/** * @see Action::execute() */ public function execute() { parent::execute(); // check permissions WCF::getUser()->checkPermission('admin.contest.canDeleteClass'); // delete $this->contestClass->delete(); $this->executed(); // forward to list page header('Location: index.php?page=ContestClassList&deletedclassID=' . $this->contestClassID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission WCF::getUser()->checkPermission('admin.contest.canEditItem'); // get class item $contestClass = new ContestClassEditor($this->contestClassID); if (!$contestClass->contestClassID) { throw new IllegalLinkException(); } $contestClass->updateTranslation($this->title, null, WCF::getLanguage()->getLanguageID()); $this->executed(); }
/** * Creates a new class. * * @param string $title * @return ContestClassEditor */ public static function create($title, $text = '', $parentClassID = 0, $position = 0, $languageID = 0) { if ($position == 0) { // get next number in row $sql = "SELECT\tMAX(position) AS position\n\t\t\t\tFROM\twcf" . WCF_N . "_contest_class\n\t\t\t\tWHERE\tparentClassID = " . intval($parentClassID); $row = WCF::getDB()->getFirstRow($sql); if (!empty($row)) { $position = intval($row['position']) + 1; } else { $position = 1; } } $sql = "INSERT INTO\twcf" . WCF_N . "_contest_class\n\t\t\t\t\t(classID, parentClassID, position)\n\t\t\tVALUES\t\t('" . escapeString($title) . "', " . intval($parentClassID) . ", " . intval($position) . ")"; WCF::getDB()->sendQuery($sql); // get new id $classID = WCF::getDB()->getInsertID("wcf" . WCF_N . "_contest_class", 'classID'); $obj = new ContestClassEditor($classID); $obj->updateTranslation($title, $text, $languageID); return $obj; }
/** * @see Action::execute() */ public function execute() { parent::execute(); // check permissions WCF::getUser()->checkPermission('admin.contest.canEditClass'); // update postions $pos = $parent = array(); foreach ($this->positions as $classID => $row) { foreach ($row as $parentClassID => $position) { $parent[$classID] = $parentClassID; $pos[$classID] = $position; } } ContestClassEditor::updatePositions($pos); ContestClassEditor::updateParents($parent); $this->executed(); // forward to list page HeaderUtil::redirect('index.php?page=ContestClassList&classID=' . $this->classID . '&successfullSorting=1&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); exit; }
public function testReflectionAPI() { require_once WCF_DIR . 'lib/data/contest/class/ContestClassEditor.class.php'; $this->deleteArray[] = $class = ContestClassEditor::create($title = __METHOD__ . ' title'); $this->callAllMethodsWithoutRequiredParameters($class); }
/** * @see Form::save() */ public function save() { parent::save(); // save $this->contestClass = ContestClassEditor::create($this->topic, $this->text, $this->parentClassID, $this->position, WCF::getLanguage()->getLanguageID()); $this->saved(); // reset values $this->topic = $this->text = $this->parentClassID = ''; $this->languageID = $this->position = 0; // show success message WCF::getTPL()->assign('success', true); }