Пример #1
0
 /**
  * 
  * Delete a record by ID; asks for confirmation before actually deleting.
  * 
  * @param int $id The record ID.
  * 
  * @return void
  * 
  */
 public function actionDelete($id = null)
 {
     // need an id
     if (!$id) {
         return $this->_error('ERR_NO_ID_SPECIFIED');
     }
     // set the record; does it exist?
     if (!$this->_setItem($id)) {
         return $this->_error('ERR_NO_SUCH_ITEM');
     }
     // is the user allowed access?
     if (!$this->_isUserAllowed()) {
         return;
     }
     // process: delete confirm
     if ($this->_isProcess('delete_confirm')) {
         // delete it
         $this->item->delete();
         // redirect to browse
         $this->_redirectNoCache("/{$this->_controller}");
     }
     // turn off http caching
     $this->_response->setNoCache();
 }