/** * @param $value */ public function setValueByArray($value) { parent::setValueByArray($value); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $reference = $value[$this->getPostVar()]; if ($reference) { $pathString = $path->getPath(ROOT_FOLDER_ID, $reference); $id = ilObject::_lookupObjId($reference); $this->title_input->setValue($pathString . " > " . ilObject::_lookupTitle($id)); $this->hidden_input->setValue($reference); } }
/** * Fill template row * @param <type> $a_set */ public function fillRow($a_set) { $this->tpl->setVariable('TIME', $a_set['time']); $this->tpl->setVariable('DURATION', $a_set['duration']); $this->tpl->setVariable('REC', ilViteroUtils::recurrenceToString($a_set['rec'])); if ($this->isAdminTable()) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->setUseImages(false); $path->enableTextOnly(false); $this->tpl->setVariable('OBJ_PATH', $path->getPath(ROOT_FOLDER_ID, end(ilObject::_getAllReferences($a_set['group'])))); } if ($a_set['rec']) { $this->tpl->setVariable('ENDS', $a_set['ends']); } else { $this->tpl->setVariable('ENDS', ''); } if (!$this->isEditable()) { return true; } include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php'; $list = new ilAdvancedSelectionListGUI(); $list->setId('booka_' . $a_set['start']->get(IL_CAL_UNIX) . '_' . $a_set['id']); $list->setListTitle($this->lng->txt('actions')); // no recurrence if ($a_set['rec'] == 0) { $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'bookid', $a_set['id']); $list->addItem(ilViteroPlugin::getInstance()->txt('edit_booking'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'editBooking')); // delete appointment $list->addItem(ilViteroPlugin::getInstance()->txt('delete_appointment'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'confirmDeleteAppointment')); } // A recurrence if ($a_set['rec'] > 0) { // Delete single appointment $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'atime', $a_set['start']->get(IL_CAL_UNIX)); $GLOBALS['ilCtrl']->setParameter($this->getParentObject(), 'bookid', $a_set['id']); $list->addItem(ilViteroPlugin::getInstance()->txt('edit_bookings'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'editBooking')); // not supported /* $list->addItem( ilViteroPlugin::getInstance()->txt('delete_appointment'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(),'confirmDeleteAppointmentInSeries') ); */ // Delete appointment series $list->addItem(ilViteroPlugin::getInstance()->txt('delete_reccurrence'), '', $GLOBALS['ilCtrl']->getLinkTarget($this->getParentObject(), 'confirmDeleteBooking')); } $this->tpl->setVariable('ACTION_PART', $list->getHTML()); }
/** * */ protected function initData() { /** * @var $tree ilTree */ global $tree; $path = new ilPathGUI(); $rows = array(); foreach ($this->question->getInstances() as $instance) { foreach ($instance['refs'] as $ref_id) { $trashed = $tree->isDeleted($ref_id); $rows[] = array('title' => $instance['title'], 'author' => $instance['author'], 'ref_id' => $ref_id, 'is_trashed' => $trashed, 'path' => $trashed ? $this->lng->txt('deleted') : $path->getPath(ROOT_FOLDER_ID, $ref_id)); } } $this->setData($rows); }
/** * Fill a single data row. */ protected function fillRow($a_set) { $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon('', 'tiny', $a_set['type'])); $this->tpl->setVariable('IMG_ALT', $this->lng->txt('obj_' . $a_set['type'])); $this->tpl->setVariable("VAL_POSTNAME", "items"); $this->tpl->setVariable("VAL_ID", $a_set['ref_id']); if (in_array($a_set['ref_id'], $this->getMaterialItems())) { $this->tpl->setVariable("VAL_CHECKED", "checked"); } $this->tpl->setVariable("COLL_TITLE", $a_set['title']); if (strlen($a_set['description'])) { $this->tpl->setVariable("COLL_DESC", $a_set['description']); } $this->tpl->setVariable("ASSIGNED_IMG_OK", in_array($a_set['ref_id'], $this->getMaterialItems()) ? ilUtil::getImagePath('icon_ok.svg') : ilUtil::getImagePath('icon_not_ok.svg')); $this->tpl->setVariable("ASSIGNED_STATUS", $this->lng->txt('event_material_assigned')); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableDisplayCut(true); $path->enableTextOnly(false); $this->tpl->setVariable("PATH", $this->lng->txt('path')); $this->tpl->setVariable("COLL_PATH", $path->getPath($this->getContainerRefId(), $a_set['ref_id'])); }
/** * fill table rows * @param array $set * @return */ protected function fillRow($set) { $this->tpl->setVariable('VAL_TITLE', $set['title']); if (strlen($set['desc'])) { $this->tpl->setVariable('VAL_DESC', $set['desc']); } $this->tpl->setVariable('TXT_PATHES', $this->lng->txt('pathes')); foreach ((array) $set['refs'] as $reference) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $this->tpl->setCurrentBlock('path'); $this->tpl->setVariable('VAL_ID', $reference); $this->tpl->setVariable('VAL_PATH', $path->getPath(ROOT_FOLDER_ID, $reference)); if ($reference == $this->getSelectedReference()) { $this->tpl->setVariable('VAL_CHECKED', 'checked="checked"'); } $this->tpl->parseCurrentBlock(); } }
/** * This function is only used by the ajax request if searching for ILIAS references. It builds the html for the search results. */ public function searchObjects() { global $lng; $search = $_POST['search_for']; $dest = $_POST['dest']; $html = ""; include_once './Services/Search/classes/class.ilQueryParser.php'; $query_parser = new ilQueryParser($search); $query_parser->setMinWordLength(1, true); $query_parser->setCombination(QP_COMBINATION_AND); $query_parser->parse(); if (!$query_parser->validate()) { $html .= $query_parser->getMessage() . "<br />"; } // only like search since fulltext does not support search with less than 3 characters include_once 'Services/Search/classes/Like/class.ilLikeObjectSearch.php'; $object_search = new ilLikeObjectSearch($query_parser); $res = $object_search->performSearch(); //$res->setRequiredPermission('copy'); $res->filter(ROOT_FOLDER_ID, true); if (!count($results = $res->getResultsByObjId())) { $html .= $lng->txt('dcl_no_search_results_found_for') . ' ' . $search . "<br />"; } $results = $this->parseSearchResults($results); foreach ($results as $entry) { $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection"); foreach ((array) $entry['refs'] as $reference) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $tpl->setCurrentBlock('result'); $tpl->setVariable('RESULT_PATH', $path->getPath(ROOT_FOLDER_ID, $reference) . " > " . $entry['title']); $tpl->setVariable('RESULT_REF', $reference); $tpl->setVariable('FIELD_ID', $dest); $tpl->parseCurrentBlock(); } $html .= $tpl->get(); } echo $html; exit; }
/** * Init settings form */ protected function initFormCSettings() { include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSNodeMappingSettings.php'; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setTitle($this->lng->txt('settings')); // individual course allocation $check = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_enable'), 'enabled'); $check->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isCourseAllocationEnabled()); $form->addItem($check); // add default container $imp = new ilCustomInputGUI($this->lng->txt('ecs_cmap_def_cat'), 'default_cat'); $imp->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'default_cat'); $default = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getDefaultCourseCategory(); $tpl->setVariable('PROPERTY_VALUE', $default); if ($default) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $imp->setHtml($tpl->get()); $imp->setInfo($this->lng->txt('ecs_cmap_def_cat_info')); $form->addItem($imp); // all in one category $allinone = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_all_in_one'), 'allinone'); $allinone->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAllInOneCategoryEnabled()); $allinone->setInfo($this->lng->txt('ecs_cmap_all_in_one_info')); $allinone_cat = new ilCustomInputGUI($this->lng->txt('ecs_cmap_all_in_one_cat'), 'allinone_cat'); $allinone_cat->setRequired(true); $tpl = new ilTemplate('tpl.ecs_import_id_form.html', true, true, 'Services/WebServices/ECS'); $tpl->setVariable('SIZE', 5); $tpl->setVariable('MAXLENGTH', 11); $tpl->setVariable('POST_VAR', 'allinone_cat'); $cat = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getAllInOneCategory(); $tpl->setVariable('PROPERTY_VALUE', $cat); if ($cat) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->enableTextOnly(false); $path->enableHideLeaf(false); $tpl->setVariable('COMPLETE_PATH', $path->getPath(ROOT_FOLDER_ID, $default)); } $allinone_cat->setHtml($tpl->get()); $allinone->addSubItem($allinone_cat); $form->addItem($allinone); // multiple attributes $multiple = new ilCheckboxInputGUI($this->lng->txt('ecs_cmap_multiple_atts'), 'multiple'); $multiple->setChecked(ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->isAttributeMappingEnabled()); // attribute selection include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; include_once './Services/WebServices/ECS/classes/Course/class.ilECSCourseAttributes.php'; $attributes = new ilSelectInputGUI($this->lng->txt('ecs_cmap_attributes'), 'atts'); $attributes->setMulti(true); $attributes->setValue(ilECSCourseAttributes::getInstance($this->getServer()->getServerId(), $this->getMid())->getAttributeValues()); $attributes->setRequired(true); $attributes->setOptions(ilECSMappingUtils::getCourseMappingFieldSelectOptions()); $multiple->addSubItem($attributes); $form->addItem($multiple); // role mapping $rm = new ilFormSectionHeaderGUI(); $rm->setTitle($this->lng->txt('ecs_role_mappings')); $form->addItem($rm); $mapping_defs = ilECSNodeMappingSettings::getInstanceByServerMid($this->getServer()->getServerId(), $this->getMid())->getRoleMappings(); include_once './Services/WebServices/ECS/classes/Mapping/class.ilECSMappingUtils.php'; foreach (ilECSMappingUtils::getRoleMappingInfo() as $name => $info) { $role_map = new ilTextInputGUI($this->lng->txt($info['lang']), $name); $role_map->setValue($mapping_defs[$name]); $role_map->setSize(32); $role_map->setMaxLength(64); $role_map->setRequired($info['required']); $form->addItem($role_map); } $form->addCommandButton('cUpdateSettings', $this->lng->txt('save')); $form->addCommandButton('cSettings', $this->lng->txt('cancel')); return $form; }
/** * Fill template row * @param array $a_set */ protected function fillRow($a_set) { global $objDefinition; include_once './Services/Link/classes/class.ilLink.php'; $this->tpl->setCurrentBlock('item_row'); $this->tpl->setVariable('ITEM_ID', $a_set['id']); $this->tpl->setVariable('COLL_TITLE', $a_set['title']); $this->tpl->setVariable('COLL_DESC', $a_set['description']); if ($this->getMode() == ilLPObjSettings::LP_MODE_SCORM) { $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png')); $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco')); } else { if ($objDefinition->isPluginTypeName($a_set["type"])) { $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_" . $a_set['type']); } else { $alt = $this->lng->txt('obj_' . $a_set['type']); } $this->tpl->setVariable('ALT_IMG', $alt); $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type'])); if ($this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_MANUAL && $this->getMode() != ilLPObjSettings::LP_MODE_COLLECTION_TLT) { $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type'])); $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type'])); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id'])); $mode = $a_set['mode_id']; if ($mode != ilLPObjSettings::LP_MODE_DEACTIVATED && $mode != ilLPObjSettings::LP_MODE_UNDEFINED) { $this->tpl->setVariable("COLL_MODE", $a_set['mode']); } else { $this->tpl->setVariable("COLL_MODE", ""); $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']); } if ($a_set["anonymized"]) { $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short')); } } else { if ($this->getMode() == ilLPObjSettings::LP_MODE_COLLECTION_TLT) { // handle tlt settings $this->tpl->setCurrentBlock("tlt"); $this->tpl->setVariable("TXT_MONTH", $this->lng->txt('md_months')); $this->tpl->setVariable("TXT_DAYS", $this->lng->txt('md_days')); $this->tpl->setVariable("TXT_TIME", $this->lng->txt('md_time')); $this->tpl->setVariable("TLT_HINT", '(hh:mm)'); // seconds to units $mon = floor($a_set["tlt"] / (60 * 60 * 24 * 30)); $tlt = $a_set["tlt"] % (60 * 60 * 24 * 30); $day = floor($tlt / (60 * 60 * 24)); $tlt = $tlt % (60 * 60 * 24); $hr = floor($tlt / (60 * 60)); $tlt = $tlt % (60 * 60); $min = floor($tlt / 60); $options = array(); for ($i = 0; $i <= 24; $i++) { $options[$i] = sprintf('%02d', $i); } $this->tpl->setVariable("SEL_MONTHS", ilUtil::formSelect($mon, 'tlt[' . $a_set['id'] . '][mo]', $options, false, true)); for ($i = 0; $i <= 31; $i++) { $options[$i] = sprintf('%02d', $i); } $this->tpl->setVariable("SEL_DAYS", ilUtil::formSelect($day, 'tlt[' . $a_set['id'] . '][d]', $options, false, true)); $this->tpl->setVariable("SEL_TLT", ilUtil::makeTimeSelect('tlt[' . $a_set['id'] . ']', true, $hr, $min, null, false)); $this->tpl->parseCurrentBlock(); } } } // Assigned ? $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status'] ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status'] ? $this->lng->txt('trac_assigned') : $this->lng->txt('trac_not_assigned')); $this->tpl->parseCurrentBlock(); // Parse grouped items foreach ((array) $a_set['grouped'] as $item) { $this->fillRow($item); } // show num obligatory info if (count($a_set['grouped'])) { $this->tpl->setCurrentBlock('num_passed_items'); $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed')); $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']); $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']); $this->tpl->parseCurrentBlock(); } }
/** * parse * * @access public * @return */ public function parse() { global $ilUser, $tree; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; $cats = ilCalendarCategories::_getInstance($ilUser->getId()); $cats->initialize(ilCalendarCategories::MODE_MANAGE); $tmp_title_counter = array(); $categories = array(); foreach ($cats->getCategoriesInfo() as $category) { $tmp_arr['obj_id'] = $category['obj_id']; $tmp_arr['id'] = $category['cat_id']; $tmp_arr['title'] = $category['title']; $tmp_arr['type'] = $category['type']; // Append object type to make type sortable $tmp_arr['type_sortable'] = ilCalendarCategory::lookupCategorySortIndex($category['type']); if ($category['type'] == ilCalendarCategory::TYPE_OBJ) { $tmp_arr['type_sortable'] .= '_' . ilObject::_lookupType($category['obj_id']); } $tmp_arr['color'] = $category['color']; $tmp_arr['editable'] = $category['editable']; $tmp_arr['accepted'] = $category['accepted']; $tmp_arr['remote'] = $category['remote']; $categories[] = $tmp_arr; // count title for appending the parent container if there is more than one entry. $tmp_title_counter[$category['type'] . '_' . $category['title']]++; } $path_categories = array(); foreach ($categories as $cat) { if ($cat['type'] == ilCalendarCategory::TYPE_OBJ) { if ($tmp_title_counter[$cat['type'] . '_' . $cat['title']] > 1) { foreach (ilObject::_getAllReferences($cat['obj_id']) as $ref_id) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $path->setUseImages(false); $path->enableTextOnly(false); $cat['path'] = $path->getPath(ROOT_FOLDER_ID, $ref_id); break; } } } $path_categories[] = $cat; } $this->setData($path_categories); }
/** * Append path * @return */ protected function appendPath($a_ref_id) { include_once './Services/Tree/classes/class.ilPathGUI.php'; $path_gui = new ilPathGUI(); $path_gui->enableTextOnly(false); $path_gui->setUseImages(false); $tpl = new ilTemplate('tpl.lucene_path.html', true, true, 'Services/Search'); $tpl->setVariable('PATH_ITEM', $path_gui->getPath(ROOT_FOLDER_ID, $a_ref_id)); return $tpl->get(); }
/** * Fill template row * @param array $a_set */ protected function fillRow($a_set) { global $objDefinition; include_once './Services/Link/classes/class.ilLink.php'; $this->tpl->setCurrentBlock('item_row'); $this->tpl->setVariable('ITEM_ID', $a_set['id']); $this->tpl->setVariable('COLL_TITLE', $a_set['title']); $this->tpl->setVariable('COLL_DESC', $a_set['description']); if ($this->getMode() == LP_MODE_SCORM) { $this->tpl->setVariable('TYPE_IMG', ilUtil::getImagePath('icon_sco_s.png')); $this->tpl->setVariable('ALT_IMG', $this->lng->txt('obj_sco')); } else { if ($objDefinition->isPluginTypeName($a_set["type"])) { $alt = ilPlugin::lookupTxt("rep_robj", $a_set['type'], "obj_" . $a_set['type']); } else { $alt = $this->lng->txt('obj_' . $a_set['type']); } $this->tpl->setVariable('ALT_IMG', $alt); $this->tpl->setVariable('TYPE_IMG', ilObject::_getIcon("", "tiny", $a_set['type'])); $this->tpl->setVariable('COLL_LINK', ilLink::_getLink($a_set['ref_id'], $a_set['type'])); $this->tpl->setVariable('COLL_FRAME', ilFrameTargetInfo::_getFrame('MainContent', $a_set['type'])); include_once './Services/Tree/classes/class.ilPathGUI.php'; $path = new ilPathGUI(); $this->tpl->setVariable('COLL_PATH', $this->lng->txt('path') . ': ' . $path->getPath($this->getNode(), $a_set['ref_id'])); $mode = $a_set['mode_id']; if ($mode != LP_MODE_DEACTIVATED && $mode != LP_MODE_UNDEFINED) { $this->tpl->setVariable("COLL_MODE", $a_set['mode']); } else { $this->tpl->setVariable("COLL_MODE", ""); $this->tpl->setVariable("COLL_MODE_DEACTIVATED", $a_set['mode']); } if ($this->isAnonymized($a_set)) { $this->tpl->setVariable("ANONYMIZED", $this->lng->txt('trac_anonymized_info_short')); } } // Assigned ? $this->tpl->setVariable("ASSIGNED_IMG_OK", $a_set['status'] ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("ASSIGNED_STATUS", $a_set['status'] ? $this->lng->txt('trac_assigned') : $this->lng->txt('trac_not_assigned')); $this->tpl->parseCurrentBlock(); // Parse grouped items foreach ((array) $a_set['grouped'] as $item) { $this->fillRow($item); } // show num obligatory info if (count($a_set['grouped'])) { $this->tpl->setCurrentBlock('num_passed_items'); $this->tpl->setVariable('MIN_PASSED_TXT', $this->lng->txt('trac_min_passed')); $this->tpl->setVariable('NUM_OBLIGATORY', $a_set['num_obligatory']); $this->tpl->setVariable('GRP_ID', $a_set['grouping_id']); $this->tpl->parseCurrentBlock(); } }
/** * insert path */ function insertPath() { global $tree, $lng; if ($this->getPathStatus() != false) { include_once 'Services/Tree/classes/class.ilPathGUI.php'; $path_gui = new ilPathGUI(); $path_gui->enableTextOnly(!$this->path_linked); $path_gui->setUseImages(false); $start_node = $this->path_start_node ? $this->path_start_node : ROOT_FOLDER_ID; $this->tpl->setCurrentBlock("path_item"); $this->tpl->setVariable('PATH_ITEM', $path_gui->getPath($start_node, $this->ref_id)); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("path"); $this->tpl->setVariable("TXT_LOCATION", $lng->txt("locator")); $this->tpl->parseCurrentBlock(); return true; } }