Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 128

Přidáno uživatelem Tomáš Dulík před téměř 16 roky(ů)

První filtr...v users.php

Zobrazit rozdíly:

freenetis/trunk/kohana/application/controllers/users.php
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
{
$form=form::open();
$form.=form::label("filter_name", "name").form::input('filter_name');
$form.=form::label("filter_surname", "surname").form::input("filter_surname");
$form.=form::submit('submit', "Send");
$form.=form::close();
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');
......
$sql_offset = ($sql_offset>$total_users) ? 0 : $sql_offset;
$dotaz = $model_users->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all(); // get all members from database
if ($this->input->post()) {
$dotaz=$model_users->like(array(
"name" =>$this->input->post("filter_name"),
"surname" =>$this->input->post("filter_surname")
)) -> orderby($order_by,$order_by_direction)
-> limit($limit_results,$sql_offset)
-> find_all();
} else
$dotaz = $model_users->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all(); // get all members from database
$grid = new Grid(url_lang::base().'users', url_lang::lang('texts.List of all users'),array(
'separator' => '',
//'use_paginator' => false,
......
$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 );
$this->template->content = $grid;
$this->template->content = $form.$grid;
// echo
$view = new View('template');
......
$view->footer = new View('base/footer');
$view->header->menu = Controller::render_menu();
$view->header->title = url_lang::lang('texts.Display member');
// $view->header->other_styles = html::stylesheet('media/css/forms.css');
$view->content->form = $form->html();
// $view->header->other_styles = html::stylesheet('media/css/forms.css');
$view->content->user_data = $user_model;
$view->render(TRUE);

Také k dispozici: Unified diff