Пример #1
0
function nav_articles_by_date()
{
    $page =& AMPContent_Page::instance();
    if ($class = $page->getClassId()) {
        $date_values = AMP_lookup('classArticlesByDate', $class);
    } else {
        $date_values = AMP_lookup('articlesByDate');
    }
    if (!$date_values) {
        return false;
    }
    $output = array();
    $renderer = AMP_get_renderer();
    foreach ($date_values as $pretty_date => $qty) {
        $real_date = strtotime($pretty_date);
        $url['year'] = date('Y', $real_date);
        $url['month'] = date('m', $real_date);
        $url['offset'] = false;
        $url['qty'] = false;
        $new_url = AMP_url_update($_SERVER['REQUEST_URI'], $url);
        $output[] = $renderer->link($new_url, $pretty_date, array('class' => AMP_CONTENT_CSS_CLASS_NAV_LINK));
        if (count($output) == AMP_CONTENT_NAV_ARCHIVE_LIMIT) {
            break;
        }
    }
    return join($renderer->newline(), $output);
}
Пример #2
0
 function execute(&$source)
 {
     $currentPage =& AMPContent_Page::instance();
     switch (true) {
         case $currentPage->isList(AMP_CONTENT_LISTTYPE_SECTION):
             $this->assign();
             $source->addCriteria($this->criteria);
             break;
         default:
     }
 }
Пример #3
0
 function __construct($options = array())
 {
     $this->display_sections = isset($options['display_sections']) && $options['display_sections'] ? $options['display_sections'] : false;
     $this->display_articles = isset($options['display_articles']) && $options['display_articles'] ? $options['display_articles'] : false;
     $this->current_id = AMP_current_section_id();
     $page = AMPContent_Page::instance();
     if ($current_article = $page->getArticle()) {
         $this->current_article_id = $current_article->id;
     }
     $this->map =& AMPContent_Map::instance();
 }
Пример #4
0
function amp_badge_rating_block($options)
{
    $page =& AMPContent_Page::instance();
    $article = $page->getArticle();
    if (!$article) {
        return false;
    }
    $header =& AMP_get_header();
    $header->addJavaScript('/scripts/rating.js', 'ratings');
    $header->addJavaScript('/scripts/ajax/prototype.js', 'prototype');
    $header->addJavascriptOnload("new Ajax.Updater( 'rating', '/badge_widget.php?id=10&cache=0&format=xml&article_id=" . $article->id . "' );", 'ratings_loader');
    $display = new Rating_Public_Display($article);
    return $display->render_block($article);
}
Пример #5
0
 function getDefaultArguments()
 {
     require_once 'AMP/Content/Page.inc.php';
     $page = AMPContent_Page::instance();
     if ($page->getSectionId() != AMP_CONTENT_SECTION_ID_ROOT) {
         $values['section'] = $page->getSectionId();
     }
     $values['class'] = $page->getClassId();
     $values['article'] = $page->getArticleId();
     $values['intro_id'] = $page->getIntroId();
     foreach ($values as $key => $value) {
         if (!$value) {
             unset($values[$key]);
         }
     }
     return $values;
 }
Пример #6
0
 function _init_intro($direct_output = false)
 {
     if ($this->_publicpage_request) {
         require_once 'AMP/Content/Page.inc.php';
         $page = AMPContent_Page::instance();
         $page->setIntroText($this->_publicpage_request);
         $intro =& $page->getIntroText();
         if (!$intro) {
             return false;
         }
         $intro_display = $intro->getDisplay();
         if ($direct_output) {
             return $intro_display->execute();
         } else {
             $this->_display->add($intro_display, AMP_CONTENT_DISPLAY_KEY_INTRO);
         }
     }
 }
Пример #7
0
function amp_badge_articles_by_author($options)
{
    $author = isset($options['author']) && $options['author'] ? $options['author'] : false;
    if (!$author) {
        $page = AMPContent_Page::instance();
        $article = $page->getArticle();
        if (!$article) {
            return false;
        }
        $options['not_id'] = $article->id;
        $author = $article->getAuthor();
        if (!$author) {
            return false;
        }
    }
    unset($options['section']);
    unset($options['class']);
    $options['author'] = $author;
    return amp_badge_articles($options);
}
Пример #8
0
 function render($display)
 {
     $this->_page = AMPContent_Page::instance();
     $this->_page->contentManager->add($display);
 }
Пример #9
0
 function _globalVars()
 {
     $page =& AMPContent_Page::instance();
     $map =& AMPContent_Map::instance();
     return array('base_path' => AMP_BASE_PATH . DIRECTORY_SEPARATOR, 'dbcon' => &$page->dbcon, 'MM_type' => $page->getSectionId(), 'MM_parent' => $map->getParent($page->getSectionId()), 'MM_typename' => $map->getName($page->getSectionId()), 'MM_website_name' => AMP_SITE_NAME, 'Web_url' => AMP_SITE_URL, 'MM_region' => isset($GLOBALS['MM_region']) ? $GLOBALS['MM_region'] : false, 'list' => $page->getLegacyListType(), 'id' => $page->getArticleId()) + $this->nav->template->globalizeNavLayout(true);
 }
Пример #10
0
 function _HTML_listFooter()
 {
     if (!AMP_CONTENT_CLASS_SECTIONFOOTER) {
         return false;
     }
     $footer = false;
     $currentPage =& AMPContent_Page::instance();
     if (!($this->_showListIntro && ($footer =& $this->_section->getFooterRef()))) {
         return false;
     }
     $display =& $footer->getDisplay();
     return $display->execute();
 }
Пример #11
0
 function _page_setup()
 {
     $page = AMPContent_Page::instance();
     $page->setArticle($this->params['id']);
     $page->initLocation();
 }
Пример #12
0
 function _set_public_page(&$public_page)
 {
     if (!$public_page) {
         return;
     }
     $this->_public_page_id = $public_page->id;
     $this->_display->add($public_page->getDisplay(), AMP_CONTENT_DISPLAY_KEY_INTRO);
     $reg =& AMP_Registry::instance();
     $reg->setEntry(AMP_REGISTRY_CONTENT_INTRO_ID, $this->_public_page_id);
     if (!isset($this->_page)) {
         require_once 'AMP/Content/Page.inc.php';
         $this->_page = AMPContent_Page::instance();
     }
     $this->_page->setIntroText($this->_public_page_id);
     $this->_page->initLocation();
 }
Пример #13
0
function AMP_current_section_id()
{
    $page = AMPContent_Page::instance();
    $current_section = $page->getSection();
    if ($current_section) {
        return $current_section->id;
    }
    if ($current_article = $page->getArticle()) {
        return $current_article->getParent();
    }
    if ($current_intro = $page->getIntroText()) {
        return $current_intro->getSection();
    }
    return AMP_CONTENT_SECTION_ID_ROOT;
}
Пример #14
0
 function _getEvalVars()
 {
     if (!($page =& AMPContent_Page::instance())) {
         return array();
     }
     $map =& AMPContent_Map::instance();
     return array('MM_parent' => $map->getParent($page->getSectionId()), 'MM_type' => $page->getSectionId(), 'MM_author' => ($article =& $page->getArticle()) ? $article->getAuthor() : "", 'MM_id' => $page->getArticleId(), 'MX_top' => AMP_CONTENT_MAP_ROOT_SECTION, 'intro_id' => $page->getIntroId());
 }
Пример #15
0
<?php

require_once 'AMP/Base/Config.php';
if ($cached_output = AMP_cached_request()) {
    print $cached_output;
    exit;
}
require_once 'AMP/Content/Article/Public/ComponentMap.inc.php';
require_once 'AMP/Content/Page.inc.php';
$_REQUEST['action'] = 'search';
$page =& AMPContent_Page::instance();
$template_section = isset($_REQUEST['template_section']) && $_REQUEST['template_section'] ? intval($_REQUEST['template_section']) : false;
if (!$template_section) {
    $template_section = isset($_REQUEST['section']) && $_REQUEST['section'] && is_numeric($_REQUEST['section']) ? $_REQUEST['section'] : AMP_CONTENT_SECTION_ID_ROOT;
}
$page->setSection($template_section);
$tag_header = isset($_REQUEST['tag_header']) && $_REQUEST['tag_header'] ? strip_tags($_REQUEST['tag_header']) : false;
$tag = isset($_REQUEST['tag']) && $_REQUEST['tag'] ? $_REQUEST['tag'] : false;
if ($tag_header && $tag) {
    require_once 'AMP/Content/Tag/Public/Search/Description.php';
    $tag_intro = new AMP_Content_Tag_Public_Search_Description($tag);
    $page->contentManager->add($tag_intro, AMP_CONTENT_DISPLAY_KEY_INTRO);
}
$map =& new ComponentMap_Article_Public();
$map->use_prefix('content', 'search_fields');
$list = $map->getComponent('content_list');
//$list = new Article_Public_List();
$list->suppress('search_form');
$page->contentManager->add($list);
require 'AMP/BaseFooter.php';
Пример #16
0
<?php

require_once 'AMP/Base/Config.php';
require_once 'AMP/Content/Map.inc.php';
require_once 'AMP/Content/Page.inc.php';
require_once 'AMP/Content/Article/Comment/Public/ComponentMap.inc.php';
$modid = AMP_MODULE_ID_COMMENTS;
$map =& new ComponentMap_Article_Comment_Public();
$controller =& $map->get_controller();
/**
 *  Initialize the Page
 */
$currentPage =& AMPContent_Page::instance();
$controller->set_page($currentPage);
AMP_directDisplay($controller->execute());
require_once "AMP/BaseFooter.php";
Пример #17
0
 function getSecondLinkValue()
 {
     $result = $this->getData('mcall2');
     if ('typeid' != $result) {
         return $result;
     }
     $currentPage =& AMPContent_Page::instance();
     return $currentPage->getSectionId();
 }
Пример #18
0
function nav_flooret_output()
{
    $page = AMPContent_Page::instance();
    $section_id = $page->getSectionId();
    if (!$section_id) {
        return false;
    }
    return nav_menu_simple($section_id);
}