/**
  * 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;
     // temporarily reset the form values so the defaults show up properly in the jumplists
     $this->formValues['scope_id'] = $this->linkValues['scopeJumpLink'] . $this->scope_id;
     /*
      * 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->statistic_id);
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     $jumpLink = $this->linkValues['scopeJumpLink'];
     $scope = new RowManager_ScopeManager();
     //           $scope->setScopeID( $this->scope_id );
     $scope->setSortOrder('scope_id');
     $scopeList = new ListIterator($scope);
     $scopeArray = $scopeList->getDropListArray(null, $jumpLink);
     //added jumplink
     $this->template->set('list_scope_id', $scopeArray);
     /*** USE JUMP/CHANGE-LIST TO GET THE CHOSEN SCOPE ID ***/
     /** THEN CREATE A DROP-LIST WITH APPROPRIATE VALUES (i.e. Regions for scope 'Region') **/
     // switch (SCOPE)
     $scopeRefs = $this->scope_ref_manager;
     //new RowManager_ScopeManager();
     //         $scope->setScopeID( $this->scope_id );
     //         $scope->setSortOrder( 'scope_id' );
     $scopeRefsList = new ListIterator($scopeRefs);
     $scopeRefsArray = $scopeRefsList->getDropListArray();
     $this->template->set('list_scope_ref_id', $scopeRefsArray);
     $statDataType = new RowManager_StatDataTypeManager();
     $statDataType->setSortOrder('statistic_type_id');
     $statDataTypeList = new ListIterator($statDataType);
     $dataTypes = $statDataTypeList->getDropListArray();
     $this->template->set('list_statistic_type_id', $dataTypes);
     $freqType = new RowManager_FreqTypeManager();
     $freqType->setFreqID($this->freq_id);
     $freqType->setSortOrder('freq_id');
     $freqTypeList = new ListIterator($freqType);
     $freqTypeArray = $freqTypeList->getDropListArray();
     $this->template->set('list_freq_id', $freqTypeArray);
     $measType = new RowManager_MeasureTypeManager();
     $measType->setMeasureID($this->meas_id);
     $measType->setSortOrder('meas_id');
     $measTypeList = new ListIterator($measType);
     $measTypeArray = $measTypeList->getDropListArray();
     $this->template->set('list_meas_id', $measTypeArray);
     /*
      * 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_StatisticManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'statistic_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_StatisticManager();
     $dataAccessManager->setSortOrder($this->sortBy);
     //        $this->dataList = new StatisticList( $this->sortBy );
     $this->dataList = $dataAccessManager->getListIterator();
     $this->template->setXML('dataList', $this->dataList->getXML());
     /*
      * Add any additional data required by the template here
      */
     $templateName = 'page_EditStatistic.tpl.php';
     //'siteFormDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_EditStatistic.php';
     return $this->template->fetch($templateName);
 }
Exemplo n.º 2
0
 $FrequencyValue->createTable();
 /*
  * Statistic Table
  *
  * A statistic description
  *
  * statistic_id [INTEGER]  unique identifier for this Statistic
  * statistic_name [STRING]  the Statistic's name
  * statistic_desc [STRING]  The Statistic description
  * statistic_type [STRING]  the data-type of this Statistic (i.e. numeric, boolean, etc)
  * scope_id [INTEGER]  the id indicating the scope of the statistic (i.e. ministry-level, division-level, etc)
  * scope_ref_id [INTEGER]  The particular scope instance associated with the statistic (i.e. project-level stat assigned to OEX Project)
  * freq_id [INTEGER]  the id indicating the frequency type associated with this statistic
  * meas_id [INTEGER]  the id of the measurement type associated with this statistic (i.e. 'Personal Ministry')
  */
 $Statistic = new RowManager_StatisticManager();
 $Statistic->dropTable();
 $Statistic->createTable();
 /*
  * StatisticValue Table
  *
  * a specific statistic value (i.e. '45' for '# of Gospel Presentations')
  *
  * statvalues_id [INTEGER]  the unique id for the Statistic Value
  * statistic_id [INTEGER]  the id of the statistic associated with this value
  * scope_id [INTEGER]  the scope of the stored stat value
  * scope_ref_id [INTEGER]  the specific scope instance associated with the stat value
  * freqvalue_id [INTEGER]  the id of the specific frequency value associated with the stat value (i.e. a particular day,week,month, or others etc)
  * meastype_id [INTEGER]  The particular measurement type associated with the stat value (OBSOLETE??)
  * statvalues_value [STRING]  The actual statistics value
  * statvalues_modtime [DATE]  the time of the value's insertion/modification
Exemplo n.º 3
0
 /**
  * function __construct
  * <pre>
  * Initialize the object.
  * </pre>
  * @param $pathModuleRoot [STRING] The path to the module's root dir.
  * @param $viewer [OBJECT] The viewer object.
  * @return [void]
  */
 function __construct($pathModuleRoot, $viewer, $freq_id, $meas_id, $start_freqvalue_id, $end_freqvalue_id, $scope_ref_array, $stats_id_array, $filter_id_array)
 {
     parent::__construct();
     // initialzie the object values
     $this->pathModuleRoot = $pathModuleRoot;
     $this->viewer = $viewer;
     //         $this->permManager = new PermissionManager( $this->viewer->getViewerID() );
     $this->freq_id = $freq_id;
     $this->meas_id = $meas_id;
     $this->scope_ref_array = $scope_ref_array;
     // initialize the freq values to display
     $this->freqValManager = new RowManager_FreqValueManager();
     $this->freqValManager->setFreqID($freq_id);
     $freqValRange = 'freqvalue_id between ' . $start_freqvalue_id . ' and ' . $end_freqvalue_id;
     $this->freqValManager->addSearchCondition($freqValRange);
     $this->freqValManager->setSortByDateTime();
     //          $this->freqValManager->setSortOrder('freqvalue_id');
     // initialize the statistics value RowManager to contain the values we want
     $this->dataManager = new RowManager_StatValueManager();
     // filter values by the statistics chosen in previous filter step
     $this->stats_id_array = $stats_id_array;
     $statFilter = '';
     reset($stats_id_array);
     foreach (array_keys($stats_id_array) as $key) {
         // TODO?: use is_numeric() on $scope_ref_list elements to determine that proper value exists
         $statFilter .= '(statistic_id = ' . current($stats_id_array) . ') OR ';
         next($stats_id_array);
     }
     $statFilter = substr($statFilter, 0, -4);
     // remove ' OR ' from the end of the string
     $this->dataManager->addSearchCondition($freqValRange);
     $this->dataManager->addSearchCondition($statFilter);
     $this->dataManager->setSortOrder('statistic_id');
     // Retrieve stats names to be displayed
     $statNames = new RowManager_StatisticManager();
     $statNames->addSearchCondition($statFilter);
     $statNames->setSortOrder('statistic_id');
     $this->stat_names_array = array();
     $statNamesList = $statNames->getListIterator();
     $statNamesArray = $statNamesList->getDataList();
     reset($statNamesArray);
     $i = 0;
     foreach (array_keys($statNamesArray) as $key) {
         $record = current($statNamesArray);
         $this->stat_names_array[$i] = $record['statistic_name'];
         next($statNamesArray);
         $i++;
     }
     //          echo "stat names array = <pre>".print_r($statNamesArray,true)."</pre>";
     // initialize the additional calculations to be made (i.e. SUM, AVG, etc)
     $this->calcManager = new RowManager_ReportFilterManager();
     $this->filter_id_array = $filter_id_array;
     $calcFilter = '';
     reset($filter_id_array);
     foreach (array_keys($filter_id_array) as $key) {
         // TODO?: use is_numeric() on $scope_ref_list elements to determine that proper value exists
         $calcFilter .= '(filter_id = ' . current($filter_id_array) . ') OR ';
         next($filter_id_array);
     }
     $calcFilter = substr($calcFilter, 0, -4);
     // remove ' OR ' from the end of the string
     $this->calcManager->addSearchCondition($calcFilter);
     // now initialize the labels for this page
     // start by loading the default field labels for this Module
     $languageID = $viewer->getLanguageID();
     $seriesKey = modulep2c_stats::MULTILINGUAL_SERIES_KEY;
     $pageKey = modulep2c_stats::MULTILINGUAL_PAGE_FIELDS;
     $this->labels = new MultilingualManager($languageID, $seriesKey, $pageKey);
     $pageKey = page_StatsReport::MULTILINGUAL_PAGE_KEY;
     $this->labels->loadPageLabels($pageKey);
     //         echo "POST values = <pre>".print_r($_POST,true)."</pre>";
 }