Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 129

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

Snad finální verze filtru pro controllers/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 = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
unset($url_array);
$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(
......
$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 = $form.$grid;
// echo
$view = new View('template');
$view->header = new View('base/header');
// $view->content = new View('content', $data);
$view->content = $this->template->content;
$filter = new View('users_filter');
$view->content = $filter . $grid;
$view->footer = new View('base/footer');
$view->header->menu = Controller::render_menu();
$view->header->title = url_lang::lang('texts.List of all users');
......
$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->content->user_data = $user_model;
$view->render(TRUE);
freenetis/trunk/kohana/application/views/users_filter.php
<?php print form::open(); ?>
<table>
<tr>
<td><label for="filter_name"><?php echo url_lang::lang('texts.Name') ?>:</label></td>
<td><input type="text" id="filter_name" name="filter_name" value="" /> </td>
<td><label for="filter_surname"><?php echo url_lang::lang('texts.Surname');?>:</label></td>
<td><input type="text" id="filter_surname" name="filter_surname" value="" /></td>
</tr>
<tr>
<td><label for="filter_email">Email:</label></td>
<td><input type="text" id="filter_email" name="filter_email" value="" /></td>
<td></td>
<td><input type="submit" value="Filter" /></td>
</tr>
</table>
</form>

Také k dispozici: Unified diff