Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 871

Přidáno uživatelem Jiří Sviták před více než 13 roky(ů)

Slouceni soucasnych zmen z testingu do vyvijene vetve noveho presmerovani.

Zobrazit rozdíly:

freenetis/branches/redirection/application/i18n/cs_CZ/texts.php
'accounting system' => 'Účetní osnova',
'accounts' => 'Účty',
'action' => 'Akce',
'action logs' => 'Logy akcí',
'action logs of object' => 'Logy akcí objektu',
'action logs of user' => 'Logy akcí uživatele',
'activate' => 'Aktivovat',
'activate redirection to member' => 'Aktivovat členovi přesměrování',
'activated number has not been changed' => 'Aktivované číslo již nelze změnit',
......
'after you\'ve done that, you can continue' => 'Poté, co tak učiníte, můžete pokračovat.',
'agree' => 'Souhlas',
'all' => 'Všichni',
'all accounts now have correct balances, %d accounts had incorrect balances' => 'Všechny účty teď mají správné zůstatky, %d účtů mělo chybné zůstatky.',
'all accounts now have correct balances, %d accounts had incorrect balances, list of ids of corrected accounts: %s' => 'Všechny účty teď mají správné zůstatky, %d účtů mělo chybné zůstatky, seznam ID opravených účtů: %s',
'all ip addresses of member' => 'všem IP adresám člena',
'all redirected' => 'Všichni přesměrovaní',
'all transfers' => 'Všechny převody',
......
'change language' => 'Změnit jazyk',
'change member limit' => 'Změnit limit člena',
'change password' => 'Změnit heslo',
'changed values' => 'Změněné hodnoty',
'change voicemail password' => 'Změnit heslo hlasové schránky',
'channel' => 'Kanál',
'check again' => 'Znovu zkontrolovat',
......
'database name' => 'Název databáze',
'database password' => 'Heslo k databázi',
'database username' => 'Uživatelské jméno k databázi',
'database variables' => 'Databázové proměnné',
'date' => 'Datum',
'date and time' => 'Datum a čas',
'date and time of creation' => 'Datum a čas vytvoření',
......
'device admins' => 'Správci zařízení',
'device engineers' => 'Technici zařízení',
'device detail' => 'Detail zařízení',
'device fees have been successfully deducted' => 'Splátky zařízení byly úspěšně strženy.',
'device fees have been successfully deducted, %d new transfers created' => 'Splátky zařízení byly úspěšně strženy, vytvořeno %d nových převodů.',
'device has been successfully deleted' => 'Zařízení bylo úspěšně smazáno.',
'device has been successfully saved' => 'Zařízení bylo úspěšně uloženo.',
'device has been successfully updated' => 'Zařízení bylo úspěšně upraveno.',
......
'e-mail variables have been successfully updated' => 'Proměnné e-mailu byly úspěšně aktualizovány.',
'e-mail variables havent been successfully updated' => 'Proměnné e-mailu nebyly úspěšně aktualizovány.',
'enable integrity test (all numbers in invoice has to be in extended statement)' => 'Povolit test na celistvost (každé číslo ve faktuře musí být v podrobném výpisu)',
'enable mysql event scheduler' => 'Povolit MySQL plánovač akcí',
'enabled' => 'Zapnuto',
'end membership' => 'Ukončit členství',
'end of month' => 'Konec měsíce',
......
'number of months' => 'Počet měsíců',
'number of the hours' => 'počet hodin',
'o' => 'V',
'object' => 'Objekt',
'october' => 'Říjen',
'of all approved work reports' => 'všech schválených pracovních výkazů',
'of all approved works' => 'všech schválených prací',
......
'show' => 'Zobrazit',
'show all confirmed works' => 'Zobraz všechnny potvrzené práce',
'show all invoices' => 'Zobrazit všechny faktury',
'show all logs' => 'Zobrazit všechny logy',
'show all messages' => 'Zobrazit všechnny zprávy',
'show all transfers on the account' => 'Ukaž všechny převody tohoto účtu',
'show all unconfirmed works' => 'Zobraz všechnny nepotvrzené práce',
......
'show transfers on this account' => 'Ukaž převody tohoto účtu',
'show unread messages' => 'Zobrazit nepřečtené zprávy',
'show user' => 'Ukaž uživatele',
'show user actions' => 'Zobraz uživatelovi akce',
'show voip account' => 'Zobrazit VoIP účet',
'show work' => 'Zobrazit práci',
'show work report' => 'Zobrazit pracovní výkaz',
......
'the request has been sent to your e-mail' => 'Žádost byla odeslána na Váš e-mail',
'the transfer successfully done' => 'Převod úspěšně dokončen',
'there are no items yet' => 'Neobsahuje žádné záznamy.',
'there are not any set tariffs for this member' => 'Pro tohoto člena nejsou nastaveny žádné tarify.',
'third-degree certified engineers' => 'Certifikovaní technici třetího stupně',
'this account does not exist' => 'Tento účet neexistuje.',
'this approval template already contains approval type with the same priority' => 'Tato hlasovací šablona již obsahuje hlasovací typ se stejnou prioritou.',
'this approval template already contains this approval type' => 'Tato hlasovací šablona již obsahuje tento hlasovací typ.',
'this member has already set up this fee type for this interval' => 'Tento člen má již nastaven tento typ poplatku pro tento interval.',
'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!',
'time' => 'Čas',
'time constraints' => 'Časová omezení',
......
'unlocked' => 'Odemčen',
'unlock invoice' => 'Odemčít fakturu',
'update' => 'Aktualizovat',
'updated' => 'Upraveno',
'upload bank transfers listing' => 'Nahrát bankovní výpis',
'url addresses without index' => 'URL adresy bez index.php.',
'url settings' => 'Nastavení URL',
......
'yes' => 'ano',
'you can simply open config-samplephp in a text editor, fill in your information, and save it as configphp' => 'Můžete jednoduše otevřít config-sample.php v textovém editoru, doplnit vaše údaje a uložit jej jako config.php.',
'you cannot vote twice about same work!' => 'Nemůžete hlasovat dvakrát o stejné práci!',
'you do not have required privilegies in database to perform this action' => 'Nemáte potřebná práva v databázi, pro provedení této akce',
'you are in debt' => 'Máte dluh',
'you have been successfully logged out' => 'Byl jste úspěšně odhlášen.',
'you have no permission to access redirection' => 'Nemáte práva k zobrazení přesměrování',
......
'your work has been rejected' => 'Vaše práce byla zamítnuta',
'your work has been updated' => 'Vaše práce byla aktualizována',
'zip code' => 'PSČ'
);
);
freenetis/branches/redirection/application/i18n/cs_CZ/help.php
'deduct_entrance_fees' => 'Již bez formuláře po kliknutí a potvrzení se provede nezávisle na čase stržení vstupního příspěvku všech členů, kteří mají nastavenou nějakou výši vstupního příspěvku, případně mají nastavenu splátku. Pak jsou splátky strženy jen do aktuálního data. Tuto operaci je opět dobré provádět jednou měsíčně od 16. dne měsíce. Jednou stržený vstupní příspěvek je při dalším strhávání ignorován.',
'deduct_member_fees' => 'Zobrazí formulář, který nabídne měsíc a rok pro stržení členských příspěvků. Strhávání členských příspěvků není automatizované a je třeba ho provádět jednou měsíčně, nejlépe uprostřed měsíce od 16. dne hospodářem sdružení. Výsledkem bude, že pro daný měsíc všem členům podle jejich tarifu buden stržen členský příspěvek.',
'deduct_device_repayments' => 'Provede stržení splátek zařízení. Jedná se o zařízení, která si člen koupil od sdružení. Pokud ve vašem sdružení neprovádíte prodej zařízení na splátky, patrně tuto možnost nevyužijete.',
'entrance_date' => 'Datum vstupu do sdružení. Se vstupem do sdružení je člen povinen platit členské příspěvky. V případě, že člen vstoupil do 15. dne v měsíci včetně, tak již tento měsíc se započítává k placení. Od 16. dne v měsíci se daný měsíc k placení nezapočítává.',
'entrance_fee' => 'Vstupní poplatek je jednorázový členský příspěvek, který je člen povinen zaplatit při vstupu do sdružení kromě případů, kdy je mu odpuštěn.',
'entrance_fee_instalment' => 'Splátka vstupního příspěvku je pro případ, kdy člen chce splácet vstupní příspěvek postupně. Zde nastavená částka mu bude každý měsíc stržena z jeho kreditního účtu. Pokud nechcete splátky využít, nechte výši splátky rovnu výši vstupního příspěvku.',
'gateway' => 'Určuje, zda-li je tato IP adresa bránou ve své podsíti. Typicky má toto nastavena každá IP adresa končící na jedničku v síti s prefixem 24.',
'gps_coordinates' => 'GPS souřadnice může být ve tvaru desetinného čísla, nebo: hodiny°minuty\'sekundy&quot.',
'mail_to_field' => 'Políčko bere jako vstup login uživatele, kterému chcete odeslat zprávu. Příjemců můžete uvést více, oddělte je čárkou.',
'member_name' => 'Vyplňujte v případě přidávání nějaké organizace. Pokud připojujete běžného člena, tak jako výsledné jméno člena se použije jeho jméno a příjmení.',
'never_redirect' => 'Zapnete-li tuto volbu, pak nebude možné tuto IP adresu nikdy přesměrovat běžným přesměrováním. Toto je vhodné zejména pro významné partnery jako jsou úřady, školy atd.',
'other_subaccounts' => 'Ostatní podúčty jsou vlastně již všechny ostatní používané účty ve Freenetisu, které se vnitřně nijak nedělí. Jde například o účet přijatých členských příspěvků nebo pokladny a tak dále. Freenetis pochopitelně nevyužívá celou účetní osnovu ČR, vzhledem k charakteru občanského sdružení.',
'password' => 'Uživatelské heslo musí obsahovat alespoň 8 znaků a musí obsahovat alespoň jedno písmeno nebo číslici.',
'payed_to' => 'Datum, do kdy máte zaplaceny členské příspěvky. Včas před tímto datem byste měli zaplatit členské příspěvky. V případě, že jste s kreditem v mínusu, tak zaplaťte co nejdříve, jinak budete zablokováni.',
......
'recalculate_account_balances' => 'Primárním zdrojem o stavu financí v systému jsou převody. Zůstatky na účtech byly dříve pokaždé počítány na požádání z převodů. Nyní si každý účet ukládá svůj zůstatek kvůli vyšší rychlosti. Tuto funkci použijete v případě přechodu na verzi systému, která tuto optimalizaci obsahuje.',
'recalculate_fees' => 'Pro primární strhávání členských příspěvků používejte funkci pro globální strhávání členských příspěvků v Účetním deníku. Tuto funkci používejte opatrně a to jen v případě, že máte správně strženy všechny členské příspěvky pro všechny členy od založení sdružení až po současné datum. Pak můžete tomuto členovi přepočítat stržení členských příspěvků v případě, že u něj došlo k nutnosti je přepočítat, např. chybné datum vstupu, vznikla nutnost přidat přerušení členství apod.',
'recalculate_entrance_fees' => 'Pro primární strhávání vstupních příspěvků používejte funkci pro globální strhávání v účetním deníku. Tuto funkci používejte jen v případě, že došlo k nějakému omylu, například, že měl zaplatit vstupní a pak se ukázalo, že nemusel.',
'service' => 'Je-li pro tuto IP adresu zapnuta služba, pak je tato IP adresa využívána pro Radius. Typicky jde o IP adresy aktivních síťových prvků, na které je se možné pomocí Radiusu přihlásit.',
'set_whitelist_to_member' => 'Trvalá bílá listina je seznam takových IP adres, pro které neplatí přesměrování. Jde například o důležitou partnerskou instituci zapojenou do sítě, například městský úřad apod. Všechna systémová přesměrování tedy nemohou ve výchozím stavu obtěžovat počítače s IP adresou na bílé listině. Lze ovšem vytvořit takové zprávy, které budou ignorovat tuto listinu, např. informování o nadcházejícím výpadku. Pro dočasnou bílou listinu platí to samé, ale IP adresy v ní jsou po určeném čase z této listiny mazány. Např. uživatel byl přesměrován kvůli neplacení a chceme mu umožnit krátkodobý přístup na internet do internetového bankovnictví.',
'unidentified_transfers' => 'Neidentifikované platby jsou všechny příchozí bankovní platby, které nebyl náš systém schopen z různých důvodů automaticky rozpoznat. Typicky se jedná o platby s chybným variabilním symbolem. Pokud zde svoji platbu najdete, pak kontaktujte hospodáře sdružení pro její správné přiřazení.',
'variable_symbol' => 'Variabilní symbol slouží k jednoznačnému určení příchozí platby člena.'
freenetis/branches/redirection/application/i18n/en_US/help.php
(
'approval_state' => 'State is in format Agree / Disagree / Abstain.',
'gps_coordinates' => 'GPS can be in shape of real number, or: hours°minutes\'seconds&quot.',
);
freenetis/branches/redirection/application/helpers/gps.php
}
/**
* Render coordinate from MySQL point __toString()
* @return string $coordinates Rendered coordinates
* @param bool $use_html_entity If it is true °'" are return as HTML entity
*/
public static function degrees_from_str($coordinates, $use_html_entity)
{
if (mb_eregi("^[0-9]+\.[0-9]+ [0-9]+\.[0-9]+$", $coordinates))
{
$coordinates = explode(' ', $coordinates);
return gps::degrees($coordinates[0], $coordinates[1], $use_html_entity);
}
return "";
}
/**
* Check if degrees coordinate is valid
* @param string $degrees_coordinate Coordinate in form: degreesX°minuteX'secondX"
* @return bool
freenetis/branches/redirection/application/helpers/callback.php
}
/**
* Callback field for segment.
* @author Jiri Svitak
* @param unknown_type $item
* @param unknown_type $name
*/
static function segment_field($item, $name)
{
if ($item->segment_id)
echo html::anchor(url_lang::base()."segments/show/$item->segment_id", $item->segment_name);
else
echo '&nbsp';
}
/**
* Callback for device field.
* @author Jiri Svitak
* @param $item
......
echo '<span style="color: red;">' . url_lang::lang('texts.Locked') . '</span>';
}
}
/**
* Callback field for user name of user given by id.
* @author Ondřej Fibich
* @param $item
* @param $name
*/
public static function user_id_log_field($item, $name)
{
$user = new User_Model($item->user_id);
if ($user->id)
{
echo html::anchor(
url_lang::base().'users/show/'.$user->id,
$user->name . ' ' . $user->surname
);
echo ' ' . html::anchor(
url_lang::base().'logs/show_by_user/'.$user->id,
html::image(array('src' => 'media/images/icons/history.png',
'title' => url_lang::lang('texts.Show user actions')))
);
}
else
{
echo $item->user_id;
}
}
/**
* Callback for action of log
* @author Ondřej Fibich
* @param $item
* @param $name
*/
public static function log_action_field($item, $name)
{
switch ($item->action)
{
case Log_Model::ACTION_ADD:
echo url_lang::lang('texts.Added');
break;
case Log_Model::ACTION_DELETE:
echo url_lang::lang('texts.Deleted');
break;
case Log_Model::ACTION_UPDATE:
echo url_lang::lang('texts.Updated');
break;
}
}
/**
* Callback for object of log
* @author Ondřej Fibich
* @param $item
* @param $name
*/
public static function object_log_field($item, $name)
{
echo html::anchor(
url_lang::base().'logs/show_object/'.$item->table_name.'/'.$item->object_id,
$item->object_id
);
}
/**
* Callback for values of log
* @author Ondřej Fibich
* @param $item
* @param $name
*/
public static function value_log_field($item, $name)
{
if (!empty($item->values))
{
$array = json_decode($item->values);
foreach ($array as $key => $value)
{
echo htmlspecialchars($key) .' = '.
htmlspecialchars($value) . '<br />';
}
}
}
/**
* Callback for display GPS
* @author Ondřej Fibich
* @param unknown_type $item
* @param string $name
*/
public static function gps_field($item, $name)
{
echo gps::degrees_from_str($item->gps, true);
}
}
freenetis/branches/redirection/application/models/phone_invoice_user.php
{
// madness query to calculate price for each user invoicee
return $this->db->query(
"SELECT `phone_invoice_users`.`id`,
"SELECT p.tax_rate,
`phone_invoice_users`.`id`,
`phone_invoice_users`.`user_id`,
`phone_invoice_users`.`phone_number` ,
CONCAT( `users`.`surname`, ' ', `users`.`name` ) AS `name`,
......
WHERE phone_invoice_user_id =phone_invoice_users.id)
) AS price
FROM `phone_invoice_users`
LEFT JOIN `phone_invoices` p ON `p`.`id` = `phone_invoice_users`.`phone_invoice_id`
LEFT JOIN `users` ON `phone_invoice_users`.`user_id` = `users`.`id`
WHERE `phone_invoice_users`.`phone_invoice_id` = ?;",
array($invoice_id)
freenetis/branches/redirection/application/models/user.php
public static $user = 2;
protected $belongs_to = array('member');
protected $has_many = array('jobs', 'devices', 'phone_invoices_users', 'users' => 'private_phone_contacts');
protected $has_many = array('jobs', 'devices', 'logs', 'phone_invoices_users', 'users' => 'private_phone_contacts');
protected $has_and_belongs_to_many = array('users_contacts' => 'contacts');
public $arr_sql = array('id' => 'u.id', 'name' => 'u.name', 'surname' => 'u.surname', 'login' => 'u.login', 'member_name' => 'm.name');
public $arr_sql = array('id' => 'u.id', 'name' => 'u.name', 'surname' => 'u.surname', 'login' => 'u.login', 'member_name' => 'm.name', 'email' => 'c.value');
/**
* Model constructor
......
if(count($filter_values)>0) $where .= 'WHERE ';
foreach($filter_values as $key => $value)
{
if($key!='submit')
if ($key!='submit')
{
if($where!='WHERE ') $where .= ' AND ';
if ($where!='WHERE ')
$where .= ' AND ';
$where .= $this->arr_sql[$key].' LIKE \'%'.trim($value).'%\' COLLATE utf8_general_ci';
}
}
......
if($where=='') $where = 'WHERE u.member_id = '.$member_id;
else $where .= ' AND u.member_id = '.$member_id;
}
return $this->db->query('SELECT
u.id, u.name, u.surname, u.login, u.member_id
FROM users u
return $this->db->query('
SELECT u.id, u.name, u.surname, u.login, u.member_id, m.name AS member_name
FROM users u
LEFT JOIN members m on m.id = u.member_id
LEFT JOIN users_contacts uc ON u.id = uc.user_id
LEFT JOIN contacts c ON uc.contact_id = c.id AND c.type = (SELECT id FROM enum_types WHERE value = \'E-mail\')
'.$where.'
GROUP BY u.id
ORDER BY '.$this->arr_sql[$order_by].' '.$order_by_direction.'
LIMIT '.$limit_from.','.$limit_results
);
......
{
$where = '';
if(count($filter_values)>0) $where .= 'WHERE ';
if (count($filter_values)>0)
$where .= 'WHERE ';
foreach($filter_values as $key => $value)
{
if($key!='submit')
if ($key!='submit')
{
if($where!='WHERE ') $where .= ' AND ';
if ($where!='WHERE ')
$where .= ' AND ';
$where .= $this->arr_sql[$key].' LIKE \'%'.trim($value).'%\' COLLATE utf8_general_ci';
}
}
if($member_id)
if ($member_id)
{
if($where=='') $where = 'WHERE u.member_id = '.$member_id;
else $where .= ' AND u.member_id = '.$member_id;
}
$users = $this->db->query('select u.id from users u join members m on m.id = u.member_id '.$where);
$users = $this->db->query('
SELECT u.id, u.name, u.surname, u.login, u.member_id, m.name AS member_name
FROM users u
LEFT JOIN members m on m.id = u.member_id
LEFT JOIN users_contacts uc ON u.id = uc.user_id
LEFT JOIN contacts c ON uc.contact_id = c.id AND c.type = (SELECT id FROM enum_types WHERE value = \'E-mail\')
'.$where.'
GROUP BY u.id');
return count($users);
}
freenetis/branches/redirection/application/models/log.php
<?php
/**
* Model of logs.
* Table logs is handled as partitioned table, it needs at least MySQL ver. 5.1.
* Table partitions are created by scheduler.
* Logs are preserved for maximum of 30 days.
*
* @author Ondřej Fibich
* @property int $id
* @property int $user_id
* @property int $object_id
* @property string $table_name
* @property string $time
* @property string $values
*/
class Log_Model extends ORM
{
protected $belongs_to = array('user');
/** Logger action for adding record to the table */
const ACTION_ADD = 1;
/** Logger action for adding record to the table */
const ACTION_DELETE = 2;
/** Logger action for updating record to the table */
const ACTION_UPDATE = 3;
/**
* Contruct set logger
* @param int $id
*/
public function __construct($id = NULL)
{
parent::__construct($id);
// set action logger of
$this->set_logger(FALSE);
}
/**
* Add new partition for logs
* @author Ondřej Fibich
* @see Scheduler_Controller::logs_partitions_daily()
*/
public function add_partition()
{
$partition_name = date('Y_m_d', time());
$partition_date = date('Y-m-d', time() + 86400);
$this->db->query("
ALTER TABLE logs
ADD PARTITION (
PARTITION p_$partition_name
VALUES LESS THAN (TO_DAYS('$partition_date')
) ENGINE = InnoDB)
");
}
/**
* Remove partition for log which is 31 days old
* @author Ondřej Fibich
* @see Scheduler_Controller::logs_partitions_daily()
*/
public function remove_old_partition()
{
$partition_name = date('Y_m_d', time() - 86400 * 31);
$this->db->query("
ALTER TABLE logs
DROP PARTITION p_$partition_name
");
}
/**
* Insert all data from array in one query
* @author Ondřej Fibich
* @param array $logs_data Keys corresponds to table columns
*/
public function insert_all_logs($logs_data)
{
if (!is_array($logs_data) || !count($logs_data))
{
return;
}
$query = 'INSERT INTO logs (id, user_id, table_name, object_id, time, action, values) VALUES ';
foreach ($this->logger_cache as $log)
{
$query .= '(0, ' .intval($log['user_id']).
', \'' .$this->db->escape_str($log['table_name']).
'\', ' .intval($log['object_id']).
', \'' .$this->db->escape_str($log['time']).
'\', ' .intval($log['action']).
', \'' .$this->db->escape_str($log['values']). '\')';
}
// remove last ,
$query = substr($query, 0, mb_strlen($query) - 1);
$this->db->query($query);
}
/**
* Gets all users logs with limit
* @param int $offset
* @param int $limit
* @param int $user_id
* @return unknown_type
*/
public function get_all_users_logs($user_id, $offset, $limit)
{
return $this->db->query("
SELECT l.*
FROM logs l
WHERE user_id = ?
ORDER BY id DESC
LIMIT ?, ?
", $user_id, $offset, $limit);
}
/**
* Gets all objects logs with limit
* @param string $table_name
* @param int $object_id
* @param int $offset
* @param int $limit
* @return unknown_type
*/
public function get_all_object_logs($table_name, $object_id, $offset, $limit)
{
return $this->db->query("
SELECT l.*
FROM logs l
WHERE object_id = ? AND table_name = ?
ORDER BY id DESC
LIMIT ?, ?
", $object_id, $table_name, $offset, $limit);
}
/**
* Gets all logs with limit
* @param int $offset
* @param int $limit
* @param array $filter_values Filter for where contition
* @return unknown_type
*/
public function get_all_logs($offset, $limit, $filter_values = array())
{
// array of where conditions
$where = array();
// user id condition
if (isset($filter_values['user_id']))
{
$where[] = 'user_id='.intval($filter_values['user_id']);
}
// object id condition
if (isset($filter_values['object_id']))
{
$where[] = 'object_id='.intval($filter_values['object_id']);
}
// date condition
if (isset($filter_values['date_from']) || isset($filter_values['date_to']))
{
$from = @$filter_values['date_from'];
$to = @$filter_values['date_to'];
if (!preg_match('/^[0-9]{4,4}\-[0-9]{2,2}\-[0-9]{2,2}$/', $from))
{
// logs are persisted at max for 30 days
$from = date('Y-m-d', time() - 60*60*24*30);
}
if (!preg_match('/^[0-9]{4,4}\-[0-9]{2,2}\-[0-9]{2,2}$/', $to))
{
$to = date('Y-m-d', time());
}
$where[] = 'time BETWEEN \'' .$from. ' 00-00-00\' AND \'' .$to. ' 23:59:59\'';
}
// fill where contition
$where_str = count($where) ? 'WHERE ' . implode(' AND ', $where) : '';
// query
return $this->db->query("
SELECT l.*
FROM logs l
$where_str
ORDER BY id DESC
LIMIT ?, ?
", $offset, $limit);
}
/**
* Gets users list which are in logs for dropdown
* @return array
*/
public function select_list_users_which_has_logs()
{
$result = $this->db->query("
SELECT CONCAT(u.name,' ',u.surname) as username, u.id
FROM logs l
LEFT JOIN users u ON l.user_id = u.id
");
$ret_array = array();
foreach ($result as $r)
{
$ret_array[$r->id] = $r->username;
}
return $ret_array;
}
/**
* Gets number of logs
* @return int
*/
public function count_all_logs()
{
return $this->db->query("
SELECT COUNT(*) AS count FROM logs
")->current()->count;
}
/**
* Gets number of users logs
* @param int $user_id
* @return int
*/
public function count_all_users_logs($user_id)
{
return $this->db->query("
SELECT COUNT(*) AS count FROM logs WHERE user_id = ?
", $user_id)->current()->count;
}
/**
* Gets number of object logs
* @param string $table_name
* @param int $object_id
* @return int
*/
public function count_all_object_logs($table_name, $object_id)
{
return $this->db->query("
SELECT COUNT(*) AS count FROM logs WHERE table_name = ? AND object_id = ?
", $table_name, $object_id)->current()->count;
}
}
?>
freenetis/branches/redirection/application/models/account.php
");
// create update sql query
$sql = "UPDATE accounts SET balance = CASE id ";
// incorrect balances
$incorrect_balances = 0;
// array of ids to change
$ids = array();
foreach ($accounts as $account)
{
if ($account->balance != $account->calculated_balance)
{
$incorrect_balances++;
$sql .= "WHEN $account->id THEN $account->calculated_balance ";
$ids[] = $account->id;
}
}
// are there some accounts with incorrect balances? save correct balances
if ($incorrect_balances > 0)
if (count($ids) > 0)
{
$ids_with_commas = implode(',', $ids);
$sql .= "END WHERE id IN ($ids_with_commas)";
$db = new Database();
$db->query($sql);
}
return $incorrect_balances;
// returns array of ids of corrected accounts
return $ids;
}
/**
......
$balance = $account_model->get_account_balance($account_id);
return $this->db->query("UPDATE accounts SET balance = '$balance' WHERE id = $account_id");
}
}
?>
freenetis/branches/redirection/application/models/login_log.php
public function __construct($id = false)
{
parent::__construct($id);
// turn off action log
$this->set_logger(FALSE);
}
/**
freenetis/branches/redirection/application/models/transfer.php
}
/**
* Used for deduction of device repayments.
* @author Jiri Svitak
* @param <type> $ca
* @param <type> $date
* @return <type>
*/
public function get_device_fee_transfers_of_account_and_date($ca, $date)
{
return $this->db->query("SELECT id FROM transfers WHERE type = ".Transfer_Model::$deduct_device_fee."
AND origin_id = $ca->id AND datetime LIKE '%$date%'");
}
/**
* @author Michal Kliment
* Gets all monthly amounts of incoming member payment for stats
* @return MySQL_Result object
freenetis/branches/redirection/application/controllers/ifaces.php
// ip addresses
$ip_model = new Ip_address_Model();
$query = $ip_model->select(array('ip_addresses.id','ip_addresses.ip_address','subnets.name as subnet_name'))
$query = $ip_model->select(array('ip_addresses.id','ip_addresses.ip_address','subnets.name as subnet_name', 'subnets.id as subnet_id'))
->join('subnets','subnets.id', 'ip_addresses.subnet_id', 'LEFT')
->orderby('id','ASC')
->where('iface_id', $iface_id)
......
$grid_ip_addresses->add_new_button(url_lang::base().'ip_addresses/add_to_iface/'.$iface->id, url_lang::lang('texts.Add new IP address'));
$grid_ip_addresses->field('id')->label('ID')->class('center');
$grid_ip_addresses->field('ip_address')->label(url_lang::lang('texts.IP address'));
$grid_ip_addresses->field('subnet_name')->label(url_lang::lang('texts.Subnet name'));
$grid_ip_addresses->callback_field('subnet_name')->label(url_lang::lang('texts.Subnet name'))->callback('callback::subnet_field');
if ($this->acl_check_view('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.IP address')) ->url(url_lang::base().'ip_addresses/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.IP address')) ->url(url_lang::base().'ip_addresses/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_delete('Devices_Controller','ip_address',$member_id))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.IP address')) ->url(url_lang::base().'ip_addresses/delete') ->action(url_lang::lang('texts.Delete'))->class('center')->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to delete this ip address').'\');"');
if ($this->acl_check_new('Messages_Controller', 'ip_address'))
$grid_ip_addresses->action_field('id')->label(url_lang::lang('texts.IP address'))->url(url_lang::base().'redirect/add')->action(url_lang::lang('texts.Redirect'));
$grid_ip_addresses->datasource( $query );
// vlan interfaces
freenetis/branches/redirection/application/controllers/users.php
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
{
if (!$this->acl_check_view(get_class($this),'users'))
if (!$this->acl_check_view(get_class($this), 'users'))
Controller::error(ACCESS);
// get new selector
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
......
"tr",
new Table_Form_Item('text','login','Login name'),
new Table_Form_Item('text','member_name','Member'),
"tr", "td", "td", "td",
"tr",
new Table_Form_Item('text','email', 'E-mail'), "td",
new Table_Form_Item('submit','submit','Filter')
)
......
$query = $model_users->get_all_users($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
if ($total_users == 1)
url::redirect(url_lang::base().'users/show/'.$query->current()->id);
$arr_gets = array();
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
$query_string = '?'.implode('&',$arr_gets);
......
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
$grid->order_field('surname')->label(url_lang::lang('texts.Surname'));
$grid->order_field('login')->label(url_lang::lang('texts.Username'));
$grid->order_callback_field('member_name')->label(url_lang::lang('texts.Member'))->callback('callback::member_field');
if ($this->acl_check_view(get_class($this),'users'))
$grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit(get_class($this),'users'))
$grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
//if ($this->acl_check_edit(get_class($this),'users'))
// $grid->action_field('id') ->label(url_lang::lang('texts.User')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_view('Devices_Controller','devices'))
$grid->action_field('id') ->label(url_lang::lang('texts.Devices')) ->url(url_lang::base().'devices/show_by_user')->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_view('Users_Controller','work'))
......
{
$form->password('oldpassword')->label(url_lang::lang('texts.Old password').':')->rules('required|length[3,50]')->callback(array($this, 'check_password'));
}
$form->password('password')->label(url_lang::lang('texts.New password').':')->rules('required|length[6,50]')->class('password');
$form->password('confirm_password')->label(url_lang::lang('texts.Confirm new password').':')->rules('required|length[6,50]')->matches($form->password)->help(help::hint('password'));
$form->password('password')->label(url_lang::lang('texts.New password').':&nbsp;'.help::hint('password'))->rules('required|length[6,50]')->class('password');
$form->password('confirm_password')->label(url_lang::lang('texts.Confirm new password').':')->rules('required|length[6,50]')->matches($form->password);
$form->submit('submit')->value(url_lang::lang('texts.Change'));
special::required_forge_style($form, ' *', 'required');
freenetis/branches/redirection/application/controllers/logs.php
<?php
/**
* Controller of logs.
* Table logs is handled as partitioned table, it needs at least MySQL ver. 5.1.
* Table partitions are created by scheduler.
* Logs are preserved for maximum of 30 days.
*
* @author Ondřej Fibich
*/
class Logs_Controller extends Controller
{
/**
* Redirects to show_all
* @author Ondřej Fibich
*/
public function index()
{
url::redirect(url_lang::base() . 'logs/show_all');
}
/**
* Show all actions logs and enable filter them.
* @author Ondřej Fibich
*/
public function show_all($limit_results = 100, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
{
if (!$this->acl_check_view('Settings_Controller', 'system'))
Controller::error(ACCESS);
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
$log_model = new Log_Model();
$total_logs = $log_model->count_all_logs();
if (($sql_offset = ($page - 1) * $limit_results) > $total_logs)
$sql_offset = 0;
// users checkbox
$user_model = new User_Model();
// can be replaced by Log::select_list_users_which_has_logs()
$users = $user_model->get_all_user_names();
$users_array = array ('0' => '');
foreach ($users as $user)
{
$users_array[$user->id] = $user->username . ' (' . $user->id . ')';
}
// creates fields for filtering logs
$filter = new Table_Form(url_lang::base() . 'logs/show_all', 'get', array
(
new Table_Form_Item('text', 'object_id', 'Object'),
new Table_Form_Item('select', 'user_id', 'User', $users_array, array('style' => 'width: 207px')),
'tr',
new Table_Form_Item('text', 'date_from', 'Date from', NULL, array('id' => 'date_from')),
new Table_Form_Item('text', 'date_to', 'Date to', NULL, array('id' => 'date_to')),
'tr',
'td',
new Table_Form_Item('submit','submit','Filter')
));
// load logs
$logs = $log_model->get_all_logs($sql_offset, (int) $limit_results, $filter->values());
$arr_gets = array();
foreach ($this->input->get() as $key=>$value)
$arr_gets[] = $key.'='.$value;
$query_string = '?'.implode('&',$arr_gets);
// title of view
$title = url_lang::lang('texts.Action logs');
// create grid
$grid = new Grid(url_lang::base() . 'logs/show_all', $title, array
(
'use_paginator' => true,
'use_selector' => true,
'current' => $limit_results, //current selected 'records_per_page' value
'selector_increace' => 200, // increace
'selector_min' => 200, // minimum where selector start
'selector_max_multiplier' => 10,
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
'base_url' => Config::get('lang') . '/logs/show_all/' . $limit_results,
'total_items' => $total_logs, // 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' => 'id',
'order_by_direction' => 'DESC',
'limit_results' => $limit_results,
'query_string' => $query_string,
'filter' => $filter->view
));
$grid->field('id')->label(url_lang::lang('texts.Id'));
$grid->callback_field('user_id')->label(url_lang::lang('texts.User'))->callback('callback::user_id_log_field');
$grid->callback_field('action')->label(url_lang::lang('texts.Action'))->callback('callback::log_action_field');
$grid->field('table_name')->label(url_lang::lang('texts.Table'));
$grid->callback_field('object_id')->label(url_lang::lang('texts.Object'))->callback('callback::object_log_field');
$grid->field('time')->label(url_lang::lang('texts.Time'));
$grid->datasource($logs);
$view = new View('main');
// @todo replace this javascript with somenting smarter ;-)
$view->extra_scripts .= "
$(document).ready(function () {
$('#date_from, #date_to').datepicker({
dateFormat: 'yy-mm-dd',
changeMonth: false,
changeYear: false,
minDate: -30,
maxDate: 0
});
$.datepicker.regional['" . Config::get('lang') . "'];
});";
$view->title = url_lang::lang('texts.Action logs');
$view->content = $grid;
$view->render(TRUE);
}
/**
* Show logs of user
* @author Ondřej Fibich
*/
function show_by_user($user_id = null, $limit_results = 200, $order_by = 'time', $order_by_direction = 'desc', $page_word = null, $page = 1)
{
if (!$this->acl_check_view('Settings_Controller', 'system'))
Controller::error(ACCESS);
if (!isset($user_id))
Controller::warning(PARAMETER);
$user = new User_Model((int) $user_id);
if (!$user->id)
Controller::error(RECORD);
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
$log_model = new Log_Model();
$total_logs = $log_model->count_all_users_logs($user_id);
if (($sql_offset = ($page - 1) * $limit_results) > $total_logs)
$sql_offset = 0;
$title = url_lang::lang('texts.Action logs of user') . ' ' . $user->name . ' ' . $user->surname;
// load logs
$logs = $log_model->get_all_users_logs($user->id, $sql_offset, (int) $limit_results);
// create grid
$grid = new Grid(url_lang::base() . 'logs/show_all', $title, array(
//'separator' => '',
'use_paginator' => true,
'use_selector' => true,
'current' => $limit_results, //current selected 'records_per_page' value
'selector_increace' => 200, // increace
'selector_min' => 200, // minimum where selector start
'selector_max_multiplier' => 10,
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
'base_url' => Config::get('lang') . '/logs/show_all/' . $limit_results,
'total_items' => $total_logs, // 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' => 'id',
'order_by_direction' => 'DESC',
'limit_results' => $limit_results
));
$grid->field('id')->label(url_lang::lang('texts.Id'));
$grid->callback_field('user_id')->label(url_lang::lang('texts.User'))->callback('callback::user_id_log_field');
$grid->callback_field('action')->label(url_lang::lang('texts.Action'))->callback('callback::log_action_field');
$grid->field('table_name')->label(url_lang::lang('texts.Table'));
$grid->callback_field('object_id')->label(url_lang::lang('texts.Object'))->callback('callback::object_log_field');
$grid->field('time')->label(url_lang::lang('texts.Time'));
$grid->datasource($logs);
$view = new View('main');
$view->title = url_lang::lang('texts.Action logs');
$view->content = new View('show_all');
$view->content->headline = url_lang::lang('texts.Action logs');
$view->content->table = $grid;
$view->content->link_back = html::anchor(url_lang::base() . 'logs/show_all', url_lang::lang('texts.Show all logs'));
$view->render(TRUE);
}
/**
* Show logs of user
* @author Ondřej Fibich
*/
function show_object($table, $object_id = null, $limit_results = 200, $order_by = 'time', $order_by_direction = 'desc', $page_word = null, $page = 1)
{
if (!$this->acl_check_view('Settings_Controller', 'system'))
Controller::error(ACCESS);
if (!is_numeric($object_id) || !is_string($table))
Controller::warning(PARAMETER);
// gets new selector
if (is_numeric($this->input->get('record_per_page')))
$limit_results = (int) $this->input->get('record_per_page');
$log_model = new Log_Model();
$total_logs = $log_model->count_all_object_logs($table, $object_id);
if (($sql_offset = ($page - 1) * $limit_results) > $total_logs)
$sql_offset = 0;
$title = url_lang::lang('texts.Action logs of object');
// load logs
$logs = $log_model->get_all_object_logs($table, $object_id, $sql_offset, (int) $limit_results);
// create grid
$grid = new Grid(url_lang::base() . 'logs/show_all', $title, array
(
'use_paginator' => true,
'use_selector' => true,
'current' => $limit_results, //current selected 'records_per_page' value
'selector_increace' => 200, // increace
'selector_min' => 200, // minimum where selector start
'selector_max_multiplier' => 10,
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
'base_url' => Config::get('lang') . '/logs/show_all/' . $limit_results,
'total_items' => $total_logs, // 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' => 'id',
'order_by_direction' => 'DESC',
'limit_results' => $limit_results
));
$grid->field('id')->label(url_lang::lang('texts.Id'));
$grid->callback_field('user_id')->label(url_lang::lang('texts.User'))->callback('callback::user_id_log_field');
$grid->callback_field('action')->label(url_lang::lang('texts.Action'))->callback('callback::log_action_field');
$grid->field('table_name')->label(url_lang::lang('texts.Table'));
$grid->callback_field('object_id')->label(url_lang::lang('texts.Object'))->callback('callback::object_log_field');
$grid->field('time')->label(url_lang::lang('texts.Time'));
$grid->callback_field('values')->label(url_lang::lang('texts.Changed values'))->callback('callback::value_log_field');
$grid->datasource($logs);
$view = new View('main');
$view->title = url_lang::lang('texts.Action logs');
$view->content = new View('show_all');
$view->content->headline = url_lang::lang('texts.Action logs');
$view->content->table = $grid;
$view->content->link_back = html::anchor(url_lang::base() . 'logs/show_all', url_lang::lang('texts.Show all logs'));
$view->render(TRUE);
}
}
freenetis/branches/redirection/application/controllers/transfers.php
$view->extra_scripts = '$(document).ready(function(){
$("#account_type").change(function(){
$("#aname").html(\'<option value="">'.url_lang::lang('texts.Loading data, please wait').'...</option>\');
$.getJSON("'.url_lang::base().'json/get_accounts_by_type/",{id: $(this).val()}, function(j){
var options = \'\';
for (var i = 0; i < j.length; i++) {
options += \'<option value="\' + j[i].optionValue + \'">\' + j[i].optionDisplay + \'</option>\';
}
$.getJSON("'.url_lang::base().'json/get_accounts_by_type/",{id: $(this).val()}, function(data){
var options = \'\';
$.each(data, function(key, val) {
options += \'<option value="\' + key + \'">\' + val + \'</option>\';
});
$("#aname").html(options);
})
})
......
$max_month = $max_date['month'];
$max_year = $max_date['year'];
// round max date
if ($max_day > 15)
if ($max_day <= 15)
{
$max_month++;
if ($max_month > 12)
$max_month--;
if ($max_month == 0)
{
$max_year++;
$max_month = 1;
$max_year--;
$max_month = 12;
}
}
// finds operating account
......
// if member's entrance fee is 0, then no transfer is generated
if ($ca->entrance_fee == 0)
{
$this->session->set_flash('message', url_lang::lang('texts.Entrance fees have been successfully deducted.'));
$this->session->set_flash('message', url_lang::lang('texts.Entrance fees have been successfully recalculated, %d transfers deleted, %d new transfers created.', array(1=>$deleted_transfers_count, 2=>$created_transfers_count)));
url::redirect(url_lang::base().'transfers/show_by_account/'.$account_id);
}
// entrance fee is not wholy paid, calculate debt
......
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
Controller::error(ACCESS);
// preparation
$created_transfers_count = 0;
$creation_datetime = date('Y-m-d H:i:s');
$operating = ORM::factory('account')->where('account_attribute_id', Account_attribute_Model::$operating)->find();
$account_model = new Account_Model();
......
}
// getting boundary date - 15th day in the month
$d = date('Y-m-d', mktime(0, 0, 0, $m, 15, $y));
echo "payments $payments<br>";
//echo "payments $payments<br>";
}
echo "buy date $device->buy_date, current date $date, end date $d<br>";
//echo "buy date $device->buy_date, current date $date, end date $d<br>";
// is current date between buying of device and date of its full repayment?
if ($device->buy_date <= $date && $date <= $d)
$payment_rate += $device->payment_rate;
echo "payment rate $payment_rate<br>";
//echo "payment rate $payment_rate<br>";
}
// is debt still greater than one monthly instalment?
if ($debt > $payment_rate)
......
{
$amount = $debt;
}
echo "<strong>date $date, amount $amount</strong><br>";
//echo "<strong>date $date, amount $amount</strong><br>";
// decrease amount of debt due to size of one instalment
$debt -= $amount;
//$transfer = ORM::factory('transfer')->where(array('type' => Transfer_Model::$deduct_device_fee, 'amount' => $amount,
// 'origin_id' => $ca->id, 'datetime' => $date))->find();
$db = new Database();
$transfers = $db->query("SELECT id FROM transfers WHERE type = ".Transfer_Model::$deduct_device_fee." AND amount = $amount AND origin_id = $ca->id AND datetime LIKE '%$date%'");
$transfers = $db->get_device_fee_transfers_of_account_and_date($ca, $date);
if ($amount > 0 && count($transfers) == 0)
{
Transfer_Model::insert_transfer($ca->id, $operating->id, null, null,
$this->session->get('user_id'), Transfer_Model::$deduct_device_fee,
$date, $creation_datetime, url_lang::lang('texts.Device repayments'), $amount);
$created_transfers_count++;
}
// iterate to next month
$month++;
......
}
}
$db->transaction_commit();
$this->session->set_flash('message', url_lang::lang('texts.Device fees have been successfully deducted.'));
$this->session->set_flash('message', url_lang::lang('texts.Device fees have been successfully deducted, %d new transfers created.', $created_transfers_count));
}
catch (ErrorException $e)
{
......
$member = new Member_Model($member_id);
if ($member->id == 0)
Controller::error(RECORD);
if (!$this->acl_check_new('Accounts_Controller', 'transfers', $member_id))
if (!$this->acl_check_new('Accounts_Controller', 'transfers'))
Controller::error(ACCESS);
$credit = ORM::factory('account')->where(array('member_id' => $member_id,
'account_attribute_id' => Account_attribute_Model::$credit))->find();
......
{
$input->add_error('required', url_lang::lang('texts.Error - amount has to be positive.'));
}
else if ($account_model->get_account_balance($this->origin) < $input->value)
else if (!$this->acl_check_new('Accounts_Controller', 'transfers') && $account_model->get_account_balance($this->origin) < $input->value)
{
$input->add_error('required', url_lang::lang('texts.Error - not enough money on origin account.'));
}
freenetis/branches/redirection/application/controllers/address_points.php
$grid->order_field('town')->label(url_lang::lang('texts.town'));
$grid->order_field('quarter')->label(url_lang::lang('texts.quarter'));
$grid->order_field('zip_code')->label(url_lang::lang('texts.zip_code'));
$grid->order_callback_field('gps')->label(url_lang::lang('texts.gps'))->callback('Address_points_Controller::gps_field');
$grid->order_callback_field('gps')->label(url_lang::lang('texts.gps'))->callback('callback::gps_field');
if ($this->acl_check_view(get_class($this), 'address_point'))
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'address_points/show') ->action(url_lang::lang('texts.Show'));
......
$form = new Forge(url_lang::base().'address_points/add/', '', 'POST', array('id' => 'article_form'));
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->dropdown('country_id')->label(url_lang::lang('texts.country').':')->rules('required')->options($arr_countries);
$form->dropdown('country_id')->label(url_lang::lang('texts.country').':')->rules('required')->options($arr_countries)->selected(Settings::get('default_country'));
$form->dropdown('street_id')->label(url_lang::lang('texts.street').':')->rules('required')->options($arr_streets);
$form->input('street_number')->label(url_lang::lang('texts.street number').':')->rules('required|length[1,50]|valid_numeric');
$form->dropdown('town_id')->label(url_lang::lang('texts.town').':')->rules('required')->options($arr_towns);
$form->input('gpsx')->label(url_lang::lang('texts.gps').' X:')->rules('gps');
$form->input('gpsy')->label(url_lang::lang('texts.gps').' Y:')->rules('gps');
$form->input('gpsx')->label(url_lang::lang('texts.gps').' X:&nbsp;'.help::hint('gps_coordinates'))->rules('gps');
$form->input('gpsy')->label(url_lang::lang('texts.gps').' Y:&nbsp;'.help::hint('gps_coordinates'))->rules('gps');
$form->submit('submit')->value(url_lang::lang('texts.Edit'));
special::required_forge_style($form, ' *', 'required');
......
$form->dropdown('street_id')->label(url_lang::lang('texts.street').':')->options($arr_streets)->selected($address_point->street_id)->disabled('disabled');;
$form->input('street_number')->label(url_lang::lang('texts.street number').':')->value($address_point->street_number)->disabled('disabled');
$form->dropdown('town_id')->label(url_lang::lang('texts.town').':')->options($arr_towns)->selected($address_point->town_id)->disabled('disabled');
$form->input('gpsx')->label(url_lang::lang('texts.gps').' X:')->rules('required|gps')->value($gpsx);
$form->input('gpsy')->label(url_lang::lang('texts.gps').' Y:')->rules('required|gps')->value($gpsy);
$form->input('gpsx')->label(url_lang::lang('texts.gps').' X:&nbsp;'.help::hint('gps_coordinates'))->rules('required|gps')->value($gpsx);
$form->input('gpsy')->label(url_lang::lang('texts.gps').' Y:&nbsp;'.help::hint('gps_coordinates'))->rules('required|gps')->value($gpsy);
if (! empty ($address_point->gps))
{
$form->gpsx->disabled('disabled');
freenetis/branches/redirection/application/controllers/ip_addresses.php
$grid->order_callback_field('device_name')->label(url_lang::lang('texts.Device name'))->callback('callback::device_field');
//if ($this->acl_check_view('Devices_Controller','ip_address'))
// $grid->action_field('id')->label(url_lang::lang('texts.Show'))->url(url_lang::base().'ip_addresses/show')->action(url_lang::lang('texts.Show'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'ip_addresses/edit')->action(url_lang::lang('texts.Edit'))->class('center');
//if ($this->acl_check_edit('Devices_Controller','ip_address'))
// $grid->action_field('id')->label(url_lang::lang('texts.Edit'))->url(url_lang::base().'ip_addresses/edit')->action(url_lang::lang('texts.Edit'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Redir'))->url(url_lang::base().'redirect/add')->action(url_lang::lang('texts.Redirect'))->class('center');
if ($this->acl_check_edit('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Smokeping'))->url(url_lang::base().'monitoring/add_smokeping')->action(url_lang::lang('texts.Monitor'))->class('center');
// $grid->action_field('id')->label(url_lang::lang('texts.Redir'))->url(url_lang::base().'redirect/add')->action(url_lang::lang('texts.Redirect'))->class('center');
//if ($this->acl_check_edit('Devices_Controller','ip_address'))
// $grid->action_field('id')->label(url_lang::lang('texts.Smokeping'))->url(url_lang::base().'monitoring/add_smokeping')->action(url_lang::lang('texts.Monitor'))->class('center');
if ($this->acl_check_delete('Devices_Controller','ip_address'))
$grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'ip_addresses/delete')->action(url_lang::lang('texts.Delete'))->class('center')->script('onclick="return potvrd(\''.url_lang::lang('texts.Do you want to delete this ip address').'\');"');
$grid->datasource( $query );
......
->rules('required')->add_button('subnets');
//->class('ajax')->onchange('ajax_get_subnet(this.value)');
$this->form->dropdown('gateway')->label(url_lang::lang('texts.Gateway'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('service')->label(url_lang::lang('texts.Service'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('whitelisted')->label(url_lang::lang('texts.Never redirect'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('gateway')->label(url_lang::lang('texts.Gateway').':&nbsp;'.help::hint('gateway'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('service')->label(url_lang::lang('texts.Service').':&nbsp;'.help::hint('service'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
$this->form->dropdown('whitelisted')->label(url_lang::lang('texts.Never redirect').':&nbsp;'.help::hint('never_redirect'))->options(array('0'=> url_lang::lang('texts.No'), '1'=> url_lang::lang('texts.Yes')))->selected('0');
/**
* Removed by dulik for SVN rev. 98 - does not work with JavaScript disabled
* @todo Proper Ajax should be implemented - see http://learn.kohanaphp.com/2008/06/17/jquery-and-kohana-unobtrusive-ajax/
freenetis/branches/redirection/application/controllers/phone_invoices.php
$data = Parser_Vodafone_Invoice::parse($form->parse->value, $integrity_test);
$phone_invoice = new Phone_invoice_Model();
$phone_invoice->set_logger(FALSE);
$phone_invoice->date_of_issuance = $data->date_of_issuance->format('Y-m-d');
$phone_invoice->billing_period_from = $data->billing_period_from->format('Y-m-d');
$phone_invoice->billing_period_to = $data->billing_period_to->format('Y-m-d');
......
$phone_inv_user_model = new Phone_invoice_user_Model();
$query = $phone_inv_user_model->get_all_invoice_users($phone_invoice->id);
$query2 = array();
// add price with tax
foreach ($query as $i => $q)
{
$q->price_vat = $q->price * (1 + $q->tax_rate / 100);
$query2[$i] = $q;
}
$grid->field('id')->label(url_lang::lang('texts.ID'));
$grid->field('phone_number')->label(url_lang::lang('texts.Phone number'));
$grid->callback_field('user')->label(url_lang::lang('texts.User'))
->callback('Phone_invoices_Controller::user_field');
$grid->callback_field('price')->label(url_lang::lang('texts.Price out of tax'))
->callback('callback::phone_price_field');
$grid->callback_field('price_vat')->label(url_lang::lang('texts.Price vat'))
->callback('callback::phone_price_field');
$grid->action_field('id')->label(url_lang::lang('texts.Show details'))
->url(url_lang::base().'phone_invoices/show_details')
->action(url_lang::lang('texts.Show'));
......
->action(url_lang::lang('texts.Delete'))->class('a_delete');
}
$grid->datasource($query);
$grid->datasource($query2);
$view = new View('main');
......
foreach ($data->bill_numbers as $services)
{
$phone_inv_user = new Phone_invoice_user_Model();
$phone_inv_user->set_logger(FALSE);
$phone_inv_user->user_id = strval(self::user_number_cache($services->number));
$phone_inv_user->phone_invoice_id = $phone_invoice->id;
$phone_inv_user->phone_number = $services->number;
......
foreach ($services->calls as $item)
{
$model = new Phone_call_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->fixed_calls as $item)
{
$model = new Phone_fixed_call_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->vpn_calls as $item)
{
$model = new Phone_vpn_call_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->smss as $item)
{
$model = new Phone_sms_message_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->roaming_smss as $item)
{
$model = new Phone_roaming_sms_message_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->internet as $item)
{
$model = new Phone_connection_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
foreach ($services->pays as $item)
{
$model = new Phone_pay_Model();
$model->set_logger(FALSE);
$model->phone_invoice_user_id = $phone_inv_user->id;
$model->datetime = $item->date_time->format('Y-m-d H:i:s');
$model->price = $item->price;
......
return $user_number_cache[$number];
}
}
}
freenetis/branches/redirection/application/controllers/scheduler.php
$member_model->update_lock_status();
}
// manage logs
if ((date('H:i') == '00:00'))
{
self::logs_partitions_daily();
}
//send quened SMS
self::send_quened_sms();
......
}
/**
* Manage partitions of log table.
* Add partition for current day and removes 31 days old partition.
* @author Ondřej Fibich
*/
private function logs_partitions_daily()
{
$model_log = new Log_Model();
// add partition for today
$model_log->add_partition();
// remove log partition
try
{
$model_log->remove_old_partition();
}
catch (Exception $ignore)
{ // ignore exception - first 30 days do not have older one..
}
}
/**
* Function sends SMS messages from db quene.
* @author Roman Sevcik
*/
freenetis/branches/redirection/application/controllers/segments.php
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
$form->group('')->label(url_lang::lang('texts.Basic data'));
$form->input('name')->label(url_lang::lang('texts.name').':')->rules('required|length[3,100]');
$form->input('name')->label(url_lang::lang('texts.name').':');
$form->dropdown('medium_id')->label(url_lang::lang('texts.Medium').':')->options($arr_media)->rules('required');
$form->input('bitrate')->label(url_lang::lang('texts.bitrate').':')->rules('required|valid_numeric')->class('join1')->style('width:100px; margin-right:5px;');
freenetis/branches/redirection/application/controllers/members.php
$form->input('title2')->label(url_lang::lang('texts.post title').':')->rules('length[1,30]');
$form->dropdown('type')->label(url_lang::lang('texts.Type').':')
->options($types)->rules('required')->selected($type_id);
$form->input('membername')->label(url_lang::lang('texts.Name of organization').':')->rules('length[1,60]')->help(help::hint('member_name'));
$form->input('membername')->label(url_lang::lang('texts.Name of organization').':&nbsp;'.help::hint('member_name'))->rules('length[1,60]');
$form->input('organization_identifier')->label(url_lang::lang('texts.Organization identifier').':')->rules('length[3,20]');
... Rozdílový soubor je zkrácen, protože jeho délka přesahuje max. limit.

Také k dispozici: Unified diff