Ejemplo n.º 1
0
 function addCriteriaSectionParent($section_id)
 {
     $map =& AMPContent_Map::instance();
     if (!($subsection_set = $map->getChildren($section_id))) {
         return $this->addCriteria('false');
     }
     return $this->addCriteria("parent in (" . join(", ", $subsection_set) . ")");
 }
Ejemplo n.º 2
0
 /**
  * Returns true if the current page requires users to login before it can be displayed
  *  
  * @access  public
  * @since   3.5.3
  * @return  boolean   true if the page requires a login, false if not
  */
 function requiresLogin()
 {
     if ($result = $this->map->readAncestors($this->getSectionId(), 'secure')) {
         $this->_registry->setEntry(AMP_REGISTRY_CONTENT_SECURE, $result);
         $GLOBALS['MM_secure'] = $result;
         return $result;
     }
     return false;
 }
Ejemplo n.º 3
0
 function loadMap()
 {
     $map = AMPContent_Map::instance();
     $menumap = $map->getMenu();
     if (isset($menumap[$map->top])) {
         $menumap[AMP_MENU_ROOT_ENTRY] = $menumap[$map->top];
     }
     return $menumap;
 }
 function getSectionCriteria()
 {
     //deprecated, use above instead
     $map =& AMPContent_Map::instance();
     if (!($subsection_set = $map->getChildren($this->_section->id))) {
         return 'false';
     }
     return "parent in (" . join(", ", $subsection_set) . ")";
 }
Ejemplo n.º 5
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();
 }
Ejemplo n.º 6
0
 function _init_sectional_script()
 {
     $map = AMPContent_Map::instance();
     $start_group = $map->getChildren(AMP_CONTENT_MAP_ROOT_SECTION);
     $start_group = $map->getAllParents();
     $script_output = '';
     foreach ($start_group as $section_id) {
         if ($section_id == AMP_CONTENT_MAP_ROOT_SECTION) {
             continue;
         }
         $children = $map->getChildren($section_id);
         if (!$children) {
             continue;
         }
         $script_output .= 'document.forms["' . $this->formname . '"].elements["sections[' . $section_id . ']"].onchange=function( ) {' . "\n" . $this->_init_sectional_children($children, $map) . '};' . "\n\n";
     }
     $script_output = 'function init_section_checkbox_cascade( ) { ' . "\n" . $script_output . "\n" . '}';
     $header = AMP_get_header();
     $header->addJavascriptDynamic($script_output, 'section_checkboxes');
     $header->addJavascriptOnload('init_section_checkbox_cascade( );');
 }
Ejemplo n.º 7
0
 function _updateSections()
 {
     $root_section = $this->getData('root_section_id');
     $allowed_base = array();
     if ($root_section && $root_section != AMP_CONTENT_SECTION_ID_ROOT) {
         $map = AMPContent_Map::instance();
         $allowed_by_root = $map->getDescendants($root_section);
         $allowed_base = array_flip($allowed_by_root);
     }
     $allowed_sections = $this->getData('sections');
     if (!$allowed_sections) {
         $allowed_sections = $allowed_base;
     }
     $actual_sections = $this->_readSections();
     $new_section_ids = array_diff(array_keys($allowed_sections), array_keys($actual_sections));
     $new_sections = array_combine_key($new_section_ids, AMP_lookup('sectionMap'));
     $deleted_section_ids = array_diff(array_keys($actual_sections), array_keys($allowed_sections));
     $deleted_sections = array_combine_key($deleted_section_ids, AMP_lookup('sectionMap'));
     if (empty($new_sections) && empty($deleted_sections)) {
         return true;
     }
     //$visible_sections = AMP_lookup( 'sectionMap');
     require_once 'AMP/System/Permission/Item/Item.php';
     foreach ($new_sections as $section_id => $section_name) {
         $item = AMP_System_Permission_Item::create_for_group($this->id, 'access', 'section', $section_id);
         unset($item);
     }
     $permissions_lookup = AMP_lookup('SectionPermissionItemsByGroup', $this->id);
     foreach ($deleted_sections as $section_id => $section_name) {
         if (!$permissions_lookup) {
             continue;
         }
         if (!($permission_item_id = array_search($section_id, $permissions_lookup))) {
             continue;
         }
         $item = new AMP_System_Permission_Item($this->dbcon, $permission_item_id);
         $item->delete();
         unset($item);
     }
 }
Ejemplo n.º 8
0
 function setDynamicValues()
 {
     $map = AMPContent_Map::instance();
     $this->setFieldValueSet('sectionadd', $map->selectOptions());
 }
Ejemplo n.º 9
0
 function trash()
 {
     $section_set = $this->getSearchSource();
     $result = $section_set->updateData(array('parent=' . AMP_CONTENT_SECTION_ID_TRASH), 'id=' . $this->id);
     if (!$result) {
         return false;
     }
     //send a notice about the child sections
     $map = AMPContent_Map::instance();
     $children = $map->getDescendants($this->id);
     $this->trash_contents($this->id);
     if (!empty($children)) {
         foreach ($children as $child_id) {
             $this->trash_contents($child_id);
         }
     }
     $this->notify('trash', $this->id);
     return count($children) + 1;
 }
Ejemplo n.º 10
0
 function _getMap()
 {
     $this->map =& AMPContent_Map::instance();
 }
Ejemplo n.º 11
0
 function Section_List(&$dbcon, $criteria = array())
 {
     $criteria['allowed'] = 1;
     $this->init($this->_init_source($dbcon, $criteria));
     $this->_map =& AMPContent_Map::instance();
 }
Ejemplo n.º 12
0
 function SectionContentSource_ArticlesAggregator(&$section)
 {
     $this->init($section);
     $this->_map =& AMPContent_Map::instance();
 }
Ejemplo n.º 13
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);
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 15
0
 function findNavs_listSection($lookup_name = 'navLayoutsBySectionList')
 {
     $map =& AMPContent_Map::instance();
     $parent_set = $map->getAncestors($this->page->getSectionId());
     if (empty($parent_set)) {
         return $this->findNavs_default();
     }
     $layout_set =& AMPContent_Lookup::instance($lookup_name);
     $layout_id = false;
     if (!$layout_set) {
         return $this->findNavs_default();
     }
     foreach ($parent_set as $section_id => $section_name) {
         if ($layout_id = array_search($section_id, $layout_set)) {
             break;
         }
     }
     if (!$layout_id) {
         return $this->findNavs_default();
     }
     #$target_crit = $target_column . " in (" . join( ', ', array_keys( $parent_set )) . ")" ;
     $locationSet =& new NavigationLocationSet($this->dbcon);
     $locationSet->addCriteriaLayout($layout_id);
     if ($position = $this->_getFindPosition()) {
         $locationSet->addCriteriaPositionPrefix($position);
     }
     $locationSet->readData();
     if (!$locationSet->RecordCount()) {
         return $this->findNavs_default();
     }
     return $locationSet->getArray();
     /*
     foreach( $parent_set as $section_id => $name ) {
         if (!($results = $locationSet->filter( $target_column , $section_id ))) continue;
         return $results;
     }
     
     return $this->findNavs_default();
     */
 }
 function Tiered_Sectional_Nav()
 {
     $this->current_id = AMP_current_section_id();
     $this->map =& AMPContent_Map::instance();
 }
Ejemplo n.º 17
0
 function addCriteriaSectionDescendentRelational($section_id)
 {
     $base_section = $this->_getCriteriaSection($section_id);
     $map =& AMPContent_Map::instance();
     if (!($child_ids = $map->getDescendants($section_id))) {
         return $this->addCriteria($base_section);
     }
     foreach ($child_ids as $child_id) {
         $child_sections[] = $this->_getCriteriaSection($child_id);
     }
     $child_sections_criteria = '( ' . join(') OR ( ', $child_sections) . ')';
     $this->addCriteria("(" . $child_sections_criteria . ' OR ' . $base_section . ")");
 }
Ejemplo n.º 18
0
 /**
  * _initStyleSheets 
  * 
  * @access protected
  * @return void
  */
 function _initStyleSheets()
 {
     $map =& AMPContent_Map::instance();
     if (!($css = $map->readAncestors($this->_page->getSectionId(), 'css'))) {
         $css = $this->_template->getCSS();
     }
     $this->addStyleSheets($css);
     return true;
 }
Ejemplo n.º 19
0
 function hasAncestor($section_id)
 {
     $map = AMPContent_Map::instance();
     $ancestors = $map->getAncestors($this->getParent());
     return isset($ancestors[$section_id]);
 }
Ejemplo n.º 20
0
 function ContentMap_Select()
 {
     $this->map =& AMPContent_Map::instance();
 }
Ejemplo n.º 21
0
function AMP_find_banner_image()
{
    $banner_image = false;
    $currentPage =& AMPContent_Page::instance();
    //if ( $currentPage->isList( AMP_CONTENT_LISTTYPE_SECTION ) || $currentPage->isArticle( )) {
    //  $map = &AMPContent_Map::instance();
    //  $banner_image = $map->readAncestors( $currentPage->getSectionId(), 'flash' );
    //} else
    if ($currentPage->isList(AMP_CONTENT_LISTTYPE_CLASS)) {
        $current_class = $currentPage->getClass();
        $banner_image = $current_class->get_image_banner();
    } elseif ($currentPage->getSectionId()) {
        $map =& AMPContent_Map::instance();
        $banner_image = $map->readAncestors($currentPage->getSectionId(), 'flash');
    }
    return $banner_image;
}
Ejemplo n.º 22
0
 function init()
 {
     parent::init();
     if (empty($this->dataset)) {
         return;
     }
     $map =& AMPContent_Map::instance();
     foreach ($this->dataset as $section_id => $draft) {
         if ($section_id == AMP_CONTENT_SECTION_ID_ROOT) {
             continue;
         }
         if (!($children = $map->getDescendants($section_id))) {
             continue;
         }
         $this->appendChildren($children);
     }
 }
Ejemplo n.º 23
0
 function makeCriteriaInSectionDescendant($section_id)
 {
     $base_section = $this->makeCriteriaSection($section_id);
     $map = AMPContent_Map::instance();
     if (!($child_ids = $map->getDescendants($section_id))) {
         return $base_section;
     }
     foreach ($child_ids as $child_id) {
         $child_sections[] = $this->makeCriteriaSection($child_id);
     }
     $child_sections_criteria = '( ' . join(') OR ( ', $child_sections) . ')';
     return '( ' . $child_sections_criteria . ' OR ' . $base_section . ')';
 }
Ejemplo n.º 24
0
 function _after_init()
 {
     $this->content_map = AMPContent_Map::instance();
 }
Ejemplo n.º 25
0
function nav_sub_listing($section_id)
{
    $map = AMPContent_Map::instance();
    $live_sections = AMP_lookup('sectionsLive');
    $listtype = $map->readSection($section_id, 'listtype');
    $include_articles = !($listtype == AMP_SECTIONLIST_SUBSECTIONS);
    $include_subsections = !($listtype == AMP_SECTIONLIST_ARTICLES);
    $links = array();
    $children = $map->getChildren($section_id);
    $renderer = AMP_get_renderer();
    if ($include_subsections && $children) {
        $child_sections = array_combine_key($children, $live_sections);
        foreach ($child_sections as $child_id => $child_name) {
            $links[] = $renderer->link(AMP_url_add_vars(AMP_CONTENT_URL_LIST_SECTION, array('type=' . $child_id)), $child_name, array('class' => 'nav_sub_list'));
        }
    }
    $articles = AMP_lookup('articleLinksBySectionLive', $section_id);
    if ($include_articles && $articles) {
        $page = AMPContent_Page::instance();
        $article_id = $currentPage->getArticleId();
        foreach ($articles as $id => $name) {
            $link_class = 'nav_sub_list';
            if ($article_id && $id == $article_id) {
                $link_class = 'nav_sub_active';
            }
            $links[] = $renderer->link(AMP_url_add_vars(AMP_CONTENT_URL_ARTICLE, array('type=' . $id)), $name, array('class' => $link_class));
        }
    }
    return $renderer->UL($links, array('class' => 'nav_sub_list'), array('class' => 'nav_sub_list'));
}