Пример #1
0
 public function executeCommand()
 {
     /**
      * @var $ilNavigationHistory ilNavigationHistory
      * @var $ilAccess ilAccessHandler
      * @var $ilCtrl ilCtrl
      * @var $ilTabs ilTabsGUI
      * @var $ilErr  ilErrorHandling
      * @var $ilUser ilObjUser
      */
     global $ilNavigationHistory, $ilAccess, $ilCtrl, $ilTabs, $ilErr, $ilUser;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $exclude_cmds = array('viewThread', 'markPostUnread', 'markPostRead', 'showThreadNotification', 'cancelPostActivation', 'cancelPostDeactivation', 'performPostActivation', 'performPostDeactivation', 'performPostAndChildPostsActivation', 'askForPostActivation', 'askForPostDeactivation', 'toggleThreadNotification', 'toggleThreadNotificationTab', 'toggleStickiness', 'cancelPost', 'savePost', 'quotePost', 'getQuotationHTMLAsynch', 'setTreeStateAsynch', 'fetchTreeChildrenAsync');
     if (!in_array($cmd, $exclude_cmds)) {
         $this->prepareOutput();
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && !$ilCtrl->isAsynch() && $ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
         $ilNavigationHistory->addItem($_GET['ref_id'], 'ilias.php?baseClass=ilRepositoryGUI&cmd=showThreads&ref_id=' . $_GET['ref_id'], 'frm');
     }
     switch ($next_class) {
         case 'ilpermissiongui':
             require_once 'Services/AccessControl/classes/class.ilPermissionGUI.php';
             $perm_gui = new ilPermissionGUI($this);
             $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'ilforumexportgui':
             require_once 'Modules/Forum/classes/class.ilForumExportGUI.php';
             $fex_gui = new ilForumExportGUI($this);
             $this->ctrl->forwardCommand($fex_gui);
             exit;
             break;
         case 'ilforummoderatorsgui':
             require_once 'Modules/Forum/classes/class.ilForumModeratorsGUI.php';
             $fm_gui = new ilForumModeratorsGUI($this);
             $this->ctrl->forwardCommand($fm_gui);
             break;
         case 'ilinfoscreengui':
             $this->infoScreen();
             break;
         case 'ilcolumngui':
             $this->showThreadsObject();
             break;
         case 'ilpublicuserprofilegui':
             include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
             $profile_gui = new ilPublicUserProfileGUI((int) $_GET['user']);
             $add = $this->getUserProfileAdditional((int) $_GET['ref_id'], (int) $_GET['user']);
             $profile_gui->setAdditional($add);
             $ret = $this->ctrl->forwardCommand($profile_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilobjectcopygui':
             include_once 'Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('frm');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilexportgui':
             $ilTabs->setTabActive('export');
             include_once 'Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this);
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         case "ilratinggui":
             if (!$this->objProperties->isIsThreadRatingEnabled() || $ilUser->isAnonymous()) {
                 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE);
             }
             require_once 'Services/Rating/classes/class.ilRatingGUI.php';
             $rating_gui = new ilRatingGUI();
             $rating_gui->setObject($this->object->getId(), $this->object->getType(), $this->objCurrentTopic->getId(), 'thread');
             $ilCtrl->setParameter($this, 'thr_pk', (int) $_GET['thr_pk']);
             $this->ctrl->forwardCommand($rating_gui);
             $avg = ilRating::getOverallRatingForObject($this->object->getId(), $this->object->getType(), (int) $_GET['thr_pk'], 'thread');
             $this->objCurrentTopic->setAverageRating($avg['avg']);
             $this->objCurrentTopic->update();
             $ilCtrl->redirect($this, "showThreads");
             break;
         case 'ilcommonactiondispatchergui':
             include_once 'Services/Object/classes/class.ilCommonActionDispatcherGUI.php';
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         default:
             // alex, 11 Jan 2011:
             // I inserted this workaround due to bug report 6971.
             // In general the command handling is quite obscure here.
             // The form action of the table should be filled
             // with $ilCtrl->getFormAction(..) not with $ilCtrl->getLinkTarget(..)
             // Commands should be determined with $ilCtrl->getCmd() not
             // with accessing $_POST['selected_cmd'], since this is internal
             // of ilTable2GUI/ilCtrl and may change.
             if (isset($_POST['select_cmd2'])) {
                 $_POST['selected_cmd'] = $_POST["selected_cmd2"];
             }
             if (isset($_POST['selected_cmd']) && $_POST['selected_cmd'] != null) {
                 $member_cmd = array('enableAdminForceNoti', 'disableAdminForceNoti', 'enableHideUserToggleNoti', 'disableHideUserToggleNoti');
                 in_array($_POST['selected_cmd'], $member_cmd) ? $cmd = $_POST['selected_cmd'] : ($cmd = 'performThreadsAction');
             } else {
                 if (!$cmd && !$_POST['selected_cmd']) {
                     $cmd = 'showThreads';
                 }
             }
             $cmd .= 'Object';
             $this->{$cmd}();
             break;
     }
     // suppress for topic level
     if ($cmd != 'viewThreadObject' && $cmd != 'showUserObject') {
         $this->addHeaderAction();
     }
 }