From 0a027cc76c27c630ecc5bf93d98834709ae63ed9 Mon Sep 17 00:00:00 2001 From: Thomas Mudrunka Date: Mon, 8 Aug 2011 05:43:48 +0200 Subject: [PATCH] Rozdelil jsem kod do dvou dalsich trid: HTML a Sklad_DB_Abstract --- index.php | 140 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 80 insertions(+), 60 deletions(-) diff --git a/index.php b/index.php index a41759c..01a0ebc 100755 --- a/index.php +++ b/index.php @@ -21,6 +21,75 @@ require_once('sklad.conf.php'); require_once('Sklad_LMS-fake.class.php'); require_once('HTTP_Auth.class.php'); +/** +* Trida poskytuje vseobecne funkce pro generovani HTML kodu +* +* Tato trida by nemela sama nic vypisovat (vyjma chybovych a debugovacich hlasek)! +* +* @package HTML +* @author Tomas Mudrunka +*/ +class HTML { + function row($row) { + $html=''; + foreach($row as $var) { + if(trim($var) == '') $var = ' '; + $html.="$var"; + } + $html.=''; + return $html; + } + + function table(&$table, $params='border=1') { + $html=""; + $header=true; + foreach($table as $row) { + if($header) { + $html.=$this->row(array_keys($row)); + $header=false; + } + $html.=$this->row($row); + } + $html.='
'; + return $html; + } + + function link($title='n/a', $link='#void', $internal=true) { + if($internal) $link = $this->internal_url($link); + return "$title"; + } + + function img($src='#void', $title='img') { + return "$title"; + } + + function input($name=false, $value=false, $type='text', $placeholder=false, $options=false) { + $html = "'); print_r($selectbox); + $html = ""; + return $html; + } +} + /** * Trida poskytuje podpurne funkce pro generovani HTML kodu specificke pro sklad * @@ -29,7 +98,7 @@ require_once('HTTP_Auth.class.php'); * @package Sklad_HTML * @author Tomas Mudrunka */ -class Sklad_HTML { +class Sklad_HTML extends HTML { function header($title='') { $home = URL_HOME; $script = $_SERVER['SCRIPT_NAME']; @@ -117,43 +186,10 @@ class Sklad_HTML { EOF; } - function row($row) { - $html=''; - foreach($row as $var) { - if(trim($var) == '') $var = ' '; - $html.="$var"; - } - $html.=''; - return $html; - } - - function table(&$table, $params='border=1') { - $html=""; - $header=true; - foreach($table as $row) { - if($header) { - $html.=$this->row(array_keys($row)); - $header=false; - } - $html.=$this->row($row); - } - $html.='
'; - return $html; - } - function internal_url($link) { return $_SERVER['SCRIPT_NAME'].'/'.$link; } - function link($title='n/a', $link='#void', $internal=true) { - if($internal) $link = $this->internal_url($link); - return "$title"; - } - - function img($src='#void', $title='img') { - return "$title"; - } - function table_add_images(&$table) { $image = array('model_id'); foreach($table as $id => $row) { @@ -206,32 +242,6 @@ EOF; return $this->table($table); } - function input($name=false, $value=false, $type='text', $placeholder=false, $options=false) { - $html = "'); print_r($selectbox); - $html = ""; - return $html; - } - function render_insert_form($class, $columns, $selectbox=array(), $current=false, $multi_insert=true) { //echo('
'); print_r($selectbox);
 		//echo('
'); print_r($current);
@@ -491,6 +501,16 @@ class Sklad_DB extends PDO {
 	}
 }
 
+/**
+* Trida poskytuje high-level rozhrani k databazi skladu
+*
+* @package  Sklad_DB_Abstract
+* @author   Tomas Mudrunka
+*/
+class Sklad_DB_Abstract extends Sklad_DB {
+	//TODO Code
+}
+
 /**
 * Trida implementuje uzivatelske rozhrani skladu
 *
-- 
2.30.2