Revize 159
Přidáno uživatelem Michal Kliment před více než 15 roky(ů)
freenetis/trunk/kohana/application/controllers/scheduler.php | ||
---|---|---|
private function parse_ebank_account($url)
|
||
{
|
||
$ucet = new Parser_Ebanka();
|
||
$ucet->set_callback('ShowData');
|
||
$ucet->set_callback(array($this, 'ShowData'));
|
||
//$ucet->set_callback('pokus');
|
||
|
||
print"<table>";
|
||
$ucet->parse($url);
|
||
print"</table>";
|
||
}
|
||
|
||
private function ShowData($res)
|
||
public function ShowData($res)
|
||
{
|
||
print sprintf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",$res->date_time, $res->comment, $res->name, $res->typ, $res->variable_symbol, $res->constant_symbol, $res->specific_symbol, $res->castka, $res->poplatek);
|
||
}
|
||
}
|
||
}
|
freenetis/trunk/kohana/application/libraries/Parser_Ebanka.php | ||
---|---|---|
return strtr($field, ",", ".");
|
||
}
|
||
|
||
protected function get_data_from_transparent() {
|
||
protected function get_data_from_transparent() {
|
||
|
||
$res = $this->result;
|
||
$first=true;
|
||
do {
|
||
$first=true;
|
||
|
||
do {
|
||
|
||
$status=$this->get_table_rows();
|
||
$nr=count($this->matches[1]);
|
||
$fields=str_replace(array("\r", "\n", "\t"), "", $this->matches[1]);
|
||
$nr=count($this->matches[1]);
|
||
//echo 'Nr: '.$nr.'<br />';
|
||
$fields=str_replace(array("\r", "\n", "\t"), "", $this->matches[1]);
|
||
if ($first) {
|
||
$i=6;
|
||
$first=false;
|
||
} else $i=0;
|
||
} else $i=0;
|
||
//echo 'i: '.$i.'<br />';
|
||
for (; $i<$nr; $i++) {
|
||
$field_nr=$i % 6;
|
||
$field=$fields[$i];
|
||
$field=$fields[$i];
|
||
//echo '<br /><br />'.$field.' '.$field_nr.'<br /><br />';
|
||
switch ($field_nr) {
|
||
case 0: // příklad: 31.08.2008<br/>06:11
|
||
$arr=explode("<br/>", $field);
|
||
$arrDate=explode(".", $arr[0]);
|
||
$res->date_time=$arrDate[2]."-".$arrDate[1]."-".$arrDate[0]." ".$arr[1];
|
||
break;
|
||
case 0: // příklad: 31.08.2008<br/>06:1
|
||
$arr=explode("<br/>", $field);
|
||
$arrDate=explode(".", $arr[0]);
|
||
$res->date_time=$arrDate[0];
|
||
//$res->date_time=$arrDate[2]."-".$arrDate[1]."-".$arrDate[0]." ".$arr[1];
|
||
break;
|
||
|
||
case 1: // Poznámky<br/>Název účtu plátce
|
||
$field=html_entity_decode($field,ENT_QUOTES,"UTF-8");
|
||
$arr=explode("<br/>", $field);
|
||
$res->comment=$arr[0];
|
||
$res->name=$arr[1];
|
||
break;
|
||
break;
|
||
|
||
case 2: //2x za sebou datum odepsání<br/>typ platby
|
||
$arr=explode("<br/>", $field);
|
||
$res->typ=html_entity_decode($arr[2],ENT_QUOTES,"UTF-8");
|
||
... | ... | |
case 5:
|
||
$res->poplatek=$this->get_castka($field); // Poplatek
|
||
if (isset($this->callback)) call_user_func($this->callback, $res);
|
||
|
||
/**
|
||
* ted uz muzeme ulozit ziskane data do databaze:
|
||
*/
|
||
break;
|
||
} // switch
|
||
} // for
|
||
} while ( $status!== false );
|
||
} while ( $status!== false );
|
||
}
|
||
|
||
protected function get_data_from_regular() {
|
||
... | ... | |
else $this->result=$param;
|
||
}
|
||
|
||
public function parse($url) {
|
||
public function parse($url) {
|
||
|
||
$this->open($url);
|
||
$this->get_charset();
|
||
/**
|
||
* Now: search for the begining of the table or the date
|
||
*/
|
||
*/
|
||
|
||
$found=$this->find_tags_and_trim(array(self::YEAR_STRING, self::START_STRING));
|
||
switch ($found) {
|
||
case 0: // období výpisu nalezeno = standardní (netransparentní) výpis
|
||
... | ... | |
break;
|
||
case 2:
|
||
die ("Nemohu najít začátek tabulky nebo datum/rok");
|
||
};
|
||
};
|
||
|
||
|
||
if ($transparent)
|
||
$this->get_data_from_transparent();
|
||
else
|
||
$this->get_data_from_regular();
|
||
|
||
fclose($this->file);
|
||
fclose($this->file);
|
||
|
||
}
|
||
}
|
||
|
||
?>
|
||
?>
|
Také k dispozici: Unified diff
Opraven vypis vsech vyparsovanych plateb, jeste zbyva doresit absenci prvni platby.