
Public Member Functions | |
| getRequestData () | |
| checkPermission () | |
| listTask () | |
| newTask () | |
| editTask () | |
| saveTask () | |
| applyTask () | |
| removeTask () | |
| cancelTask () | |
Protected Member Functions | |
| setID ($id) | |
| getID () | |
| clearID () | |
| commonSave () | |
Protected Attributes | |
| $cid = array() | |
| $id = 0 | |
Static Protected Attributes | |
| static | $instance = null |
Definition at line 3 of file aliroDBUpdateController.php.
| aliroDBUpdateController::getRequestData | ( | ) |
Definition at line 9 of file aliroDBUpdateController.php.
References $_REQUEST, and aliroFriendlyBase::getParam().
00009 { 00010 $this->cid = $this->getParam($_REQUEST, 'cid', array()); 00011 $this->id = $this->getParam($_REQUEST, 'id', 0); 00012 if (!$this->id AND isset($this->cid[0])) $this->id = intval($this->cid[0]); 00013 }
| aliroDBUpdateController::checkPermission | ( | ) |
| aliroDBUpdateController::setID | ( | $ | id | ) | [protected] |
Definition at line 19 of file aliroDBUpdateController.php.
References $id.
Referenced by commonSave(), and editTask().
| aliroDBUpdateController::getID | ( | ) | [protected] |
Definition at line 23 of file aliroDBUpdateController.php.
Referenced by commonSave().
00023 { 00024 if (isset($_SESSION[$this->session_var])) return $_SESSION[$this->session_var]; 00025 else return 0; 00026 }
| aliroDBUpdateController::clearID | ( | ) | [protected] |
Definition at line 28 of file aliroDBUpdateController.php.
Referenced by cancelTask(), newTask(), and saveTask().
00028 { 00029 if (isset($_SESSION[$this->session_var])) unset ($_SESSION[$this->session_var]); 00030 }
| aliroDBUpdateController::listTask | ( | ) |
Definition at line 32 of file aliroDBUpdateController.php.
References aliroComponentControllers::makePageNav().
00032 { 00033 $database = call_user_func(array($this->DBname, 'getInstance')); 00034 $query = "SELECT %s FROM $this->table_name"; 00035 if (isset($this->limit_list)) $query .= ' WHERE '.$this->limit_list; 00036 $database->setQuery(sprintf($query, 'COUNT(id)')); 00037 $total = $database->loadResult(); 00038 $this->makePageNav($total); 00039 if ($total) { 00040 $limiter = " LIMIT {$this->pageNav->limitstart}, {$this->pageNav->limit}"; 00041 $database->setQuery(sprintf($query,'*').$limiter); 00042 $rows = $database->loadObjectList(); 00043 } 00044 else $rows = array(); 00045 $view = new $this->view_class ($this); 00046 $view->view($rows); 00047 }
| aliroDBUpdateController::newTask | ( | ) |
Definition at line 49 of file aliroDBUpdateController.php.
References aliroComponentAdminControllers::checkExclusion(), and clearID().
00049 { 00050 if ($this->checkExclusion('new')) return; 00051 $this->clearID(); 00052 $view = new $this->view_class ($this); 00053 $view->newclass(); 00054 }
| aliroDBUpdateController::editTask | ( | ) |
Definition at line 56 of file aliroDBUpdateController.php.
References aliroComponentAdminControllers::checkExclusion(), setID(), and T_().
00056 { 00057 if ($this->checkExclusion('edit')) return; 00058 if ($this->id) { 00059 $this->setID($this->id); 00060 $database = call_user_func(array($this->DBname, 'getInstance')); 00061 $database->setQuery("SELECT * FROM $this->table_name WHERE id=$this->id"); 00062 $database->loadObject($classdocs); 00063 $view = new $this->view_class ($this); 00064 $view->editclass($classdocs); 00065 } 00066 else $this->setErrorMessage(T_('No item was selected for editing')); 00067 }
| aliroDBUpdateController::saveTask | ( | ) |
Definition at line 69 of file aliroDBUpdateController.php.
References aliroComponentAdminControllers::checkExclusion(), clearID(), commonSave(), and aliroFriendlyBase::redirect().
00069 { 00070 if ($this->checkExclusion('save')) return; 00071 $this->commonSave(); 00072 $this->clearID(); 00073 $this->redirect($this->optionurl); 00074 }
| aliroDBUpdateController::applyTask | ( | ) |
Definition at line 76 of file aliroDBUpdateController.php.
References aliroComponentAdminControllers::checkExclusion(), commonSave(), and aliroFriendlyBase::redirect().
00076 { 00077 if ($this->checkExclusion('apply')) return; 00078 $this->commonSave(); 00079 $this->redirect($this->optionurl.'&task=edit&id='.$this->getID()); 00080 }
| aliroDBUpdateController::commonSave | ( | ) | [protected] |
Definition at line 82 of file aliroDBUpdateController.php.
References $id, aliroComponentAdminControllers::basicInsert(), aliroComponentAdminControllers::basicUpdate(), getID(), and setID().
Referenced by applyTask(), and saveTask().
00082 { 00083 $id = $this->getID(); 00084 if ($id) $this->basicUpdate($this->table_name, 'id', $id); 00085 else { 00086 $newid = $this->basicInsert($this->table_name); 00087 $this->setID($newid); 00088 } 00089 }
| aliroDBUpdateController::removeTask | ( | ) |
Definition at line 91 of file aliroDBUpdateController.php.
References $id, aliroComponentAdminControllers::checkExclusion(), aliroFriendlyBase::redirect(), and T_().
00091 { 00092 if ($this->checkExclusion('remove')) return; 00093 if (count($this->cid)) { 00094 foreach ($this->cid as &$id) $id = intval($id); 00095 $idlist = implode(',', $this->cid); 00096 $database = call_user_func(array($this->DBname, 'getInstance')); 00097 $database->doSQL("DELETE FROM $this->table_name WHERE id IN ($idlist)"); 00098 $this->setErrorMessage(T_('Deletion completed'), _ALIRO_ERROR_INFORM); 00099 } 00100 else $this->setErrorMessage(T_('No items for deletion'), _ALIRO_ERROR_WARN); 00101 $this->redirect($this->optionurl); 00102 }
| aliroDBUpdateController::cancelTask | ( | ) |
Definition at line 104 of file aliroDBUpdateController.php.
References clearID(), and aliroFriendlyBase::redirect().
aliroDBUpdateController::$instance = null [static, protected] |
Definition at line 5 of file aliroDBUpdateController.php.
aliroDBUpdateController::$cid = array() [protected] |
Reimplemented from aliroComponentAdminControllers.
Definition at line 6 of file aliroDBUpdateController.php.
aliroDBUpdateController::$id = 0 [protected] |
Definition at line 7 of file aliroDBUpdateController.php.
Referenced by commonSave(), removeTask(), and setID().
1.5.5