Revize 58
Přidáno uživatelem kenod před více než 16 roky(ů)
freenetis/trunk/kohana/application/controllers/ports.php | ||
---|---|---|
//=============================================================================
|
||
function show_all($limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC')
|
||
{
|
||
$iface_model = new Iface_Model();
|
||
/*print_r($segment_model);
|
||
die();*/
|
||
//---- delete session device ----
|
||
$this->session->del('ssDevice_id');
|
||
|
||
$total_ifaces = $iface_model->count_all_ifaces(); // count all members in database
|
||
$port_model = new Port_Model();
|
||
|
||
$total_ports = $port_model->count_all_ports(); // count all ports in database
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
... | ... | |
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_ifaces) ? 0 : $sql_offset;
|
||
$sql_offset = ($sql_offset>$total_ports) ? 0 : $sql_offset;
|
||
|
||
//die();
|
||
|
||
$query = $iface_model->select(array('devices.name as device_name', 'segments.name as segment_name', 'ifaces.*'))->join('devices', 'devices.id = ifaces.device_id')->join('segments', 'segments.id = ifaces.segment_id')->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all();
|
||
//$query = $port_model->select(array('devices.name as device_name', 'segments.name as segment_name', 'ports.*'))->join('devices', 'devices.id = ports.device_id')->join('segments', 'segments.id = ports.segment_id')->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all();
|
||
$query = $port_model->get_all_ports($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'ifaces', null,array(
|
||
$grid = new Grid(url_lang::base().'ports', null,array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
... | ... | |
'selector_increace' => 10, // increace
|
||
'selector_min' => 10, // minimum where selector start
|
||
'selector_max_multiplier' => 5,
|
||
'base_url' => Config::item('locale.lang').'/devices/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'base_url' => Config::item('locale.lang').'/ports/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_ifaces, // use db count query here of course
|
||
'total_items' => $total_ports, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
... | ... | |
'limit_results' => $limit_results
|
||
));
|
||
|
||
$grid->add_new_button('ifaces/add', url_lang::lang('texts.Add new interface'));
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->add_new_button('ports/add', url_lang::lang('texts.Add new port'));
|
||
$grid->order_field('id')->label('ID')->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.name'));
|
||
$grid->order_field('device_name')->label(url_lang::lang('texts.Device name'));
|
||
$grid->order_field('segment_name')->label(url_lang::lang('texts.Segment name'));
|
||
$grid->order_field('comment')->label(url_lang::lang('texts.comment'));
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ifaces/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
$grid->order_field('vlan_count')->label(url_lang::lang('texts.Vlans'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ports/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ports/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
|
||
$grid->datasource( $query );
|
||
$this->template->content = $grid;
|
||
// echo
|
||
|
||
|
||
$view = new View('template');
|
||
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
$view->content = $this->template->content;
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->title = "Úprava uživatele";
|
||
$view->header->title = url_lang::lang('texts.Ports list');
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('show_all');
|
||
$view->content->table = $this->template->content;
|
||
$view->content->headline = url_lang::lang('texts.Ports list');
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
//----- end SHOW_ALL ----------------------------------------------------------
|
||
... | ... | |
//=============================================================================
|
||
//----- SHOW ------------------------------------------------------------------
|
||
//=============================================================================
|
||
function show($iface_id = null)
|
||
function show($port_id = null)
|
||
{
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
|
||
$iface = new Iface_Model($iface_id);
|
||
$port = new Port_Model($port_id);
|
||
|
||
if (!isset($iface_id) || $iface->id == 0) {
|
||
if (!isset($port_id) || $port->id == 0) {
|
||
Controller::error();
|
||
}
|
||
//print_r($ifaces);
|
||
|
||
if ($ssDevice_id) $link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
else $link_back = html::anchor(url_lang::base().'ports/show_all', url_lang::lang('texts.Back to ports list'));
|
||
|
||
|
||
//----------- list of VLANS ---------------
|
||
|
||
$query = $port->find_related_vlans();
|
||
$grid_vlans = new Grid(url_lang::base().'ports', null,array(
|
||
'separator' => '',
|
||
'use_paginator' => false,
|
||
'use_selector' => false
|
||
));
|
||
|
||
$grid_vlans->field('id')->label('ID')->class('center');
|
||
$grid_vlans->field('name')->label(url_lang::lang('texts.Port name'));
|
||
$grid_vlans->field('tag_802_1q')->label(url_lang::lang('texts.tag_802_1q'));
|
||
$grid_vlans->field('comment')->label(url_lang::lang('texts.comment'));
|
||
$grid_vlans->datasource( $query );
|
||
|
||
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
$view->header->title = url_lang::lang('texts.Port detail').' - '.$port->name;
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('show_iface');
|
||
$view->content->segment = $iface;
|
||
$view->content = new View('show_port');
|
||
$view->content->port = $port;
|
||
$view->content->table_vlans = $grid_vlans;
|
||
$view->content->headline = url_lang::lang('texts.Port detail').' - '.$port->name;
|
||
$view->content->link_back = $link_back;
|
||
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->title = url_lang::lang('texts.Interface detail').' - '.$iface->name;
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->render(TRUE);
|
||
}
|
||
//----- end SHOW --------------------------------------------------------------
|
||
... | ... | |
//=============================================================================
|
||
function add()
|
||
{
|
||
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
|
||
$form = new Forge(url_lang::base()."ports/add/", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic data'));
|
||
|
||
$form->input('name')->label(url_lang::lang('texts.Ports name').':')->rules('required|length[3,250]');
|
||
$form->input('name')->label(url_lang::lang('texts.Ports name').':')->rules('required|length[3,200]');
|
||
|
||
if ($ssDevice_id = $this->session->get('ssDevice_id'))
|
||
if ($ssDevice_id)
|
||
{
|
||
$device = new Device_Model($ssDevice_id);
|
||
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options(array($ssDevice_id => $device->name))->rules('required');
|
||
}
|
||
else
|
||
{
|
||
|
||
$device_model = new Device_Model();
|
||
$devices = $device_model->select(array('id','name'))->orderby('name')->find_all();
|
||
$arr_devices[0] = '----- '.url_lang::lang('texts.select device').' -----';
|
||
foreach ($devices as $device) {
|
||
$arr_devices[$device->id] = $device->name;
|
||
}
|
||
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required');
|
||
}
|
||
|
||
$segment_model = new Segment_Model();
|
||
$segments = $segment_model->select(array('id','name'))->orderby('id')->find_all();
|
||
$segments = $segment_model->select(array('id','name'))->orderby('name')->find_all();
|
||
$arr_segments[0] = '----- '.url_lang::lang('texts.select segment').' -----';
|
||
foreach ($segments as $segment) {
|
||
$arr_segments[$segment->id] = $segment->name;
|
||
}
|
||
|
||
$vlan_model = new Vlan_Model();
|
||
$vlans = $vlan_model->select(array('id','name'))->orderby('name')->find_all();
|
||
$arr_vlans[0] = '----- '.url_lang::lang('texts.select vlan').' -----';
|
||
foreach ($vlans as $vlan) {
|
||
$arr_vlans[$vlan->id] = $vlan->name;
|
||
}
|
||
|
||
$form->dropdown('segment_id')->label(url_lang::lang('texts.Segment name'))->options($arr_segments)->rules('required');
|
||
|
||
$form->dropdown('vlan_id[]')->label(url_lang::lang('texts.Vlan name'))->options($arr_vlans)->multiple('multiple')->id('vlan_id');
|
||
|
||
$form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
... | ... | |
//----- validate form and save data -----------------------------------
|
||
if($form->validate())
|
||
{
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
$port = new Port_Model();
|
||
$arr_vlan_id = array();
|
||
if(isset($_POST['vlan_id'])) $arr_vlan_id = $_POST['vlan_id'];
|
||
|
||
$port = new Port_Model();
|
||
|
||
$port->name = $form_data['name'];
|
||
$port->device_id = $form_data['device_id'];
|
||
$port->segment_id = $form_data['segment_id'];
|
||
|
||
|
||
$saved = $port->save();
|
||
|
||
if ($saved) {
|
||
$vlans = new Ports_vlan_Model();
|
||
foreach ($arr_vlan_id as $vlan_id) {
|
||
if ($vlan_id == 0) break;
|
||
$vlans->vlan_id = $vlan_id;
|
||
$vlans->port_id = $port->id;
|
||
$vlans->save();
|
||
$vlans->clear();
|
||
}
|
||
}
|
||
unset($form_data);
|
||
|
||
if ($port->save()) {
|
||
$this->session->set_flash('save', url_lang::lang('texts.Port is successfully saved.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$ssDevice_id, 'redirect');
|
||
|
||
if ($saved) {
|
||
$this->session->set_flash('message', url_lang::lang('texts.Port is successfully saved.'));
|
||
url::redirect(url_lang::base().'ports/show/'.$port->id, 'redirect');
|
||
exit;
|
||
}
|
||
|
||
}
|
||
//----- end validate --------------------------------------------------
|
||
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
if ($ssDevice_id) $link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
else $link_back = html::anchor(url_lang::base().'ports/show_all', url_lang::lang('texts.Back to ports list'));
|
||
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
... | ... | |
$view->content = new View('form');
|
||
$view->content->form = $form->html();
|
||
$view->content->link_back = $link_back;
|
||
$view->content->headline = url_lang::lang('texts.Interface - create new interface');
|
||
$view->content->headline = url_lang::lang('texts.Create new port');
|
||
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->title = url_lang::lang('texts.Add new device');
|
||
$view->header->title = url_lang::lang('texts.Create new port');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->render(TRUE);
|
||
}
|
||
... | ... | |
//=============================================================================
|
||
//----- EDIT ------------------------------------------------------------------
|
||
//=============================================================================
|
||
function icontrol ()
|
||
{
|
||
function edit($port_id = null)
|
||
{
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
|
||
}
|
||
function edit($port_id = null)
|
||
{
|
||
$port = new Port_Model($port_id);
|
||
|
||
if (!isset($port_id) || $port->id == 0) {
|
||
... | ... | |
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic data'));
|
||
|
||
$device_model = new Device_Model();
|
||
$devices = $device_model->select(array('id','name'))->orderby('id')->find_all();
|
||
foreach ($devices as $device) {
|
||
$arr_devices[$device->id] = $device->name;
|
||
$form->input('name')->label(url_lang::lang('texts.Port name').':')->rules('required|length[3,200]')->value($port->name);
|
||
|
||
if ($ssDevice_id)
|
||
{
|
||
$device = new Device_Model($ssDevice_id);
|
||
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options(array($ssDevice_id => $device->name))->rules('required');
|
||
}
|
||
else
|
||
{
|
||
|
||
$device_model = new Device_Model();
|
||
$devices = $device_model->select(array('id','name'))->orderby('id')->find_all();
|
||
$arr_devices[0] = '----- '.url_lang::lang('texts.select device').' -----';
|
||
foreach ($devices as $device) {
|
||
$arr_devices[$device->id] = $device->name;
|
||
}
|
||
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required')->selected($port->device_id);
|
||
}
|
||
|
||
|
||
$segment_model = new Segment_Model();
|
||
$segments = $segment_model->select(array('id','name'))->orderby('id')->find_all();
|
||
foreach ($segments as $segment) {
|
||
$arr_segments[$segment->id] = $segment->name;
|
||
}
|
||
|
||
$vlan_model = new Vlan_Model();
|
||
$vlans = $vlan_model->select(array('id','name'))->orderby('name')->find_all();
|
||
$arr_vlans[0] = '----- '.url_lang::lang('texts.select vlan').' -----';
|
||
foreach ($vlans as $vlan) {
|
||
$arr_vlans[$vlan->id] = $vlan->name;
|
||
}
|
||
|
||
$vlans = '';
|
||
$vlans = $port->find_related_vlans();
|
||
$i=0;
|
||
foreach ($vlans as $vlan) {
|
||
$arr_vlan_id_sel[$i] = $vlan->id;
|
||
$i++;
|
||
}
|
||
|
||
$form->dropdown('segment_id')->label(url_lang::lang('texts.Segment name'))->options($arr_segments)->rules('required')->selected($port->segment_id);
|
||
|
||
$form->dropdown('vlan_id[]')->label(url_lang::lang('texts.Vlan name'))->options($arr_vlans)->multiple('multiple')->id('vlan_id');
|
||
|
||
$form->input('name')->label(url_lang::lang('texts.Port name').':')->rules('required|length[3,250]')->value($port->name);
|
||
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required')->selected($port->device_id);
|
||
$form->dropdown('segment_id')->label(url_lang::lang('texts.Segment name'))->options($arr_segments)->rules('required')->selected($port->segment_id);
|
||
|
||
$form->submit('submit')->value(url_lang::lang('texts.update'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
... | ... | |
//----- validate form and save data -----------------------------------
|
||
if($form->validate())
|
||
{
|
||
|
||
$form_data = $form->as_array();
|
||
|
||
$port = new Port_Model($port_id);
|
||
$arr_vlan_id = array();
|
||
if(isset($_POST['vlan_id'])) $arr_vlan_id = $_POST['vlan_id'];
|
||
|
||
$port = new Port_Model($port_id);
|
||
|
||
$port->name = $form_data['name'];
|
||
$port->device_id = $form_data['device_id'];
|
||
$port->segment_id = $form_data['segment_id'];
|
||
|
||
|
||
$ports_vlans_model = new Ports_vlan_Model();
|
||
$ports_vlans = $ports_vlans_model->find_all_by_port_id($port_id);
|
||
foreach ($ports_vlans as $vlan) {
|
||
$vlan->delete();
|
||
}
|
||
|
||
$saved = $port->save();
|
||
|
||
/*print_r($form_data);
|
||
die();*/
|
||
if ($saved) {
|
||
$vlans = new Ports_vlan_Model();
|
||
foreach ($arr_vlan_id as $vlan_id) {
|
||
if ($vlan_id == 0) break;
|
||
$vlans->vlan_id = $vlan_id;
|
||
$vlans->port_id = $port->id;
|
||
$vlans->save();
|
||
$vlans->clear();
|
||
}
|
||
}
|
||
unset($form_data);
|
||
|
||
if ($port->save()) {
|
||
$this->session->set_flash('update', url_lang::lang('texts.Port is successfully updated.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$port->device_id, 'redirect');
|
||
|
||
if ($saved) {
|
||
$this->session->set_flash('message', url_lang::lang('texts.Port is successfully updated.'));
|
||
url::redirect(url_lang::base().'ports/show/'.$port->id, 'redirect');
|
||
exit;
|
||
}
|
||
|
||
}
|
||
//----- end validate --------------------------------------------------
|
||
|
||
if ($ssDevice_id) $link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
else $link_back = html::anchor(url_lang::base().'ports/show_all', url_lang::lang('texts.Back to ports list'));
|
||
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
|
||
$view->content = new View('form');
|
||
$view->content->form = $form->html();
|
||
$view->content->link_back = html::anchor(url_lang::base().'segments/show/'.$port_id, url_lang::lang('texts.Back to detail'));
|
||
$view->content->headline = url_lang::lang('texts.Interface - Edit interface');
|
||
$view->content->link_back = $link_back;
|
||
$view->content->headline = url_lang::lang('texts.Edit port').' - '.$port->name;
|
||
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->header->title = url_lang::lang('texts.Add new device');
|
||
$view->header->title = url_lang::lang('texts.Edit port').' - '.$port->name;
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->render(TRUE);
|
||
}
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
<?php
|
||
|
||
class Controller extends Controller_Core {
|
||
protected $gacl_class;
|
||
public $gacl_class;
|
||
private $myMenu;
|
||
public $arr;
|
||
public $arr;
|
||
|
||
public function __construct(){
|
||
|
||
... | ... | |
{
|
||
// Not logged in - redirect to login page
|
||
$this->session->set_flash('err_message', url_lang::lang('texts.Must be logged in'));
|
||
url::redirect(url_lang::base().'login', 'redirect');
|
||
url::redirect(url_lang::base().'login');
|
||
die();
|
||
}
|
||
require_once('application/vendors/phpgacl/gacl.class.php');
|
||
... | ... | |
{
|
||
|
||
//verze 2
|
||
$this->myMenu = '';
|
||
/*$this->myMenu = '';
|
||
$model = new Menu_Model;
|
||
$i = 0;
|
||
foreach($model->find_all() as $menu){
|
||
... | ... | |
$i++;
|
||
}
|
||
$myMenu = $this->create_menu($arr,0);
|
||
return str_replace('<ul></ul>', '', $myMenu);
|
||
|
||
return str_replace('<ul></ul>', '', $myMenu);*/
|
||
|
||
if ($this->session->get('member_login')==$this->session->get('username')) $url = 'members/show/'.$this->session->get('member_id');
|
||
else $url = 'users/show/'.$this->session->get('user_id');
|
||
|
||
$myMenu = '';
|
||
$myMenu .= '<ul>';
|
||
|
||
$myMenu .= ' <li class="account"><h2>'.url_lang::lang('texts.My account').'</h2>
|
||
<ul>
|
||
<li>'.html::anchor(url_lang::base().$url, url_lang::lang('texts.My account')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'members/users/'.$this->session->get('member_id'), url_lang::lang('texts.My users')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/transfers/'.$this->session->get('member_id'), url_lang::lang('texts.My transfers')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'devices/show_my', url_lang::lang('texts.My devices')).'</li>
|
||
</ul>
|
||
</li>
|
||
<li class="transfer"><h2>'.url_lang::lang('texts.Transfers').'</h2>
|
||
<ul>
|
||
<li>'.html::anchor(url_lang::base().'accounts/unidentified_transfers/', url_lang::lang('texts.Unidentified transfers')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/works/uncorfirmed/', url_lang::lang('texts.Unconfirmed works')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/main_accounts/master', url_lang::lang('texts.Bank account')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'accounts/main_accounts/infrastructure', url_lang::lang('texts.Infrastructure account')).'</li>
|
||
</ul>
|
||
</li>
|
||
<li class="users"><h2>'.url_lang::lang('texts.Users').'</h2>
|
||
<ul>
|
||
<li>'.html::anchor(url_lang::base().'users', url_lang::lang('texts.Users')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'members', url_lang::lang('texts.Members')).'</li>
|
||
</ul>
|
||
</li>
|
||
<li class="networks"><h2>'.url_lang::lang('texts.Networks').'</h2>
|
||
<ul>
|
||
<li>'.html::anchor(url_lang::base().'devices', url_lang::lang('texts.Devices')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'segments', url_lang::lang('texts.Segments')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'ifaces', url_lang::lang('texts.Interfaces')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'ports', url_lang::lang('texts.Ports')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'vlan_ifaces', url_lang::lang('texts.Vlan interfaces')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'vlans', url_lang::lang('texts.Vlans')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'ip_addresses', url_lang::lang('texts.IP addresses')).'</li>
|
||
<li>'.html::anchor(url_lang::base().'subnets', url_lang::lang('texts.Subnets')).'</li>
|
||
</ul>
|
||
</li>
|
||
';
|
||
|
||
$myMenu .= '</ul>';
|
||
|
||
return $myMenu;
|
||
|
||
}
|
||
|
||
public function create_menu($arr,$master)
|
||
... | ... | |
|
||
|
||
public function error($message = null)
|
||
{
|
||
if (is_numeric($message))
|
||
{
|
||
switch ($message) {
|
||
case 1:
|
||
$message = url_lang::lang('texts.You dont have the permissions.');
|
||
break;
|
||
|
||
}
|
||
}
|
||
if (!isset($message)) $message = url_lang::lang('texts.ID is required.');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Error'.' - '.$message);
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('errors');
|
||
$view->content->required = $message;
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
exit;
|
||
}
|
||
{
|
||
if (is_numeric($message))
|
||
{
|
||
switch ($message) {
|
||
case 1:
|
||
$message = url_lang::lang('texts.You dont have the permissions.');
|
||
break;
|
||
|
||
}
|
||
}
|
||
if (!isset($message)) $message = url_lang::lang('texts.ID is required.');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Error'.' - '.$message);
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('errors');
|
||
$view->content->required = $message;
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
exit;
|
||
}
|
||
|
||
public function insert_phpgacl($user_id,$username,$value,$group, $is_edit = false)
|
||
{
|
||
// $aro_data = new Aro_Model();
|
||
$aro_group_data = new Group_aro_map_Model();
|
||
switch ($group) {
|
||
case 'member':
|
||
$group_id = 22;
|
||
break;
|
||
case 'wannabe':
|
||
$group_id = 23;
|
||
break;
|
||
default:
|
||
$group_id = 33;
|
||
break;
|
||
}
|
||
|
||
|
||
$group_arr = array();
|
||
/*
|
||
$aro = array();
|
||
$aro['value'] = $value;
|
||
$aro['name'] = $username;
|
||
$aro['section_value'] = 'all';
|
||
*/
|
||
$group_arr['group_id'] = $group_id;
|
||
|
||
if ($is_edit)
|
||
{
|
||
// editation of phpgacl ARO
|
||
// $aro_data->insert_aro($aro,$user_id);
|
||
|
||
$aro_group_data->insert_data($group_arr, $user_id);
|
||
}
|
||
else
|
||
{
|
||
/* $aro['id'] = $user_id;
|
||
$aro_data->insert_aro($aro);
|
||
*/
|
||
$group_arr['aro_id'] = $user_id;
|
||
$aro_group_data->insert_data($group_arr);
|
||
}
|
||
}
|
||
public function insert_phpgacl($user_id,$username,$value,$group, $is_edit = false)
|
||
{
|
||
// $aro_data = new Aro_Model();
|
||
$aro_group_data = new Group_aro_map_Model();
|
||
switch ($group) {
|
||
case 'member':
|
||
$group_id = 22;
|
||
break;
|
||
case 'wannabe':
|
||
$group_id = 23;
|
||
break;
|
||
default:
|
||
$group_id = 33;
|
||
break;
|
||
}
|
||
|
||
|
||
$group_arr = array();
|
||
/*
|
||
$aro = array();
|
||
$aro['value'] = $value;
|
||
$aro['name'] = $username;
|
||
$aro['section_value'] = 'all';
|
||
*/
|
||
$group_arr['group_id'] = $group_id;
|
||
|
||
if ($is_edit)
|
||
{
|
||
// editation of phpgacl ARO
|
||
// $aro_data->insert_aro($aro,$user_id);
|
||
|
||
$aro_group_data->insert_data($group_arr, $user_id);
|
||
}
|
||
else
|
||
{
|
||
/* $aro['id'] = $user_id;
|
||
$aro_data->insert_aro($aro);
|
||
*/
|
||
$group_arr['aro_id'] = $user_id;
|
||
$aro_group_data->insert_data($group_arr);
|
||
}
|
||
}
|
||
|
||
}
|
||
?>
|
||
?>
|
Také k dispozici: Unified diff