Revize 683
Přidáno uživatelem Michal Kliment před více než 14 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'add member fee payment by cash' => 'Přidat platbu členského příspěvku hotově',
|
||
'add new account' => 'Přidat nový účet',
|
||
'add new admin' => 'Přidat nového správce',
|
||
'add new approval template' => 'Přidat novou hlasovací šablonu',
|
||
'add new approval type' => 'Přidat nový hlasovací typ',
|
||
'add new backup' => 'Přidat novou zálohu',
|
||
'add new bank account' => 'Přidat nový bankovní účet',
|
||
'add new bank account of association' => 'Přidat nový bankovní účet sdružení',
|
||
... | ... | |
'applicant' => 'Čekatel na členství',
|
||
'application password' => 'Aplikační heslo',
|
||
'approval' => 'Hlasování',
|
||
'approval templates' => 'Hlasovací šablony',
|
||
'approval type' => 'Hlasovací typ',
|
||
'approval type has been successfully added' => 'Hlasovací typ byl úspěšně přidán.',
|
||
'approval type has been successfully deleted' => 'Hlasovací typ byl úspěšně smazán.',
|
||
'approval type has been successfully updated' => 'Hlasovací typ byl úspěšně aktualizován.',
|
||
'approval types' => 'Hlasovací typy',
|
||
'approved' => 'Schváleno',
|
||
'approved works' => 'Schválené práce',
|
||
'april' => 'Duben',
|
||
... | ... | |
'back to ip address' => 'Zpět na IP adresu',
|
||
'back to ip addresses list' => 'Zpět na seznam IP adres',
|
||
'back to list' => 'Zpět na seznam',
|
||
'back to list of all approval templates' => 'Zpět na seznam všech schvalovacích šablon',
|
||
'back to list of all approval types' => 'Zpět na seznam všech schvalovacích typů',
|
||
'back to list of all address points' => 'Zpět na seznam všech adresních bodů',
|
||
'back to list of all confirmed works' => 'Zpět na seznam všech potvrzených prací',
|
||
'back to list of all devices' => 'Zpět na seznam všech zařízení',
|
||
... | ... | |
'back to profile of association' => 'Zpět na profil sdružení',
|
||
'back to project accounts' => 'Zpět na projektové účty',
|
||
'back to segments list' => 'Zpět na seznam segmentů',
|
||
'back to the approval type' => 'Zpátky k hlasovacímu typu',
|
||
'back to the cloud list' => 'Zpět na seznam oblastí',
|
||
'back to the double-entry accounts' => 'Zpět na podvojné účty',
|
||
'back to the form' => 'Zpátky k formuláři',
|
||
... | ... | |
'edit' => 'Upravit',
|
||
'edit account' => 'Upravit účet',
|
||
'edit address point' => 'Upravit adresní bod',
|
||
'edit approval type' => 'Upravit schvalovací typ',
|
||
'edit cloud' => 'Upravit oblast',
|
||
'edit device' => 'Upravit zařízení',
|
||
'edit device admin' => 'Upravit správce zařízení',
|
||
... | ... | |
'import has been successfully finished' => 'Import byl úspěšně dokončen.',
|
||
'import new invoice' => 'Import nové faktury',
|
||
'import results' => 'Výsledky importu',
|
||
'in hours' => 'V hodinách',
|
||
'inactive' => 'Neaktivní',
|
||
'inbound' => 'Příchozí',
|
||
'increase of members' => 'Přírůstek členů',
|
||
... | ... | |
'limit of member' => 'Limit člena',
|
||
'limit has been successfully changed' => 'Limit byl úspěšně změněn.',
|
||
'list of all address points' => 'Seznam všech adresních bodů',
|
||
'list of all approval templates' => 'Seznam všech schvalovacích šablon',
|
||
'list of all approval types' => 'Seznam všech schvalovacích typů',
|
||
'list of all approved works' => 'Seznam všech schválených prací',
|
||
'list of all backups' => 'Seznam všech záloh konfigurací',
|
||
'list of all calls' => 'Výpis všech hovorů',
|
||
... | ... | |
'messages for redirection' => 'Zprávy pro přesměrování',
|
||
'middle name' => 'Prostřední jméno',
|
||
'minimal duration of interrupt is one month' => 'Minimální délka přerušení je jeden měsíc',
|
||
'minimal suggest amount' => 'Minimální navrhovaná částka',
|
||
'mode' => 'Mód',
|
||
'monitor' => 'Sledovat',
|
||
'month' => 'Měsíc',
|
||
... | ... | |
'show all transfers on the account' => 'Ukaž všechny převody tohoto účtu',
|
||
'show all unconfirmed works' => 'Zobraz všechnny nepotvrzené práce',
|
||
'show answer for this message' => 'Zobrazit odpověď na tuto zprávu',
|
||
'show approval template' => 'Zobrazit schvalovací šablonu',
|
||
'show approval type' => 'Zobrazit schvalovací typ',
|
||
'show clouds' => 'Zobrazit oblasti',
|
||
'show devices' => 'Zobrazit zařízení',
|
||
'show help' => 'Zobrazit nápovědu',
|
||
... | ... | |
'type of the recipient' => 'Typ příjemce',
|
||
'type of redirection' => 'Typ přesměrování',
|
||
'type' => 'Typ',
|
||
'types count' => 'Počet typů',
|
||
'rejected' => 'Zamítnuto',
|
||
'rejected works' => 'Zamítnuté práce',
|
||
'unconfirmed works' => 'Nepotvrzené práce',
|
freenetis/trunk/kohana/application/helpers/num.php | ||
---|---|---|
return round($number / $nearest) * $nearest;
|
||
}
|
||
|
||
public static function null_fill($number, $position)
|
||
{
|
||
$len = strlen($number);
|
||
$null_str = '';
|
||
for ($i=0;$i<($position-$len);$i++)
|
||
$null_str .= '0';
|
||
|
||
return $null_str.$number;
|
||
}
|
||
|
||
}
|
freenetis/trunk/kohana/application/helpers/date.php | ||
---|---|---|
* @param $year
|
||
* @return date
|
||
*/
|
||
public static function create($day, $month, $year)
|
||
public static function create($day, $month, $year, $hour = 0, $minute = 0, $second = 0, $datetime = FALSE)
|
||
{
|
||
$date = $year.'-';
|
||
$date = num::null_fill($year,4).'-';
|
||
|
||
$date .= ($month>9) ? $month.'-' : '0'.$month.'-';
|
||
$date .= ($day>9) ? $day : '0'.$day;
|
||
$date .= num::null_fill($month,2).'-';
|
||
$date .= num::null_fill($day,2);
|
||
|
||
if ($datetime)
|
||
{
|
||
$date .= ' '.num::null_fill($hour,2).':';
|
||
$date .= num::null_fill($minute,2).':';
|
||
$date .= num::null_fill($second,2);
|
||
}
|
||
|
||
return $date;
|
||
}
|
||
|
||
... | ... | |
$pd = date_parse($datetime);
|
||
|
||
$years = $pd['year'];
|
||
$months = $years * 365 + $pd['month'];
|
||
$months = $years * 12 + $pd['month'];
|
||
$days = $months * 30 + $pd['day'];
|
||
$hours = $days * 24 + $pd['hour'];
|
||
|
||
echo $$unit.' '.strtolower(url_lang::lang('texts.'.$unit));
|
||
return $$unit;
|
||
}
|
||
|
||
public static function from_interval($interval = 0, $unit = 'hours')
|
||
{
|
||
$years = 0;
|
||
$months = 0;
|
||
$days = 0;
|
||
$hours = 0;
|
||
$minutes = 0;
|
||
$seconds = 0;
|
||
|
||
if ($unit == 'seconds')
|
||
$seconds = $interval;
|
||
|
||
$minutes = floor ($seconds / 60);
|
||
$seconds = $seconds - $minutes*60;
|
||
|
||
if ($unit == 'minutes')
|
||
$minutes = $interval;
|
||
|
||
$hours = floor($minutes / 60);
|
||
$minutes = $minutes - $hours*60;
|
||
|
||
if ($unit == 'hours')
|
||
$hours = $interval;
|
||
|
||
$days = floor ($hours / 24);
|
||
$hours = $hours - $days*24;
|
||
|
||
if ($unit == 'days')
|
||
$days = $interval;
|
||
|
||
$months = floor ($days / 30);
|
||
$days = $days - $months*30;
|
||
|
||
if ($unit == 'months')
|
||
$months = $interval;
|
||
|
||
$years = floor($months / 12);
|
||
$months = $months - $years*12;
|
||
|
||
if ($unit == 'years')
|
||
$years = $interval;
|
||
|
||
if ($years > 9999)
|
||
$years = 9999;
|
||
|
||
return date::create($days, $months, $years, $hours, $minutes, $seconds, TRUE);
|
||
}
|
||
|
||
} // End date
|
freenetis/trunk/kohana/application/models/approval_template.php | ||
---|---|---|
<?php
|
||
class Approval_template_Model extends ORM {
|
||
protected $has_many = array('approval_template_items');
|
||
//protected $belongs_to = array('aro_group');
|
||
|
||
/*public static $templates = array(
|
||
1 => 'test'
|
||
);*/
|
||
|
||
public function get_all_approval_templates($limit_from = 0, $limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC', $filter_values = array())
|
||
{
|
||
return self::$db->query('SELECT at.id, at.name, at.comment, count(ati.id) AS types_count FROM approval_templates at
|
||
LEFT JOIN approval_template_items ati ON at.id = ati.approval_template_id
|
||
GROUP BY at.id
|
||
ORDER BY `'.$order_by.'` '.$order_by_direction.' LIMIT '.$limit_from.', '.$limit_results);
|
||
}
|
||
|
||
public function count_all_approval_templates()
|
||
{
|
||
return count(self::$db->query("SELECT at.id FROM approval_templates at"));
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/models/approval_template_item.php | ||
---|---|---|
<?php
|
||
class Approval_template_item_Model extends ORM {
|
||
protected $belongs_to = array('approval_template', 'approval_type');
|
||
|
||
|
||
public function get_all_items_by_template_id ($template_id)
|
||
{
|
||
return self::$db->query('SELECT i.*, t.id AS type_id, t.name, ag.id AS group_id, ag.name AS group_name, t.type, t.interval, t.min_suggest_amount
|
||
FROM approval_template_items i
|
||
LEFT JOIN approval_types t ON t.id = i.approval_type_id
|
||
LEFT JOIN aro_groups ag ON t.aro_group_id = ag.id
|
||
WHERE i.approval_template_id = '.$template_id.'
|
||
ORDER BY i.priority');
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/models/job.php | ||
---|---|---|
GROUP BY j.id) as q
|
||
LEFT JOIN job_reports r ON q.job_report_id = r.id
|
||
LEFT JOIN transfers t ON q.transfer_id = t.id
|
||
WHERE q.sum > 0 AND j.job_report_id IS NULL AND q.user_id = '.$user_id);
|
||
WHERE q.sum > 0 AND q.job_report_id IS NULL AND q.user_id = '.$user_id);
|
||
}
|
||
|
||
public function get_all_rejected_works_by_user ($user_id)
|
||
... | ... | |
GROUP BY j.id) as q
|
||
LEFT JOIN job_reports r ON q.job_report_id = r.id
|
||
LEFT JOIN transfers t ON q.transfer_id = t.id
|
||
WHERE q.sum <= 0 AND j.job_report_id IS NULL AND q.user_id = '.$user_id);
|
||
WHERE q.sum <= 0 AND q.job_report_id IS NULL AND q.user_id = '.$user_id);
|
||
}
|
||
|
||
/*
|
freenetis/trunk/kohana/application/controllers/approval_templates.php | ||
---|---|---|
<?php
|
||
/**
|
||
*
|
||
* @author Michal Kliment
|
||
* @copyright (c) 2010 Kliment Michal
|
||
* @license GNU GPLv3
|
||
* @license http://www.gnu.org/licenses/gpl.txt
|
||
*/
|
||
|
||
class Approval_templates_Controller extends Controller
|
||
{
|
||
public function index()
|
||
{
|
||
url::redirect(url_lang::base().'approval_templates/show_all');
|
||
}
|
||
|
||
public function show_all($limit_results = 100, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
// gets new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$approval_template_model = new Approval_template_Model();
|
||
$total_approval_templates = $approval_template_model->count_all_approval_templates();
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_approval_templates)
|
||
$sql_offset = 0;
|
||
|
||
$approval_templates = $approval_template_model->get_all_approval_templates($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
// create grid
|
||
$grid = new Grid(url_lang::base().'approval_templates/show_all', url_lang::lang('texts.List of all approval templates'), array(
|
||
//'separator' => '',
|
||
'use_paginator' => true,
|
||
'use_selector' => true,
|
||
'current' => $limit_results, //current selected 'records_per_page' value
|
||
'selector_increace' => 100, // increace
|
||
'selector_min' => 100, // minimum where selector start
|
||
'selector_max_multiplier' => 20,
|
||
'base_url' => Config::get('lang').'/approval_templates/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_approval_templates, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
//'query_string' => $query_string
|
||
));
|
||
|
||
//if ($this->acl_check_new('Users_Controller','work'))
|
||
$grid->add_new_button(url_lang::base().'approval_templates/add', url_lang::lang('texts.Add new approval template'));
|
||
|
||
$grid->order_field('id')->label(url_lang::lang('texts.Id'));
|
||
$grid->order_callback_field('name')->label(url_lang::lang('texts.Name'))->callback('Approval_templates_Controller::name_field');
|
||
$grid->order_callback_field('comment')->label(url_lang::lang('texts.Comment'))->callback('Approval_templates_Controller::comment_field');
|
||
$grid->order_field('types_count')->label(url_lang::lang('texts.Types count'));
|
||
|
||
$grid->datasource($approval_templates);
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Approval');
|
||
$view->content = new View('approval');
|
||
$view->content->grid = $grid;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
public function show($approval_template_id = NULL)
|
||
{
|
||
if (!$approval_template_id || !is_numeric($approval_template_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$approval_template = new Approval_template_Model($approval_template_id);
|
||
|
||
if (!$approval_template->id)
|
||
Controller::error(RECORD);
|
||
|
||
$approval_template_item_model = new Approval_template_item_Model();
|
||
$approval_template_items = $approval_template_item_model->get_all_items_by_template_id($approval_template->id);
|
||
|
||
// create grid
|
||
$items_grid = new Grid(url_lang::base().'approval_templates/show/'.$approval_template->id, '', array(
|
||
//'separator' => '',
|
||
'use_paginator' => false,
|
||
'use_selector' => false,
|
||
'total_items' => count ($approval_template_items)
|
||
));
|
||
|
||
$items_grid->field('type_id')->label(url_lang::lang('texts.Id'));
|
||
$items_grid->callback_field('name')->label(url_lang::lang('texts.Name'))->callback('Approval_types_Controller::name_field');
|
||
$items_grid->callback_field('group_id')->label(url_lang::lang('texts.Group'))->callback('Approval_types_Controller::group_field');
|
||
$items_grid->callback_field('type')->label(url_lang::lang('texts.Type'))->callback('Approval_types_Controller::type_field');
|
||
$items_grid->callback_field('interval')->label(url_lang::lang('texts.Interval'))->callback('Approval_types_Controller::interval_field');
|
||
$items_grid->callback_field('min_suggest_amount')->label(url_lang::lang('texts.Minimal suggest amount'))->callback('Approval_types_Controller::min_suggest_amount_field');
|
||
$items_grid->field('priority')->label(url_lang::lang('texts.Priority'));
|
||
|
||
$items_grid->datasource($approval_template_items);
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Show approval template');
|
||
$view->content = new View('approval_templates_show');
|
||
$view->content->approval_template = $approval_template;
|
||
$view->content->items_grid = $items_grid;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
public static function name_field($item, $name)
|
||
{
|
||
echo html::anchor(url_lang::base().'approval_templates/show/'.$item->id, $item->name, array('title' => url_lang::lang('texts.Show approval template')));
|
||
}
|
||
|
||
public static function comment_field($item, $name)
|
||
{
|
||
echo $item->comment;
|
||
}
|
||
}
|
freenetis/trunk/kohana/application/controllers/approval_types.php | ||
---|---|---|
$grid->add_new_button(url_lang::base().'approval_types/add', url_lang::lang('texts.Add new approval type'));
|
||
|
||
$grid->order_field('id')->label(url_lang::lang('texts.Id'));
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
|
||
$grid->order_callback_field('name')->label(url_lang::lang('texts.Name'))->callback('Approval_types_Controller::name_field');
|
||
$grid->order_callback_field('group_id')->label(url_lang::lang('texts.Group'))->callback('Approval_types_Controller::group_field');
|
||
$grid->order_field('type')->label(url_lang::lang('texts.Type'));
|
||
$grid->order_callback_field('type')->label(url_lang::lang('texts.Type'))->callback('Approval_types_Controller::type_field');
|
||
$grid->order_callback_field('interval')->label(url_lang::lang('texts.Interval'))->callback('Approval_types_Controller::interval_field');
|
||
$grid->order_callback_field('min_suggest_amount')->label(url_lang::lang('texts.Minimal suggest amount'))->callback('Approval_types_Controller::min_suggest_amount_field');;
|
||
|
||
// access control
|
||
//if ($this->acl_check_view('Users_Controller','work'))
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'approval_types/show') ->action(url_lang::lang('texts.Show'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'approval_types/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
|
||
$grid->action_field('id')->label(url_lang::lang('texts.Delete')) ->url(url_lang::base().'approval_types/delete') ->action(url_lang::lang('texts.Delete'))->class('center');
|
||
|
||
$grid->datasource($approval_types);
|
||
|
||
$view = new View('main');
|
||
... | ... | |
$view->render(TRUE);
|
||
}
|
||
|
||
public function show($approval_type_id = NULL)
|
||
{
|
||
if (!$approval_type_id || !is_numeric($approval_type_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$approval_type = new Approval_type_Model($approval_type_id);
|
||
|
||
if (!$approval_type->id)
|
||
Controller::error(RECORD);
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Show approval type');
|
||
$view->content = new View('approval_types_show');
|
||
$view->content->approval_type = $approval_type;
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
public function add()
|
||
{
|
||
|
||
... | ... | |
$form->dropdown('aro_group_id')->label(url_lang::lang('texts.Group'))->options($arr_aro_groups)->rules('required');
|
||
$form->dropdown('type')->label(url_lang::lang('texts.Type'))->options(Approval_type_Model::$types)->rules('required');
|
||
$form->input('interval')->label(url_lang::lang('texts.Interval').':')->rules('valid_numeric')->help(url_lang::lang('texts.In hours'));
|
||
$form->input('suggest_amount')->label(url_lang::lang('texts.Suggest amount').':')->rules('valid_numeric');
|
||
$form->input('min_suggest_amount')->label(url_lang::lang('texts.Suggest amount').':')->rules('valid_numeric');
|
||
|
||
$form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
|
||
$approval_type = new Approval_type_Model();
|
||
$approval_type->name = $form_data['name'];
|
||
$approval_type->comment = $form_data['comment'];
|
||
$approval_type->aro_group_id = $form_data['aro_group_id'];
|
||
$approval_type->type = $form_data['type'];
|
||
$approval_type->interval = date::from_interval($form_data['interval']);
|
||
$approval_type->min_suggest_amount = $form_data['min_suggest_amount'];
|
||
$approval_type->save();
|
||
|
||
$this->session->set_flash('message', url_lang::lang('texts.Approval type has been successfully added.'));
|
||
url::redirect(url_lang::base().'approval_types/show/'.$approval_type->id);
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Add new approval type');
|
||
$view->content = new View('form');
|
||
$view->content->headline = url_lang::lang('texts.Add new approval type');
|
||
$view->content->link_back = '';
|
||
$view->content->link_back = html::anchor(url_lang::base().'approval_types/show_all', url_lang::lang('texts.Back to list of all approval types'));
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
public function edit($approval_type_id = NULL)
|
||
{
|
||
if (!$approval_type_id || !is_numeric($approval_type_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$approval_type = new Approval_type_Model($approval_type_id);
|
||
|
||
if (!$approval_type->id)
|
||
Controller::error(RECORD);
|
||
|
||
$aro_group_model = new Aro_group_Model();
|
||
$aro_groups = $aro_group_model->get_traverz_tree();
|
||
|
||
$arr_aro_groups = array();
|
||
|
||
foreach ($aro_groups as $aro_group)
|
||
{
|
||
$ret = '';
|
||
for($j = 0; $j < count_parent($aro_group->id) - 1; $j++ )
|
||
$ret .= ' ';
|
||
|
||
$arr_aro_groups[$aro_group->id] = $ret.url_lang::lang('texts.'.$aro_group->name);
|
||
}
|
||
|
||
// form
|
||
$form = new Forge(url_lang::base().'approval_types/edit/'.$approval_type->id, '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
|
||
$form->group('')->label(url_lang::lang('texts.Basic information'));
|
||
$form->input('name')->label(url_lang::lang('texts.Name').':')->rules('required|length[0,250]')->value($approval_type->name);
|
||
$form->textarea('comment')->label(url_lang::lang('texts.Comment').':')->rules('length[0,65535]')->value($approval_type->comment);
|
||
$form->dropdown('aro_group_id')->label(url_lang::lang('texts.Group'))->options($arr_aro_groups)->rules('required')->selected($approval_type->aro_group_id);
|
||
$form->dropdown('type')->label(url_lang::lang('texts.Type'))->options(Approval_type_Model::$types)->rules('required')->selected($approval_type->type);
|
||
$form->input('interval')->label(url_lang::lang('texts.Interval').':')->rules('valid_numeric')->help(url_lang::lang('texts.In hours'))->value(date::interval($approval_type->interval));
|
||
$form->input('min_suggest_amount')->label(url_lang::lang('texts.Suggest amount').':')->rules('valid_numeric')->value($approval_type->min_suggest_amount);
|
||
|
||
$form->submit('submit')->value(url_lang::lang('texts.Save'));
|
||
special::required_forge_style($form, ' *', 'required');
|
||
|
||
if ($form->validate())
|
||
{
|
||
$form_data = $form->as_array();
|
||
|
||
$approval_type = new Approval_type_Model($approval_type_id);
|
||
$approval_type->name = $form_data['name'];
|
||
$approval_type->comment = $form_data['comment'];
|
||
$approval_type->aro_group_id = $form_data['aro_group_id'];
|
||
$approval_type->type = $form_data['type'];
|
||
$approval_type->interval = date::from_interval($form_data['interval']);
|
||
$approval_type->min_suggest_amount = $form_data['min_suggest_amount'];
|
||
$approval_type->save();
|
||
|
||
$this->session->set_flash('message', url_lang::lang('texts.Approval type has been successfully updated.'));
|
||
url::redirect(url_lang::base().'approval_types/show/'.$approval_type->id);
|
||
}
|
||
|
||
$view = new View('main');
|
||
$view->title = url_lang::lang('texts.Edit approval type');
|
||
$view->content = new View('form');
|
||
$view->content->headline = url_lang::lang('texts.Edit approval type');
|
||
$view->content->link_back = html::anchor(url_lang::base().'approval_types/show/'.$approval_type->id, url_lang::lang('texts.Back to the approval type'));
|
||
$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
}
|
||
|
||
public function delete($approval_type_id = NULL)
|
||
{
|
||
if (!$approval_type_id || !is_numeric($approval_type_id))
|
||
Controller::warning(PARAMETER);
|
||
|
||
$approval_type = new Approval_type_Model($approval_type_id);
|
||
|
||
if (!$approval_type->id)
|
||
Controller::error(RECORD);
|
||
|
||
$approval_type->delete();
|
||
$this->session->set_flash('message', url_lang::lang('texts.Approval type has been successfully deleted.'));
|
||
url::redirect(url_lang::base().'approval_types/show_all');
|
||
}
|
||
|
||
public static function name_field($item, $name)
|
||
{
|
||
echo html::anchor(url_lang::base().'approval_types/show/'.$item->id, $item->name, array('title' => url_lang::lang('texts.Show approval type')));
|
||
}
|
||
|
||
public static function type_field($item, $name)
|
||
{
|
||
echo Approval_type_Model::$types[$item->type];
|
||
}
|
||
|
||
public static function group_field($item, $name)
|
||
{
|
||
if ($item->group_id)
|
||
... | ... | |
if (!$item->interval)
|
||
echo url_lang::lang('texts.None');
|
||
else
|
||
echo date::interval($item->interval);
|
||
echo date::interval($item->interval).' '.strtolower(url_lang::lang('texts.hours'));
|
||
}
|
||
|
||
public static function min_suggest_amount_field($item, $name)
|
freenetis/trunk/kohana/application/views/approval_templates_show.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Show approval template') ?></h2>
|
||
<?php echo ($message = $this->session->get('message')) ? '<div class="message">'.$message.'</div>' : ''; ?>
|
||
<?php
|
||
$links = array();
|
||
$links[] = html::anchor(url_lang::base().'approval_templates/show_all', url_lang::lang('texts.Back to list of all approval templates'));
|
||
|
||
$links[] = html::anchor(url_lang::base().'approval_templates/edit/'.$approval_template->id, url_lang::lang('texts.Edit'));
|
||
|
||
$links[] = html::anchor(url_lang::base().'approval_templates/delete/'.$approval_template->id, url_lang::lang('texts.Delete'));
|
||
|
||
echo implode (' | ', $links);
|
||
?>
|
||
<br /><br />
|
||
<table class="extended" cellspacing="0">
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.ID') ?></th>
|
||
<td><?php echo $approval_template->id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Name') ?></th>
|
||
<td><?php echo $approval_template->name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Comment') ?></th>
|
||
<td><?php echo $approval_template->comment ?></td>
|
||
</tr>
|
||
</table>
|
||
|
||
<?php echo $items_grid ?>
|
freenetis/trunk/kohana/application/views/approval_types_show.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Show approval type') ?></h2>
|
||
<?php echo ($message = $this->session->get('message')) ? '<div class="message">'.$message.'</div>' : ''; ?>
|
||
<?php
|
||
$links = array();
|
||
$links[] = html::anchor(url_lang::base().'approval_types/show_all', url_lang::lang('texts.Back to list of all approval types'));
|
||
|
||
$links[] = html::anchor(url_lang::base().'approval_types/edit/'.$approval_type->id, url_lang::lang('texts.Edit'));
|
||
|
||
$links[] = html::anchor(url_lang::base().'approval_types/delete/'.$approval_type->id, url_lang::lang('texts.Delete'));
|
||
|
||
echo implode (' | ', $links);
|
||
?>
|
||
<br /><br />
|
||
<table class="extended" cellspacing="0">
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.ID') ?></th>
|
||
<td><?php echo $approval_type->id ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Name') ?></th>
|
||
<td><?php echo $approval_type->name ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Comment') ?></th>
|
||
<td><?php echo $approval_type->comment ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Group') ?></th>
|
||
<td><?php echo url_lang::lang('texts.'.$approval_type->aro_group->name) ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Type') ?></th>
|
||
<td><?php echo Approval_type_Model::$types[$approval_type->type] ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Interval') ?></th>
|
||
<td><?php echo date::interval($approval_type->type) ?> <?php echo strtolower(url_lang::lang('texts.hours')) ?></td>
|
||
</tr>
|
||
<tr>
|
||
<th><?php echo url_lang::lang('texts.Minimal suggest amount') ?></th>
|
||
<td><?php echo $approval_type->min_suggest_amount ?></td>
|
||
</tr>
|
||
</table>
|
freenetis/trunk/kohana/application/views/approval.php | ||
---|---|---|
<h2><?php echo url_lang::lang('texts.Approval') ?></h2>
|
||
<?php echo ($message = $this->session->get('message')) ? '<div class="message">'.$message.'</div>' : ''; ?>
|
||
<br />
|
||
<?php echo html::anchor(url_lang::base().'approval/templates', url_lang::lang('texts.Approval templates')) ?> |
|
||
<?php echo html::anchor(url_lang::base().'approval_templates', url_lang::lang('texts.Approval templates')) ?> |
|
||
<?php echo html::anchor(url_lang::base().'approval_types', url_lang::lang('texts.Approval types')) ?>
|
||
<br /><br />
|
||
<?php echo $grid ?>
|
Také k dispozici: Unified diff
Dalsi prace na hlasovani - pridany hlasovaci sablony...