/** * 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(); }
/** * function processTransition * <pre> * Takes the Transition info and updates the app_MODULENAME file to * insert the form auto transitions. * </pre> * @param $moduleID [INTEGER] The module id of the Pages to work with * @return [void] */ function processTransition($moduleID) { // get form transition template $pathToTemplates = $this->values[ModuleCreator::KEY_PATH_RAD_ROOT]; $pathToTemplates .= 'data/code/'; $contentsTemplate = file_get_contents($pathToTemplates . 'formTrans_FormStyle.php'); $contentsTemplate = $this->replaceCommonTags($contentsTemplate); // open app file $appFileName = $this->values[ModuleCreator::KEY_PATH_APP_NAME]; $appFileContents = file_get_contents($appFileName); $transitionsList = new TransitionsList($moduleID); // for each transition $transitionsList->setFirst(); while ($transition = $transitionsList->getNext()) { // if transition is a form type if ($transition->isFormType()) { // if transition not already created if (!$transition->isCreated()) { // get source page info $sourcePage = $transition->getFromPageObj(); // NOTE: this one uses the Template above as the initial // code source. $tag = ModuleCreator::TAG_TRANSITION_SOURCE_CONSTNAME; $data = $sourcePage->getPageConstantName(); $contents = str_replace($tag, $data, $contentsTemplate); // replace the Source Page's init var back to '' $tag = '[RAD_SOURCE_FORMINIT]'; $daObj = $sourcePage->getFormDAObj(); $stateVar = $daObj->getFormInitStateVar(); if ($stateVar->isLoaded()) { $data = '$this->' . $stateVar->getName() . " = '';"; } else { $data = '/* No StateVar given for FormInit. */'; } $contents = str_replace($tag, $data, $contents); // get destiniation page info $destPage = $transition->getToPageObj(); $tag = ModuleCreator::TAG_TRANSITION_DEST_CONSTNAME; $data = $destPage->getPageConstantName(); $contents = str_replace($tag, $data, $contents); $tag = ModuleCreator::TAG_TRANSITION_DEST_NAME; $data = $destPage->getPageName(); $contents = str_replace($tag, $data, $contents); // save data into App file $tag = ModuleCreator::TAG_TRANSITION_CODE; $data = $contents . "\n\n" . $tag; $appFileContents = str_replace($tag, $data, $appFileContents); // Mark this transition as having been created $transition->setCreated(); } // end if } // end if form type } // next page // save app file file_put_contents($appFileName, $appFileContents); }