function restore() { $target_id = $this->getData('id'); if (!$target_id) { return false; } require_once 'AMP/Content/Template.inc.php'; $template = new AMPContent_Template($this->dbcon, $target_id); $template->save_version(); $template->mergeData($this->getData()); $result = $template->save(); if (!$result) { return false; } AMP_flush_common_cache(); $flash =& AMP_System_Flash::instance(); $flash->add_message(sprintf(AMP_TEXT_DATA_RESTORE_SUCCESS, $this->getName())); ampredirect(AMP_url_update(AMP_SYSTEM_URL_TEMPLATE, array('id' => $target_id))); return $result; }
if ($cached_output = AMP_cached_request()) { print $cached_output; exit; } $intro_id = isset($_GET['intro_id']) && $_GET['intro_id'] ? intval($_GET['intro_id']) : false; $position = isset($_GET['position']) && $_GET['position'] ? $_GET['position'] : false; $format = isset($_GET['format']) && $_GET['format'] ? $_GET['format'] : false; if (!$position) { trigger_error('no position requested for ' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']); exit; } require_once 'AMP/BaseTemplate.php'; $current_page =& AMPContent_Page::instance(); require_once 'AMP/Content/Template.inc.php'; require_once 'AMP/Content/Nav/Manager.inc.php'; $template = new AMPContent_Template(AMP_Registry::getDbcon(), $current_page->getTemplateId()); if (!$template->hasData()) { return false; } $header =& AMP_get_header(); $standard_js = $header->_HTML_javaScripts(); $template->setPage($current_page); $template->globalizeNavLayout(); $nav_manager = new NavigationManager($template, $current_page); $nav_output = $nav_manager->output(strtoupper(substr($position, 0, 1))); $new_js = $header->_HTML_javascripts(); $nav_js = array_diff(split("\n", $new_js), split("\n", $standard_js)); $nav_output = $nav_output . join("\n", $nav_js); /* $url = AMP_SITE_URL;
/** * set the Template for use on the current page * * @param integer $template_id The database id of the Template to use * @access public * @since 3.5.3 * @return void */ function setTemplate($template_id) { require_once 'AMP/Content/Template.inc.php'; $template = new AMPContent_Template($this->_page->dbcon, $template_id); if (!$template->hasData()) { return false; } $template->setPage($this->_page); $this->_template =& $template; $template->globalizeNavLayout(); }
function getCurrentValue($template_id, $fieldname) { require_once 'AMP/Content/Template.inc.php'; $template = new AMPContent_Template(AMP_Registry::getDbcon(), $template_id); return $template->getData($fieldname); }