Revize 107
Přidáno uživatelem Tomáš Dulík před více než 16 roky(ů)
freenetis/trunk/kohana/application/i18n/cs_CZ/texts.php | ||
---|---|---|
'honorary member'=>'Čestný člen',
|
||
'former member'=>'Bývalý člen',
|
||
'non-statutory member'=>'Člen bez statusu',
|
||
'vacating member'=>'Přerušené členství'
|
||
'vacating member'=>'Přerušené členství',
|
||
'non-member'=>'Nečlen'
|
||
);
|
freenetis/trunk/kohana/application/models/money_transfer.php | ||
---|---|---|
|
||
public function get_last_transfers($account_id = null)
|
||
{
|
||
return self::$db->query('SELECT mt. * , mt.id AS mtid, bi. *
|
||
FROM money_transfers mt
|
||
LEFT JOIN money_transfer_bank_infos bi ON bi.id = mt.bank_info_id
|
||
return self::$db->query('SELECT mt. * , mt.id AS mtid, bi.*
|
||
FROM money_transfers AS mt
|
||
LEFT JOIN money_transfer_bank_infos AS bi
|
||
ON bi.id = mt.bank_info_id
|
||
WHERE mt.destination_id = '.$account_id.'
|
||
AND mt.origin_id IS NULL
|
||
AND mt.bank_info_id IS NOT NULL
|
freenetis/trunk/kohana/application/models/enum_type.php | ||
---|---|---|
<?php
|
||
class Enum_type_Model extends ORM {
|
||
const type_id_member=1,
|
||
type_id_device=2;
|
||
const id_type_of_member=1,
|
||
id_type_of_device=2,
|
||
id_type_of_user=3;
|
||
|
||
/**
|
||
* enum_types array supplements a database table, holding the names for
|
||
* all enumeration types for dropdown fields.
|
||
... | ... | |
* @var array of integers, where index is a string
|
||
*/
|
||
private static $enum_types=array(
|
||
self::type_id_member=>"Member types",
|
||
self::type_id_device=>"Device types",
|
||
self::id_type_of_member=>"Member types",
|
||
self::id_type_of_device=>"Device types",
|
||
self::id_type_of_user=>"User types",
|
||
|
||
);
|
||
|
||
function cmp_utf($a, $b)
|
||
{
|
||
return strcoll($a,$b);
|
||
}
|
||
|
||
/**
|
||
* get_values returns all values for enumeration type identified by
|
||
* $type_id from database. It translates the values using i18n,
|
||
* and finally sorts them according to current locale.
|
||
*
|
||
* Note: the sort function does not work on Windows, because
|
||
* windows do not support the UTF locales.
|
||
*/
|
||
function get_values($type_id) {
|
||
$types = $this->find_all_by_type_id($type_id);
|
||
|
||
$arr_types=array();
|
||
foreach ($types as $type)
|
||
$arr_types[$type->id]=url_lang::lang('texts.'.$type->value);
|
||
|
||
uasort($arr_types, array($this, "cmp_utf"));
|
||
return $arr_types;
|
||
}
|
||
|
freenetis/trunk/kohana/application/models/user.php | ||
---|---|---|
|
||
public function username_exist($username, $user_id = null)
|
||
{
|
||
if (isset($user_id)) return (bool) self::$db->where(array('login' => $username, 'id!=' => $user_id))->count_records('users');
|
||
if (isset($user_id)) {
|
||
$count=self::$db->where(array('login' => $username, 'id!=' => $user_id))->count_records('users');
|
||
//print_r("userid=$user_id, count=$count");
|
||
return (bool)$count;
|
||
}
|
||
else return (bool) self::$db->where('login', $username)->count_records('users');
|
||
}
|
||
|
freenetis/trunk/kohana/application/controllers/members.php | ||
---|---|---|
if (!$this->acl_check_2D('freenetis', 'new_all')) Controller::error(1);
|
||
|
||
$enum_types=new Enum_type_Model();
|
||
$types=$enum_types->get_values(Enum_type_Model::type_id_member);
|
||
$types=$enum_types->get_values(Enum_type_Model::id_type_of_member);
|
||
|
||
$form = new Forge(url_lang::base().'members/add', '', 'POST', array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
... | ... | |
$user_data->phone = $form_data['phone'];
|
||
$user_data->email = $form_data['email'];
|
||
$user_data->password = sha1($form_data['passwd']);
|
||
|
||
$user_data->type="member";
|
||
|
||
$member_data->type = $form_data['type'];
|
||
$member_data->comment = $form_data['comment'];
|
||
$member_data->entrance_date = date("Y-m-d",$form_data['entrance_date']);
|
||
... | ... | |
{
|
||
|
||
$user_model=new User_Model();
|
||
$user_model->select('id, login');
|
||
$user_model->where('type!=','user');
|
||
$user_model->find_by_member_id($member_id);
|
||
$user_model->select('id, login')
|
||
->where('type=','member')
|
||
->find_by_member_id($member_id);
|
||
if ($member_id == $_SESSION['member_id'])
|
||
{
|
||
if (!$this->acl_check_2D('freenetis', 'edit_own')) Controller::error(1);
|
||
... | ... | |
$form->input('post_title')->label(url_lang::lang('texts.post title').':')->rules('length[3,30]')->value($member_data->post_title);
|
||
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_type')) {
|
||
$enum_types=new Enum_type_Model();
|
||
$types=$enum_types->get_values(Enum_type_Model::type_id_member);
|
||
$types=$enum_types->get_values(Enum_type_Model::id_type_of_member);
|
||
$form->dropdown('type')->label(url_lang::lang('texts.Type').':')
|
||
->options($types)
|
||
->selected($member_data->typem);
|
freenetis/trunk/kohana/application/controllers/users.php | ||
---|---|---|
$user_data = new User_Model;
|
||
$user_data->find($user_id);
|
||
$form_data['birthday'] = date("Y-m-d",$form_data['birthday']);
|
||
if ($this->gacl_class->acl_check('freenetis', 'edit_username', 'all', $_SESSION['username'],get_class($this),'edit_username')) $form_data['login'] = $form_data['username'];
|
||
if ($this->acl_check_3D('freenetis', 'edit_own', 'edit_username'))
|
||
$form_data['login'] = $form_data['username'];
|
||
|
||
foreach($form_data as $key => $value)
|
||
{
|
||
$user_data->$key = $value;
|
freenetis/trunk/kohana/application/controllers/accounts.php | ||
---|---|---|
protected $editation = FALSE;
|
||
protected $acc_id = NULL;
|
||
protected $sel_member;
|
||
|
||
const acc_nr="184932848";
|
||
const acc_url="http://www.rb.cz/firemni-finance/transparentni-ucty/?root=firemni-finance&item1=transparentni-ucty&tr_acc=vypis&account_number=";
|
||
|
||
function index()
|
||
{
|
||
url::redirect(url_lang::base().'accounts/transfers');
|
||
... | ... | |
**********************************************************************************
|
||
*********************HERE ARE FUNCTIONS FOR DIRECT GET ACCESS *******************/
|
||
|
||
public function parse_ebank_account()
|
||
public function upload_ebank_file() {
|
||
$form = new Forge(url_lang::base().'accounts/upload_ebank_file', '','POST',array('id' => 'article_form'));
|
||
$form->set_attr('class', 'form_class')->set_attr('method', 'post');
|
||
$form->upload('listing', TRUE)->label(url_lang::lang('texts.Transactions listing file'))
|
||
->rules('required|allow[htm,html]');
|
||
$form->submit('submit');
|
||
|
||
if($form->validate())
|
||
{
|
||
print_r($form);
|
||
}
|
||
else
|
||
{
|
||
$view->form = new View('registration');
|
||
|
||
$view = new View('template');
|
||
$view->header = new View('base/header');
|
||
|
||
$view->header->title = url_lang::lang('texts.Upload bank transactions listing');
|
||
$view->header->menu = Controller::render_menu();
|
||
|
||
$view->content = new View('form');
|
||
$view->content->form = $form->html();
|
||
$view->content->link_back = html::anchor(url_lang::base().'/accounts/main_accounts/master',
|
||
url_lang::lang('texts.Back to main bank account'));
|
||
$view->content->headline = url_lang::lang('texts.Upload bank transactions listing');
|
||
|
||
$view->footer = new View('base/footer');
|
||
|
||
$view->render(TRUE);
|
||
}
|
||
}
|
||
|
||
private function parse_ebank_account($url=NULL)
|
||
/**
|
||
* pridat parametry:
|
||
* + full výpis (včetně čísel účtů) nebo veřejný výpis (bez čísel účtů?)
|
||
* + číslo účtu, ze kterého se to má tahat
|
||
*/
|
||
{
|
||
|
||
//*
|
||
// get bank fee value
|
||
/**
|
||
* get the value of fee that we (organization) withdraw from member's
|
||
* account upon each bank transaction he makes.
|
||
* This way we punish members who pay their fees every month, often with
|
||
* wrong variable symbols, so we must spend lot of time with
|
||
* manual identification of the payments.
|
||
*/
|
||
$model_fee = new Bank_fee_Model(1);
|
||
$fee_value = (float)$model_fee->fee;
|
||
|
||
// Get last two transfers
|
||
$model_account = new Account_Model();
|
||
$model_account->where('type=\'master\'')->find();
|
||
$master_acc_id = $model_account->id;
|
||
... | ... | |
$model_account->where('type=\'unidentified\'')->find();
|
||
$unidentified_acc_id = $model_account->id;
|
||
|
||
// Get last two transfers
|
||
$model_transfer = new Money_transfer_Model();
|
||
$last_transactions = $model_transfer->get_last_transfers($master_acc_id);
|
||
$last = array();
|
||
... | ... | |
}
|
||
//*
|
||
// parse ebank file
|
||
$string = strstr(file_get_contents ('http://www.ebanka.cz/tran_uct/184932848.html'), '<tbody>');
|
||
if ($url==NULL)
|
||
$string=file_get_contents (self::acc_url . self::acc_nr);
|
||
else $string=file_get_contents($url);
|
||
$string = strstr($file, '<tbody>');
|
||
$pozice = strpos ($string, '</tbody>');
|
||
$string = substr ($string, 0, $pozice);
|
||
$dopryc = array(" class=\"odd\"", " class=\"even\"", "\n\n", "<tbody>", "br");
|
Také k dispozici: Unified diff
accounts.php: ebanka zanikla, transparentni vypis je na nove adrese. Začátek implementace importu kompletních výpisů pomocí souborů
enum_type.php: přidání nového typu type_of_user. Kosmetické úpravy, např. řazení hodnot výčtového typu
users.php: odstranění chyby, kdy nebylo možné editovat uživatelské jméno
texts.php: doplnění překladu "Non-member"
members.php: při přidání nového člena nebyl nastaven typ uživatele na "member"
money_transfer.php: asi jen nějaká kosmetická úprava
user.php: kosmetická úprava
upload: nový adresář, ve kterém budou sídlit uploadované soubory (např. s bankovními výpisy)