/**
  * function deleteEntry
  * <pre>
  * Removes the DB table info.
  * </pre>
  * @return [void]
  */
 function deleteEntry()
 {
     // before removing entry, make sure associated linkGroups & linkViewers
     // are removed as well
     $linkID = $this->getID();
     $linkMgr = new RowManager_NavLinkAccessGroupManager();
     $linkMgr->setLinkID($linkID);
     $list = $linkMgr->getListIterator();
     $list->setFirst();
     while ($entry = $list->getNext()) {
         $entry->deleteEntry();
     }
     $linkViewerMgr = new RowManager_NavLinkViewerManager();
     $linkViewerMgr->setLinkID($linkID);
     $list = $linkViewerMgr->getListIterator();
     $list->setFirst();
     while ($entry = $list->getNext()) {
         $entry->deleteEntry();
     }
     parent::deleteEntry();
 }
Пример #2
0
 $values['module_id'] = $module->getID();
 $values['navbarlink_isActive'] = 1;
 $values['navbarlink_isModule'] = 1;
 $values['navbarlink_order'] = 0;
 $link->loadFromArray($values);
 $link->createNewEntry();
 /*
  * NavLinkAccessGroup Table
  *
  * This table joins which nav bar links are displayed for which site access group.
  *
  * navlinkaccessgroup_id [INTEGER]  Primary Key for this table
  * navbarlink_id [INTEGER]  Foreign Key relating this entry to a link
  * accessgroup_id [INTEGER]  Foreign key relating this link to a site Access Group
  */
 $navLinkAccessGroup = new RowManager_NavLinkAccessGroupManager();
 $navLinkAccessGroup->dropTable();
 $navLinkAccessGroup->createTable();
 // now link the "Site Administration" Access Group to the "Site Administration" link
 // first we have to flip over backwards to get the account group with the label "Site Administration"
 $accessGroup = new RowManager_AccessGroupManager();
 $seriesKey = moduleAccountAdmin::MULTILINGUAL_SERIES_KEY;
 $pageKey = RowManager_AccessGroupManager::XML_NODE_NAME;
 $multiLingualContext = new MultilingualManager(1, $seriesKey, $pageKey);
 $group = $accessGroup->getRowLabelBridge($multiLingualContext);
 $group->constructSearchCondition('label_label', OP_EQUAL, 'Site Administration', true);
 $list = $group->getListIterator();
 $list->setFirst();
 if ($item = $list->getNext()) {
     $navLinkAccessGroup->setGroupID($item->getID());
     $navLinkAccessGroup->setLinkID($link->getID());
Пример #3
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Uncomment the following line if you want to create a template
     // tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     // Otherwise use the standard Templates for the site:
     $path = SITE_PATH_TEMPLATES;
     /*
      * store the link values
      */
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     // store the link labels
     $this->linkLabels['edit'] = $this->labels->getLabel('[Edit]');
     $this->linkLabels['del'] = $this->labels->getLabel('[Delete]');
     $this->linkLabels['cont'] = $this->labels->getLabel('[Continue]');
     // $this->linkLabels[ 'view' ] = 'new link label here';
     /*
      * store any additional link Columns
      */
     // example:
     //$title = $this->labels->getLabel( '[title_groups]');
     //$columnLabel = $this->labels->getLabel( '[groups]');
     //$link = $this->linkValues[ 'groups' ];
     //$fieldName = 'accessgroup_id';
     //$this->addLinkColumn( $title, $columnLabel, $link, $fieldName);
     /*
      * Update any label tags ...
      */
     // example:
     $linkManager = new RowManager_NavBarLinksManager($this->navbarlink_id);
     $seriesKey = moduleNavBar::MULTILINGUAL_SERIES_KEY;
     $pageKey = $linkManager->getXMLNodeName();
     $groupMultiLingual = new MultilingualManager($this->viewer->getLanguageID(), $seriesKey, $pageKey);
     $bridgeManager = new RowLabelBridge($linkManager, $groupMultiLingual);
     $name = $bridgeManager->getLabel();
     $this->labels->setLabelTag('[Title]', '[linkName]', $name);
     // NOTE:  this parent method prepares the $this->template with the
     // common AdminBox data.
     $this->prepareTemplate($path);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->navlinkaccessgroup_id);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     /*
      * Insert the date start/end values for the following date fields:
      */
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * List related Template variables :
      */
     // Store the XML Node name for the Data Access Field List
     $xmlNodeName = $this->dataManager->getXMLNodeName();
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'navlinkaccessgroup_id');
     // store data list to the template
     // NOTE: we initialize it here to make sure we capture any new data
     // from a recent processData() call.
     //        $this->dataList = new NavLinkAccessGroupList( $this->navbarlink_id, $this->sortBy );
     $groupManager = new RowManager_NavLinkAccessGroupManager();
     $groupManager->setLinkID($this->navbarlink_id);
     $this->dataList = $groupManager->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $accountGroupMgr = new RowManager_AccessGroupManager();
     $multiLingualContext = new MultilingualManager($this->viewer->getLanguageID());
     $rowLabelBridge = $accountGroupMgr->getRowLabelBridge($multiLingualContext);
     $accountList = $rowLabelBridge->getListIterator();
     $this->template->set("list_accessgroup_id", $accountList->getDropListArray());
     $templateName = TEMPLATE_ADMIN_BOX;
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_LinkGroups.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function getGroupLinks
  * <pre>
  * Returns an array of links linked directly to groups this viewer is 
  * linked to.
  * </pre>
  * @param $viewerID [INTEGER] the viewer_id of the person to make a cache
  * entry for.
  * @param $languageID [INTEGER] the language_id of the cache entry 
  * @return [ARRAY]
  */
 function getGroupLinks($viewerID, $languageID)
 {
     $resultArray = array();
     // create Link RowLabelBridge
     $linkManager = new RowManager_NavBarLinksManager();
     $multiLingualContext = new MultilingualManager($languageID, 'moduleNavBar', 'navBarLinks');
     $bridgeManager = $linkManager->getRowLabelBridge($multiLingualContext);
     // add to it the LinkAccessGroup table
     $linkGroup = new RowManager_NavLinkAccessGroupManager();
     $joinPair = new JoinPair($linkGroup->getJoinOnLinkID(), $linkManager->getJoinOnLinkID());
     $bridgeManager->addRowManager($linkGroup, $joinPair);
     // add to it the ViewerAccessGroup Table
     $viewerAccessGroup = new RowManager_ViewerAccessGroupManager();
     $viewerAccessGroup->setViewerID($viewerID);
     $joinPair = new JoinPair($viewerAccessGroup->getJoinOnGroupID(), $linkGroup->getJoinOnGroupID());
     $bridgeManager->addRowManager($viewerAccessGroup, $joinPair);
     // get list of entries
     $list = $bridgeManager->getListIterator();
     // for each item
     $list->setFirst();
     while ($link = $list->getNext()) {
         // add to resultArray
         $resultArray[] = $link->getArrayOfValues();
     }
     // next item
     return $resultArray;
 }