Example #1
0
 /**
  * Deletes a DIV from the DB
  *
  * @return void
  */
 public function deletedivAction()
 {
     $divs = new Pagdivspage();
     $request = $this->getRequest();
     $status = 0;
     if (!$request->id) {
         $msg = 'Ok';
         $status = 1;
     } else {
         /*
          * Get detail for Add trace of current action
          */
         if ($this->eModule == 'pages') {
             $orderPageDiv = new Pagdivspage($request->id);
             $rowPage = $orderPageDiv->getParent();
             $parentId = $rowPage->get()->id;
             $orderPage = new Pagstructure();
             $orderPage->saveLastupdateContent($parentId);
             $module = 'adminpages';
             $traceMessage = Sydney_Tools::_('trace.event.delete_content_page') . ' [' . $rowPage->get()->label . ']';
         }
         if ($request->id <= 0) {
             $msg = 'Technical error. The entry ID has an inconcistent value!';
             $status = 0;
         } elseif ($this->eModule == 'pages' && $divs->checkRightFromId($request->id, $this->_config->db->safinstances_id)) {
             $divs->delete('id = ' . $request->id);
             $msg = 'Element deleted.';
             $status = 1;
         } else {
             // @todo TODO : quick fix here to make deletable work for news but we do not check the access rights anymore... it is a problem
             $divs->delete('id = ' . $request->id);
             $msg = 'Element deleted.';
             $status = 1;
         }
         if ($status == 1) {
             /*
              * Add trace of current action
              */
             Sydney_Db_Trace::add($traceMessage, $module, Sydney_Tools::getTableName($divs), 'deletecontent', $request->id, $parentId);
         }
     }
     $this->view->ResultSet = array('message' => $msg, 'status' => $status, 'dbid' => $request->id, 'modal' => false);
 }