Esempio n. 1
0
 /**
  * function deleteEntry
  * <pre>
  * Removes the child entries of Module objects before removing self. 
  * (Poor Man's Referential Integrity)
  * </pre>
  * @return [void]
  */
 function deleteEntry()
 {
     // first remove any associated State Variables
     $list = new StateVarList($this->getModuleID());
     $list->setFirst();
     while ($item = $list->getNext()) {
         $item->deleteEntry();
     }
     // now remove any Data Access Objects
     $list = new DAObjList($this->getModuleID());
     $list->setFirst();
     while ($item = $list->getNext()) {
         $item->deleteEntry();
     }
     // now remove any Page Objects
     $list = new PageList($this->getModuleID());
     $list->setFirst();
     while ($item = $list->getNext()) {
         $item->deleteEntry();
     }
     // now remove any Transitions
     $list = new TransitionsList($this->getModuleID());
     $list->setFirst();
     while ($item = $list->getNext()) {
         $item->deleteEntry();
     }
     // now call parent method
     parent::deleteEntry();
 }
Esempio n. 2
0
 /**
  * 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 any additional values to template
     $this->template->set('formAction', $this->formAction);
     // store the page labels in XML format...
     // NOTE: use this location to update any label tags ...
     $name = $this->dataManager->getName();
     $this->labels->setLabelTag('[Title]', '[pageName]', $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_EditPage::FORM_FIELD_TYPES);
     $this->template->set('formFieldType', $fieldTypes);
     // store the button label
     $this->template->set('buttonText', $this->labels->getLabel('[Update]'));
     // Insert the date start/end values for the following date fields:
     // example:
     //$this->template->set( 'startYear_[fieldName]', 2000);
     //$this->template->set( 'endYear_[fieldName]', 2010);
     /*
      * Add any additional data required by the template here
      */
     $pageTypeArray = RowManager_PageManager::getPageTypeArray();
     $this->template->set('list_page_type', $pageTypeArray);
     $daObjList = new DAObjList($this->module_id);
     $listArray = $daObjList->getDroplistArray();
     $this->template->set('list_page_rowMgrID', $listArray);
     $this->template->set('list_page_listMgrID', $listArray);
     // uncomment this line if you are creating a template for this page
     //$templateName = 'page_EditPage.php';
     // otherwise use the generic admin box template
     $templateName = 'siteFormSingle.php';
     return $this->template->fetch($templateName);
 }
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Make a new Template object
     $path = SITE_PATH_TEMPLATES;
     // Replace $path with the following line if you want to create a
     // template tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     $this->template = new Template($path);
     // store the form action data
     $this->template->set('formAction', $this->formCallBack);
     // store the page labels used by this template...
     // NOTE: use this location to update any label tags ...
     $name = $this->itemManager->getName();
     $this->labels->setLabelTag('[Title]', '[pageName]', $name);
     $this->template->setXML('pageLabels', $this->labels->getLabelXML());
     // store the field names being displayed
     $fieldNames = explode(',', page_DeletePage::DISPLAY_FIELDS);
     $this->template->set('dataFieldList', $fieldNames);
     // store XML Data of item
     $this->template->setXML('dataItem', $this->itemManager->getXML());
     $pageTypeArray = RowManager_PageManager::getPageTypeArray();
     $this->template->set('list_page_type', $pageTypeArray);
     $moduleID = $this->itemManager->getModuleID();
     $daObjList = new DAObjList($moduleID);
     $listArray = $daObjList->getDroplistArray();
     $this->template->set('list_page_rowMgrID', $listArray);
     $this->template->set('list_page_listMgrID', $listArray);
     // uncomment this line if you are creating a template for this page
     //$templateName = 'page_DeletePage.php';
     // otherwise use the generic admin box template
     $templateName = 'siteDeleteConf.php';
     return $this->template->fetch($templateName);
 }
Esempio n. 4
0
 /**
  * function processDataAccessObjectInfo
  * <pre>
  * Takes the Data Access info and creates the proper tool_setup.php entries
  * as well as the individual DataAccessManager & DataAccessList objects.
  * </pre>
  * @param $moduleID [INTEGER] The module id of the DAObjects to work with
  * @return [void]
  */
 function processDataAccessObjectInfo($moduleID)
 {
     $pathToCodeTemplates = $this->values[ModuleCreator::KEY_PATH_RAD_ROOT];
     $pathToCodeTemplates .= 'data/code/';
     $codeTemplate = new Template($pathToCodeTemplates);
     // open include file to include any created objects
     $includeFileName = $this->values[ModuleCreator::KEY_PATH_INCLUDE_NAME];
     $includeFileContents = file_get_contents($includeFileName);
     /* 
      * Begin by modifying the tool_setup file
      */
     // open tool_setup file
     $setupFileName = $this->values[ModuleCreator::KEY_PATH_SETUP_NAME];
     $setupFileContents = file_get_contents($setupFileName);
     // get daObjList object
     $daObjList = new DAObjList($moduleID);
     // for each daObj object
     $daObjList->setFirst();
     while ($daObj = $daObjList->getNext()) {
         // if object not created then
         if (!$daObj->isCreated()) {
             $docTableName = ucwords($daObj->getName());
             $docTableDescription = $daObj->getDescription() . "\n";
             $docFieldList = '';
             $sqlManagerName = $docTableName;
             $sqlFieldList = '';
             $sqlPrimaryKey = '';
             $fieldLabels = '';
             $tableManagerFieldList = '';
             $primaryKeyFieldName = '';
             $listInitFields = array();
             $labelFieldName = '';
             $fieldList = $daObj->getFieldList();
             $fieldList->setFirst();
             while ($field = $fieldList->getNext()) {
                 // compile documentation entries
                 $docFieldList .= '     * ' . $field->getName() . ' [' . $field->getType() . ']  ' . $field->getDescription() . "\n";
                 // compile sql field(s)
                 $sqlFieldList .= $this->getSQLFieldEntry($field);
                 if ($field->isPrimaryKey()) {
                     $sqlPrimaryKey = '  PRIMARY KEY (' . $field->getName() . ")\n";
                     $primaryKeyFieldName = $field->getName();
                 }
                 // Collect Field Label info
                 $fieldLabels .= $this->getFieldLabels($field);
                 // collect TableManager field list
                 if ($tableManagerFieldList != '') {
                     $tableManagerFieldList .= ',';
                 }
                 $tableManagerFieldList .= $field->getName();
                 // collect names of any fields used to init the list
                 if ($field->isListInit()) {
                     $listInitFields[] = $field;
                 }
                 // store the field name used for labels display(s)
                 // (like Form Grid Rows, or Drop List Labels, etc...)
                 if ($field->isLabelName()) {
                     $labelFieldName = $field->getName();
                 }
             }
             // next Field Entry
             // combine sqlFieldList with sqlPrimaryKey
             $sqlFieldList .= $sqlPrimaryKey;
             $codeTemplate->set('tableName', $docTableName);
             $codeTemplate->set('tableDescription', $docTableDescription);
             $codeTemplate->set('fieldList', $docFieldList);
             $codeTemplate->set('tableNameCap', $sqlManagerName);
             $codeTemplate->set('dbFieldList', $sqlFieldList);
             $setupCode = $codeTemplate->fetch('setup_dbTable.php');
             //echo $setupCode;
             //exit;
             // insert sql setup code
             $tag = ModuleCreator::TAG_TOOL_DAOBJ_TABLE;
             $data = $setupCode . "\n\n\n\n" . $tag;
             $setupFileContents = str_replace($tag, $data, $setupFileContents);
             // insert field labels
             $tag = ModuleCreator::TAG_TOOL_FIELDS_LABEL;
             $data = "    //\n    // " . $daObj->getName() . " table\n    //\n" . $fieldLabels . "\n\n" . $tag;
             $setupFileContents = str_replace($tag, $data, $setupFileContents);
             // Now create new Table manager Object
             $tableManagerName = $this->createTableManagerObject($daObj, $tableManagerFieldList, $primaryKeyFieldName, $labelFieldName, $docFieldList, $sqlFieldList);
             // Now create new List Manager Object
             //                $listIteratorName = $this->createListIteratorObject( $daObj, $listInitFields );
             // Now insert new objects into include file
             $tag = ModuleCreator::TAG_INCLUDE_DA;
             $data = "require_once( '" . ModuleCreator::PATH_OBJECT_DA . $tableManagerName . "' );\n";
             //                $data .= "require_once( '".ModuleCreator::PATH_OBJECT_DA.$listIteratorName."' );\n";
             $data .= $tag;
             $includeFileContents = str_replace($tag, $data, $includeFileContents);
             // Now mark this Data Access Object as having been created.
             $daObj->setCreated();
         }
         // end if !created
     }
     // next object
     // save Setup file contents
     file_put_contents($setupFileName, $setupFileContents);
     // save Include File Contents
     file_put_contents($includeFileName, $includeFileContents);
 }
Esempio n. 5
0
 /**
  * function getHTML
  * <pre>
  * This method returns the HTML data generated by this object.
  * </pre>
  * @return [STRING] HTML Display data.
  */
 function getHTML()
 {
     // Make a new Template object
     $path = SITE_PATH_TEMPLATES;
     // Replace $path with the following line if you want to create a
     // template tailored for this page:
     //$path = $this->pathModuleRoot.'templates/';
     $this->template = new Template($path);
     // store the Row Manager's XML Node Name
     $this->template->set('rowManagerXMLNodeName', RowManager_PageManager::XML_NODE_NAME);
     // store the field names being displayed
     $fieldNames = explode(',', page_ViewPages::DISPLAY_FIELDS);
     $this->template->set('dataFieldList', $fieldNames);
     // store the primary key field name for the data being displayed
     $this->template->set('primaryKeyFieldName', 'page_id');
     // store the link values
     // $this->linkValues[ 'view' ] = 'add/new/href/data/here';
     $this->template->set('linkValues', $this->linkValues);
     // store the link labels
     $this->linkLabels['add'] = $this->labels->getLabel('[Add]');
     $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 page labels
     // NOTE: use this location to update any label tags ...
     // example:
     $moduleManager = new RowManager_ModuleManager($this->module_id);
     $name = $moduleManager->getModuleName();
     $this->labels->setLabelTag('[Title]', '[moduleName]', $name);
     $this->template->setXML('pageLabels', $this->labels->getLabelXML());
     // store XML List of Applicants ...
     $this->template->setXML('dataList', $this->listManager->getXML());
     /*
      *  Set up any additional data transfer to the Template here...
      */
     $pageTypeArray = RowManager_PageManager::getPageTypeArray();
     $this->template->set('list_page_type', $pageTypeArray);
     $daObjList = new DAObjList($this->module_id);
     $listArray = $daObjList->getDroplistArray();
     $this->template->set('list_page_rowMgrID', $listArray);
     $this->template->set('list_page_listMgrID', $listArray);
     $templateName = 'siteDataList.php';
     // if you are creating a custom template for this page then
     // replace $templateName with the following:
     //$templateName = 'page_ViewPages.php';
     return $this->template->fetch($templateName);
 }