/** * Build action menu * * @param array $a_set * @return ilAdvancedSelectionListGUI */ protected function buildActionMenu(array $a_set) { $list = new ilAdvancedSelectionListGUI(); $list->setId($a_set['id']); $list->setListTitle($this->pl->txt('actions')); $this->ctrl->setParameterByClass('srcertificatetypegui', 'type_id', $this->type->getId()); $this->ctrl->setParameterByClass('srcertificatetypegui', 'custom_setting_id', $a_set['id']); $list->addItem($this->lng->txt('edit'), 'edit', $this->ctrl->getLinkTargetByClass('srcertificatetypegui', 'editCustomSetting')); $list->addItem($this->lng->txt('delete'), 'delete', $this->ctrl->getLinkTargetByClass('srcertificatetypegui', 'confirmDeleteCustomSetting')); $this->ctrl->clearParametersByClass('srcertificatetypegui'); return $list; }
/** * Pass data to row template * * @param array $set */ public function fillRow($set) { $this->tpl->setVariable('TITLE', $set['title']); $this->tpl->setVariable('DESCRIPTION', $set['description']); $this->tpl->setVariable('DEFAULT_LANG', $set['default_language']); $this->tpl->setVariable('ICON', $set['icon']); $this->ctrl->setParameterByClass("ilorgunittypegui", "type_id", $set['id']); $selection = new ilAdvancedSelectionListGUI(); $selection->setListTitle($this->lng->txt('Actions')); $selection->setId('action_orgu_type' . $set['id']); $selection->addItem($this->lng->txt('edit'), 'edit', $this->ctrl->getLinkTargetByClass('ilorgunittypegui', 'edit')); $selection->addItem($this->lng->txt('delete'), 'delete', $this->ctrl->getLinkTargetByClass('ilorgunittypegui', 'delete')); $this->tpl->setVariable('ACTIONS', $selection->getHTML()); }
/** * @param array $a_set */ protected function fillRow(array $a_set) { // For checkboxes in first column if (count($this->getOption('actions_multi')) && $a_set['status'] == 3) { $this->tpl->setCurrentBlock('CHECKBOXES'); $this->tpl->setVariable('VALUE', $a_set['id']); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock('COL'); $this->tpl->setVariable('VALUE', ''); $this->tpl->parseCurrentBlock(); } $utc = ilCertificateConfig::get('time_format_utc'); $date_function = $utc ? 'gmdate' : 'date'; foreach ($this->columns as $k => $column) { $value = is_null($a_set[$column]) ? '' : $a_set[$column]; if ($this->isColumnSelected($column)) { // Format dates if (in_array($column, array('valid_from', 'valid_to')) && $value != '') { $time = strtotime($value); $time = $utc ? $time + srCertificate::TIME_ZONE_CORRECTION : $time; switch ($this->user->getDateFormat()) { case ilCalendarSettings::DATE_FORMAT_DMY: $value = $date_function('d.m.Y', $time); break; case ilCalendarSettings::DATE_FORMAT_MDY: $value = $date_function('m/d/Y', $time); break; } } elseif (in_array($column, array('valid_from', 'valid_to')) && $value == '') { $value = $this->pl->txt('unlimited'); } if ($column == 'status') { $value = $this->pl->txt("cert_status_" . (int) $value); } // Set value $this->tpl->setCurrentBlock('COL'); $this->tpl->setVariable('VALUE', $value); $this->tpl->parseCurrentBlock(); } } // Actions if (count($this->getOption('actions'))) { if ($this->hasAction($a_set)) { $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'cert_id', $a_set['id']); $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'status', $a_set['status']); $async_url = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), get_class($this->parent_obj)), 'buildActions', '', true); $actions = new ilAdvancedSelectionListGUI(); $actions->setId('action_list_' . $a_set['id']); $actions->setAsynchUrl($async_url); $actions->setAsynch(true); $actions->setListTitle($this->pl->txt('actions')); } else { $actions = ' '; } $this->tpl->setCurrentBlock('ACTIONS'); $this->tpl->setVariable('ACTIONS', is_string($actions) ? $actions : $actions->getHTML()); $this->tpl->parseCurrentBlock(); } }
/** * returns a link to page object editor for page object * with given type and id * * @final * @access private * @param type $pageObjectType * @param type $pageObjectId * @return string $pageObjectEditingLink */ private final function getPageObjectEditingLink($pageObjectType, $pageObjectId) { $cl = $this->getClassNameByType($pageObjectType, true); $this->ctrl->setParameterByClass($cl, 'feedback_type', $pageObjectType); $this->ctrl->setParameterByClass($cl, 'feedback_id', $pageObjectId); $linkHREF = $this->ctrl->getLinkTargetByClass($cl, 'edit'); $linkTEXT = $this->lng->txt('tst_question_feedback_edit_page'); return "<a href='{$linkHREF}'>{$linkTEXT}</a>"; }
protected function redirectToRefId($a_ref_id, $a_cmd = "") { $obj_type = ilObject::_lookupType($a_ref_id, true); if ($obj_type != "orgu") { parent::redirectToRefId($a_ref_id, $a_cmd); } else { $this->ctrl->setParameterByClass("ilObjOrgUnitGUI", "ref_id", $a_ref_id); $this->ctrl->redirectByClass("ilObjOrgUnitGUI", $a_cmd); } }
public function delete() { $mainTableId = $this->table->getCollectionObject()->getMainTableId(); if ($mainTableId == $this->table->getId()) { ilUtil::sendFailure($this->lng->txt("dcl_cant_delete_main_table"), true); } else { $this->ctrl->setParameterByClass("ildatacollectionfieldlistgui", "table_id", $mainTableId); } $this->table->doDelete(); $this->ctrl->redirectByClass("ildatacollectionfieldlistgui", "listFields"); }
/** * @param $a_comp * @param $a_part * @param array $a_par */ public function modifyGUI($a_comp, $a_part, $a_par = array()) { /** * @var $ilTabsGUI ilTabsGUI */ if ($a_part == 'tabs' && isset($_GET['ref_id']) && self::$ref_is_crs !== false) { // ATM only display certificate tab in courses if (self::$ref_is_crs === null && ilObject::_lookupType((int) $_GET['ref_id'], true) != 'crs' || $_GET['admin_mode']) { self::$ref_is_crs = false; return; } self::$ref_is_crs = true; // User needs write access to course to see the tab 'certificate' if ($this->access->checkAccess('write', '', (int) $_GET['ref_id'])) { $ilTabsGUI = $a_par['tabs']; $this->ctrl->setParameterByClass('srCertificateDefinitionGUI', 'ref_id', $_GET['ref_id']); $link = $this->ctrl->getLinkTargetByClass(array(ilCertificatePlugin::getBaseClass(), 'srCertificateDefinitionGUI')); $ilTabsGUI->addTarget('certificate', $link, 'show', 'srCertificateDefinitionGUI'); } } }
/** * Set Course title and icon in header * */ protected function initHeader() { $lgui = ilObjectListGUIFactory::_getListGUIByType($this->crs->getType()); $this->tpl->setTitle($this->crs->getTitle()); $this->tpl->setDescription($this->crs->getDescription()); if ($this->crs->getOfflineStatus()) { $this->tpl->setAlertProperties($lgui->getAlertProperties()); } $this->tpl->setTitleIcon(ilUtil::getTypeIconPath('crs', $this->crs->getId(), 'big')); $this->ctrl->setParameterByClass('ilrepositorygui', 'ref_id', $this->ref_id); $this->tabs->setBackTarget($this->pl->txt('back_to_course'), $this->ctrl->getLinkTargetByClass('ilrepositorygui')); }
protected function addOtherRolesToolbar() { $arrLocalRoles = $this->rbacreview->getLocalRoles($this->parent_object->getRefId()); $types = array(); foreach ($arrLocalRoles as $role_id) { $ilObjRole = new ilObjRole($role_id); if (!preg_match("/il_orgu_/", $ilObjRole->getUntranslatedTitle())) { $types[$role_id] = $ilObjRole->getPresentationTitle(); } } $this->ctrl->setParameterByClass('ilRepositorySearchGUI', 'addusertype', 'other'); ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $this->toolbar, array('auto_complete_name' => $this->lng->txt('user'), 'user_type' => $types, 'submit_name' => $this->lng->txt('add'))); }
/** * Checkes to what view (table or detail) should be redirected and performs redirect * */ protected function checkAndPerformRedirect($force_redirect = false) { if ($force_redirect || isset($_GET['redirect']) && !$this->ctrl->isAsynch()) { switch ((int) $_GET['redirect']) { case self::REDIRECT_DETAIL: $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $this->record_id); $this->ctrl->setParameterByClass('ildatacollectionrecordviewgui', 'table_id', $this->table_id); $this->ctrl->redirectByClass("ildatacollectionrecordviewgui", "renderRecord"); break; case self::REDIRECT_RECORD_LIST: $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords"); break; default: $this->ctrl->redirectByClass("ildatacollectionrecordlistgui", "listRecords"); } } }
public function listRecords() { global $tpl, $lng, $ilToolbar; /** * @var $ilToolbar ilToolbarGUI * @var $ilToolbar ilToolbarGUI */ // Show tables require_once "./Modules/DataCollection/classes/class.ilDataCollectionTable.php"; if (ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id)) { $tables = $this->parent_obj->object->getTables(); } else { $tables = $this->parent_obj->object->getVisibleTables(); } $options = array(); foreach ($tables as $table) { $options[$table->getId()] = $table->getTitle(); } $tpl->addCss("./Modules/DataCollection/css/dcl_reference_hover.css"); $list = new ilDataCollectionRecordListTableGUI($this, "listRecords", $this->table_obj, $this->mode); $list->setExternalSegmentation(true); $list->setExternalSorting(true); $list->determineLimit(); $list->determineOffsetAndOrder(); $data = $this->table_obj->getPartialRecords($list->getOrderField(), $list->getOrderDirection(), $list->getLimit(), $list->getOffset(), $list->getFilter()); $records = $data['records']; $total = $data['total']; $list->setMaxCount($total); $list->setRecordData($records); if (count($options) > 0) { include_once './Services/Form/classes/class.ilSelectInputGUI.php'; $table_selection = new ilSelectInputGUI('', 'table_id'); $table_selection->setOptions($options); $table_selection->setValue($this->table_id); $ilToolbar->setFormAction($this->ctrl->getFormActionByClass("ilDataCollectionRecordListGUI", "doTableSwitch")); $ilToolbar->addText($lng->txt("dcl_table")); $ilToolbar->addInputItem($table_selection); $ilToolbar->addFormButton($lng->txt('change'), 'doTableSwitch'); $ilToolbar->addSeparator(); } $permission_to_add_or_import = $this->table_obj->hasPermissionToAddRecord($this->parent_obj->ref_id) and $this->table_obj->hasCustomFields(); if ($permission_to_add_or_import) { $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL); $add_new = ilLinkButton::getInstance(); $add_new->setCaption("dcl_add_new_record"); $add_new->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordeditgui", "create")); // $add_new->addCSSClass('emphsubmit'); $ilToolbar->addButtonInstance($add_new); } if ($this->table_obj->getExportEnabled() or $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id)) { $export = ilDataCollectionLinkButton::getInstance(); $export->setCaption("dcl_export_table_excel"); $export->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "exportExcel")); if (count($this->table_obj->getExportableFields()) == 0 or $total == 0) { $export->setUseWrapper(true); $export->setDisabled(true); $export->addAttribute('data-toggle', 'datacollection-tooltip', true); $export->addAttribute('data-placement', 'bottom', true); $export->addAttribute('title', $lng->txt('dcl_no_exportable_fields_or_no_data'), true); } $ilToolbar->addButtonInstance($export); } if ($permission_to_add_or_import) { $this->ctrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", NULL); $import = ilLinkButton::getInstance(); $import->setCaption("dcl_import_records .xls"); $import->setUrl($this->ctrl->getFormActionByClass("ildatacollectionrecordlistgui", "showImportExcel")); $ilToolbar->addButtonInstance($import); } // requested not to implement this way... //$tpl->addJavaScript("Modules/DataCollection/js/fastTableSwitcher.js"); if (count($this->table_obj->getRecordFields()) == 0) { ilUtil::sendInfo($lng->txt("dcl_no_fields_yet") . " " . ($this->table_obj->hasPermissionToFields($this->parent_obj->ref_id) ? $lng->txt("dcl_create_fields") : "")); } $tpl->getStandardTemplate(); $tpl->setPermanentLink("dcl", $this->parent_obj->ref_id); if ($desc = $this->table_obj->getDescription()) { $desc = "<div class='ilDclTableDescription'>{$desc}</div>"; } $tpl->setContent($desc . $list->getHTML()); }
public function doTableSwitch() { $this->ctrl->setParameterByClass("ilObjDataCollectionGUI", "table_id", $_POST['table_id']); $this->ctrl->redirectByClass("ilDataCollectionFieldListGUI", "listFields"); }
/** * Returns the pass details overview for a given active ID and pass * * @param array $result_array An array containing the results of the users test pass (generated by ilObjTest::getTestResult) * @param integer $active_id Active ID of the active user * @param integer $pass Test pass * @param string $targetclass The name of the ILIAS class for the "pass details" URL (optional) * @param string $targetcommand The name of the ILIAS command for the "pass details" URL (optional) * @param string $targetcommanddetails The name of the ILIAS command which should be called for the details of an answer (optional) * @param boolean $standard_header TRUE if the table headers should be plain text, FALSE if the table headers should be URL's for sortable columns * @return string HTML code of the pass details overview * @access public */ function getPassDetailsOverview($result_array, $active_id, $pass, $targetclass = "", $targetcommandsort = "", $targetcommanddetails = "", $standard_header = TRUE) { global $ilUser; $testresults = $result_array["pass"]; unset($result_array["test"]); $user_id = $this->object->_getUserIdFromActiveId($active_id); $sort = $_GET["sort"] ? $_GET["sort"] : "nr"; $sortorder = $_GET["sortorder"] ? $_GET["sortorder"] : "asc"; if (!$standard_header) { // change sortorder of result array usort($result_array, "sortResults"); } $color_class = array("tblrow1top", "tblrow2top"); $counter = 0; $template = new ilTemplate("tpl.il_as_tst_pass_details_overview.html", TRUE, TRUE, "Modules/Test"); $this->ctrl->setParameterByClass($targetclass, "pass", "{$pass}"); if (!$testresults["total_max_points"]) { $percentage = 0; } else { $percentage = $testresults["total_reached_points"] / $testresults["total_max_points"] * 100; } $total_max = $testresults["total_max_points"]; $total_reached = $testresults["total_reached_points"]; $totalRequestedHints = $testresults["total_requested_hints"]; $img_title_percent = ""; $img_title_nr = ""; $hasSuggestedSolutions = FALSE; if ($this->object->getShowSolutionSuggested()) { foreach ($result_array as $key => $value) { if (strlen($value["solution"])) { $hasSuggestedSolutions = TRUE; } } } foreach ($result_array as $key => $value) { if (preg_match("/\\d+/", $key)) { if (strlen($targetclass) && strlen($targetcommanddetails)) { $template->setCurrentBlock("linked_title"); $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $template->setVariable("VALUE_QUESTION_TITLE", $value["title"]); $this->ctrl->setParameterByClass($targetclass, "evaluation", $value["qid"]); $this->ctrl->setParameterByClass($targetclass, "active_id", $active_id); $template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommanddetails)); $template->parseCurrentBlock(); } else { $template->setCurrentBlock("plain_title"); $template->setVariable("VALUE_QUESTION_TITLE", $value["title"]); $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $template->parseCurrentBlock(); } if ($hasSuggestedSolutions) { $template->setCurrentBlock("question_suggested_solution"); $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $template->setVariable("SOLUTION_HINT", $this->object->prepareTextareaOutput($value["solution"], true)); $template->parseCurrentBlock(); } $template->setCurrentBlock("question"); $template->setVariable("COLOR_CLASS", $color_class[$counter % 2]); $template->setVariable("VALUE_QUESTION_COUNTER", $value["nr"]); $template->setVariable("VALUE_MAX_POINTS", $value["max"]); $template->setVariable("VALUE_REACHED_POINTS", $value["reached"]); if ($this->object->isOfferingQuestionHintsEnabled()) { $template->setVariable("VALUE_HINT_COUNT", $value["requested_hints"]); } $template->setVariable("VALUE_PERCENT_SOLVED", $value["percent"]); $template->parseCurrentBlock(); $counter++; } } if ($hasSuggestedSolutions) { $template->touchBlock("footer_suggested_solution"); } $template->setCurrentBlock("footer"); $template->setVariable("VALUE_QUESTION_COUNTER", "<strong>" . $this->lng->txt("total") . "</strong>"); $template->setVariable("VALUE_QUESTION_TITLE", ""); $template->setVariable("VALUE_MAX_POINTS", "<strong>{$total_max}</strong>"); $template->setVariable("VALUE_REACHED_POINTS", "<strong>{$total_reached}</strong>"); if ($this->object->isOfferingQuestionHintsEnabled()) { $template->setVariable("VALUE_TOTAL_HINT_COUNT", "<strong>{$totalRequestedHints}</strong>"); } $template->setVariable("VALUE_PERCENT_SOLVED", "<strong>" . sprintf("%2.2f", $percentage) . " %" . "</strong>"); $template->parseCurrentBlock(); if ($standard_header) { if ($hasSuggestedSolutions) { $template->setCurrentBlock("standard_header_suggested_solution"); $template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint")); $template->parseCurrentBlock(); } $template->setCurrentBlock("standard_header"); $template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no")); $template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved")); $template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title")); $template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points")); $template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points")); if ($this->object->isOfferingQuestionHintsEnabled()) { $template->setVariable("HINT_COUNT", $this->lng->txt("tst_question_hints_requested_hint_count_header")); } $template->parseCurrentBlock(); } else { if ($hasSuggestedSolutions) { $template->setCurrentBlock("linked_header_suggested_solution"); if (strcmp($sort, "solution") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $this->ctrl->setParameterByClass($targetclass, "sort", "solution"); $template->setVariable("URL_SOLUTION_HINT_HEADER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("SOLUTION_HINT_HEADER", $this->lng->txt("solution_hint")); if (strcmp($sort, "solution") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_SOLUTION_HINT_HEADER", $image->get()); } $template->parseCurrentBlock(); } $template->setCurrentBlock("linked_header"); $this->ctrl->setParameterByClass($targetclass, "sort", "nr"); if (strcmp($sort, "nr") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $template->setVariable("URL_QUESTION_COUNTER", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("QUESTION_COUNTER", $this->lng->txt("tst_question_no")); if (strcmp($sort, "nr") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_QUESTION_COUNTER", $image->get()); } $this->ctrl->setParameterByClass($targetclass, "sort", "percent"); if (strcmp($sort, "percent") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $template->setVariable("URL_PERCENT_SOLVED", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("PERCENT_SOLVED", $this->lng->txt("tst_percent_solved")); if (strcmp($sort, "percent") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_PERCENT_SOLVED", $image->get()); } $this->ctrl->setParameterByClass($targetclass, "sort", "title"); if (strcmp($sort, "title") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $template->setVariable("URL_QUESTION_TITLE", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("QUESTION_TITLE", $this->lng->txt("tst_question_title")); if (strcmp($sort, "title") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_QUESTION_TITLE", $image->get()); } $this->ctrl->setParameterByClass($targetclass, "sort", "max"); if (strcmp($sort, "max") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $template->setVariable("URL_MAX_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("MAX_POINTS", $this->lng->txt("tst_maximum_points")); if (strcmp($sort, "max") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_MAX_POINTS", $image->get()); } $this->ctrl->setParameterByClass($targetclass, "sort", "reached"); if (strcmp($sort, "reached") == 0) { $this->ctrl->setParameterByClass($targetclass, "sortorder", !strcmp($sortorder, "asc") ? "desc" : "asc"); } else { $this->ctrl->setParameterByClass($targetclass, "sortorder", "asc"); } $template->setVariable("URL_REACHED_POINTS", $this->ctrl->getLinkTargetByClass($targetclass, $targetcommandsort)); $template->setVariable("REACHED_POINTS", $this->lng->txt("tst_reached_points")); if (strcmp($sort, "reached") == 0) { $image = new ilTemplate("tpl.image.html", TRUE, TRUE, "Modules/Test"); $image->setVariable("IMAGE_SOURCE", ilUtil::getImagePath($sortorder . "_order.png")); $image->setVariable("IMAGE_ALT", $this->lng->txt("change_sort_direction")); $image->setVariable("IMAGE_TITLE", $this->lng->txt("change_sort_direction")); $template->setVariable("IMAGE_REACHED_POINTS", $image->get()); } $template->parseCurrentBlock(); } return $template->get(); }
/** * Returns the pass overview for a given active ID * * @return string HTML code of the pass overview * @access public * * @deprecated */ public function getPassOverview(ilTestSession $testSession, $targetclass = "", $targetcommand = "", $short = FALSE, $hide_details = FALSE) { $active_id = $testSession->getActiveId(); require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php'; require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php'; $table = new ilTestPassOverviewTableGUI($this, '', $short ? ilTestPassOverviewTableGUI::CONTEXT_SHORT : ilTestPassOverviewTableGUI::CONTEXT_LONG, isset($_GET['pdf']) && $_GET['pdf'] == 1); $considerHiddenQuestions = true; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $considerHiddenQuestions = false; $table->setObjectiveOrientedPresentationEnabled(true); require_once 'Modules/Course/classes/Objectives/class.ilLOTestQuestionAdapter.php'; $objectivesAdapter = ilLOTestQuestionAdapter::getInstance($testSession); } $table->init(); $data = array(); $counted_pass = $this->object->_getResultPass($active_id); $reached_pass = $this->object->_getPass($active_id); require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object); $testPassesSelector->setActiveId($active_id); $lastFinishedPass = $this->testSessionFactory->getSession($active_id)->getLastFinishedPass(); $testPassesSelector->setLastFinishedPass($lastFinishedPass); foreach ($testPassesSelector->getReportablePasses() as $pass) { $row = array(); $considerOptionalQuestions = true; if ($this->getObjectiveOrientedContainer()->isObjectiveOrientedPresentationRequired()) { $testSequence = $this->testSequenceFactory->getSequenceByActiveIdAndPass($active_id, $pass); $testSequence->loadFromDb(); $testSequence->loadQuestions(); if ($this->object->isRandomTest() && !$testSequence->isAnsweringOptionalQuestionsConfirmed()) { $considerOptionalQuestions = false; } $testSequence->setConsiderHiddenQuestionsEnabled($considerHiddenQuestions); $testSequence->setConsiderOptionalQuestionsEnabled($considerOptionalQuestions); $objectivesList = $this->buildQuestionRelatedObjectivesList($objectivesAdapter, $testSequence); $objectivesList->loadObjectivesTitles(); $row['objectives'] = $objectivesList->getUniqueObjectivesStringForQuestions($testSequence->getUserSequenceQuestions()); } if (!$short) { $result_array =& $this->object->getTestResult($active_id, $pass, false, $considerHiddenQuestions, $considerOptionalQuestions); if (!$result_array['pass']['total_max_points']) { $percentage = 0; } else { $percentage = $result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points'] * 100; } $total_max = $result_array['pass']['total_max_points']; $total_reached = $result_array['pass']['total_reached_points']; $total_requested_hints = $result_array['pass']['total_requested_hints']; } if (!$hide_details) { if (strlen($targetclass) && strlen($targetcommand)) { $this->ctrl->setParameterByClass($targetclass, 'active_id', $active_id); $this->ctrl->setParameterByClass($targetclass, 'pass', $pass); $aslgui = new ilAdvancedSelectionListGUI(); $aslgui->setListTitle($this->lng->txt('actions')); $aslgui->setId($pass); $aslgui->addItem($this->lng->txt('tst_pass_details'), 'tst_pass_details', $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand)); if ($this->object->isPassDeletionAllowed() && $pass != $counted_pass) { $aslgui->addItem($this->lng->txt('delete'), 'tst_pass_delete', $this->ctrl->getLinkTargetByClass($targetclass, 'confirmDeletePass')); } $row['pass_details'] = $aslgui->getHTML(); } } if (!$short) { if ($pass == $counted_pass) { $row['scored'] = '⊗'; } else { $row['scored'] = ''; } } $row['pass'] = $pass + 1; $row['date'] = $this->object->getPassFinishDate($active_id, $pass); if (!$short) { $row['answered'] = $result_array['pass']['num_workedthrough'] . ' ' . strtolower($this->lng->txt('of')) . ' ' . (count($result_array) - 2); if ($this->object->isOfferingQuestionHintsEnabled()) { $row['hints'] = $total_requested_hints; } $row['reached'] = $total_reached . ' ' . strtolower($this->lng->txt('of')) . ' ' . $total_max; $row['percentage'] = $percentage; } $data[] = $row; } $table->setData($data); return $table->getHTML(); }
/** * @param $a_set */ protected function setCtrlParametersForRow($a_set) { $this->ctrl->setParameterByClass(get_class($this->parent_obj), 'ar_id', self::domid_encode($a_set[$this->getFields()->getPrimaryField()->getName()])); }
/** * Returns the pass overview for a given active ID * * @return string HTML code of the pass overview * @access public * * @deprecated */ public function getPassOverview($active_id, $targetclass = "", $targetcommand = "", $short = FALSE, $hide_details = FALSE) { require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php'; require_once 'Modules/Test/classes/tables/class.ilTestPassOverviewTableGUI.php'; $table = new ilTestPassOverviewTableGUI($this, '', $short ? ilTestPassOverviewTableGUI::CONTEXT_SHORT : ilTestPassOverviewTableGUI::CONTEXT_LONG, isset($_GET['pdf']) && $_GET['pdf'] == 1); $data = array(); $counted_pass = $this->object->_getResultPass($active_id); $reached_pass = $this->object->_getPass($active_id); require_once 'Modules/Test/classes/class.ilTestPassesSelector.php'; $testPassesSelector = new ilTestPassesSelector($GLOBALS['ilDB'], $this->object); $testPassesSelector->setActiveId($active_id); $lastFinishedPass = $this->testSessionFactory->getSession($active_id)->getLastFinishedPass(); $testPassesSelector->setLastFinishedPass($lastFinishedPass); foreach ($testPassesSelector->getReportablePasses() as $pass) { $row = array(); if (!$short) { $result_array =& $this->object->getTestResult($active_id, $pass); if (!$result_array['pass']['total_max_points']) { $percentage = 0; } else { $percentage = $result_array['pass']['total_reached_points'] / $result_array['pass']['total_max_points'] * 100; } $total_max = $result_array['pass']['total_max_points']; $total_reached = $result_array['pass']['total_reached_points']; $total_requested_hints = $result_array['pass']['total_requested_hints']; } if (!$hide_details) { if (strlen($targetclass) && strlen($targetcommand)) { $this->ctrl->setParameterByClass($targetclass, 'active_id', $active_id); $this->ctrl->setParameterByClass($targetclass, 'pass', $pass); $aslgui = new ilAdvancedSelectionListGUI(); $aslgui->setListTitle($this->lng->txt('actions')); $aslgui->setId($pass); $aslgui->addItem($this->lng->txt('tst_pass_details'), 'tst_pass_details', $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand)); if ($this->object->isPassDeletionAllowed() && $pass != $counted_pass) { $aslgui->addItem($this->lng->txt('delete'), 'tst_pass_delete', $this->ctrl->getLinkTargetByClass($targetclass, 'confirmDeletePass')); $delete_entry = true; } if ($delete_entry == true) { $row['pass_details'] = $aslgui->getHTML(); } else { $row['pass_details'] = '<a href="' . $this->ctrl->getLinkTargetByClass($targetclass, $targetcommand) . '">' . $this->lng->txt('tst_pass_details') . '</a>'; } } } if (!$short) { if ($pass == $counted_pass) { $row['scored'] = '⊗'; } else { $row['scored'] = ''; } } $row['pass'] = $pass + 1; $row['date'] = $this->object->getPassFinishDate($active_id, $pass); if (!$short) { $row['answered'] = $result_array['pass']['num_workedthrough'] . ' ' . strtolower($this->lng->txt('of')) . ' ' . (count($result_array) - 2); if ($this->object->isOfferingQuestionHintsEnabled()) { $row['hints'] = $total_requested_hints; } $row['reached'] = $total_reached . ' ' . strtolower($this->lng->txt('of')) . ' ' . $total_max; $row['percentage'] = $percentage; } $data[] = $row; } $table->setData($data); return $table->getHTML(); }