Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 188

Přidáno uživatelem Michal Kliment před více než 15 roky(ů)

Kompletne predelane pristupove prava.

Zobrazit rozdíly:

freenetis/trunk/kohana/application/vendors/phpgacl/gacl.ini.php
;
db_type = "mysql"
db_host = "localhost"
db_user = "root"
db_password = ""
db_name = "freenetis2"
db_user = "freenetis"
db_password = "bcac568614812719"
db_name = "freenetis"
db_table_prefix = ""
;
freenetis/trunk/kohana/application/controllers/ifaces.php
$this->session->del('ssDevice_id');
$this->session->del('ssIface_id');
if(!$this->acl_check_view('Devices_Controller','iface')) Controller::error(1);
$iface_model = new Iface_Model();
$total_ifaces = $iface_model->count_all_ifaces(); // count all members in database
......
'limit_results' => $limit_results
));
$grid->add_new_button(url_lang::base().'ifaces/add', url_lang::lang('texts.Add new interface'));
if ($this->acl_check_new('Devices_Controller','iface'))
$grid->add_new_button(url_lang::base().'ifaces/add', url_lang::lang('texts.Add new interface'));
$grid->order_field('id')->label('ID');
$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->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
if ($this->acl_check_view('Devices_Controller','iface'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','iface'))
$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->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;
......
{
$ssDevice_id = $this->session->get('ssDevice_id');
$iface = new Iface_Model($iface_id);
$iface = new Iface_Model($iface_id);
$member_id = $iface->device->user->member_id;
if (!$this->acl_check_view('Devices_Controller','iface',$member_id)) Controller::error(1);
if (is_null($iface->segment_id)) $iface->segment_id="NULL";
if (!isset($iface_id) || $iface->id == 0) {
Controller::warning(1);
......
'use_selector' => false
));
$grid_ip_addresses->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
if ($this->acl_check_new('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
$grid_ip_addresses->field('id')->label('ID')->class('center');
$grid_ip_addresses->field('IP_address')->label(url_lang::lang('texts.IP address'));
$grid_ip_addresses->field('subnet_name')->label(url_lang::lang('texts.Subnet name'));
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Delete')) ->url(url_lang::base().'ip_addresses/delete') ->action(url_lang::lang('texts.Delete'))->class('center');
if ($this->acl_check_view('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
//$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Delete')) ->url(url_lang::base().'ip_addresses/delete') ->action(url_lang::lang('texts.Delete'))->class('center');
$grid_ip_addresses->datasource( $query );
......
'use_selector' => false
));
$grid_VLAN_ifaces->add_new_button(url_lang::base().'vlan_ifaces/add', url_lang::lang('texts.Add new VLAN interface'));
if ($this->acl_check_new('Devices_Controller','vlan_iface',$member_id))
$grid_VLAN_ifaces->add_new_button(url_lang::base().'vlan_ifaces/add', url_lang::lang('texts.Add new VLAN interface'));
$grid_VLAN_ifaces->field('id')->label('ID')->class('center');
$grid_VLAN_ifaces->field('name')->label(url_lang::lang('texts.Name'));
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlan_ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlan_ifaces/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
if ($this->acl_check_view('Devices_Controller','vlan_iface',$member_id))
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlan_ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','vlan_iface',$member_id))
$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlan_ifaces/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
//$grid_VLAN_ifaces->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
$grid_VLAN_ifaces->datasource( $query );
if ($ssDevice_id) $link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
......
$form->input('name')->label(url_lang::lang('texts.Interface name').':')->rules('required|length[3,250]');
$member_id = NULL;
if ($ssDevice_id)
{
$device = new Device_Model($ssDevice_id);
$member_id = $device->user->member_id;
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options(array($ssDevice_id => $device->name))->rules('required');
}
......
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required');
}
if (!$this->acl_check_new('Devices_Controller','iface',$member_id)) Controller::error(1);
$segment_model = new Segment_Model();
$segments = $segment_model->select(array('id','name'))->orderby('name')->find_all();
$arr_segments[0] = '----- '.url_lang::lang('texts.select segment').' -----';
......
if (!isset($iface_id) || $iface->id == 0) {
Controller::warning(1);
}
if (!$this->acl_check_edit('Devices_Controller','iface',$iface->device->user->member_id)) Controller::error(1);
$form = new Forge(url_lang::base()."ifaces/edit/".$iface_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
freenetis/trunk/kohana/application/controllers/members.php
if (!$this->acl_check_2D('freenetis', 'view_all')) Controller::error(1);
if (!$this->acl_check_view(get_class($this),'members')) Controller::Error(1);
// get new selector
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
......
'query_string' => $query_string
));
if ($this->acl_check_2D('freenetis', 'new_all'))
if ($this->acl_check_new(get_class($this), 'members'))
$grid->add_new_button(url_lang::base().'members/add', url_lang::lang('texts.Add new member'));
//$grid->order_field('member_id')->label('ID');
$grid->order_field('id')->label('ID');
......
$grid->order_field('street_number')->label(url_lang::lang('texts.Street number'));
//$grid->order_field('phone')->label(url_lang::lang('texts.Phone'));
$grid->order_field('town')->label(url_lang::lang('texts.Town'));
$grid->action_field('id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/show') ->action(url_lang::lang('texts.Show'));
if ($this->acl_check_2D('freenetis', 'edit_all'))
if ($this->acl_check_view(get_class($this), 'members'))
$grid->action_field('id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/show') ->action(url_lang::lang('texts.Show'));
if ($this->acl_check_edit(get_class($this), 'members'))
//if ($this->acl_check_2D('freenetis', 'edit_all'))
$grid->action_field('id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/edit') ->action(url_lang::lang('texts.Edit'));
// if ($this->acl_check_2D('freenetis', 'delete_all'))
......
if (isset($member_id))
{
if(!$this->acl_check_view(get_class($this),'members',$member_id)) Controller::Error(1);
$model_members = new Member_Model();
$member_data = $model_members->get_member($member_id)->current();
// print_r($member_data);
......
$model_translation = new Translation_Model();
$member_type = $model_translation->get_translation($member_data->member_type);
if ($member_id == $_SESSION['member_id'])
{
if (!$this->acl_check_2D('freenetis', 'view_own')) Controller::error(1);
}
else
{
if (!$this->acl_check_2D('freenetis', 'view_all')) Controller::error(1);
}
$model_contacts = new Contact_Model();
$contacts = $model_contacts->find_all_by_user_id($member_data->id);
......
));
if ($this->acl_check_2D('freenetis', 'new_own'))
if($this->acl_check_new('Users_Controller','users',$member_id))
$grid->add_new_button(url_lang::base().'users/add/'.$member_id, url_lang::lang('texts.Add new user'));
$grid->add_back_button(url_lang::lang('texts.Back'));
$grid->order_field('id','id')->label('ID');
......
$grid->order_field('surname','surname')->label(url_lang::lang('texts.Surname'));
$grid->order_field('login','login')->label(url_lang::lang('texts.Username'));
$grid->order_field('email','email')->label('E-mail');
$grid->action_field('id') ->label(url_lang::lang('texts.Show'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
$grid->action_field('id') ->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'users/edit')->action(url_lang::lang('texts.Edit'));
if($this->acl_check_view('Users_Controller','users',$member_id))
$grid->action_field('id') ->label(url_lang::lang('texts.Show'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
if($this->acl_check_edit('Users_Controller','users',$member_id))
$grid->action_field('id') ->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'users/edit')->action(url_lang::lang('texts.Edit'));
// $grid->action_field('id') ->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');;
$grid->datasource( $users );
$this->template->content = $grid;
......
function add()
{
if (!$this->acl_check_2D('freenetis', 'new_all')) Controller::error(1);
if (!$this->acl_check_new(get_class($this),'members')) Controller::error(1);
$enum_types=new Enum_type_Model();
$types=$enum_types->get_values(Enum_type_Model::id_type_of_member);
......
->callback(array($this, 'valid_email'));
$form->group('')->label(url_lang::lang('texts.Account informations'));
//$form->dropdown('acctype')->label(url_lang::lang('texts.Account type').':')->options(array('analytic'=>url_lang::lang('texts.Double entry account'),'bank'=>url_lang::lang('texts.Bank account')));
if ($this->acl_check_3D('freenetis', 'new_all', 'add_current_credit'))
if ($this->acl_check_new(get_class($this),'current_credit'))
$form->input('current_credit')->label(url_lang::lang('texts.Current credit').':')->rules('valid_numeric');
$form->input('entrance_fee')->label(url_lang::lang('texts.Entrance fee').':')->rules('valid_numeric');
$form->input('entrance_fee_left')->label(url_lang::lang('texts.Entrance fee left').':')->rules('valid_numeric');
......
$form->date('birthday')->label(url_lang::lang('texts.birthday').':')->years(date('Y')-100, date('Y'))->rules('required');
$form->date('entrance_date')->label(url_lang::lang('texts.Entrance date').':')->years(date('Y')-100, date('Y'))->rules('required');
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]');
if ($this->acl_check_3D('freenetis', 'new_all', 'add_must_pay')) $form->radio('must_pay_regular_fee')->label(url_lang::lang('texts.Must pay regular fee').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default(1);
if ($this->acl_check_new(get_class($this),'must_pay'))
$form->radio('must_pay_regular_fee')->label(url_lang::lang('texts.Must pay regular fee').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default(1);
$form->submit('submit')->value(url_lang::lang('texts.Add'));
special::required_forge_style($form, ' *', 'required');
......
$account_data->type = 'analytic';
$account_data->name = $form_data['membername'];
if ($this->acl_check_3D('freenetis', 'new_all', 'add_current_credit')) $account_data->start_amount = $form_data['current_credit'];
if ($this->acl_check_new(get_class($this),'current_credit'))
$account_data->start_amount = $form_data['current_credit'];
//print_r($member_data);die();
$user_data->name = $form_data['name'];
......
$member_data->entrance_fee = $form_data['entrance_fee'];
$member_data->entrance_fee_left = $form_data['entrance_fee_left'];
$member_data->debt_payment_rate = $form_data['debt_payment_rate'];
if ($this->acl_check_3D('freenetis', 'new_all', 'add_current_credit')) $member_data->current_credit = $form_data['current_credit'];
if ($this->acl_check_3D('freenetis', 'new_all', 'add_must_pay')) $member_data->must_pay_regular_fee = $form_data['must_pay_regular_fee'];
if ($this->acl_check_new(get_class($this),'current_credit'))
$member_data->current_credit = $form_data['current_credit'];
if ($this->acl_check_new(get_class($this),'must_pay'))
$member_data->must_pay_regular_fee = $form_data['must_pay_regular_fee'];
$member_saved = $member_data->save();
$user_data->member_id = $member_data->id;
......
$user_model->select('id, login')
->where('type=','member')
->find_by_member_id($member_id);
if ($member_id == $_SESSION['member_id'])
{
if (!$this->acl_check_2D('freenetis', 'edit_own')) Controller::error(1);
}
else
{
if (!$this->acl_check_2D('freenetis', 'edit_all')) Controller::error(1);
}
if (!$this->acl_check_edit(get_class($this),'members')) Controller::error(1);
$this->user_id = $user_model->id;
unset($user_model);
......
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic informations'));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_username'))
if ($this->acl_check_edit('Users_Controller','login',$member_id))
$form->input('login')->label(url_lang::lang('texts.username').':')
->rules('required|length[3,50]')
->callback(array($this, 'valid_username'))
->value($member_data->login);
$form->input('pre_title')->label(url_lang::lang('texts.pre title').':')->rules('length[3,40]')->value($member_data->pre_title);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_name'))
if ($this->acl_check_edit('Users_Controller','name',$member_id))
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,30]')->value($member_data->name);
$form->input('middle_name')->label(url_lang::lang('texts.middle name').':')->rules('length[3,30]')->value($member_data->middle_name);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_surname'))
if ($this->acl_check_edit('Users_Controller','surname',$member_id))
$form->input('surname')->label(url_lang::lang('texts.surname').':')->rules('required|length[3,60]')->value($member_data->surname);
$form->input('post_title')->label(url_lang::lang('texts.post title').':')->rules('length[3,30]')->value($member_data->post_title);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type')) {
if ($this->acl_check_edit(get_class($this),'type',$member_id))
{
$enum_types=new Enum_type_Model();
$types=$enum_types->get_values(Enum_type_Model::id_type_of_member);
$form->dropdown('type')->label(url_lang::lang('texts.Type').':')
->options($types)
->selected($member_data->typem);
}
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_membersname'))
if ($this->acl_check_edit(get_class($this),'name',$member_id))
$form->input('membername')->label(url_lang::lang('texts.Members firstname and surname').':')->rules('required|length[3,60]')->value($member_data->namem);
$form->group('')->label(url_lang::lang('texts.Contact informations'));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_address'))
if ($this->acl_check_edit(get_class($this),'address',$member_id))
{
$form->input('street')->label(url_lang::lang('texts.street').':')->rules('required|length[1,200]')->value($member_data->street);
$form->input('street_number')->label(url_lang::lang('texts.street number').':')->rules('required|length[1,50]')->value($member_data->street_number);
$form->input('town')->label(url_lang::lang('texts.town').':')->rules('required|length[3,200]')->value($member_data->town);
$form->input('zip_code')->label(url_lang::lang('texts.zip code').':')->rules('required|length[5,10]')->value($member_data->ZIP_code);
}
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_phone')) $form->input('phone')->label(url_lang::lang('texts.phone').':')->rules('required|length[3,40]')->callback(array($this, 'valid_phone'))->value($member_data->phone);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_email'))
if ($this->acl_check_edit('Users_Controller','phone',$member_id))
$form->input('phone')->label(url_lang::lang('texts.phone').':')->rules('required|length[3,40]')->callback(array($this, 'valid_phone'))->value($member_data->phone);
if ($this->acl_check_edit('Users_Controller','email',$member_id))
$form->input('email')->label(url_lang::lang('texts.email').':')
->rules('length[3,50]|valid_email')
->callback(array($this, 'valid_email'))->value($member_data->email);
$form->group('')->label(url_lang::lang('texts.Account informations'));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_currentcredit'))
if ($this->acl_check_edit(get_class($this),'currentcredit',$member_id))
$form->input('current_credit')->label(url_lang::lang('texts.Current credit').':')->rules('valid_numeric')->value($member_data->current_credit);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_en_fee'))
if ($this->acl_check_edit(get_class($this),'en_fee',$member_id))
$form->input('entrance_fee')->label(url_lang::lang('texts.Entrance fee').':')->rules('valid_numeric')->value($member_data->entrance_fee);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_en_fee_left'))
if ($this->acl_check_edit(get_class($this),'en_fee_left',$member_id))
$form->input('entrance_fee_left')->label(url_lang::lang('texts.Entrance fee left').':')->rules('valid_numeric')->value($member_data->entrance_fee_left);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_debit'))
if ($this->acl_check_edit(get_class($this),'debit',$member_id))
$form->input('debt_payment_rate')->label(url_lang::lang('texts.Debit payment rate').':')->rules('valid_numeric')->value($member_data->debt_payment_rate);
$form->group('')->label(url_lang::lang('texts.Completive informations'));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_qos_ceil'))
if ($this->acl_check_edit(get_class($this),'qos_ceil',$member_id))
$form->input('qos_ceil')->label(url_lang::lang('texts.qos ceil').':')->rules('valid_numeric')->value($member_data->qos_ceil);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_qos_rate'))
if ($this->acl_check_edit(get_class($this),'qos_rate',$member_id))
$form->input('qos_rate')->label(url_lang::lang('texts.qos rate').':')->rules('valid_numeric')->value($member_data->qos_rate);
$form->date('birthday')->label(url_lang::lang('texts.birthday').':')->years(date('Y')-100, date('Y'))->rules('required')->value(strtotime($member_data->birthday));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_entrance_date'))
if ($this->acl_check_edit(get_class($this),'entrance_date',$member_id))
$form->date('entrance_date')->label(url_lang::lang('texts.Entrance date').':')->years(date('Y')-100, date('Y'))->rules('required')->value(strtotime($member_data->entrance_date));
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_comment'))
if ($this->acl_check_edit(get_class($this),'comment',$member_id))
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($member_data->comment);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_must_pay'))
if ($this->acl_check_edit(get_class($this),'must_pay',$member_id))
$form->radio('must_pay_regular_fee')->label(url_lang::lang('texts.Must pay regular fee').':')->options(array('1'=>url_lang::lang('texts.Yes'),'0'=>url_lang::lang('texts.No')))->default((int)$member_data->must_pay_regular_fee);
$form->submit('submit')->value(url_lang::lang('texts.Edit'));
......
$user_data->find_by_member_id($member_id);
//print_r($member_data);die();
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_name'))
if ($this->acl_check_edit(get_class($this),'name',$member_id))
$user_data->name = $form_data['name'];
$user_data->middle_name = $form_data['middle_name'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_username'))
if ($this->acl_check_edit('Users_Controller','login',$member_id))
$user_data->login = $form_data['login'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_surname'))
if ($this->acl_check_edit('Users_Controller','surname',$member_id))
$user_data->surname = $form_data['surname'];
$user_data->pre_title = $form_data['pre_title'];
$user_data->post_title = $form_data['post_title'];
$user_data->birthday = date("Y-m-d",$form_data['birthday']);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_phone'))
if ($this->acl_check_edit('Users_Controller','phone',$member_id))
$user_data->phone = $form_data['phone'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_email'))
if ($this->acl_check_edit('Users_Controller','email',$member_id))
$user_data->email = $form_data['email'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type'))
if ($this->acl_check_edit(get_class($this),'type',$member_id))
$member_data->type = $form_data['type'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_comment'))
$member_data->comment = $form_data['comment'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_entrance_date'))
if ($this->acl_check_edit(get_class($this),'comment',$member_id))
$member_data->comment = $form_data['comment'];
if ($this->acl_check_edit(get_class($this),'entrance_date',$member_id))
$member_data->entrance_date = date("Y-m-d",$form_data['entrance_date']);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_membersname'))
$member_data->name = $form_data['membername'];;
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_address')) {
if ($this->acl_check_edit(get_class($this),'name',$member_id))
$member_data->name = $form_data['membername'];
if ($this->acl_check_edit(get_class($this),'address',$member_id)) {
$member_data->street = $form_data['street'];
$member_data->street_number = $form_data['street_number'];
$member_data->town = $form_data['town'];
$member_data->ZIP_code = $form_data['zip_code'];
}
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_qos_ceil'))
if ($this->acl_check_edit(get_class($this),'qos_ceil',$member_id))
$member_data->qos_ceil = $form_data['qos_ceil'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_qos_rate'))
if ($this->acl_check_edit(get_class($this),'qos_rate',$member_id))
$member_data->qos_rate = $form_data['qos_rate'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_en_fee'))
if ($this->acl_check_edit(get_class($this),'en_fee',$member_id))
$member_data->entrance_fee = $form_data['entrance_fee'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_en_fee_left'))
if ($this->acl_check_edit(get_class($this),'en_fee_left',$member_id))
$member_data->entrance_fee_left = $form_data['entrance_fee_left'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_debit'))
if ($this->acl_check_edit(get_class($this),'debit',$member_id))
$member_data->debt_payment_rate = $form_data['debt_payment_rate'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_currentcredit'))
if ($this->acl_check_edit(get_class($this),'currentcredit',$member_id))
$member_data->current_credit = $form_data['current_credit'];
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_must_pay'))
if ($this->acl_check_edit(get_class($this),'must_pay',$member_id))
$member_data->must_pay_regular_fee = $form_data['must_pay_regular_fee'];
$member_saved = $member_data->save();
$user_data->member_id = $member_data->id;
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type')) Controller::insert_phpgacl($user_data->id,$user_data->surname.' '.$user_data->name,$user_data->login,$form_data['type'], true);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type'))
Controller::insert_phpgacl($user_data->id,$user_data->surname.' '.$user_data->name,$user_data->login,$form_data['type'], true);
unset($form_data);
if ($member_saved && $user_data->save())
{
......
$this->session->set_flash('message', url_lang::lang('texts.Error - cant update member.'));
}
url::redirect(url_lang::base().'members/show/'.(int)$member_id);
}
else
{
......
function registration($limit_results = 500, $page = 1)
{
if (!$this->acl_check_2D('menu', 'registration_admin')) Controller::error(1);
if (!$this->acl_check_edit(get_class($this), 'registration')) Controller::error(1);
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'],get_class($this),'view_all_registrations')) Controller::error(1);
if ($this->input->post('registrationsubmit')!='')
{
freenetis/trunk/kohana/application/controllers/users.php
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
{
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'])) Controller::error(1);
if (!$this->acl_check_view(get_class($this),'users')) Controller::error(1);
// get new selector
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
......
$grid->order_field('login')->label(url_lang::lang('texts.Username'));
$grid->order_field('email')->label('E-mail');
$grid->order_field('member_name')->label(url_lang::lang('texts.Member'));
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
if ($this->acl_check_view(get_class($this),'users'))
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
if ($this->acl_check_edit(get_class($this),'users'))
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
$grid->datasource( $dotaz );
......
if (!isset($member_id)) {
Controller::warning(1);
} else {
if(!$this->acl_check_view(get_class($this),'users',$member_id)) Controller::error(1);
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'])) Controller::error(1);
// get new selector
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
......
$grid->order_field('surname')->label(url_lang::lang('texts.Surname'));
$grid->order_field('login')->label(url_lang::lang('texts.Username'));
$grid->order_field('email')->label('E-mail');
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
if ($this->acl_check_view(get_class($this),'users',$member_id))
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
if ($this->acl_check_edit(get_class($this),'users',$member_id))
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
$grid->datasource( $dotaz );
......
if (!$this->gacl_class->acl_check('freenetis', 'delete_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if ($user_model->delete())
{
$this->session->set_flash('message', url_lang::lang('texts.User successfully deleted.'));
......
$user_model=new User_Model();
$user_model->find($user_id);
$this->user_id = $user_id;
if ($user_model->login == $_SESSION['username'] || $user_model->member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'])) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'edit_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if(!$this->acl_check_edit(get_class($this),'users',$user_model->member_id)) Controller::error(1);
$form = new Forge(url_lang::base().'users/edit/'.$user_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic informations'));
if ($this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_username'))
if ($this->acl_check_edit(get_class($this),'login',$user_model->member_id))
$form->input('username')->label(url_lang::lang('texts.username').':')
->rules('required|length[3,50]')
->callback(array($this, 'valid_username'))->value($user_model->login);
......
$form->input('surname')->label(url_lang::lang('texts.surname').':')->rules('required|length[3,60]')->value($user_model->surname);
$form->input('post_title')->label(url_lang::lang('texts.post title').':')->rules('length[3,30]')->value($user_model->post_title);
$form->group('')->label(url_lang::lang('texts.Contact informations'));
if ($this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_phone'))
if ($this->acl_check_edit(get_class($this),'phone',$user_model->member_id))
$form->input('phone')
->label(url_lang::lang('texts.phone').':')
->rules('required|length[3,40]')->callback(array($this, 'valid_phone'))->value($user_model->phone);
if ($this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_email'))
if ($this->acl_check_edit(get_class($this),'email',$user_model->member_id))
$form->input('email')->label(url_lang::lang('texts.email').':')
->rules('length[3,50]|valid_email')
->value($user_model->email);
$form->group('')->label(url_lang::lang('texts.Completive informations'));
$form->date('birthday')->label(url_lang::lang('texts.birthday').':')->years(date('Y')-100, date('Y'))->rules('required')->value(strtotime($user_model->birthday));
if ($this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_comment')) $form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($user_model->comment);
if ($this->acl_check_edit(get_class($this),'comment',$user_model->member_id))
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]')->value($user_model->comment);
$form->submit('submit')->value(url_lang::lang('texts.Edit'));
special::required_forge_style($form, ' *', 'required');
......
$user_data = new User_Model;
$user_data->find($user_id);
$form_data['birthday'] = date("Y-m-d",$form_data['birthday']);
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_username'))
if ($this->acl_check_edit(get_class($this),'login',$user_data->member_id))
$form_data['login'] = $form_data['username'];
foreach($form_data as $key => $value)
......
if (isset($user_id))
{
$model_users = new User_Model($user_id);
if ($model_users->login == $_SESSION['username'] || $model_users->member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'])) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if (!$this->acl_check_view(get_class($this),'users',$model_users->member_id)) Controller::error(1);
$model_contacts = new Contact_Model();
$contacts = $model_contacts->find_all_by_user_id($user_id);
......
),'work_grid_template');
if ($this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'],get_class($this),'add_work')) $grid->add_new_button(url_lang::base().'users/add_work/'.$user_id, url_lang::lang('texts.Add new work'));
if ($this->acl_check_new(get_class($this),'work',$model_users->member_id))
$grid->add_new_button(url_lang::base().'users/add_work/'.$user_id, url_lang::lang('texts.Add new work'));
$grid->field('id')->label('ID');
$grid->field('description')->label(url_lang::lang('texts.Description'));
......
function add($member_id = null)
{
if ($member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'])) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'new_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if (!$this->acl_check_new(get_class($this),'users',$member_id)) Controller::error(1);
if (isset($member_id))
{
$form = new Forge(url_lang::base().'users/add/'.$member_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic informations'));
// KONTROLA PRAV PHPGACL if ($this->gacl_class->acl_check('freenetis', 'edit', 'all', 'mara', get_class($this), 'surname'))
$form->input('username')->label(url_lang::lang('texts.username').':')
->rules('required|length[3,50]')
->callback(array($this, 'valid_username'));
if ($this->acl_check_new(get_class($this),'login',$member_id))
$form->input('username')->label(url_lang::lang('texts.username').':')
->rules('required|length[3,50]')
->callback(array($this, 'valid_username'));
$form->input('pre_title')->label(url_lang::lang('texts.pre title').':')->rules('length[3,40]');
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,30]');
......
$form->input('email')->label(url_lang::lang('texts.email').':')->rules('length[3,50]|valid_email')->callback(array($this, 'valid_email'));
$form->group('')->label(url_lang::lang('texts.Completive informations'));
$form->date('birthday')->label(url_lang::lang('texts.birthday').':')->years(date('Y')-100, date('Y'))->rules('required');
if ($this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'add_comment')) $form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]');
if ($this->acl_check_new(get_class($this),'comment',$member_id))
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,250]');
$form->submit('submit')->value(url_lang::lang('texts.Add'));
special::required_forge_style($form, ' *', 'required');
......
function aditional_contacts ($user_id = null)
{
$model_users = new User_Model($user_id);
if ($user_id == $_SESSION['user_id'] || $model_users->member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'])) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if (!$this->acl_check_edit(get_class($this),'aditional_contacts',$model_users->member_id)) Controller::error(1);
if (isset($user_id))
{
$model_contacts = new Contact_Model();
......
{
if (isset($user_id))
{
$user = new User_Model($user_id);
if (!$this->acl_check_edit(get_class($this),'password',$user->member_id)) Controller::error(1);
$this->user_id = $user_id;
$form = new Forge(url_lang::base()."users/chngpass/".$user_id, '', 'POST', array('id' => 'article_form'));
......
function add_work($user_id = null)
{
$model_users = new User_Model($user_id);
if ($user_id == $_SESSION['user_id'] || $model_users->member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'view_own', 'all', $_SESSION['username'],get_class($this),'add_work')) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'new_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if (!$this->acl_check_new(get_class($this),'work',$model_users->member_id)) Controller::error(1);
if (isset($user_id))
{
......
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic informations'));
// KONTROLA PRAV PHPGACL if ($this->gacl_class->acl_check('freenetis', 'edit', 'all', 'mara', get_class($this), 'surname'))
$form->textarea('description')->label(url_lang::lang('texts.Description').':')->rules('required|length[0,250]');
$form->input('hours')->label(url_lang::lang('texts.Number of the hours').':')->rules('required|length[0,10]|valid_numeric');
......
{
$work_data = new Job_Model($work_id);
$model_users = new User_Model($work_data->user_id);
if ($work_data->user_id == $_SESSION['user_id'] || $model_users->member_id == $_SESSION['member_id'])
{
if (!$this->gacl_class->acl_check('freenetis', 'edit_own', 'all', $_SESSION['username'],get_class($this),'edit_work')) Controller::error(1);
}
else
{
if (!$this->gacl_class->acl_check('freenetis', 'edit_all', 'all', $_SESSION['username'])) Controller::error(1);
}
if (!$this->acl_check_edit(get_class($this),'work',$model_users->member_id)) Controller::error(1);
$form = new Forge(url_lang::base().'users/edit_work/'.$work_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic informations'));
// KONTROLA PRAV PHPGACL if ($this->gacl_class->acl_check('freenetis', 'edit', 'all', 'mara', get_class($this), 'surname'))
$form->textarea('description')->label(url_lang::lang('texts.Description').':')->rules('required|length[0,250]')->value($work_data->description);
$form->input('hours')->label(url_lang::lang('texts.Number of the hours').':')->rules('required|length[0,10]|valid_numeric')->value($work_data->hours);
freenetis/trunk/kohana/application/controllers/works.php
function uncorfirmed()
{
if (!$this->gacl_class->acl_check('freenetis', 'view_all', 'all', $_SESSION['username'],get_class($this),'work_confirm')) Controller::error(1);
if (!$this->acl_check_new('Users_Controller', 'work')) Controller::error(1);
$work_data = new Job_Model();
$unc_works = $work_data->where('confirmed_by_id IS NULL')->find_all();
freenetis/trunk/kohana/application/controllers/ip_addresses.php
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
{
if (!$this->acl_check_view('Devices_Controller','ip_address')) Controller::error(1);
//---- delete session device and Iface ----
$this->session->del('ssDevice_id');
$this->session->del('ssIface_id');
......
'query_string' => $this->input->get()
));
$grid->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
if ($this->acl_check_new('Devices_Controller','ip_address'))
$grid->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('IP_address')->label(url_lang::lang('texts.ip addresses'));
//$grid->order_field('subnet_name')->label(url_lang::lang('texts.Subnet name'));
......
$grid->order_field('device_name')->label(url_lang::lang('texts.Device name'));
$grid->order_field('user_name')->label(url_lang::lang('texts.User'));
//$grid->order_field('vlan_iface_name')->label(url_lang::lang('texts.VLAN interface name'));
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/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');
if ($this->acl_check_view('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/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 );
......
$ip_address = new Ip_address_Model($ip_address_id);
$member_id = $ip_address->iface->device->user->member_id;
if (!isset($ip_address_id) || $ip_address->id == 0) {
Controller::warning(1);
}
if (!$this->acl_check_view('Devices_Controller','ip_address',$member_id)) Controller::error(1);
$view = new View('template');
$view->header = new View('base/header');
......
$iface_model = new Iface_Model();
$vlan_iface_model = new Vlan_iface_Model();
$member_id = NULL;
if ($ssVlan_iface_id) {
$ifaces = $vlan_iface_model->select('id','name')->orderby('name')->find_all_by_id($ssVlan_iface_id);
$default = 'VLAN';
}
elseif ($ssIface_id) {
$ifaces = $iface_model->select('id','name')->orderby('name')->find_all_by_id($ssIface_id);
$ifaces = $iface_model->orderby('name')->find_all_by_id($ssIface_id);
$default = 'iface';
foreach($ifaces as $iface) $member_id = $iface->device->user->member_id;
}
else {
$ifaces = $iface_model->select('id','name')->orderby('name')->find_all();
$arr_ifaces[0] = '----- '.url_lang::lang('texts.select interface').' -----';
}
if (!$this->acl_check_new('Devices_Controller', 'ip_address',$member_id)) Controller::error(1);
foreach ($ifaces as $iface) {
$arr_ifaces[$iface->id] = $iface->name;
}
$subnet_model = new Subnet_Model();
$subnets = $subnet_model
->select("id","name","network_address as net_str",
......
//=============================================================================
function edit($ip_address_id = null)
{
//---- Get variable for narrow selecting of selectbox ----
$ssDevice_id = $this->session->get('ssDevice_id');
$ssIface_id = $this->session->get('ssIface_id');
......
Controller::warning(1);
}
$member_id = NULL;
if($ip_address->iface->id) $member_id = $ip_address->iface->device->user->member_id;
else if ($ip_address->vlan_iface->id) $member_id = $ip_address->vlan_iface->iface->device->user->member_id;
if (!$this->acl_check_edit('Devices_Controller', 'ip_address', $member_id)) Controller::error(1);
$form = new Forge(url_lang::base()."ip_addresses/edit/".$ip_address_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
freenetis/trunk/kohana/application/controllers/ports.php
//---- delete session device ----
$this->session->del('ssDevice_id');
if(!$this->acl_check_view('Devices_Controller','port')) Controller::error(1);
$port_model = new Port_Model();
$total_ports = $port_model->count_all_ports(); // count all ports in database
......
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
));
$grid->add_new_button(url_lang::base().'ports/add', url_lang::lang('texts.Add new port'));
if ($this->acl_check_new('Devices_Controller','port'))
$grid->add_new_button(url_lang::base().'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('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');
if ($this->acl_check_view('Devices_Controller','port'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ports/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','port'))
$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;
......
Controller::warning(1);
}
if ($ssDevice_id) $link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
$member_id = NULL;
if ($ssDevice_id)
{
$link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
$device = new Device_Model($ssDevice_id);
$member_id = $device->user->member_id;
}
else $link_back = html::anchor(url_lang::base().'ports/show_all', url_lang::lang('texts.Back to ports list'));
if(!$this->acl_check_view('Devices_Controller','port',$member_id)) Controller::error(1);
//----------- list of VLANS ---------------
$query = $port->find_related_vlans();
......
//=============================================================================
function add()
{
$ssDevice_id = $this->session->get('ssDevice_id');
$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->input('name')->label(url_lang::lang('texts.Port name').':')->rules('required|length[3,200]');
$member_id = NULL;
if ($ssDevice_id)
{
$device = new Device_Model($ssDevice_id);
$member_id = $device->user->member_id;
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options(array($ssDevice_id => $device->name))->rules('required');
}
else
......
}
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required');
}
if (!$this->acl_check_new('Devices_Controller','port',$member_id)) Controller::Error(1);
$segment_model = new Segment_Model();
$segments = $segment_model->select(array('id','name'))->orderby('name')->find_all();
......
$form->group('')->label(url_lang::lang('texts.Basic data'));
$form->input('name')->label(url_lang::lang('texts.Port name').':')->rules('required|length[3,200]')->value($port->name);
$member_id = NULL;
if ($ssDevice_id)
{
$device = new Device_Model($ssDevice_id);
$member_id = $device->user->member_id;
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options(array($ssDevice_id => $device->name))->rules('required');
}
else
......
$form->dropdown('device_id')->label(url_lang::lang('texts.Device name'))->options($arr_devices)->rules('required')->selected($port->device_id);
}
if (!$this->acl_check_edit('Devices_Controller','port',$member_id)) Controller::error(1);
$segment_model = new Segment_Model();
$segments = $segment_model->select(array('id','name'))->orderby('id')->find_all();
freenetis/trunk/kohana/application/controllers/vlan_ifaces.php
$this->session->del('ssDevice_id');
$this->session->del('ssIface_id');
if (!$this->acl_check_view('Devices_Controller','vlan_iface')) Controller::error(1);
$vlan_iface_model = new Vlan_iface_Model();
$total_vlan_ifaces = $vlan_iface_model->count_all_vlan_ifaces(); // count all members in database
......
'limit_results' => $limit_results
));
$grid->add_new_button(url_lang::base().'vlan_ifaces/add', url_lang::lang('texts.Add new VLAN interface'));
if ($this->acl_check_new('Devices_Controller','vlan_iface'))
$grid->add_new_button(url_lang::base().'vlan_ifaces/add', url_lang::lang('texts.Add new VLAN interface'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('name')->label(url_lang::lang('texts.name'));
$grid->order_field('iface_name')->label(url_lang::lang('texts.Interface name'));
$grid->order_field('vlan_name')->label(url_lang::lang('texts.VLAN name'));
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlan_ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlan_ifaces/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');
if ($this->acl_check_view('Devices_Controller','vlan_iface'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlan_ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','vlan_iface'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlan_ifaces/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;
......
//=============================================================================
function show($vlan_iface_id = null)
{
$ssIface_id = $this->session->get('ssIface_id');
$vlan_iface = new Vlan_iface_Model($vlan_iface_id);
......
Controller::warning(1);
}
$member_id = $vlan_iface->iface->device->user->member_id;
if(!$this->acl_check_view('Devices_Controller','vlan_iface',$member_id)) Controller::error(1);
$this->session->set('ssVlan_iface_id',$vlan_iface->id);
//----------- list of IP ADDRESSES ---------------
......
'use_selector' => false
));
$grid_ip_addresses->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
if ($this->acl_check_new('Devices_Controller','ip_address'))
$grid_ip_addresses->add_new_button(url_lang::base().'ip_addresses/add', url_lang::lang('texts.Add new IP address'));
$grid_ip_addresses->field('id')->label('ID')->class('center');
$grid_ip_addresses->field('IP_address')->label(url_lang::lang('texts.IP address'));
$grid_ip_addresses->field('subnet_name')->label(url_lang::lang('texts.Subnet name'));
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
if ($this->acl_check_view('Devices_Controller','ip_address'))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'ip_addresses/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
//$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');
$grid_ip_addresses->datasource( $query );
......
//=============================================================================
function add()
{
$ssDevice_id = $this->session->get('ssDevice_id');
$ssIface_id = $this->session->get('ssIface_id');
......
$form->input('name')->label(url_lang::lang('texts.VLAN interface name').':')->rules('required|length[3,250]');
$member_id = NULL;
if ($ssIface_id)
{
$iface = new Iface_Model($ssIface_id);
$member_id = $iface->device->user->member_id;
$form->dropdown('iface_id')->label(url_lang::lang('texts.Interface name'))->options(array($ssIface_id => $iface->name))->rules('required');
}
......
$form->dropdown('iface_id')->label(url_lang::lang('texts.Interface name'))->options($arr_ifaces)->rules('required');
}
if (!$this->acl_check_new('Devices_Controller','vlan_iface',$member_id)) Controller::error(1);
$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').' -----';
......
//=============================================================================
function edit($vlan_iface_id = null)
{
$ssDevice_id = $this->session->get('ssDevice_id');
$ssIface_id = $this->session->get('ssIface_id');
$ssVlan_iface_id = $this->session->get('ssVlan_iface_id');
......
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,250]')->value($vlan_iface->name);
$member_id = NULL;
if ($ssIface_id)
{
$iface = new Iface_Model($ssIface_id);
$member_id = $iface->device->user->member_id;
$form->dropdown('iface_id')->label(url_lang::lang('texts.Interface name'))->options(array($ssIface_id => $iface->name))->rules('required');
}
......
$form->dropdown('iface_id')->label(url_lang::lang('texts.Interface name'))->options($arr_ifaces)->rules('required')->selected($vlan_iface->iface_id);
}
if (!$this->acl_check_edit('Devices_Controller','vlan_iface',$member_id)) Controller::error(1);
$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').' -----';
freenetis/trunk/kohana/application/controllers/devices.php
$device_model = new Device_Model;
if (!$this->acl_check_view(get_class($this),'devices')) Controller::error(1);
$member_id = NULL;
if (is_numeric($this->input->get('member_id'))) $member_id = $this->input->get('member_id');
......
));
if ($member->id) $grid->add_new_button(url_lang::base().'devices/show_all', url_lang::lang('texts.Back to list of all devices'));
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.Add new device'));
if ($this->acl_check_new(get_class($this),'devices'))
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.Add new device'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('name')->label(url_lang::lang('texts.name'));
$grid->order_field('type')->label(url_lang::lang('texts.type'));
$grid->order_field('u_name')->label(url_lang::lang('texts.user'));
$grid->order_field('iface_count')->label(url_lang::lang('texts.ifaces'))->class('center');
$grid->order_field('port_count')->label(url_lang::lang('texts.ports'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'devices/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');
if ($this->acl_check_view(get_class($this),'devices'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'devices'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'devices/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;
......
function show_by_member($member_id=NULL, $limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
{
url::redirect(url_lang::base().'devices/show_all?member_id='.$member_id);
/**if (!isset($member_id)) {
if (!isset($member_id)) {
Controller::warning(1);
} else {
if (!$this->acl_check_view(get_class($this),'devices',$member_id)) Controller::error(1);
$device_model = new Device_Model;
$member = new Member_Model($member_id);
......
'url_array_ofset' => 1
));
$grid->add_new_button(url_lang::base().'devices/add', url_lang::lang('texts.add new device').' ');
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.add new whole device'));
if ($this->acl_check_new(get_class($this),'devices',$member_id))
$grid->add_new_button(url_lang::base().'devices/add_whole', url_lang::lang('texts.add new device').' ');
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.back to the member'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('name')->label(url_lang::lang('texts.name'));
......
$grid->order_field('u_name')->label(url_lang::lang('texts.user'));
$grid->order_field('iface_count')->label(url_lang::lang('texts.ifaces'))->class('center');
$grid->order_field('port_count')->label(url_lang::lang('texts.ports'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'devices/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');
if ($this->acl_check_view(get_class($this),'devices',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'devices/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'devices',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'devices/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;
......
$view->render(TRUE);
}
**/
}
//----- end show_by_member ----------------------------------------------------------
......
if (!isset($device_id) || $device->id == 0) {
Controller::warning(1);
}
$member_id = $device->user->member_id;
if (!$this->acl_check_view(get_class($this),'devices',$member_id)) Controller::error(1);
$ssMember_id = $this->session->get('ssMember_id');
......
'use_selector' => false
));
$grid->add_new_button(url_lang::base().'device_admins/add', url_lang::lang('texts.Add new device admin'));
if ($this->acl_check_new(get_class($this),'admin',$member_id))
$grid->add_new_button(url_lang::base().'device_admins/add', url_lang::lang('texts.Add new device admin'));
$grid->field('id')->label('ID')->class('center');
$grid->field('name')->label(url_lang::lang('texts.name'));
$grid->field('surname')->label(url_lang::lang('texts.surname'));
$grid->field('login')->label(url_lang::lang('texts.username'));
$grid->action_field('user_id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'device_admins/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');;
if ($this->acl_check_view(get_class($this),'admin',$member_id))
$grid->action_field('user_id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'admin',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'device_admins/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 );
$grid_device_admins = $grid;
unset($grid);
......
'use_selector' => false
));
$grid->add_new_button(url_lang::base().'ifaces/add', url_lang::lang('texts.Add new interface'));
if ($this->acl_check_new(get_class($this),'iface',$member_id))
$grid->add_new_button(url_lang::base().'ifaces/add', url_lang::lang('texts.Add new interface'));
$grid->field('id')->label('ID')->class('center');
$grid->field('name')->label(url_lang::lang('texts.name'));
$grid->field('MAC')->label(url_lang::lang('texts.MAC'));
$grid->field('segment_name')->label(url_lang::lang('texts.Segment name'));
$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->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');;
if ($this->acl_check_view(get_class($this),'iface',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ifaces/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'iface',$member_id))
$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->action_field('id')->label(url_lang::lang('texts.Delete')) ->url('delete') ->action(url_lang::lang('texts.Delete'))->class('center');;
$grid->datasource( $query );
$grid_ifaces = $grid;
unset($grid);
......
'use_selector' => false
));
$grid->add_new_button(url_lang::base().'ports/add', url_lang::lang('texts.Add new port'));
if ($this->acl_check_new(get_class($this),'port',$member_id))
$grid->add_new_button(url_lang::base().'ports/add', url_lang::lang('texts.Add new port'));
$grid->field('id')->label('ID')->class('center');
$grid->field('name')->label(url_lang::lang('texts.Port name'));
$grid->field('segment_name')->label(url_lang::lang('texts.Segment name'));
$grid->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');
if ($this->acl_check_view(get_class($this),'port',$member_id))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'ports/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'port',$member_id))
$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 );
$grid_ports = $grid;
......
$submenu .= html::anchor(url_lang::base().'ip_addresses/add/', url_lang::lang('texts.add new IP address')).' | ';
$submenu .= html::anchor(url_lang::base().'devices/add/', url_lang::lang('texts.add new VLAN iface')).' | ';
$view = new View('template');
$view->header = new View('base/header');
// $view->content = new View('content', $data);
......
//----- ADD -------------------------------------------------------------------
//=============================================================================
function add()
{
{
$ssMember_id = $this->session->get('ssMember_id');
$ssMember_id = $this->session->get('ssMember_id');
if (!$this->acl_check_new(get_class($this),'devices',$ssMember_id)) Controller::error(1);
$form = new Forge(url_lang::base()."devices/add", '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
......
if (!isset($device_id) || $device->id == 0) {
Controller::warning(1);
}
if (!$this->acl_check_edit(get_class($this),'devices',$device->user->member_id)) Controller::error(1);
$form = new Forge(url_lang::base()."devices/edit/".$device_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
......
$ssMember_id = $this->session->get('ssMember_id');
if (!$this->acl_check_new(get_class($this),'devices',$ssMember_id)) Controller::error(1);
$form = new Forge(url_lang::base()."devices/add_whole", '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
freenetis/trunk/kohana/application/controllers/subnets.php
//=============================================================================
function show_all($limit_results = 400, $order_by = 'id', $order_by_direction = 'ASC')
{
if (!$this->acl_check_view('Devices_Controller', 'subnet')) Controller::error(1);
$subnet_model = new Subnet_Model();
$total_subnets = $subnet_model->count_all_subnets(); // count all members in database
......
'limit_results' => $limit_results
));
$grid->add_new_button(url_lang::base().'subnets/add', url_lang::lang('texts.Add new subnet'));
if ($this->acl_check_new('Devices_Controller', 'subnet'))
$grid->add_new_button(url_lang::base().'subnets/add', url_lang::lang('texts.Add new subnet'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('name')->label(url_lang::lang('texts.name'));
$grid->order_field('network_address')->label(url_lang::lang('texts.Network address'));
$grid->order_field('netmask')->label(url_lang::lang('texts.Netmask'));
$grid->order_field('OSPF_area_id')->label(url_lang::lang('texts.OSPF area ID'));
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'subnets/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'subnets/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');
if ($this->acl_check_view('Devices_Controller', 'subnet'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'subnets/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller', 'subnet'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'subnets/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;
......
Controller::warning(1);
}
if (!$this->acl_check_view('Devices_Controller', 'subnet')) Controller::error(1);
$view = new View('template');
......
{
$subnet = new Subnet_Model();
if (!$this->acl_check_new('Devices_Controller', 'subnet')) Controller::error(1);
$form = new Forge(url_lang::base()."subnets/add/", '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
......
Controller::warning(1);
}
if (!$this->acl_check_edit('Devices_Controller', 'subnet')) Controller::error(1);
$this->form=$form = new Forge(url_lang::base()."subnets/edit/".$subnet_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
freenetis/trunk/kohana/application/controllers/vlans.php
//=============================================================================
function show_all($limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC')
{
if (!$this->acl_check_view('Devices_Controller','vlan')) Controller::error(1);
$vlan_model = new Vlan_Model();
$total_vlans = $vlan_model->count_all_vlans(); // count all members in database
......
'limit_results' => $limit_results
));
$grid->add_new_button(url_lang::base().'vlans/add', url_lang::lang('texts.Add new vlan'));
if ($this->acl_check_new('Devices_Controller','vlan'))
$grid->add_new_button(url_lang::base().'vlans/add', url_lang::lang('texts.Add new vlan'));
$grid->order_field('id')->label('ID')->class('center');
$grid->order_field('name')->label(url_lang::lang('texts.Vlan name'));
$grid->order_field('tag_802_1q')->label(url_lang::lang('texts.tag_802_1q'));
$grid->order_field('vlan_ifaces_count')->label(url_lang::lang('texts.Vlan ifaces'))->class('center');
$grid->order_field('ports_count')->label(url_lang::lang('texts.Ports'))->class('center');
$grid->order_field('comment')->label(url_lang::lang('texts.comment'));
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlans/show') ->action(url_lang::lang('texts.Show'))->class('center');
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlans/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');
if ($this->acl_check_view('Devices_Controller','vlan'))
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'vlans/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','vlan'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'vlans/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;
......
{
$vlan = new Vlan_Model($vlan_id);
$ports_vlan_model = new Ports_vlan_Model();
if (!isset($vlan_id) || $vlan->id == 0) {
Controller::warning(1);
}
if (!$this->acl_check_view('Devices_Controller','vlan')) Controller::error(1);
//----------- list of PORTS ---------------
$ports = new Port_Model();
$query = $vlan->find_related_ports();
$query = $ports_vlan_model->where('vlan_id',$vlan_id)->find_all();
//$query = $ports->select(array('ports_vlans.id as port_id', 'ports.*'))->join('ports_vlans', 'ports_vlans.port_id = ports.id')->orderby('id','ASC')->find_all();
$grid_ports = new Grid(url_lang::base().'vlans', null,array(
'separator' => '',
......
$grid_ports->field('id')->label('ID')->class('center');
$grid_ports->field('name')->label(url_lang::lang('texts.Port name'));
$grid_ports->datasource( $query );
$view = new View('template');
$view->header = new View('base/header');
......
function add()
{
if (!$this->acl_check_new('Devices_Controller','vlan')) Controller::error(1);
$vlan = new vlan_Model();
$form = new Forge(url_lang::base()."vlans/add", '', 'POST', array('id' => 'article_form'));
......
Controller::warning(1);
}
if (!$this->acl_check_edit('Devices_Controller','vlan')) Controller::error(1);
$form = new Forge(url_lang::base()."vlans/edit/".$vlan_id, '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
freenetis/trunk/kohana/application/controllers/segments.php
//=============================================================================
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
{
if (!$this->acl_check_view('Devices_Controller','segment')) Controller::error(1);
$segment_model = new Segment_Model();
$total_segments = $segment_model->count_all_segments(); // count all members in database
......
'limit_results' => $limit_results
));
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff