/**
  * @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;
 }