Example #1
0
 /** 
  * function includeFile
  *
  * This function takes some of the file path guesswork out of including files.
  *
  * <pre><code>
  *   set pathFile as the proper path+FileName.
  *   if file exists & is not a Directory then 
  *       include file
  *       return success
  *   else
  *       return failure.
  *   end if
  * </code></pre>
  * @param $file [STRING] The path to the file you want to include.  The path
  * should be from the ROOT of the site.
  *
  * @return [BOOL] True if we were able to find & load the given file. False otherwise. 
  */
 function includeFile($file)
 {
     $pathFile = Page::findPathExtension($file) . $file;
     //check if file exists & is not a Directory then
     if (file_exists($pathFile) && !is_dir($pathFile)) {
         // include File
         // return Success
         $returnValue = (include_once $pathFile);
     } else {
         // else
         // return failure
         $returnValue = false;
     }
     return $returnValue;
 }
/*
 * page_MySchedule.php
 *
 * This is a generic template for the page_MySchedule.php page.
 *
 * Required Template Variables:
 *  $pageLabels :   The values of the labels to display on the page.
 *
 *  $groupCollectionArray: an array of GroupCollection objects
 *
 */
// First load the common Template Tools object
// This object handles the common display of our form items and
// text formmatting tools.
$fileName = 'objects/TemplateTools.php';
$path = Page::findPathExtension($fileName);
require_once $path . $fileName;
$templateTools = new TemplateTools();
// load the page labels
$templateTools->loadPageLabels($pageLabels);
?>
<p><span class="heading"><?php 
echo $templateTools->getPageLabel('[Title]');
?>
</span></p>
<p><span class="text"><?php 
echo $templateTools->getPageLabel('[Instr]');
?>
</span></p>

<form name="Form" id="Form" method="post" action="<?php 
<?php

$toolName = 'modules/app_cim_hrdb/objects_da/AdminManager.php';
$toolPath = Page::findPathExtension($toolName);
require_once $toolPath . $toolName;
$toolName = 'modules/app_cim_hrdb/objects_da/AccessManager.php';
$toolPath = Page::findPathExtension($toolName);
require_once $toolPath . $toolName;
/**
 * @package cim_hrdb
 */
/**
 * class FormProcessor_EditMyInfo 
 * <pre> 
 * Allows a person to edit their hrdb info.
 * </pre>
 * @author CIM Team
 * Date:   06 Apr 2006
 */
// RAD Tools: FormSingleEntry Page
class FormProcessor_EditMyInfo extends PageDisplay_FormProcessor
{
    //CONSTANTS:
    /** The list of form fields for this page */
    // NOTE: the format for this list is:
    //
    //         form_field_name|form_field_type|invalid_value
    //
    //             form_field_name = the name for the form field.  generally
    //                               it is named the same as the table column
    //                               of the data it represents
 /**
  * function getCallBackString
  * <pre>
  * Generates a callback string that will use the Perl tools to upload and
  * pass back control to your page.  Send it the form action you would 
  * use normally. This routine will return a modified version that includes
  * the necessary parameters used by the perl tools.
  * </pre>
  * @param $callBack [STRING] The callback string for your form.
  * @return [STRING]
  */
 function getCallBackString($callBack)
 {
     // create unique session id ($sid) for this new form.
     $this->sid = md5(uniqid(rand()));
     $parts = explode('?', $callBack);
     // For Live Site
     $pathToScript = Page::findPathExtension(PerlFileUpload::DEF_LOCATION_UPLOAD) . PerlFileUpload::DEF_LOCATION_UPLOAD;
     // For Local testing
     //        $pathToScript = 'http://localhost/' . PerlFileUpload::DEF_LOCATION_UPLOAD;
     $returnValue = $pathToScript . '?' . $parts[1] . '&';
     $returnValue .= PerlFileUpload::DEF_QSPARAM_SID . '=' . $this->sid . '&';
     $returnValue .= PerlFileUpload::DEF_QSPARAM_UPLOADER . '=' . $parts[0];
     return $returnValue;
 }
<?php

/**
 * @package cim_reg
 */
// First load the common Registration Summaries Tools object
// This object allows for efficient access to registration summary data (multi-table).
$fileName = 'Tools/tools_RegSummaries.php';
$path = Page::findPathExtension($fileName);
$testName = 'Tools/tools_Finances.php';
$testPath = Page::findPathExtension($testName);
require_once $testPath . $testName;
require_once $path . $fileName;
/**
 * class page_AdminEventHome 
 * <pre> 
 * Administrative home page for one of the events
 * </pre>
 * @author Russ Martin
 * Date:   20 Feb 2007
 */
// RAD Tools: Custom Page
class page_AdminEventHome extends PageDisplay
{
    //CONSTANTS:
    /** The Multilingual Page Key for labels on this page */
    const MULTILINGUAL_PAGE_KEY = 'page_AdminEventHome';
    //VARIABLES:
    /** @var [OBJECT] The viewer object. */
    protected $viewer;
    protected $event_id;
 /**
  * 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;
     $this->template = new Template($path);
     // store the form action information
     $this->template->set('formAction', $this->formAction);
     // store the link values
     // example:
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     $this->template->set('linkValues', $this->linkValues);
     // 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';
     $this->template->set('linkLabels', $this->linkLabels);
     // 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);
     $this->template->set('linkColumns', $this->linkColumns);
     // store the statevar id to edit
     $this->template->set('editEntryID', $this->dafield_id);
     // store the current op type
     $this->template->set('opType', $this->opType);
     // store the page labels in XML format...
     // NOTE: use this location to update any label tags ...
     // example:
     $daObj = new RowManager_DAObjManager($this->daobj_id);
     $name = $daObj->getName();
     $this->labels->setLabelTag('[Title]', '[daobjName]', $name);
     $this->template->setXML('pageLabels', $this->labels->getLabelXML());
     // store all the fields to the template
     $this->setFormFieldsToTemplate();
     /*
      * Form related Template variables:
      */
     // save the list of form fields
     $this->template->set('formFieldList', $this->formFields);
     // store the field types being displayed
     $fieldTypes = explode(',', FormProcessor_AddDAFields::FORM_FIELD_TYPES);
     $this->template->set('formFieldType', $fieldTypes);
     // 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_DAFieldManager::XML_NODE_NAME;
     $this->template->set('rowManagerXMLNodeName', $xmlNodeName);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'dafield_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 DAFieldList($this->daobj_id, $this->sortBy);
     $this->template->setXML('dataList', $this->dataList->getXML());
     // store the field names being displayed
     $fieldNames = explode(',', FormProcessor_AddDAFields::DISPLAY_FIELDS);
     $this->template->set('dataFieldList', $fieldNames);
     /*
      * Add any additional data required by the template here
      */
     // add Variable Type List
     $listData['STRING'] = $this->labels->getLabel('[STRING]');
     $listData['BOOL'] = $this->labels->getLabel('[BOOL]');
     $listData['INTEGER'] = $this->labels->getLabel('[INTEGER]');
     $listData['DATE'] = $this->labels->getLabel('[DATE]');
     $this->template->set('list_dafield_type', $listData);
     // add StateVar List
     // get module ID
     $moduleID = $daObj->getModuleID();
     $stateVarList = new StateVarList($moduleID);
     $dataList = $stateVarList->getDroplistArray();
     $this->template->set('list_statevar_id', $dataList);
     // add DB Field Type List
     $this->template->set('list_dbType', $this->dataManager->getDBFieldTypeArray());
     $this->template->set('list_dafield_dbType', $this->dataManager->getDBFieldTypeArray());
     // add Form Field Types List
     $fileName = 'objects/TemplateTools.php';
     $path = Page::findPathExtension($fileName);
     require_once $path . $fileName;
     $templateTools = new TemplateTools();
     $formTypes = $templateTools->getFormTypeList();
     $this->template->set('list_dafield_formFieldType', $formTypes);
     //$templateName = 'page_AddDAFields.php';
     $templateName = 'siteFormDataList.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function createCache
  * <pre>
  * Create a cache entry for a given viewer_id and language_id
  * </pre>
  * @param $viewerID [OBJECT] the viewer object of the person to make a
  * cache entry for.
  * @return [void]
  */
 function createCache($viewer)
 {
     $viewerID = $viewer->getID();
     $languageID = $viewer->getLanguageID();
     $groupArray = array();
     // Make sure all required Row Managers are included
     $accountAdminPath = SITE_PATH_MODULES . 'site_AccountAdmin/objects_da/';
     $navBarPath = SITE_PATH_MODULES . 'site_NavBar/objects_da/';
     $pathToRoot = Page::findPathExtension($accountAdminPath);
     require_once $pathToRoot . $accountAdminPath . 'ViewerAccessGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavBarGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavLinkAccessGroupManager.php';
     require_once $pathToRoot . $navBarPath . 'NavLinkViewerManager.php';
     require_once $pathToRoot . $navBarPath . 'NavBarLinksManager.php';
     // get list of Links linked to this viewer
     // array of links: link_id, link_text, link_url, group_id
     $viewerLinks = $this->getViewerLinks($viewerID, $languageID);
     // get list of Links linked to this viewer's groups
     // array of links: link_id, link_text, link_url, group_id
     $groupLinks = $this->getGroupLinks($viewerID, $languageID);
     /*
      * combine lists
      */
     $combinedLinks = array();
     $usedLinks = array();
     // for each viewerLink
     for ($indx = 0; $indx < count($viewerLinks); $indx++) {
         // compute a link key
         $linkKey = $viewerLinks[$indx]['navbarlink_url'] . '[' . $viewerLinks[$indx]['module_id'] . ']';
         // if this link key has not already been added (no duplicate links)
         if (!key_exists($linkKey, $usedLinks)) {
             $usedLinks[$linkKey] = $linkKey;
             $combinedLinks[] = $viewerLinks[$indx];
         }
     }
     // for each groupLink
     for ($indx = 0; $indx < count($groupLinks); $indx++) {
         $linkKey = $groupLinks[$indx]['navbarlink_url'] . '[' . $groupLinks[$indx]['module_id'] . ']';
         if (!key_exists($linkKey, $usedLinks)) {
             $usedLinks[$linkKey] = $linkKey;
             $combinedLinks[] = $groupLinks[$indx];
         }
     }
     // for each link in combinedLinks
     for ($indx = 0; $indx < count($combinedLinks); $indx++) {
         // if groupObject in GroupArray then
         $groupID = (int) $combinedLinks[$indx]['navbargroup_id'];
         if (!key_exists($groupID, $groupArray)) {
             // create new group Object
             $group = new GroupItem();
             $groupManager = new RowManager_NavBarGroupManager($groupID);
             $multiLingualContext = new MultilingualManager($languageID);
             $bridgeManager = $groupManager->getRowLabelBridge($multiLingualContext);
             $group->loadFromArray($bridgeManager->getArrayOfValues());
             // store in GroupArray
             $groupArray[$groupID] = $group;
         }
         // end if
         // Add link Object to Group Object
         $link = new LinkItem();
         $link->loadFromArray($combinedLinks[$indx]);
         $groupArray[$groupID]->addItem($link);
     }
     // next item
     // Now manually sort the group Items since we couldn't get the SQL
     // to sort it.
     $sortedArray = array();
     foreach ($groupArray as $group) {
         $key = $group->getOrder() . $group->getText();
         $sortedArray[$key] = $group;
     }
     ksort($sortedArray);
     // send array of group objects to Template
     $template = new Template($pathToRoot . SITE_PATH_MODULES . 'site_NavBar/templates/');
     $template->set('arrayGroup', $sortedArray);
     $template->set('pathToRoot', $this->getPathToRootTag());
     // get cache data from template
     $cacheData = $template->fetch('obj_NavBar.php');
     $cacheData = str_replace('[userID]', $viewer->getUserID(), $cacheData);
     $cacheData = str_replace('[passWord]', $viewer->getPassword(), $cacheData);
     if ((int) $viewer->getLanguageID() == 1) {
         $cacheData = str_replace('[gtsLanguageID]', 'en', $cacheData);
     } else {
         $cacheData = str_replace('[gtsLanguageID]', 'chi', $cacheData);
     }
     // store cache data in this object
     $this->setValueByFieldName('navbarcache_cache', $cacheData);
     //echo 'cacheData=[<pre>'.$cacheData.'</pre>]<br>';
     // set isValid to true
     $this->setCacheValid();
     $this->setViewerID($viewerID);
     $this->setLanguageID($languageID);
     // update DB Table
     if ($this->isLoaded()) {
         $this->updateDBTable();
     } else {
         $this->createNewEntry();
     }
 }