Revize 140
Přidáno uživatelem Michal Kliment před více než 15 roky(ů)
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
if($key!='submit')
|
||
{
|
||
if($where!='WHERE ') $where .= ' AND ';
|
||
$where .= $key.' LIKE \'%'.$value.'%\' COLLATE utf8_general_ci';
|
||
$where .= $key.' LIKE \'%'.trim($value).'%\' COLLATE utf8_general_ci';
|
||
}
|
||
}
|
||
|
||
... | ... | |
|
||
public function count_all_members()
|
||
{
|
||
return (int) self::$db->from('members')->count_records();
|
||
|
||
return self::$db->from('members')->count_records();
|
||
|
||
}
|
||
|
||
public function get_member($id)
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
}
|
||
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
|
||
{
|
||
{
|
||
|
||
|
||
|
||
|
||
if (!$this->acl_check_2D('freenetis', 'view_all')) Controller::error(1);
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
... | ... | |
$data['title'] = url_lang::lang('texts.Association members');
|
||
$data['heading'] = url_lang::lang('texts.Association members');
|
||
$model_members = new Member_Model();
|
||
|
||
$total_members = $model_members->count_all_members(); // count all members in database
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_members) ? 0 : $sql_offset;
|
||
|
||
|
||
$filter=new Table_Form("get", array(
|
||
"name"=>"Name",
|
||
"town"=>"Town",
|
||
... | ... | |
"td",
|
||
"submit"=>"Filter"
|
||
)
|
||
);
|
||
);
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
$dotaz = $model_members->get_all_members($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
//$total_members = count($dotaz); // count all members in database
|
||
$total_members = $model_members->count_all_members();
|
||
|
||
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_members) ? 0 : $sql_offset;
|
||
|
||
|
||
// $dotaz = $model_members
|
||
... | ... | |
// -> find_all();
|
||
|
||
|
||
$dotaz = $model_members->get_all_members($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
|
||
// $dotaz = $model_members->get_all_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_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'));
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/show_by_member') ->action(url_lang::lang('texts.Show users'));
|
||
|
||
// if ($this->acl_check_2D('freenetis', 'delete_all'))
|
||
// $grid->action_field('member_id') ->label(url_lang::lang('texts.Delete')) ->url(url_lang::base().'members/delete') ->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_member').'\');"');
|
||
$grid->datasource( $dotaz );
|
||
... | ... | |
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
$view->content = $filter->view . $grid;
|
||
$view->content = $filter->view . $grid;
|
||
//$view->content = new View('pokus');
|
||
//$view->content->total = $total_members;
|
||
//$view->content->sql_offset = $sql_offset;
|
||
//$view->content->limit_results = $limit_results;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of all members');
|
Také k dispozici: Unified diff
Pridano ignorovani prazdnych znaku na zacatku a na konci vyhledavaneho
retezce.