/** * Returns a description of the available certificate parameters. The description will be shown at * the bottom of the certificate editor text area. * * @return string The certificate parameters description */ public function getCertificateVariablesDescription() { global $lng; $vars = $this->getBaseVariablesDescription(); $vars["SCORM_TITLE"] = $lng->txt("certificate_ph_scormtitle"); $vars["SCORM_POINTS"] = $lng->txt("certificate_ph_scormpoints"); $vars["SCORM_POINTS_MAX"] = $lng->txt("certificate_ph_scormmaxpoints"); $template = new ilTemplate("tpl.certificate_edit.html", TRUE, TRUE, "Modules/ScormAicc"); $template->setCurrentBlock("items"); foreach ($vars as $id => $caption) { $template->setVariable("ID", $id); $template->setVariable("TXT", $caption); $template->parseCurrentBlock(); } $template->setVariable("PH_INTRODUCTION", $lng->txt("certificate_ph_introduction")); include_once 'Services/Tracking/classes/class.ilLPCollections.php'; $lp_collections = new ilLPCollections($this->object->getId()); if (!($items = ilLPCollections::_getPossibleSAHSItems($this->object->getId()))) { $template->setCurrentBlock('NO_SCO'); $template->setVariable('PH_NO_SCO', $lng->txt('certificate_ph_no_sco')); $template->parseCurrentBlock(); } else { $template->setCurrentBlock('SCOS'); $template->setVariable('PH_SCOS', $lng->txt('certificate_ph_scos')); $template->parseCurrentBlock(); $template->setCurrentBlock('SCO_HEADER'); $template->setVariable('PH_TITLE_SCO', $lng->txt('certificate_ph_title_sco')); //$template->setVariable('PH_PH',$lng->txt('certificate_ph_ph')); $template->setVariable('PH_SCO_TITLE', $lng->txt('certificate_ph_sco_title')); $template->setVariable('PH_SCO_POINTS_RAW', $lng->txt('certificate_ph_sco_points_raw')); $template->setVariable('PH_SCO_POINTS_MAX', $lng->txt('certificate_ph_sco_points_max')); $template->setVariable('PH_SCO_POINTS_SCALED', $lng->txt('certificate_ph_sco_points_scaled')); $template->parseCurrentBlock(); } $counter = 0; foreach (ilLPCollections::_getPossibleSAHSItems($this->object->getId()) as $item_id => $sahs_item) { if ($lp_collections->isAssigned($item_id)) { $template->setCurrentBlock("SCO"); $template->setVariable('SCO_TITLE', $sahs_item['title']); $template->setVariable('PH_SCO_TITLE', '[SCO_T_' . $counter . ']'); $template->setVariable('PH_SCO_POINTS_RAW', '[SCO_P_' . $counter . ']'); $template->setVariable('PH_SCO_POINTS_MAX', '[SCO_PM_' . $counter . ']'); $template->setVariable('PH_SCO_POINTS_SCALED', '[SCO_PP_' . $counter . ']'); $template->parseCurrentBlock(); $counter++; } } return $template->get(); }
/** * Init form for condition table * * @access private * @param * */ private function initFormCondition($a_source_id, $a_condition_id = 0, $a_mode = 'add') { $trigger_obj_id = ilObject::_lookupObjId($a_source_id); $trigger_type = ilObject::_lookupType($trigger_obj_id); $condition = ilConditionHandler::_getCondition($a_condition_id); if (is_object($this->form)) { return true; } include_once 'Services/Form/classes/class.ilPropertyFormGUI.php'; $this->form = new ilPropertyFormGUI(); $this->ctrl->setParameter($this, 'source_id', $a_source_id); $this->form->setFormAction($this->ctrl->getFormAction($this)); $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source")); $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id))); $this->form->addItem($info_source); $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target")); $info_target->setValue($this->getTargetTitle()); $this->form->addItem($info_target); /* moved to list $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory'); $obl->setInfo($this->lng->txt('precondition_obligatory_info')); $obl->setValue(1); if($a_condition_id) { $obl->setChecked($condition['obligatory']); } else { $obl->setChecked(true); } $this->form->addItem($obl); */ $obl = new ilHiddenInputGUI('obligatory'); if ($a_condition_id) { $obl->setValue($condition['obligatory']); } else { $obl->setValue(1); } $this->form->addItem($obl); $sel = new ilSelectInputGUI($this->lng->txt('condition'), 'operator'); include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; $ch_obj = new ilConditionHandler(); if ($a_mode == 'add') { $operators[0] = $this->lng->txt('select_one'); } foreach ($ch_obj->getOperatorsByTargetType($trigger_type) as $operator) { $operators[$operator] = $this->lng->txt('condition_' . $operator); } $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0); $sel->setOptions($operators); $sel->setRequired(true); $this->form->addItem($sel); if (ilConditionHandler::_isReferenceHandlingOptional($this->getTargetType())) { $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'), 'ref_handling'); $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS); $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'), ilConditionHandler::SHARED_CONDITIONS); $rad_opt->addOption($opt2); $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'), ilConditionHandler::UNIQUE_CONDITIONS); $rad_opt->addOption($opt1); $this->form->addItem($rad_opt); } // Additional settings for SCO's if ($trigger_type == 'sahs') { $this->lng->loadLanguageModule('trac'); include_once 'Services/Tracking/classes/class.ilLPCollections.php'; $lp_collections = new ilLPCollections($trigger_obj_id); $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'), 'item_ids[]'); $cus->setRequired(true); $tpl = new ilTemplate('tpl.condition_handler_sco_row.html', true, true, "Services/AccessControl"); $counter = 0; foreach (ilLPCollections::_getPossibleSAHSItems($trigger_obj_id) as $item_id => $sahs_item) { $tpl->setCurrentBlock("sco_row"); $tpl->setVariable('SCO_ID', $item_id); $tpl->setVariable('SCO_TITLE', $sahs_item['title']); $tpl->setVariable('CHECKED', $lp_collections->isAssigned($item_id) ? 'checked="checked"' : ''); $tpl->parseCurrentBlock(); $counter++; } $tpl->setVariable('INFO_SEL', $this->lng->txt('trac_lp_determination_info_sco')); $cus->setHTML($tpl->get()); $this->form->addItem($cus); } switch ($a_mode) { case 'edit': $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.png')); $this->form->setTitle($this->lng->txt('rbac_edit_condition')); $this->form->addCommandButton('updateCondition', $this->lng->txt('save')); $this->form->addCommandButton('listConditions', $this->lng->txt('cancel')); break; case 'add': $this->form->setTitleIcon(ilUtil::getImagePath('icon_' . $this->getTargetType() . '.png')); $this->form->setTitle($this->lng->txt('add_condition')); $this->form->addCommandButton('assign', $this->lng->txt('save')); $this->form->addCommandButton('selector', $this->lng->txt('back')); break; } return true; }