Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 1230

Přidáno uživatelem Ondřej Fibich před asi 13 roky(ů)

Novinky - nove vykazy:

- Prepracovany vykazy, nyni jsou rozdeleny na 2 typy: shlukle prace a mesicni vykazy
- Rozhrani pro pridavani jen podobne excel dokumentu pro zrychleni vyplnovani.
- Vykazy nejsou primo zasilane pro hlasovani ale pouze je pouzit model konceptu, kdy uzivatel doplnuje a upravuje vykaz a az uzna za vhodne, tak tento koncept posle k hlasovani.
- Prozatim neimplementovano hlasovani.

Upravy:

- vylepseno rozhrani praci funkcemi pouzitymi ve vykazech
- vylepsen vzhled tlacitek akci u Gridu
- kontroller JS nyni umoznuje vkladat javascripty mimo sekci $(document).ready()

Opravy:

- automaticke vytvoreni popisku sloupce Gridu ze jmena sloupce

Zobrazit rozdíly:

freenetis/branches/testing/media/css/style.css
display: block;
}
input.error, input.error:focus, textarea.error, textarea.error:focus, select.error, select.error:focus {
border: 1px solid red;
}
.dispNone {
display:none;
}
......
.right { text-align:right; }
.justify { text-align:justify; }
.bold { font-weight:bold; }
.normal { font-weight:normal; }
.ajax-loader {
position:absolute;
......
/* Action icon of grid */
a.action_field_icon {
display: block;
padding: 2px;
margin-right: 2px;
text-decoration: none;
}
a.action_field_icon:hover {
background-color: #EC7A04;;
a.action_field_icon:hover img {
background-color: #EC7A04;
border-color: #ac8736;
}
a.action_field_icon img {
border: none;
padding: 1px;
border: 1px solid #ccc;
background-color: white;
-moz-border-radius: 2px;
-webkit-border-radius: 2px;
border-radius: 2px;
}
table.no_table, table.no_table tr, table.no_table td, table.no_table th {
margin: 0px;
padding: 0px;
border: none;
}
.one_row_textarea {
height: 16px;
margin: 2px 10px;
}
freenetis/branches/testing/media/css/forms.css
.form th {
background-color:#F1F1F1;
width:200px;
padding:5px 0 5px 2px;
padding:5px 0 5px 5px;
text-align:left;
}
.form th.group {
......
background-color:#ffffff;
font-weight:bold;
padding:0px;
cursor: pointer;
}
.button_big {
freenetis/branches/testing/application/i18n/cs_CZ/texts.php
'add vote' => 'Přidat hlas',
'add vote about work' => 'Přidat hlas o práci',
'add wireless setting' => 'Přidat bezdrátové nastavení',
'add work' => 'Přidat práci',
'added' => 'Přidáno',
'added by' => 'Přidal',
'another contact information' => 'Další kontaktní informace',
......
'comments count' => 'Počet komentářů',
'comments of user' => 'komentáře uživatele',
'company' => 'Firemní',
'concept of report has been sended fo approval' => 'Koncept výkazu byl zaslán na hlasování o schválení.',
'configuration files' => 'Konfigurační soubory',
'confirm' => 'Potvrdit',
'confirm password' => 'Heslo znovu',
......
'content of file htaccess' => 'Obsah souboru .htaccess',
'content of the message for e-mail' => 'Obsah zprávy pro e-mail',
'content of the message for redirection' => 'Obsah zprávy pro přesměrování',
'continue with works filling' => 'Pokračovat vyplňováním prací',
'contractual increase' => 'Smluvní navýšení',
'cookies must be enabled' => 'Musí být zapnuty cookies.',
'count' => 'Počet',
......
'count of address points' => 'Počet adresních bodů',
'count of allowed subnets' => 'Počet povolených podsítí',
'count of members' => 'Počet členů',
'count of works' => 'Počet prací',
'counteraccount' => 'Protiúčet',
'counteraccount bank code' => 'Kód banky protiúčtu',
'counteraccount name' => 'Název protiúčtu',
......
'deposit' => 'Vklad',
'descending' => 'Sestupně',
'description' => 'Popis',
'description of work' => 'Popis práce',
'describe what you have been doing, when the error came out' => 'Popište jakou akci jste prováděl(a), když se objevila tato chyba',
'description of work report' => 'Popis pracovního výkazu',
'deselect all' => 'Zrušit výběr',
'destination' => 'Destinace',
'destination account' => 'Cílový účet',
......
'error - cannot delete bank statement' => 'Chyba - nelze smazat bankovní výpis.',
'error - cannot load intelligent selection' => 'Chyba - nelze načíst inteligentní výběr',
'error - cannot update message' => 'Chyba - nelze upravit zprávu.',
'srror - cannot remove admin of cloud' => 'Chyba - nelze odebrat admina oblasti',
'error - cannot remove admin of cloud' => 'Chyba - nelze odebrat admina oblasti',
'error - cannot save data' => 'Chyba - nelze uložit data.',
'error - cannot send email to applicant about approval of membership' => 'Chyba - nepodařilo se poslat email žadateli s vyhověním jeho žádosti o členství',
'error - cannot send email to applicant about deny of membership' => 'Chyba - nepodařilo se poslat email žadateli s nevyhověním jeho žádosti o členství',
......
'error - cant add new transfer' => 'Chyba -nelze přidat nový převod.',
'error - cant add new user' => 'Chyba - nelze vytvořit uživatele.',
'error - cant add new work' => 'Chyba - nelze přidat novou práci.',
'error - cant add new work report' => 'Chyba - nelze přidat pracovní výkaz.',
'error - cant add private phone contact' => 'Chyba - nelze přidat soukromí telefonní kontakt.',
'error - cant deduct entrance fee' => 'Chyba - nelze strhnout vstupní příspěvek.',
'error - cant delete address point' => 'Chyba - nelze smazat adresní bod.',
......
'error - can\'t delete translation' => 'Chyba - nelze smazat překlad.',
'error - cant do the transfer' => 'Chyba - nelze provést transakci.',
'error - cant edit fee' => 'Chyba - nelze upravit poplatek.',
'error - cant edit work report' => 'Chyba - nelze editovat pracovní výkaz',
'error - cant end membership' => 'Chyba - nelze ukončit členství.',
'error - cant change password' => 'Chyba - nelze změnit heslo.',
'error - cant change limit' => 'Chyba - nelze změnit limit.',
......
'fill in gps' => 'Doplnit GPS',
'fill in at least one from prices' => 'Vyplňte alespoň jednu z cen.',
'fill in field' => 'Doplňte pole',
'filled' => 'Vyplněno',
'filter' => 'Filtrovat',
'finances' => 'Finance',
'financial state of member' => 'Finanční stav člena',
......
'first number can\'t be larger then second number' => 'První číslo nesmí být větší než druhé číslo',
'first or last day of month is not valid' => 'První nebo poslední den v měsíci není správně.',
'firstname of user' => 'Křestní jméno uživatele',
'for' => 'Za',
'for all type' => 'Pro všechny typy',
'fixed line' => 'Pevná linka',
'fixed line number' => 'Číslo v pevné lince',
......
'generate smokeping configuration file' => 'Generovat konfigurační soubor smokepingu',
'generation of configuration files' => 'Generování konfiguračních souborů',
'good' => 'Dobré',
'gw' => 'sp',
'gps' => 'GPS souřadnice',
'gps coordinates has to be filled in' => 'GPS souřadnice musí být vyplněny',
'graph of increase and decrease of members' => 'Graf přírůstku a úbytku členů',
......
'group' => 'Skupina',
'group by' => 'Shlukovat',
'group selection by same phone number' => 'Sdružovat výběry dle telefonních čísel',
'grouped works' => 'Shluklé práce',
'groups of users' => 'Skupiny uživatelů',
'growth of members' => 'Růst členů',
'hello' => 'Dobrý den',
......
'list of tariffs of member' => 'Seznam tarifů člena',
'list of whitelisted members' => 'Seznam členů na bílé listině',
'list of works of user' => 'Seznam prací uživatele',
'list of work reports of user' => 'Seznam pracovních výkazů uživatele',
'loading...' => 'Nahrávám...',
'loading data, please wait' => 'Nahrávám data, prosím čekejte',
'location address' => 'Adresa umístění',
......
'my transfers' => 'Moje převody',
'my users' => 'Moji uživatelé',
'my voip calls' => 'Moje VoIP hovory',
'my work reports' => 'Moje pracovní výkazy',
'my works' => 'Moje práce',
'mwr' => 'mpr',
'n' => 'U',
'name' => 'Jméno',
'name of error' => 'Název chyby',
......
'payment notice' => 'Upozornění na placení',
'payment notice boundary' => 'Hranice pro upozornění na placení',
'payment notice text' => 'Text pro upozornění na placení',
'payment per hour' => 'Hodinový plat',
'pays' => 'Platby',
'peak' => 'Špička',
'penalty' => 'Pokuta',
......
'prepaid' => 'Předplacený',
'price' => 'Cena',
'price out of tax' => 'Cena bez DPH',
'price per kilometre' => 'Cena za kilometr',
'price per one hour, kilometre' => 'Cena za jednu hodinu, kilometr',
'price vat' => 'Cena s DPH',
'primary dns' => 'Primární DNS.',
'primary user of member cannot be deleted' => 'Primárního uživatele člena nelze smazat.',
......
'remove' => 'Odebrat',
'remove broadcast ip address' => 'Odebrat IP adresu broadcastu',
'remove network ip address' => 'Odebrat IP adresu sítě',
'remove this work' => 'Odstranit tuto práci',
'reply' => 'Odpovědět',
'reported by' => 'Nahlásil',
'repository root' => 'Kořen úložiště',
......
'rules breaking' => 'Porušování pravidel',
'save changes' => 'Uložit změny',
'save' => 'Uložit',
'save concept' => 'Uložit koncept',
'save wireless setting' => 'Uložit bezdrátové nastavení',
'sc' => 'SZ',
'schedule' => 'Plán',
......
'send sms' => 'Pošli SMS',
'send sms message' => 'Poslat SMS zprávu',
'send to member' => 'Pošli členovi',
'send this concept for approval' => 'Zaslat tento koncept na hlasování o schválení',
'sent' => 'Odeslaná',
'sent e-mails' => 'Odeslané e-maily',
'sent message' => 'Odeslaná zpráva',
......
'some phones wasn\'t founded' => 'Některé telefony nebyly nalezeny',
'someone from the ip address %s, probably you, requested to change your password' => 'někdo, patrně Vy, žádal z IP %s o změnu vašeho hesla',
'specific symbol' => 'Specifický symbol',
'specification of type' => 'Specifikace typu',
'ssh key' => 'SSH klíč',
'ssh keys' => 'SSH klíče',
'start amount' => 'Počáteční částka',
......
'this member has default system member fee %d %s' => 'Tento člen má výchozí systémový členský příspěvek %d %s.',
'this month has been already deducted!' => 'Tento měsíc už byl stržen!',
'this month traffic' => 'Provoz za tento měsíc',
'this report is your concept, you can edit it till you think that it is ready for approval' => 'Tento výkaz je váš koncept, můžete jej editovat dokud si nemyslíte, že je připraven na hlasování o schválení.',
'this subnet is disabled' => 'Tato podsíť je zakázána.',
'this subnet is enabled' => 'Tato podsíť je povolena.',
'this week traffic' => 'Provoz za tento týden',
......
'too short' => 'Příliš krátké',
'tools' => 'Nástroje',
'total' => 'Celkem',
'total count' => 'Celkový počet',
'total download' => 'Celkový download',
'total found items' => 'Celkem nalezeno položek',
'total inbound' => 'Celkem příchozí',
......
'translation has been successfully deleted' => 'Překlad byl úspěšně smazán.',
'translation has been successfully updated' => 'Překlad byl úspěšně aktualizován.',
'translations' => 'Překlady',
'type' => 'Typ',
'type of contact' => 'Typ kontaktu',
'type of double-entry account' => 'Typ podvojného účtu',
'type of the recipient' => 'Typ příjemce',
'type of redirection' => 'Typ přesměrování',
'type of report' => 'Typ výkazu',
'type of traffic' => 'Typ provozu',
'type' => 'Typ',
'types count' => 'Počet typů',
'unconfirmed works' => 'Nepotvrzené práce',
'unidentified transfers' => 'Neidentifikované platby',
......
'work hasn\'t been successfully confirmed' => 'Práce nebyla úspěšně akutualizována',
'work report' => 'Pracovní výkaz',
'work report approval' => 'Schválení pracovního výkazu',
'work report details' => 'Detaily pracovního výkazu',
'work report has been successfully added' => 'Pracovní výkaz byl úspěšně přidán',
'work report has been successfully deleted' => 'Pracovní výkaz byl úspěšně smazán',
'work report has been successfully updated' => 'Pracovní výkaz byl úspěšně aktualizován',
'work report has to have at least one work' => 'Pracovní výkaz musí obsahovat alespoň jednu práci.',
'work report per month' => 'Měsíční pracovní výkaz',
'work reports' => 'Pracovní výkazy',
'worker' => 'Pracovník',
'works' => 'Práce',
'works of report' => 'Práce ve výkazu',
'write email' => 'Napsat e-mail',
'write new message' => 'Napsat novou zprávu',
'wrong call length' => 'Chybné trvání hovoru',
......
'you will need to know the following items before proceeding' => 'Budete potřebovat znát následující položky před pokračováním:',
'your ip address has not been found in database' => 'Vaše IP adresa nebyla nalezena v databázi.',
'your accout has been locked' => 'Váš účet byl uzamčen.',
'your concepts of work reports' => 'Vaše koncepty pracovních výkazů',
'your email' => 'Váš email',
'your request for membership has not been approved yet' => 'Vaše žádost o členství zatím nebyla schválena',
'your mysql password' => 'Vaše MySQL heslo.',
freenetis/branches/testing/application/vendors/unit_tester/unit_testing_config.xml
</input>
</values>
</method>
<method name="store_transfer_ebanka" autogenerate="on">
<attributes>
<attribute name="data" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
</controller>
<controller name="installation">
<method name="index" autogenerate="on">
......
<input></input>
</values>
</method>
<method name="show_by_user" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
<method name="show" autogenerate="off">
<attributes>
<attribute name="work_report_id" default_value=""/>
......
</input>
</values>
</method>
<method name="concept_change" autogenerate="on">
<attributes>
<attribute name="work_report_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="" />
</input>
</values>
</method>
</controller>
<controller name="works">
<method name="index" autogenerate="on">
......
</values>
</method></model>
<model name="job_report">
<method name="get_state" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_works_of_monthly_workreport" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_work_report" autogenerate="off">
<attributes>
<attribute name="work_report_id" default_value=""/>
......
</input>
</values>
</method>
<method name="count_all_pending_work_reports" autogenerate="on">
<method name="delete_works" autogenerate="on">
<attributes>
<attribute name="filter_values" default_value="array()" />
<attribute name="preserved_keys" default_value="array()" />
<attribute name="work_report_id" default_value="" />
</attributes>
<values>
<input></input>
<input>
<param value="array()" />
</input>
<input>
<param value="array()" />
<param value="" />
</input>
</values>
</method>
<method name="count_all_pending_work_reports" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="count_all_approved_work_reports" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="count_all_rejected_work_reports" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
<method name="get_concepts_work_reports_of_user" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_approved_work_reports_of_user" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_rejected_work_reports_of_user" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="get_pending_work_reports_of_user" autogenerate="on">
<attributes>
<attribute name="user_id" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
</model>
<model name="log">
<method name="create_table" autogenerate="off">
......
</input>
</values>
</method>
<method name="device_ssid" autogenerate="on">
<attributes>
<attribute name="keyword" default_value="" />
</attributes>
<values>
<input>
<param value="" />
</input>
</values>
</method>
<method name="subnet_name" autogenerate="off">
<attributes>
<attribute name="keyword" default_value=""/>
......
<param value="1'+1"/>
</input>
</values>
</method></model>
</method>
</model>
<model name="segment">
<method name="count_all_segments" autogenerate="on">
<attributes>
......
</input>
</values>
</method>
<method name="get_full_name" autogenerate="on">
<attributes></attributes>
<values>
<input></input>
</values>
</method>
</model>
<model name="users_contacts">
<method name="set_whitelist_by_member_and_type" autogenerate="on">
......
</method>
</helper>
<helper name="callback">
<method name="limited_text" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="work_report_type" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
<attribute name="name" default_value=""/>
</attributes>
<values>
</values>
</method>
<method name="balance_field" autogenerate="off">
<attributes>
<attribute name="item" default_value=""/>
freenetis/branches/testing/application/helpers/callback.php
class callback
{
/**
* Callback for limited text, text over 50 character is stripped and added to title.
*
* @author Ondrej Fibich
* @param object $item
* @param string $name
*/
public static function limited_text($item, $name)
{
$text = strip_tags($item->$name);
if (mb_strlen($text) > 50)
{
echo '<span title="' . text::limit_chars(htmlspecialchars($text), 200) . '">';
echo text::limit_chars(htmlspecialchars($text), 50);
echo '</span>';
}
else
{
echo $text;
}
}
/**
* Callback for work report type
*
* @author Ondrej Fibich
* @param object $item
* @param string $name
*/
public static function work_report_type($item, $name)
{
$type = $item->$name;
if ($type && preg_match("/^[0-9]{4}-[0-9]{1,2}$/", $type))
{
$date = explode('-', $type);
echo '<span title="' . __('Work report per month') . '" class="more">' . __('MWR', '', 3) . '</span> ';
echo __('for', '', 1);
echo ' <b>' . __(date::$months[intval($date[1])]) . ' ' . $date[0] . '</b>';
}
else
{
echo '<span title="' . __('Grouped works') . '" class="more">' . __('GW', '', 3) . '</span> ';
echo __('since', '', 1) . ' ';
echo date('j.n.Y', strtotime($item->date_from)) . ' ';
echo __('until', '', 1) . ' ';
echo date('j.n.Y', strtotime($item->date_to));
}
}
/**
* Callback for balance field in accounts.
* @author Jiri Svitak
* @param unknown_type $item
freenetis/branches/testing/application/helpers/form.php
// Inner key should always be a string
$inner_key = (string) $inner_key;
$sel = (in_array($inner_key,$selected)) ? ' selected' : '';
$sel = (in_array($inner_key,$selected)) ? ' selected="selected"' : '';
$input .= '<option value="'.$inner_key.'"'.$sel.'>'.$inner_val.'</option>'."\n";
}
$input .= '</optgroup>'."\n";
}
else
{
$sel = (in_array($key,$selected)) ? ' selected' : '';
$sel = (in_array($key,$selected)) ? ' selected="selected"' : '';
$input .= '<option value';
if ($key!='')
$input.= '="'.$key.'"';
freenetis/branches/testing/application/models/user.php
) ORDER BY name
", $device_id);
}
/**
* Gets full name of user
*
* @return string
*/
public function get_full_name()
{
if (!$this->id)
return NULL;
return
(empty($this->pre_title) ? '' : $this->pre_title . ' ') .
$this->name . ' ' .
(empty($this->middle_name) ? '' : $this->middle_name . ' ') .
$this->surname .
(empty($this->post_title) ? '' : ', ' . $this->post_title);
}
}
freenetis/branches/testing/application/models/approval_template.php
*/
class Approval_template_Model extends ORM
{
protected $has_many = array('approval_template_items', 'jobs');
protected $has_many = array('approval_template_items', 'jobs', 'job_reports');
/**
* Function to return all approval templates
......
* @param number $approval_template_id
* @return number
*/
public function get_state($approval_template_id)
public function get_state($approval_template_id = NULL)
{
if ($approval_template_id == NULL && $this->id)
{
$approval_template_id = $this->id;
}
return $this->db->query("
SELECT IFNULL((MAX(j.state)+1),0) AS state FROM approval_templates t
LEFT JOIN jobs j ON j.approval_template_id = t.id
freenetis/branches/testing/application/models/job.php
*/
/**
* Users works
*
* @author Michal Kliment
* @package Model
*
* @property integer $job_report_id
* @property Job_report_Model $job_report
* @property integer $user_id
* @property User_Model $user
* @property integer $approval_template_id
* @property Approval_template_Model $approval_template
* @property integer $added_by_id
* @property User_Model $added_by
* @property string $description
* @property double $suggest_amount
* @property string $date
* @property string $create_date
* @property double $hours
* @property integer $km
*/
class Job_Model extends ORM
{
protected $belongs_to = array('user', 'approval_template');
protected $belongs_to = array
(
'user', 'added_by' => 'user',
'approval_template', 'job_report'
);
/**
* Function to return all pending works
......
* @param array $filter_values
* @return ORM iterator
*/
public function get_all_pending_works($limit_from = 0, $limit_results = 50,
$order_by = 'id', $order_by_direction = 'ASC', $filter_values = array())
public function get_all_pending_works(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
freenetis/branches/testing/application/models/job_report.php
<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is release under GPLv3 licence.
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
......
*/
/**
* @author Michal Kliment
* Model for job(work) reports. Groups works to one report.
*
* @author Ondřej Fibich
* @package Model
*
* @property integer $user_id
* @property User_Model $user
* @property integer $approval_template_id
* @property Approval_template_Model $approval_template
* @property string $description
* @property string $type
* @property double $price_per_hour
* @property double $price_per_km
* @property boolean $concept
* @property unknown_type $jobs
*/
class Job_report_Model extends ORM
{
protected $belongs_to = array('user', 'approval_template');
protected $has_many = array('jobs');
protected $belongs_to = array('user');
public function get_work_report($work_report_id)
/**
* Gets state of work reports from it's works
*
* @author Ondřej Fibich
* @staticvar array $cache Cache fo states
* @return integer
*/
public function get_state()
{
static $cache = array();
if (!$this->id)
{
return FALSE;
}
if (!isset($cache[$this->id]))
{
$cache[$this->id] = $this->db->query("
SELECT IFNULL(MAX(j.state), 0) AS state
FROM job_reports r
LEFT JOIN jobs j ON r.id = j.job_report_id
WHERE r.id = ?
", $this->id)->current()->state;
}
return $cache[$this->id];
}
/**
* Gets workd of montly workreport in array, blank days are filled by NULL
*
* @see Work_reports_Controller#edit()
* @author Ondřej Fibich
* @return array[object]
*/
public function get_works_of_monthly_workreport()
{
if (!$this->id || empty($this->type))
{
return array();
}
$jobs = array();
$job_model = new Job_Model();
$jobs_in_report = $job_model->get_all_works_by_job_report_id($this->id);
$year = intval(substr($this->type, 0, 4));
$month = intval(substr($this->type, 5, 6));
for ($i = 1; $i <= date::days_of_month($month, $year); $i++)
{
$day = ($i < 10) ? '0' . $i : $i;
$jobs[$i] = NULL;
if ($jobs_in_report->current() &&
$jobs_in_report->current()->date == $this->type . '-' . $day)
{
$jobs[$i] = $jobs_in_report->current();
$jobs_in_report->next();
}
}
return $jobs;
}
/**
* Gets work report with details
*
* @see Work_reports_Controller#edit()
* @author Ondřej Fibich
*
* @param integer $work_report_id
* @return object
*/
public function get_work_report($work_report_id = NULL)
{
if ($work_report_id == NULL && $this->id)
{
$work_report_id = $this->id;
}
$result = $this->db->query('
SELECT r.id, j.user_id, j.approval_template_id, u.member_id,
SELECT r.id, r.user_id, r.approval_template_id, u.member_id,
CONCAT(u.name, \' \', u.surname) as uname, r.description,
SUM(j.suggest_amount) AS suggest_amount, MIN(j.date) AS date_from,
MAX(j.date) AS date_to, SUM(j.hours) AS hours, SUM(j.km) AS km,
MAX(j.state) AS state, j.transfer_id
MAX(j.state) AS state, j.transfer_id, r.price_per_hour,
r.price_per_km, r.type, r.concept
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
GROUP BY r.id
HAVING r.id = ?
', $work_report_id);
if ($result && $result->count())
{
return $result->current();
}
return FALSE;
}
public function get_all_pending_work_reports($limit_from = 0, $limit_results = 50,
$order_by = 'id', $order_by_direction = 'ASC', $filter_values = array())
/**
* Delete works of report
*
* @param array $preserved_keys Array of preserved works (ID of work as value)
* @param integer $work_report_id ID of report
*/
public function delete_works($preserved_keys = array(), $work_report_id = NULL)
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
if ($work_report_id == NULL && $this->id)
{
$order_by_direction = 'asc';
$work_report_id = $this->id;
}
// query
return $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
FROM job_reports r
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
GROUP BY r.id
HAVING state < 2
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
');
$where = '';
if (is_array($preserved_keys) && count($preserved_keys))
{
array_map('intval', $preserved_keys);
$where = "AND id NOT IN(" . implode(', ', $preserved_keys) . ")";
}
$this->db->query("
DELETE FROM jobs
WHERE job_report_id = ?
$where
", $work_report_id);
}
public function get_all_approved_work_reports($limit_from = 0, $limit_results = 50,
$order_by = 'id', $order_by_direction = 'ASC', $filter_values = array())
/**
* Gets all work reports with given state
*
* @param integer $state
* @param integer $limit_from
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @param boolean $lower Should be operant to state < (= otherwise)
* @return ORM iterator
*/
private function _get_all_work_reports_with_state(
$state, $limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array(), $lower = FALSE)
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
......
}
// query
return $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
SELECT r.id, r.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
WHERE r.concept = 0
GROUP BY r.id
HAVING state = 3
HAVING state ' . ($lower ? '<' : '=') . ' ?
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
');
', $state);
}
public function get_all_rejected_work_reports($limit_from = 0, $limit_results = 50,
$order_by = 'id', $order_by_direction = 'ASC', $filter_values = array())
/**
* Gets all concepts of work reports of user
*
* @param integer $user_id
* @param integer $state
* @param boolean $lower Should be operant to state < (= otherwise)
* @return ORM iterator
*/
private function _get_report_concepts_of_user_by_state($user_id, $state, $lower = FALSE)
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
{
$order_by_direction = 'asc';
}
// query
return $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
SELECT r.id, r.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
WHERE r.concept = 0 AND r.user_id = ?
GROUP BY r.id
HAVING state = 2
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
');
HAVING state ' . ($lower ? '<' : '=') . ' ?
', $user_id, $state);
}
public function count_all_pending_work_reports($filter_values = array())
/**
* Counts all work reports with given state
*
* @param integer $state
* @param boolean $lower Should be operant to state < (= otherwise)
* @return integer
*/
private function _count_all_work_reports_with_state($state, $lower = FALSE)
{
$work_reports = $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
return count($this->db->query('
SELECT MAX(j.state) AS state
FROM job_reports r
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
WHERE r.concept = 0
GROUP BY r.id
HAVING state < 2
');
HAVING state ' . ($lower ? '<' : '=') . ' ?
', $state));
}
return count($work_reports);
/**
* Gets all pending work reports
*
* @param integer $limit_from
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @return ORM iterator
*/
public function get_all_pending_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
{
return $this->_get_all_work_reports_with_state(
2, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values, TRUE
);
}
public function count_all_approved_work_reports(
/**
* Gets all approved work reports
*
* @param integer $limit_from
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @return ORM iterator
*/
public function get_all_approved_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
{
$order_by_direction = 'asc';
}
// query
$work_reports = $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
FROM job_reports r
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
GROUP BY r.id
HAVING state = 3
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
');
return count($work_reports);
return $this->_get_all_work_reports_with_state(
3, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values
);
}
public function count_all_rejected_work_reports(
/**
* Gets all rejected work reports
*
* @param integer $limit_from
* @param integer $limit_results
* @param string $order_by
* @param string $order_by_direction
* @param array $filter_values
* @return ORM iterator
*/
public function get_all_rejected_work_reports(
$limit_from = 0, $limit_results = 50, $order_by = 'id',
$order_by_direction = 'ASC', $filter_values = array())
{
// order by direction check
if (strtolower($order_by_direction) != 'desc')
{
$order_by_direction = 'asc';
}
// query
$work_reports = $this->db->query('
SELECT r.id, j.user_id, CONCAT(u.name, \' \', u.surname) as uname,
r.description, SUM(j.suggest_amount) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to,
SUM(j.hours) AS hours, SUM(j.km) AS km, MAX(j.state) AS state
return $this->_get_all_work_reports_with_state(
2, $limit_from, $limit_results, $order_by,
$order_by_direction, $filter_values
);
}
/**
* Counts all pending work reports
*
* @return integer
*/
public function count_all_pending_work_reports()
{
return $this->_count_all_work_reports_with_state(2, TRUE);
}
/**
* Counts all approved work reports
*
* @return integer
*/
public function count_all_approved_work_reports()
{
return $this->_count_all_work_reports_with_state(3);
}
/**
* Counts all rejected work reports
*
* @return integer
*/
public function count_all_rejected_work_reports()
{
return $this->_count_all_work_reports_with_state(2);
}
/**
* Gets all concepted work reports of user
*
* @param integer $user_id
* @return ORM iterator
*/
public function get_concepts_work_reports_of_user($user_id)
{
return $this->db->query("
SELECT r.id, r.user_id, CONCAT(u.name, ' ', u.surname) as uname,
r.description, IFNULL(SUM(j.suggest_amount), 0.0) AS suggest_amount,
MIN(j.date) AS date_from, MAX(j.date) AS date_to, r.type,
IFNULL(SUM(j.hours), 0) AS hours, IFNULL(SUM(j.km), 0) AS km,
MAX(j.state) AS state
FROM job_reports r
LEFT JOIN users u ON u.id = r.user_id
LEFT JOIN jobs j ON r.id = j.job_report_id
LEFT JOIN users u ON j.user_id = u.id
WHERE r.concept = 1 AND r.user_id = ?
GROUP BY r.id
ORDER BY ' . $this->db->escape_column($order_by) . ' ' . $order_by_direction . '
LIMIT ' . intval($limit_from) . ', ' . intval($limit_results) . '
');
return count($work_reports);
", $user_id);
}
/**
* Gets all approved work reports of user
*
* @param integer $user_id
* @return ORM iterator
*/
public function get_approved_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 3);
}
/**
* Gets all rejected work reports of user
*
* @param integer $user_id
* @return ORM iterator
*/
public function get_rejected_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 2);
}
/**
* Gets all pending work reports of user
*
* @param integer $user_id
* @return ORM iterator
*/
public function get_pending_work_reports_of_user($user_id)
{
return $this->_get_report_concepts_of_user_by_state($user_id, 2, TRUE);
}
}
freenetis/branches/testing/application/controllers/js.php
private $view = NULL;
/**
* Array of other views
* Array of other views put into document ready
*
* @var array
*/
private $views = array();
/**
* Array of other views not puted into document ready
*
* @var array
*/
private $views_notready = array();
/**
* Constructor, only send header
*
* @author Michal Kliment
......
}
$this->view->views = $this->views;
$this->view->views_notready = $this->views_notready;
$this->view->render(TRUE);
}
......
$this->address_point_gps();
}
private function _js_ifaces_add()
{
$this->segment_iface();
}
private function _js_ifaces_edit($iface_id = NULL)
{
$this->segment_iface();
}
private function _js_members_add()
{
$this->address_point_gps();
......
$this->voip_calculator($user_id);
}
private function _js_ifaces_add()
private function _js_work_reports_add()
{
$this->segment_iface();
$this->work_report_form_functions();
}
private function _js_ifaces_edit($iface_id = NULL)
private function _js_work_reports_edit()
{
$this->segment_iface();
$this->work_report_form_functions();
}
/***************** Helper methods for javascript queries ******************/
......
View::factory('js/__pieces/segment_iface')->render();
}
/**
* Adds javascript for work reports forms
*/
private function work_report_form_functions()
{
$this->views_notready['__pieces_work_report_form_functions'] =
View::factory('js/__pieces/work_report_form_functions')->render();
}
}
freenetis/branches/testing/application/controllers/work_reports.php
{
// acccess control
if (!$this->acl_check_view('Users_Controller','work'))
{
Controller::error(ACCESS);
}
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
{
$limit_results = (int) $this->input->get('record_per_page');
}
$work_report_model = new Job_report_Model();
$total_work_reports = $work_report_model->count_all_pending_work_reports();
......
}
$grid->order_field('id')
->label(__('Id'));
->label('ID');
$grid->order_callback_field('uname')
->label(__('User name'))
->label('Worker')
->callback('Works_Controller::user_name');
$grid->order_field('description')
->label(__('Description'));
$grid->order_callback_field('description')
->callback('callback::limited_text');
$grid->order_field('date_from')
->label(__('Date from'));
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('date_to')
->label(__('Date to'));
$grid->order_field('hours');
$grid->order_field('hours')
->label(__('Hours'));
$grid->order_field('km');
$grid->order_field('km')
->label(__('Km'));
$grid->order_callback_field('suggest_amount')
->label(__('Suggest amount'))
->callback('Works_Controller::suggest_amount');
// access control
if ($this->acl_check_view('Users_Controller','work'))
$actions = $grid->grouped_action_field();
if ($this->acl_check_view('Users_Controller', 'work'))
{
$grid->action_field('id')
->label(__('Show'))
->url(url_lang::base().'work_reports/show')
->action(__('Show'))
->class('center');
$actions->add_action()
->icon_action('show')
->url('work_reports/show');
}
if ($this->acl_check_edit('Users_Controller', 'work'))
{
$actions->add_action()
->icon_action('edit')
->url('work_reports/edit');
}
$grid->datasource($work_reports);
......
$view = new View('main');
$view->title = __('Pending work reports');
$view->breadcrumbs = $breadcrumbs->html();
$view->content = new View('work_reports');
$view->content = new View('work_reports/show_all');
$view->content->grid = $grid;
$view->render(TRUE);
}
......
->label(__('Id'));
$grid->order_callback_field('uname')
->label(__('User name'))
->label(__('Worker'))
->callback('Works_Controller::user_name');
$grid->order_field('description')
->label(__('Description'));
$grid->order_field('date_from')
->label(__('Date from'));
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('date_to')
->label(__('Date to'));
$grid->order_field('hours')
->label(__('Hours'));
......
// access control
if ($this->acl_check_view('Users_Controller','work'))
{
$grid->action_field('id')
->label(__('Show'))
->url(url_lang::base().'work_reports/show')
->action(__('Show'))
->class('center');
$grid->grouped_action_field()
->add_action()
->icon_action('show')
->url('work_reports/show');
}
$grid->datasource($work_reports);
......
$view = new View('main');
$view->title = __('Approved work reports');
$view->breadcrumbs = $breadcrumbs->html();
$view->content = new View('work_reports');
$view->content = new View('work_reports/show_all');
$view->content->grid = $grid;
$view->render(TRUE);
}
......
$grid->order_field('id')->label(__('Id'));
$grid->order_callback_field('uname')
->label(__('User name'))
->label(__('Worker'))
->callback('Works_Controller::user_name');
$grid->order_field('description')
->label(__('Description'));
$grid->order_field('date_from')
->label(__('Date from'));
$grid->order_callback_field('type')
->callback('callback::work_report_type');
$grid->order_field('date_to')
->label(__('Date to'));
$grid->order_field('hours')
->label(__('Hours'));
......
->label(__('Suggest amount'))
->callback('Works_Controller::suggest_amount');
// access control
if ($this->acl_check_view('Users_Controller','work'))
$actions = $grid->grouped_action_field();
if ($this->acl_check_view('Users_Controller', 'work'))
{
$grid->action_field('id')
->label(__('Show'))
->url(url_lang::base().'work_reports/show')
->action(__('Show'))
->class('center');
$actions->add_action()
->icon_action('show')
->url('work_reports/show');
}
$grid->datasource($work_reports);
......
$view = new View('main');
$view->title = __('Rejected work reports');
$view->breadcrumbs = $breadcrumbs->html();
$view->content = new View('work_reports');
$view->content = new View('work_reports/show_all');
$view->content->grid = $grid;
$view->render(TRUE);
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff