/** * 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: // $name = $user->getName(); // $this->labels->setLabelTag( '[Title]', '[userName]', $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->campusaccess_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 // // NOTE: Hobbe, here are the original two lines that I moved to below // // $xmlNodeName = RowManager_EventAdminCampusAssignmentManager::XML_NODE_NAME; // $this->template->set( 'rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'campusaccess_id'); // Russ' Debugging Methodoloy // 1. Try and create a multi-table manager that returns the // result set I want and put it into and array. Then figure // out why that is not making it through to the template. // // Result: Hobbe, indeed you were creating the multi-table // manager correctly (I just renamed the one row manager), // otherwise your code was fine. // // 2. Ok, try and figure out why the template doesn't like // XML it is getting. // // a. first I check another example (FormProcessor_AddSuperAdmin) // of where an adminbox type template is generated. Yes, it // appears we are sending the xml properly // // b. i notice the call to ->set('primaryKeyFieldName', ... ) // in the example I'm checking, that too seems to be okay // // c. I notice the xmlNodeName parameter being set in the // templates, i realize that we are not setting this properly // and refactor the code a little to get the xmlNodeName from // the multitablemanager instead. // store data list to the template // NOTE: we initialize it here to make sure we capture any new data // from a recent processData() call. $campusAdminManager = new RowManager_EventAdminCampusAssignmentManager(); //*** ADDED JOIN TO FILTER BY EVENT ***/ $eventAdminManager = new RowManager_EventAdminAssignmentManager(); // echo "The eventID is [".$this->event_id."]<br/>"; $eventAdminManager->setEventID($this->event_id); $multiTableManager = new MultiTableManager(); $multiTableManager->addRowManager($campusAdminManager); $multiTableManager->addRowManager($eventAdminManager, new JoinPair($eventAdminManager->getJoinOnEventAdminID(), $campusAdminManager->getJoinOnEventAdminID())); // code to check the result set in the multi-table manager // $i = 0; // $listIt = $multiTableManager->getListIterator(); // $listIt->setFirst(); // while( $listIt->moveNext() ) // { // echo "ith [".$i."] element"; // $i++; // } // end multi-table manager check // $this->dataList = $multiTableManager->getListIterator(); // echo "<pre>List: ".print_r($this->dataList,true)."</pre>"; //*** END ADD ***/ $this->dataList = $multiTableManager->getListIterator(); // Hobbe, I added/moved these two lines and now it works! // It has to do with how the template understands the // XML that it is passed $xmlNodeName = $this->dataList->getRowManagerXMLNodeName(); $this->template->set('rowManagerXMLNodeName', $xmlNodeName); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $eventAdmin = new RowManager_EventAdminAssignmentManager(); $eventAdmin->setEventID($this->event_id); $viewer = new RowManager_ViewerManager(); $multiTableManager2 = new MultiTableManager(); $multiTableManager2->addRowManager($eventAdmin); $multiTableManager2->addRowManager($viewer, new JoinPair($eventAdmin->getJoinOnViewerID(), $viewer->getJoinOnViewerID())); // $multiTableManager2->constructSearchCondition( 'event_id', '=', $this->event_id, true ); $multiTableManager2->setSortOrder('viewer_userID'); $multiTableManager2->setLabelTemplate('viewer_userID', '[viewer_userID]'); $listIterator = $multiTableManager2->getListIterator(); // code to check the result set in the multi-table manager /* echo "<pre>List: ".print_r($listIterator,true)."</pre>"; $i = 0; $listIt = $multiTableManager2->getListIterator(); $listIt->setFirst(); while( $listIt->moveNext() ) { echo "ith [".$i."] element"; $i++; } */ // end multi-table manager check // echo print_r($listIterator,true); /* $viewer = new RowManager_ViewerManager(); $viewer->setSortOrder( 'viewer_userID' ); $viewerList = new ListIterator($viewer); $viewerArray = $viewerList->getDropListArray(); */ $viewerArray = $listIterator->getDropListArray(); //$listIterator $this->template->set('list_eventadmin_id', $viewerArray); // echo print_r($viewerArray,true); $campus = new RowManager_CampusManager(); // $campus->setEventID( $this->event_id); $campus->setSortOrder('campus_id'); $campusList = new ListIterator($campus); $campusArray = $campusList->getDropListArray(); $this->template->set('list_campus_id', $campusArray); $templateName = 'siteAdminBox.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_AddCampusAdmin.php'; return $this->template->fetch($templateName); }