Revize 297
Přidáno uživatelem Jiří Sviták před asi 15 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'back' => 'Zpět',
|
||
'back to account transfers' => 'Zpět na převody účtu',
|
||
'back to all subnets' => 'Zpět na seznam podsítí',
|
||
'back to bank accounts' => 'Zpět na bankovní účty',
|
||
'back to credit accounts' => 'Zpět na kreditní účty',
|
||
'back to detail' => 'Zpět na detail',
|
||
'back to device parameters' => 'Zpět na parametry zařízení',
|
||
... | ... | |
'back to login' => 'Zpět na přihlášení',
|
||
'back to ports list' => 'Zpět na seznam portů',
|
||
'back to segments list' => 'Zpět na seznam segmentů',
|
||
'back to the bank accounts of association' => 'Zpět na bankovní účty sdružení',
|
||
'back to the double-entry accounts' => 'Zpět na podvojné účty',
|
||
'back to the member' => 'Zpět na profil člena',
|
||
'back to the members transfers' => 'Zpět na převody člena',
|
||
... | ... | |
'back to vlan interfaces list' => 'Zpět na seznam VLAN rozhraní',
|
||
'back to vlans list' => 'Zpět na seznam VLANů',
|
||
'bad phone format' => 'Špatný formát telefonu',
|
||
'balance' => 'Stav',
|
||
'bank account' => 'Bankovní účet',
|
||
'bank accounts' => 'Bankovní účty',
|
||
'bank accounts of association' => 'Bankovní účty sdružení',
|
freenetis/trunk/kohana/application/models/member.php | ||
---|---|---|
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all debtors from database.
|
||
* @param $limit_from starting row
|
||
* @param $limit_results number of rows
|
||
* @param $order_by sorting column
|
||
* @param $order_by_direction sorting direction
|
||
* @return unknown_type
|
||
*/
|
||
public function get_debtors($limit_from = 0, $limit_results = 50, $order_by = 'm.id', $order_by_direction = 'ASC')
|
||
{
|
||
/*
|
||
return self::$db->query('SELECT members.id, members.name, members.street, members.town,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) as credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(sum(amount),0) as inbound, outbound FROM
|
||
(SELECT accounts.id, member_id, IFNULL( sum( amount ) , 0 ) AS outbound
|
||
FROM accounts
|
||
LEFT JOIN enum_types ON accounts.type_id = enum_types.id
|
||
LEFT JOIN money_transfers ON accounts.id = money_transfers.origin_id
|
||
WHERE enum_types.value = \'credit\'
|
||
GROUP BY accounts.id) AS q1
|
||
LEFT JOIN money_transfers ON q1.id = money_transfers.destination_id GROUP BY q1.id) AS q2
|
||
WHERE (inbound - outbound) < 0) AS q3
|
||
LEFT JOIN members ON q3.member_id = members.id
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
*/
|
||
return self::$db->query('SELECT members.id, members.name, members.street, members.town,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) as credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(sum(amount),0) as inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL( sum( amount ) , 0 ) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN money_transfers mt ON a.id = mt.origin_id
|
||
WHERE aa.id = '.Account_attribute_Model::$credit.'
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN money_transfers ON q1.id = money_transfers.destination_id GROUP BY q1.id) AS q2
|
||
WHERE (inbound - outbound) < 0) AS q3
|
||
LEFT JOIN members ON q3.member_id = members.id
|
||
ORDER BY '.$order_by.' '.$order_by_direction.'
|
||
LIMIT '.$limit_from.','.$limit_results);
|
||
}
|
||
|
||
/**
|
||
* @param $phone - string containing a phone number
|
||
* @return first member_id of a member with given phone number
|
||
* This function is used in the Accounts_controller - e.g. in the function
|
freenetis/trunk/kohana/application/models/account.php | ||
---|---|---|
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all bank accounts of association.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_assoc_bank_accounts()
|
||
{
|
||
/*
|
||
return self::$db->query('SELECT q3.id, a.name, a.comment,
|
||
CONCAT(ba.account_nr, \'/\', ba.bank_nr) AS account_number,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(sum(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, a.member_id, IFNULL(sum(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN transfers t ON q1.id = t.destination_id
|
||
GROUP BY q1.id) AS q2
|
||
) AS q3
|
||
LEFT JOIN accounts a ON q3.id = a.id
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
WHERE a.member_id = 1 AND a.account_attribute_id = '.Account_attribute_Model::$bank
|
||
);
|
||
*/
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all double-entry accounts.
|
||
* @return unknown_type
|
||
*/
|
||
... | ... | |
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets bank account number of given account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_account_number($account_id)
|
||
{
|
||
$ba_nr = self::$db->query("SELECT CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM bank_accounts ba
|
||
JOIN accounts a ON ba.account_id = a.id");
|
||
return $ba_nr->current()->account_number;
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all credit accounts from database including member name and credit.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_credit_accounts($limit_from = 0, $limit_results = 20, $order_by = 'aid', $order_by_direction = 'desc')
|
||
{
|
||
return self::$db->query('SELECT q3.id, a.name AS aname, a.comment, m.name AS mname,
|
||
return self::$db->query('SELECT q3.id, a.name AS aname, a.comment, m.name AS mname, a.member_id,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) as credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(sum(amount),0) as inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL( sum( amount ) , 0 ) AS outbound
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(SUM(amount),0) AS inbound, outbound FROM
|
||
(SELECT a.id, member_id, IFNULL(SUM(amount) , 0 ) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
... | ... | |
}
|
||
|
||
/**
|
||
* It gets balance of bank account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_account_balance($account_id)
|
||
{
|
||
$credit = (float)self::$db->query("SELECT
|
||
(IFNULL(SUM(amount), 0) - IFNULL(a.outbound, 0)) AS credit
|
||
FROM (
|
||
SELECT SUM(amount) AS outbound
|
||
FROM transfers
|
||
WHERE origin_id = ".$account_id."
|
||
AND account_attribute_id = ".Account_attribute_Model::$bank."
|
||
) a, transfers t
|
||
WHERE t.destination_id = ".$account_id."
|
||
AND account_attribute_id = ".Account_attribute_Model::$bank
|
||
)->current()->credit;
|
||
return $credit;
|
||
}
|
||
|
||
/**
|
||
* It gets id of operating account.
|
||
* @return unknown_type
|
||
*/
|
freenetis/trunk/kohana/application/models/bank_transfer.php | ||
---|---|---|
<?php
|
||
class Bank_transfer_Model extends ORM
|
||
{
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all bank transfers of given bank account.
|
||
* @param $account_id
|
||
* @param $limit_from
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_transfers($account_id = null, $limit_from = 0, $limit_results = 20, $order_by = 't.id', $order_by_direction = 'DESC')
|
||
{
|
||
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name AS aname, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
AND a.account_attribute_id = ".Account_attribute_Model::$bank."
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It counts all bank transfers of given account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function count_bank_transfers($account_id)
|
||
{
|
||
return self::$db->query("SELECT
|
||
t.id, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
AND aa.id = ".Account_attribute_Model::$bank)->count();
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all unidentified bank transfers from db. Unidentified transfer is that with bank info only
|
||
* and no other transfer has set previous_transfer_id to this transfer.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_unidentified_transfers($limit_from = 0, $limit_results = 20, $order_by = 'id', $order_by_direction = 'asc')
|
||
{
|
||
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT t.id, t.datetime, t.amount, t.text,
|
||
bt.variable_symbol AS varsym,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM transfers t
|
||
LEFT JOIN bank_accounts ba ON ba.account_id = t.origin_id
|
||
JOIN bank_transfers bt ON bt.transfer_id = t.id
|
||
WHERE t.id NOT IN
|
||
(SELECT previous_transfer_id
|
||
FROM transfers t
|
||
WHERE t.previous_transfer_id IS NOT NULL)
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
/**
|
||
* It gets unidentified transfer including bank information
|
||
* @param $trans_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_unidentified_transfer($trans_id = null)
|
||
{
|
||
return self::$db->query("SELECT
|
||
oa.name AS oaname, oa.id AS oaid, oa.member_id AS oamember_id,
|
||
CONCAT(oba.account_nr, '/', oba.bank_nr) AS oanumber,
|
||
da.name AS daname, da.id AS daid, da.member_id AS daowner,
|
||
CONCAT(dba.account_nr, '/', dba.bank_nr) AS danumber,
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym
|
||
FROM transfers t
|
||
LEFT JOIN accounts oa ON oa.id = t.origin_id
|
||
LEFT JOIN bank_accounts oba ON oa.id = oba.account_id
|
||
LEFT JOIN accounts da ON da.id = t.destination_id
|
||
LEFT JOIN bank_accounts dba ON da.id = dba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
WHERE t.id =".$trans_id
|
||
)->current();
|
||
}
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/models/transfer.php | ||
---|---|---|
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT
|
||
a.id AS aid, a.name AS aname,
|
||
t.id AS tid, IF(t.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type,
|
||
t.id, IF(t.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type,
|
||
t.text, t.amount, t.datetime,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
a.name
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF(t.origin_id = ".$account_id.", t.destination_id, t.origin_id)
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
WHERE t.origin_id = ".$account_id." OR t.destination_id = ".$account_id."
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
... | ... | |
public function get_transfers_count($account_id = null)
|
||
{
|
||
return self::$db->query("SELECT
|
||
a.id AS aid, a.name AS aname,
|
||
t.id AS tid, IF(t.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type,
|
||
t.id, IF(t.destination_id = ".$account_id.", FALSE, TRUE) AS trans_type,
|
||
t.text, t.amount, t.datetime,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
a.name
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF(t.origin_id = ".$account_id.", t.destination_id, t.origin_id)
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
WHERE t.origin_id = ".$account_id." OR t.destination_id = ".$account_id
|
||
)->count();
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all bank transfers of given bank account.
|
||
* @param $account_id
|
||
* @param $limit_from
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_transfers($account_id = null, $limit_from = 0, $limit_results = 20, $order_by = 't.id', $order_by_direction = 'DESC')
|
||
{
|
||
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name AS aname, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
AND a.account_attribute_id = ".Account_attribute_Model::$bank."
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It counts all bank transfers of given account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function count_bank_transfers($account_id)
|
||
{
|
||
return self::$db->query("SELECT
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym,
|
||
a.name AS aname, CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number,
|
||
IF( t.destination_id = ".$account_id.", FALSE, TRUE ) AS trans_type
|
||
FROM transfers t
|
||
LEFT JOIN accounts a ON a.id = IF( t.origin_id = ".$account_id.", t.destination_id, t.origin_id )
|
||
LEFT JOIN bank_accounts ba ON a.id = ba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
LEFT JOIN account_attributes aa ON a.account_attribute_id = aa.id
|
||
WHERE (t.origin_id = ".$account_id." OR t.destination_id = ".$account_id.")
|
||
AND aa.id = ".Account_attribute_Model::$bank)->count();
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets all unidentified bank transfers from db. Unidentified transfer is that with bank info only
|
||
* and no other transfer has set previous_transfer_id to this transfer.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_unidentified_transfers($limit_from = 0, $limit_results = 20, $order_by = 't.id', $order_by_direction = 'desc')
|
||
{
|
||
if ($order_by == 'amount')
|
||
$order_by = 'IF( t.destination_id = '.$account_id.', amount, amount*-1 )';
|
||
return self::$db->query("SELECT t.id AS tid, t.datetime, t.amount, t.text,
|
||
bt.variable_symbol AS varsym,
|
||
CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM transfers t
|
||
LEFT JOIN bank_accounts ba ON ba.account_id = t.origin_id
|
||
JOIN bank_transfers bt ON bt.transfer_id = t.id
|
||
WHERE t.id NOT IN
|
||
(SELECT previous_transfer_id
|
||
FROM transfers t
|
||
WHERE t.previous_transfer_id IS NOT NULL)
|
||
ORDER BY ".$order_by." ".$order_by_direction."
|
||
LIMIT ".$limit_from." , ".$limit_results
|
||
);
|
||
}
|
||
|
||
/**
|
||
* It gets unidentified transfer including bank information
|
||
* @param $trans_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_unidentified_transfer($trans_id = null)
|
||
{
|
||
return self::$db->query("SELECT
|
||
oa.name AS oaname, oa.id AS oaid, oa.member_id AS oamember_id,
|
||
CONCAT(oba.account_nr, '/', oba.bank_nr) AS oanumber,
|
||
da.name AS daname, da.id AS daid, da.member_id AS daowner,
|
||
CONCAT(dba.account_nr, '/', dba.bank_nr) AS danumber,
|
||
t.id AS tid, t.datetime, t.text, t.amount,
|
||
bt.variable_symbol AS varsym
|
||
FROM transfers t
|
||
LEFT JOIN accounts oa ON oa.id = t.origin_id
|
||
LEFT JOIN bank_accounts oba ON oa.id = oba.account_id
|
||
LEFT JOIN accounts da ON da.id = t.destination_id
|
||
LEFT JOIN bank_accounts dba ON da.id = dba.account_id
|
||
LEFT JOIN bank_transfers bt ON t.id = bt.transfer_id
|
||
WHERE t.id =".$trans_id."
|
||
ORDER BY t.id DESC"
|
||
)->current();
|
||
}
|
||
|
||
|
||
// purpose unknown
|
||
/*
|
||
public function get_last_transfers($account_id = null)
|
||
{
|
||
return self::$db->query('SELECT t. * , t.id AS tid, bt.*
|
||
... | ... | |
{
|
||
return self::$db->count_records('transfers');
|
||
}
|
||
*/
|
||
|
||
/**
|
||
* Gets all money transfers from database. In case of transfers between bank accounts it shows
|
||
* additional information about transfer, for example account number and variable symbol.
|
||
* @return unknown_type
|
||
*/
|
||
// absolete function
|
||
/*
|
||
public function get_all_transfers()
|
||
{
|
||
return self::$db->query('SELECT t.id AS tid, t.datetime, t.text, t.amount,
|
||
... | ... | |
ON da.id = dba.account_id
|
||
ORDER BY t.id');
|
||
}
|
||
|
||
*/
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/models/bank_account.php | ||
---|---|---|
*/
|
||
public function get_assoc_bank_accounts()
|
||
{
|
||
return self::$db->query('SELECT q3.id, a.name, a.comment,
|
||
return self::$db->query('SELECT ba.id, ba.name, a.comment,
|
||
CONCAT(ba.account_nr, \'/\', ba.bank_nr) AS account_number,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
... | ... | |
LEFT JOIN bank_accounts ba ON a.name = ba.account_nr
|
||
WHERE a.member_id = 1 AND a.account_attribute_id = '.Account_attribute_Model::$bank
|
||
);
|
||
/*
|
||
return self::$db->query('SELECT
|
||
ba.id, ba.name,
|
||
CONCAT(ba.account_nr, \'/\', ba.bank_nr) AS account_number
|
||
}
|
||
|
||
/**
|
||
* It gets all bank accounts except bank accounts of association.
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_accounts()
|
||
{
|
||
return self::$db->query('SELECT q3.id, a.name, a.comment,
|
||
CONCAT(ba.account_nr, \'/\', ba.bank_nr) AS account_number,
|
||
q3.credit FROM
|
||
(SELECT id, member_id, (inbound - outbound) AS credit FROM
|
||
(SELECT q1.id, q1.member_id, IFNULL(sum(amount), 0) AS inbound, outbound FROM
|
||
(SELECT a.id, a.member_id, IFNULL(sum(amount), 0) AS outbound
|
||
FROM accounts a
|
||
LEFT JOIN transfers t ON a.id = t.origin_id
|
||
GROUP BY a.id) AS q1
|
||
LEFT JOIN transfers t ON q1.id = t.destination_id
|
||
GROUP BY q1.id) AS q2
|
||
) AS q3
|
||
LEFT JOIN accounts a ON q3.id = a.id
|
||
LEFT JOIN bank_accounts ba ON a.name = ba.account_nr
|
||
WHERE a.member_id <> 1 AND a.account_attribute_id = '.Account_attribute_Model::$bank
|
||
);
|
||
}
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It gets bank account number of given account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_account_number($account_id)
|
||
{
|
||
$ba_nr = self::$db->query("SELECT CONCAT(ba.account_nr, '/', ba.bank_nr) AS account_number
|
||
FROM bank_accounts ba
|
||
WHERE ba.member_id = 1'
|
||
);
|
||
*/
|
||
JOIN accounts a ON ba.account_nr = a.name");
|
||
return $ba_nr->current()->account_number;
|
||
}
|
||
|
||
/**
|
||
* It gets balance of bank account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
public function get_bank_account_balance($account_id)
|
||
{
|
||
$credit = (float)self::$db->query("SELECT
|
||
(IFNULL(SUM(amount), 0) - IFNULL(a.outbound, 0)) AS credit
|
||
FROM (
|
||
SELECT SUM(amount) AS outbound
|
||
FROM transfers
|
||
WHERE origin_id = ".$account_id."
|
||
AND account_attribute_id = ".Account_attribute_Model::$bank."
|
||
) a, transfers t
|
||
WHERE t.destination_id = ".$account_id."
|
||
AND account_attribute_id = ".Account_attribute_Model::$bank
|
||
)->current()->credit;
|
||
return $credit;
|
||
}
|
||
|
||
|
||
}
|
||
|
||
?>
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_all($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
// checks access control
|
||
// access rights
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::Error(1);
|
||
// gets new selector
|
||
... | ... | |
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array('name', 'street', 'street_number', 'town', 'ZIP_code', 'qos_ceil', 'qos_rate', 'entrance_fee', 'debt_payment_rate', 'entrance_fee_left', 'must_pay_regular_fee', 'current_credit', 'entrance_date', 'comment');
|
||
$allowed_order_type = array('id', 'name', 'street', 'street_number', 'town', 'ZIP_code', 'qos_ceil', 'qos_rate', 'entrance_fee', 'debt_payment_rate', 'entrance_fee_left', 'must_pay_regular_fee', 'current_credit', 'entrance_date', 'comment');
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
// to do - comment
|
||
$data['title'] = url_lang::lang('texts.Association members');
|
||
$data['heading'] = url_lang::lang('texts.Association members');
|
||
|
||
// creates member model
|
||
$model_members = new Member_Model();
|
||
|
||
// creates fields for filtering members
|
||
$filter=new Table_Form(url_lang::base()."members/show_all", "get", array(
|
||
... | ... | |
"tr", "td", "td", "td",
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
)
|
||
);
|
||
/** @todo Co je toto za hrůza?? Klímo, jak toto může fungovat na instalaci Freenetisu,
|
||
* která je třeba v nějakém 3. podadresáři www root-a ??
|
||
*/
|
||
// unknown... what's this? to do - comment
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
|
||
// gets members from database
|
||
$query = $model_members->get_all_members($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
$total_members = $model_members->count_all_members($filter->values());// count all members in database
|
||
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_members) ? 0 : $sql_offset;
|
||
|
||
);
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
|
||
foreach ($this->input->get() as $key=>$value)
|
||
$arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
$model_members = new Member_Model();
|
||
$total_members = $model_members->count_all_members($filter->values());
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_members)
|
||
$sql_offset = 0;
|
||
$query = $model_members->get_all_members($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
// it creates grid to view all members
|
||
$grid = new Grid(url_lang::base().'members', url_lang::lang('texts.List of all members'),array(
|
||
$grid = new Grid(url_lang::base().'members', url_lang::lang('texts.List of all members'), array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
... | ... | |
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/members/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_members, // use db count query here of course
|
||
'total_items' => $total_members, // 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',
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
... | ... | |
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('registration')->label(url_lang::lang('texts.Reg'))->bool(array(url_lang::lang('texts.No'),url_lang::lang('texts.Yes')))->class('center');
|
||
$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_field('email')->label('E-mail');
|
||
$grid->order_field('street')->label(url_lang::lang('texts.Street'));
|
||
$grid->order_field('street_number')->label(url_lang::lang('texts.Street number'));
|
||
//$grid->order_field('phone')->label(url_lang::lang('texts.Phone'));
|
||
... | ... | |
//if ($this->acl_check_2D('freenetis', 'edit_all'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'members/edit') ->action(url_lang::lang('texts.Edit'));
|
||
//if ($this->acl_check_2D('freenetis', 'delete_all'))
|
||
|
||
// member should never be deleted
|
||
//$grid->action_field('member_id') ->label(url_lang::lang('texts.Delete')) ->url(url_lang::base().'members/delete') ->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_member').'\');"');
|
||
|
||
// sets grid source of data
|
||
$grid->datasource($query);
|
||
|
||
// creates view
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
// $view->content = new View('content', $data);
|
||
$view->content = $filter->view.$grid;
|
||
//$view->content = new View('pokus');
|
||
//$view->content->total = $total_members;
|
||
//$view->content->sql_offset = $sql_offset;
|
||
//$view->content->limit_results = $limit_results;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of all members');
|
||
... | ... | |
} // end of show function
|
||
|
||
/**
|
||
* Shows list of all debtors.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function debtors($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
|
||
{
|
||
// checks access control
|
||
if (!$this->acl_check_view(get_class($this),'members'))
|
||
Controller::Error(1);
|
||
// gets new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array('name', 'street', 'street_number', 'town', 'ZIP_code', 'qos_ceil', 'qos_rate', 'entrance_fee', 'debt_payment_rate', 'entrance_fee_left', 'must_pay_regular_fee', 'current_credit', 'entrance_date', 'comment');
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
// creates member model
|
||
$model_members = new Member_Model();
|
||
|
||
/** @todo Co je toto za hrůza?? Klímo, jak toto může fungovat na instalaci Freenetisu,
|
||
* která je třeba v nějakém 3. podadresáři www root-a ??
|
||
*/
|
||
// unknown... what's this? to do - comment
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
|
||
// gets debtors from database
|
||
$query = $model_members->get_debtors($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
$total_members = count($query);
|
||
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_members) ? 0 : $sql_offset;
|
||
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
|
||
$query_string = '?'.implode('&',$arr_gets);
|
||
|
||
$grid = new Grid(url_lang::base().'members', url_lang::lang('texts.Debtors'),array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 500, // increace
|
||
'selector_min' => 500, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/members/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_members, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'query_string' => $query_string
|
||
));
|
||
|
||
$grid->order_field('id')->label('ID');
|
||
//$grid->order_field('registration')->label(url_lang::lang('texts.Reg'))->bool(array(url_lang::lang('texts.No'),url_lang::lang('texts.Yes')))->class('center');
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Name'));
|
||
$grid->order_field('street')->label(url_lang::lang('texts.Street'));
|
||
//$grid->order_field('street_number')->label(url_lang::lang('texts.Street number'));
|
||
//$grid->order_field('phone')->label(url_lang::lang('texts.Phone'));
|
||
$grid->order_field('town')->label(url_lang::lang('texts.Town'));
|
||
$grid->order_field('credit')->label(url_lang::lang('texts.Current credit'));
|
||
if ($this->acl_check_view(get_class($this), 'members'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Member')) ->url(url_lang::base().'members/show') ->action(url_lang::lang('texts.Show'));
|
||
$grid->datasource($query);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Debtors');
|
||
$view->render(TRUE);
|
||
} // end of debtors function
|
||
|
||
/**
|
||
* Adds new member to database. Creates special user assigned to this member.
|
||
* @return unknown_type
|
||
*/
|
freenetis/trunk/kohana/application/controllers/ifaces.php | ||
---|---|---|
//=============================================================================
|
||
//----- SHOW_ALL --------------------------------------------------------------
|
||
//=============================================================================
|
||
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
//---- delete session device ----
|
||
$this->session->del('ssDevice_id');
|
||
... | ... | |
|
||
if(!$this->acl_check_view('Devices_Controller','iface')) Controller::error(1);
|
||
|
||
$iface_model = new Iface_Model();
|
||
|
||
$total_ifaces = $iface_model->count_all_ifaces(); // count all members in database
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_ifaces) ? 0 : $sql_offset;
|
||
|
||
//die();
|
||
|
||
|
||
$iface_model = new Iface_Model();
|
||
$total_ifaces = $iface_model->count_all_ifaces();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_ifaces)
|
||
$sql_offset = 0;
|
||
$query = $iface_model->select(array('devices.name as device_name', 'segments.name as segment_name', 'ifaces.*'))
|
||
->join('devices', 'devices.id = ifaces.device_id')
|
||
->join('segments', 'segments.id = ifaces.segment_id', NULL, 'LEFT')
|
freenetis/trunk/kohana/application/controllers/users.php | ||
---|---|---|
<?php
|
||
class Users_Controller extends Controller {
|
||
|
||
protected $user_id = false;
|
||
protected $user_id = false;
|
||
|
||
function index()
|
||
{
|
||
url::redirect(url_lang::base().'users/show_all');
|
||
}
|
||
|
||
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_all($limit_results = 200, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
|
||
if (!$this->acl_check_view(get_class($this),'users')) Controller::error(1);
|
||
if (!$this->acl_check_view(get_class($this),'users'))
|
||
Controller::error(1);
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
//$allowed_order_type = array('street', 'street_number', 'town', 'ZIP_code', 'type', 'name', 'surname','login','birthday','comment','phone','email', 'id', 'member_id');
|
||
//if (!in_array(strtolower($order_by),$allowed_order_type)) $order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc') $order_by_direction = 'asc';
|
||
$allowed_order_type = array('id', 'name', 'surname', 'login', 'email', 'member_name');
|
||
if (!in_array(strtolower($order_by), $allowed_order_type))
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$data['title'] = url_lang::lang('texts.Association members');
|
||
$data['heading'] = url_lang::lang('texts.Association members');
|
||
$model_users = new User_Model();
|
||
|
||
|
||
$filter=new Table_Form(url_lang::base()."users/show_all", "get", array(
|
||
|
||
new Table_Form_Item('text','name','Name'),
|
||
new Table_Form_Item('text','surname','Surname'),
|
||
new Table_Form_Item('text','surname','Surname'),
|
||
"tr",
|
||
new Table_Form_Item('text','email','Email'),
|
||
new Table_Form_Item('text','phone','Phone'),
|
||
new Table_Form_Item('text','email','Email'),
|
||
new Table_Form_Item('text','phone','Phone'),
|
||
"tr",
|
||
new Table_Form_Item('text','login','Login name'),
|
||
new Table_Form_Item('text','member_name','Member'),
|
||
new Table_Form_Item('text','login','Login name'),
|
||
new Table_Form_Item('text','member_name','Member'),
|
||
"tr", "td", "td", "td",
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
|
||
)
|
||
);
|
||
|
||
//$dotaz=$model_users
|
||
// -> like($filter->values())
|
||
// -> orderby($order_by,$order_by_direction)
|
||
// -> limit($limit_results,$sql_offset)
|
||
// -> find_all();
|
||
|
||
$total_users = $model_users->count_all_users($filter->values()); // count all members in database
|
||
$total_users = $model_users->count_all_users($filter->values());
|
||
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_users)
|
||
$sql_offset = 0;
|
||
|
||
$dotaz = $model_users->get_all_users($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
//$total_users = $dotaz->count();
|
||
|
||
$sql_offset = ($sql_offset>$total_users) ? 0 : $sql_offset;
|
||
$query = $model_users->get_all_users($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values());
|
||
|
||
$arr_gets = array();
|
||
foreach ($this->input->get() as $key=>$value) $arr_gets[] = $key.'='.$value;
|
||
... | ... | |
//'separator' => '',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'selector_min' => 200, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/users/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_users, // use db count query here of course
|
||
'base_url' => Config::item('locale.lang').'/users/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_users, // 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',
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'query_string' => $query_string
|
||
));
|
||
|
||
//$grid->add_new_button(url_lang::base().'users/add', url_lang::lang('texts.Add new user'));
|
||
$grid->order_field('id')->label('ID');
|
||
$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_field('email')->label('E-mail');
|
||
$grid->order_field('member_name')->label(url_lang::lang('texts.Member'));
|
||
if ($this->acl_check_view(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
if ($this->acl_check_edit(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
|
||
$grid->datasource( $dotaz );
|
||
|
||
//$grid->add_new_button(url_lang::base().'users/add', url_lang::lang('texts.Add new user'));
|
||
$grid->order_field('id')->label('ID');
|
||
$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_field('email')->label('E-mail');
|
||
$grid->order_field('member_name')->label(url_lang::lang('texts.Member'));
|
||
if ($this->acl_check_view(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
if ($this->acl_check_edit(get_class($this),'users'))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
// user never should be deleted
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
|
||
$grid->datasource($query);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $filter->view . $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of all users');
|
||
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
|
||
//$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
// */
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $filter->view.$grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of all users');
|
||
$view->render(TRUE);
|
||
} // end of show_all function
|
||
|
||
|
||
|
||
function show_by_member($member_id = NULL, $limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_by_member($member_id = NULL, $limit_results = 200, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
|
||
if (!isset($member_id)) {
|
||
if (!isset($member_id))
|
||
{
|
||
Controller::warning(1);
|
||
} else {
|
||
}
|
||
else
|
||
{
|
||
|
||
if(!$this->acl_check_view(get_class($this),'users',$member_id)) Controller::error(1);
|
||
|
||
... | ... | |
if (!in_array(strtolower($order_by),$allowed_order_type)) $order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc') $order_by_direction = 'asc';
|
||
|
||
$data['title'] = url_lang::lang('texts.Association members');
|
||
$data['heading'] = url_lang::lang('texts.Association members');
|
||
$model_users = new User_Model();
|
||
|
||
|
||
$total_users = $model_users->count_all_users_by_member($member_id); // count all members in database
|
||
|
||
|
||
|
||
|
||
$filter=new Table_Form(url_lang::base()."users/show_by_member/".$member_id, "get", array(
|
||
new Table_Form_Item('text','name','Name'),
|
||
new Table_Form_Item('text','surname','Surname'),
|
||
"tr",
|
||
new Table_Form_Item('text','email','Email'),
|
||
new Table_Form_Item('text','phone','Phone'),
|
||
"tr",
|
||
new Table_Form_Item('text','login','Login name'),
|
||
"td",
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
new Table_Form_Item('text','name','Name'),
|
||
new Table_Form_Item('text','surname','Surname'),
|
||
"tr",
|
||
new Table_Form_Item('text','email','Email'),
|
||
new Table_Form_Item('text','phone','Phone'),
|
||
"tr",
|
||
new Table_Form_Item('text','login','Login name'),
|
||
"td",
|
||
new Table_Form_Item('submit','submit','Filter')
|
||
)
|
||
);
|
||
//$dotaz=$model_users
|
||
// -> like($filter->values())
|
||
// -> orderby($order_by,$order_by_direction)
|
||
// -> where('member_id',$member_id)
|
||
// -> limit($limit_results,$sql_offset)
|
||
// -> find_all();
|
||
|
||
$total_users = $model_users->count_all_users($filter->values(),$member_id); // count all members in database
|
||
$total_users = $model_users->count_all_users($filter->values(),$member_id);
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_users) ? 0 : $sql_offset;
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_users)
|
||
$sql_offset = 0;
|
||
|
||
$dotaz = $model_users->get_all_users($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values(),$member_id);
|
||
$query = $model_users->get_all_users($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $filter->values(), $member_id);
|
||
|
||
$grid = new Grid(url_lang::base().'users', url_lang::lang('texts.List of users of member').' '.$member->name,array(
|
||
//'separator' => '',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 200, // increace
|
||
'selector_min' => 200, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/users/show_by_member/'.$member_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_users, // use db count query here of course
|
||
'base_url' => Config::item('locale.lang').'/users/show_by_member/'.$member_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_users, // 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',
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
... | ... | |
'query_string' => $this->input->get()
|
||
));
|
||
|
||
//$grid->add_new_button(url_lang::base().'users/add', url_lang::lang('texts.Add new user'));
|
||
$grid->order_field('id')->label('ID');
|
||
$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_field('email')->label('E-mail');
|
||
|
||
if ($this->acl_check_view(get_class($this),'users',$member_id))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
|
||
if ($this->acl_check_edit(get_class($this),'users',$member_id))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
|
||
$grid->datasource( $dotaz );
|
||
//$grid->add_new_button(url_lang::base().'users/add', url_lang::lang('texts.Add new user'));
|
||
$grid->order_field('id')->label('ID');
|
||
$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_field('email')->label('E-mail');
|
||
if ($this->acl_check_view(get_class($this),'users',$member_id))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Show')) ->url(url_lang::base().'users/show') ->action(url_lang::lang('texts.Show'));
|
||
if ($this->acl_check_edit(get_class($this),'users',$member_id))
|
||
$grid->action_field('id') ->label(url_lang::lang('texts.Edit')) ->url(url_lang::base().'users/edit') ->action(url_lang::lang('texts.Edit'));
|
||
// user never should be deleted
|
||
// $grid->action_field('id')->label(url_lang::lang('texts.Delete'))->url(url_lang::base().'users/delete')->action(url_lang::lang('texts.Delete'))->script('onclick="return potvrd(\''.url_lang::lang('texts.delete_user').'\');"');
|
||
$grid->datasource($query);
|
||
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $filter->view . $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of users of member').' '.$member->name;
|
||
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
|
||
//$view->content->form = $form->html();
|
||
$view->render(TRUE);
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $filter->view.$grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.List of users of member').' '.$member->name;
|
||
$view->render(TRUE);
|
||
}
|
||
// */
|
||
}
|
||
|
||
|
||
... | ... | |
$grid->datasource( $model_works->get_jobs($user_id) );
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('users_show');
|
||
$view->footer = new View('base/footer');
|
||
$view->header = new View('base/header');
|
||
$view->content = new View('users_show');
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Display user');
|
||
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
|
||
$view->header->title = url_lang::lang('texts.Display user');
|
||
//$view->content->heading = "Úprava uživatele ".$data['row']['name']." ".$data['row']['surname'];
|
||
// $view->content->user_data = $model_users->get_user($user_id)->current();
|
||
$view->content->user_data = $model_users;
|
||
$view->content->contacts = $contacts;
|
||
$view->content->contact_types = $arr_contact_types;
|
||
$view->content->works = $grid ;
|
||
$view->content->message = $this->session->get_once('message');
|
||
$view->render(TRUE);
|
||
$view->render(TRUE);
|
||
|
||
}
|
||
else
|
||
... | ... | |
$form->input('post_title')->label(url_lang::lang('texts.post title').':')->rules('length[3,30]');
|
||
$form->group('')->label(url_lang::lang('texts.Password'));
|
||
$form->password('password')->label(url_lang::lang('texts.password').':')->rules('required|length[3,50]')->class('required');
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.confirm password').':')->rules('required|length[3,50]')->matches($form->password);
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.confirm password').':')->rules('required|length[3,50]')->matches($form->password);
|
||
$form->group('')->label(url_lang::lang('texts.Contact informations'));
|
||
$form->input('phone')->label(url_lang::lang('texts.phone').':')->rules('required|length[9,40]')->callback(array($this, 'valid_phone'));
|
||
$form->input('email')->label(url_lang::lang('texts.email').':')->rules('length[3,50]|valid_email')->callback(array($this, 'valid_email'));
|
||
... | ... | |
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$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[3,50]');
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.Confirm new password').':')->rules('required|length[3,50]')->matches($form->password);
|
||
$form->password('confirm_password')->label(url_lang::lang('texts.Confirm new password').':')->rules('required|length[3,50]')->matches($form->password);
|
||
$form->submit('submit')->value(url_lang::lang('texts.Change'));
|
||
|
||
if($form->validate())
|
freenetis/trunk/kohana/application/controllers/ports.php | ||
---|---|---|
//=============================================================================
|
||
//----- SHOW_ALL --------------------------------------------------------------
|
||
//=============================================================================
|
||
function show_all($limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC')
|
||
function show_all($limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC', $page_word = null, $page = 1)
|
||
{
|
||
//---- delete session device ----
|
||
$this->session->del('ssDevice_id');
|
||
|
||
if(!$this->acl_check_view('Devices_Controller','port')) Controller::error(1);
|
||
|
||
$port_model = new Port_Model();
|
||
|
||
$total_ports = $port_model->count_all_ports(); // count all ports in database
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_ports) ? 0 : $sql_offset;
|
||
|
||
//die();
|
||
|
||
//$query = $port_model->select(array('devices.name as device_name', 'segments.name as segment_name', 'ports.*'))->join('devices', 'devices.id = ports.device_id')->join('segments', 'segments.id = ports.segment_id')->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all();
|
||
|
||
$port_model = new Port_Model();
|
||
$total_ports = $port_model->count_all_ports();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_ports)
|
||
$sql_offset = 0;
|
||
$query = $port_model->get_all_ports($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'ports', null,array(
|
freenetis/trunk/kohana/application/controllers/transfers.php | ||
---|---|---|
if (!in_array(strtolower($order_by),$allowed_order_type)) $order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc') $order_by_direction = 'asc';
|
||
|
||
$data['title'] = url_lang::lang('texts.List of all transactions');
|
||
$data['heading'] = url_lang::lang('texts.List of all transactions');
|
||
$model_transfer = new Transfer_Model();
|
||
$total_transfers = $model_transfer->count_all_transfers();
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$alltransfers = $model_transfer->get_all_transfers();
|
||
$total_transfers = $model_transfer->count_all_transfers();
|
||
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.List of all transactions'), array(
|
||
'separator' => '',
|
||
'use_paginator' => true,
|
||
... | ... | |
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
function show_by_member($member_id = NULL, $limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'DESC')
|
||
function show_by_member($member_id = NULL, $limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
if (isset($member_id))
|
||
{
|
||
... | ... | |
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('mt.id', 'origin_id', 'destination_id', 'timestamp', 'amount', 'constant_symbol', 'specific_symbol', 'name', 'date_time', 'fee_transfer_id', 'trans_type', 'text');
|
||
$allowed_order_type = array('id', 'amount', 'name', 'datetime', 'trans_type', 'text');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'mt.id';
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
... | ... | |
$account = $account_model->find_by_member_id($member_id);
|
||
$transfer_model = new Transfer_Model();
|
||
$total_transfers = $transfer_model->count_my_transfers($account->id);
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$transfers = $transfer_model->get_transfers($account->id,$sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.Transfers of member').' '.$member->name, array(
|
||
... | ... | |
$grid->add_new_button(url_lang::base().'members/show/'.$member_id, url_lang::lang('texts.Back to the member'));
|
||
// to do - has to be solved by session, add function has to know where to return
|
||
//$grid->add_new_button(url_lang::base().'transfers/add/'.$account->id, url_lang::lang('texts.Send money to other account'));
|
||
$grid->order_field('mtid','mt.id')->label('ID');
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('trans_type')->label(url_lang::lang('texts.Type'))->bool(array(url_lang::lang('texts.Arrival'),url_lang::lang('texts.Outbound')));
|
||
$grid->order_field('aname', 'name')->label(url_lang::lang('texts.From/To'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->order_field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->datasource($transfers);
|
||
|
||
$view = new View('template');
|
||
... | ... | |
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows transfers of bank account. Transaction list includes bank information like
|
||
* variable symbol or bank account number.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
function show_by_bank_account($account_id = NULL, $limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'ASC')
|
||
{
|
||
if (isset($account_id))
|
||
{
|
||
// to do - access control
|
||
if(!$this->acl_check_view('Accounts_Controller', 'transfers', $account_id))
|
||
Controller::Error(1);
|
||
|
||
// gets grid settings
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
// to do - correct allowed order type array
|
||
$allowed_order_type = array('mt.id', 'amount', 'datetime', 'trans_type', 'account_number', 'varsym', 'aname');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'mt.id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$transfer_model = new Transfer_Model();
|
||
$total_transfers = $transfer_model->count_bank_transfers($account_id);
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
|
||
|
||
$transfers = $transfer_model->get_bank_transfers($account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$account_model = new Account_Model();
|
||
$bank_account_number = $account_model->get_bank_account_number($account_id);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.Transfers of bank account').' '.$bank_account_number, array(
|
||
//'separator' => '<br />-----------',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/transfers/show_by_member/'.$account_id.'/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_transfers, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
'variables' => $account_id.'/',
|
||
'url_array_ofset' => 1
|
||
));//,'acc_grid_template');
|
||
|
||
//if($this->acl_check_new(get_class($this),'transfers',$account_id))
|
||
// $grid->add_new_button(url_lang::base().'accounts/new_transfer/'.$account->id, url_lang::lang('texts.New transfer'));
|
||
$grid->add_new_button(url_lang::base().'accounts/bank_accounts', url_lang::lang('texts.Back to the bank accounts of association'));
|
||
$grid->order_field('mtid','mt.id')->label('ID');
|
||
$grid->order_field('trans_type')->label(url_lang::lang('texts.Type'))->bool(array(url_lang::lang('texts.Arrival'),url_lang::lang('texts.Outbound')));
|
||
$grid->order_field('aname', 'name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('varsym')->label(url_lang::lang('texts.VS'));
|
||
$grid->datasource($transfers);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Transfers of bank account').' '.$bank_account_number;
|
||
$view->render(TRUE);
|
||
}
|
||
else
|
||
{
|
||
Controller::warning(1);;
|
||
}
|
||
} // end of show_by_bank_account function
|
||
|
||
/**
|
||
* @author Jiri Svitak
|
||
* It shows transfers of credit account.
|
||
* @param $account_id
|
||
* @return unknown_type
|
||
*/
|
||
function show_by_credit_account($account_id = NULL, $limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'ASC')
|
||
function show_by_credit_account($account_id = NULL, $limit_results = 50, $order_by = 'id', $order_by_direction = 'asc', $page_word = null, $page = 1)
|
||
{
|
||
if (isset($account_id))
|
||
{
|
||
... | ... | |
// to do - correct allowed order type array
|
||
$allowed_order_type = array('mt.id', 'aname', 'amount', 'datetime', 'trans_type');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'mt.id';
|
||
$order_by = 'id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$transfer_model = new Transfer_Model();
|
||
$total_transfers = $transfer_model->get_transfers_count($account_id);
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[8])) ? (int) ($url_array[8] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
|
||
|
||
if (($sql_offset = ($page - 1) * $limit_results) > $total_transfers)
|
||
$sql_offset = 0;
|
||
$transfers = $transfer_model->get_transfers($account_id, $sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', null, array(
|
||
... | ... | |
// to do - access rights
|
||
$grid->add_new_button(url_lang::base().'accounts/credit_accounts', url_lang::lang('texts.Back to credit accounts'));
|
||
$grid->add_new_button(url_lang::base().'transfers/add/'.$account_id, url_lang::lang('texts.Send money to other account'));
|
||
$grid->order_field('mtid', 'mt.id')->label('ID');
|
||
$grid->order_field('id')->label('ID');
|
||
$grid->order_field('trans_type')->label(url_lang::lang('texts.Type'))->bool(array(url_lang::lang('texts.Arrival'),url_lang::lang('texts.Outbound')));
|
||
$grid->order_field('aname', 'name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field('name')->label(url_lang::lang('texts.Counteraccount'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->datasource($transfers);
|
||
|
||
$view = new View('template');
|
||
... | ... | |
}
|
||
} // end of show_by_bank_account function
|
||
|
||
/**
|
||
* It shows unidentified bank transfers.
|
||
* @param $limit_results
|
||
* @param $order_by
|
||
* @param $order_by_direction
|
||
* @return unknown_type
|
||
*/
|
||
function unidentified_transfers($limit_results = 50, $order_by = 'mt.id', $order_by_direction = 'asc')
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->acl_check_view(get_class($this), 'unidentified_transfers'))
|
||
// Controller::error(1);
|
||
|
||
// get new selector
|
||
if (is_numeric($this->input->get('record_per_page')))
|
||
$limit_results = (int) $this->input->get('record_per_page');
|
||
|
||
// parameters control
|
||
$allowed_order_type = array('mt.id', 'destination_id', 'timestamp', 'amount', 'variable_symbol', 'constant_symbol', 'specific_symbol', 'name', 'date_time', 'fee_transfer_id');
|
||
if (!in_array(strtolower($order_by),$allowed_order_type))
|
||
$order_by = 'mt.id';
|
||
if (strtolower($order_by_direction) != 'asc' && strtolower($order_by_direction) != 'desc')
|
||
$order_by_direction = 'asc';
|
||
|
||
$mt_model = new Transfer_Model();
|
||
$total_transfers = $mt_model->count_unidentified();
|
||
|
||
$url_array = explode('/', trim(url::current(), '/'));
|
||
$sql_offset = (isset($url_array[7])) ? (int) ($url_array[7] - 1) * $limit_results : 0;
|
||
unset($url_array);
|
||
|
||
$sql_offset = ($sql_offset>$total_transfers) ? 0 : $sql_offset;
|
||
|
||
// could be specified for particular bank account of association
|
||
$transfers = $mt_model->get_unidentified_transfers($sql_offset, (int)$limit_results, $order_by, $order_by_direction);
|
||
|
||
$grid = new Grid(url_lang::base().'transfers', url_lang::lang('texts.Unidentified transfers'),array(
|
||
'separator' => '<br />',
|
||
//'use_paginator' => false,
|
||
//'use_selector' => false,
|
||
'current' => $limit_results, // current selected 'records_per_page' value
|
||
'selector_increace' => 50, // increace
|
||
'selector_min' => 50, // minimum where selector start
|
||
'selector_max_multiplier' => 10,
|
||
'base_url' => Config::item('locale.lang').'/transfers/unidentified_transfers/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
|
||
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
|
||
'total_items' => $total_transfers, // use db count query here of course
|
||
'items_per_page' => $limit_results, // it may be handy to set defaults for stuff like this in config/pagination.php
|
||
'style' => 'classic',
|
||
'order_by' => $order_by,
|
||
'order_by_direction' => $order_by_direction,
|
||
'limit_results' => $limit_results,
|
||
//'variables' => $acc_id.'/',
|
||
'url_array_ofset' => 0
|
||
));//,'unident_grid_template');
|
||
|
||
|
||
//$grid->add_new_button(url_lang::base().'accounts/new_transfer/'.$member_id, url_lang::lang('texts.New transfer'));
|
||
$grid->order_field('mtid','mt.id')->label('ID');
|
||
$grid->order_field('datetime')->label(url_lang::lang('texts.Date and time'));
|
||
$grid->order_field('amount')->label(url_lang::lang('texts.Amount'));
|
||
$grid->order_field('varsym')->label(url_lang::lang('texts.Variable symbol'));
|
||
$grid->order_field('account_number')->label(url_lang::lang('texts.Account number'));
|
||
$grid->field('text')->label(url_lang::lang('texts.Text'));
|
||
//$grid->action_field('mtid') ->label(url_lang::lang('texts.Details'))->url(url_lang::base().'accounts/unidentified_detail')->action(url_lang::lang('texts.Details'))->style('style="text-align:center;"');
|
||
$grid->action_field('mtid') ->label(url_lang::lang('texts.Payment'))->url(url_lang::base().'transfers/assign_transfer')->action(url_lang::lang('texts.Assign'));
|
||
$grid->datasource($transfers);
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
$view->content = $grid;
|
||
$view->footer = new View('base/footer');
|
||
$view->header->menu = Controller::render_menu();
|
||
$view->header->title = url_lang::lang('texts.Unidentified transfers');
|
||
$view->render(TRUE);
|
||
} // end of unidentified_transfers function
|
||
|
||
function assign_transfer($trans_id = NULL)
|
||
{
|
||
// to do - access rights
|
||
//if (!$this->gacl_class->acl_check('freenetis', 'new_own', 'all', $_SESSION['username'],get_class($this),'assign_transfers')) Controller::error(1);
|
||
if (isset($trans_id))
|
||
{
|
||
$account_model = new Account_Model();
|
||
$accounts = $account_model->get_credit_accounts(0, $account_model->get_credit_accounts_count(), 'a.id', 'asc');
|
Také k dispozici: Unified diff
Snad vsude konecne spravena ta prasarna se sekanim lomitek u strankovani gridu. Predelano menu a zobrazovani bankovnich uctu, jdou videt uz vsechny.