/**
  * Get command target frame
  *
  * @param	string		$a_cmd			command
  *
  * @return	string		command target frame
  */
 function getCommandFrame($a_cmd)
 {
     global $ilias;
     switch ($a_cmd) {
         case "view":
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             //$showViewInFrameset = $ilias->ini->readVariable("layout","view_target") == "frame";
             $showViewInFrameset = true;
             $isBuyable = ilPaymentObject::_isBuyable($this->ref_id);
             if ($isBuyable && ilPaymentObject::_hasAccess($this->ref_id) == false || $showViewInFrameset) {
                 //$frame = ilFrameTargetInfo::_getFrame("MainContent");
                 $frame = "ilContObj" . $this->obj_id;
             } else {
                 $frame = "ilContObj" . $this->obj_id;
             }
             break;
         case "edit":
             $frame = ilFrameTargetInfo::_getFrame("MainContent");
             break;
         default:
             $frame = "";
             break;
     }
     return $frame;
 }
 /**
  * Get command target frame
  *
  * @param	string		$a_cmd			command
  *
  * @return	string		command target frame
  */
 function getCommandFrame($a_cmd)
 {
     if (IS_PAYMENT_ENABLED) {
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         if (ilPaymentObject::_isBuyable($this->ref_id) && !ilPaymentObject::_hasAccess($this->ref_id)) {
             return '';
         }
     }
     $frame = "";
     switch ($a_cmd) {
         // BEGIN WebDAV: View inline objects in a blank window
         case 'sendfile':
             require_once 'Modules/File/classes/class.ilObjFileAccess.php';
             if (ilObjFileAccess::_isFileInline($this->title)) {
                 $frame = '_blank';
             }
             break;
             // END WebDAV View inline objects in a blank window
         // END WebDAV View inline objects in a blank window
         case "":
             $frame = ilFrameTargetInfo::_getFrame("RepositoryContent");
             break;
         default:
     }
     return $frame;
 }
 /**
  * Sends a notification message to all users responsible for vat assignment.
  * 
  * @access	public
  * @static
  * @param	ilPaymentObject $oPaymentObject
  */
 public static function _sendNotificationToVATAdministration($oPaymentObject)
 {
     global $ilSetting, $lng, $ilClientIniFile;
     $payment_vat_admins = $ilSetting->get('payment_vat_admins');
     $users = explode(',', $payment_vat_admins);
     $subject = $lng->txt('payment_vat_assignment_notification_subject');
     $tmp_obj = ilObjectFactory::getInstanceByRefId($oPaymentObject->getRefId());
     $message = sprintf($lng->txt('payment_vat_assignment_notification_body'), $tmp_obj->getTitle()) . "\n\n";
     $message .= "------------------------------------------------------------\n";
     $message .= sprintf($lng->txt('payment_vat_assignment_notification_intro'), $ilClientIniFile->readVariable('client', 'name'), ILIAS_HTTP_PATH . '/?client_id=' . CLIENT_ID);
     include_once 'Services/Mail/classes/class.ilMail.php';
     $mail_obj = new ilMail(ANONYMOUS_USER_ID);
     foreach ((array) $users as $login) {
         if (strlen(trim($login)) && (int) ilObjUser::_lookupId(trim($login))) {
             $success = $mail_obj->sendMail(trim($login), '', '', $subject, $message, array(), array("system"));
         }
     }
 }
 function ilLMPresentationGUI()
 {
     global $ilias, $lng, $tpl, $rbacsystem, $ilCtrl, $ilAccess;
     // load language vars
     $lng->loadLanguageModule("content");
     $this->ilias =& $ilias;
     $this->lng =& $lng;
     $this->tpl =& $tpl;
     $this->offline = false;
     $this->frames = array();
     $this->ctrl =& $ilCtrl;
     $this->ctrl->saveParameter($this, array("ref_id"));
     $this->lm_set = new ilSetting("lm");
     // Todo: check lm id
     $type = $this->ilias->obj_factory->getTypeByRefId($_GET["ref_id"]);
     // TODO: WE NEED AN OBJECT FACTORY FOR GUI CLASSES
     switch ($type) {
         case "dbk":
             include_once "./Modules/LearningModule/classes/class.ilObjDlBookGUI.php";
             $this->lm_gui = new ilObjDlBookGUI($data, $_GET["ref_id"], true, false);
             break;
         case "lm":
             include_once "./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php";
             $this->lm_gui = new ilObjLearningModuleGUI($data, $_GET["ref_id"], true, false);
             break;
     }
     $this->lm =& $this->lm_gui->object;
     if (IS_PAYMENT_ENABLED) {
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         $this->needs_to_be_purchased = ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm->getRefId());
     } else {
         $this->needs_to_be_purchased = false;
     }
     // check, if learning module is online
     if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
         if (!$this->lm->getOnline()) {
             $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
         }
     }
     $this->lm_tree = new ilTree($this->lm->getId());
     $this->lm_tree->setTableNames('lm_tree', 'lm_data');
     $this->lm_tree->setTreeTablePK("lm_id");
     // do digilib book initialisation stuff
     if ($type == "dbk") {
         $this->abstract = true;
         $this->setSessionVars();
         if (count($_POST["tr_id"]) > 1 or !$_POST["target"] and ($_POST["action"] == "show" or $_POST["action"] == "show_citation")) {
             $this->abstract = true;
         } else {
             if ($_GET["obj_id"] or $_POST["action"] == "show" or $_POST["action"] == "show_citation") {
                 $this->abstract = false;
             }
         }
     }
 }
 function ilLMPresentationGUI()
 {
     global $ilUser, $lng, $tpl, $rbacsystem, $ilCtrl, $ilAccess;
     // load language vars
     $lng->loadLanguageModule("content");
     $this->lng = $lng;
     $this->tpl = $tpl;
     $this->offline = false;
     $this->frames = array();
     $this->ctrl = $ilCtrl;
     $this->ctrl->saveParameter($this, array("ref_id", "transl", "focus_id", "focus_return"));
     $this->lm_set = new ilSetting("lm");
     include_once "./Modules/LearningModule/classes/class.ilObjLearningModuleGUI.php";
     $this->lm_gui = new ilObjLearningModuleGUI($data, $_GET["ref_id"], true, false);
     $this->lm = $this->lm_gui->object;
     // language translation
     include_once "./Services/Object/classes/class.ilObjectTranslation.php";
     $this->ot = ilObjectTranslation::getInstance($this->lm->getId());
     //include_once("./Services/COPage/classes/class.ilPageMultiLang.php");
     //$this->ml = new ilPageMultiLang("lm", $this->lm->getId());
     $this->lang = "-";
     if ($this->ot->getContentActivated()) {
         $langs = $this->ot->getLanguages();
         if (isset($langs[$_GET["transl"]]) || $_GET["transl"] == $this->ot->getMasterLanguage()) {
             $this->lang = $_GET["transl"];
         } else {
             if (isset($langs[$ilUser->getCurrentLanguage()])) {
                 $this->lang = $ilUser->getCurrentLanguage();
             }
         }
         if ($this->lang == $this->ot->getMasterLanguage()) {
             $this->lang = "-";
         }
     }
     if (IS_PAYMENT_ENABLED) {
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         $this->needs_to_be_purchased = ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm->getRefId());
     } else {
         $this->needs_to_be_purchased = false;
     }
     // check, if learning module is online
     if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
         if (!$this->lm->getOnline()) {
             $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
         }
     }
     include_once "./Modules/LearningModule/classes/class.ilLMTree.php";
     $this->lm_tree = ilLMTree::getInstance($this->lm->getId());
     /*$this->lm_tree = new ilTree($this->lm->getId());
     		$this->lm_tree->setTableNames('lm_tree','lm_data');
     		$this->lm_tree->setTreeTablePK("lm_id");*/
     if ((int) $_GET["focus_id"] > 0 && $this->lm_tree->isInTree((int) $_GET["focus_id"])) {
         $this->focus_id = (int) $_GET["focus_id"];
     }
 }
 /**
  * check if links for certain object type are activated
  *
  * @param	string		$a_type			object type
  *
  * @return	boolean		true if linking is activated
  */
 function isClickable($a_type, $a_obj_id = 0)
 {
     global $ilUser;
     // in this standard implementation
     // only the type determines, wether an object should be clickable or not
     // but this method can be overwritten and make use of the ref id
     // (this happens e.g. in class ilRepositoryExplorerGUI)
     if ($this->is_clickable[$a_type] == "n") {
         return false;
     }
     // check public access
     include_once 'Services/Payment/classes/class.ilPaymentObject.php';
     if (($ilUser->getId() == ANONYMOUS_USER_ID || ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm_obj->getRefId())) && !ilLMObject::_isPagePublic($a_obj_id, true)) {
         return false;
     }
     return true;
 }
 /**
  * overwritten method from baseclass
  * @param mixed $node
  * @return bool
  */
 function isNodeClickable($node)
 {
     global $ilUser;
     switch ($node['type']) {
         case 'lm':
         case 'crs':
         case 'tst':
         case 'sahs':
         case 'file':
         case 'htlm':
         case 'exc':
         case 'glo':
             break;
         default:
             return false;
     }
     if ($this->classname == 'ilpaymentstatisticgui') {
         if (ilPaymentObject::_isPurchasable($node['ref_id'], $ilUser->getId(), true)) {
             return true;
         }
     } else {
         if ($this->classname == 'ilobjpaymentsettingsgui') {
             if (ilPaymentObject::_isPurchasable($node['ref_id'])) {
                 return true;
             }
         } else {
             if ($this->classname == 'ilpaymentobjectgui') {
                 // object doesn't exist in payment_object
                 if (ilPaymentObject::_isNewObject($node['ref_id'])) {
                     return true;
                 }
             } else {
                 if (ilPaymentObject::_isPurchasable($node['ref_id'])) {
                     return true;
                 }
             }
         }
     }
     return false;
 }
 public function purchase($tid)
 {
     global $lng;
     $this->getDebtor();
     $this->deb->createInvoice();
     $products = array();
     foreach ($this->sc as $i) {
         $pod = ilPaymentObject::_getObjectData($i['pobject_id']);
         $bo = new ilPaymentBookings($this->ilUser->getId());
         $ilias_tid = $this->ilUser->getId() . "_" . $tid;
         // psc_id, pobject_id, obj_id, typ, betrag_string
         $bo->setTransaction($ilias_tid);
         $bo->setPobjectId(isset($i['pobject_id']) ? $i['pobject_id'] : 0);
         $bo->setCustomerId($this->ilUser->getId());
         $bo->setVendorId($pod['vendor_id']);
         $bo->setPayMethod($this->paytype);
         $bo->setOrderDate(time());
         // $bo->setDuration($i['dauer']); // duration
         // $bo->setPrice(  $i['betrag'] ); // amount
         //$bo->setPrice( ilPaymentPrices::_getPriceString( $i['price_id'] ));
         $bo->setDuration($i['duration']);
         $bo->setPrice($i['price_string']);
         $bo->setDiscount(0);
         $bo->setVoucher('');
         $bo->setVatRate($i['vat_rate']);
         $bo->setVatUnit($i['vat_unit']);
         $bo->setTransactionExtern($tid);
         // $product_name = $i['buchungstext'];
         //$duration = $i['dauer'];
         //$amount = $i['betrag'];
         $product_name = $i['object_title'];
         $duration = $i['duration'];
         $amount = $i['price'];
         // -> ? $i['price_string']
         include_once './Services/Payment/classes/class.ilPayMethods.php';
         $save_adr = (int) ilPaymethods::_EnabledSaveUserAddress($this->paytype) ? 1 : 0;
         //if($save_adr == 1)
         //{
         $bo->setStreet($this->ilUser->getStreet(), '');
         $bo->setPoBox('');
         //$this->ilUser->);
         $bo->setZipcode($this->ilUser->getZipcode());
         $bo->setCity($this->ilUser->getCity());
         $bo->setCountry($this->ilUser->getCountry());
         //}
         $bo->setPayed(1);
         $bo->setAccess(1);
         $bo->setAccessExtension($this->sc['extension']);
         $boid = $bo->add();
         //$bo->update();
         if ($i['typ'] == 'crs') {
             include_once './Modules/Course/classes/class.ilCourseParticipants.php';
             $this->deb->createInvoiceLine(0, $product_name . " (" . $duration . ")", 1, $amount);
             $products[] = $product_name;
             $obj_id = ilObject::_lookupObjId($pod["ref_id"]);
             $cp = ilCourseParticipants::_getInstanceByObjId($obj_id);
             $cp->add($this->ilUser->getId(), IL_CRS_MEMBER);
             $cp->sendNotification($cp->NOTIFY_ACCEPT_SUBSCRIBER, $this->ilUser->getId());
         }
     }
     $inv = $this->deb->bookInvoice();
     $invoice_number = $this->deb->getInvoiceNumber();
     $attach = $this->deb->getInvoicePDF($inv);
     $this->deb->saveInvoice($attach, false);
     $lng->loadLanguageModule('payment');
     $this->deb->sendInvoice($lng->txt('pay_order_paid_subject'), $this->ilUser->getFullName() . ",\n" . str_replace('%products%', implode(", ", $products), $lng->txt('pay_order_paid_body')), $this->ilUser->getEmail(), $attach, $lng->txt('pays_invoice') . "-" . $invoice_number);
     $this->cart->emptyShoppingCart();
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilUser, $ilLocator, $ilTabs;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) {
         $this->prepareOutput();
     } else {
         if (!in_array($cmd, array("", "framset")) || $next_class != "") {
             $this->getTemplate();
             $this->setLocator();
             $this->setTabs();
         }
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 return true;
             }
         }
     }
     switch ($next_class) {
         case 'ilmdeditorgui':
             $this->checkPermission("write");
             $ilTabs->activateTab('id_meta_data');
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "ilfilesystemgui":
             $this->checkPermission("write");
             $ilTabs->activateTab('id_list_files');
             $fs_gui =& new ilFileSystemGUI($this->object->getDataDirectory());
             $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
             $fs_gui->setTableId("htlmfs" . $this->object->getId());
             if ($this->object->getStartFile() != "") {
                 $fs_gui->labelFile($this->object->getStartFile(), $this->lng->txt("cont_startfile"));
             }
             $fs_gui->addCommand($this, "setStartFile", $this->lng->txt("cont_set_start_file"));
             $ret =& $this->ctrl->forwardCommand($fs_gui);
             break;
         case "ilinfoscreengui":
             $ret =& $this->outputInfoScreen();
             break;
         case "illearningprogressgui":
             $ilTabs->activateTab('id_learning_progress');
             include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY, $this->object->getRefId(), $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case 'ilpermissiongui':
             $ilTabs->activateTab('id_permissions');
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'illicensegui':
             $ilTabs->activateTab('id_license');
             include_once "./Services/License/classes/class.ilLicenseGUI.php";
             $license_gui =& new ilLicenseGUI($this);
             $ret =& $this->ctrl->forwardCommand($license_gui);
             break;
         case "ilexportgui":
             $ilTabs->activateTab("export");
             include_once "./Services/Export/classes/class.ilExportGUI.php";
             $exp_gui = new ilExportGUI($this);
             $exp_gui->addFormat("xml");
             $exp_gui->addFormat("html", "", $this, "exportHTML");
             $ret = $this->ctrl->forwardCommand($exp_gui);
             //				$this->tpl->show();
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd = $this->ctrl->getCmd("frameset");
             if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) {
                 $cmd .= "Object";
             }
             $ret =& $this->{$cmd}();
             break;
     }
     $this->addHeaderAction();
 }
Example #10
0
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilAccess, $ilNavigationHistory, $ilCtrl, $ilErr, $tpl, $lng, $ilTabs, $ilPluginAdmin, $ilDB, $tree, $ilias, $ilUser;
     if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilias->raiseError($this->lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
     }
     $cmd = $this->ctrl->getCmd("infoScreen");
     $cmdsDisabledDueToOfflineStatus = array('resumePlayer', 'resumePlayer', 'outUserResultsOverview', 'outUserListOfAnswerPasses');
     if (!$this->getCreationMode() && !$this->object->isOnline() && in_array($cmd, $cmdsDisabledDueToOfflineStatus)) {
         $cmd = 'infoScreen';
     }
     $next_class = $this->ctrl->getNextClass($this);
     $this->ctrl->setReturn($this, "infoScreen");
     if (method_exists($this->object, "getTestStyleLocation")) {
         $this->tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     }
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?baseClass=ilObjTestGUI&cmd=infoScreen&ref_id=" . $_GET["ref_id"], "tst");
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             require_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->setLocator();
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 $this->tpl->show();
                 exit;
             }
         }
     }
     // elba hack for storing question id for inserting new question after
     if ($_REQUEST['prev_qid']) {
         global $___prev_question_id;
         $___prev_question_id = $_REQUEST['prev_qid'];
         $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
     }
     if (!$this->getCreationMode() && $this->testQuestionSetConfigFactory->getQuestionSetConfig()->areDepenciesBroken()) {
         if (!$this->isValidRequestOnBrokenQuestionSetDepencies($next_class, $cmd)) {
             $this->ctrl->redirectByClass('ilObjTestGUI', 'infoScreen');
         }
     }
     $this->determineObjectiveOrientedContainer();
     switch ($next_class) {
         case 'iltestexportgui':
             if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestExportGUI.php';
             $ilCtrl->forwardCommand(new ilTestExportGUI($this));
             break;
         case "ilinfoscreengui":
             $this->prepareOutput();
             $this->addHeaderAction();
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "iltestplayerfixedquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerFixedQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerFixedQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerrandomquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerRandomQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerRandomQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestplayerdynamicquestionsetgui":
             require_once "./Modules/Test/classes/class.ilTestPlayerDynamicQuestionSetGUI.php";
             if (!$this->object->getKioskMode()) {
                 $this->prepareOutput();
             }
             $gui = new ilTestPlayerDynamicQuestionSetGUI($this->object);
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $this->ctrl->forwardCommand($gui);
             break;
         case "iltestevaluationgui":
             $this->forwardToEvaluationGUI();
             break;
         case "iltestevalobjectiveorientedgui":
             $this->forwardToEvalObjectiveOrientedGUI();
             break;
         case "iltestservicegui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestServiceGUI.php";
             $serviceGUI =& new ilTestServiceGUI($this->object);
             $this->ctrl->forwardCommand($serviceGUI);
             break;
         case 'ilpermissiongui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case "illearningprogressgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "ilcertificategui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             require_once "./Modules/Test/classes/class.ilTestCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilTestCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case "iltestscoringgui":
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once "./Modules/Test/classes/class.ilTestScoringGUI.php";
             $output_gui = new ilTestScoringGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilmarkschemagui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
                 $this->ctrl->redirect($this, 'infoScreen');
             }
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilMarkSchemaGUI.php';
             $mark_schema_gui = new ilMarkSchemaGUI($this->object);
             $this->ctrl->forwardCommand($mark_schema_gui);
             break;
         case 'iltestscoringbyquestionsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             include_once 'Modules/Test/classes/class.ilTestScoringByQuestionsGUI.php';
             $output_gui = new ilTestScoringByQuestionsGUI($this->object);
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjtestsettingsgeneralgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsGeneralGUI.php';
             $gui = new ilObjTestSettingsGeneralGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $ilUser, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestsettingsscoringresultsgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestSettingsScoringResultsGUI.php';
             $gui = new ilObjTestSettingsScoringResultsGUI($this->ctrl, $ilAccess, $this->lng, $this->tpl, $this->tree, $ilDB, $ilPluginAdmin, $this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjtestdynamicquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfigGUI.php';
             $gui = new ilObjTestDynamicQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestrandomquestionsetconfiggui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestRandomQuestionSetConfigGUI.php';
             $gui = new ilTestRandomQuestionSetConfigGUI($this->ctrl, $ilAccess, $ilTabs, $this->lng, $this->tpl, $ilDB, $tree, $ilPluginAdmin, $this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestquestionbrowsertablegui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/tables/class.ilTestQuestionBrowserTableGUI.php';
             $gui = new ilTestQuestionBrowserTableGUI($this->ctrl, $this->tpl, $ilTabs, $this->lng, $tree, $ilDB, $ilPluginAdmin, $this->object);
             $gui->setWriteAccess($ilAccess->checkAccess("write", "", $this->ref_id));
             $gui->init();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskilladministrationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/Test/classes/class.ilTestSkillAdministrationGUI.php';
             $gui = new ilTestSkillAdministrationGUI($ilias, $this->ctrl, $ilAccess, $ilTabs, $this->tpl, $this->lng, $ilDB, $tree, $ilPluginAdmin, $this->object, $this->ref_id);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'iltestskillevaluationgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionList.php';
             if ($this->object->isDynamicTest()) {
                 require_once 'Modules/Test/classes/class.ilObjTestDynamicQuestionSetConfig.php';
                 $dynamicQuestionSetConfig = new ilObjTestDynamicQuestionSetConfig($tree, $ilDB, $ilPluginAdmin, $this->object);
                 $dynamicQuestionSetConfig->loadFromDb();
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($dynamicQuestionSetConfig->getSourceQuestionPoolId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_ORIGINALS);
             } else {
                 $questionList = new ilAssQuestionList($ilDB, $this->lng, $ilPluginAdmin);
                 $questionList->setParentObjId($this->object->getId());
                 $questionList->setQuestionInstanceTypeFilter(ilAssQuestionList::QUESTION_INSTANCE_TYPE_DUPLICATES);
             }
             $questionList->load();
             require_once 'Modules/Test/classes/class.ilTestSessionFactory.php';
             $testSessionFactory = new ilTestSessionFactory($this->object);
             $testSession = $testSessionFactory->getSession();
             $testResults = $this->object->getTestResult($testSession->getActiveId(), $testSession->getPass(), true);
             require_once 'Modules/Test/classes/class.ilTestSkillEvaluationGUI.php';
             $gui = new ilTestSkillEvaluationGUI($this->ctrl, $ilTabs, $this->tpl, $this->lng, $ilDB, $this->object->getTestId(), $this->object->getRefId(), $this->object->getId());
             $gui->setObjectiveOrientedContainer($this->getObjectiveOrientedContainer());
             $gui->setQuestionList($questionList);
             $gui->setTestSession($testSession);
             $gui->setTestResults($testResults);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilobjectcopygui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('tst');
             $this->ctrl->forwardCommand($cp);
             break;
         case 'ilrepositorysearchgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             require_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             $rep_search->setCallback($this, 'addParticipantsObject', array());
             // Set tabs
             $this->ctrl->setReturn($this, 'participants');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->tabs_gui->setTabActive('participants');
             break;
         case 'ilpageeditorgui':
         case 'iltestexpresspageobjectgui':
             require_once 'Modules/TestQuestionPool/classes/class.ilAssIncompleteQuestionPurger.php';
             $incompleteQuestionPurger = new ilAssIncompleteQuestionPurger($ilDB);
             $incompleteQuestionPurger->setOwnerId($ilUser->getId());
             $incompleteQuestionPurger->purge();
             $qid = $_REQUEST['q_id'];
             // :FIXME: does not work
             // $this->ctrl->saveParameterByClass(array('iltestexpresspageobjectgui', 'assorderingquestiongui', 'ilpageeditorgui', 'ilpcquestion', 'ilpcquestiongui'), 'test_express_mode');
             if (!$qid || $qid == 'Array') {
                 $questions = $this->object->getQuestionTitlesAndIndexes();
                 if (!is_array($questions)) {
                     $questions = array();
                 }
                 $keys = array_keys($questions);
                 $qid = $keys[0];
                 $_REQUEST['q_id'] = $qid;
                 $_GET['q_id'] = $qid;
                 $_POST['q_id'] = $qid;
             }
             $this->prepareOutput();
             if (!in_array($cmd, array('addQuestion', 'browseForQuestions'))) {
                 $this->buildPageViewToolbar($qid);
             }
             if (!$qid || in_array($cmd, array('insertQuestions', 'browseForQuestions'))) {
                 require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
                 $pageObject = new ilTestExpressPageObjectGUI(0);
                 $pageObject->test_object = $this->object;
                 $ret =& $this->ctrl->forwardCommand($pageObject);
                 break;
             }
             require_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $this->tpl->setCurrentBlock("ContentStyle");
             $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
             $this->tpl->parseCurrentBlock();
             // syntax style
             $this->tpl->setCurrentBlock("SyntaxStyle");
             $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
             $this->tpl->parseCurrentBlock();
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI("", $qid);
             if (!$q_gui instanceof assQuestionGUI) {
                 $this->ctrl->setParameterByClass('iltestexpresspageobjectgui', 'q_id', '');
                 $this->ctrl->redirectByClass('iltestexpresspageobjectgui', $this->ctrl->getCmd());
             }
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question = $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             #$this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilTestExpressPageObjectGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPage.php";
             require_once "./Modules/Test/classes/class.ilTestExpressPageObjectGUI.php";
             $page_gui = new ilTestExpressPageObjectGUI($qid);
             $page_gui->test_object = $this->object;
             $page_gui->setEditPreview(true);
             $page_gui->setEnabledTabs(false);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $this->ctrl->setCmdClass(get_class($page_gui));
                 $this->ctrl->setCmd("preview");
             }
             $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $page_gui->setHeader($question->getTitle());
             $page_gui->setFileDownloadLink($this->ctrl->getLinkTarget($this, "downloadFile"));
             $page_gui->setFullscreenLink($this->ctrl->getLinkTarget($this, "fullscreen"));
             $page_gui->setSourcecodeDownloadScript($this->ctrl->getLinkTarget($this));
             $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             global $ilTabs;
             $ilTabs->activateTab('assQuestions');
             $this->tpl->setContent($ret);
             break;
         case 'ilassquestionpreviewgui':
             $this->prepareOutput();
             $this->ctrl->saveParameter($this, "q_id");
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionPreviewGUI.php';
             $gui = new ilAssQuestionPreviewGUI($this->ctrl, $this->tabs_gui, $this->tpl, $this->lng, $ilDB);
             $gui->initQuestion((int) $_GET['q_id'], $this->object->getId());
             $gui->initPreviewSettings($this->object->getRefId());
             $gui->initPreviewSession($ilUser->getId(), (int) $_GET['q_id']);
             $gui->initHintTracking();
             $gui->initStyleSheets();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionpagegui':
             require_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionPageGUI.php";
             //echo $_REQUEST['prev_qid'];
             if ($_REQUEST['prev_qid']) {
                 $this->ctrl->setParameter($this, 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->prepareOutput();
             //global $___test_express_mode;
             //$___test_express_mode = true;
             $_GET['calling_test'] = $this->object->getRefId();
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $this->tpl->setCurrentBlock("ContentStyle");
             $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath(0));
             $this->tpl->parseCurrentBlock();
             // syntax style
             $this->tpl->setCurrentBlock("SyntaxStyle");
             $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath());
             $this->tpl->parseCurrentBlock();
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui = assQuestionGUI::_getQuestionGUI("", $_GET["q_id"]);
             $q_gui->setQuestionTabs();
             $q_gui->outAdditionalOutput();
             $q_gui->object->setObjId($this->object->getId());
             $question =& $q_gui->object;
             $this->ctrl->saveParameter($this, "q_id");
             $this->lng->loadLanguageModule("content");
             $this->ctrl->setReturnByClass("ilAssQuestionPageGUI", "view");
             $this->ctrl->setReturn($this, "questions");
             $page_gui = new ilAssQuestionPageGUI($_GET["q_id"]);
             $page_gui->setEditPreview(true);
             if (strlen($this->ctrl->getCmd()) == 0) {
                 $this->ctrl->setCmdClass(get_class($page_gui));
                 $this->ctrl->setCmd("preview");
             }
             $page_gui->setQuestionHTML(array($q_gui->object->getId() => $q_gui->getPreview(TRUE)));
             $page_gui->setTemplateTargetVar("ADM_CONTENT");
             $page_gui->setOutputMode($this->object->evalTotalPersons() == 0 ? "edit" : 'preview');
             $page_gui->setHeader($question->getTitle());
             $page_gui->setPresentationTitle($question->getTitle() . ' [' . $this->lng->txt('question_id_short') . ': ' . $question->getId() . ']');
             $ret =& $this->ctrl->forwardCommand($page_gui);
             $this->tpl->setContent($ret);
             break;
         case 'ilassspecfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssSpecFeedbackPageGUI.php";
             $pg_gui = new ilAssSpecFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'ilassgenfeedbackpagegui':
             require_once "./Modules/TestQuestionPool/classes/feedback/class.ilAssGenFeedbackPageGUI.php";
             $pg_gui = new ilAssGenFeedbackPageGUI((int) $_GET["feedback_id"]);
             $this->ctrl->forwardCommand($pg_gui);
             break;
         case 'illocalunitconfigurationgui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             require_once 'Modules/TestQuestionPool/classes/class.ilLocalUnitConfigurationGUI.php';
             require_once 'Modules/TestQuestionPool/classes/class.ilUnitConfigurationRepository.php';
             $gui = new ilLocalUnitConfigurationGUI(new ilUnitConfigurationRepository((int) $_GET['q_id']));
             $this->ctrl->forwardCommand($gui);
             break;
         case "ilcommonactiondispatchergui":
             require_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilassquestionhintsgui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI =& assQuestionGUI::_getQuestionGUI($q_type, $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             // forward to ilAssQuestionHintsGUI
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionHintsGUI.php';
             $gui = new ilAssQuestionHintsGUI($questionGUI);
             $ilCtrl->forwardCommand($gui);
             break;
         case 'ilassquestionfeedbackeditinggui':
             $this->prepareSubGuiOutput();
             // set return target
             $this->ctrl->setReturn($this, "questions");
             // set context tabs
             require_once 'Modules/TestQuestionPool/classes/class.assQuestionGUI.php';
             $questionGUI = assQuestionGUI::_getQuestionGUI('', $_GET['q_id']);
             $questionGUI->object->setObjId($this->object->getId());
             $questionGUI->setQuestionTabs();
             // forward to ilAssQuestionFeedbackGUI
             require_once 'Modules/TestQuestionPool/classes/class.ilAssQuestionFeedbackEditingGUI.php';
             $gui = new ilAssQuestionFeedbackEditingGUI($questionGUI, $ilCtrl, $ilAccess, $tpl, $ilTabs, $lng);
             $ilCtrl->forwardCommand($gui);
             break;
         case 'iltesttoplistgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilTestToplistGUI.php';
             $gui = new ilTestToplistGUI($this);
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ilscoringadjustmentgui':
             $this->prepareOutput();
             require_once './Modules/Test/classes/class.ilScoringAdjustmentGUI.php';
             $gui = new ilScoringAdjustmentGUI($this->object);
             $this->ctrl->forwardCommand($gui);
             break;
         case '':
         case 'ilobjtestgui':
             $this->prepareOutput();
             $this->addHeaderAction();
             if (strcmp($cmd, "properties") == 0 && $_GET["browse"]) {
                 $this->questionBrowser();
                 return;
             }
             if (strcmp($cmd, "properties") == 0 && ($_GET["up"] || $_GET["down"])) {
                 $this->questionsObject();
                 return;
             }
             $cmd .= "Object";
             $ret =& $this->{$cmd}();
             break;
         default:
             // elba hack for storing question id for inserting new question after
             if ($_REQUEST['prev_qid']) {
                 global $___prev_question_id;
                 $___prev_question_id = $_REQUEST['prev_qid'];
                 $this->ctrl->setParameterByClass('ilassquestionpagegui', 'prev_qid', $_REQUEST['prev_qid']);
                 $this->ctrl->setParameterByClass($_GET['sel_question_types'] . 'gui', 'prev_qid', $_REQUEST['prev_qid']);
             }
             $this->create_question_mode = true;
             $this->prepareOutput();
             $this->ctrl->setReturn($this, "questions");
             require_once "./Modules/TestQuestionPool/classes/class.assQuestionGUI.php";
             $q_gui =& assQuestionGUI::_getQuestionGUI($_GET['sel_question_types'], $_GET["q_id"]);
             $q_gui->object->setObjId($this->object->getId());
             if (!$_GET['sel_question_types']) {
                 $qType = assQuestion::getQuestionTypeFromDb($_GET['q_id']);
             } else {
                 $qType = $_GET['sel_question_types'];
             }
             $this->ctrl->setParameterByClass($qType . "GUI", 'prev_qid', $_REQUEST['prev_qid']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'test_ref_id', $_REQUEST['ref_id']);
             $this->ctrl->setParameterByClass($qType . "GUI", 'q_id', $_REQUEST['q_id']);
             if ($_REQUEST['test_express_mode']) {
                 $this->ctrl->setParameterByClass($qType . "GUI", 'test_express_mode', 1);
             }
             #global $___test_express_mode;
             #$___test_express_mode = true;
             if (!$q_gui->isSaveCommand()) {
                 $_GET['calling_test'] = $this->object->getRefId();
             }
             $q_gui->setQuestionTabs();
             #unset($___test_express_mode);
             $ret =& $this->ctrl->forwardCommand($q_gui);
             break;
     }
     if (!in_array(strtolower($_GET["baseClass"]), array('iladministrationgui', 'ilrepositorygui')) && $this->getCreationMode() != true) {
         $this->tpl->show();
     }
 }
 function sendCreditCard()
 {
     $this->psc_obj = new ilPaymentShoppingCart($this->user_obj);
     $this->psc_obj->clearCouponItemsSession();
     if (!count($items = $this->psc_obj->getEntries($this->pm_id))) {
         $this->tpl->setVariable("HEADER", $this->lng->txt('pay_bmf_your_order'));
         $this->tpl->touchBlock("stop_floating");
         ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
     } else {
         $payment = new KreditkartenzahlungWS();
         $customer = new Kunde($this->user_obj->getId());
         $creditCard = new Kreditkarte();
         $sc_obj = new ilPaymentShoppingCart($this->user_obj);
         $tmp_bookEntries = $sc_obj->getShoppingCart();
         if (!is_array($tmp_bookEntries)) {
             ilUtil::sendInfo($this->lng->txt('pay_shopping_cart_empty'));
         } else {
             $totalAmount = 0;
             for ($i = 0; $i < count($tmp_bookEntries); $i++) {
                 $booking = true;
                 if (!empty($_SESSION["coupons"]["bmf"])) {
                     $price = $tmp_bookEntries[$i]["price"];
                     $tmp_bookEntries[$i]["math_price"] = $price;
                     foreach ($_SESSION["coupons"]["bmf"] as $key => $coupon) {
                         $this->coupon_obj->setId($coupon["pc_pk"]);
                         $this->coupon_obj->setCurrentCoupon($coupon);
                         $tmp_pobject = new ilPaymentObject($this->user_obj, $tmp_bookEntries[$i]['pobject_id']);
                         if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                             $_SESSION["coupons"]["bmf"][$key]["total_objects_coupon_price"] += $price;
                             $_SESSION["coupons"]["bmf"][$key]["items"][] = $tmp_bookEntries[$i];
                             $booking = false;
                         }
                         unset($tmp_pobject);
                     }
                 }
                 if ($booking) {
                     $tmp_bookEntries[$i]["price_string"] = number_format((double) $tmp_bookEntries[$i]["price"], 2, ",", ".");
                     $bookEntries[] = new Buchung($tmp_bookEntries[$i]);
                     $totalAmount += $tmp_bookEntries[$i]["price"];
                 } else {
                     $tmp_bookEntries[$i]["price_string"] = number_format((double) $tmp_bookEntries[$i]["price"], 2, ",", ".");
                 }
             }
             $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["bmf"]);
             if (is_array($coupon_discount_items) && !empty($coupon_discount_items)) {
                 foreach ($coupon_discount_items as $item) {
                     $item["price"] = number_format((double) $item["discount_price"], 2, ".", "");
                     $bookEntries[] = new Buchung($item);
                     $totalAmount += $item["discount_price"];
                 }
             }
             $totalAmount = number_format((double) $totalAmount, 2, ".", "");
             $values = array("betrag" => $totalAmount, "buchungen" => $bookEntries);
             $bookingList = new BuchungsListe($this->user_obj->getId(), $values);
         }
         $resultObj = $payment->zahlenUndAnlegenKunde($customer, $creditCard, $bookingList);
         $result = $resultObj->ergebnis;
         if (is_object($result)) {
             if ($result->code < 0) {
                 $this->tpl->setVariable("HEADER", $this->lng->txt('error'));
                 $this->tpl->touchBlock("stop_floating");
                 $error = $this->lng->txt('pay_bmf_server_error_code') . " " . $result->code . ": " . $result->kurzText . "<br>\n" . $result->langText;
                 if ($result->code == -103 || $result->code == -104 || $result->code == -107 || $result->code <= -202 && $result->code >= -208 || $result->code == -213) {
                     ilUtil::sendInfo($error);
                     $this->showPersonalData();
                 } else {
                     if ($result->code == -507 || $result->code == -510 || $result->code == -511) {
                         ilUtil::sendInfo($error);
                         $this->showPaymentType();
                     } else {
                         if ($result->code == -701 || $result->code == -1701 || $result->code == -1706 || $result->code == -1707 || $result->code == -1710 || $result->code == -1711) {
                             ilUtil::sendInfo($error);
                             $this->showCreditCard();
                         } else {
                             $error .= "<br>\n" . $this->lng->txt('pay_bmf_server_error_sysadmin');
                             ilUtil::sendInfo($error);
                             $this->showPersonalData();
                         }
                     }
                 }
             } else {
                 // everything ok => send confirmation, fill statistik, delete session, delete shopping cart.
                 $external_data = array();
                 $external_data['voucher'] = $resultObj->buchungsListe->buchungen[$b++]->belegNr;
                 $external_data['transaction_extern'] = $resultObj->buchungsListe->kassenzeichen;
                 $external_data['street'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->strasse) . ' ' . utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->hausNr);
                 $external_data['po_box'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->postfach);
                 $external_data['zipcode'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->PLZ);
                 $external_data['city'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->ort);
                 $external_data['country'] = utf8_decode($resultCustomerObj->kunde->rechnungsAdresse->land);
                 parent::__addbookings($external_data);
                 $this->__emptyShoppingCart();
                 $this->__clearSession();
                 $this->tpl->setVariable("HEADER", $this->lng->txt('pay_bmf_your_order'));
                 $this->tpl->setVariable("DESCRIPTION", $this->lng->txt('pay_bmf_thanks'));
                 $this->tpl->touchBlock("stop_floating");
                 ilUtil::sendInfo($this->lng->txt('pay_bmf_thanks'));
                 $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.pay_bmf_credit_card.html', 'Services/Payment');
                 if ($this->ilias->getSetting("https") != 1) {
                     $this->tpl->setCurrentBlock("buyed_objects");
                     $link = $this->ctrl->getLinkTargetByClass('ilshopboughtobjectsgui');
                     $this->tpl->setVariable("LINK_GOTO_BUYED_OBJECTS", $link);
                     $this->tpl->setVariable("TXT_GOTO_BUYED_OBJECTS", $this->lng->txt('pay_goto_buyed_objects'));
                     $this->tpl->parseCurrentBlock("buyed_objects");
                 }
                 $this->tpl->setVariable("TXT_CLOSE_WINDOW", $this->lng->txt('close_window'));
             }
         } else {
             $this->tpl->setVariable("HEADER", $this->lng->txt('error'));
             $this->tpl->touchBlock("stop_floating");
             ilUtil::sendInfo($this->lng->txt('pay_bmf_server_error_communication'));
         }
         /**/
         #zum testen
     }
 }
 /**
  * get lm menu html
  */
 function setilLMMenu($a_offline = false, $a_export_format = "", $a_active = "content", $a_use_global_tabs = false, $a_as_subtabs = false, $a_cur_page = 0)
 {
     global $ilCtrl, $ilUser, $ilAccess, $ilTabs, $rbacsystem, $ilPluginAdmin;
     if ($a_as_subtabs) {
         $addcmd = "addSubTabTarget";
         $getcmd = "getSubTabHTML";
     } else {
         $addcmd = "addTarget";
         $getcmd = "getHTML";
     }
     $active[$a_active] = true;
     if (!$this->object->isActiveLMMenu()) {
         return "";
     }
     if ($a_use_global_tabs) {
         $tabs_gui = $ilTabs;
     } else {
         $tabs_gui = new ilTabsGUI();
     }
     // Determine whether the view of a learning resource should
     // be shown in the frameset of ilias, or in a separate window.
     //$showViewInFrameset = $this->ilias->ini->readVariable("layout","view_target") == "frame";
     $showViewInFrameset = true;
     if ($showViewInFrameset && !$a_offline) {
         $buttonTarget = ilFrameTargetInfo::_getFrame("MainContent");
     } else {
         $buttonTarget = "_top";
     }
     if ($a_export_format == "scorm") {
         $buttonTarget = "";
     }
     include_once "./Services/Payment/classes/class.ilPaymentObject.php";
     $requires_purchase_to_access = ilPaymentObject::_requiresPurchaseToAccess((int) $_GET['ref_id']);
     // content
     if (!$a_offline && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
         $tabs_gui->{$addcmd}("content", $ilCtrl->getLinkTargetByClass("illmpresentationgui", "layout"), "", "", $buttonTarget, $active["content"]);
     }
     // table of contents
     if (!$requires_purchase_to_access && $this->object->isActiveTOC() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showTableOfContents");
         } else {
             $link = "./table_of_contents.html";
         }
         $tabs_gui->{$addcmd}("cont_toc", $link, "", "", $buttonTarget, $active["toc"]);
     }
     // print view
     if (!$requires_purchase_to_access && $this->object->isActivePrintView() && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showPrintViewSelection");
             $tabs_gui->{$addcmd}("cont_print_view", $link, "", "", $buttonTarget, $active["print"]);
         }
     }
     // download
     if (!$requires_purchase_to_access && $ilUser->getId() == ANONYMOUS_USER_ID) {
         $is_public = $this->object->isActiveDownloadsPublic();
     } else {
         if (!$requires_purchase_to_access) {
             $is_public = true;
         }
     }
     if (!$requires_purchase_to_access && $this->object->isActiveDownloads() && !$a_offline && $is_public && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
         $link = $ilCtrl->getLinkTargetByClass("illmpresentationgui", "showDownloadList");
         $tabs_gui->{$addcmd}("download", $link, "", "", $buttonTarget, $active["download"]);
     }
     // info button
     if ($a_export_format != "scorm" && !$a_offline) {
         if (!$a_offline) {
             $ilCtrl->setParameterByClass("illmpresentationgui", "obj_id", $_GET["obj_id"]);
             $link = $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "ilinfoscreengui"), "showSummary");
         } else {
             $link = "./info.html";
         }
         $tabs_gui->{$addcmd}($requires_purchase_to_access ? 'buy' : 'info_short', $link, "", "", $buttonTarget, $active["info"]);
     }
     include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
     if (ilLearningProgressAccess::checkAccess($_GET["ref_id"])) {
         include_once './Services/Object/classes/class.ilObjectLP.php';
         $olp = ilObjectLP::getInstance($this->object->getId());
         if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_MANUAL) {
             $tabs_gui->{$addcmd}("learning_progress", $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "editmanual"), "", "", $buttonTarget, $active["learning_progress"]);
         } else {
             if ($olp->getCurrentMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) {
                 $tabs_gui->{$addcmd}("learning_progress", $this->ctrl->getLinkTargetByClass(array("illmpresentationgui", "illearningprogressgui"), "showtlt"), "", "", $buttonTarget, $active["learning_progress"]);
             }
         }
     }
     // edit learning module
     if (!$a_offline && $a_cur_page > 0) {
         if ($rbacsystem->checkAccess("write", $_GET["ref_id"])) {
             //$page_id = $this->getCurrentPageId();
             $page_id = $a_cur_page;
             $tabs_gui->{$addcmd}("edit_page", ILIAS_HTTP_PATH . "/ilias.php?baseClass=ilLMEditorGUI&ref_id=" . $_GET["ref_id"] . "&obj_id=" . $page_id . "&to_page=1", "", "", $buttonTarget, $active["edit_page"]);
         }
     }
     if (!$requires_purchase_to_access) {
         // get user defined menu entries
         $this->__initLMMenuEditor();
         $entries = $this->lmme_obj->getMenuEntries(true);
         if (count($entries) > 0 && $ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
             foreach ($entries as $entry) {
                 // build goto-link for internal resources
                 if ($entry["type"] == "intern") {
                     $entry["link"] = ILIAS_HTTP_PATH . "/goto.php?target=" . $entry["link"];
                 }
                 // add http:// prefix if not exist
                 if (!strstr($entry["link"], '://') && !strstr($entry["link"], 'mailto:')) {
                     $entry["link"] = "http://" . $entry["link"];
                 }
                 if (!strstr($entry["link"], 'mailto:')) {
                     $entry["link"] = ilUtil::appendUrlParameterString($entry["link"], "ref_id=" . $this->ref_id . "&structure_id=" . $this->obj_id);
                 }
                 $tabs_gui->{$addcmd}($entry["title"], $entry["link"], "", "", "_blank", "", true);
             }
         }
     }
     // user interface hook [uihk]
     $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk");
     $plugin_html = false;
     foreach ($pl_names as $pl) {
         $ui_plugin = ilPluginAdmin::getPluginObject(IL_COMP_SERVICE, "UIComponent", "uihk", $pl);
         $gui_class = $ui_plugin->getUIClassInstance();
         $resp = $gui_class->modifyGUI("Modules/LearningModule", "lm_menu_tabs", array("lm_menu_tabs" => $tabs_gui));
     }
     return $tabs_gui->{$getcmd}();
 }
 public function editPriceObject()
 {
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.main_view.html', 'Services/Payment');
     $price_id = $_GET['price_id'] ? $_GET['price_id'] : $_POST['price_id'];
     $price = ilPaymentPrices::_getPrice($price_id);
     $this->ctrl->setParameter($this, 'pobject_id', (int) $_GET['pobject_id']);
     $tmp_pobject = ilPaymentObject::_getObjectData($_GET['pobject_id']);
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $form = new ilPropertyFormGUI();
     $form->setFormAction($this->ctrl->getFormAction($this));
     $tmp_obj = ilObjectFactory::getInstanceByRefId($tmp_pobject['ref_id'], false);
     if ($tmp_obj) {
         $form->setTitle($tmp_obj->getTitle());
     } else {
         $form->setTitle($this->lng->txt('object_not_found'));
     }
     //price_type
     $radio_group = new ilRadioGroupInputGUI('', 'price_type');
     $radio_group->setTitle($this->lng->txt('duration'));
     $radio_group->setRequired(true);
     $radio_group->setValue($price['price_type']);
     $radio_group->setPostVar('price_type');
     $radio_option_1 = new ilRadioOption($this->lng->txt('duration_month'), ilPaymentPrices::TYPE_DURATION_MONTH);
     // duration month
     $oDuration = new ilNumberInputGUI();
     $oDuration->setTitle($this->lng->txt('paya_months'));
     $oDuration->setSize('20%');
     $oDuration->setValue($price['duration']);
     $oDuration->setPostVar('duration_month');
     $radio_option_1->addSubItem($oDuration);
     $radio_group->addOption($radio_option_1);
     $radio_option_3 = new ilRadioOption($this->lng->txt('duration_date'), ilPaymentPrices::TYPE_DURATION_DATE);
     // duration_date from
     $o_date_from = new ilDateTimeInputGUI();
     $o_date_from->setTitle($this->lng->txt('cal_from'));
     $o_date_from->setDate(new ilDate($price['duration_from'], IL_CAL_DATE));
     $o_date_from->setPostVar('duration_date_from');
     $radio_option_3->addSubItem($o_date_from);
     // duration_date until
     $o_date_until = new ilDateTimeInputGUI();
     $o_date_until->setTitle($this->lng->txt('cal_until'));
     $o_date_until->setDate(new ilDate($price['duration_until'], IL_CAL_DATE));
     $o_date_until->setPostVar('duration_date_until');
     $radio_option_3->addSubItem($o_date_until);
     $radio_group->addOption($radio_option_3);
     $radio_option_2 = new ilRadioOption($this->lng->txt('unlimited_duration'), ilPaymentPrices::TYPE_UNLIMITED_DURATION);
     $radio_group->addOption($radio_option_2);
     $form->addItem($radio_group);
     // description
     $oDescription = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
     $oDescription->setRows(4);
     $oDescription->setCols(35);
     $oDescription->setValue($price['description']);
     $form->addItem($oDescription);
     // price
     $oPrice = new ilNumberInputGUI();
     $oPrice->setTitle($this->lng->txt('price_a'));
     $oPrice->setSize('20%');
     $oPrice->setRequired(true);
     $oPrice->setValue($price['price']);
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $oPrice->setInfo($genSet->get('currency_unit'));
     $oPrice->setPostVar('price');
     $oPrice->allowDecimals(true);
     $form->addItem($oPrice);
     //extension
     $oExtension = new ilCheckboxInputGUI($this->lng->txt('extension_price'), 'extension');
     $oExtension->setChecked($price['extension']);
     $form->addItem($oExtension);
     $o_hidden_1 = new ilHiddenInputGUI('pobject_id');
     $o_hidden_1->setValue((int) $_GET['pobject_id']);
     $o_hidden_1->setPostVar('pobject_id');
     $o_hidden_2 = new ilHiddenInputGUI('price_id');
     $o_hidden_2->setValue((int) $_GET['price_id']);
     $o_hidden_2->setPostVar('price_id');
     $form->addItem($o_hidden_1);
     $form->addItem($o_hidden_2);
     $form->addCommandButton('updatePrice', $this->lng->txt('save'));
     $form->addCommandButton('editPrices', $this->lng->txt('cancel'));
     $this->tpl->setVariable('FORM', $form->getHTML());
 }
 private function __checkItems($a_array)
 {
     $genSet = ilPaymentSettings::_getInstance();
     // Wrong currency
     if ($a_array["mc_currency"] != $genSet->get("currency_unit")) {
         return false;
     }
     $sc = $this->psc_obj->getShoppingCart($this->pay_method);
     $this->psc_obj->clearCouponItemsSession();
     if (is_array($sc) && count($sc) > 0) {
         for ($i = 0; $i < count($sc); $i++) {
             $items[$i] = array("name" => $a_array["item_name" . ($i + 1)], "amount" => $a_array["mc_gross_" . ($i + 1)]);
             if (!empty($_SESSION["coupons"]["paypal"])) {
                 $sc[$i]["math_price"] = (double) $sc[$i]["price"];
                 $tmp_pobject = new ilPaymentObject($this->user_obj, $sc[$i]['pobject_id']);
                 foreach ($_SESSION["coupons"]["paypal"] as $key => $coupon) {
                     $this->coupon_obj->setId($coupon["pc_pk"]);
                     $this->coupon_obj->setCurrentCoupon($coupon);
                     if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                         $_SESSION["coupons"]["paypal"][$key]["total_objects_coupon_price"] += (double) $sc[$i]["price"];
                         $_SESSION["coupons"]["paypal"][$key]["items"][] = $sc[$i];
                     }
                 }
                 unset($tmp_pobject);
             }
         }
         $coupon_discount_items = $this->psc_obj->calcDiscountPrices($_SESSION["coupons"]["paypal"]);
         $found = 0;
         $total = 0;
         for ($i = 0; $i < count($sc); $i++) {
             if (array_key_exists($sc[$i]["pobject_id"], $coupon_discount_items)) {
                 $sc[$i]["price"] = round($coupon_discount_items[$sc[$i]["pobject_id"]]["discount_price"], 2);
                 if ($sc[$i]["price"] < 0) {
                     $sc[$i]["price"] = 0.0;
                 }
             }
             for ($j = 0; $j < count($items); $j++) {
                 if (substr($items[$j]["name"], 0, strlen($sc[$i]["obj_id"]) + 2) == "[" . $sc[$i]["obj_id"] . "]" && $items[$j]["amount"] == $sc[$i]["price"]) {
                     $total += $items[$j]["amount"];
                     $found++;
                 }
             }
         }
         // The number of items, the items themselves and their amounts and the total amount correct
         if (number_format($total, 2, ".", "") == $a_array["mc_gross"] && $found == count($sc)) {
             return true;
         }
     }
     return false;
 }
 private function __initPaymentObject()
 {
     global $ilUser;
     $this->pobject = new ilPaymentObject($ilUser, ilPaymentObject::_lookupPobjectId($this->ref_id));
     return true;
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $ilUser, $ilLocator, $ilTabs;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) {
         $this->prepareOutput();
     } else {
         if (!in_array($cmd, array("", "framset")) || $next_class != "") {
             $this->getTemplate();
             $this->setLocator();
             $this->setTabs();
         }
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->tpl->getStandardTemplate();
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
                 $ret = $this->ctrl->forwardCommand($pp);
                 return true;
             }
         }
     }
     switch ($next_class) {
         case 'ilmdeditorgui':
             $this->checkPermission("write");
             $ilTabs->activateTab('id_meta_data');
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             break;
         case "ilfilesystemgui":
             $this->checkPermission("write");
             $ilTabs->activateTab('id_list_files');
             $fs_gui = new ilFileSystemGUI($this->object->getDataDirectory());
             $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
             $fs_gui->setUseUploadDirectory(true);
             $fs_gui->setTableId("htlmfs" . $this->object->getId());
             if ($this->object->getStartFile() != "") {
                 $fs_gui->labelFile($this->object->getStartFile(), $this->lng->txt("cont_startfile"));
             }
             $fs_gui->addCommand($this, "setStartFile", $this->lng->txt("cont_set_start_file"));
             $this->ctrl->forwardCommand($fs_gui);
             // try to set start file automatically
             require_once "./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
             if (!ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId())) {
                 $do_update = false;
                 $pcommand = $fs_gui->getLastPerformedCommand();
                 if (is_array($pcommand)) {
                     $valid = array("index.htm", "index.html", "start.htm", "start.html");
                     if ($pcommand["cmd"] == "create_file") {
                         $file = strtolower(basename($pcommand["name"]));
                         if (in_array($file, $valid)) {
                             $this->object->setStartFile($pcommand["name"]);
                             $do_update = $pcommand["name"];
                         }
                     } else {
                         if ($pcommand["cmd"] == "unzip_file") {
                             $zip_file = strtolower(basename($pcommand["name"]));
                             $suffix = strrpos($zip_file, ".");
                             if ($suffix) {
                                 $zip_file = substr($zip_file, 0, $suffix);
                             }
                             foreach ($pcommand["added"] as $file) {
                                 $chk_file = null;
                                 if (stristr($file, ".htm")) {
                                     $chk_file = strtolower(basename($file));
                                     $suffix = strrpos($chk_file, ".");
                                     if ($suffix) {
                                         $chk_file = substr($chk_file, 0, $suffix);
                                     }
                                 }
                                 if (in_array(basename($file), $valid) || $zip_file && $chk_file && $chk_file == $zip_file) {
                                     $this->object->setStartFile($file);
                                     $do_update = $file;
                                     break;
                                 }
                             }
                         }
                     }
                 }
                 if ($do_update) {
                     ilUtil::sendInfo(sprintf($this->lng->txt("cont_start_file_set_to"), $do_update), true);
                     $this->object->update();
                     $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
                 }
             }
             break;
         case "ilinfoscreengui":
             $ret =& $this->outputInfoScreen();
             break;
         case "illearningprogressgui":
             $ilTabs->activateTab('id_learning_progress');
             include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId(), $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
             $this->ctrl->forwardCommand($new_gui);
             break;
         case 'ilpermissiongui':
             $ilTabs->activateTab('id_permissions');
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'illicensegui':
             $ilTabs->activateTab('id_license');
             include_once "./Services/License/classes/class.ilLicenseGUI.php";
             $license_gui =& new ilLicenseGUI($this);
             $ret =& $this->ctrl->forwardCommand($license_gui);
             break;
         case "ilexportgui":
             $ilTabs->activateTab("export");
             include_once "./Services/Export/classes/class.ilExportGUI.php";
             $exp_gui = new ilExportGUI($this);
             $exp_gui->addFormat("xml");
             $exp_gui->addFormat("html", "", $this, "exportHTML");
             $ret = $this->ctrl->forwardCommand($exp_gui);
             //				$this->tpl->show();
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         default:
             $cmd = $this->ctrl->getCmd("frameset");
             if (strtolower($_GET["baseClass"]) == "iladministrationgui" || $this->getCreationMode() == true) {
                 $cmd .= "Object";
             }
             $ret =& $this->{$cmd}();
             break;
     }
     $this->addHeaderAction();
 }
 /**
  * Get assignment body for overview
  */
 function getOverviewBody($a_data)
 {
     global $lng, $ilCtrl, $ilUser;
     $tpl = new ilTemplate("tpl.assignment_body.html", true, true, "Modules/Exercise");
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     include_once "./Services/UIComponent/Button/classes/class.ilLinkButton.php";
     if (IS_PAYMENT_ENABLED) {
         include_once './Services/Payment/classes/class.ilPaymentObject.php';
     }
     $info = new ilInfoScreenGUI(null);
     $info->setTableClass("");
     $not_started_yet = false;
     if ($a_data["start_time"] > 0 && time() - $a_data["start_time"] <= 0) {
         $not_started_yet = true;
     }
     if (!$not_started_yet) {
         // instructions
         $info->addSection($lng->txt("exc_instruction"));
         $is_html = strlen($a_data["instruction"]) != strlen(strip_tags($a_data["instruction"]));
         if (!$is_html) {
             $a_data["instruction"] = nl2br(ilUtil::makeClickable($a_data["instruction"], true));
         }
         $info->addProperty("", $a_data["instruction"]);
     }
     // schedule
     $info->addSection($lng->txt("exc_schedule"));
     if ($a_data["start_time"] > 0) {
         $info->addProperty($lng->txt("exc_start_time"), ilDatePresentation::formatDate(new ilDateTime($a_data["start_time"], IL_CAL_UNIX)));
     }
     if ($a_data["deadline"] > 0) {
         $info->addProperty($lng->txt("exc_edit_until"), ilDatePresentation::formatDate(new ilDateTime($a_data["deadline"], IL_CAL_UNIX)));
     }
     $time_str = $this->getTimeString($a_data["deadline"]);
     if (!$not_started_yet) {
         $info->addProperty($lng->txt("exc_time_to_send"), "<b>" . $time_str . "</b>");
     }
     // public submissions
     if ($this->exc->getShowSubmissions()) {
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
         if ($a_data["deadline"] - time() <= 0) {
             $button = ilLinkButton::getInstance();
             $button->setCaption("exc_list_submission");
             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "listPublicSubmissions"));
             $info->addProperty($lng->txt("exc_public_submission"), $button->render());
         } else {
             $info->addProperty($lng->txt("exc_public_submission"), $lng->txt("exc_msg_public_submission"));
         }
         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $_GET["ass_id"]);
     }
     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
     if (!$not_started_yet) {
         // download files
         $files = ilExAssignment::getFiles($a_data["exc_id"], $a_data["id"]);
         if (count($files) > 0) {
             $info->addSection($lng->txt("exc_files"));
             foreach ($files as $file) {
                 // if download must be purchased first show a "buy"-button
                 if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'download') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'download'))) {
                     $info->addProperty($file["name"], $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
                 } else {
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file["name"]));
                     $info->addProperty($file["name"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFile"));
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                 }
             }
         }
         // submission
         // if submission must be purchased first
         if (IS_PAYMENT_ENABLED && (ilPaymentObject::_isBuyable($_GET['ref_id'], 'upload') && !ilPaymentObject::_hasAccess($_GET['ref_id'], '', 'upload'))) {
             $info->addSection($lng->txt("exc_your_submission"));
             $ilCtrl->clearParameters($this);
             $ilCtrl->setParameter($this, "ref_id", $_GET['ref_id']);
             $ilCtrl->setParameter($this, 'subtype', 'upload');
             $info->addProperty($lng->txt('exc_hand_in'), $lng->txt("buy"), $ilCtrl->getLinkTargetByClass("ilShopPurchaseGUI", "showDetails"));
         } else {
             $info->addSection($lng->txt("exc_your_submission"));
             $delivered_files = ilExAssignment::getDeliveredFiles($a_data["exc_id"], $a_data["id"], $ilUser->getId());
             $times_up = false;
             if ($a_data["deadline"] > 0 && $a_data["deadline"] - time() < 0) {
                 $times_up = true;
             }
             $team_members = null;
             switch ($a_data["type"]) {
                 case ilExAssignment::TYPE_UPLOAD_TEAM:
                     $no_team_yet = false;
                     $team_members = ilExAssignment::getTeamMembersByAssignmentId($a_data["id"], $ilUser->getId());
                     if (sizeof($team_members)) {
                         $team = array();
                         foreach ($team_members as $member_id) {
                             $team[] = ilObjUser::_lookupFullname($member_id);
                         }
                         $team = implode(", ", $team);
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_manage_team");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreenTeam"));
                         $team .= " " . $button->render();
                         $info->addProperty($lng->txt("exc_team_members"), $team);
                     } else {
                         $no_team_yet = true;
                         if (!$times_up) {
                             if (!sizeof($delivered_files)) {
                                 $team_info = $lng->txt("exc_no_team_yet_notice");
                             } else {
                                 $team_info = '<span class="warning">' . $lng->txt("exc_no_team_yet_notice") . '</span>';
                             }
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption("exc_create_team");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createTeam"));
                             $team_info .= " " . $button->render();
                             $team_info .= '<div class="ilFormInfo">' . $lng->txt("exc_no_team_yet_info") . '</div>';
                         } else {
                             $team_info = '<span class="warning">' . $lng->txt("exc_create_team_times_up_warning") . '</span>';
                         }
                         $info->addProperty($lng->txt("exc_team_members"), $team_info);
                     }
                     // fallthrough
                 // fallthrough
                 case ilExAssignment::TYPE_UPLOAD:
                     $titles = array();
                     foreach ($delivered_files as $file) {
                         $titles[] = $file["filetitle"];
                     }
                     $files_str = implode($titles, ", ");
                     if ($files_str == "") {
                         $files_str = $lng->txt("message_no_delivered_files");
                     }
                     // no team == no submission
                     if (!$no_team_yet) {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                         if (!$times_up) {
                             $title = count($titles) == 0 ? $lng->txt("exc_hand_in") : $lng->txt("exc_edit_submission");
                             $button = ilLinkButton::getInstance();
                             $button->setPrimary(true);
                             $button->setCaption($title, false);
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                             $files_str .= " " . $button->render();
                         } else {
                             if (count($titles) > 0) {
                                 $button = ilLinkButton::getInstance();
                                 $button->setCaption("already_delivered_files");
                                 $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "submissionScreen"));
                                 $files_str .= " " . $button->render();
                             }
                         }
                     }
                     $info->addProperty($lng->txt("exc_files_returned"), $files_str);
                     break;
                 case ilExAssignment::TYPE_BLOG:
                     include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                     $wsp_tree = new ilWorkspaceTree($ilUser->getId());
                     // #12939
                     if (!$wsp_tree->getRootId()) {
                         $wsp_tree->createTreeForUser($ilUser->getId());
                     }
                     $files_str = "";
                     $valid_blog = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $blog_id = (int) $delivered_files["filetitle"];
                         $node = $wsp_tree->getNodeData($blog_id);
                         if ($node["title"]) {
                             // #10116
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", $blog_id);
                             $blog_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilpersonalworkspacegui", "ilobjbloggui"), "");
                             $ilCtrl->setParameterByClass("ilobjbloggui", "wsp_id", "");
                             $files_str = '<a href="' . $blog_link . '">' . $node["title"] . '</a>';
                             $valid_blog = true;
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_blog) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_blog");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createBlog"));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $blogs = sizeof($wsp_tree->getObjectsFromType("blog"));
                         if (!$valid_blog && $blogs || $valid_blog && $blogs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_blog" . ($valid_blog ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectBlog"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_blog_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_PORTFOLIO:
                     include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
                     $files_str = "";
                     $valid_prtf = false;
                     if (sizeof($delivered_files)) {
                         $delivered_files = array_pop($delivered_files);
                         $portfolio_id = (int) $delivered_files["filetitle"];
                         // #11746
                         if (ilObject::_exists($portfolio_id, false, "prtf")) {
                             $portfolio = new ilObjPortfolio($portfolio_id, false);
                             if ($portfolio->getTitle()) {
                                 // #10116 / #12791
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", $portfolio_id);
                                 $prtf_link = $ilCtrl->getLinkTargetByClass(array("ilpersonaldesktopgui", "ilportfoliorepositorygui", "ilobjportfoliogui"), "view");
                                 $ilCtrl->setParameterByClass("ilobjportfoliogui", "prt_id", "");
                                 $files_str = '<a href="' . $prtf_link . '">' . $portfolio->getTitle() . '</a>';
                                 $valid_prtf = true;
                             }
                         } else {
                             if (substr($delivered_files["filename"], -1) == "/") {
                                 $this->exc->deleteResourceObject($delivered_files["ass_id"], $ilUser->getId(), $delivered_files["returned_id"]);
                             }
                         }
                     }
                     if (!$times_up) {
                         if (!$valid_prtf) {
                             // if there are portfolio templates available show form first
                             include_once "Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php";
                             $has_prtt = sizeof(ilObjPortfolioTemplate::getAvailablePortfolioTemplates()) ? "Template" : "";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_create_portfolio");
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "createPortfolio" . $has_prtt));
                             $files_str .= $button->render();
                         }
                         // #10462
                         $prtfs = sizeof(ilObjPortfolio::getPortfoliosOfUser($ilUser->getId()));
                         if (!$valid_prtf && $prtfs || $valid_prtf && $prtfs > 1) {
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("exc_select_portfolio" . ($valid_prtf ? "_change" : ""));
                             $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "selectPortfolio"));
                             $files_str .= " " . $button->render();
                         }
                     }
                     if ($files_str) {
                         $info->addProperty($lng->txt("exc_portfolio_returned"), $files_str);
                     }
                     if ($delivered_files && substr($delivered_files["filename"], -1) != "/") {
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", $delivered_files["returned_id"]);
                         $dl_link = $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "download");
                         $ilCtrl->setParameterByClass("ilobjexercisegui", "delivered", "");
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("download");
                         $button->setUrl($dl_link);
                         $info->addProperty($lng->txt("exc_files_returned"), $button->render());
                     }
                     break;
                 case ilExAssignment::TYPE_TEXT:
                     $ilCtrl->setParameterByClass("ilobjexercisegui", "ass_id", $a_data["id"]);
                     if (!$times_up) {
                         $button = ilLinkButton::getInstance();
                         $button->setPrimary(true);
                         $button->setCaption("exc_text_assignment_edit");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editAssignmentText"));
                         $files_str = $button->render();
                     } else {
                         $button = ilLinkButton::getInstance();
                         $button->setCaption("exc_text_assignment_show");
                         $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showAssignmentText"));
                         $files_str = $button->render();
                     }
                     $info->addProperty($lng->txt("exc_files_returned_text"), $files_str);
                     break;
             }
             $last_sub = ilExAssignment::getLastSubmission($a_data["id"], $ilUser->getId());
             if ($last_sub) {
                 $last_sub = ilDatePresentation::formatDate(new ilDateTime($last_sub, IL_CAL_DATETIME));
             } else {
                 $last_sub = "---";
             }
             if ($last_sub != "---") {
                 $info->addProperty($lng->txt("exc_last_submission"), $last_sub);
             }
             // peer feedback
             if ($times_up && $a_data["peer"]) {
                 $nr_missing_fb = ilExAssignment::getNumberOfMissingFeedbacks($a_data["id"], $a_data["peer_min"]);
                 if (!$a_data["peer_dl"] || $a_data["peer_dl"] > time()) {
                     $dl_info = "";
                     if ($a_data["peer_dl"]) {
                         $dl_info = " (" . sprintf($lng->txt("exc_peer_review_deadline_info_button"), ilDatePresentation::formatDate(new ilDateTime($a_data["peer_dl"], IL_CAL_UNIX))) . ")";
                     }
                     $button = ilLinkButton::getInstance();
                     $button->setPrimary($nr_missing_fb);
                     $button->setCaption($lng->txt("exc_peer_review_give") . $dl_info, false);
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "editPeerReview"));
                     $edit_pc = $button->render();
                 } else {
                     if ($a_data["peer_dl"]) {
                         $edit_pc = $lng->txt("exc_peer_review_deadline_reached");
                     }
                 }
                 if ((!$a_data["peer_dl"] || $a_data["peer_dl"] < time()) && !$nr_missing_fb) {
                     $button = ilLinkButton::getInstance();
                     $button->setCaption("exc_peer_review_show");
                     $button->setUrl($ilCtrl->getLinkTargetByClass("ilobjexercisegui", "showPersonalPeerReview"));
                     $view_pc = $button->render();
                 }
                 /*
                 else 
                 {
                 	$view_pc = $lng->txt("exc_peer_review_show_not_rated_yet");
                 }
                 */
                 $info->addProperty($lng->txt("exc_peer_review"), $edit_pc . " " . $view_pc);
             }
             // feedback from tutor
             if ($a_data["type"] == ilExAssignment::TYPE_UPLOAD_TEAM) {
                 $feedback_id = "t" . ilExAssignment::getTeamIdByAssignment($a_data["id"], $ilUser->getId());
             } else {
                 $feedback_id = $ilUser->getId();
             }
             // global feedback / sample solution
             if ($a_data["fb_date"] == ilExAssignment::FEEDBACK_DATE_DEADLINE) {
                 $show_global_feedback = $times_up && $a_data["fb_file"];
             } else {
                 $show_global_feedback = $last_sub != "---" && $a_data["fb_file"];
             }
             $storage = new ilFSStorageExercise($a_data["exc_id"], $a_data["id"]);
             $cnt_files = $storage->countFeedbackFiles($feedback_id);
             $lpcomment = ilExAssignment::lookupCommentForUser($a_data["id"], $ilUser->getId());
             $mark = ilExAssignment::lookupMarkOfUser($a_data["id"], $ilUser->getId());
             $status = ilExAssignment::lookupStatusOfUser($a_data["id"], $ilUser->getId());
             if ($lpcomment != "" || $mark != "" || $status != "notgraded" || $cnt_files > 0 || $show_global_feedback) {
                 $info->addSection($lng->txt("exc_feedback_from_tutor"));
                 if ($lpcomment != "") {
                     $info->addProperty($lng->txt("exc_comment"), $lpcomment);
                 }
                 if ($mark != "") {
                     $info->addProperty($lng->txt("exc_mark"), $mark);
                 }
                 if ($status == "") {
                     //				  $info->addProperty($lng->txt("status"),
                     //						$lng->txt("message_no_delivered_files"));
                 } else {
                     if ($status != "notgraded") {
                         $img = '<img src="' . ilUtil::getImagePath("scorm/" . $status . ".svg") . '" ' . ' alt="' . $lng->txt("exc_" . $status) . '" title="' . $lng->txt("exc_" . $status) . '" />';
                         $info->addProperty($lng->txt("status"), $img . " " . $lng->txt("exc_" . $status));
                     }
                 }
                 if ($cnt_files > 0) {
                     $info->addSection($lng->txt("exc_fb_files") . '<a name="fb' . $a_data["id"] . '"></a>');
                     if ($cnt_files > 0) {
                         $files = $storage->getFeedbackFiles($feedback_id);
                         foreach ($files as $file) {
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", urlencode($file));
                             $info->addProperty($file, $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadFeedbackFile"));
                             $ilCtrl->setParameterByClass("ilobjexercisegui", "file", "");
                         }
                     }
                 }
                 // #15002 - global feedback
                 if ($show_global_feedback) {
                     $info->addSection($lng->txt("exc_global_feedback_file"));
                     $info->addProperty($a_data["fb_file"], $lng->txt("download"), $ilCtrl->getLinkTargetByClass("ilobjexercisegui", "downloadGlobalFeedbackFile"));
                 }
             }
         }
     }
     $tpl->setVariable("CONTENT", $info->getHTML());
     return $tpl->get();
 }
Example #18
0
 /**
  * Delete objects. Move them to trash (if trash feature is enabled).
  *
  * @param	integer		current ref id
  * @param	array		array of ref(!) ids to be deleted
  */
 public static function deleteObjects($a_cur_ref_id, $a_ids)
 {
     global $ilAppEventHandler, $rbacsystem, $rbacadmin, $log, $ilUser, $tree, $lng, $ilSetting;
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     include_once "./Services/Repository/exceptions/class.ilRepositoryException.php";
     // Remove duplicate ids from array
     $a_ids = array_unique((array) $a_ids);
     // FOR ALL SELECTED OBJECTS
     foreach ($a_ids as $id) {
         if ($tree->isDeleted($id)) {
             $log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
             throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
         }
         // GET COMPLETE NODE_DATA OF ALL SUBTREE NODES
         $node_data = $tree->getNodeData($id);
         $subtree_nodes = $tree->getSubTree($node_data);
         $all_node_data[] = $node_data;
         $all_subtree_nodes[] = $subtree_nodes;
         // CHECK DELETE PERMISSION OF ALL OBJECTS
         foreach ($subtree_nodes as $node) {
             if ($node['type'] == 'rolf') {
                 continue;
             }
             if (!$rbacsystem->checkAccess('delete', $node["child"])) {
                 $not_deletable[] = $node["child"];
                 $perform_delete = false;
             } else {
                 if (ilPaymentObject::_isBuyable($node['child'])) {
                     $buyable[] = $node['child'];
                     $perform_delete = false;
                 }
             }
         }
     }
     // IF THERE IS ANY OBJECT WITH NO PERMISSION TO DELETE
     if (count($not_deletable)) {
         $not_deletable = implode(',', $not_deletable);
         ilSession::clear("saved_post");
         throw new ilRepositoryException($lng->txt("msg_no_perm_delete") . " " . $not_deletable . "<br/>" . $lng->txt("msg_cancel"));
     }
     if (count($buyable)) {
         foreach ($buyable as $id) {
             $tmp_object = ilObjectFactory::getInstanceByRefId($id);
             $titles[] = $tmp_object->getTitle();
         }
         $title_str = implode(',', $titles);
         throw new ilRepositoryException($lng->txt('msg_obj_not_deletable_sold') . ' ' . $title_str);
     }
     // DELETE THEM
     if (!$all_node_data[0]["type"]) {
         // alex: this branch looks suspicious to me... I deactivate it for
         // now. Objects that aren't in the tree should overwrite this method.
         throw new ilRepositoryException($lng->txt("ilRepUtil::deleteObjects: Type information missing."));
         // OBJECTS ARE NO 'TREE OBJECTS'
         if ($rbacsystem->checkAccess('delete', $a_cur_ref_id)) {
             foreach ($a_ids as $id) {
                 $obj =& ilObjectFactory::getInstanceByObjId($id);
                 $obj->delete();
                 // write log entry
                 $log->write("ilObjectGUI::confirmedDeleteObject(), deleted obj_id " . $obj->getId() . ", type: " . $obj->getType() . ", title: " . $obj->getTitle());
             }
         } else {
             throw new ilRepositoryException($lng->txt("no_perm_delete") . "<br/>" . $lng->txt("msg_cancel"));
         }
     } else {
         // SAVE SUBTREE AND DELETE SUBTREE FROM TREE
         $affected_ids = array();
         foreach ($a_ids as $id) {
             if ($tree->isDeleted($id)) {
                 $log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
                 throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
             }
             // DELETE OLD PERMISSION ENTRIES
             $subnodes = $tree->getSubtree($tree->getNodeData($id));
             foreach ($subnodes as $subnode) {
                 $rbacadmin->revokePermission($subnode["child"]);
                 // remove item from all user desktops
                 $affected_users = ilUtil::removeItemFromDesktops($subnode["child"]);
                 $affected_ids[$subnode["child"]] = $subnode["child"];
                 // TODO: inform users by mail that object $id was deleted
                 //$mail->sendMail($id,$msg,$affected_users);
                 // should go to appevents at the end
             }
             // TODO: needs other handling
             // This class shouldn't have to know anything about ECS
             include_once './Services/WebServices/ECS/classes/class.ilECSObjectSettings.php';
             ilECSObjectSettings::_handleDelete($subnodes);
             if (!$tree->saveSubTree($id, true)) {
                 $log->write(__METHOD__ . ': Object with ref_id: ' . $id . ' already deleted.');
                 throw new ilRepositoryException($lng->txt("msg_obj_already_deleted"));
             }
             // write log entry
             $log->write("ilObjectGUI::confirmedDeleteObject(), moved ref_id " . $id . " to trash");
             // remove item from all user desktops
             $affected_users = ilUtil::removeItemFromDesktops($id);
             $affected_ids[$id] = $id;
             // TODO: inform users by mail that object $id was deleted
             //$mail->sendMail($id,$msg,$affected_users);
         }
         // send global events
         foreach ($affected_ids as $aid) {
             $ilAppEventHandler->raise("Services/Object", "toTrash", array("obj_id" => ilObject::_lookupObjId($aid), "ref_id" => $aid));
         }
         // inform other objects in hierarchy about paste operation
         //$this->object->notify("confirmedDelete", $_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$_SESSION["saved_post"]);
     }
     if (!$ilSetting->get('enable_trash')) {
         ilRepUtil::removeObjectsFromSystem($a_ids);
     }
 }
 public function showContainerContent()
 {
     global $ilUser, $rbacreview, $ilToolbar;
     if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
         $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilpageobjectgui'), 'edit'));
     }
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id);
     if ($is_buyable) {
         $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id));
         $obj_id = ilObject::_lookupObjId($this->cur_ref_id);
         $title = ilObject::_lookupTitle($obj_id);
         $description = ilObject::_lookupDescription($obj_id);
         $type = ilObject::_lookupType($obj_id);
         $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']);
     } else {
         $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id);
         if (count($pobjects) >= 1) {
             foreach ($pobjects as $result) {
                 $obj_id = $result['obj_id'];
                 $title = $result['title'];
                 $description = $result['description'];
                 $type = $result['type'];
                 $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']);
             }
         }
     }
     $shop_content_tpl = new ilTemplate('tpl.shop_content.html', true, true, 'Services/Payment');
     $shop_content_tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
     include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
     $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
     $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
     $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
     $html = $search_result_presentation->showSpecials();
     $shop_content_tpl->setVariable('RESULTS', $html);
     $show_general_filter = $this->oGeneralSettings->get('show_general_filter');
     $show_topics_filter = $this->oGeneralSettings->get('show_topics_filter');
     $show_shop_explorer = $this->oGeneralSettings->get('show_shop_explorer');
     if ($show_general_filter) {
         $g_filter_html = $this->showGeneralFilter(count($search_result_presentation));
         $shop_content_tpl->setVariable('FORM', $g_filter_html);
     }
     if ($show_topics_filter) {
         $this->showTopicsFilter(count($search_result_presentation));
     }
     if ($show_shop_explorer) {
         $this->showShopExplorer();
     }
     global $tpl;
     $tpl->setContent($shop_content_tpl->parse());
 }
Example #20
0
 function executeCommand()
 {
     global $rbacsystem, $ilUser, $ilAccess, $ilErr, $ilTabs, $ilNavigationHistory, $ilCtrl;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $this->prepareOutput();
     // show repository tree
     $this->showRepTree(true);
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $_GET['ref_id'])) {
         $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "frameset");
         $ilNavigationHistory->addItem($_GET['ref_id'], $link, 'crs');
     }
     if (!$this->getCreationMode()) {
         if (IS_PAYMENT_ENABLED) {
             include_once 'Services/Payment/classes/class.ilPaymentObject.php';
             if (ilPaymentObject::_requiresPurchaseToAccess($this->object->getRefId(), $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $ilTabs->setTabActive('info_short');
                 include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $this->ctrl->setReturn($this, '');
                 $pp_gui = new ilShopPurchaseGUI($this->object->getRefId());
                 $this->ctrl->forwardCommand($pp_gui);
                 return true;
             }
         }
     }
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->infoScreen();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             $this->ctrl->forwardCommand($md_gui);
             $this->tabs_gui->setTabActive('meta_data');
             break;
         case 'ilcourseregistrationgui':
             $this->ctrl->setReturn($this, 'infoScreen');
             $this->tabs_gui->setTabActive('join');
             include_once './Modules/Course/classes/class.ilCourseRegistrationGUI.php';
             $registration = new ilCourseRegistrationGUI($this->object);
             $this->ctrl->forwardCommand($registration);
             break;
         case 'ilobjectcustomuserfieldsgui':
             include_once './Services/Membership/classes/class.ilObjectCustomUserFieldsGUI.php';
             if (isset($_REQUEST['member_id'])) {
                 $this->ctrl->setReturn($this, 'members');
             }
             $cdf_gui = new ilObjectCustomUserFieldsGUI($this->object->getId());
             $this->setSubTabs('properties');
             $this->tabs_gui->setTabActive('settings');
             $this->ctrl->forwardCommand($cdf_gui);
             break;
         case "ilcourseobjectivesgui":
             include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
             $this->ctrl->setReturn($this, "");
             $reg_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
             $ret =& $this->ctrl->forwardCommand($reg_gui);
             break;
         case 'ilobjcoursegroupinggui':
             include_once './Modules/Course/classes/class.ilObjCourseGroupingGUI.php';
             $this->ctrl->setReturn($this, 'edit');
             $this->setSubTabs('properties');
             $crs_grp_gui =& new ilObjCourseGroupingGUI($this->object, (int) $_GET['obj_id']);
             $this->ctrl->forwardCommand($crs_grp_gui);
             $this->tabs_gui->setTabActive('settings');
             $this->tabs_gui->setSubTabActive('groupings');
             break;
         case "ilcolumngui":
             $this->tabs_gui->setTabActive('none');
             $this->checkPermission("read");
             //$this->prepareOutput();
             //include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
             //$this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
             //	ilObjStyleSheet::getContentStylePath(0));
             //$this->renderObject();
             $this->viewObject();
             break;
         case "ilconditionhandlergui":
             include_once './Services/AccessControl/classes/class.ilConditionHandlerGUI.php';
             // preconditions for whole course
             $this->setSubTabs("properties");
             $this->tabs_gui->setTabActive('settings');
             $new_gui =& new ilConditionHandlerGUI($this);
             $this->ctrl->forwardCommand($new_gui);
             break;
         case "illearningprogressgui":
             include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
             $new_gui =& new ilLearningProgressGUI(ilLearningProgressGUI::LP_CONTEXT_REPOSITORY, $this->object->getRefId(), $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
             $this->ctrl->forwardCommand($new_gui);
             $this->tabs_gui->setTabActive('learning_progress');
             break;
         case 'illicenseoverviewgui':
             include_once "./Services/License/classes/class.ilLicenseOverviewGUI.php";
             $license_gui =& new ilLicenseOverviewGUI($this, ilLicenseOverviewGUI::LIC_MODE_REPOSITORY);
             $ret =& $this->ctrl->forwardCommand($license_gui);
             $this->tabs_gui->setTabActive('licenses');
             break;
         case 'ilpermissiongui':
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $this->tabs_gui->setTabActive('perm_settings');
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case 'ilrepositorysearchgui':
             include_once './Services/Search/classes/class.ilRepositorySearchGUI.php';
             $rep_search =& new ilRepositorySearchGUI();
             if (ilCourseParticipant::_getInstanceByObjId($this->object->getId(), $GLOBALS['ilUser']->getId())->isAdmin() or $this->checkPermissionBool('edit_permission')) {
                 $rep_search->setCallback($this, 'assignMembersObject', $this->getLocalRoles());
             } else {
                 $rep_search->setCallback($this, 'assignMembersObject', array(ilCourseConstants::CRS_MEMBER => $this->lng->txt('crs_member'), ilCourseConstants::CRS_TUTOR => $this->lng->txt('crs_tutor')));
             }
             $this->checkLicenses();
             // Set tabs
             $this->ctrl->setReturn($this, 'members');
             $ret =& $this->ctrl->forwardCommand($rep_search);
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('crs_member_administration');
             break;
         case 'ilcoursecontentinterface':
             $this->initCourseContentInterface();
             $this->cci_obj->cci_setContainer($this);
             $this->ctrl->forwardCommand($this->cci_obj);
             $this->setSubTabs('content');
             $this->tabs_gui->setTabActive('content');
             break;
         case 'ilcoursecontentgui':
             $this->ctrl->setReturn($this, 'members');
             include_once './Modules/Course/classes/class.ilCourseContentGUI.php';
             $course_content_obj = new ilCourseContentGUI($this);
             $this->ctrl->forwardCommand($course_content_obj);
             break;
         case 'ilpublicuserprofilegui':
             $this->tpl->enableDragDropFileUpload(null);
             require_once './Services/User/classes/class.ilPublicUserProfileGUI.php';
             $profile_gui = new ilPublicUserProfileGUI($_GET["user"]);
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "membersGallery"));
             $this->tabs_gui->setSubTabActive('crs_members_gallery');
             $html = $this->ctrl->forwardCommand($profile_gui);
             $this->tpl->setVariable("ADM_CONTENT", $html);
             break;
         case 'ilmemberexportgui':
             include_once './Services/Membership/classes/Export/class.ilMemberExportGUI.php';
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('export_members');
             $export = new ilMemberExportGUI($this->object->getRefId());
             $this->ctrl->forwardCommand($export);
             break;
         case 'ilmemberagreementgui':
             include_once 'Services/Membership/classes/class.ilMemberAgreementGUI.php';
             $this->tabs_gui->clearTargets();
             $this->ctrl->setReturn($this, '');
             $agreement = new ilMemberAgreementGUI($this->object->getRefId());
             $this->ctrl->forwardCommand($agreement);
             break;
         case 'ilsessionoverviewgui':
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->tabs_gui->setSubTabActive('events');
             include_once './Modules/Course/classes/class.ilCourseParticipants.php';
             $prt = ilCourseParticipants::_getInstanceByObjId($this->object->getId());
             include_once './Modules/Session/classes/class.ilSessionOverviewGUI.php';
             $overview = new ilSessionOverviewGUI($this->object->getRefId(), $prt);
             $this->ctrl->forwardCommand($overview);
             break;
             // container page editing
         // container page editing
         case "ilcontainerpagegui":
             $ret = $this->forwardToPageObject();
             if ($ret != "") {
                 $this->tpl->setContent($ret);
             }
             break;
         case "ilcontainerstartobjectspagegui":
             // file downloads, etc. (currently not active)
             include_once "Services/Container/classes/class.ilContainerStartObjectsPageGUI.php";
             $pgui = new ilContainerStartObjectsPageGUI($this->object->getId());
             $ret = $this->ctrl->forwardCommand($pgui);
             if ($ret) {
                 $this->tpl->setContent($ret);
             }
             break;
         case 'ilobjectcopygui':
             include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('crs');
             $this->ctrl->forwardCommand($cp);
             break;
         case "ilobjstylesheetgui":
             $this->forwardToStyleSheet();
             break;
         case 'ilcourseparticipantsgroupsgui':
             include_once './Modules/Course/classes/class.ilCourseParticipantsGroupsGUI.php';
             $cmg_gui = new ilCourseParticipantsGroupsGUI($this->object->getRefId());
             $this->setSubTabs('members');
             $this->tabs_gui->setTabActive('members');
             $this->ctrl->forwardCommand($cmg_gui);
             break;
         case 'ilexportgui':
             $this->tabs_gui->setTabActive('export');
             include_once './Services/Export/classes/class.ilExportGUI.php';
             $exp = new ilExportGUI($this);
             $exp->addFormat('xml');
             $this->ctrl->forwardCommand($exp);
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         case 'ildidactictemplategui':
             $this->ctrl->setReturn($this, 'edit');
             include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateGUI.php';
             $did = new ilDidacticTemplateGUI($this);
             $this->ctrl->forwardCommand($did);
             break;
         case "ilcertificategui":
             $this->tabs_gui->activateTab("settings");
             $this->setSubTabs("properties");
             include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
             include_once "./Modules/Course/classes/class.ilCourseCertificateAdapter.php";
             $output_gui = new ilCertificateGUI(new ilCourseCertificateAdapter($this->object));
             $this->ctrl->forwardCommand($output_gui);
             break;
         case 'ilobjectservicesettingsgui':
             $this->ctrl->setReturn($this, 'edit');
             $this->setSubTabs("properties");
             $this->tabs_gui->activateTab('settings');
             $this->tabs_gui->acltivateSubTab('tool_settings');
             include_once './Services/Object/classes/class.ilObjectServiceSettingsGUI.php';
             $service = new ilObjectServiceSettingsGUI($this, $this->object->getId(), array(ilObjectServiceSettingsGUI::CALENDAR_VISIBILITY));
             $this->ctrl->forwardCommand($service);
             break;
         case 'illoeditorgui':
             #$this->tabs_gui->clearTargets();
             #$this->tabs_gui->setBackTarget($this->lng->txt('back'),$this->ctrl->getLinkTarget($this,''));
             $this->tabs_gui->activateTab('crs_objectives');
             include_once './Modules/Course/classes/Objectives/class.ilLOEditorGUI.php';
             $editor = new ilLOEditorGUI($this->object);
             $this->ctrl->forwardCommand($editor);
             break;
         case 'ilcontainerstartobjectsgui':
             $this->ctrl->setReturn($this, 'edit');
             $this->tabs_gui->clearTargets();
             $this->tabs_gui->setBackTarget($this->lng->txt("back_to_crs_content"), $this->ctrl->getLinkTarget($this, "edit"));
             $this->tabs_gui->addTab("start", $this->lng->txt("crs_start_objects"), $this->ctrl->getLinkTargetByClass("ilcontainerstartobjectsgui", "listStructure"));
             include_once './Services/Container/classes/class.ilContainerStartObjectsGUI.php';
             $stgui = new ilContainerStartObjectsGUI($this->object);
             $this->ctrl->forwardCommand($stgui);
             break;
         case 'illomembertestresultgui':
             include_once './Modules/Course/classes/Objectives/class.ilLOMemberTestResultGUI.php';
             $GLOBALS['ilCtrl']->setReturn($this, 'members');
             $GLOBALS['ilTabs']->clearTargets();
             $GLOBALS['ilTabs']->setBackTarget($GLOBALS['lng']->txt('back'), $GLOBALS['ilCtrl']->getLinkTarget($this, 'members'));
             $result_view = new ilLOMemberTestResultGUI($this, $this->object, (int) $_REQUEST['uid']);
             $this->ctrl->forwardCommand($result_view);
             break;
         default:
             /*                if(!$this->creation_mode)
                             {
                                 $this->checkPermission('visible');
                             }*/
             /*
             if(!$this->creation_mode and !$ilAccess->checkAccess('visible','',$this->object->getRefId(),'crs'))
             {
                 $ilErr->raiseError($this->lng->txt("msg_no_perm_read"),$ilErr->MESSAGE);
             }
             */
             // #9401 - see also ilStartupGUI::_checkGoto()
             if ($cmd == 'infoScreenGoto') {
                 if (ilObjCourse::_isActivated($this->object->getId()) && ilObjCourse::_registrationEnabled($this->object->getId())) {
                     $cmd = 'join';
                 } else {
                     $cmd = 'infoScreen';
                 }
             }
             if (!$this->creation_mode) {
                 if ($cmd == "infoScreen") {
                     $this->checkPermission("visible");
                 } else {
                     //						$this->checkPermission("read");
                 }
             }
             if (!$this->creation_mode && $cmd != 'infoScreen' && $cmd != 'sendfile' && $cmd != 'unsubscribe' && $cmd != 'performUnsubscribe' && !$ilAccess->checkAccess("read", '', $this->object->getRefId()) || $cmd == 'join' || $cmd == 'subscribe') {
                 include_once './Modules/Course/classes/class.ilCourseParticipants.php';
                 if ($rbacsystem->checkAccess('join', $this->object->getRefId()) && !ilCourseParticipants::_isParticipant($this->object->getRefId(), $ilUser->getId())) {
                     include_once './Modules/Course/classes/class.ilCourseRegistrationGUI.php';
                     $this->ctrl->redirectByClass("ilCourseRegistrationGUI");
                 } else {
                     $this->infoScreenObject();
                     break;
                 }
             }
             if ($cmd == 'listObjectives') {
                 include_once './Modules/Course/classes/class.ilCourseObjectivesGUI.php';
                 $this->ctrl->setReturn($this, "");
                 $obj_gui =& new ilCourseObjectivesGUI($this->object->getRefId());
                 $ret =& $this->ctrl->forwardCommand($obj_gui);
                 break;
             }
             // Dirty hack for course timings view
             if ($this->forwardToTimingsView()) {
                 break;
             }
             if (!$cmd) {
                 $cmd = 'view';
             }
             $cmd .= 'Object';
             $this->{$cmd}();
             break;
     }
     $this->addHeaderAction();
     return true;
 }
 /**
  * execute command
  */
 function executeCommand()
 {
     global $lng, $ilAccess, $ilias;
     $lng->loadLanguageModule("content");
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd("listTerms");
     // check write permission
     if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]) && !($ilAccess->checkAccess("visible", "", $_GET["ref_id"]) && ($cmd == "infoScreen" || strtolower($next_class) == "ilinfoscreengui"))) {
         $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
     }
     if ($cmd != "listDefinitions") {
         $this->prepareOutput();
     }
     include_once 'Services/Payment/classes/class.ilPaymentObject.php';
     if (IS_PAYMENT_ENABLED == true && ilPaymentObject::_requiresPurchaseToAccess($_GET["ref_id"], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
         $this->tpl->getStandardTemplate();
         include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
         $pp = new ilShopPurchaseGUI((int) $_GET['ref_id']);
         $ret = $this->ctrl->forwardCommand($pp);
     } else {
         switch ($next_class) {
             case "ilnotegui":
                 $this->setTabs();
                 $ret =& $this->listDefinitions();
                 break;
             case "ilinfoscreengui":
                 $ret =& $this->outputInfoScreen();
                 break;
             case "ilpresentationlisttablegui":
                 $prtab = $this->getPresentationTable();
                 $this->ctrl->forwardCommand($prtab);
                 return;
                 break;
             default:
                 $ret =& $this->{$cmd}();
                 break;
         }
     }
     $this->tpl->show();
 }
Example #22
0
 function executeCommand()
 {
     global $ilNavigationHistory, $ilCtrl, $ilUser, $ilTabs, $ilAccess, $ilErr;
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     if ($this->id_type == self::WORKSPACE_NODE_ID) {
         include_once "Services/Form/classes/class.ilFileInputGUI.php";
         ilFileInputGUI::setPersonalWorkspaceQuotaCheck(true);
     }
     if (!$this->getCreationMode()) {
         // do not move this payment block!!
         if (IS_PAYMENT_ENABLED) {
             include_once './Services/Payment/classes/class.ilPaymentObject.php';
             if (ANONYMOUS_USER_ID == $ilUser->getId() && isset($_GET['transaction'])) {
                 $transaction = $_GET['transaction'];
                 include_once './Services/Payment/classes/class.ilPaymentBookings.php';
                 $valid_transaction = ilPaymentBookings::_readBookingByTransaction($transaction);
             }
             if (ilPaymentObject::_requiresPurchaseToAccess($this->node_id, $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
                 $this->setLocator();
                 $this->tpl->getStandardTemplate();
                 include_once './Services/Payment/classes/class.ilShopPurchaseGUI.php';
                 $pp = new ilShopPurchaseGUI((int) $this->node_id);
                 $ret = $this->ctrl->forwardCommand($pp);
                 return true;
             }
         } else {
             if ($this->id_type == self::REPOSITORY_NODE_ID && $this->checkPermissionBool("read")) {
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->node_id);
                 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "infoScreen");
                 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
                 // add entry to navigation history
                 $ilNavigationHistory->addItem($this->node_id, $link, "file");
             }
         }
     }
     $this->prepareOutput();
     switch ($next_class) {
         case "ilinfoscreengui":
             $this->infoScreenForward();
             // forwards command
             break;
         case 'ilmdeditorgui':
             if (!$this->checkPermissionBool("write")) {
                 $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
             }
             $ilTabs->activateTab("id_meta");
             include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
             $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'General');
             // todo: make this work
             $md_gui->addObserver($this->object, 'MDUpdateListener', 'Technical');
             $this->ctrl->forwardCommand($md_gui);
             break;
             // repository permissions
         // repository permissions
         case 'ilpermissiongui':
             $ilTabs->activateTab("id_permissions");
             include_once "Services/AccessControl/classes/class.ilPermissionGUI.php";
             $perm_gui =& new ilPermissionGUI($this);
             $ret =& $this->ctrl->forwardCommand($perm_gui);
             break;
         case "ilexportgui":
             $ilTabs->activateTab("export");
             include_once "./Services/Export/classes/class.ilExportGUI.php";
             $exp_gui = new ilExportGUI($this);
             $exp_gui->addFormat("xml");
             $ret = $this->ctrl->forwardCommand($exp_gui);
             break;
         case 'ilobjectcopygui':
             include_once './Services/Object/classes/class.ilObjectCopyGUI.php';
             $cp = new ilObjectCopyGUI($this);
             $cp->setType('file');
             $this->ctrl->forwardCommand($cp);
             break;
             // personal workspace permissions
         // personal workspace permissions
         case "ilworkspaceaccessgui":
             $ilTabs->activateTab("id_permissions");
             include_once './Services/PersonalWorkspace/classes/class.ilWorkspaceAccessGUI.php';
             $wspacc = new ilWorkspaceAccessGUI($this->node_id, $this->getAccessHandler());
             $this->ctrl->forwardCommand($wspacc);
             break;
         case "ilcommonactiondispatchergui":
             include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
             $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
             $this->ctrl->forwardCommand($gui);
             break;
         default:
             // in personal workspace use object2gui
             if ($this->id_type == self::WORKSPACE_NODE_ID) {
                 $this->addHeaderAction();
                 // coming from goto we need default command
                 if (empty($cmd)) {
                     $ilCtrl->setCmd("infoScreen");
                 }
                 $ilTabs->clearTargets();
                 return parent::executeCommand();
             }
             if (empty($cmd)) {
                 $cmd = "infoScreen";
             }
             $this->{$cmd}();
             break;
     }
     $this->addHeaderAction();
 }
 private function showItemsTable(&$a_tpl, $a_result_set, $a_pay_method = 0)
 {
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     include_once './Services/Payment/classes/class.ilShoppingCartTableGUI.php';
     $tbl = new ilShoppingCartTableGUI($this);
     $tbl->setId('tbl_id_' . $a_pay_method);
     $tbl->setTitle($this->lng->txt('paya_shopping_cart') . " (" . $this->lng->txt('payment_system') . ": " . ilPayMethods::getStringByPaymethod($a_pay_method['pm_title']) . ")");
     $coupon_session = $a_pay_method['pm_title'];
     $tbl->setRowTemplate("tpl.shop_shoppingcart_row.html", "Services/Payment");
     $tbl->addColumn('', 'item', '1%', true);
     $tbl->addColumn($this->lng->txt('title'), "table" . $a_pay_method['pm_title'] . "_title", '30%');
     $tbl->addColumn($this->lng->txt('duration'), "table" . $a_pay_method['pm_title'] . "_duration", '30%');
     $tbl->addColumn($this->lng->txt('vat_rate'), "table" . $a_pay_method['pm_title'] . "_vat_rate", '15%');
     $tbl->addColumn($this->lng->txt('vat_unit'), "table" . $a_pay_method['pm_title'] . "_vat_unit", '15%');
     $tbl->addColumn($this->lng->txt('price_a'), "table" . $a_pay_method['pm_title'] . "_price", '10%');
     $tbl->setPrefix("table" . $a_pay_method['pm_title'] . "_");
     $tbl->addMultiCommand('deleteItem', $this->lng->txt('delete'));
     // show total amount of costs
     $sc_obj = new ilPaymentShoppingCart($this->user_obj);
     $totalAmount = $sc_obj->getTotalAmount();
     if (!empty($_SESSION['coupons'][$coupon_session])) {
         if (count($items = $sc_obj->getEntries($a_pay_method['pm_id']))) {
             $tbl->setTotalData('TXT_SUB_TOTAL', $this->lng->txt('pay_bmf_subtotal_amount') . ": ");
             $tbl->setTotalData('VAL_SUB_TOTAL', number_format($totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit'));
             foreach ($_SESSION['coupons'][$coupon_session] as $coupon) {
                 $this->coupon_obj->setId($coupon['pc_pk']);
                 $this->coupon_obj->setCurrentCoupon($coupon);
                 $total_object_price = 0.0;
                 $current_coupon_bonus = 0.0;
                 foreach ($items as $item) {
                     $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
                     if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                         $price_data = ilPaymentPrices::_getPrice($item['price_id']);
                         $price = (double) $price_data['price'];
                         $total_object_price += $price;
                     }
                     unset($tmp_pobject);
                 }
                 $current_coupon_bonus = $this->coupon_obj->getCouponBonus($total_object_price);
                 $totalAmount[$current_coupon_bonus] += $current_coupon_bonus * -1;
             }
             $tbl->setTotalData('TXT_COUPON_BONUS', $this->lng->txt('paya_coupons_coupon') . ": ");
             # . $coupon['pcc_code'] . ": ");
             #$tbl->setTotalData('VAL_COUPON_BONUS', number_format($current_coupon_bonus * (-1), 2, ',', '.') . " " . $genSet->get('currency_unit'));
             $tbl->setTotalData('VAL_COUPON_BONUS', number_format($totalAmount[$current_coupon_bonus], 2, ',', '.') . " " . $genSet->get('currency_unit'));
             if ($totalAmount[$a_pay_method['pm_id']] < 0) {
                 $totalAmount[$a_pay_method['pm_id']] = 0;
                 $this->totalVat = 0;
             }
         }
     }
     $this->totalAmount[$a_pay_method['pm_id']] = $totalAmount[$a_pay_method['pm_id']] - $totalAmount[$current_coupon_bonus] * -1;
     $tbl->setTotalData('TXT_TOTAL_AMOUNT', $this->lng->txt('pay_bmf_total_amount') . ": ");
     $tbl->setTotalData('VAL_TOTAL_AMOUNT', number_format($this->totalAmount[$a_pay_method['pm_id']], 2, ',', '.') . " " . $genSet->get('currency_unit'));
     #.$item['currency']);
     if ($this->totalVat > 0) {
         $tbl->setTotalData('TXT_TOTAL_VAT', $this->lng->txt('pay_bmf_vat_included') . ": ");
         $tbl->setTotalData('VAL_TOTAL_VAT', number_format($this->totalVat, 2, ',', '.') . " " . $genSet->get('currency_unit'));
     }
     $tbl->setData($a_result_set);
     $a_tpl->setVariable('ITEMS_TABLE', $tbl->getCartHTML());
     return true;
 }
 public function performDeleteDeassignCrs()
 {
     include_once './Services/Payment/classes/class.ilShopUtils.php';
     if (!isset($_GET['booking_id'])) {
         ilUtil::sendInfo($this->lng->txt('paya_no_booking_id_given'));
         $this->showStatistics();
         return true;
     }
     $this->__initBookingObject();
     $bookings = $this->booking_obj->getBookings();
     $booking = $bookings[(int) $_GET['booking_id']];
     $pobject_data = ilPaymentObject::_getObjectData($booking['pobject_id']);
     ilShopUtils::_deassignPurchasedCourseMemberRole($pobject_data['ref_id'], $booking['customer_id']);
     $this->booking_obj->setBookingId((int) $_GET['booking_id']);
     if (!$this->booking_obj->delete()) {
         die('Error deleting booking');
     }
     ilUtil::sendInfo($this->lng->txt('pay_deleted_booking'));
     $this->showStatistics();
     return true;
 }
 /**
  * @param $cur_obj_type
  * @param $item
  * @return array
  */
 private function getObjectListItem($cur_obj_type, $item)
 {
     if ($cur_obj_type != $item['type']) {
         include_once 'Services/Object/classes/class.ilObjectListGUIFactory.php';
         $item_list_gui = ilObjectListGUIFactory::_getListGUIByType($item['type']);
     }
     $item_list_gui->initItem($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], ilObjectListGUI::CONTEXT_SHOP);
     $item_list_gui->enableDelete(false);
     $item_list_gui->enableCut(false);
     $item_list_gui->enableCopy(false);
     $item_list_gui->enableLink(false);
     $item_list_gui->enableSubscribe(false);
     $item_list_gui->enablePayment(true);
     $item_list_gui->enableCommands(true);
     $item_list_gui->enablePath(false);
     $item_list_gui->insertCommands();
     $item_list_gui->enableInfoScreen(false);
     $item_list_gui->enableSubstitutions(false);
     $item_list_gui->enableNoticeProperties(false);
     $item_list_gui->enablePreconditions(false);
     $item_list_gui->enableProperties(false);
     $item_list_gui->setBoldTitle(true);
     if (ilPaymentObject::_hasAccess($item['ref_id'])) {
         $item_list_gui->enableInfoScreen(true);
         $item_list_gui->enableCommands(true);
     }
     //		else
     //		{
     switch ($item['type']) {
         case 'sahs':
             $demo_link = 'ilias.php?baseClass=ilSAHSPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo';
             break;
         case 'lm':
             $demo_link = 'ilias.php?baseClass=ilLMPresentationGUI&ref_id=' . $item['ref_id'] . '&purchasetype=demo';
             break;
         case 'exc':
             $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"];
             break;
         default:
             $demo_link = $this->ctrl->getLinkTargetByClass('ilshoppurchasegui', 'showDemoVersion') . '&purchasetype=demo&ref_id=' . $item["ref_id"];
             break;
     }
     $item['title'] = '<a href="' . $demo_link . '">' . $item["title"] . '</a>';
     //		}
     $tpl_pinfo = new ilTemplate('tpl.shop_item_info.html', true, true, 'Services/Payment');
     if ($item['price_string'] != '') {
         $tpl_pinfo->setCurrentBlock('ploop');
         $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('price_a'));
         $tpl_pinfo->setVariable('VALUE', $item['price_string']);
         $tpl_pinfo->parseCurrentBlock();
     }
     if ($item['author'] != '') {
         $tpl_pinfo->setCurrentBlock('ploop');
         $tpl_pinfo->setVariable('PROPERTY', $this->lng->txt('author'));
         $tpl_pinfo->setVariable('VALUE', $item['author']);
         $tpl_pinfo->parseCurrentBlock();
     }
     $oFile = new ilFileDataShop(ilPaymentObject::_lookupPobjectId($item['ref_id']));
     if (($webpath_file = $oFile->getCurrentImageWebPath()) !== false) {
         $tpl_pinfo->setCurrentBlock('image');
         $tpl_pinfo->setVariable('SRC', $webpath_file);
         $tpl_pinfo->setVariable('ALT', strip_tags($item['title']));
         $tpl_pinfo->parseCurrentBlock();
     }
     $item_list_gui->addSubItemHTML($tpl_pinfo->get());
     $html = $item_list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description'], false, false, "", ilObjectListGUI::CONTEXT_SHOP);
     return array($item, $html);
 }
 function isClickable($a_type, $a_node_id)
 {
     global $ilUser;
     $orig_node_id = $a_node_id;
     if ($a_type == "st") {
         if (!$this->offlineMode()) {
             $a_node = $this->tree->fetchSuccessorNode($a_node_id, "pg");
             $a_node_id = $a_node["child"];
             if ($a_node_id == 0) {
                 return false;
             }
         } else {
             // get next activated page
             $found = false;
             while (!$found) {
                 $a_node = $this->tree->fetchSuccessorNode($a_node_id, "pg");
                 $a_node_id = $a_node["child"];
                 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                 $active = ilLMPage::_lookupActive($a_node_id, $this->lm_obj->getType(), $this->lm_set->get("time_scheduled_page_activation"));
                 if ($a_node_id > 0 && !$active) {
                     $found = false;
                 } else {
                     $found = true;
                 }
             }
             if ($a_node_id <= 0) {
                 return false;
             } else {
                 $path = $this->tree->getPathId($a_node_id);
                 if (!in_array($orig_node_id, $path)) {
                     return false;
                 }
             }
         }
     }
     if ($a_type == "pg") {
         // check public area mode
         include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         if (($ilUser->getId() == ANONYMOUS_USER_ID || ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm_obj->getRefId())) && !ilLMObject::_isPagePublic($a_node_id, true)) {
             return false;
         }
     }
     return true;
 }
 /**
  * execute command
  */
 function &executeCommand()
 {
     global $lng, $ilAccess, $ilNavigationHistory, $ilCtrl, $ilLocator, $ilObjDataCache;
     include_once "./Services/Object/classes/class.ilObjectGUI.php";
     include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
     $lng->loadLanguageModule("content");
     $obj_id = ilObject::_lookupObjectId($_GET['ref_id']);
     // add entry to navigation history
     if ($ilAccess->checkAccess("read", "", $_GET["ref_id"])) {
         include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
         if (!ilObjSAHSLearningModuleAccess::_lookupEditable($obj_id)) {
             $ilNavigationHistory->addItem($_GET["ref_id"], "ilias.php?cmd=infoScreen&baseClass=ilSAHSPresentationGUI&ref_id=" . $_GET["ref_id"], "lm");
         }
     }
     include_once 'Services/Payment/classes/class.ilPaymentObject.php';
     if (ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL)) {
         $ilLocator->addRepositoryItems();
         $ilLocator->addItem($ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($_GET['ref_id'])), 'ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=' . $_GET['ref_id'], '', $_GET['ref_id'], 'sahs');
         $this->tpl->setLocator();
         $this->tpl->getStandardTemplate();
         include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
         $this->ctrl->setReturn($this, '');
         $pp_gui = new ilShopPurchaseGUI($_GET['ref_id']);
         $this->ctrl->forwardCommand($pp_gui);
         $this->tpl->show();
         exit;
     }
     $next_class = $this->ctrl->getNextClass($this);
     $cmd = $this->ctrl->getCmd();
     $type = ilObjSAHSLearningModule::_lookupSubType($obj_id);
     if ($cmd == "downloadCertificate") {
         require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php";
         $scorm_gui = new ilSCORMPresentationGUI();
         $ret =& $this->ctrl->forwardCommand($scorm_gui);
     }
     switch ($type) {
         case "scorm2004":
             include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php";
             $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false);
             break;
         case "scorm":
             include_once "./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php";
             $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false);
             break;
         case "aicc":
             include_once "./Modules/ScormAicc/classes/class.ilObjAICCLearningModuleGUI.php";
             $this->slm_gui = new ilObjAICCLearningModuleGUI("", $_GET["ref_id"], true, false);
             break;
         case "hacp":
             include_once "./Modules/ScormAicc/classes/class.ilObjHACPLearningModuleGUI.php";
             $this->slm_gui = new ilObjHACPLearningModuleGUI("", $_GET["ref_id"], true, false);
             break;
     }
     if ($next_class != "ilinfoscreengui" && $cmd != "infoScreen" && $next_class != "illearningprogressgui") {
         include_once "./Services/License/classes/class.ilLicense.php";
         ilLicense::_noteAccess($obj_id, "sahs", $_GET["ref_id"]);
         switch ($type) {
             case "scorm2004":
                 $this->ctrl->setCmdClass("ilscorm13player");
                 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false);
                 break;
             case "scorm":
                 $this->ctrl->setCmdClass("ilscormpresentationgui");
                 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false);
                 break;
             case "aicc":
                 $this->ctrl->setCmdClass("ilaiccpresentationgui");
                 break;
             case "hacp":
                 $this->ctrl->setCmdClass("ilhacppresentationgui");
                 break;
         }
         $next_class = $this->ctrl->getNextClass($this);
     }
     switch ($next_class) {
         case "ilinfoscreengui":
             $ret =& $this->outputInfoScreen();
             break;
         case "ilscorm13player":
             require_once "./Modules/Scorm2004/classes/ilSCORM13Player.php";
             $scorm_gui = new ilSCORM13Player();
             $ret =& $this->ctrl->forwardCommand($scorm_gui);
             break;
         case "ilscormpresentationgui":
             require_once "./Modules/ScormAicc/classes/SCORM/class.ilSCORMPresentationGUI.php";
             $scorm_gui = new ilSCORMPresentationGUI();
             $ret =& $this->ctrl->forwardCommand($scorm_gui);
             break;
         case "ilaiccpresentationgui":
             require_once "./Modules/ScormAicc/classes/AICC/class.ilAICCPresentationGUI.php";
             $aicc_gui = new ilAICCPresentationGUI();
             $ret =& $this->ctrl->forwardCommand($aicc_gui);
             break;
         case "ilhacppresentationgui":
             require_once "./Modules/ScormAicc/classes/HACP/class.ilHACPPresentationGUI.php";
             $hacp_gui = new ilHACPPresentationGUI();
             $ret =& $this->ctrl->forwardCommand($hacp_gui);
             break;
         case "illearningprogressgui":
             $this->setInfoTabs("learning_progress");
             include_once "./Services/Tracking/classes/class.ilLearningProgressGUI.php";
             $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY, $_GET['ref_id']);
             $this->ctrl->forwardCommand($new_gui);
             $this->tpl->show();
             break;
         default:
             $this->{$cmd}();
     }
 }
 /**
  * Is node clickable
  *
  * @param array $a_node node array
  * @return bool clickable?
  */
 function isNodeClickable($a_node)
 {
     global $ilUser;
     $orig_node_id = $a_node["child"];
     // if navigation is restricted based on correct answered questions
     // check if we have preceeding pages including unsanswered/incorrect answered questions
     if (!$this->getOfflineMode()) {
         if ($this->lm->getRestrictForwardNavigation()) {
             if ($this->getTracker()->hasPredIncorrectAnswers($orig_node_id)) {
                 return false;
             }
         }
     }
     if ($a_node["type"] == "st") {
         if (!$this->getOfflineMode()) {
             if ($this->lm->getTOCMode() != "pages") {
                 $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
             } else {
                 // faster, but needs pages to be in explorer
                 $a_node = $this->getSuccessorNode($a_node["child"], "pg");
             }
             if ($a_node["child"] == 0) {
                 return false;
             }
         } else {
             // get next activated page
             $found = false;
             while (!$found) {
                 if ($this->lm->getTOCMode() != "pages") {
                     $a_node = $this->getTree()->fetchSuccessorNode($a_node["child"], "pg");
                 } else {
                     $a_node = $this->getSuccessorNode($a_node["child"], "pg");
                 }
                 include_once "./Modules/LearningModule/classes/class.ilLMPage.php";
                 $active = ilLMPage::_lookupActive($a_node["child"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation"));
                 if ($a_node["child"] > 0 && !$active) {
                     $found = false;
                 } else {
                     $found = true;
                 }
             }
             if ($a_node["child"] <= 0) {
                 return false;
             } else {
                 $path = $this->getTree()->getPathId($a_node["child"]);
                 if (!in_array($orig_node_id, $path)) {
                     return false;
                 }
             }
         }
     }
     if ($a_node["type"] == "pg") {
         // check public area mode
         include_once "./Modules/LearningModule/classes/class.ilLMObject.php";
         include_once 'Services/Payment/classes/class.ilPaymentObject.php';
         if (($ilUser->getId() == ANONYMOUS_USER_ID || ilPaymentObject::_requiresPurchaseToAccess((int) $this->lm->getRefId())) && !ilLMObject::_isPagePublic($a_node["child"], true)) {
             return false;
         }
     }
     return true;
 }
 /**
  * Creates output for explorer view in admin menue
  * recursive method
  * @access	public
  * @param	integer		parent_node_id where to start from (default=0, 'root')
  * @param	integer		depth level where to start (default=1)
  * @return	string
  */
 public function setOutput($a_parent, $a_depth = 1)
 {
     global $ilCtrl, $tree;
     $this->root_id = $tree->getRootId();
     if ($a_parent < $a_depth) {
         foreach ($this->payment_objects as $ref_id) {
             $objects = $tree->getPathFull($ref_id);
             foreach ($objects as $object) {
                 if ($object['child'] == $this->root_id) {
                     $href = $ilCtrl->getLinkTargetByClass('ilshopgui', '');
                     $title = "<span style='white-space:wrap;' class='frmTitle'><a class='small' href='" . $href . "'>" . stripslashes($object['title']) . "</a></span>" . "<div style='white-space:nowrap; margin-bottom:5px;' class='small'></div>";
                     $this->tpl->setVariable('TREE_ROOT_NODE_VARIABLE', 'Node' . $object['child']);
                     $this->tpl->setVariable('TREE_ROOT_NODE_LINK', $title);
                     // Recursive
                     $this->setOutput($object['child'], $a_depth);
                 } else {
                     if ($this->checkFilter($object['type']) && ilPaymentObject::_isBuyable($object['ref_id'])) {
                     } else {
                         if ($this->checkFilter($object['type']) && !ilPaymentObject::_isBuyable($object['ref_id'])) {
                             $href = $ilCtrl->getLinkTargetByClass('ilshopgui', '');
                             $title = "<span style='white-space:wrap;' class='frmTitle'><a class='small' href='" . $href . "&tree_ref_id=" . $object['child'] . "'>" . stripslashes($object['title']) . "</a></span>" . "<div style='white-space:nowrap; margin-bottom:5px;' class='small'></div>";
                             $this->tpl->setCurrentBlock('nodes');
                             $this->tpl->setVariable('NODES_VARNAME', 'Node' . $object['child']);
                             $this->tpl->setVariable('NODES_PARENT_VARNAME', 'Node' . $object['parent']);
                             $this->tpl->setVariable('NODES_LINK', $title);
                             $this->tpl->parseCurrentBlock();
                             // Recursive
                             $this->setOutput($object['child'], $a_depth);
                         }
                     }
                 }
             }
             //foreach
         }
     }
 }
Example #30
0
 public function showContainerContent()
 {
     global $ilUser, $rbacreview, $ilToolbar, $tpl;
     if ($rbacreview->isAssigned($ilUser->getId(), SYSTEM_ROLE_ID)) {
         $ilToolbar->addButton($this->lng->txt('edit_page'), $this->ctrl->getLinkTargetByClass(array('ilshoppagegui'), 'edit'));
     }
     include_once './Services/Payment/classes/class.ilPaymentObject.php';
     $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.shop_content.html', 'Services/Payment');
     $this->tpl->setVariable('PAGE_CONTENT', $this->getPageHTML());
     $is_buyable = ilPaymentObject::_isBuyable($this->cur_ref_id);
     if ($is_buyable) {
         $pobjects = ilPaymentObject::_getObjectData(ilPaymentObject::_lookupPobjectId($this->cur_ref_id));
         $obj_id = ilObject::_lookupObjId($this->cur_ref_id);
         $title = ilObject::_lookupTitle($obj_id);
         $description = ilObject::_lookupDescription($obj_id);
         $type = ilObject::_lookupType($obj_id);
         $presentation_results[$pobjects['pt_topic_fk']][$type][] = array('ref_id' => $pobjects['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $pobjects['pt_topic_fk'], 'child' => $pobjects['child']);
     } else {
         $pobjects = ilPaymentObject::_getContainerObjects($this->cur_ref_id);
         if (count($pobjects) >= 1) {
             foreach ($pobjects as $result) {
                 $obj_id = $result['obj_id'];
                 $title = $result['title'];
                 $description = $result['description'];
                 $type = $result['type'];
                 $presentation_results[$result['pt_topic_fk']][$type][] = array('ref_id' => $result['ref_id'], 'title' => $title, 'description' => $description, 'type' => $type, 'obj_id' => $obj_id, 'topic_id' => $result['pt_topic_fk'], 'child' => $result['child']);
             }
         }
     }
     include_once 'Services/Payment/classes/class.ilShopResultPresentationGUI.php';
     $search_result_presentation = new ilShopResultPresentationGUI($presentation_results);
     $search_result_presentation->setSortField(strtolower(trim($this->getSortField())));
     $search_result_presentation->setSortDirection(trim($this->getSortDirection()));
     if (!$presentation_results) {
         $this->tpl->setVariable('RESULTS', $this->lng->txt('payment_shop_not_objects_found'));
     } else {
         $html = $search_result_presentation->showSpecials();
         $this->tpl->setVariable('RESULTS', $html);
     }
     $this->showFilters();
 }