Revize 1220
Přidáno uživatelem Ondřej Fibich před asi 13 roky(ů)
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml | ||
---|---|---|
<values>
|
||
</values>
|
||
</method>
|
||
<method name="valid_itype" autogenerate="on">
|
||
<method name="valid_itype" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="valid_mac" autogenerate="on">
|
||
<method name="valid_mac" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="valid_subnet" autogenerate="on">
|
||
<method name="valid_subnet" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
</controller>
|
||
... | ... | |
<values>
|
||
</values>
|
||
</method>
|
||
<method name="valid_segment" autogenerate="on">
|
||
<method name="valid_segment" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
<method name="valid_mode" autogenerate="on">
|
||
<method name="valid_mode" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
</controller>
|
||
... | ... | |
</input>
|
||
</values>
|
||
</method>
|
||
<method name="valid_port_nr" autogenerate="on">
|
||
<method name="valid_port_nr" autogenerate="off">
|
||
<attributes>
|
||
<attribute name="input" default_value="" />
|
||
<attribute name="input" default_value=""/>
|
||
</attributes>
|
||
<values>
|
||
<input>
|
||
<param value="" />
|
||
</input>
|
||
</values>
|
||
</method>
|
||
</controller>
|
||
... | ... | |
</values>
|
||
</method>
|
||
</model>
|
||
<model name="ip_addresses_state">
|
||
<method name="update_ip_addresses" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_success_avarages" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_success_counts" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_fail_counts" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_last_success" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_last_fail" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="update_availabilities" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
<method name="clean_pings" autogenerate="on">
|
||
<attributes></attributes>
|
||
<values>
|
||
<input></input>
|
||
</values>
|
||
</method>
|
||
</model>
|
||
<model name="ip_addresses_traffic">
|
||
<method name="count_all_ip_addresses_traffics" autogenerate="on">
|
||
<attributes></attributes>
|
freenetis/branches/testing/application/models/iface.php | ||
---|---|---|
public function select_list_with_device()
|
||
{
|
||
$ifaces = $this->db->query("
|
||
SELECT i.id, CONCAT(d.name, ' - ', i.name) AS name
|
||
SELECT i.id, CONCAT(COALESCE(d.name, ''), ' - ', COALESCE(i.name, '')) AS name
|
||
FROM ifaces i
|
||
LEFT JOIN devices d ON d.id = i.device_id
|
||
")->result()->result_array();
|
freenetis/branches/testing/application/models/cloud.php | ||
---|---|---|
}
|
||
|
||
return $this->db->query("
|
||
SELECT u.id, u.id AS uid, CONCAT(u.surname,' ',u.name,' - ',u.login) as user
|
||
SELECT u.id, u.id AS uid, CONCAT(
|
||
COALESCE(u.surname, ''),' ',
|
||
COALESCE(u.name, ''),' - ',
|
||
COALESCE(u.login, '')
|
||
) as user
|
||
FROM clouds_users cu
|
||
LEFT JOIN users u ON u.id = cu.user_id
|
||
WHERE cu.cloud_id = ?
|
||
... | ... | |
}
|
||
|
||
$subnets = $this->db->query("
|
||
SELECT id, CONCAT(surname,' ',name,' - ',login) as user
|
||
SELECT id, CONCAT(
|
||
COALESCE(surname, ''),' ',
|
||
COALESCE(name, ''),' - ',
|
||
COALESCE(login, '')
|
||
) as user
|
||
FROM users
|
||
WHERE id NOT IN
|
||
(
|
freenetis/branches/testing/application/models/user.php | ||
---|---|---|
*/
|
||
public function select_list_grouped()
|
||
{
|
||
return $this->select_list('id', "CONCAT(surname, ' ', name, ' - ', login)");
|
||
$concat = "CONCAT(
|
||
COALESCE(surname, ''), ' ',
|
||
COALESCE(name, ''), ' - ',
|
||
COALESCE(login, '')
|
||
)";
|
||
|
||
return $this->select_list('id', $concat);
|
||
}
|
||
|
||
|
||
... | ... | |
|
||
// query
|
||
return $this->db->query("
|
||
SELECT u.id, CONCAT(u.login, ' - ', u.surname, ' ', u.name) AS name
|
||
SELECT u.id, CONCAT(
|
||
COALESCE(u.login, ''), ' - ',
|
||
COALESCE(u.surname, ''), ' ',
|
||
COALESCE(u.name, '')
|
||
) AS name
|
||
FROM users u
|
||
WHERE $like id IN (
|
||
SELECT aro_id
|
||
... | ... | |
|
||
// query
|
||
return $this->db->query("
|
||
SELECT u.id, CONCAT(u.login, ' - ', u.surname, ' ', u.name) AS name
|
||
SELECT u.id, CONCAT(
|
||
COALESCE(u.login, ''), ' - ',
|
||
COALESCE(u.surname, ''), ' ',
|
||
COALESCE(u.name, '')
|
||
) AS name
|
||
FROM users u
|
||
WHERE $like id NOT IN (
|
||
SELECT aro_id
|
||
... | ... | |
|
||
// query
|
||
return $this->db->query("
|
||
SELECT u.id, CONCAT(u.login, ' - ', u.surname, ' ', u.name) AS name
|
||
SELECT u.id, CONCAT(
|
||
COALESCE(u.login, ''), ' - ',
|
||
COALESCE(u.surname, ''), ' ',
|
||
COALESCE(u.name, '')
|
||
) AS name
|
||
FROM users u
|
||
WHERE $like id IN (
|
||
SELECT user_id
|
||
... | ... | |
|
||
// query
|
||
return $this->db->query("
|
||
SELECT u.id, CONCAT(u.login, ' - ', u.surname, ' ', u.name) AS name
|
||
SELECT u.id, CONCAT(
|
||
COALESCE(u.login, ''), ' - ',
|
||
COALESCE(u.surname, ''), ' ',
|
||
COALESCE(u.name, '')
|
||
) AS name
|
||
FROM users u
|
||
WHERE $like id NOT IN (
|
||
SELECT user_id
|
||
... | ... | |
public function get_users_not_in_engineer_of($device_id)
|
||
{
|
||
return $this->db->query("
|
||
SELECT u.id, CONCAT(u.surname, ' ', u.name, ' - ', u.login) AS name
|
||
SELECT u.id, CONCAT(
|
||
COALESCE(u.login, ''), ' - ',
|
||
COALESCE(u.surname, ''), ' ',
|
||
COALESCE(u.name, '')
|
||
) AS name
|
||
FROM users u
|
||
WHERE u.id NOT IN (
|
||
SELECT de.user_id
|
freenetis/branches/testing/application/models/log.php | ||
---|---|---|
public function select_list_users_which_has_logs()
|
||
{
|
||
$result = $this->db->query("
|
||
SELECT CONCAT(u.name,' ',u.surname) as username, u.id
|
||
SELECT CONCAT(COALESCE(u.name, ''),' ',COALESCE(u.surname, '')) as username, u.id
|
||
FROM logs l
|
||
LEFT JOIN users u ON l.user_id = u.id
|
||
");
|
freenetis/branches/testing/application/controllers/users.php | ||
---|---|---|
if ($user->type != User_Model::$member &&
|
||
$this->acl_check_edit(get_class($this),'member', $user->member_id))
|
||
{
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->orderby('name')->find_all();
|
||
foreach ($members as $member)
|
||
$arr_members[$member->id] = $member->name;
|
||
$arr_members = ORM::factory('member')->select_list('id', 'name');
|
||
}
|
||
else
|
||
{
|
||
$arr_members[$user->member_id] = $user->member->name;
|
||
}
|
||
|
||
$form = new Forge(
|
||
url_lang::base().'users/edit/'.$user_id, '',
|
freenetis/branches/testing/application/controllers/ports.php | ||
---|---|---|
NULL => '----- '.__('select segment').' -----'
|
||
) + $segment_model->get_all_segments_to_port_dropdown();
|
||
|
||
$vlan_model = new Vlan_Model();
|
||
|
||
$vlans = $vlan_model->select(array('id','name','tag_802_1q'))
|
||
->orderby('tag_802_1q')
|
||
->find_all();
|
||
|
||
foreach ($vlans as $vlan)
|
||
{
|
||
$arr_vlans[$vlan->id] = $vlan->tag_802_1q . ' - ' . $vlan->name;
|
||
}
|
||
$concat = "CONCAT(COLLATE(tag_802_1q, ''), ' - ', COLLATE(name, ''))";
|
||
$arr_vlans = ORM::factory('vlan')->select_list('id', $concat);
|
||
|
||
$form->dropdown('segment_id')
|
||
->label(__('Segment name'))
|
||
... | ... | |
$segment_model = new Segment_Model();
|
||
$arr_segments = $segment_model->get_all_segments_to_port_dropdown();
|
||
|
||
$vlan_model = new Vlan_Model();
|
||
$vlans = $vlan_model->select(array('id','name','tag_802_1q'))
|
||
->orderby('tag_802_1q')
|
||
->find_all();
|
||
|
||
foreach ($vlans as $vlan)
|
||
{
|
||
$arr_vlans[$vlan->id] = $vlan->tag_802_1q . ' - ' . $vlan->name;
|
||
}
|
||
$concat = "CONCAT(COLLATE(tag_802_1q, ''), ' - ', COLLATE(name, ''))";
|
||
$arr_vlans = ORM::factory('vlan')->select_list('id', $concat);
|
||
|
||
$arr_vlan_id_sel = array();
|
||
foreach ($port->vlans as $vlan)
|
||
... | ... | |
$port->segment_id = $form_data['segment_id'];
|
||
$ports_vlans_model = new Ports_vlan_Model();
|
||
$ports_vlans = $ports_vlans_model->where('port_id', $port_id)->find_all();
|
||
|
||
foreach ($ports_vlans as $vlan)
|
||
{
|
||
$vlan->delete();
|
||
}
|
||
|
||
$saved = $port->save();
|
||
|
||
if ($saved)
|
||
{
|
||
$vlans = new Ports_vlan_Model();
|
freenetis/branches/testing/application/controllers/vlan_ifaces.php | ||
---|---|---|
->rules('required|length[3,250]')
|
||
->value($vlan_iface->name);
|
||
|
||
$iface_model = new Iface_Model();
|
||
$ifaces = $iface_model->where('id', $vlan_iface->iface_id)->find_all();
|
||
|
||
foreach ($ifaces as $iface)
|
||
{
|
||
$arr_ifaces[$iface->id] = $iface->name;
|
||
}
|
||
$arr_ifaces = ORM::factory('iface')
|
||
->where('id', $vlan_iface->iface_id)
|
||
->select_list();
|
||
|
||
$form->dropdown('iface_id')
|
||
->label(__('Interface name'))
|
freenetis/branches/testing/application/controllers/towns.php | ||
---|---|---|
|
||
$town_model = new Town_Model();
|
||
|
||
$towns = $town_model->where(array
|
||
$towns_count = $town_model->where(array
|
||
(
|
||
'town' => $town,
|
||
'quarter' => $quarter,
|
||
'zip_code' => $zip_code,
|
||
'id <>' => $this->town_id
|
||
))->find_all();
|
||
))->count_all();
|
||
|
||
if (count($towns))
|
||
if ($towns_count)
|
||
{
|
||
$input->add_error('required', __('Town already exists.'));
|
||
}
|
freenetis/branches/testing/application/controllers/email_queues.php | ||
---|---|---|
$limit_results = 100, $order_by = 'access_time',
|
||
$order_by_direction = 'DESC', $page_word = null, $page = 1)
|
||
{
|
||
// access check
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
Controller::error(ACCESS);
|
||
|
||
// filter form
|
||
$filter_form = new Filter_form('eq');
|
||
... | ... | |
$limit_results = 100, $order_by = 'access_time',
|
||
$order_by_direction = 'DESC', $page_word = null, $page = 1)
|
||
{
|
||
// access check
|
||
if (!$this->acl_check_view('Settings_Controller', 'system'))
|
||
Controller::error(ACCESS);
|
||
|
||
// filter form
|
||
$filter_form = new Filter_form('eq');
|
freenetis/branches/testing/application/controllers/translations.php | ||
---|---|---|
|
||
// get data from database
|
||
$model_translations = new Translation_Model();
|
||
$total_translations = $model_translations->find_all()->count();
|
||
$total_translations = $model_translations->count_all();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_translations)
|
||
$sql_offset = 0;
|
freenetis/branches/testing/application/controllers/address_points.php | ||
---|---|---|
if (!$this->acl_check_view(get_class($this), 'address_point'))
|
||
Controller::error(ACCESS);
|
||
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->where('address_point_id', $address_point->id)->find_all();
|
||
$count_members = count($members);
|
||
|
||
//echo count($address_point->members);
|
||
|
||
$gps = "";
|
||
|
||
if (! empty ($address_point->gps))
|
||
... | ... | |
*/
|
||
public function add()
|
||
{
|
||
// access rights
|
||
if (!$this->acl_check_new(get_class($this),'address_point'))
|
||
Controller::error(ACCESS);
|
||
|
||
// country
|
||
$arr_countries = ORM::factory('country')->select_list('id', 'country_name');
|
||
|
freenetis/branches/testing/application/controllers/enum_types.php | ||
---|---|---|
if (!$this->acl_check_new('Settings_Controller', 'enum_types'))
|
||
Controller::error(ACCESS);
|
||
|
||
$enum_type_name_model = new Enum_type_name_Model();
|
||
$enum_type_names = $enum_type_name_model->find_all();
|
||
$arr_type_names = array
|
||
(
|
||
NULL => '----- ' . __('select type') . ' -----'
|
||
) + ORM::factory('enum_type_name')->select_list('id', 'type_name');
|
||
|
||
$arr_type_names = array();
|
||
$arr_type_names[0] = '----- ' . __('select type') . ' -----';
|
||
|
||
foreach ($enum_type_names as $enum_type_name)
|
||
{
|
||
$arr_type_names[$enum_type_name->id] = $enum_type_name->type_name;
|
||
}
|
||
|
||
// form for new enum type
|
||
$form = new Forge(
|
||
url_lang::base() . 'enum_types/add', '',
|
||
... | ... | |
if (!$enum_type->id)
|
||
url::redirect(url_lang::base() . 'enum_types/show_all');
|
||
|
||
$enum_type_name_model = new Enum_type_name_Model();
|
||
$enum_type_names = $enum_type_name_model->find_all();
|
||
$arr_type_names = ORM::factory('enum_type_name')->select_list('id', 'type_name');
|
||
|
||
$arr_type_names = array();
|
||
|
||
foreach ($enum_type_names as $enum_type_name)
|
||
{
|
||
$arr_type_names[$enum_type_name->id] = $enum_type_name->type_name;
|
||
}
|
||
|
||
// form for new enum type
|
||
$form = new Forge(
|
||
url_lang::base() . 'enum_types/edit/' . $enum_type->id, '',
|
freenetis/branches/testing/application/controllers/streets.php | ||
---|---|---|
|
||
$street_model = new Street_Model();
|
||
|
||
$streets = $street_model->where(array
|
||
$streets_count = $street_model->where(array
|
||
(
|
||
'street' => $street,
|
||
'id <>' => $this->street_id
|
||
))->find_all();
|
||
))->count_all();
|
||
|
||
if (count($streets))
|
||
if ($streets_count)
|
||
{
|
||
$input->add_error('required', __('Street already exists.'));
|
||
}
|
freenetis/branches/testing/application/controllers/votes.php | ||
---|---|---|
$groups_aro_map_model = new Groups_aro_map_Model();
|
||
$vote_model = new Vote_Model();
|
||
|
||
$votes = $vote_model->where('type', $type)
|
||
$votes_count = $vote_model->where('type', $type)
|
||
->where('fk_id', $object->id)
|
||
->find_all();
|
||
->count_all();
|
||
|
||
// 0 votes - vote not yet started
|
||
if (!count($votes))
|
||
if (!$votes_count)
|
||
{
|
||
$state = 0;
|
||
return $state;
|
freenetis/branches/testing/application/controllers/bank_transfers.php | ||
---|---|---|
if (!is_numeric($trans_id))
|
||
Controller::error(RECORD);
|
||
|
||
$accounts = ORM::factory('account')
|
||
$concat = "CONCAT(
|
||
COALESCE(name, ''),
|
||
' - " . __('Account ID') . " ',
|
||
id,
|
||
' - " . __('Member ID') . " ',
|
||
COALESCE(member_id, '')
|
||
)";
|
||
|
||
$arr_accounts = ORM::factory('account')
|
||
->where('account_attribute_id', Account_attribute_Model::$credit)
|
||
->find_all();
|
||
->select_list('id', $concat);
|
||
|
||
$arr_accounts = array();
|
||
$arr_accounts = array
|
||
(
|
||
NULL => '----- '.__('Select').' -----'
|
||
) + $arr_accounts;
|
||
|
||
foreach ($accounts as $account)
|
||
{
|
||
$arr_accounts[$account->id] =
|
||
$account->name.' - '.__('Account ID').' '.
|
||
$account->id.' - '.__('Member ID').' '.
|
||
$account->member_id;
|
||
}
|
||
|
||
asort($arr_accounts, SORT_LOCALE_STRING);
|
||
$arr_accounts[0] = '----- '.__('Select').' -----';
|
||
|
||
$bt_model = new Bank_transfer_Model();
|
||
$bt = $bt_model->get_bank_transfer($trans_id);
|
||
|
freenetis/branches/testing/application/controllers/approval_templates.php | ||
---|---|---|
|
||
// finding all items belong to template
|
||
$approval_template_item_model = new Approval_template_item_Model();
|
||
$approval_template_items = $approval_template_item_model
|
||
$approval_template_count_items = $approval_template_item_model
|
||
->where('approval_template_id', $approval_template->id)
|
||
->find_all();
|
||
->count_all();
|
||
|
||
// template is not empthy
|
||
if (count($approval_template_items))
|
||
if ($approval_template_count_items)
|
||
{
|
||
// approval template still contains some items
|
||
status::warning('Approval template still contains some items.');
|
freenetis/branches/testing/application/controllers/ip_addresses.php | ||
---|---|---|
$arr_ifaces = array();
|
||
$arr_vlan_ifaces = array();
|
||
|
||
if ($ip_address->iface_id)
|
||
if ($ip_address->iface_id)
|
||
{
|
||
$ifaces = $iface_model
|
||
$arr_ifaces = $iface_model
|
||
->where('id', $ip_address->iface_id)
|
||
->find_all();
|
||
|
||
$vlan_ifaces = array();
|
||
->select_list();
|
||
}
|
||
else
|
||
{
|
||
$vlan_ifaces = $vlan_iface_model
|
||
$arr_vlan_ifaces = $vlan_iface_model
|
||
->where('id', $ip_address->vlan_iface_id)
|
||
->find_all();
|
||
|
||
$ifaces = array();
|
||
->select_list();
|
||
}
|
||
|
||
foreach ($ifaces as $iface) {
|
||
$arr_ifaces[$iface->id] = $iface->name;
|
||
}
|
||
|
||
foreach ($vlan_ifaces as $vlan_iface) {
|
||
$arr_vlan_ifaces[$vlan_iface->id] = $vlan_iface->name;
|
||
}
|
||
|
||
$subnet_model = new Subnet_Model();
|
||
|
||
$arr_subnets = $subnet_model->select_list_by_net();
|
||
... | ... | |
else
|
||
{
|
||
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add();
|
||
|
||
if ($ip_address->vlan_iface_id)
|
||
{
|
||
$breadcrumbs->link(
|
||
'vlan_ifaces/show_all', 'VLAN Interfaces',
|
||
$this->acl_check_view('Devices_Controller','vlan_iface'))
|
||
->link('vlan_ifaces/show/' . $ip_address->vlan_iface_id,
|
||
$ip_address->vlan_iface->name . ' (' . $ip_address->vlan_iface->id . ')',
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'vlan_iface', $member_id
|
||
));
|
||
}
|
||
elseif ($ip_address->iface_id)
|
||
{
|
||
if (empty($ip_address->iface->name))
|
||
// breadcrumbs menu
|
||
$breadcrumbs = breadcrumbs::add();
|
||
|
||
if ($ip_address->vlan_iface_id)
|
||
{
|
||
$name = $ip_address->iface->mac;
|
||
$breadcrumbs->link(
|
||
'vlan_ifaces/show_all', 'VLAN Interfaces',
|
||
$this->acl_check_view('Devices_Controller','vlan_iface'))
|
||
->link('vlan_ifaces/show/' . $ip_address->vlan_iface_id,
|
||
$ip_address->vlan_iface->name . ' (' . $ip_address->vlan_iface->id . ')',
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'vlan_iface', $member_id
|
||
));
|
||
}
|
||
elseif ($ip_address->iface_id)
|
||
{
|
||
if (empty($ip_address->iface->name))
|
||
{
|
||
$name = $ip_address->iface->mac;
|
||
}
|
||
else
|
||
{
|
||
$name = $ip_address->iface->name . ' (' . $ip_address->iface->mac . ')';
|
||
}
|
||
|
||
$breadcrumbs->link(
|
||
'ifaces/show_all', 'Interfaces',
|
||
$this->acl_check_view('Devices_Controller','iface'))
|
||
->link('ifaces/show/' . $ip_address->iface_id, $name,
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'iface',
|
||
$ip_address->iface->device->user->member_id
|
||
));
|
||
}
|
||
else
|
||
{
|
||
$name = $ip_address->iface->name . ' (' . $ip_address->iface->mac . ')';
|
||
$breadcrumbs->link(
|
||
'ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
)->disable_translation()
|
||
->link('ip_addresses/show/' . $ip_address->id,
|
||
$ip_address->ip_address . ' (' . $ip_address->id . ')',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address'));
|
||
}
|
||
|
||
$breadcrumbs->link(
|
||
'ifaces/show_all', 'Interfaces',
|
||
$this->acl_check_view('Devices_Controller','iface'))
|
||
->link('ifaces/show/' . $ip_address->iface_id, $name,
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->link('ip_addresses/show/' . $ip_address_id,
|
||
$ip_address->ip_address . ' (' . $ip_address->id . ')',
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'iface',
|
||
$iface->device->user->member_id
|
||
));
|
||
}
|
||
else
|
||
{
|
||
$breadcrumbs->link(
|
||
'ip_addresses/show_all', 'IP addresses',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address')
|
||
)->disable_translation()
|
||
->link('ip_addresses/show/' . $ip_address->id,
|
||
$ip_address->ip_address . ' (' . $ip_address->id . ')',
|
||
$this->acl_check_view('Devices_Controller', 'ip_address'));
|
||
}
|
||
'Devices_Controller', 'ip_address', $member_id
|
||
))
|
||
->enable_translation()
|
||
->text('Edit IP address');
|
||
|
||
$breadcrumbs->disable_translation()
|
||
->link('ip_addresses/show/' . $ip_address_id,
|
||
$ip_address->ip_address . ' (' . $ip_address->id . ')',
|
||
$this->acl_check_view(
|
||
'Devices_Controller', 'ip_address', $member_id
|
||
))
|
||
->enable_translation()
|
||
->text('Edit IP address');
|
||
|
||
}
|
||
|
||
// view
|
||
$view = new View('main');
|
||
$view->title = __('Edit IP address').
|
||
' - '.$ip_address->ip_address;
|
||
$view->title = __('Edit IP address') . ' - '.$ip_address->ip_address;
|
||
$view->breadcrumbs = $breadcrumbs->html();
|
||
$view->content = new View('form');
|
||
$view->content->form = $this->form->html();
|
||
$view->content->headline = __('Edit IP address').
|
||
' - '.$ip_address->ip_address;
|
||
$view->content->headline = __('Edit IP address').' - '.$ip_address->ip_address;
|
||
$view->render(TRUE);
|
||
} // end of add function
|
||
|
||
... | ... | |
$input->add_error('required', __('IP address already exists.'));
|
||
}
|
||
}
|
||
}
|
||
|
||
// end of valid_ip
|
||
} // end of valid_ip
|
||
|
||
/**
|
||
* Checks ip address if matches subnet and mask.
|
||
... | ... | |
$method = $this->form->ip_address->method; // <FORM> method = POST, GET, ...
|
||
$iface_id = $this->input->$method('iface_id');
|
||
$vlan_iface_id = $input->value;
|
||
|
||
if ($iface_id && $vlan_iface_id)
|
||
{
|
||
$input->add_error('required', __('Select only one type of iface.'));
|
freenetis/branches/testing/application/controllers/bank_accounts.php | ||
---|---|---|
|
||
// form
|
||
if (!isset($member_id) || $member_id != 1)
|
||
{
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->find_all();
|
||
$arr_members = array();
|
||
foreach ($members as $member)
|
||
{
|
||
// members list
|
||
$arr_members = ORM::factory('member')->select_list();
|
||
|
||
if (isset($arr_members[1]))
|
||
{
|
||
if ($member->id != 1)
|
||
$arr_members[$member->id] = $member->name;
|
||
unset($arr_members[1]);
|
||
}
|
||
asort($arr_members, SORT_LOCALE_STRING);
|
||
|
||
$form = new Forge(
|
||
url_lang::base()."bank_accounts/add/", '',
|
freenetis/branches/testing/application/controllers/bank_templates.php | ||
---|---|---|
|
||
// get data from database
|
||
$model_templates = new Bank_template_Model();
|
||
$total_templates = count($model_templates->find_all());
|
||
$total_templates = $model_templates->count_all();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_templates)
|
||
$sql_offset = 0;
|
||
|
||
$templates = $model_templates->orderby($order_by, $order_by_direction)
|
||
->limit($limit_results, $sql_offset)
|
||
->find_all();
|
||
... | ... | |
*/
|
||
public function add()
|
||
{
|
||
if (!$this->acl_check_new('Accounts_Controller', 'bank_transfers'))
|
||
Controller::Error(ACCESS);
|
||
|
||
$form = new Forge(
|
||
url_lang::base().'bank_templates/add', '',
|
||
'POST', array('id' => 'article_form')
|
||
... | ... | |
Controller::error(RECORD);
|
||
}
|
||
|
||
if (!$this->acl_check_edit('Accounts_Controller', 'bank_transfers'))
|
||
{
|
||
Controller::Error(ACCESS);
|
||
}
|
||
|
||
$form = new Forge(
|
||
url_lang::base().'bank_templates/edit/'.$template_id, '',
|
||
'POST', array('id' => 'article_form')
|
freenetis/branches/testing/application/controllers/members.php | ||
---|---|---|
$users = ORM::factory('user')->where('member_id', $member->id)->find_all();
|
||
|
||
// grid with lis of users
|
||
$users_grid = new Grid(url_lang::base().'members', null,array(
|
||
$users_grid = new Grid(url_lang::base().'members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
... | ... | |
->url('users/show');
|
||
}
|
||
|
||
if($this->acl_check_edit('Users_Controller', 'users') ||
|
||
if ($this->acl_check_edit('Users_Controller', 'users') ||
|
||
($this->session->get('user_type') == User_Model::$member &&
|
||
$this->acl_check_edit('Users_Controller','users',$member_id)))
|
||
{
|
||
... | ... | |
->url('users/edit');
|
||
}
|
||
|
||
if($this->acl_check_delete('Users_Controller', 'users', $member_id))
|
||
if ($this->acl_check_delete('Users_Controller', 'users', $member_id))
|
||
{
|
||
$actions->add_action('id')
|
||
->icon_action('delete')
|
||
... | ... | |
|
||
// membership interrupts
|
||
$membership_interrupts = ORM::factory('membership_interrupt')->get_all_by_member($member_id);
|
||
|
||
$membership_interrupts_grid = new Grid(url_lang::base().'members', null, array
|
||
(
|
||
'separator' => '<br /><br />',
|
||
... | ... | |
// engineers
|
||
$member = new Member_Model($member_id);
|
||
|
||
$concat = "CONCAT(
|
||
COALESCE(surname, ''), ' ',
|
||
COALESCE(name, ''), ' - ',
|
||
COALESCE(login, '')
|
||
)";
|
||
|
||
$arr_engineers = array
|
||
(
|
||
NULL => '----- '.__('select user').' -----'
|
||
) + ORM::factory('user')->select_list(
|
||
'id', "CONCAT(surname, ' ', name, ' - ', login)", FALSE
|
||
);
|
||
) + ORM::factory('user')->select_list('id', $concat, FALSE);
|
||
|
||
$allowed_subnets_count = ($member->allowed_subnets_count) ?
|
||
$member->allowed_subnets_count->count : 0;
|
||
... | ... | |
$value = trim($input->value);
|
||
$member_model = new Member_Model();
|
||
|
||
$members = $member_model->where(array
|
||
$total = $member_model->where(array
|
||
(
|
||
'variable_symbol' => $value,
|
||
'id!=' => $this->member_id
|
||
))->find_all();
|
||
))->count_all();
|
||
|
||
$total = count($members);
|
||
if (!preg_match("/^[0-9]{1,10}$/", $value))
|
||
{
|
||
$input->add_error('required', __('Bad variable symbol format.'));
|
freenetis/branches/testing/application/controllers/json.php | ||
---|---|---|
->groupby('organization_identifier')
|
||
->orderby('organization_identifier')
|
||
->find_all();
|
||
|
||
|
||
$arr_members = array();
|
||
foreach ($members as $member)
|
||
$arr_members[] = $member->organization_identifier;
|
freenetis/branches/testing/application/controllers/access_rights.php | ||
---|---|---|
));
|
||
}
|
||
else
|
||
{
|
||
foreach ($users1 as $user1)
|
||
{
|
||
$system_users[$user1->id] = $user1->name;
|
||
}
|
||
|
||
{
|
||
$system_users_select = form::dropdown(array
|
||
(
|
||
'name' => 'system_users[]',
|
||
'size' => 20,
|
||
'style' => 'width:250px'
|
||
), $system_users);
|
||
), arr::from_objects($users1));
|
||
}
|
||
|
||
//generovani system searchboxu
|
||
... | ... | |
}
|
||
else
|
||
{
|
||
foreach ($users2 as $user2)
|
||
{
|
||
$group_users[$user2->id] = $user2->name;
|
||
}
|
||
|
||
$group_users_select = form::dropdown(array
|
||
(
|
||
'name' => 'group_users[]',
|
||
'size' => 20,
|
||
'style' => 'width:250px'
|
||
), $group_users);
|
||
), arr::from_objects($users2));
|
||
}
|
||
|
||
//generovani group searchboxu
|
freenetis/branches/testing/application/controllers/allowed_subnets_counts.php | ||
---|---|---|
// member doesn't exist
|
||
if (!$member->id || $member->id == 1)
|
||
Controller::error(RECORD);
|
||
|
||
// access control
|
||
if (!$this->acl_check_edit('Devices_Controller', 'allowed_subnet', $member_id))
|
||
Controller::error(ACCESS);
|
||
|
||
$form = new Forge(
|
||
url::base(TRUE) . url::current(TRUE), '',
|
freenetis/branches/testing/application/controllers/work_reports.php | ||
---|---|---|
if (!$this->acl_check_new('Users_Controller', 'work'))
|
||
Controller::error(ACCESS);
|
||
|
||
$user_model = new User_Model();
|
||
$users = $user_model->select('id','name','surname','login')->orderby('id')->find_all();
|
||
$selected = NULL;
|
||
|
||
foreach ($users as $user)
|
||
{
|
||
$arr_users[$user->id] = $user->surname.' '.$user->name.' - '.$user->login;
|
||
}
|
||
asort($arr_users, SORT_LOCALE_STRING);
|
||
$arr_users = arr::merge(array
|
||
$concat = "CONCAT(
|
||
COALESCE(surname, ''), ' ',
|
||
COALESCE(name, ''), ' - ',
|
||
COALESCE(login, '')
|
||
)";
|
||
|
||
$arr_users = array
|
||
(
|
||
NULL => '----- '.__('select user').' -----'
|
||
), $arr_users);
|
||
) + ORM::factory('user')->select_list('id', $concat);
|
||
}
|
||
|
||
if ($this->acl_check_view('approval','templates'))
|
||
{
|
||
$approval_template_model = new Approval_template_Model();
|
||
$approval_templates = $approval_template_model->find_all();
|
||
|
||
// transforms array of objects to classic array
|
||
$arr_approval_templates = arr::from_objects($approval_templates);
|
||
$arr_approval_templates = arr::merge(array
|
||
{
|
||
$arr_approval_templates = array
|
||
(
|
||
NULL => '----- '.__('select approval template').' -----'
|
||
),$arr_approval_templates);
|
||
) + ORM::factory('approval_template')->select_list();
|
||
}
|
||
|
||
// creates form
|
||
... | ... | |
|
||
if ($this->acl_check_view('approval','templates'))
|
||
{
|
||
$approval_template_model = new Approval_template_Model();
|
||
$approval_templates = $approval_template_model->find_all();
|
||
|
||
// transforms array of objects to classic array
|
||
$arr_approval_templates = arr::from_objects($approval_templates);
|
||
$arr_approval_templates = arr::merge(array
|
||
(
|
||
NULL => '----- '.__('select approval template').' -----'
|
||
), $arr_approval_templates);
|
||
), ORM::factory('approval_template')->select_list());
|
||
}
|
||
|
||
$work_model = new Job_Model();
|
freenetis/branches/testing/application/controllers/sms.php | ||
---|---|---|
* @copyright (c) 2010 Lubomir Buben, Roman Sevcik
|
||
*
|
||
* @TODO correct functionality not confirmed - candidate for removal? (jsvitak)
|
||
* @TODO access rights missing (dzolo)
|
||
*/
|
||
|
||
class Sms_Controller extends Controller{
|
||
... | ... | |
|
||
$model_sms_message = new Sms_message_Model();
|
||
|
||
$total_sms_message = count($model_sms_message->find_all());
|
||
$total_sms_message = $model_sms_message->count_all();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_sms_message)
|
||
$sql_offset = 0;
|
||
|
freenetis/branches/testing/application/controllers/works.php | ||
---|---|---|
if (!$this->acl_check_new('Users_Controller', 'work'))
|
||
Controller::error(ACCESS);
|
||
|
||
$users = ORM::factory('user')->select('id', 'name', 'surname', 'login')
|
||
->orderby('id')
|
||
->find_all();
|
||
|
||
$selected = NULL;
|
||
|
||
foreach ($users as $user)
|
||
{
|
||
$arr_users[$user->id] = $user->surname . ' ' . $user->name . ' - ' . $user->login;
|
||
}
|
||
asort($arr_users, SORT_LOCALE_STRING);
|
||
$concat = "CONCAT(
|
||
COALESCE(surname, ''), ' ',
|
||
COALESCE(name, ''), ' - ',
|
||
COALESCE(login, '')
|
||
)";
|
||
|
||
$arr_users = arr::merge(array
|
||
$arr_users = array
|
||
(
|
||
NULL => '----- ' . __('select user') . ' -----'
|
||
), $arr_users);
|
||
NULL => '----- '.__('select user').' -----'
|
||
) + ORM::factory('user')->select_list('id', $concat);
|
||
|
||
// breadcrumbs navigation
|
||
$breadcrumbs->link('works/pending', 'Pending works',
|
||
... | ... | |
|
||
if ($this->acl_check_view('approval', 'templates'))
|
||
{
|
||
$approval_template_model = new Approval_template_Model();
|
||
$approval_templates = $approval_template_model->find_all();
|
||
|
||
// transforms array of objects to classic array
|
||
$arr_approval_templates = arr::from_objects($approval_templates);
|
||
$arr_approval_templates = arr::merge(array
|
||
$arr_approval_templates = array
|
||
(
|
||
NULL => '----- ' . __('select approval template') . ' -----'
|
||
), $arr_approval_templates);
|
||
NULL => '----- '.__('select approval template').' -----'
|
||
) + ORM::factory('approval_template')->select_list();
|
||
}
|
||
|
||
// form
|
||
... | ... | |
|
||
if ($this->acl_check_view('approval', 'templates'))
|
||
{
|
||
$approval_template_model = new Approval_template_Model();
|
||
$approval_templates = $approval_template_model->find_all();
|
||
|
||
// transforms array of objects to classic array
|
||
$arr_approval_templates = arr::from_objects($approval_templates);
|
||
$arr_approval_templates = arr::merge(array
|
||
$arr_approval_templates = array
|
||
(
|
||
NULL => '----- ' . __('select approval template') . ' -----'
|
||
), $arr_approval_templates);
|
||
NULL => '----- '.__('select approval template').' -----'
|
||
) + ORM::factory('approval_template')->select_list();
|
||
}
|
||
|
||
// creates form
|
freenetis/branches/testing/application/controllers/accounts.php | ||
---|---|---|
|
||
// members list
|
||
$arr_members = ORM::factory('member')
|
||
->select_list('id', 'CONCAT(id, \' - \', name)', FALSE);
|
||
->select_list('id', "CONCAT(id, ' - ', COALESCE(name,''))", FALSE);
|
||
|
||
// form
|
||
$form = new Forge(
|
freenetis/branches/testing/application/controllers/invoices.php | ||
---|---|---|
|
||
$invoice_model = new Invoice_Model();
|
||
|
||
$total_invoices = count($invoice_model->find_all());
|
||
$total_invoices = $invoice_model->count_all();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_invoices)
|
||
$sql_offset = 0;
|
||
... | ... | |
* @param integer $invoice_template_id id of type of invoice template (type)
|
||
*/
|
||
public function import($invoice_template_id = null)
|
||
{
|
||
{
|
||
// access rights
|
||
if (!$this->acl_check_new('Accounts_Controller', 'invoices'))
|
||
Controller::Error(ACCESS);
|
||
|
||
// breadcrumbs
|
||
$breadcrumbs = breadcrumbs::add()
|
||
->link('invoices/show_all', 'Invoices',
|
||
... | ... | |
|
||
if (!$invoice_id || !$invoice->id)
|
||
url::redirect(url_lang::base() . 'invoices/show_all');
|
||
|
||
$arr_members = ORM::factory('member')->select_list();
|
||
|
||
$member_model = new Member_Model();
|
||
$members = $member_model->find_all();
|
||
|
||
$arr_members = arr::from_objects($members);
|
||
|
||
// creates form
|
||
$this->form = new Forge(
|
||
url_lang::base() . 'invoices/edit/' . $invoice->id, '',
|
freenetis/branches/testing/application/controllers/approval_template_items.php | ||
---|---|---|
url::redirect(url_lang::base().'approval_templates/show/'.$this->approval_template->id);
|
||
}
|
||
|
||
$approval_type_model = new Approval_type_Model();
|
||
$approval_types = $approval_type_model->find_all();
|
||
|
||
$arr_approval_types = array();
|
||
foreach ($approval_types as $approval_type)
|
||
{
|
||
$arr_approval_types[$approval_type->id] = $approval_type->name;
|
||
}
|
||
$arr_approval_types = arr::merge(array
|
||
$arr_approval_types = ORM::factory('approval_type')->select_list();
|
||
|
||
$arr_approval_types = array
|
||
(
|
||
NULL => '----- '.__('select approval type').' -----'
|
||
), $arr_approval_types);
|
||
) + $arr_approval_types;
|
||
|
||
// creates form
|
||
$form = new Forge(
|
||
... | ... | |
status::warning('It is not possible edit used template.');
|
||
url::redirect(url_lang::base().'approval_templates/show/'.$this->approval_template->id);
|
||
}
|
||
|
||
|
||
$arr_approval_types = ORM::factory('approval_type')->select_list();
|
||
|
||
$arr_approval_types = array
|
||
(
|
||
NULL => '----- '.__('select approval type').' -----'
|
||
) + $arr_approval_types;
|
||
|
||
$approval_type_model = new Approval_type_Model();
|
||
$approval_types = $approval_type_model->find_all();
|
||
|
||
$arr_approval_types = array();
|
||
foreach ($approval_types as $approval_type)
|
||
{
|
||
$arr_approval_types[$approval_type->id] = $approval_type->name;
|
||
}
|
||
$arr_approval_types = arr::merge(array(NULL => '----- '.__('select approval type').' -----'), $arr_approval_types);
|
||
|
||
// creates form
|
||
$form = new Forge(
|
||
url_lang::base().'approval_template_items/edit/'.$this->approval_template_item->id,
|
freenetis/branches/testing/application/controllers/fees.php | ||
---|---|---|
|
||
$fee_model = new Fee_Model();
|
||
$fees = $fee_model->get_all_fees($order_by, $order_by_direction);
|
||
$total_fees = count($fee_model->find_all());
|
||
$total_fees = $fee_model->count_all();
|
||
|
||
// create grid
|
||
$grid = new Grid(url_lang::base() . 'fees', '', array
|
freenetis/branches/testing/system/libraries/ORM.php | ||
---|---|---|
* @author Kohana Team
|
||
* @copyright (c) 2007-2008 Kohana Team
|
||
* @license http://kohanaphp.com/license.html
|
||
*
|
||
* @method ORM where()
|
||
*/
|
||
class ORM_Core {
|
||
|
||
... | ... | |
* @param bool order by value?
|
||
* @return array
|
||
*/
|
||
public function select_list($key = NULL, $val = NULL, $order_val = TRUE)
|
||
public function select_list($key = 'id', $val = 'name', $order_val = TRUE)
|
||
{
|
||
if ($key === NULL)
|
||
{
|
Také k dispozici: Unified diff
Upravy:
- pridani chybejicich pristupovych prav do controlleru
- optimalizace nacitanych dat do dropdownu v controllerech pomoci select_list
- opravy chyb ve funkcich pouzivajici MySQL CONCAT pri NULLovych hodnot pomoci funkce COALESCE