sesskey_protected = false; // This action doesn't need sesskey protection /// Get needed strings $this->loadStrings(array( 'change' => 'xmldb', 'vieworiginal' => 'xmldb', 'viewedited' => 'xmldb', 'newsentence' => 'xmldb', 'sentences' => 'xmldb', 'edit' => 'xmldb', 'delete' => 'xmldb', 'duplicate' => 'xmldb', 'back' => 'xmldb' )); } /** * 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_GENERATE_HTML; /// These are always here global $CFG, $XMLDB; /// Do the job, setting result as needed /// Get the dir containing the file $dirpath = required_param('dir', PARAM_PATH); $dirpath = $CFG->dirroot . stripslashes_safe($dirpath); /// Get the correct dirs if (!empty($XMLDB->dbdirs)) { $dbdir =& $XMLDB->dbdirs[$dirpath]; } else { return false; } if (!empty($XMLDB->editeddirs)) { $editeddir =& $XMLDB->editeddirs[$dirpath]; $structure =& $editeddir->xml_file->getStructure(); } /// ADD YOUR CODE HERE $statementparam = optional_param('statement', NULL, PARAM_CLEAN); /// If no statement, then we are coming for a new one. Look for /// type and table and build the correct statementparam if (!$statementparam) { $typeparam = optional_param('type', NULL, PARAM_CLEAN); $tableparam = optional_param('table', NULL, PARAM_CLEAN); $typename = XMLDBStatement::getXMLDBStatementName($typeparam); $statementparam = trim(strtolower($typename . ' ' . $tableparam)); } if (!$statement =& $structure->getStatement($statementparam)) { /// Arriving here from a name change, looking for the new statement name $statementname = required_param('name', PARAM_CLEAN); $statement =& $structure->getStatement($statementparam); } $dbdir =& $XMLDB->dbdirs[$dirpath]; $origstructure =& $dbdir->xml_file->getStructure(); /// Add the main form $o = '
'; /// Calculate the buttons $b = ' '; $o .= $b; /// Delete any 'changeme' sentence ///$statement->deleteSentence('changeme'); /// Add the fields list $sentences =& $statement->getSentences(); if (!empty($sentences)) { $o .= ''; /// The edit button $b .= '[' . $this->str['edit'] . ']'; $b .= ' | '; /// The duplicate button $b .= '[' . $this->str['duplicate'] . ']'; $b .= ' | '; /// The delete button $b .= '[' . $this->str['delete'] . ']'; $b .= ' | '; /// Print table row $o .= '
' . $p . $sentence . $b . ' |