Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //----------------------------------------------
- // base classes
- //----------------------------------------------
- class DBConn {
- private static $_db=0;
- private static $DB_HOST;
- private static $DB_USER;
- private static $DB_PASSWORD;
- private static $DB_NAME;
- //----------------------------------
- public static function connect() {
- self::$_db = @new mysqli (self::$DB_HOST, self::$DB_USER, self::$DB_PASSWORD, self::$DB_NAME );
- if (self::$_db->connect_errno) {
- throw new Exception('connection error '.self::$_db->connect_error);
- }
- }
- //----------------------------------
- public static function set($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME) {
- self::$DB_HOST = $DB_HOST;
- self::$DB_USER = $DB_USER;
- self::$DB_PASSWORD = $DB_PASSWORD;
- self::$DB_NAME = $DB_NAME;
- }
- //----------------------------------
- public static function get() {
- if (self::$_db==0) {
- self::connect();
- }
- return self::$_db;
- }
- }
- //----------------------------------------------
- // Debugger
- //----------------------------------------------
- class Debugger {
- private static $_prepared = false;
- private static $_debugFile ='';
- private static $_buffer ='';
- //---------------------------------
- private static function isDebugFile() {
- return (bool)self::$_debugFile;
- }
- //---------------------------------
- private static function prepared() {
- if (self::$_prepared)
- return true;
- if (isset($_SESSION['debug_prepared'])) {
- if (isset($_SESSION['debug_file']))
- self::$_debugFile = $_SESSION['debug_file'];
- self::$_prepared = true;
- return true;
- }
- return false;
- }
- //-------------------------------------------------save session variable
- private static function save_to_session($name,$value) {
- if (function_exists('session_status')) {
- if (session_status()==PHP_SESSION_ACTIVE)
- $_SESSION[$name] = $value;
- }
- else
- if (session_id()!=='')
- $_SESSION[$name] = $value;
- }
- //--------------------------------- reset debugger
- public static function reset() {
- if (isset($_SESSION['debug_prepared']))
- unset ($_SESSION['debug_prepared']);
- if (isset($_SESSION['debug_file']))
- unset ($_SESSION['debug_file']);
- self::$_debugFile = '';
- self::$_prepared = false;
- }
- //--------------------------------- prepare file
- private static function prepare_file() {
- if (!file_exists(ROOT.DS.'logs'))
- mkdir (ROOT.DS.'logs');
- self::$_debugFile = ROOT.DS.'logs'.DS.'debug_'.date('d_m_Y_H_i_s').rand(100,500).'.txt';
- self::save_to_session('debug_file', self::$_debugFile);
- }
- //------------------------------------ output buffer
- private static function outputBuffer() {
- if (self::isDebugFile()) {
- $link = substr(self::$_debugFile, strpos(self::$_debugFile, 'logs'.DS));
- echo 'debug information in file: <a href="'.$link.'">'.$link.'</a>';
- }
- else
- echo '<h2>debug information</h2><div style="font-family:courier new">'.self::$_buffer.'</div>';
- }
- //------------------------------------ error handler
- public static function errorHandler($number, $message, $file, $line) {
- echo '<h2>error occured</h2>';
- echo '<p>'.str_pad('error number: ',30,' ',STR_PAD_RIGHT).$number.'</p>';
- echo '<p>'.str_pad('error message: ',30,' ',STR_PAD_RIGHT).$message.'</p>';
- echo '<p>'.str_pad('error in file: ',30,' ',STR_PAD_RIGHT).$file.'</p>';
- echo '<p>'.str_pad('error in line: ',30,' ',STR_PAD_RIGHT).$line.'</p>';
- self::outputBuffer();
- }
- //----------------------------------- exception handler
- public static function exceptionHandler($exception) {
- echo '<h2>exception occured</h2>';
- echo '<p>'.str_pad('exception code: ',30,' ',STR_PAD_RIGHT).$exception->getCode().'</p>';
- echo '<p>'.str_pad('exception message: ',30).$exception->getMessage().'</p>';
- echo '<p>'.str_pad('exception in file: ',30).$exception->getFile().'</p>';
- echo '<p>'.str_pad('exception in line: ',30).$exception->getLine().'</p>';
- //echo '<h3>exception trace</h3>';
- //echo '<pre>'.print_r($exception->getTrace(),true).'</pre>';
- self::outputBuffer();
- }
- //----------------------------------- shutdown handler
- public static function shutdownHandler() {
- $error = error_get_last();
- echo '<h2>script finished</h2>';
- echo 'error: <pre>'.print_r($error,true).'</pre>';
- self::outputBuffer();
- }
- //--------------------------------- prepare debugger
- public static function prepare() {
- if (!defined('DEBUG_MODE') || (!DEBUG_MODE))
- return;
- if (self::prepared())
- return;
- error_reporting(E_ALL);
- ini_set('display_errors','On');
- set_error_handler (array('Debugger','errorHandler'));
- set_exception_handler (array('Debugger','exceptionHandler'));
- register_shutdown_function (array('Debugger','shutdownHandler'));
- if (defined('DEBUG_FILE') && (DEBUG_FILE==true))
- self::prepare_file();
- self::$_buffer = '';
- self::$_prepared = true;
- self::save_to_session('debug_prepared', self::$_prepared);
- }
- //--------------------------------- handle & write info
- public static function writeInfo($info, $className, $method) {
- if (!defined('DEBUG_MODE') || (!DEBUG_MODE))
- return;
- self::prepare();
- $s = str_repeat('-',50)."\r\n";
- $s .= date('d.m.Y H:i:s').' class: '.$className.' method: '.$method. "\r\n";
- $s .= str_repeat('-',50)."\r\n";
- $inf = array();
- if (!is_array($info)) {
- $inf[] = $info;
- } else
- $inf = $info;
- $s .= '<pre>'.print_r($inf, true).'</pre>';
- if (self::isDebugFile()) {
- if (!file_exists(self::$_debugFile))
- $f = fopen (self::$_debugFile,'w');
- else
- $f = fopen (self::$_debugFile,'a');
- fwrite($f, $s);
- fclose($f);
- }
- self::$_buffer .= nl2br($s);
- }
- }
- //----------------------------------------------
- // Controller
- //----------------------------------------------
- abstract class Controller {
- protected $_model;
- protected $_controller;
- protected $_action;
- protected $_view;
- protected $_routes;
- protected $_params=array();
- //---------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- Debugger::writeInfo($info, $className, $method);
- }
- //---------------------------- collect session and input parameters
- private function getSessionParams() {
- if (!isset($_SESSION))
- return;
- foreach ($_SESSION as $key=>$val) {
- foreach ($this->_params as $pkey=>$pval) {
- if ($key==$pkey) {
- $this->_params[$pkey]=$_SESSION[$key];
- }
- }
- }
- $this->_w( $this->_params, __METHOD__);
- }
- //--------------------------------
- private function getInputParams() {
- foreach ($_REQUEST as $key=>$val) {
- foreach ($this->_params as $pkey=>$pval) {
- if ($key==$pkey) {
- $this->_params[$pkey]=$_REQUEST[$key];
- $_SESSION[$pkey] = $this->_params[$pkey];
- }
- }
- }
- }
- //---------------------------------- get related controllers
- public function related() {
- return array();
- }
- //---------------------------------- declare expected GET parameters
- abstract protected function declareParams();
- //--------------------------------get parameters
- private function getParams() {
- $this->getSessionParams();
- $this->getInputParams();
- }
- //---------------------------------------init
- public function __construct($model, $view, $controller, $action) {
- $this->_controller = $controller;
- $this->_model = $model;
- $this->_action = $action;
- $this->_view = $view;
- $this->$model = new $model;
- $this->_view = new $view($action, $controller, $this->_routes);
- //-----------------params
- $this->declareParams();
- $this->getParams();
- }
- //---------------------------------- properties get handler
- public function __get($name) {
- if (substr($name,0,3)=='p__') {
- $paramName = substr($name,3);
- if (array_key_exists($paramName, $this->_params))
- return $this->_params[$paramName];
- else
- return false;
- }
- }
- //---------------------------------- common dispatching operations
- abstract protected function commonDispatch();
- //---------------------------------- dispatch current action
- public function dispatch() {
- $this->commonDispatch();
- //$this->_w($this->_action,__METHOD__);
- if ((int)method_exists($this, $this->_action)) {
- call_user_func (array($this, $this->_action));
- }
- }
- //--------------------------------- set view variable
- protected function set($name, $value) {
- $this->_view->set($name, $value);
- }
- //--------------------------------- set block of view variables
- protected function setAll($el) {
- foreach ($el as $key=>$value) {
- $this->set($key,$value);
- }
- }
- //-------------------------------------- render view
- function render($retblocks=true, $tmpl='') {
- return $this->_view->render($retblocks, $tmpl);
- }
- }
- //----------------------------------------------
- // form input
- //----------------------------------------------
- class stdInput {
- private $_type;
- private $_name;
- private $_value;
- private $_values = array();
- private $_label = '';
- private $_labels = array();
- private $_handlers = array();
- //-------------------------------- constructor
- public function __construct($type, $name, $value, $label='') {
- $this->_type = $type;
- $this->_name = $name;
- //-------------------- checkboxes and radiogroups
- if (is_array($value)) {
- for ($i=0; $i<count($value); $i++) {
- $el = array();
- if (substr($value[$i], strlen($value[$i])-1,1)=='*') {
- $el['checked']=true;
- $el['value'] = substr($value[$i],0,strlen($value[$i])-1);
- } else {
- $el['checked']=false;
- $el['value'] = $value[$i];
- }
- $this->_values[] = $el;
- }
- } //------- single components ( text / password / button / submit /reset )
- else {
- $this->_value = $value;
- }
- //------------------------- labels
- if (is_array($label)) {
- for ($i=0; $i<count($label); $i++) {
- $this->_labels[] = $label[$i];
- }
- } else {
- $this->_label = $label;
- }
- }
- //------------------------------------------- add handler
- public function addHandler ($handler) {
- $this->_handlers[] = array ('event'=>$handler[0], 'handler'=>$handler[1]);
- }
- //------------------------------ draw input
- public function draw() {
- $s = '';
- $handlers_str = '';
- for ($i=0; $i<count($this->_handlers); $i++) {
- $handlers_str .= $this->_handlers[$i]['event'].'="'.$this->_handlers[$i]['handler'].'" ';
- }
- switch (strtolower($this->_type)) {
- //--------------------------
- case 'text': case 'password': case 'submit':
- case 'reset': case 'button': case 'file': case 'hidden':
- if ($this->_label) {
- $s .= "<label for=\"{$this->_name}\">{$this->_label}</label>";
- }
- $s .= "<input $handlers_str type=\"{$this->_type}\" ".
- "name=\"{$this->_name}\" value=\"{$this->_value}\" />";
- break;
- //--------------------------
- case 'textarea':
- if ($this->_label)
- $s .= "<p>{$this->_label}</p>";
- $s .= "<textarea $handlers_str name=\"{$this->_name}\">{$this->_value}</textarea><br/>";
- break;
- //--------------------------
- case 'radio': case 'checkbox':
- for ($i=0; $i<count($this->_values); $i++) {
- $checked = ($this->_values[$i]['checked']) ? 'checked' : '';
- $s .= "<p><input $handlers_str type=\"{$this->_type}\" ".
- " name=\"{$this->_name}\" value=\"{$this->_values[$i]['value']}\" $checked />";
- $s .= $this->_labels[$i].'</p>';
- }
- break;
- //--------------------------
- case 'select':
- $s = "<select $handlers_str name=\"{$this->_name}\">";
- for ($i=0; $i<count($this->_values); $i++) {
- $selected = ($this->_values[$i]['checked']) ? 'selected' : '';
- $s .= "<option value=\"{$this->_values[$i]['value']}\" $selected >";
- $s .= $this->_labels[$i].'</option>';
- }
- $s .= '</select><br/>';
- break;
- }
- return $s;
- }
- }
- //----------------------------------------------
- // form fieldset
- //----------------------------------------------
- class stdFieldset {
- private $fields = array();
- private $legend;
- //------------------------------------ constructor
- public function __construct($legend) {
- $this->legend = $legend;
- }
- //------------------------------ add field
- public function addField($type, $name, $value, $label) {
- $a = new stdInput ($type, $name, $value, $label);
- $this->fields[] = & $a;
- }
- //------------------------------ draw field
- public function draw() {
- $s = "<fieldset><legend>{$this->legend}</legend>";
- for ($i=0; $i<count($this->fields); $i++)
- $s .= $this->fields[$i]->draw();
- $s .= '</fieldset>';
- return $s;
- }
- }
- //----------------------------------------------
- // Form
- //----------------------------------------------
- class stdForm {
- private $_action_route;
- private $scripts = array();
- private $fieldsets = array();
- private $hidden_fields = array();
- private $buttons = array();
- //------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- Debugger::writeInfo($info, $className, $method);
- }
- //------------------------- check if empty
- public function nzz($var, $default) {
- return (isset($var)) ? $var : $default;
- }
- //------------------------- constructor
- public function __construct($action_route, $onsubmit="") {
- $this->_action_route = $action_route;
- if (is_array($onsubmit)) {
- $this->scripts['onsubmit'] = array ('handler'=>$onsubmit[0], 'script'=>$onsubmit[1]);
- }
- }
- //-------------------------- add fieldset
- public function addFieldset ($legend) {
- $a = new stdFieldset($legend);
- $this->fieldsets[] = & $a;
- return $a;
- }
- //-------------------------- add hidden field
- public function addHidden ($name, $value) {
- $this->hidden_fields[] = new stdInput ('HIDDEN', $name, $value);
- }
- //-------------------------- add button
- public function addButton ($type, $name, $value, $onclick='') {
- if (is_array($onclick)) {
- $this->scripts[$name] = array ('handler'=>$onclick[0], 'script'=>$onclick[1]);
- }
- $a = new stdInput ($type, $name, $value);
- if (is_array($onclick))
- $a->addHandler(array('onclick', $onclick[0]));
- $this->buttons[] = & $a;
- }
- //--------------------------- draw header
- private function drawHeader() {
- $s = '<script type="text/javascript">';
- foreach ($this->scripts as $script) {
- $s .= $script['script'];
- }
- $s .= '</script>';
- $subm = (isset($this->scripts['onsubmit'])) ?
- 'onsubmit="'.$this->scripts['onsubmit']['handler'].'"':'';
- $s .= '<form '.$subm. ' action="'.$this->_action_route.'" method="post" '.
- ' enctype="application/x-www-form-urlencoded" >';
- return $s;
- }
- //--------------------------- draw footer
- private function drawFooter() {
- return '</form>';
- }
- //--------------------------- draw form
- public function draw() {
- $s = '';
- $s .= $this->drawHeader();
- $func = create_function('$a',' echo $a->draw();');
- ob_start();
- array_walk($this->fieldsets, $func);
- array_walk($this->hidden_fields, $func);
- array_walk($this->buttons, $func);
- $s .= ob_get_contents();
- ob_end_clean();
- $s .= $this->drawFooter();
- return $s;
- }
- }
- //----------------------------------------------
- // View
- //----------------------------------------------
- abstract class View {
- protected $variables = array();
- protected $_action;
- protected $_controller;
- protected $_routes;
- protected $_blocks =array('header'=>'','content'=>'','sidebar'=>'','footer'=>'');
- protected $_stdtemplate = '<div id="%viewid%">
- <div class="header">%header%</div>
- <div class="content">%content%</div>
- <div class="sidebar">%sidebar%</div>
- <div class="footer">%footer%</div></div>';
- //---------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- Debugger::writeInfo($info, $className, $method);
- }
- //------------------------- constructor
- public function __construct($action, $controller, $routes) {
- /*$this->_w(array('action'=>$action,
- 'controller'=>$controller, 'routes'=>$routes), __METHOD__ );*/
- $this->_action = $action;
- $this->_controller = $controller;
- $this->_routes = $routes;
- }
- //------------------------- func calls handler
- public function __call($name, $arguments) {
- //$this->_w(array('name'=>$name, 'args'=>$arguments),__METHOD__);
- if (substr($name, 0, 6 )=='route_') {
- $routeName = substr ($name, 6);
- return $this->getRoute($routeName, isset($arguments[0]) ? $arguments[0] :'');
- }
- }
- //----------------------------------- properties get handler
- public function __get($name) {
- if (substr($name,0,2)=='v_') {
- $varName = substr($name, 2);
- return $this->get($varName);
- }
- }
- //------------------------- build routes
- protected function getRoute($s, $param='') {
- $route = $this->_routes[$s];
- //$this->_w(array('routeName'=>$s, 'route'=>$route),__METHOD__);
- if (is_array($param)) {
- $zpar = array();
- foreach ($param as $key=>$value) {
- $zpar[] = & $param[$key];
- }
- array_unshift($zpar, $route);
- $route = call_user_func_array('sprintf', $zpar);
- }
- else
- $route = sprintf($route, $param);
- return $_SERVER["PHP_SELF"].'?controller='.$this->_controller.'&'.$route;
- }
- //------------------------- set variables
- public function set($name, $value) {
- $this->variables[$name] = $value;
- }
- //------------------------- get variables
- protected function get($name) {
- if (array_key_exists($name, $this->variables))
- return $this->variables[$name];
- else
- return false;
- }
- //-------------- common rendering operations and filling blocks
- abstract protected function commonRender();
- abstract protected function renderBlocks();
- //------------------------- output view to template
- private function output($tmpl) {
- if ($tmpl=='')
- $tmpl= $this->_stdtemplate;
- $c = get_class($this);
- $c = strtolower(substr($c, 0, strpos($c,'View')));
- $blocks = array_values($this->_blocks);
- array_unshift($blocks , $c);
- $s = str_replace (array('%viewid%','%header%','%content%','%sidebar%','%footer%'), $blocks, $tmpl);
- return $s;
- }
- //------------------------- render view
- public function render($retblocks, $tmpl ) {
- $this->commonRender();
- if (method_exists($this, $this->_action))
- call_user_func(array($this, $this->_action));
- $this->renderBlocks();
- if ($retblocks) {
- $c = get_class($this);
- $pref = substr($c,0, strpos($c,'View'));
- $prefixf = create_function('$a', 'return "'.$pref.'_".$a;');
- return
- array_combine(
- array_map($prefixf, array_keys($this->_blocks)),
- array_values($this->_blocks));
- }
- else
- return $this->output($tmpl);
- }
- }
- //----------------------------------------------
- // DBModel
- //----------------------------------------------
- class DBModel {
- protected $_db;
- protected $_table='';
- protected $_idfield='';
- protected $fields = array(); // fn, ft
- protected $filter = '';
- protected $order = '';
- //---------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- Debugger::writeInfo($info, $className, $method);
- }
- //------------------------------ constructor
- protected function __construct() {
- $this->_db = DBConn::get();
- }
- //------------------------------ check errors
- private function checkResult($result, $err, $sql='') {
- if ($result===false)
- throw new Exception ('db error '.$err.'<br/>sql: '.$sql, 30044);
- }
- //------------------------------ get single record from model table
- protected function getRecordById($id) {
- //$stmt = $this->_db->prepare(
- // 'select * from '.$this->_table.' where '.$this->_idfield.'=?');
- //$stmt->bind_param('i', $id);
- $sql = 'select * from '.$this->_table.
- ' where '.$this->_idfield.'='. $this->_db->real_escape_string($id);
- $result = $this->_db->query($sql);
- $this->checkResult($result, $this->_db->error, $sql);
- $row = $result->fetch_array(MYSQLI_ASSOC);
- $result->close();
- return $row;
- }
- //------------------------------ get N records from model table
- protected function getNRecords($start, $num) {
- $sql = 'select * from '.$this->_table.' '.$this->filter.' '.$this->order;
- $result = $this->_db->query($sql);
- $this->checkResult($result, $this->_db->error, $sql);
- $result->data_seek($start);
- $i=0;
- $ret = array();
- while (($row = $result->fetch_assoc()) && ($i<$num)) {
- $ret[] = $row;
- $i++;
- }
- $result->close();
- //$this->_w($ret, __METHOD__);
- return $ret;
- }
- //------------------------------ get number of records in model table
- protected function getNumRecs() {
- $sql = 'select count(*) from '.$this->_table;
- $result = $this->_db->query($sql);
- $this->checkResult($result, $this->_db->error, $sql);
- $inf = $result->fetch_row();
- $result->close();
- return $inf[0];
- }
- //------------------------------ inserting and updating records
- protected function processRecord($type='update',$id,$values) {
- $flds = array();
- $types = array();
- $invars = array();
- $func = create_function ('$a', 'return $a["fn"];');
- $func4 = create_function('$a','return $a."=?";');
- //$this->_w($values,__METHOD__);
- $sarr = array_map($func, $this->fields);
- foreach ($values as $key=>$value) {
- $flds[] = $key;
- $invars[] = & $values[$key];
- $types[] = $this->fields[array_search($key, $sarr)]['ft'];
- }
- //--------------------------
- if ($type=='insert') {
- $flds_s = implode(',',$flds);
- $valpos = implode(',' , array_fill(0, count($flds),'?'));
- } else {
- $fld_s = implode(',' , array_map($func4, $flds));
- }
- //--------------------------
- $types_s = implode('',$types);
- array_unshift($invars, $types_s);
- //---------------------------
- if ($type=='insert')
- $sql = 'insert into '.$this->_table.'('.$flds_s.') values ('.$valpos.')';
- else
- $sql = 'update '.$this->_table.' set '.$fld_s.
- ' where '.$this->_idfield.'='.$this->_db->real_escape_string($id);
- //---------------------------
- $stmt = $this->_db->prepare ($sql);
- call_user_func_array(array($stmt,'bind_param'), $invars);
- $rez = $stmt->execute();
- $this->checkResult($rez, $stmt->error, $sql);
- $rid = ($type=='insert') ? $stmt->insert_id : $stmt->affected_rows ;
- $stmt->close();
- return($rid);
- }
- //-------------------------------------- insert record
- protected function insertRecord($values) {
- $rid = $this->processRecord ('insert', 0, $values);
- return array('message'=>'record successfully inserted. record id: '.$rid, 'rid'=>$rid);
- }
- //-------------------------------------- update record
- protected function updateRecord($id, $values) {
- $affected_rows = $this->processRecord('update', $id, $values);
- return 'record successfully updated. affected rows: '.$affected_rows;
- }
- //--------------------------------------- delete record
- protected function deleteRecord($id) {
- $sql = 'delete from '.$this->_table.' where '.$this->_idfield.'=?';
- $stmt = $this->_db->prepare($sql);
- $stmt->bind_param('i', $id);
- $rez = $stmt->execute();
- $this->checkResult($rez, $stmt->error, $sql);
- $affected_rows = $stmt->affected_rows;
- $stmt->close();
- return ('record successfully deleted. affected rows: '.$affected_rows);
- }
- }
- //----------------------------------------------
- // Model
- //----------------------------------------------
- abstract class Model extends DBModel {
- protected $_postvars = array();
- private $_autovars = array();
- public $rec_per_page=3;
- //-------------------------------- get post vars
- private function getPostVars() {
- foreach ($_POST as $key=>$val) {
- foreach ($this->_postvars as $pkey=>$pval) {
- if ($key==$pkey) {
- $this->_postvars[$pkey] = $val;
- }
- }
- }
- }
- //-------------------------------- set auto vars
- abstract protected function setAutoVars();
- //-------------------------------- prepare to write to database
- private function prepareInfo() {
- $this->getPostVars();
- //$this->_w($this->_postvars,__METHOD__);
- $this->setAutoVars();
- return array_merge($this->_postvars, $this->_autovars);
- }
- //-------------------------------- constructor
- public function __construct() {
- parent::__construct();
- }
- //-------------------------------- set properties handler
- public function __set($name, $value) {
- if (substr($name,0,3)==='a__') {
- $varName = substr($name,3);
- $this->_autovars[$varName] = $value;
- }
- }
- //-------------------------------- get single item
- public function getSingle($record_id) {
- return $this->getRecordById($record_id);
- }
- //-------------------------------- get page
- public function getPage($page_id=0) {
- if (!is_numeric($page_id))
- $page_id = 0;
- return $this->getNRecords($page_id * $this->rec_per_page, $this->rec_per_page);
- }
- //-------------------------------- get number of pages
- public function getNumPages() {
- $nrecs = $this->getNumRecs();
- return (ceil($nrecs/$this->rec_per_page));
- }
- //-------------------------------- insert item
- public function insertItem() {
- return $this->insertRecord($this->prepareInfo());
- }
- //-------------------------------- update item
- public function updateItem($id) {
- return $this->updateRecord($id, $this->prepareInfo());
- }
- //-------------------------------- delete item
- public function deleteItem($id) {
- return $this->deleteRecord($id);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement