/** * function addColumnData * <pre> * adds a row entry in this XML object. * </pre> * @param $heading [STRING] the row label * @param $fieldName [STRING] the row id value * @return [void] */ function addColumnData($heading, $fieldName) { $xmlRow = new XMLObject(XMLObject_ColumnList::XML_NODE_COL); $xmlRow->addElement(XMLObject_ColumnList::XML_ELEMENT_HEADING, $heading); $xmlRow->addElement(XMLObject_ColumnList::XML_ELEMENT_FIELDNAME, $fieldName); $this->addXMLObject($xmlRow); }
/** * function addRowData * <pre> * adds a row entry in this XML object. * </pre> * @param $label [STRING] the row label * @param $id [STRING] the row id value * @return [void] */ function addRowData($label, $id) { $xmlRow = new XMLObject(XMLObject_RowList::XML_NODE_ROW); $xmlRow->addElement(XMLObject_RowList::XML_ELEMENT_NAME, $label); $xmlRow->addElement(XMLObject_RowList::XML_ELEMENT_VALUE, $id); $this->addXMLObject($xmlRow); }
/** * function addLink * <pre> * Adds a link item to the menu * </pre> * @param $label [STRING] The label to display for the link. * @param $link [STRING] The actual HREF link * @return [void] */ function addLink($label, $link) { $xmlObject = new XMLObject(XMLObject_Menu::NODE_ITEM); $xmlObject->addElement(XMLObject_Menu::ITEM_TYPE, XMLObject_Menu::ITEM_TYPE_LINK); $xmlObject->addElement(XMLObject_Menu::ITEM_TYPE_LINK_LABEL, $label); $xmlObject->addElement(XMLObject_Menu::ITEM_TYPE_LINK_LINK, $link); $this->addXmlObject($xmlObject); }
/** * function getLabelXML * <pre> * Prepares all the currently held labels into an XML output. * </pre> * @return [STRING] */ function getLabelXML() { $xmlList = new XMLObject(RowManager_MultilingualLabelManager::XML_NODE_NAME); $labelKey = RowManager_MultilingualLabelManager::XML_ELEMENT_NAME; foreach ($this->labels as $key => $value) { $label = $this->getLabel($key, $this->languageID); $xmlList->addElement($labelKey, $label, array('key' => $key)); } //echo $xmlList->getXML(); return $xmlList->getXML(); }
/** * function getLabelXML * <pre> * Prepares all the currently held labels into an XML output. * </pre> * @return [STRING] */ function getLabelXML() { $xmlList = new XMLObject(XMLObject_MultilingualManager::XML_NODE_LABELLIST); foreach ($this->labels as $key => $value) { $label = $this->getLabel($key, $this->languageID); $xmlList->addElement('label', $label, array('key' => $key)); } return $xmlList->getXML(); }
/** * function addHiddenData * <pre> * Stores a hidden data item in the object * </pre> * @param $name [STRING] the name of the hidden data item * @param $value [STRING] the value of the hidden data item * @return [void] */ function addHiddenData($name, $value) { $xmlItem = new XMLObject(XMLObject_AdminBox::XML_NODE_HIDDEN); $xmlItem->addElement(XMLObject_AdminBox::XML_ELEMENT_HIDDEN_NAME, $name); $xmlItem->addElement(XMLObject_AdminBox::XML_ELEMENT_HIDDEN_VALUE, $value); $this->hiddenData->addXmlObject($xmlItem); }
/** * function loadData * <pre> * gathers the label data from the DB * </pre> * @return [void] */ function loadData() { // build sql for gathering data // $fieldNames = str_replace('label_moddate','FROM_UNIXTIME(label_moddate) as label_moddate', $this->fieldNames); $sql = 'SELECT * FROM '; $sql .= SITE_DB_NAME . '.' . XMLObject_MultilingualManager::DB_TABLE_TRANSLATION; $sql .= ' WHERE label_id="' . $this->labelID . '"'; $this->db->runSQL($sql); // for each label while ($row = $this->db->retrieveRow()) { // create new XML Object $currentLabel = new XMLObject(XMLObject_Multilingual_Translation::NODE_TRANSLATION); // load Values into XML Object for ($indx = 0; $indx < count($this->fieldList); $indx++) { $fieldName = $this->fieldList[$indx]; $currentLabel->addElement($fieldName, $row[$fieldName]); } // store XML Object into array $this->labelsList[] = $currentLabel; } // next label // Add Each Label entry to this element for ($indx = 0; $indx < count($this->labelsList); $indx++) { $this->addXmlObject($this->labelsList[$indx]); } // next Label }
/** * function getXMLObject * * Generates an XML Object from the object's Values array. * * @param $isHeaderIncluded [BOOL] Determines if we include the '<?xml version="1.0"?>' header. * @param $rootNodeName [STRING] The XML root node name. * * @return [OBJECT] Returns an XMLObject. */ function getXMLObject($isHeaderIncluded = true, $rootNodeName = '') { $xmlObject = new XMLObject($rootNodeName); // for each possible field this object manages ... for ($indx = 0; $indx < count($this->fields); $indx++) { $key = $this->fields[$indx]; // if value exists if (isset($this->values[$key])) { $xmlObject->addElement($key, $this->values[$key]); } else { $xmlObject->addElement($key, ''); } } return $xmlObject; }
/** * function getXMLObject * <pre> * Generates an XML Object from the object's Values array. * </pre> * @param $isHeaderIncluded [BOOL] Determines if we include the '<?xml version="1.0"?>' header. * @param $rootNodeName [STRING] The XML root node name. * @param $skipManagers [BOOLEAN] Whether to skip reading individual manager values in favour of overall values * * @return [OBJECT] XMLObject */ function getXMLObject($isHeaderIncluded = true, $rootNodeName = '', $skipManagers = false) { // use member root node name if one is not provided. if ($rootNodeName == '') { $rootNodeName = $this->xmlNodeName; } // NOTE: Big picture here, is to make the individual XML values from // the XMLObjects and combine them into 1 XMLObject for a unified // XML result. // for each rowManager in list $combinedValues = array(); // only use overall result values, NOT values from individual managers (which has problems with LEFT JOINs) if ($skipManagers == true) { $combinedValues = $this->getArrayOfValues($skipManagers); } else { // echo "ROwManager = <pre>".print_r($this->rowManagerList,true)."</pre>"; for ($indx = 0; $indx < count($this->rowManagerList); $indx++) { // pull out XMLValues array $valuesArray = $this->rowManagerList[$indx]->getArrayOfValues(); // echo 'The XML values<pre>'.print_r($valuesArray,true).'</pre>'; // combine them into 1 array of Values $combinedValues = array_merge($combinedValues, $valuesArray); } // echo 'Combined<pre>'.print_r($combinedValues,true).'</pre>'; // exit; } // create new XML Object for output $xmlObject = new XMLObject($rootNodeName); // set those combined values as this Blended XML object foreach ($combinedValues as $key => $value) { $xmlObject->addElement($key, $value); } return $xmlObject; }
/** * function loadPage * <pre> * load the page zones and applications given a pageID. * </pre> * @param $pageID [INTEGER] Unique PageID of the page to load. */ function loadPage($pageID) { // now get a list of zones for this page $sql = 'SELECT DISTINCT pageapp_zone FROM ' . SITE_DB_NAME . '.' . XMLObject_CMSPageApp::DB_TABLE_PAGEAPP . ' WHERE page_id=' . $pageID; // for each zone $this->db->runSQL($sql); while ($row = $this->db->retrieveRow()) { // store in this->zones $this->zones[] = $row['pageapp_zone']; } // Create a generic App Object. $currentApp = new XMLObject_CMSApps($this->viewer); // for each zone for ($zoneIndx = 0; $zoneIndx < count($this->zones); $zoneIndx++) { // Create a new zone XML Object $currentZone = new XMLObject(XMLObject_CMSPageApp::XML_NODE_ZONE); $currentZone->addAttribute('name', $this->zones[$zoneIndx]); // get all the applications in the current zone $sql = 'SELECT * FROM ' . SITE_DB_NAME . '.' . XMLObject_CMSPageApp::DB_TABLE_PAGEAPP . ' WHERE page_id=' . $pageID . ' AND pageapp_zone="' . $this->zones[$zoneIndx] . '" ORDER BY pageapp_order'; // for each application $this->db->runSQL($sql); while ($row = $this->db->retrieveRow()) { // Load Application $currentApp->loadApp($row['app_id']); // Store Application in current Zone $currentZone->addElement($currentApp->getNodeName(), $currentApp->getValues()); } // end while // Now store current Zone in this object $this->addElement($currentZone->getNodeName(), $currentZone->getValues()); } // end For Each Zone }
function prepareDisplayData() { // set the page's Template to the Login Template $this->setPageTemplate(PAGE_TEMPLATE_LOGIN); // Compile Login Form Data as XML $formData = new XMLObject('PageContent'); $formData->addElement('formAction', $this->getCallBack(moduleLogin::MODE_SUBMIT)); $formData->addElement('pathToRoot', $this->moduleRootPath); $formData->addElement('errorMessage', $this->errorMessages); $formData->addElement('form_username', moduleLogin::FORM_USERID); $formData->addElement('form_password', moduleLogin::FORM_PASSWORD); $formData->addElement('username', $this->userID); $formData->addElement('password', $this->passWord); $xmlData = $formData->getXML(); $template = new Template($this->moduleRootPath . 'templates/'); $template->setXML('pageContent', $xmlData); $content = $template->fetch(PAGE_LOGIN_TEMPLATE); // Finally store HTML content as this page's content Item $this->addElement(XMLObject_PageContent::NODE_CONTENT, $content); }
/** * function getXMLObject * * Generates an XML Object from the object's Values array. * * @param $isHeaderIncluded [BOOL] Determines if we include the '<?xml version="1.0"?>' header. * @param $rootNodeName [STRING] The XML root node name. * * @return [OBJECT] Returns an XMLObject. */ function getXMLObject($isHeaderIncluded = true, $rootNodeName = '') { // use member root node name if one is not provided. if ($rootNodeName == '') { $rootNodeName = $this->xmlNodeName; } $xmlObject = new XMLObject($rootNodeName); // for each possible field this object manages ... for ($indx = 0; $indx < count($this->fields); $indx++) { $key = $this->fields[$indx]; // if value exists if (isset($this->values[$key])) { // echo 'Value ['.$key.'] Exists<br/>'; $xmlObject->addElement($key, $this->values[$key]); } else { // echo 'Value ['.$key.'] does NOT Exist<br/>'; $xmlObject->addElement($key, ''); } } return $xmlObject; }