Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //----------------------------------------------
- // interfaces
- //----------------------------------------------
- interface IInjectable {
- public function __construct($injector);
- }
- interface IDebug {
- public function reset();
- public function errorHandler($number, $message, $file, $line);
- public function exceptionHandler($exception);
- public function shutdownHandler();
- public function writeInfo($info, $className, $method);
- public function debugMode($mode);
- }
- interface IDBConn {
- public function connect();
- public function set($DB_HOST, $DB_USER, $DB_PASSWORD, $DB_NAME);
- public function get();
- }
- interface IDecorator {
- public function setup($view);
- }
- interface IForm {
- }
- interface IDBModel {
- public function getTableName($tabname);
- public function getRecordById($id);
- public function getNRecords($start, $num);
- public function getNumRecs();
- public function insertRecord($values);
- public function updateRecord($id, $values);
- public function deleteRecord($id);
- public function setup($model);
- }
- interface IController {
- public function dispatch();
- public function render($retblocks=true, $tmpl='');
- }
- interface IModel {
- public function getSingle($record_id);
- public function getPage($page_id=0);
- public function getNumPages();
- public function insertItem();
- public function updateItem($id);
- public function deleteItem($id);
- }
- interface IView {
- public function setup($controllerName, $action, $routes);
- public function render($retblocks, $tmpl );
- }
- //----------------------------------------------
- // base classes
- //----------------------------------------------
- class Injector {
- private $_instances = array();
- public function set($instance) {
- array_push($this->_instances, $instance);
- }
- public function get($interface) {
- foreach ($this->_instances as $instance) {
- $className = get_class($instance);
- $refl = new ReflectionClass($className);
- if ($refl->implementsInterface($interface))
- return $instance;
- }
- }
- }
- //----------------------------------------------
- // Controller
- //----------------------------------------------
- abstract class Controller implements IController {
- private $_debug;
- protected $_model;
- protected $_view;
- protected $_routes;
- protected $_controller_name;
- protected $_action_name;
- protected $_params=array();
- //---------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- $this->_debug->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
- protected function declareParams() {
- $this->_params[$this->_model->_idfield] = '';
- $this->_params['dbkey'] = $this->_model->_idfield;
- $this->_params['filter'.$this->_controller_name] = '';
- }
- //--------------------------------get parameters
- private function getParams() {
- $this->getSessionParams();
- $this->getInputParams();
- $this->_model->_filterstr = $this->_params['filter'.$this->_controller_name];
- }
- //---------------------------------------init
- public function __construct($injector, $controllerName, $action) {
- $this->_debug = $injector->get('IDebug');
- $this->_controller_name = $controllerName;
- $this->_action_name = $action;
- $this->_model = $injector->get('IModel');
- $this->_view = $injector->get('IView');
- $func = create_function('$a',' return str_replace("[dbkey]","'.$this->_model->_idfield.'", $a);');
- $this->_routes = array_map ($func, $this->_routes );
- $this->_view ->setup($controllerName, $action, $this->_routes);
- //-----------------params
- $this->declareParams();
- $this->getParams();
- }
- //---------------------------------- properties get handler
- public function __get($name) {
- if (substr($name,0,3)=='p__') {
- $paramName = substr($name,3);
- return $this->get($paramName);
- }
- }
- //-------------------------------- get property
- public function get($name) {
- if (array_key_exists($name, $this->_params))
- return $this->_params[$name];
- else
- return false;
- }
- //---------------------------------- common dispatching operations
- abstract protected function commonDispatch();
- //--------------------------------- 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);
- }
- }
- //---------------------------------- dispatch current action
- public function dispatch() {
- $this->commonDispatch();
- //$this->_w($this->_action,__METHOD__);
- if ((int)method_exists($this, $this->_action_name)) {
- call_user_func (array($this, $this->_action_name));
- }
- }
- //-------------------------------------- render view
- public function render($retblocks=true, $tmpl='') {
- return $this->_view->render($retblocks, $tmpl);
- }
- }
- //----------------------------------------------
- // form input
- //----------------------------------------------
- class stdInput {
- private $_type;
- public $_name;
- private $_value;
- private $_values = array();
- private $_label = '';
- private $_labels = array();
- private $_group_caption;
- private $_handlers = array();
- //-------------------------------- constructor
- public function __construct($type, $name, $value, $label='', $group_caption='') {
- $this->_type = $type;
- $this->_name = $name;
- $this->_group_caption = $group_caption;
- //------------------------- values
- $this->setValue($value);
- //------------------------- labels
- if (is_array($label)) {
- for ($i=0; $i<count($label); $i++) {
- $this->_labels[] = $label[$i];
- }
- } else {
- $this->_label = $label;
- }
- }
- //------------------------------------------- set field values
- public function setValue($value) {
- //-------------------- checkboxes and radiogroups
- if (is_array($value)) {
- $this->_values = array();
- 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;
- }
- }
- //------------------------------------------- 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':
- $s .= "<label for=\"{$this->_name}\">{$this->_group_caption}</label>";
- for ($i=0; $i<count($this->_values); $i++) {
- //$checked = ($this->_values[$i]['checked']) ? 'checked' : '';
- $checked = ($this->_values[$i]['value']==$this->_value) ? '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 .= "<label for=\"{$this->_name}\">{$this->_group_caption}</label>";
- $s .= "<select $handlers_str name=\"{$this->_name}\">";
- for ($i=0; $i<count($this->_values); $i++) {
- $selected = ($this->_values[$i]['value']==$this->_value) ? 'selected' : '';
- $s .= "<option value=\"{$this->_values[$i]['value']}\" $selected >";
- $s .= $this->_labels[$i].'</option>';
- }
- $s .= '</select><br/>';
- break;
- }
- return $s;
- }
- }
- //----------------------------------------------
- // form fieldset
- //----------------------------------------------
- class stdFieldset {
- public $fields = array();
- private $legend;
- //------------------------------------ constructor
- public function __construct($legend) {
- $this->legend = $legend;
- }
- //------------------------------
- public function hasField($name) {
- for ($i=0; $i<count($this->fields); $i++) {
- if ($this->fields[$i]->_name == $name)
- return true;
- }
- return false;
- }
- //------------------------------
- public function getField($name) {
- for ($i=0; $i<count($this->fields); $i++) {
- if ($this->fields[$i]->_name == $name)
- return $this->fields[$i];
- }
- return false;
- }
- //------------------------------ add field
- public function addField($type, $name, $value, $label, $group_caption='') {
- $a = new stdInput ($type, $name, $value, $label, $group_caption);
- $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 implements IForm {
- private $_debug;
- public $_model;
- private $_action_route;
- protected $scripts = array();
- private $fieldsets = array();
- private $hidden_fields = array();
- private $buttons = array();
- //------------------------- debug information
- protected function _w($info, $method) {
- $className = get_class($this);
- $this->_debug->writeInfo($info, $className, $method);
- }
- //------------------------- check if empty
- public function nzz($var, $default) {
- return (isset($var)) ? $var : $default;
- }
- //------------------------- constructor
- public function __construct($injector ) {
- $this->_debug = $injector->get('IDebug');
- $this->_model = $injector->get('IModel');
- }
- //-------------------------- setup field values
- public function set_field_values($flds) {
- foreach ($flds as $name=>$value) {
- foreach ($this->fieldsets as $key=>$fieldset) {
- if ($fieldset->hasField($name))
- $this->fieldsets[$key]->getField($name)->setValue($value);
- }
- for ($i=0; $i<count($this->hidden_fields); $i++) {
- if ($this->hidden_fields[$i]->_name == $name)
- $this->hidden_fields[$i]->setValue($value);
- }
- for ($i=0; $i<count($this->buttons); $i++) {
- if ($this->buttons[$i]->_name == $name)
- $this->buttons[$i]->setValue($value);
- }
- }
- }
- //-------------------------- set form action route
- public function set_action_route ($action_route) {
- $this->_action_route = $action_route;
- }
- //---------------------------set form submit script
- public function set_submit_action ($onsubmit="") {
- 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 implements IView, IInjectable {
- private $_debug;
- protected $_decorator;
- public $_form;
- protected $variables = array();
- protected $_controller_name;
- protected $_action_name;
- 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);
- $this->_debug->writeInfo($info, $className, $method);
- }
- //------------------------- constructor
- public function __construct($injector) {
- $this->_debug = $injector->get('IDebug');
- $this->_decorator = $injector->get('IDecorator');
- $this->_decorator->setup($this);
- $this->_form = $injector->get('IForm');
- }
- //------------------------- transfer information from controller
- public function setup($controllerName, $action, $routes) {
- $this->_controller_name = $controllerName;
- $this->_action_name = $action;
- $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_name.'&'.$route;
- }
- //------------------------- set variables
- public function set($name, $value) {
- $this->variables[$name] = $value;
- }
- //------------------------- get variables
- public 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 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 ) {
- if (method_exists($this, $this->_action_name))
- call_user_func(array($this, $this->_action_name));
- $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);
- }
- }
- //----------------------------------------------
- // Model
- //----------------------------------------------
- abstract class Model implements IModel, IInjectable {
- private $_db_model;
- public $_table='';
- public $_idfield='';
- public $_orderstr='';
- public $_filterstr='';
- public $fields = array(); // fn, ft, fc
- protected $_postvars = array();
- private $_autovars = array();
- public $rec_per_page=50;
- //-------------------------------- 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($injector) {
- $this->_db_model = $injector->get('IDBModel');
- $this->_table = $this->_db_model->getTableName($this->_table);
- $this->_db_model->setup($this);
- }
- //-------------------------------- 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->_db_model->getRecordById($record_id);
- }
- //-------------------------------- get page
- public function getPage($page_id=0) {
- if (!is_numeric($page_id))
- $page_id = 0;
- return $this->_db_model->getNRecords($page_id * $this->rec_per_page, $this->rec_per_page);
- }
- //-------------------------------- get number of pages
- public function getNumPages() {
- $nrecs = $this->_db_model->getNumRecs();
- return (ceil($nrecs/$this->rec_per_page));
- }
- //-------------------------------- insert item
- public function insertItem() {
- return $this->_db_model->insertRecord($this->prepareInfo());
- }
- //-------------------------------- update item
- public function updateItem($id) {
- return $this->_db_model->updateRecord($id, $this->prepareInfo());
- }
- //-------------------------------- delete item
- public function deleteItem($id) {
- return $this->_db_model->deleteRecord($id);
- }
- }
- //----------------------------------------------
- // Form connected to model
- //----------------------------------------------
- class ModelForm extends stdForm {
- public function __construct($injector) {
- parent::__construct( $injector);
- $fset = $this->addFieldset('');
- foreach ($this->_model->fields as $fld) {
- if (array_key_exists($fld['fn'], $this->_model->_postvars)) {
- if (isset($fld['fl'])) {
- $fset->addField('SELECT',$fld['fn'],$fld['fl'],$fld['fc'], $fld['fs']);
- } else
- if ($fld['fc']=='hidden')
- $this->addHidden($fld['fn'],'');
- else
- $fset->addField('TEXT', $fld['fn'], '', $fld['fc']);
- }
- }
- }
- }
- //----------------------------------------------
- // Easy form draft
- //----------------------------------------------
- class EasyForm extends ModelForm {
- public function __construct($injector) {
- parent::__construct( $injector);
- $submit_action = array ('return check_form(this);',
- "\r\n".'function check_form(f) {
- for (var i=0; i<f.elements.length; i++) {
- if ((f.elements[i].type.toUpperCase()=="TEXT") && (f.elements[i].value=="")) {
- alert(f.elements[i].name+" should be filled");
- return false;}
- } return true;}'."\r\n");
- $this->set_submit_action($submit_action);
- $cancel_script = array ('back_to_list();',
- 'function back_to_list() {window.location.assign("%zzz%");}');
- $this->addButton('SUBMIT','submit', 'post');
- $this->addButton('BUTTON','cancel', 'cancel', $cancel_script);
- }
- //------------------------------
- public function setCancelRoute($route) {
- $inf = $this->scripts['cancel']['script'];
- $inf = str_replace('%zzz%',$route, $inf);
- $this->scripts['cancel']['script']= $inf;
- $this->addHidden('cancelroute',$route);
- }
- }
- //-------------------------------------------------
- // Easy controller draft
- //-------------------------------------------------
- class EasyController extends Controller {
- protected $_routes = array (
- 'add_form' => 'action4=add_form',
- 'insert' => 'action4=insert',
- 'edit_form' => 'action4=edit_form&[dbkey]=%d',
- 'update' => 'action4=update&[dbkey]=%d',
- 'delete_form' => 'action4=delete_form&[dbkey]=%d',
- 'delete' => 'action4=delete&[dbkey]=%d',
- 'view_single' => 'action4=view_single&[dbkey]=%d',
- 'view_page' => 'action4=view_page&pageid=%d');
- //----------------------------------- declare params
- protected function declareParams() {
- parent::declareParams();
- $this->_params['pageid']='';
- }
- //----------------------------------- common dispatch
- protected function commonDispatch() {
- $this->set('nav_numpages', $this->_model->getNumPages());
- $this->set('nav_pageid', $this->p__pageid);
- $this->set('nav_id', $this->get($this->p__dbkey));
- }
- //--------------------------------------------
- private function set_current_page() {
- $els = $this->_model->getPage($this->p__pageid);
- $this->set('items',$els);
- }
- //--------------------------------------------
- private function set_single_page() {
- $el = $this->_model->getSingle($this->get($this->p__dbkey));
- $this->setAll($el);
- }
- //--------------------------------- draw single record
- public function view_single() {
- $this->set_single_page();
- }
- //-------------------------------- draw page
- public function view_page() {
- $this->set_current_page();
- }
- //-------------------------------- insert record
- public function insert() {
- $inf = $this->_model->insertItem();
- $this->set('message', $inf['message']);
- $this->set('newrecord_id', $inf['rid']);
- $this->set('nav_numpages', $this->_model->getNumPages());
- $this->set_current_page();
- }
- //-------------------------------- draw edit form
- public function edit_form() {
- $this->set_single_page();
- }
- //-------------------------------- update record
- public function update() {
- $this->set('message',$this->_model->updateItem($this->get($this->p__dbkey)));
- $this->set_current_page();
- }
- //-------------------------------- delete form
- public function delete_form() {
- $this->set('message', 'really delete record ?');//.$this->get($this->p__dbkey).' ?');
- }
- //-------------------------------- delete record
- public function delete() {
- $this->set('message',$this->_model->deleteItem($this->get($this->p__dbkey)));
- $this->set('nav_numpages', $this->_model->getNumPages());
- $this->set_current_page();
- }
- }
- //----------------------------------------------
- // Easy view draft
- //----------------------------------------------
- class EasyView extends View {
- //---------------------------- put content into blocks
- protected function renderBlocks() {
- $this->_blocks['header'] = $this->_decorator->getHeader();
- $this->_blocks['content'] = $this->_decorator->getContent();
- $this->_blocks['footer'] = $this->_decorator->getFooter();
- }
- //-------------------------------------------
- // action handlers
- //-------------------------------------------
- //--------------------------- show single record
- public function view_single() {
- $this->_decorator->_drawSingle();
- $this->_decorator->_drawEditPanel();
- }
- //--------------------------- show page
- public function view_page() {
- $this->_decorator->_drawPageEditNav();
- }
- //---------------------------- show add form
- public function add_form() {
- $this->_decorator->_drawForm('add');
- }
- //---------------------------- show insert record result
- public function insert() {
- /*$this->_decorator->setMessage( $this->v_message.
- '<br/><a href="'.$this->route_view_single($this->v_newrecord_id).'">view record</a>');*/
- $this->_decorator->_drawPageEditNav();
- }
- //---------------------------- show edit form
- public function edit_form() {
- $this->_decorator->_drawForm('edit');
- }
- //---------------------------- show update record result
- public function update() {
- /*$this->_decorator->setMessage($this->v_message);*/
- $this->_decorator->_drawPageEditNav();
- }
- //---------------------------- show delete form
- public function delete_form() {
- $this->_decorator->setMessage($this->v_message.'<br/>'.
- '<a href="'.$this->route_delete($this->v_nav_id).'">delete</a><br/>'.
- '<a href="'.$this->route_view_page($this->v_nav_pageid).'">cancel</a>');
- }
- //---------------------------- show delete record result
- public function delete() {
- /*$this->_decorator->setMessage($this->v_message);*/
- $this->_decorator->_drawPageEditNav();
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement