loadStrings(array( 'administration' => '' )); } /** * Invoke method, every class will have its own * returns true/false on completion, setting both * errormsg and output as necessary */ function invoke() { parent::invoke(); $result = true; /// Set own core attributes $this->does_generate = ACTION_NONE; //$this->does_generate = ACTION_GENERATE_HTML; /// These are always here global $CFG, $XMLDB; /// Do the job, setting result as needed /// Get parameters $dirpath = required_param('dir', PARAM_PATH); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath); $statementparam = strtolower(required_param('statement', PARAM_CLEAN)); $name = trim(strtolower(required_param('name', PARAM_CLEAN))); $comment = required_param('comment', PARAM_CLEAN); $comment = stripslashes_safe($comment); $editeddir =& $XMLDB->editeddirs[$dirpath]; $structure =& $editeddir->xml_file->getStructure(); $statement =& $structure->getStatement($statementparam); $errors = array(); /// To store all the errors found /// If there is one name change, do it, changing the prev and next /// atributes of the adjacent tables if ($statementparam != $name) { $statement->setName($name); if ($statement->getPrevious()) { $prev =& $structure->getStatement($statement->getPrevious()); $prev->setNext($name); $prev->setChanged(true); } if ($statement->getNext()) { $next =& $structure->getStatement($statement->getNext()); $next->setPrevious($name); $next->setChanged(true); } } /// Set comment $statement->setComment($comment); /// Launch postaction if exists (leave this here!) if ($this->getPostAction() && $result) { return $this->launch($this->getPostAction()); } /// Return ok if arrived here return $result; } } ?>