Esempio n. 1
0
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to this module's root directory
  * @param $viewer [OBJECT] The viewer object.
  * @param $formAction [STRING] The action on a form submit
  * @param $sortBy [STRING] Field data to sort listManager by.
  * @param $navbarlink_id [STRING] The init data for the dataManager obj
  * @param $navbargroup_id [STRING] The init data for the dataList obj
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $formAction, $sortBy, $navbarlink_id, $navbargroup_id = "")
 {
     // NOTE: be sure to call the parent constructor before trying to
     //       use the ->formXXX arrays...
     $fieldList = FormProcessor_LinkList::FORM_FIELDS;
     $fieldTypes = FormProcessor_LinkList::FORM_FIELD_TYPES;
     $displayFields = FormProcessor_LinkList::DISPLAY_FIELDS;
     parent::__construct($viewer, $formAction, $sortBy, $fieldList, $fieldTypes, $displayFields);
     $this->pathModuleRoot = $pathModuleRoot;
     $this->navbarlink_id = $navbarlink_id;
     $this->navbargroup_id = $navbargroup_id;
     // figure out the important fields for the dataManager
     $fieldsOfInterest = implode(',', $this->formFields);
     $linkManager = new RowManager_NavBarLinksManager($navbarlink_id);
     $seriesKey = moduleNavBar::MULTILINGUAL_SERIES_KEY;
     $pageKey = $linkManager->getXMLNodeName();
     $this->bridgeMultiLingualManager = new MultilingualManager($viewer->getLanguageID(), $seriesKey, $pageKey);
     $this->dataManager = new RowLabelBridge($linkManager, $this->bridgeMultiLingualManager);
     $this->dataManager->setFieldsOfInterest($fieldsOfInterest);
     $this->formValues = $this->dataManager->getArrayOfValues();
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = moduleNavBar::MULTILINGUAL_SERIES_KEY;
     $pageKey = moduleNavBar::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     // then load the page specific labels for this page
     $pageKey = FormProcessor_LinkList::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     // load the site default form link labels
     $this->labels->setSeriesKey(SITE_LABEL_SERIES_SITE);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORM_LINKS);
     $this->labels->loadPageLabels(SITE_LABEL_PAGE_FORMERRORS);
 }
 /**
  * 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);
 }