function &_get_model() { if (isset($this->_model)) { return $this->_model; } $id = $this->getIdValue(); if (!$id) { return false; } require_once 'AMP/Content/Article/Version.inc.php'; $article = new Article_Version(AMP_Registry::getDbcon(), $id); if (!$article->hasData()) { return false; } $this->_model =& $article; return $this->_model; }
function saveVersion() { require_once 'AMP/Content/Article/Version.inc.php'; $version = new Article_Version($this->dbcon); $version->mergeData($this->getData()); return $version->save(); }
function commit_delete_version() { $version_id = $this->assert_var('vid'); if (!$version_id) { return false; } require_once 'AMP/Content/Article/Version.inc.php'; $version = new Article_Version(AMP_Registry::getDbcon(), $version_id); $this->_model_id = $version->getArticleId(); $name = $version->getName(); if (!$name) { $name = AMP_TEXT_ITEM_NAME; } if (!$version->delete()) { if (method_exists($version, 'getErrors')) { $this->error($version->getErrors()); } ampredirect(AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE_VERSION, array('id' => 'id=' . $version_id))); return false; } $this->message(sprintf(AMP_TEXT_DATA_DELETE_VERSION_SUCCESS, $name, $version_id)); ampredirect(AMP_Url_AddVars(AMP_SYSTEM_URL_ARTICLE, array('id' => 'id=' . $this->_model_id))); //$this->commit_edit( ); return true; }