GIT.Harvie.CZ
/
mirrors
/
SokoMan.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
121e44f
)
Trida Sklad_HTML nyni nic nevypisuje (priprava na templatovaci system)
author
Thomas Mudrunka
<tomas@mudrunka.cz>
Mon, 18 Jul 2011 14:57:56 +0000
(16:57 +0200)
committer
Thomas Mudrunka
<tomas@mudrunka.cz>
Mon, 18 Jul 2011 14:57:56 +0000
(16:57 +0200)
index.php
patch
|
blob
|
blame
|
history
diff --git
a/index.php
b/index.php
index d1d0942acba4f35bd998eb41a6884336ac481fc4..68c81d71c43528f9116cd7f26301e488adbeb547 100755
(executable)
--- a/
index.php
+++ b/
index.php
@@
-24,15
+24,17
@@
require_once('HTTP_Auth.class.php');
/**
* Trida poskytuje podpurne funkce pro generovani HTML kodu specificke pro sklad
*
/**
* Trida poskytuje podpurne funkce pro generovani HTML kodu specificke pro sklad
*
+* Tato trida by nemela sama nic vypisovat (vyjma chybovych a debugovacich hlasek)!
+*
* @package Sklad_HTML
* @author Tomas Mudrunka
*/
class Sklad_HTML {
* @package Sklad_HTML
* @author Tomas Mudrunka
*/
class Sklad_HTML {
- function header
_print
($title='') {
+ function header($title='') {
$home = URL_HOME;
$script = $_SERVER['SCRIPT_NAME'];
$search = @trim($_GET['q']);
$home = URL_HOME;
$script = $_SERVER['SCRIPT_NAME'];
$search = @trim($_GET['q']);
-
echo
<<<EOF
+
return
<<<EOF
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
@@
-54,26
+56,28
@@
class Sklad_HTML {
EOF;
}
EOF;
}
- function row
_print
($row) {
-
echo('<tr>')
;
+ function row($row) {
+
$html='<tr>'
;
foreach($row as $var) {
if(trim($var) == '') $var = ' ';
foreach($row as $var) {
if(trim($var) == '') $var = ' ';
-
echo("<td>$var</td>")
;
+
$html.="<td>$var</td>"
;
}
}
- echo('</tr>');
+ $html.='</tr>';
+ return $html;
}
}
- function table
_print
(&$table, $params='border=1') {
-
echo("<table $params>")
;
+ function table(&$table, $params='border=1') {
+
$html="<table $params>"
;
$header=true;
foreach($table as $row) {
if($header) {
$header=true;
foreach($table as $row) {
if($header) {
- $
this->row_print
(array_keys($row));
+ $
html.=$this->row
(array_keys($row));
$header=false;
}
$header=false;
}
- $
this->row_print
($row);
+ $
html.=$this->row
($row);
}
}
- echo('</table>');
+ $html.='</table>';
+ return $html;
}
function link($title='n/a', $link='#void', $internal=true) {
}
function link($title='n/a', $link='#void', $internal=true) {
@@
-130,11
+134,11
@@
EOF;
$table = $table_sorted;
}
$table = $table_sorted;
}
- function
print
_item_table($table) {
+ function
render
_item_table($table) {
$this->table_add_images($table);
$this->table_collapse($table);
$this->table_sort($table);
$this->table_add_images($table);
$this->table_collapse($table);
$this->table_sort($table);
- return $this->table
_print
($table);
+ return $this->table($table);
}
function input($name=false, $value=false, $type='text', $placeholder=false, $options=false) {
}
function input($name=false, $value=false, $type='text', $placeholder=false, $options=false) {
@@
-163,7
+167,7
@@
EOF;
return $html;
}
return $html;
}
- function
print
_insert_form($class, $columns, $selectbox=array(), $current=false, $multi_insert=true) {
+ function
render
_insert_form($class, $columns, $selectbox=array(), $current=false, $multi_insert=true) {
//echo('<pre>'); print_r($selectbox);
//echo('<pre>'); print_r($current);
$update = false;
//echo('<pre>'); print_r($selectbox);
//echo('<pre>'); print_r($current);
$update = false;
@@
-172,33
+176,33
@@
EOF;
$current = array_shift($current);
}
$current = array_shift($current);
}
-
echo('<form method="POST">')
;
- if($multi_insert)
echo('<div name="input_set" style="float:left; border:1px solid grey;">')
;
-
echo
$this->input('table', $class, 'hidden');
+
$html='<form method="POST">'
;
+ if($multi_insert)
$html.='<div name="input_set" style="float:left; border:1px solid grey;">'
;
+
$html.=
$this->input('table', $class, 'hidden');
foreach($columns as $column) {
foreach($columns as $column) {
-
echo($column['Field'].': ')
;
+
$html.=$column['Field'].': '
;
$name='value:'.$column['Field'].'[]';
switch(true) {
case preg_match('/auto_increment/', $column['Extra']):
$val = $update ? $current[$column['Field']] : ''; //opakuje se (skoro) zbytecne
$name='value:'.$column['Field'].'[]';
switch(true) {
case preg_match('/auto_increment/', $column['Extra']):
$val = $update ? $current[$column['Field']] : ''; //opakuje se (skoro) zbytecne
-
echo
$this->input($name, $val, 'hidden');
-
echo($val.'(AUTO)')
;
+
$html.=
$this->input($name, $val, 'hidden');
+
$html.=$val.'(AUTO)'
;
break;
case isset($selectbox[$column['Field']]):
$val = $update ? $current[$column['Field']] : false;
break;
case isset($selectbox[$column['Field']]):
$val = $update ? $current[$column['Field']] : false;
-
echo
$this->select($name,$selectbox[$column['Field']],$val); //opakuje se
+
$html.=
$this->select($name,$selectbox[$column['Field']],$val); //opakuje se
break;
default:
$val = $update ? $current[$column['Field']] : false; //opakuje se
break;
default:
$val = $update ? $current[$column['Field']] : false; //opakuje se
-
echo
$this->input($name, $val);
+
$html.=
$this->input($name, $val);
break;
}
break;
}
-
echo('<br />')
;
+
$html.='<br />'
;
}
if($multi_insert) {
//TODO, move to separate JS file
}
if($multi_insert) {
//TODO, move to separate JS file
-
echo
<<<EOF
+
$html.=
<<<EOF
</div>
<span name="input_set_next"></span><br style="clear:both" />
<script>
</div>
<span name="input_set_next"></span><br style="clear:both" />
<script>
@@
-213,8
+217,9
@@
EOF;
}
$btn = is_array($current) ? 'UPDATE' : 'INSERT';
}
$btn = is_array($current) ? 'UPDATE' : 'INSERT';
- echo($this->input(false, $btn, 'submit'));
- echo('</form>');
+ $html.=$this->input(false, $btn, 'submit');
+ $html.='</form>';
+ return $html;
}
}
}
}
@@
-358,20
+363,20
@@
class Sklad_UI {
}
function show_items($class, $id=false, $limit=false, $offset=0, $search=false) {
}
function show_items($class, $id=false, $limit=false, $offset=0, $search=false) {
-
$this->html->print
_item_table($this->db->get_listing($class, $id, $limit, $offset, $search));
+
echo $this->html->render
_item_table($this->db->get_listing($class, $id, $limit, $offset, $search));
}
function show_form_add($class) {
$columns = $this->db->get_columns($class);
$selectbox = $this->db->columns_get_selectbox($columns, $class);
}
function show_form_add($class) {
$columns = $this->db->get_columns($class);
$selectbox = $this->db->columns_get_selectbox($columns, $class);
-
$this->html->print
_insert_form($class, $columns, $selectbox);
+
echo $this->html->render
_insert_form($class, $columns, $selectbox);
}
function show_form_edit($class, $id) {
$columns = $this->db->get_columns($class);
$selectbox = $this->db->columns_get_selectbox($columns, $class);
$current = $this->db->get_listing($class, $id);
}
function show_form_edit($class, $id) {
$columns = $this->db->get_columns($class);
$selectbox = $this->db->columns_get_selectbox($columns, $class);
$current = $this->db->get_listing($class, $id);
-
$this->html->print
_insert_form($class, $columns, $selectbox, $current);
+
echo $this->html->render
_insert_form($class, $columns, $selectbox, $current);
}
function show_single_record_details($class, $id) {
}
function show_single_record_details($class, $id) {
@@
-487,7
+492,7
@@
class Sklad_UI {
}
$PATH_INFO=@trim($_SERVER[PATH_INFO]);
}
$PATH_INFO=@trim($_SERVER[PATH_INFO]);
-
$this->html->header_print
($PATH_INFO);
+
echo $this->html->header
($PATH_INFO);
//Sephirot:
//Sephirot:
This page took
0.29109 seconds
and
4
git commands to generate.