Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 114

Přidáno uživatelem Tomáš Dulík před asi 16 roky(ů)

members_show.php : v šabloně přidána funkce show_by_member, která zobrazí všechny zařízení všech uživatelů jednoho člena
devices.php: opravena funkce show_my() - zobrazovala na dalších stránkách všechna zařízení v DB, tedy i ty které nepatřily userovi
device.php: porýpáno, ale nic neupraveno
accounts.php: porýpáno, nedokončeno

Zobrazit rozdíly:

freenetis/trunk/kohana/application/models/device.php
return self::$db->query('SELECT d.id,d.type,d.name, CONCAT(users.name, \' \', users.surname) AS u_name,CONCAT(u2.name, \' \', u2.surname) AS engineer_name,
IFNULL(ifaces.iface_count,0) AS iface_count,
IFNULL(ports.port_count,0) AS port_count FROM devices d
LEFT JOIN users ON d.user_id = users.id
JOIN users ON d.user_id = users.id
LEFT JOIN users u2 ON d.engineer_id = u2.id
LEFT JOIN (SELECT COUNT(*) as iface_count,device_id FROM ifaces GROUP BY ifaces.device_id) ifaces ON d.id=ifaces.device_id
LEFT JOIN (SELECT COUNT(*) as port_count,device_id FROM ports GROUP BY ports.device_id) ports ON d.id=ports.device_id
freenetis/trunk/kohana/application/controllers/accounts.php
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'))
$form->upload('listing', TRUE)->label(url_lang::lang('texts.File with bank transfer listing'))
->rules('required|allow[htm,html]');
$form->submit('submit');
if($form->validate())
{
print_r($form);
$this->parse_ebank_account($form->listing->value);
}
else
{
$title = url_lang::lang('texts.Upload bank transfers listing');
$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->title = $title;
$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->content->headline = $title;
$view->footer = new View('base/footer');
......
}
}
private function parse_ebank_account($url=NULL)
public function parse_ebank_account($url="c:/www/freenetis/kohana/upload/2007.html")
/**
* pridat parametry:
* + full výpis (včetně čísel účtů) nebo veřejný výpis (bez čísel účtů?)
......
}
//*
// parse ebank file
echo "Memory usage=".memory_get_usage()."<p>";
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");
$string = str_replace($dopryc, "", $string);
$string = str_replace("< />", ";", $string);
$string = str_replace("</tr>", "<br />", $string);
$string = stristr($string, 'Pohyby na');
$string = stristr($string, '<table');
$pozice = stripos ($string, '</table');
$string = substr ($string, 0, $pozice);
$dopryc = array(" class=\"odd\"", " class=\"even\"",
"\n\n", "<tbody>", "br");
$string = str_ireplace($dopryc, "", $string);
$string = str_ireplace("< />", ";", $string);
$string = str_ireplace("</tr>", "<br />", $string);
$dopryc = array("<tr>","&nbsp;","<td>");
$string = str_replace($dopryc, "", $string);
$string = str_replace("</td>", ";", $string);
$string = str_replace("\n", "", $string);
$string = str_ireplace($dopryc, "", $string);
$string = str_ireplace("</td>", ";", $string);
$string = str_ireplace("\n", "", $string);
$string = str_replace(" ", "", $string);
echo "Memory usage=".memory_get_usage()."<p>";
print $string;
$vysledek = html_entity_decode($string, NULL, 'UTF-8');
$radky = explode('<br />', $vysledek);
die("OK");
$model_transfer->clear();
$model_bank_transfer = new Money_transfer_bank_info_Model();
$zaznamy = 0;
freenetis/trunk/kohana/application/controllers/devices.php
//=============================================================================
//----- SHOW_MY --------------------------------------------------------------
//=============================================================================
function show_my($limit_results = 50, $order_by = 'id', $order_by_direction = 'ASC')
function show_my($limit_results = 500, $order_by = 'id', $order_by_direction = 'ASC')
{
$user_id = $this->session->get('user_id');
$device_model = new Device_Model;
$total_devices = $device_model->count_all_devices(); // count all devices in database
// get new selector
if (is_numeric($this->input->get('record_per_page'))) $limit_results = (int) $this->input->get('record_per_page');
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_devices) ? 0 : $sql_offset;
//$sql_offset = ($sql_offset>$total_devices) ? 0 : $sql_offset;
//$dotaz = $this->model_members->get_all_members($sql_offset, (int)$limit_results, $order_by, $order_by_direction); // get all members from database
//$dotaz = $device_model->find_all();
//$dotaz = $device_model->select(array('CONCAT(users.name,\' \',users.surname) as u_name', 'devices.*'))->join('users', 'devices.user_id = users.id')->orderby($order_by,$order_by_direction)->limit($limit_results,$sql_offset)->find_all();
$query = $device_model->get_all_devices($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $user_id = $this->session->get('user_id'));
$query = $device_model->get_all_devices($sql_offset, (int)$limit_results, $order_by, $order_by_direction, $user_id);
$total_devices=$device_model->count_last_query();
$grid = new Grid(url_lang::base().'devices', null,array(
//'separator' => '<br />-----------',
//'use_paginator' => false,
//'use_selector' => false,
'current' => $limit_results, // current selected 'records_per_page' value
'selector_increace' => 10, // increace
'selector_min' => 10, // minimum where selector start
'selector_max_multiplier' => 5,
'base_url' => Config::item('locale.lang').'/devices/show_all/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
'selector_increace' => 500, // increace
'selector_min' => 500, // minimum where selector start
'selector_max_multiplier' => 10,
'base_url' => Config::item('locale.lang').'/devices/show_my/'.$limit_results.'/'.$order_by.'/'.$order_by_direction ,
'uri_segment' => 'page', // pass a string as uri_segment to trigger former 'label' functionality
'total_items' => $total_devices, // 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
......
}
//----- end SHOW_MY ----------------------------------------------------------
//=============================================================================
//=============================================================================
//----- SHOW ------------------------------------------------------------------
//=============================================================================
freenetis/trunk/kohana/application/views/members_show.php
<?php echo $message ? '<div class="message">'.$message.'</div>' : '' ?>
<?php echo html::anchor(url_lang::base().'members/edit/'.$member_data->member_id,url_lang::lang('texts.Edit member')).' | '.html::anchor(url_lang::base().'users/chngpass/'.$member_data->id,url_lang::lang('texts.Change password')).' | '.html::anchor(url_lang::base().'accounts/transfers/'.$member_data->member_id,url_lang::lang('texts.Show account transfers')) ?><br />
<?php echo html::anchor(url_lang::base().'members/edit/'.$member_data->member_id,url_lang::lang('texts.Edit member'))
.' | '.html::anchor(url_lang::base().'users/chngpass/'.$member_data->id,url_lang::lang('texts.Change password'))
.' | '.html::anchor(url_lang::base().'devices/show_by_member/'.$member_data->member_id,url_lang::lang('texts.Show devices'))
.' | '.html::anchor(url_lang::base().'accounts/transfers/'.$member_data->member_id,url_lang::lang('texts.Show account transfers'))
?>
<br />
<br />
<table class="extended" cellspacing="0" style="float:left">
<tr>

Také k dispozici: Unified diff