Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 121

Přidáno uživatelem Michal Kliment před asi 16 roky(ů)

Opravena chyba u metody show_by_member u controlleru devices - grid
nepocital s promennou member_id, pri zmene razeni podle jednotlivych
sloupcu volal dalsi funkce bez teto promenne - ve vysledku
Kohana skoncila errorem

Zobrazit rozdíly:

freenetis/trunk/kohana/application/controllers/devices.php
$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;
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
unset($url_array);
$query = $device_model->get_all_by_member($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $member_id);
$total_devices=$device_model->count_last_query();
......
'selector_increace' => 500, // increace
'selector_min' => 500, // minimum where selector start
'selector_max_multiplier' => 10,
'base_url' => Config::item('locale.lang').'/devices/show_my/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
'base_url' => Config::item('locale.lang').'/devices/show_by_member/'.$member_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
'total_items' => $total_devices, // 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,
'order_by_direction' => $order_by_direction,
'limit_results' => $limit_results
'limit_results' => $limit_results,
'variables' => $member_id.'/',
'url_array_ofset' => 1
));
$grid->order_field('id')->label('ID')->class('center');
......
if (!isset($device_id) || $device->id == 0) {
Controller::error();
}
$enum_type_model = new Enum_type_Model();
}
$enum_type_model = new Enum_type_Model();
$device_type = $enum_type_model->get_value($device->type);
$this->session->set('ssDevice_id',$device->id);
......
$user_model = new User_Model;
$iface_model = new Iface_Model;
$ip_model = new Ip_address_Model;
$subnet_model = new Subnet_Model;
$subnet_model = new Subnet_Model;
$device_engineer_model = new Device_engineer_Model();
$engineers = $device_engineer_model->find_all_by_device_id($device->id);
$ifaces = $iface_model ->find_all_by_device_id($device->id);
$arr_engineers = array();
foreach($engineers as $engineer) {
$arr_engineers[] = $engineer->user->name . ' ' . $engineer->user->surname;
$ifaces = $iface_model ->find_all_by_device_id($device->id);
$arr_engineers = array();
foreach($engineers as $engineer) {
$arr_engineers[] = $engineer->user->name . ' ' . $engineer->user->surname;
}
......
$arr_ip[$i]['netmask'] = $subnet->netmask;
$i++;
}
}
$device_admin_model = new Device_admin_Model();
$query = $device_admin_model->select(array('device_admins.id as id', 'users.id as user_id', 'users.name', 'users.surname', 'users.login'))
->join('users','users.id = device_admins.user_id')
->orderby('id','ASC')
->find_all_by_device_id($device_id);
$grid = new Grid(url_lang::base().'devices', null, array(
'use_paginator' => false,
'use_selector' => false
));
}
$device_admin_model = new Device_admin_Model();
$query = $device_admin_model->select(array('device_admins.id as id', 'users.id as user_id', 'users.name', 'users.surname', 'users.login'))
->join('users','users.id = device_admins.user_id')
->orderby('id','ASC')
->find_all_by_device_id($device_id);
$grid = new Grid(url_lang::base().'devices', null, array(
'use_paginator' => false,
'use_selector' => false
));
$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('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');
......
$view->content = new View('show_device');
//$view->content->submenu = $submenu;
$view->content->headline = url_lang::lang('texts.Device detail').' - '.$device->name;
$view->content->device = $device;
$view->content->device = $device;
$view->content->device_type = $device_type;
$view->content->engineers = $arr_engineers;
$view->content->count_iface = $iface_model->count_ifaces_of_device($device->id);
$view->content->ifaces = $ifaces;
$view->content->ip_iface = $ip_iface;
$view->content->set('arr_ip',$arr_ip);
$view->content->set('arr_ip',$arr_ip);
$view->content->table_device_admins = $grid_device_admins;
$view->content->table_ifaces = $grid_ifaces;
$view->content->table_ports = $grid_ports;
......
foreach ($users as $user) {
$arr_users[$user->id] = $user->surname.' '.$user->name.' - '.$user->login;
}
asort($arr_users);
$enum_type_model = new Enum_type_Model();
$types = $enum_type_model->get_values(Enum_type_Model::id_type_of_device);
asort($arr_users);
$enum_type_model = new Enum_type_Model();
$types = $enum_type_model->get_values(Enum_type_Model::id_type_of_device);
$form->dropdown('user_id')->label(url_lang::lang('texts.user'))->options($arr_users)->rules('required');
$form->input('name')->label(url_lang::lang('texts.Device name').':')->rules('required|length[3,250]');
......
foreach ($users as $user) {
$arr_users[$user->id] = $user->surname.' '.$user->name.' - '.$user->login;
}
asort($arr_users);
$enum_type_model = new Enum_type_Model();
$types = $enum_type_model->get_values(Enum_type_Model::id_type_of_device);
asort($arr_users);
$enum_type_model = new Enum_type_Model();
$types = $enum_type_model->get_values(Enum_type_Model::id_type_of_device);
$form->dropdown('user_id')->label(url_lang::lang('texts.user'))->options($arr_users)->rules('required')->selected($device->user_id);
$form->input('name')->label(url_lang::lang('texts.Device name').':')->rules('required|length[3,250]')->value($device->name);
$form->input('name')->label(url_lang::lang('texts.Device name').':')->rules('required|length[3,250]')->value($device->name);
$form->dropdown('type')->label(url_lang::lang('texts.type'))->options($types)->rules('required')->selected($device->type);
$form->checkbox('PPPoE_logging_in')->label(url_lang::lang('texts.PPPoE'))->value('1')->checked($device->PPPoE_logging_in);
$form->input('login')->label(url_lang::lang('texts.username').':')->rules('length[0,250]')->value($device->login);
......
//----- end EDIT --------------------------------------------------------------
//=============================================================================
}
?>
?>

Také k dispozici: Unified diff