/** * 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); // Enable the 'Add' form for creating new reports $formLabel = 'New Report Name:'; // TODO: replace with constant? $formFieldArray = explode(',', page_HrdbForms::DISPLAY_FIELDS); $formField = $formFieldArray[0]; $formButtonText = 'Add Report'; $this->template->set('addFormAction', $this->formAction); $this->template->set('addFormLabel', $formLabel); $this->template->set('addFormField', $formField); $this->template->set('addButtonText', $formButtonText); // store the statevar id to edit $this->template->set('editEntryID', $this->customfields_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 = RowManager_CustomFieldsManager::XML_NODE_NAME; $this->template->set('rowManagerXMLNodeName', $xmlNodeName); // store the primary key field name for the data being displayed $this->template->set('primaryKeyFieldName', 'customfields_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. $dataAccessManager = new RowManager_CustomFieldsManager(); if ($this->report_id != '') { $dataAccessManager->setReportID($this->report_id); } $dataAccessManager->setSortOrder($this->sortBy); // $this->dataList = new CustomFieldsList( $this->sortBy ); $this->dataList = $dataAccessManager->getListIterator(); $this->template->setXML('dataList', $this->dataList->getXML()); /* * Add any additional data required by the template here */ $report_manager = new RowManager_CustomReportsManager($this->report_id); $report_list = $report_manager->getListIterator(); $reportArray = $report_list->getDropListArray(); $this->template->set('list_report_id', $reportArray); $fields_manager = new RowManager_FormFieldManager(); $fields_list = $fields_manager->getListIterator(); // $fieldsArray = $fields_list ->getDropListArray(); $fieldsInfoArray = $fields_list->getDataList(); $fieldsArray = array(); foreach (array_keys($fieldsInfoArray) as $fields_id) { $record = current($fieldsInfoArray); $fields_desc = strip_tags($record['fields_desc']); // remove HTML tags $question_regex = '/[^]*[\\.\\?!:]*[A-Z]+[a-z\\s0-9%]+[?]{1}/'; // example: ([0-9]{3})\-[0-9]{1,2}\-[0-9]{1,2} for YYYY-MM-DD $simple_question = '/[?]{1}/'; if (preg_match($question_regex, $fields_desc, $matches) >= 1) { $fieldsArray[$fields_id] = $matches[0]; //substr($fields_desc,$matches[0][1]); } else { if (preg_match($simple_question, $fields_desc, $matches) < 1) { $fieldsArray[$fields_id] = $fields_desc; } else { $fieldsArray[$fields_id] = 'ERROR: ' . $fields_desc; } } next($fieldsInfoArray); } $this->template->set('list_fields_id', $fieldsArray); $report_name = ''; if ($this->report_id != '') { $reportContext = new RowManager_CustomReportsManager($this->report_id); $report_name = $reportContext->getReportName(); } $this->template->set('subheading', $report_name); $templateName = 'siteAdminBox.php'; // if you are creating a custom template for this page then // replace $templateName with the following: //$templateName = 'page_EditCustomReports.php'; return $this->template->fetch($templateName); }
* report_id [INTEGER] The unique ID of the custom report. * report_name [STRING] The name of the custom HRDB report. */ $CustomReports = new RowManager_CustomReportsManager(); $CustomReports->dropTable(); $CustomReports->createTable(); /* * CustomFields Table * * The object used to associate HRDB form fields with a custom-built report. * * customfields_id [INTEGER] The unique id of this custom report to HRDB form field match-up. * report_id [INTEGER] The ID of the associated custom report. * fields_id [INTEGER] The HRDB form field that should be associated with a custom report. */ $CustomFields = new RowManager_CustomFieldsManager(); $CustomFields->dropTable(); $CustomFields->createTable(); /* * Ministry Table * * Contains name and abbreviation of some ministry. Other data may be added in the future, i.e. description and website. * * ministry_id [INTEGER] the unique primary id of the ministry * ministry_name [STRING] The full name of the ministry. * ministry_abbrev [STRING] The abbreviation of the ministry name. */ $Ministry = new RowManager_MinistryManager(); $Ministry->dropTable(); $Ministry->createTable(); /*[RAD_DAOBJ_TABLE]*/
protected function getFieldArray($reportID = '') { // $FALSE = 0; $groupBy = 'cim_hrdb_fields.fields_id'; $dbFunction = 'COUNT'; $funcParam = 'person_id'; $fields = new RowManager_FormFieldManager(); // $fvalues = new RowManager_FieldValueManager(); $ftypes = new RowManager_FieldTypeManager(); // $custom_reports = new RowManager_CustomReportsManager(); //$reportID $custom_fields = new RowManager_CustomFieldsManager(); //$reportID if ($reportID != '') { $custom_fields->setReportID($reportID); } $fieldvalues = new RowManager_FormFieldValueManager(); // "NEW" (in order to sort fields by # of values) // echo "personID = ".$personID; // if ($formID != '') // { // $fields->setFormID($formID); // //$fvalues->setRegID($regID); // } $fieldInfo = new MultiTableManager(); $fieldInfo->addRowManager($fields); // $fieldInfo->addRowManager($fvalues, new JoinPair($fvalues->getJoinOnFieldID(), $fields->getJoinOnFieldID())); $fieldInfo->addRowManager($ftypes, new JoinPair($fields->getJoinOnFieldTypeID(), $ftypes->getJoinOnFieldTypeID())); $fieldInfo->addRowManager($custom_fields, new JoinPair($custom_fields->getJoinOnFieldID(), $fields->getJoinOnFieldID())); $fieldInfo->addRowManager($fieldvalues, new JoinPair($fieldvalues->getJoinOnFieldID(), $fields->getJoinOnFieldID())); // use GROUP BY and $dbFunction = 'COUNT' to sort fields by # of values if ($groupBy != '') { $fieldInfo->setGroupBy($groupBy); //'campus_desc'); } if ($dbFunction != '') { $fieldInfo->setFunctionCall($dbFunction, $funcParam); } $fieldInfo->setSortOrder('COUNT(person_id) DESC'); // $fieldInfo->setSortOrder('fields_priority'); // echo $fieldInfo->createSQL(); $valuesIterator = $fieldInfo->getListIterator(); $valuesArray = $valuesIterator->getDataList(); // echo "values:<br><pre>".print_r($valuesArray,true)."</pre>"; // map the fields_id of each field values row to the label of that particular form field // $idx = 0; // reset($valuesArray); // foreach(array_keys($valuesArray) as $k) // { // $record = current($valuesArray); // // // store mapping associating form field label with fields_id // $this->formFieldToFieldIDmapper['form_field'.$idx] = $record['fields_id']; // // next($valuesArray); // $idx++; // } // echo "field id values:<br><pre>".print_r($this->formFieldToFieldIDmapper,true)."</pre>"; $reportFields = new MultiTableManager(); $customfields = new RowManager_CustomFieldsManager(); $customfields->setReportID($this->customreport_id); // TODO? error checking on ID $fieldvalues = new RowManager_FormFieldValueManager(); $reportFields->addRowManager($customfields); $reportFields->addRowManager($fieldvalues, new JoinPair($customfields->getJoinOnFieldID(), $fieldvalues->getJoinOnFieldID())); // use GROUP BY and $dbFunction = 'COUNT' to quickly get summary data per campus if ($groupBy != '') { $reportFields->setGroupBy($groupBy); //'campus_desc'); } if ($dbFunction != '') { $reportFields->setFunctionCall($dbFunction, $funcParam); } $reportFields->setSortOrder('COUNT(person_id) DESC'); return $valuesArray; }