Revize 402
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/states.php | ||
---|---|---|
|
||
$lang = array
|
||
(
|
||
'you dont have the permissions' => 'Nemáte dostatečná práva.',
|
||
'failed to connect to database' => 'Nepodařilo se připojit k databázi.',
|
||
'failed to send e-mail' => 'Nepodařilo se odeslat e-mail.',
|
||
'please check settings' => 'Prosím zkontrolujte nastavení.',
|
||
'parameter is required' => 'Je vyžadován parametr.',
|
||
'this group do not exist' => 'Tato skupina neexistuje.',
|
||
'page not found' => 'Strana nenalezena.'
|
||
|
||
'access denied' => 'Přístup odepřen',
|
||
'failed to connect to database' => 'Nepodařilo se připojit k databázi',
|
||
'failed to send e-mail' => 'Nepodařilo se odeslat e-mail',
|
||
'invalid parameter' => 'Chybný parametr',
|
||
'page not found' => 'Strana nenalezena',
|
||
'parameter required' => 'Vyžadován parametr',
|
||
'please check settings' => 'Prosím zkontrolujte nastavení',
|
||
'this group do not exist' => 'Tato skupina neexistuje'
|
||
|
||
);
|
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'error - some fees have not been deducted' => 'Chyba - některé členské příspěvky nebyly strženy.',
|
||
'error: parameter ID is required!' => 'Chyba: parametr ID je povinný!',
|
||
'export to xls' => 'Exportovat do XLS',
|
||
'export to csv' => 'Exportovat do CSV',
|
||
'fee' => 'Poplatek',
|
||
'export to csv (utf-8)' => 'Exportovat do CSV (utf-8)',
|
||
'export to csv (windows-1250)' => 'Exportovat do CSV (windows-1250)',
|
||
'fee' => 'Poplatek',
|
||
'fee has been successfully added' => 'Poplatek byl úspěšně uložen',
|
||
'fee has been successfully deleted' => 'Poplatek byl úspěšně smazán',
|
||
'fee has been successfully updated' => 'Poplatek byl úspěšně aktualizován',
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
// name filter
|
||
$name = '';
|
||
if (isset($filter_values['name']))
|
||
$name = 'AND a.name LIKE \'%'.$filter_values['name'].'%\' COLLATE utf8_czech_ci';
|
||
$name = 'AND a.name LIKE \'%'.$filter_values['name'].'%\' COLLATE utf8_general_ci';
|
||
// which group will be get
|
||
if ($filter_values['group'] == self::$project)
|
||
$account_attribute = 'a.account_attribute_id = '.Account_attribute_Model::$project;
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
|
||
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'));
|
||
// xls export of members
|
||
if ($this->acl_check_view(get_class($this), 'members'))
|
||
$grid->add_new_button(url_lang::base().'members/xls_export', url_lang::lang('texts.Export to XLS'));
|
||
// csv export of members
|
||
if ($this->acl_check_view(get_class($this), 'members'))
|
||
$grid->add_new_button(url_lang::base().'members/csv_export', url_lang::lang('texts.Export to CSV'));
|
||
{
|
||
// xls export of members, works fine in OpenOffice,
|
||
// but there are problems probably with encofing in MS Excel
|
||
//$grid->add_new_button(url_lang::base().'members/xls_export', url_lang::lang('texts.Export to XLS'));
|
||
// csv export of members
|
||
$grid->add_new_button(url_lang::base().'members/csv_export', url_lang::lang('texts.Export to CSV (utf-8)'));
|
||
$grid->add_new_button(url_lang::base().'members/csv_export/windows-1250', url_lang::lang('texts.Export to CSV (windows-1250)'));
|
||
}
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('registration')->label(url_lang::lang('texts.Reg'))->bool(array(url_lang::lang('texts.No'),url_lang::lang('texts.Yes')))->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
|
||
... | ... | |
if(!$this->acl_check_view(get_class($this),'members',$member_id))
|
||
Controller::Error(1);
|
||
$model_members = new Member_Model();
|
||
if (count($model_members->get_member($member_id)) == 0)
|
||
url::redirect(url_lang::base().'members/show_all');
|
||
$member_data = $model_members->get_member($member_id)->current();
|
||
$model_translation = new Translation_Model();
|
||
$member_type = $model_translation->get_translation($member_data->member_type);
|
||
... | ... | |
$mi_grid->action_field('id') ->label(url_lang::lang('texts.Membership interrupts'))->url(url_lang::base().'membership_interrupts/delete')->action(url_lang::lang('texts.Delete'));
|
||
$mi_grid->datasource($mis);
|
||
|
||
// nefungovalo to, tak jsem to zakomentoval - Jura
|
||
/*
|
||
$voip_sip = new Voip_sip_Model();
|
||
$voip = $voip_sip->get_all_record_by_member($member_id);
|
||
|
||
|
||
$voip_grid = new Grid(url_lang::base().'members', null, array(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
... | ... | |
$voip_grid->action_field('id')->label(url_lang::lang('texts.Account'))->url(url_lang::base().'voip/show')->action(url_lang::lang('texts.Show'));
|
||
$voip_grid->action_field('user_id')->label(url_lang::lang('texts.User'))->url(url_lang::base().'users/show')->action(url_lang::lang('texts.Show'));
|
||
$voip_grid->datasource($voip);
|
||
*/
|
||
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('members/show');
|
||
... | ... | |
$view->header->title = url_lang::lang('texts.Display member');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->content->users = $user_grid;
|
||
$view->content->voip = $voip_grid;
|
||
// toto taky
|
||
$view->content->voip = '';//$voip_grid;
|
||
$view->content->mis = $mi_grid;
|
||
$view->content->account_balance = $account_balance;
|
||
foreach($member_data as $key=>$val)
|
||
... | ... | |
/**
|
||
* @author Jiri Svitak
|
||
* Export list of members to xls file. Requires library PEAR.
|
||
* Works fine in OpenOffice, but there are problems probably with encoding in MS Excel.
|
||
* @return unknown_type
|
||
*/
|
||
function xls_export()
|
||
... | ... | |
/**
|
||
* @author Jiri Svitak
|
||
* Function exports list of members to csv file. Rows are separated by newlines and it columns by semicolon.
|
||
* @param encoding optional parameter; by default the result is encoded in utf-8 and encoding can change this
|
||
* @return unknown_type
|
||
*/
|
||
function csv_export()
|
||
function csv_export($encoding = null)
|
||
{
|
||
// access rights
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
... | ... | |
$member_model = new Member_Model();
|
||
$members = $member_model->get_all_members_to_export();
|
||
// set content header
|
||
header('Content-type: application/csv; charset=UTF-8');
|
||
header('Content-type: application/csv');
|
||
$filename = url_lang::lang('texts.Members').'.csv';
|
||
header('Content-Disposition: attachment; filename="'.$filename.'"');
|
||
$first = true;
|
||
// yes and no for registration
|
||
$yes = url_lang::lang('texts.yes');
|
||
$no = url_lang::lang('texts.no');
|
||
// encoding of characters
|
||
if (!isset($encoding))
|
||
$encoding = 'utf-8';
|
||
// this foreach goes through rows
|
||
foreach ($members as $line)
|
||
{
|
||
... | ... | |
{
|
||
foreach ($line as $key => $value)
|
||
{
|
||
// translation of column titles
|
||
$title = url_lang::lang('texts.'.$key);
|
||
// file cannot start with ID, otherwise excel and openoffice think that the file is invalid
|
||
if ($title == 'ID')
|
||
$title = 'Číslo';
|
||
// character encoding
|
||
if ($encoding != 'utf-8')
|
||
$title = iconv ('utf-8', $encoding, $title);
|
||
echo '"'.$title.'";';
|
||
//echo $key.';';
|
||
}
|
||
echo "\n";
|
||
$first = false;
|
||
... | ... | |
else
|
||
$value = $no;
|
||
}
|
||
// character encoding
|
||
if ($encoding != 'utf-8')
|
||
$value = iconv ('utf-8', $encoding, $value);
|
||
echo '"'.$value.'";';
|
||
}
|
||
echo "\n";
|
freenetis/trunk/kohana/application/controllers/ifaces.php | ||
---|---|---|
* Function adds new interface.
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
function add($device_id = null)
|
||
{
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
$form = new Forge(url_lang::base()."ifaces/add/", '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base()."ifaces/add/$device_id", '', '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.Interface name').':')->rules('required|length[3,250]');
|
||
$member_id = NULL;
|
||
if ($ssDevice_id)
|
||
if (isset($device_id))
|
||
{
|
||
$device = new Device_Model($ssDevice_id);
|
||
$device = new Device_Model($device_id);
|
||
if ($device->id == 0)
|
||
Controller::warning(2);
|
||
$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(array($device_id => $device->name))->rules('required');
|
||
}
|
||
else
|
||
{
|
||
... | ... | |
url::redirect(url_lang::base().'ifaces/show/'.$iface->id);
|
||
}
|
||
}
|
||
if ($ssDevice_id)
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
if (isset($device_id))
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$device_id, url_lang::lang('texts.Back to device parameters'));
|
||
else
|
||
$link_back = html::anchor(url_lang::base().'ifaces/show_all/', url_lang::lang('texts.Back to interfaces list'));
|
||
$view = new View('template');
|
||
... | ... | |
}
|
||
}
|
||
if ($ssIface_id)
|
||
$link_back = html::anchor(url_lang::base().'ifaces/show/'.$ssIface_id, url_lang::lang('texts.Back to interface parameters'));
|
||
$link_back = html::anchor(url_lang::base().'ifaces/show/'.$iface->id, url_lang::lang('texts.Back to interface parameters'));
|
||
else
|
||
$link_back = html::anchor(url_lang::base().'ifaces/show_all/', url_lang::lang('texts.Back to interfaces list'));
|
||
$view = new View('template');
|
||
... | ... | |
{
|
||
// gets information from session to know where to return
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
$iface = new Iface_Model($iface_id);
|
||
if (!$iface->id)
|
||
url::redirect(url_lang::base().'ifaces/show_all');
|
||
if ($ssDevice_id)
|
||
$link_back = url_lang::base().'devices/show/'.$ssDevice_id;
|
||
$link_back = url_lang::base().'devices/show/'.$iface->device_id;
|
||
else
|
||
$link_back = url_lang::base().'ifaces/show_all';
|
||
$iface = new Iface_Model($iface_id);
|
||
if (!$iface->id)
|
||
url::redirect($link_back);
|
||
if (!$this->acl_check_delete('Devices_Controller', 'iface', $iface->device->user->member_id))
|
||
Controller::error(1);
|
||
// find ip addresses of interface, in this relation 1:n ORM works
|
freenetis/trunk/kohana/application/controllers/device_engineers.php | ||
---|---|---|
* Adds engineer to device (creates relation between engineer and device).
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
function add($device_id = null)
|
||
{
|
||
if (!isset($device_id))
|
||
Controller::warning(1);
|
||
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
|
||
$user_model = new User_Model();
|
||
$Device_engineer_Model = new Device_engineer_Model();
|
||
if($ssDevice_id)
|
||
$engineers = $Device_engineer_Model->find_all_by_device_id($ssDevice_id);
|
||
$engineers = $Device_engineer_Model->find_all_by_device_id($device_id);
|
||
else
|
||
$engineers = array();
|
||
$users = $user_model->find_all();
|
||
... | ... | |
asort($arr_users, SORT_LOCALE_STRING);
|
||
$arr_users[0] = '----- '.url_lang::lang('texts.select user').' -----';
|
||
// form
|
||
$form = new Forge(url_lang::base()."device_engineers/add/", '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base()."device_engineers/add/$device_id", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('user_id')->label(url_lang::lang('texts.Engineer'))->options($arr_users)->rules('required')->selected(0);
|
||
$form->dropdown('user_id')->label(url_lang::lang('texts.Engineer').':')->options($arr_users)->rules('required')->selected(0);
|
||
$form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
... | ... | |
|
||
$device_engineer = new Device_engineer_Model();
|
||
$device_engineer->user_id = $form_data['user_id'];
|
||
$device_engineer->device_id = $ssDevice_id;
|
||
$device_engineer->device_id = $device_id;
|
||
unset($form_data);
|
||
if ($device_engineer->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.New device engineer has been successfully saved.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$ssDevice_id);
|
||
url::redirect(url_lang::base().'devices/show/'.$device_id);
|
||
}
|
||
}
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$device_id, url_lang::lang('texts.Back to device parameters'));
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Add new device engineer');
|
||
... | ... | |
if (isset($rel_id))
|
||
{
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
$linkback = url_lang::base()."devices/show/$ssDevice_id";
|
||
$device_engineer_model = new Device_engineer_Model();
|
||
$relations = $device_engineer_model->get_device_engineers($ssDevice_id);
|
||
$device_engineer_model = new Device_engineer_Model($rel_id);
|
||
$device_id = $device_engineer_model->device_id;
|
||
$linkback = url_lang::base()."devices/show/$device_id";
|
||
$relations = $device_engineer_model->get_device_engineers($device_id);
|
||
if ((count($relations) > 1 && $rel_id == $relations->current()->id) || count($relations) == 1)
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.First engineer cannot be removed from this device.'));
|
||
url::redirect($linkback);
|
||
}
|
||
$device_engineer_model->find($rel_id, FALSE)->delete($rel_id);
|
||
$device_engineer_model->delete();
|
||
if ($device_engineer_model->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Engineer has been successfully removed from this device.'));
|
freenetis/trunk/kohana/application/controllers/device_admins.php | ||
---|---|---|
* Function adds device admin.
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
function add($device_id = null)
|
||
{
|
||
if (!isset($device_id))
|
||
Controller::warning(1);
|
||
$ssDevice_id = $this->session->get('ssDevice_id');
|
||
$user_model = new User_Model();
|
||
$device_admin_model = new Device_admin_Model();
|
||
if($ssDevice_id)
|
||
$admins = $device_admin_model->find_all_by_device_id($ssDevice_id);
|
||
$admins = $device_admin_model->find_all_by_device_id($device_id);
|
||
else $admins = array();
|
||
$users = $user_model->find_all();
|
||
foreach($users as $user)
|
||
... | ... | |
asort($arr_users, SORT_LOCALE_STRING);
|
||
$arr_users[0] = '----- '.url_lang::lang('texts.select user').' -----';
|
||
// form
|
||
$form = new Forge(url_lang::base()."device_admins/add/", '', 'POST', array('id' => 'article_form'));
|
||
$form = new Forge(url_lang::base()."device_admins/add/$device_id", '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->dropdown('user_id')->label(url_lang::lang('texts.admin').':')->options($arr_users)->rules('required')->selected(0);
|
||
$form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
... | ... | |
$form_data = $form->as_array();
|
||
$device_admin = new Device_admin_Model();
|
||
$device_admin->user_id = $form_data['user_id'];
|
||
$device_admin->device_id = $ssDevice_id;
|
||
$device_admin->device_id = $device_id;
|
||
unset($form_data);
|
||
if ($device_admin->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.New device admin has been successfully saved.'));
|
||
url::redirect(url_lang::base().'devices/show/'.$ssDevice_id);
|
||
url::redirect(url_lang::base().'devices/show/'.$device_id);
|
||
}
|
||
}
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$ssDevice_id, url_lang::lang('texts.Back to device parameters'));
|
||
$link_back = html::anchor(url_lang::base().'devices/show/'.$device_id, url_lang::lang('texts.Back to device parameters'));
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->header->title = url_lang::lang('texts.Add new device admin');
|
||
... | ... | |
* @param $id id of association
|
||
* @return unknown_type
|
||
*/
|
||
function remove($id = null)
|
||
function remove($rel_id = null)
|
||
{
|
||
// access rights
|
||
//if (!$this->acl_check_new(get_class($this),'translations'))
|
||
// Controller::error(1);
|
||
if (isset($id))
|
||
if (isset($rel_id))
|
||
{
|
||
$device_admin_model = new Device_admin_Model();
|
||
$device_admin_model->find($id, FALSE)->delete($id);
|
||
$device_admin_model = new Device_admin_Model($rel_id);
|
||
$device_id = $device_admin_model->device_id;
|
||
$device_admin_model->delete();
|
||
if ($device_admin_model->save())
|
||
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Admin has been successfully removed from this device.'));
|
||
... | ... | |
{
|
||
$this->session->set_flash('message', url_lang::lang('texts.Error - it is not possible to remove admin.'));
|
||
}
|
||
url::redirect(url_lang::base().'devices/show/'.$this->session->get('ssDevice_id'));
|
||
url::redirect(url_lang::base().'devices/show/'.$device_id);
|
||
}
|
||
else
|
||
{
|
freenetis/trunk/kohana/application/controllers/devices.php | ||
---|---|---|
'url_array_ofset' => 1
|
||
|
||
));
|
||
|
||
|
||
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
|
||
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 whole device'));
|
||
$grid->add_new_button(url_lang::base().'devices/add_whole/'.$member_id, 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', 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->add_new_button(url_lang::base().'devices/add/'.$member_id, 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'));
|
||
... | ... | |
if (!$this->acl_check_view(get_class($this),'devices',$member_id))
|
||
Controller::error(1);
|
||
|
||
$ssMember_id = $this->session->get('ssMember_id');
|
||
$enum_type_model = new Enum_type_Model();
|
||
$device_type = $enum_type_model->get_value($device->type);
|
||
$this->session->set('ssDevice_id',$device->id);
|
||
... | ... | |
));
|
||
// to do - access rights
|
||
//if ($this->acl_check_new(get_class($this),'engineer',$member_id))
|
||
$grid->add_new_button(url_lang::base().'device_engineers/add', url_lang::lang('texts.Add new device engineer'));
|
||
$grid->add_new_button(url_lang::base()."device_engineers/add/$device_id", url_lang::lang('texts.Add new device engineer'));
|
||
$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'));
|
||
... | ... | |
'use_selector' => false
|
||
));
|
||
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->add_new_button(url_lang::base()."device_admins/add/$device_id", url_lang::lang('texts.Add new device admin'));
|
||
$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'));
|
||
... | ... | |
));
|
||
|
||
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->add_new_button(url_lang::base().'ifaces/add/'.$device_id, 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'));
|
||
... | ... | |
* Function adds new device only.
|
||
* @return unknown_type
|
||
*/
|
||
function add()
|
||
function add($member_id = null)
|
||
{
|
||
$ssMember_id = $this->session->get('ssMember_id');
|
||
|
||
if (!$this->acl_check_new(get_class($this),'devices',$ssMember_id))
|
||
if (!$this->acl_check_new(get_class($this),'devices',$member_id))
|
||
Controller::error(1);
|
||
// user of device
|
||
$user_model = new User_Model;
|
||
if($ssMember_id)
|
||
if(isset($member_id))
|
||
{
|
||
$member = new Member_Model($ssMember_id);
|
||
$users = $user_model->select('id','name','surname','login')->orderby('id')->find_all_by_member_id($ssMember_id);
|
||
$member = new Member_Model($member_id);
|
||
if ($member->id == 0)
|
||
Controller::warning(2);
|
||
$users = $user_model->select('id','name','surname','login')->orderby('id')->find_all_by_member_id($member_id);
|
||
$selected = $users->current()->id;
|
||
}
|
||
else
|
||
... | ... | |
$view->header = new View('base/header');
|
||
$view->content = new View('form');
|
||
$view->content->form = $form->html();
|
||
if($ssMember_id)
|
||
if(isset($member_id))
|
||
{
|
||
$view->content->link_back = html::anchor(url_lang::base().'devices/show_by_member/'.$ssMember_id, url_lang::lang('texts.Back to devices list of this member'));
|
||
$view->content->link_back = html::anchor(url_lang::base().'devices/show_by_member/'.$member_id, url_lang::lang('texts.Back to devices list of this member'));
|
||
$view->content->headline = url_lang::lang('texts.Add new device for member').' '.$member->name;
|
||
}
|
||
else
|
||
... | ... | |
* and new ip address assigned to this interface.
|
||
* @return unknown_type
|
||
*/
|
||
function add_whole()
|
||
function add_whole($member_id = null)
|
||
{
|
||
// gets member id from current session
|
||
$ssMember_id = $this->session->get('ssMember_id');
|
||
// access rights
|
||
if (!$this->acl_check_new(get_class($this),'devices',$ssMember_id))
|
||
if (!$this->acl_check_new(get_class($this),'devices',$member_id))
|
||
Controller::error(1);
|
||
// enum types for device
|
||
$enum_type_model = new Enum_type_Model();
|
||
... | ... | |
{
|
||
$username = '';
|
||
// finding member
|
||
if($ssMember_id)
|
||
if(isset($member_id))
|
||
{
|
||
$user = $user_model->where('member_id',$ssMember_id)->find();
|
||
$user = $user_model->where('member_id',$member_id)->find();
|
||
if ($user->id == 0)
|
||
Controller::warning(2);
|
||
$username = $user->surname.' '.$user->name.' - '.$user->login;
|
||
}
|
||
$form->input('user')->label(url_lang::lang('texts.user').':')->rules('required')->callback(array($this,'exist_user'))->value($username);
|
||
... | ... | |
{
|
||
// javascript is off
|
||
// finding member
|
||
if($ssMember_id)
|
||
if(isset($member_id))
|
||
{
|
||
$users = $user_model->select('id','name','surname','login')->orderby('id')->find_all_by_member_id($ssMember_id);
|
||
$users = $user_model->select('id','name','surname','login')->orderby('id')->find_all_by_member_id($member_id);
|
||
if ($users->id == 0)
|
||
Controller::warning(2);
|
||
}
|
||
else
|
||
{
|
||
... | ... | |
$view->header = new View('base/header');
|
||
$view->content = new View('form');
|
||
$view->content->form = $form->html();
|
||
if($ssMember_id)
|
||
if(isset($member_id))
|
||
{
|
||
$view->content->link_back = html::anchor(url_lang::base().'devices/show_by_member/'.$ssMember_id, url_lang::lang('texts.Back to devices list of this member'));
|
||
$member = new Member_Model($ssMember_id);
|
||
$view->content->link_back = html::anchor(url_lang::base().'devices/show_by_member/'.$member_id, url_lang::lang('texts.Back to devices list of this member'));
|
||
$member = new Member_Model($member_id);
|
||
$view->content->headline = url_lang::lang('texts.Add new whole device for member').' '.$member->name;
|
||
}
|
||
else
|
||
... | ... | |
{
|
||
$device = new Device_Model($device_id);
|
||
|
||
if (!isset($device_id) || $device->id == 0) {
|
||
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);
|
||
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');
|
||
... | ... | |
if (isset($device_id))
|
||
{
|
||
$member_id = $this->session->get('ssMember_id');
|
||
$device = new Device_Model($device_id);
|
||
if ($member_id)
|
||
$linkback = url_lang::base()."devices/show_by_member/$member_id";
|
||
$linkback = url_lang::base()."devices/show_by_member/".$device->user->member_id;
|
||
else
|
||
$linkback = url_lang::base()."devices/show_all";
|
||
$device = new Device_Model($device_id);
|
||
if (!$device->id)
|
||
url::redirect($linkback);
|
||
if (!$this->acl_check_delete('Devices_Controller', 'devices', $device->user->member_id))
|
freenetis/trunk/kohana/application/libraries/MY_Controller.php | ||
---|---|---|
switch ($message)
|
||
{
|
||
case 1:
|
||
$message = url_lang::lang('states.You dont have the permissions.');
|
||
$message = url_lang::lang('states.Access denied');
|
||
$this->showbox( $message, $this->ICON_ERROR, $content);
|
||
break;
|
||
|
||
... | ... | |
break;
|
||
|
||
case 4:
|
||
$message = url_lang::lang('states.This group do not exist.');
|
||
$message = url_lang::lang('states.This group do not exist');
|
||
$this->showbox( $message, $this->ICON_ERROR, $content);
|
||
break;
|
||
|
||
case 5:
|
||
$message = url_lang::lang('states.Page not found.');
|
||
$message = url_lang::lang('states.Page not found');
|
||
$this->showbox( $message, $this->ICON_ERROR, $content);
|
||
}
|
||
}
|
||
... | ... | |
switch ($message)
|
||
{
|
||
case 1:
|
||
$message = url_lang::lang('states.Parameter is required.');
|
||
$message = url_lang::lang('states.Parameter required');
|
||
$this->showbox( $message, $this->ICON_WARNING, $content);
|
||
break;
|
||
case 2:
|
||
$message = url_lang::lang('states.Invalid parameter');
|
||
$this->showbox( $message, $this->ICON_WARNING, $content);
|
||
break;
|
||
}
|
||
|
||
}
|
freenetis/trunk/kohana/application/views/members/show.php | ||
---|---|---|
?>
|
||
<br />
|
||
<br />
|
||
<table class="extended" style="float:left">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Basic information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>ID</th>
|
||
<td><?php echo $member_data->member_id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Username') ?></th>
|
||
<td><?php echo $member_data->login ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Name') ?></th>
|
||
|
||
<table class="extended" style="float:left; width:360px;">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Basic information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>ID</th>
|
||
<td><?php echo $member_data->member_id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Username') ?></th>
|
||
<td><?php echo $member_data->login ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Name') ?></th>
|
||
|
||
<td><?php echo (($member_data->pre_title != ' ') ? $member_data->pre_title.' ' : '').$member_data->name.' '.(($member_data->middle_name != ' ') ? $member_data->middle_name.' ' : ' ').$member_data->surname.' '.$member_data->post_title ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Members name') ?></th>
|
||
<td><?php echo $member_data->namem ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Organization identifier') ?></th>
|
||
<td><?php echo $member_data->organization_identifier ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Type') ?></th>
|
||
<td><?php echo $member_type ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Contact information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Members name') ?></th>
|
||
<td><?php echo $member_data->namem ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Organization identifier') ?></th>
|
||
<td><?php echo $member_data->organization_identifier ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Type') ?></th>
|
||
<td><?php echo $member_type ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Contact information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th>
|
||
<table class="picturebox"><tr>
|
||
<td>E-mail</td>
|
||
<td>
|
||
... | ... | |
</table>
|
||
</th>
|
||
<td><?php echo $member_data->email ?></td>
|
||
</tr>
|
||
<tr>
|
||
</tr>
|
||
<tr>
|
||
<th>
|
||
<table class="picturebox"><tr>
|
||
<td><?php echo url_lang::lang('texts.Phone') ?></td>
|
||
... | ... | |
</tr>
|
||
</table>
|
||
</th>
|
||
<td><?php echo $member_data->phone ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Address') ?></th>
|
||
<td><?php echo $member_data->street.' '.$member_data->street_number?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Town') ?></th>
|
||
<td><?php echo $member_data->town.' '.$member_data->quarter?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.ZIP code') ?></th>
|
||
<td><?php echo $member_data->ZIP_code ?></td>
|
||
</tr>
|
||
|
||
<?php foreach ($contacts as $i => $contact):?>
|
||
<tr>
|
||
<th><?php echo $contact_types[$i] ?></th>
|
||
<td><?php echo $contact->value ?></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
<?php
|
||
if ($this->acl_check_view('Users_Controller', 'additional_contacts', $member_data->member_id))
|
||
{
|
||
?>
|
||
<tr>
|
||
<td colspan="2"><?php echo html::anchor(url_lang::base().'users/additional_contacts/'.$member_data->id,url_lang::lang('texts.Administrate additional contacts')) ?></td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
</table>
|
||
<table class="extended" cellspacing="0" style="float:left; margin-left:25px;">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Account information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Current credit') ?></th>
|
||
<td><?php echo number_format((float) $account_balance, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance fee') ?></th>
|
||
<td><?php echo number_format((float)$member_data->entrance_fee, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance fee left') ?></th>
|
||
<td><?php echo number_format((float)$member_data->entrance_fee_left, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Debit payment rate') ?></th>
|
||
<td><?php echo number_format((float)$member_data->debt_payment_rate, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Additional information') ?></th>
|
||
</tr>
|
||
<?php
|
||
if ($this->acl_check_view('Members_Controller', 'qos_ceil', $member_data->member_id))
|
||
{ ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.qos ceil') ?></th>
|
||
<td><?php echo $member_data->qos_ceil ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php
|
||
if ($this->acl_check_view('Members_Controller', 'qos_rate', $member_data->member_id))
|
||
{ ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.qos rate') ?></th>
|
||
<td><?php echo $member_data->qos_rate ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Birthday') ?></th>
|
||
<td><?php echo $member_data->birthday ?></td>
|
||
</tr>
|
||
|
||
<?php if ($this->acl_check_view('Members_Controller', 'entrance_date', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance date') ?></th>
|
||
<td><?php echo $member_data->entrance_date ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Members_Controller', 'leaving_date', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Leaving date') ?></th>
|
||
<td><?php echo $member_data->leaving_date ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Registration') ?></th>
|
||
<td><?php echo $member_data->registration ?></td>
|
||
</tr>
|
||
<?php if ($this->acl_check_view('Members_Controller', 'comment', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Comment') ?></th>
|
||
<td style="padding:0px"><textarea readonly="readonly" style="border:0px"><?php echo $member_data->comment ?></textarea></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Users_Controller', 'application_password', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Application password') ?></th>
|
||
<td><?php echo $member_data->application_password ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
</table>
|
||
<br class="clear" /><br />
|
||
<td><?php echo $member_data->phone ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Address') ?></th>
|
||
<td><?php echo $member_data->street.' '.$member_data->street_number?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Town') ?></th>
|
||
<td><?php echo $member_data->town.' '.$member_data->quarter?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.ZIP code') ?></th>
|
||
<td><?php echo $member_data->ZIP_code ?></td>
|
||
</tr>
|
||
|
||
<?php foreach ($contacts as $i => $contact):?>
|
||
<tr>
|
||
<th><?php echo $contact_types[$i] ?></th>
|
||
<td><?php echo $contact->value ?></td>
|
||
</tr>
|
||
<?php endforeach; ?>
|
||
<?php
|
||
if ($this->acl_check_view('Users_Controller', 'additional_contacts', $member_data->member_id))
|
||
{
|
||
?>
|
||
<tr>
|
||
<td colspan="2"><?php echo html::anchor(url_lang::base().'users/additional_contacts/'.$member_data->id,url_lang::lang('texts.Administrate additional contacts')) ?></td>
|
||
</tr>
|
||
<?php
|
||
}
|
||
?>
|
||
|
||
</table>
|
||
<table class="extended" cellspacing="0" style="float:left; margin-left:10px; width:360px;">
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Account information') ?></th>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Current credit') ?></th>
|
||
<td><?php echo number_format((float) $account_balance, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance fee') ?></th>
|
||
<td><?php echo number_format((float)$member_data->entrance_fee, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance fee left') ?></th>
|
||
<td><?php echo number_format((float)$member_data->entrance_fee_left, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Debit payment rate') ?></th>
|
||
<td><?php echo number_format((float)$member_data->debt_payment_rate, 2, ',', ' ').' '.$this->setting->currency ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th colspan="2"><?php echo url_lang::lang('texts.Additional information') ?></th>
|
||
</tr>
|
||
<?php
|
||
if ($this->acl_check_view('Members_Controller', 'qos_ceil', $member_data->member_id))
|
||
{ ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.qos ceil') ?></th>
|
||
<td><?php echo $member_data->qos_ceil ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php
|
||
if ($this->acl_check_view('Members_Controller', 'qos_rate', $member_data->member_id))
|
||
{ ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.qos rate') ?></th>
|
||
<td><?php echo $member_data->qos_rate ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Birthday') ?></th>
|
||
<td><?php echo $member_data->birthday ?></td>
|
||
</tr>
|
||
|
||
<?php if ($this->acl_check_view('Members_Controller', 'entrance_date', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Entrance date') ?></th>
|
||
<td><?php echo $member_data->entrance_date ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Members_Controller', 'leaving_date', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Leaving date') ?></th>
|
||
<td><?php echo $member_data->leaving_date ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Registration') ?></th>
|
||
<td><?php echo $member_data->registration ?></td>
|
||
</tr>
|
||
<?php if ($this->acl_check_view('Members_Controller', 'comment', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Comment') ?></th>
|
||
<td style="padding:0px"><textarea readonly="readonly" style="border:0px"><?php echo $member_data->comment ?></textarea></td>
|
||
</tr>
|
||
<?php } ?>
|
||
<?php if ($this->acl_check_view('Users_Controller', 'application_password', $member_data->member_id)) { ?>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Application password') ?></th>
|
||
<td><?php echo $member_data->application_password ?></td>
|
||
</tr>
|
||
<?php } ?>
|
||
</table>
|
||
|
||
<br class="clear" /><br />
|
||
|
||
<h3><?php echo url_lang::lang('texts.Users')?></h3>
|
||
<?php echo $users ?>
|
||
<br />
|
Také k dispozici: Unified diff
Opravy chyb, export do csv podporuje víc kódovaní. Všechny věci kolem zařízení je třeba předělat kvůli chybě se session, při otevřených víc panelech. Opravy chybných dat v ostré databázi.