public function getParent($id = 0) { $page = new Pagdivspage(); if ($parent = $page->getParent($id)) { return $parent; } else { $news = new Pagdivsnews(); if ($parent = $news->getParent($id)) { return $parent; } } return null; }
/** * Rollback a DIV from the DB * * @return void */ public function rollbackdivAction() { $request = $this->getRequest(); $status = 0; /* * GDE : 27/08/2010 * Get detail for Add trace of current action */ if ($this->eModule == 'pages') { $divs = new Pagdivspage($request->id); $rowPage = $divs->getParent(); $parent_id = $rowPage->get()->id; $oPage = new Pagstructure(); $oPage->saveLastupdateContent($parent_id, false); $module = 'adminpages'; $traceMessage = 'trace.event.rollback_content_page' . ' [' . $rowPage->label . ']'; } else { $divs = new Pagdivsnews($request->id); $rowNews = $divs->getParent(); $parent_id = $rowNews->get()->id; $module = 'adminnews'; $traceMessage = 'trace.event.rollback_content_news' . ' [' . $rowNews->shortdesc . ']'; } // */ 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)) { $divd = $divs->update(array('content_draft' => '', 'params_draft' => '', 'status' => 'published'), 'id = ' . $request->id); $msg = 'Element updated.'; $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 $divd = $divs->update(array('content_draft' => '', 'params_draft' => '', 'status' => 'published'), 'id = ' . $request->id); $msg = 'Element updated.'; $status = 1; } if ($status == 1) { /* * GDE : 27/08/2010 * Add trace of current action */ Sydney_Db_Trace::add($traceMessage, $module, Sydney_Tools::getTableName($divs), 'restorecontent', $request->id, $parent_id); // */ } $this->view->ResultSet = array('message' => $msg, 'status' => $status, 'dbid' => $request->id, 'modal' => false); }