コード例 #1
0
 /**
  * @see Action::execute()
  */
 public function execute()
 {
     parent::execute();
     // check permission
     WCF::getUser()->checkPermission('admin.user.rank.canDeleteRank');
     // delete rank
     require_once WCF_DIR . 'lib/data/user/rank/UserRankEditor.class.php';
     $userRank = new UserRankEditor($this->rankID);
     if (!$userRank->rankID) {
         throw new IllegalLinkException();
     }
     $userRank->delete();
     $this->executed();
     // forward to list page
     HeaderUtil::redirect('index.php?page=UserRankList&deletedRankID=' . $this->rankID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED);
     exit;
 }
コード例 #2
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     $this->rankID = UserRankEditor::create($this->title, $this->image, $this->groupID, $this->neededPoints, $this->gender, $this->repeatImage);
     $this->saved();
     // reset values
     $this->groupID = Group::getGroupIdByType(Group::USERS);
     $this->neededPoints = $this->gender = 0;
     $this->repeatImage = 1;
     $this->title = $this->image = '';
     // show success message
     WCF::getTPL()->assign('success', true);
 }