/** * Write course item information * Starting time, ending time... * @param int $a_ref_id * @return */ protected function writeCourseItemInformation($a_ref_id) { include_once './Services/Object/classes/class.ilObjectActivation.php'; $item = ilObjectActivation::getItem($a_ref_id); $this->xmlStartTag('Timing', array('Type' => $item['timing_type'], 'Visible' => $item['visible'], 'Changeable' => $item['changeable'])); if ($item['timing_start']) { $tmp_date = new ilDateTime($item['timing_start'], IL_CAL_UNIX); $this->xmlElement('Start', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } if ($item['timing_end']) { $tmp_date = new ilDateTime($item['timing_end'], IL_CAL_UNIX); $this->xmlElement('End', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } if ($item['suggestion_start']) { $tmp_date = new ilDateTime($item['suggestion_start'], IL_CAL_UNIX); $this->xmlElement('SuggestionStart', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } if ($item['suggestion_end']) { $tmp_date = new ilDateTime($item['suggestion_end'], IL_CAL_UNIX); $this->xmlElement('SuggestionEnd', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } if ($item['earliest_start']) { $tmp_date = new ilDateTime($item['earliest_start'], IL_CAL_UNIX); $this->xmlElement('EarliestStart', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } if ($item['latest_end']) { $tmp_date = new ilDateTime($item['latest_end'], IL_CAL_UNIX); $this->xmlElement('LatestEnd', array(), $tmp_date->get(IL_CAL_DATETIME, '', ilTimeZone::UTC)); } $this->xmlEndTag('Timing'); }
function validate() { include_once './Services/Object/classes/class.ilObjectActivation.php'; $item = ilObjectActivation::getItem($this->getItemId()); if ($this->getPlanedEndingTime() > $item_data['latest_end']) { return false; } return true; }
public function preload() { global $objDefinition, $tree, $ilObjDataCache, $ilUser, $rbacsystem; if (!$this->obj_ids) { return; } $this->obj_ids = array_unique($this->obj_ids); $this->types = array_unique($this->types); if ($this->ref_ids) { $this->ref_ids = array_unique($this->ref_ids); } // type specific preloads include_once "./Services/AccessControl/classes/class.ilConditionHandler.php"; foreach ($this->types as $type) { $this->obj_ids_by_type[$type] = array_unique($this->obj_ids_by_type[$type]); if (is_array($this->ref_ids_by_type[$type])) { $this->ref_ids_by_type[$type] = array_unique($this->ref_ids_by_type[$type]); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { ilConditionHandler::preloadConditionsForTargetRecords($type, $this->obj_ids_by_type[$type]); } $class = $objDefinition->getClassName($type); $location = $objDefinition->getLocation($type); if ($class && $location) { $full_class = "ilObj" . $class . "Access"; include_once $location . "/class." . $full_class . ".php"; if (class_exists($full_class)) { call_user_func(array($full_class, "_preloadData"), $this->obj_ids_by_type[$type], $this->ref_ids_by_type[$type]); } } } if ($this->ref_ids) { $tree->preloadDeleted($this->ref_ids); $tree->preloadDepthParent($this->ref_ids); $ilObjDataCache->preloadReferenceCache($this->ref_ids, false); $rbacsystem->preloadRbacPaCache($this->ref_ids, $ilUser->getId()); if ($ilUser->getId != ANONYMOUS_USER_ID && $this->context != ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP) { ilObjUser::preloadIsDesktopItem($ilUser->getId(), $this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($this->ref_ids); } include_once "./Services/Object/classes/class.ilObjectListGUI.php"; ilObjectListGUI::preloadCommonProperties($this->obj_ids, $this->context); if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY) { include_once "./Services/Rating/classes/class.ilRating.php"; include_once "./Services/Rating/classes/class.ilRatingGUI.php"; ilRating::preloadListGUIData($this->obj_ids); include_once "./Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php"; ilAdvancedMDValues::preloadByObjIds($this->obj_ids); } if ($this->context == ilObjectListGUI::CONTEXT_REPOSITORY || $this->context == ilObjectListGUI::CONTEXT_PERSONAL_DESKTOP || $this->context == ilObjectListGUI::CONTEXT_SEARCH) { include_once "./Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($this->obj_ids); } }
function &_getTimings($a_ref_id) { static $cache = array(); if (isset($cache[$a_ref_id])) { return $cache[$a_ref_id]; } $cache[$a_ref_id]['item'] = ilObjectActivation::getItem($a_ref_id); $cache[$a_ref_id]['user'] = ilTimingPlaned::_getPlanedTimingsByItem($a_ref_id); return $cache[$a_ref_id]; }
/** * Parse timing info * @param object $a_ref_id * @param object $a_parent_id * @param object $timing * @return */ protected function parseTiming($a_ref_id, $a_parent_id, $timing) { $type = (string) $timing['Type']; $visible = (string) $timing['Visible']; $changeable = (string) $timing['Changeable']; include_once './Services/Object/classes/class.ilObjectActivation.php'; $crs_item = new ilObjectActivation(); $crs_item->setTimingType($type); $crs_item->toggleVisible((bool) $visible); $crs_item->toggleChangeable((bool) $changeable); foreach ($timing->children() as $sub) { switch ((string) $sub->getName()) { case 'Start': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setTimingStart($dt->get(IL_CAL_UNIX)); break; case 'End': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setTimingEnd($dt->get(IL_CAL_UNIX)); break; case 'SuggestionStart': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setSuggestionStart($dt->get(IL_CAL_UNIX)); break; case 'SuggestionEnd': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setSuggestionEnd($dt->get(IL_CAL_UNIX)); break; case 'EarliestStart': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setEarliestStart($dt->get(IL_CAL_UNIX)); break; case 'LatestEnd': $dt = new ilDateTime((string) $sub, IL_CAL_DATETIME, ilTimeZone::UTC); $crs_item->setLatestEnd($dt->get(IL_CAL_UNIX)); break; } } if ($crs_item->getTimingStart()) { $crs_item->update($a_ref_id, $a_parent_id); } }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $obj_id = $a_set["obj_id"]; $ref_id = $a_set["ref_id"]; $type = $a_set['type']; $title = $a_set['title']; $description = $a_set['description']; $relevance = $a_set['relevance']; if (!$type) { return false; } include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php'; $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type); $item_list_gui->initItem($ref_id, $obj_id, $title, $description); $item_list_gui->setContainerObject($this->parent_obj); $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id, 0)); $item_list_gui->setSeparateCommands(true); ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_set); $this->presenter->appendAdditionalInformation($item_list_gui, $ref_id, $obj_id, $type); $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML()); if ($html = $item_list_gui->getListItemHTML($ref_id, $obj_id, $title, $description)) { $item_html[$ref_id]['html'] = $html; $item_html[$ref_id]['type'] = $type; } $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]); global $lng; if ($this->enabledRelevance()) { $width1 = (int) ((int) $relevance / 2); $width2 = (int) (50 - $width1); $this->tpl->setCurrentBlock('relev'); $this->tpl->setVariable('VAL_REL', sprintf("%d %%", $relevance)); $this->tpl->setVariable('WIDTH_A', $width1); $this->tpl->setVariable('WIDTH_B', $width2); $this->tpl->setVariable('IMG_A', ilUtil::getImagePath("relevance_blue.png")); $this->tpl->setVariable('IMG_B', ilUtil::getImagePath("relevance_dark.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ITEM_HTML", $html); if (!$objDefinition->isPlugin($type)) { $type_txt = $lng->txt('icon') . ' ' . $lng->txt('obj_' . $type); $icon = ilUtil::getImagePath('icon_' . $type . '.png'); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } $this->tpl->setVariable("TYPE_IMG", ilUtil::img($icon, $type_txt)); }
/** * Is activated? * * @param int $a_obj_id * @param int $a_ref_id * @return boolean */ public static function _isActivated($a_ref_id) { include_once './Services/Object/classes/class.ilObjectActivation.php'; $item = ilObjectActivation::getItem($a_ref_id); switch ($item['timing_type']) { case ilObjectActivation::TIMINGS_ACTIVATION: if (time() < $item['timing_start'] or time() > $item['timing_end']) { return false; } // fallthrough // fallthrough default: return true; } }
/** * Fill table row */ protected function fillRow($a_set) { global $lng, $objDefinition; $obj_id = $a_set["obj_id"]; $ref_id = $a_set["ref_id"]; $type = $a_set['type']; $title = $a_set['title']; $description = $a_set['description']; $relevance = $a_set['relevance']; if (!$type) { return false; } include_once './Services/Search/classes/Lucene/class.ilLuceneSearchObjectListGUIFactory.php'; $item_list_gui = ilLuceneSearchObjectListGUIFactory::factory($type); $item_list_gui->initItem($ref_id, $obj_id, $title, $description); $item_list_gui->setContainerObject($this->parent_obj); $item_list_gui->setSearchFragment($this->presenter->lookupContent($obj_id, 0)); $item_list_gui->setSeparateCommands(true); ilObjectActivation::addListGUIActivationProperty($item_list_gui, $a_set); $this->presenter->appendAdditionalInformation($item_list_gui, $ref_id, $obj_id, $type); $this->tpl->setVariable("ACTION_HTML", $item_list_gui->getCommandsHTML()); if ($html = $item_list_gui->getListItemHTML($ref_id, $obj_id, $title, $description)) { $item_html[$ref_id]['html'] = $html; $item_html[$ref_id]['type'] = $type; } $this->tpl->setVariable("HREF_IMG", $item_list_gui->default_command["link"]); global $lng; if ($this->enabledRelevance()) { include_once "Services/UIComponent/ProgressBar/classes/class.ilProgressBar.php"; $pbar = ilProgressBar::getInstance(); $pbar->setCurrent($relevance); $this->tpl->setCurrentBlock('relev'); $this->tpl->setVariable('REL_PBAR', $pbar->render()); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("ITEM_HTML", $html); if (!$objDefinition->isPlugin($type)) { $type_txt = $lng->txt('icon') . ' ' . $lng->txt('obj_' . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } else { include_once "./Services/Component/classes/class.ilPlugin.php"; $type_txt = ilPlugin::lookupTxt("rep_robj", $type, "obj_" . $type); $icon = ilObject::_getIcon($obj_id, 'small', $type); } $this->tpl->setVariable("TYPE_IMG", ilUtil::img($icon, $type_txt, '', '', 0, '', 'ilIcon')); }
protected function updateActivation() { // moved activation to ilObjectActivation if ($this->ref_id) { include_once "./Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::getItem($this->ref_id); $item = new ilObjectActivation(); if (!$this->isActivationLimited()) { $item->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED); } else { $item->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION); $item->setTimingStart($this->getActivationStartDate()); $item->setTimingEnd($this->getActivationEndDate()); $item->toggleVisible($this->getActivationVisibility()); } $item->update($this->ref_id); } }
/** * Loads a ilObjTest object from a database */ public function loadFromDb() { global $ilDB; $result = $ilDB->queryF("SELECT * FROM tst_tests WHERE obj_fi = %s", array('integer'), array($this->getId())); if ($result->numRows() == 1) { $data = $ilDB->fetchObject($result); $this->setTestId($data->test_id); if (strlen($this->getAuthor()) == 0) { $this->saveAuthorToMetadata($data->author); } $this->setAuthor($data->author); include_once "./Services/RTE/classes/class.ilRTE.php"; $this->setIntroductionEnabled($data->intro_enabled); $this->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($data->introduction, 1)); $this->setShowInfo($data->showinfo); $this->setFinalStatement(ilRTE::_replaceMediaObjectImageSrc($data->finalstatement, 1)); $this->setForceJS($data->forcejs); $this->setCustomStyle($data->customstyle); $this->setShowFinalStatement($data->showfinalstatement); $this->setSequenceSettings($data->sequence_settings); $this->setScoreReporting($data->score_reporting); $this->setInstantFeedbackSolution($data->instant_verification); $this->setAnswerFeedbackPoints($data->answer_feedback_points); $this->setAnswerFeedback($data->answer_feedback); $this->setAnonymity($data->anonymity); $this->setShowCancel($data->show_cancel); $this->setShowMarker($data->show_marker); $this->setFixedParticipants($data->fixed_participants); $this->setNrOfTries($data->nr_of_tries); $this->setKiosk($data->kiosk); $this->setUsePreviousAnswers($data->use_previous_answers); $this->setRedirectionMode($data->redirection_mode); $this->setRedirectionUrl($data->redirection_url); $this->setTitleOutput($data->title_output); $this->setProcessingTime($data->processing_time); $this->setEnableProcessingTime($data->enable_processing_time); $this->setResetProcessingTime($data->reset_processing_time); $this->setReportingDate($data->reporting_date); $this->setShuffleQuestions($data->shuffle_questions); $this->setResultsPresentation($data->results_presentation); $this->setStartingTimeEnabled($data->starting_time_enabled); $this->setStartingTime($data->starting_time); $this->setEndingTimeEnabled($data->ending_time_enabled); $this->setEndingTime($data->ending_time); $this->setListOfQuestionsSettings($data->show_summary); $this->setECTSOutput($data->ects_output); $this->setECTSGrades(array("A" => $data->ects_a, "B" => $data->ects_b, "C" => $data->ects_c, "D" => $data->ects_d, "E" => $data->ects_e)); $this->setECTSFX($data->ects_fx); $this->mark_schema->flush(); $this->mark_schema->loadFromDb($this->getTestId()); $this->setCountSystem($data->count_system); $this->setMCScoring($data->mc_scoring); $this->setMailNotification($data->mailnotification); $this->setMailNotificationType($data->mailnottype); $this->setExportSettings($data->exportsettings); $this->setScoreCutting($data->score_cutting); $this->setPasswordEnabled($data->password_enabled); $this->setPassword($data->password); $this->setLimitUsersEnabled($data->limit_users_enabled); $this->setAllowedUsers($data->allowedusers); $this->setAllowedUsersTimeGap($data->alloweduserstimegap); $this->setPassScoring($data->pass_scoring); $this->setObligationsEnabled($data->obligations_enabled); $this->setOfferingQuestionHintsEnabled($data->offer_question_hints); $this->setCertificateVisibility($data->certificate_visibility); $this->setEnabledViewMode($data->enabled_view_mode); $this->setTemplate($data->template_id); $this->setPoolUsage($data->pool_usage); $this->setPrintBestSolutionWithResult((bool) $data->print_bs_with_res); $this->setHighscoreEnabled((bool) $data->highscore_enabled); $this->setHighscoreAnon((bool) $data->highscore_anon); $this->setHighscoreAchievedTS((bool) $data->highscore_achieved_ts); $this->setHighscoreScore((bool) $data->highscore_score); $this->setHighscorePercentage((bool) $data->highscore_percentage); $this->setHighscoreHints((bool) $data->highscore_hints); $this->setHighscoreWTime((bool) $data->highscore_wtime); $this->setHighscoreOwnTable((bool) $data->highscore_own_table); $this->setHighscoreTopTable((bool) $data->highscore_top_table); $this->setHighscoreTopNum((int) $data->highscore_top_num); $this->setOnline((bool) $data->online_status); $this->setSpecificAnswerFeedback((int) $data->specific_feedback); $this->setAutosave((bool) $data->autosave); $this->setAutosaveIval((int) $data->autosave_ival); $this->setPassDeletionAllowed($data->pass_deletion_allowed); $this->setEnableExamview((bool) $data->enable_examview); $this->setShowExamviewHtml((bool) $data->show_examview_html); $this->setShowExamviewPdf((bool) $data->show_examview_pdf); $this->setEnableArchiving((bool) $data->enable_archiving); $this->setShowExamIdInTestPassEnabled((bool) $data->examid_in_test_pass); $this->setShowExamIdInTestResultsEnabled((bool) $data->examid_in_test_res); $this->setSignSubmission((bool) $data->sign_submission); $this->setQuestionSetType($data->question_set_type); $this->setCharSelectorAvailability((int) $data->char_selector_availability); $this->setCharSelectorDefinition($data->char_selector_definition); $this->setSkillServiceEnabled((bool) $data->skill_service); $this->setResultFilterTaxIds(strlen($data->result_tax_filters) ? unserialize($data->result_tax_filters) : array()); $this->setShowGradingStatusEnabled((bool) $data->show_grading_status); $this->setShowGradingMarkEnabled((bool) $data->show_grading_mark); $this->setInstantFeedbackAnswerFixationEnabled((bool) $data->inst_fb_answer_fixation); $this->loadQuestions(); } // moved activation to ilObjectActivation if ($this->ref_id) { include_once "./Services/Object/classes/class.ilObjectActivation.php"; $activation = ilObjectActivation::getItem($this->ref_id); switch ($activation["timing_type"]) { case ilObjectActivation::TIMINGS_ACTIVATION: $this->setActivationLimited(true); $this->setActivationStartingTime($activation["timing_start"]); $this->setActivationEndingTime($activation["timing_end"]); $this->setActivationVisibility($activation["visible"]); break; default: $this->setActivationLimited(false); break; } } }
/** * update * * @access public * @return */ public function update() { global $ilErr, $ilAccess, $tpl, $ilUser; // #19997 - see ilObjectListGUI::insertTimingsCommand() if (!$ilAccess->checkAccess('write', '', $this->parent_ref_id) && !$ilAccess->checkAccess('write', '', $this->getItemId())) { $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->MESSAGE); } $this->initFormEdit(); if ($this->form->checkInput()) { include_once "Services/Object/classes/class.ilObjectActivation.php"; $activation = new ilObjectActivation(); $activation->setTimingType($this->form->getInput('timing_type')); $date = $this->form->getInput('timing_start'); $date = new ilDateTime($date['date'] . ' ' . $date['time'], IL_CAL_DATETIME, $ilUser->getTimeZone()); $activation->setTimingStart($date->get(IL_CAL_UNIX)); $date = $this->form->getInput('timing_end'); $date = new ilDateTime($date['date'] . ' ' . $date['time'], IL_CAL_DATETIME, $ilUser->getTimeZone()); $activation->setTimingEnd($date->get(IL_CAL_UNIX)); $date = $this->form->getInput('sug_start'); $date = new ilDate($date['date'], IL_CAL_DATE); $activation->setSuggestionStart($date->get(IL_CAL_UNIX)); $date = $this->form->getInput('sug_end'); $date = new ilDate($date['date'], IL_CAL_DATE); $activation->setSuggestionEnd($date->get(IL_CAL_UNIX)); $date = $this->form->getInput('early_start'); $date = new ilDate($date['date'], IL_CAL_DATE); $activation->setEarliestStart($date->get(IL_CAL_UNIX)); $date = $this->form->getInput('late_end'); $date = new ilDate($date['date'], IL_CAL_DATE); $activation->setLatestEnd($date->get(IL_CAL_UNIX)); $activation->toggleVisible((bool) $this->form->getInput('visible')); $activation->toggleChangeable((bool) $this->form->getInput('changeable')); if (!$activation->validateActivation()) { ilUtil::sendFailure($ilErr->getMessage()); $this->form->setValuesByPost(); $tpl->setContent($this->form->getHTML()); return false; } else { $activation->update($this->getItemId()); ilUtil::sendSuccess($this->lng->txt('settings_saved'), true); $this->ctrl->redirect($this, "edit"); } } else { $this->form->setValuesByPost(); $tpl->setContent($this->form->getHTML()); } }
function getPossibleStarters() { include_once "Services/Object/classes/class.ilObjectActivation.php"; foreach (ilObjectActivation::getItems($this->getRefId(), false) as $node) { switch ($node['type']) { case 'lm': case 'sahs': case 'svy': case 'tst': $poss_items[] = $node['ref_id']; break; } } return $poss_items ? $poss_items : array(); }
/** * render objective * * @access protected * @param int objective id * @param bool co page status * @param ilAccordionGUI $a_accordion * @param array $a_lo_result * @return string html */ protected function renderObjective($a_objective_id, &$a_has_lo_page, ilAccordionGUI $a_accordion = null, array $a_lo_result = null) { global $ilUser, $lng; include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByObjective($a_objective_id); // sorting is handled by ilCourseObjectiveMaterials // $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj',$a_objective_id,$items); include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id); // #13381 - map material assignment to position $sort_map = array(); foreach ($objectives_lm_obj->getMaterials() as $item) { $sort_map[$item["lm_ass_id"]] = $item["position"]; } $is_manage = $this->getContainerGUI()->isActiveAdministrationPanel(); $is_order = $this->getContainerGUI()->isActiveOrdering(); $sort_content = array(); foreach ($items as $item) { if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) { continue; } $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); if ($is_order || $a_accordion) { $item_list_gui2->enableCommands(true, true); $item_list_gui2->enableProperties(false); } $chapters = $objectives_lm_obj->getChapters(); if (count($chapters)) { $has_sections = false; foreach ($chapters as $chapter) { if ($chapter['ref_id'] != $item['child']) { continue; } $has_sections = true; include_once './Modules/LearningModule/classes/class.ilLMObject.php'; $title = $item['title'] . " › " . ilLMObject::_lookupTitle($chapter['obj_id']) . " (" . $lng->txt('obj_' . $chapter['type']) . ")"; $item_list_gui2->setDefaultCommandParameters(array("obj_id" => $chapter['obj_id'], "focus_id" => $chapter['obj_id'], "focus_return" => $this->container_obj->getRefId())); if ($is_order) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $chapter['lm_ass_id'] . "]", sprintf('%d', $chapter['position'] * 10)); } $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $title, $item['description']); // #13381 - use materials order $sort_key = str_pad($chapter['position'], 5, 0, STR_PAD_LEFT) . "_" . strtolower($title) . "_" . $chapter['lm_ass_id']; $sort_content[$sort_key] = $sub_item_html; } } $this->rendered_items[$item['child']] = true; if ($lm_ass_id = $objectives_lm_obj->isAssigned($item['ref_id'], true)) { if ($is_order) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $lm_ass_id . "]", sprintf('%d', $sort_map[$lm_ass_id] * 10)); } $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); // #13381 - use materials order $sort_key = str_pad($sort_map[$lm_ass_id], 5, 0, STR_PAD_LEFT) . "_" . strtolower($item['title']) . "_" . $lm_ass_id; $sort_content[$sort_key] = $sub_item_html; } } if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) { $this->objective_list_gui->enableCommands(false); } else { $this->objective_list_gui->enableCommands(true); } if ($is_order) { $this->objective_list_gui->setPositionInputField("[lobj][" . $a_objective_id . "][0]", $objective->__getPosition() * 10); } ksort($sort_content); if (!$a_accordion) { foreach ($sort_content as $sub_item_html) { $this->objective_list_gui->addSubItemHTML($sub_item_html); } return $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription(), $is_manage || $is_order); } else { $acc_content = $sort_content; $initial_shown = false; if ($this->getSettings()->hasSeparateInitialTests() and !$a_lo_result['initial_status']) { $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_INITIAL), $a_objective_id, true, false, $a_lo_result); $initial_shown = TRUE; } elseif ($this->getSettings()->hasSeparateQualifiedTests()) { $acc_content[] = $this->renderTest($this->getTestAssignments()->getTestByObjective($a_objective_id, ilLOSettings::TYPE_TEST_QUALIFIED), $a_objective_id, false, false, $a_lo_result); } /* if($this->loc_settings->getInitialTest() && $this->loc_settings->getType() == ilLOSettings::LOC_INITIAL_SEL && !$a_lo_result["initial_status"]) { $acc_content[] = $this->renderTest($this->loc_settings->getInitialTest(), $a_objective_id, true, false, $a_lo_result); $initial_shown = true; } if(!$initial_shown && $this->loc_settings->getQualifiedTest() && $this->loc_settings->isQualifiedTestPerObjectiveVisible()) { $acc_content[] = $this->renderTest($this->loc_settings->getQualifiedTest(), $a_objective_id, false, false, $a_lo_result); } */ $co_page = null; include_once "./Services/COPage/classes/class.ilPageUtil.php"; if (ilPageUtil::_existsAndNotEmpty("lobj", $objective->getObjectiveId())) { $a_has_lo_page = true; include_once 'Modules/Course/classes/Objectives/class.ilLOPageGUI.php'; $page_gui = new ilLOPageGUI($objective->getObjectiveId()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId(0)); $page_gui->setPresentationTitle(""); $page_gui->setTemplateOutput(false); $page_gui->setHeader(""); $co_page = "<div class='ilContObjectiveIntro'>" . $page_gui->showPage() . "</div>"; } // patch optes start $a_accordion->addItem($this->buildAccordionTitle($objective, $a_lo_result), $co_page . $this->buildAccordionContent($acc_content), isset($_GET["oobj"]) && (int) $_GET["oobj"] == $objective->getObjectiveId()); // patch optes end } }
public function checkReminder() { global $ilDB, $ilAccess; $now = time(); $today = date("Y-m-d"); // object settings / participation period if ($this->isOffline() || !$this->getReminderStatus() || $this->getStartDate() && $now < $this->getStartDate() || $this->getEndDate() && $now > $this->getEndDate()) { return false; } // reminder period $start = $this->getReminderStart(); if ($start) { $start = $start->get(IL_CAL_DATE); } $end = $this->getReminderEnd(); if ($end) { $end = $end->get(IL_CAL_DATE); } if ($today < $start || $end && $today > $end) { return false; } // object access period include_once "Services/Object/classes/class.ilObjectActivation.php"; $item_data = ilObjectActivation::getItem($this->getRefId()); if ($item_data["timing_type"] == ilObjectActivation::TIMINGS_ACTIVATION && ($now < $item_data["timing_start"] || $now > $item_data["timing_end"])) { return false; } // check frequency $cut = new ilDate($today, IL_CAL_DATE); $cut->increment(IL_CAL_DAY, $this->getReminderFrequency() * -1); if (!$this->getReminderLastSent() || $cut->get(IL_CAL_DATE) >= substr($this->getReminderLastSent(), 0, 10)) { $user_ids = $this->getNotificationTargetUserIds(); if ($user_ids) { // gather participants who already finished $finished_ids = array(); $set = $ilDB->query("SELECT user_fi FROM svy_finished" . " WHERE survey_fi = " . $ilDB->quote($this->getSurveyId(), "integer") . " AND state = " . $ilDB->quote(1, "text") . " AND " . $ilDB->in("user_fi", $user_ids, "", "integer")); while ($row = $ilDB->fetchAssoc($set)) { $finished_ids[] = $row["user_fi"]; } // some users missing out? $missing_ids = array_diff($user_ids, $finished_ids); if ($missing_ids) { foreach ($missing_ids as $idx => $user_id) { // should be able to participate if (!$ilAccess->checkAccessOfUser($user_id, "read", "", $this->getRefId(), "svy", $this->getId())) { unset($missing_ids[$idx]); } } } if ($missing_ids) { $this->sentReminder($missing_ids); } } $this->setReminderLastSent($today); $this->saveToDb(); return true; } return false; }
/** * Get news aggregation (e.g. for courses, groups) */ function getAggregatedNewsData($a_ref_id, $a_only_public = false, $a_time_period = 0, $a_prevent_aggregation = false, $a_starting_date = "", $a_no_auto_generated = false, $a_user_id = null) { global $tree, $ilAccess, $ilObjDataCache; // get news of parent object $data = array(); // get subtree $cur_node = $tree->getNodeData($a_ref_id); if ($cur_node["lft"] != "") { $nodes = $tree->getSubTree($cur_node, true); } else { $nodes = array(); } // preload object data cache $ref_ids = array(); $obj_ids = array(); foreach ($nodes as $node) { $ref_ids[] = $node["child"]; $obj_ids[] = $node["obj_id"]; } $ilObjDataCache->preloadReferenceCache($ref_ids); if (!$a_only_public) { include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($ref_ids); } // no check, for which of the objects any news are available $news_obj_ids = ilNewsItem::filterObjIdsPerNews($obj_ids, $a_time_period, $a_starting_date); //$news_obj_ids = $obj_ids; // get news for all subtree nodes $contexts = array(); foreach ($nodes as $node) { // only go on, if news are available if (!in_array($node["obj_id"], $news_obj_ids)) { continue; } if (!$a_only_public) { if (!$a_user_id) { $acc = $ilAccess->checkAccess("read", "", $node["child"]); } else { $acc = $ilAccess->checkAccessOfUser($a_user_id, "read", "", $node["child"]); } if (!$acc) { continue; } } $ref_id[$node["obj_id"]] = $node["child"]; $contexts[] = array("obj_id" => $node["obj_id"], "obj_type" => $node["type"]); } // sort and return $news = $this->queryNewsForMultipleContexts($contexts, $a_only_public, $a_time_period, $a_starting_date, $a_no_auto_generated, $a_user_id); $to_del = array(); foreach ($news as $k => $v) { $news[$k]["ref_id"] = $ref_id[$v["context_obj_id"]]; } $data = ilNewsItem::mergeNews($data, $news); $data = ilUtil::sortArray($data, "creation_date", "desc", false, true); if (!$a_prevent_aggregation) { $data = $this->aggregateFiles($data, $a_ref_id); } return $data; }
/** * delete object or referenced object * (in the case of a referenced object, object data is only deleted * if last reference is deleted) * This function removes an object entirely from system!! * * @access public * @return boolean true if object was removed completely; false if only a references was removed */ function delete() { global $rbacadmin, $log, $ilDB; $remove = false; // delete object_data entry if (!$this->referenced || $this->countReferences() == 1) { // check type match $db_type = ilObject::_lookupType($this->getId()); if ($this->type != $db_type) { $message = "ilObject::delete(): Type mismatch. Object with obj_id: " . $this->id . " " . "was instantiated by type '" . $this->type . "'. DB type is: " . $db_type; // write log entry $log->write($message); // raise error $this->ilias->raiseError("ilObject::delete(): Type mismatch. (" . $this->type . "/" . $this->id . ")", $this->ilias->error_obj->WARNING); } // delete entry in object_data $q = "DELETE FROM object_data " . "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($q); // delete long description $query = "DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"); $ilDB->manipulate($query); // write log entry $log->write("ilObject::delete(), deleted object, obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); // remove news include_once "./Services/News/classes/class.ilNewsItem.php"; $news_item = new ilNewsItem(); $news_item->deleteNewsOfContext($this->getId(), $this->getType()); include_once "./Services/Block/classes/class.ilBlockSetting.php"; ilBlockSetting::_deleteSettingsOfBlock($this->getId(), "news"); include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; ilDidacticTemplateObjSettings::deleteByObjId($this->getId()); /* remove notes (see infoscreen gui) as they can be seen as personal data we are keeping them for now include_once("Services/Notes/classes/class.ilNote.php"); foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type) { foreach(ilNote::_getNotesOfObject($this->id, 0, $this->type, $note_type) as $note) { $note->delete(); } } */ // BEGIN WebDAV: Delete WebDAV properties $query = "DELETE FROM dav_property " . "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer'); $res = $ilDB->manipulate($query); // END WebDAV: Delete WebDAV properties include_once './Services/Tracking/classes/class.ilChangeEvent.php'; ilChangeEvent::_delete($this->getId()); include_once './Services/Tracking/classes/class.ilLPCollections.php'; ilLPCollections::_deleteAll($this->getId()); include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; ilECSImport::_deleteByObjId($this->getId()); $remove = true; } else { // write log entry $log->write("ilObject::delete(), object not deleted, number of references: " . $this->countReferences() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); } // delete object_reference entry if ($this->referenced) { include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::deleteAllEntries($this->getRefId()); // delete entry in object_reference $query = "DELETE FROM object_reference " . "WHERE ref_id = " . $ilDB->quote($this->getRefId(), 'integer'); $res = $ilDB->manipulate($query); // write log entry $log->write("ilObject::delete(), reference deleted, ref_id: " . $this->getRefId() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle()); // DELETE PERMISSION ENTRIES IN RBAC_PA // DONE: method overwritten in ilObjRole & ilObjUser. // this call only applies for objects in rbac (not usr,role,rolt) // TODO: Do this for role templates too $rbacadmin->revokePermission($this->getRefId(), 0, false); include_once "Services/AccessControl/classes/class.ilRbacLog.php"; ilRbacLog::delete($this->getRefId()); // Remove applied didactic template setting include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php'; ilDidacticTemplateObjSettings::deleteByRefId($this->getRefId()); // Remove desktop items ilUtil::removeItemFromDesktops($this->getRefId()); } // remove conditions if ($this->referenced) { $ch =& new ilConditionHandler(); $ch->delete($this->getRefId()); unset($ch); } return $remove; }
/** * Is activated? * * @see ilStartupGUI * @param int $a_obj_id * @param bool &$a_visible_flag * @param bool $a_mind_member_view * @return boolean */ public static function _isActivated($a_obj_id, &$a_visible_flag = null, $a_mind_member_view = true) { // #7669 if ($a_mind_member_view) { include_once './Services/Container/classes/class.ilMemberViewSettings.php'; if (ilMemberViewSettings::getInstance()->isActive()) { $a_visible_flag = true; return true; } } // offline? if (!self::_isOnline($a_obj_id)) { $a_visible_flag = false; return false; } $ref_id = ilObject::_getAllReferences($a_obj_id); $ref_id = array_pop($ref_id); $a_visible_flag = true; include_once './Services/Object/classes/class.ilObjectActivation.php'; $item = ilObjectActivation::getItem($ref_id); switch ($item['timing_type']) { case ilObjectActivation::TIMINGS_ACTIVATION: if (time() < $item['timing_start'] or time() > $item['timing_end']) { $a_visible_flag = $item['visible']; return false; } // fallthrough // fallthrough default: return true; } }
/** * Member administration * * @global ilRbacReview $rbacreview * @access protected * @return */ protected function membersObject() { global $ilUser, $ilAccess, $ilToolbar, $lng, $ilCtrl, $tpl, $rbacreview; include_once './Modules/Course/classes/class.ilCourseParticipants.php'; include_once './Modules/Course/classes/class.ilCourseParticipantsTableGUI.php'; if (isset($_GET['member_table_nav'])) { list($_SESSION['crs_print_sort'], $_SESSION['crs_print_order'], $tmp) = explode(':', $_GET['member_table_nav']); } $this->checkPermission('write'); include_once './Services/Tracking/classes/class.ilObjUserTracking.php'; $this->show_tracking = (ilObjUserTracking::_enabledLearningProgress() and ilObjUserTracking::_enabledUserRelatedData()); if ($this->show_tracking) { include_once './Services/Object/classes/class.ilObjectLP.php'; $olp = ilObjectLP::getInstance($this->object->getId()); $this->show_tracking = $olp->isActive(); } include_once './Services/Object/classes/class.ilObjectActivation.php'; $this->timings_enabled = (ilObjectActivation::hasTimings($this->object->getRefId()) and $this->object->getViewMode() == IL_CRS_VIEW_TIMING); $this->setSubTabs('members'); $this->tabs_gui->setTabActive('members'); $this->tabs_gui->setSubTabActive('crs_member_administration'); $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.crs_edit_members.html', 'Modules/Course'); $this->tpl->setVariable('FORMACTION', $this->ctrl->getFormAction($this)); // add members include_once './Services/Search/classes/class.ilRepositorySearchGUI.php'; ilRepositorySearchGUI::fillAutoCompleteToolbar($this, $ilToolbar, array('auto_complete_name' => $lng->txt('user'), 'user_type' => $this->getLocalRoles(), 'submit_name' => $lng->txt('add'))); // spacer $ilToolbar->addSeparator(); // search button $ilToolbar->addButton($this->lng->txt("crs_search_users"), $this->ctrl->getLinkTargetByClass('ilRepositorySearchGUI', 'start')); // separator $ilToolbar->addSeparator(); // print button $ilToolbar->addButton($this->lng->txt("crs_print_list"), $this->ctrl->getLinkTarget($this, 'printMembers')); /* attendance list button $ilToolbar->addButton($this->lng->txt("sess_gen_attendance_list"), $this->ctrl->getLinkTarget($this, 'attendanceList')); */ $this->setShowHidePrefs(); // Waiting list table include_once './Modules/Course/classes/class.ilCourseWaitingList.php'; $waiting_list = new ilCourseWaitingList($this->object->getId()); if (count($wait = $waiting_list->getAllUsers())) { include_once './Services/Membership/classes/class.ilWaitingListTableGUI.php'; if ($ilUser->getPref('crs_wait_hide')) { $table_gui = new ilWaitingListTableGUI($this, $waiting_list, false); $this->ctrl->setParameter($this, 'wait_hide', 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilWaitingListTableGUI($this, $waiting_list, true); $this->ctrl->setParameter($this, 'wait_hide', 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->setUsers($wait); $table_gui->setTitle($this->lng->txt('crs_waiting_list'), 'icon_usr.svg', $this->lng->txt('crs_waiting_list')); $this->tpl->setVariable('TABLE_WAIT', $table_gui->getHTML()); } // Subscriber table if ($subscribers = ilCourseParticipants::lookupSubscribers($this->object->getId())) { include_once './Services/Membership/classes/class.ilSubscriberTableGUI.php'; if ($ilUser->getPref('crs_subscriber_hide')) { $table_gui = new ilSubscriberTableGUI($this, false); $this->ctrl->setParameter($this, 'subscriber_hide', 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilSubscriberTableGUI($this, true); $this->ctrl->setParameter($this, 'subscriber_hide', 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->readSubscriberData(); $table_gui->setTitle($this->lng->txt('group_new_registrations'), 'icon_usr.svg', $this->lng->txt('group_new_registrations')); $this->tpl->setVariable('TABLE_SUB', $table_gui->getHTML()); } if ($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultAdminRole()))) { // Security: display the list of course administrators read-only, // if the user doesn't have the 'edit_permission' permission. $showEditLink = ($ilAccess->checkAccess("edit_permission", '', $this->object->getRefId()) or ilCourseParticipants::_getInstanceByObjId($this->object->getId())->isAdmin($ilUser->getId())); if ($ilUser->getPref('crs_admin_hide')) { $table_gui = new ilCourseParticipantsTableGUI($this, 'admin', false, false, $this->timings_enabled, $showEditLink, $this->object->getDefaultAdminRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'admin_hide', 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilCourseParticipantsTableGUI($this, 'admin', true, false, $this->timings_enabled, $showEditLink, $this->object->getDefaultAdminRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'admin_hide', 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->setTitle($this->lng->txt('crs_administrators'), 'icon_usr.svg', $this->lng->txt('crs_administrators')); $table_gui->parse(); $this->tpl->setVariable('ADMINS', $table_gui->getHTML()); } if ($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultTutorRole()))) { if ($ilUser->getPref('crs_tutor_hide')) { $table_gui = new ilCourseParticipantsTableGUI($this, 'tutor', false, false, $this->timings_enabled, true, $this->object->getDefaultTutorRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'tutor_hide', 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilCourseParticipantsTableGUI($this, 'tutor', true, false, $this->timings_enabled, true, $this->object->getDefaultTutorRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'tutor_hide', 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->setTitle($this->lng->txt('crs_tutors'), 'icon_usr.svg', $this->lng->txt('crs_tutors')); $table_gui->parse(); $this->tpl->setVariable('TUTORS', $table_gui->getHTML()); } if ($rbacreview->getNumberOfAssignedUsers(array($this->object->getDefaultMemberRole()))) { if ($ilUser->getPref('crs_member_hide')) { $table_gui = new ilCourseParticipantsTableGUI($this, 'member', false, $this->show_tracking, $this->timings_enabled, true, $this->object->getDefaultMemberRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'member_hide', 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilCourseParticipantsTableGUI($this, 'member', true, $this->show_tracking, $this->timings_enabled, true, $this->object->getDefaultMemberRole(), $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'member_hide', 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->setTitle($this->lng->txt('crs_members'), 'icon_usr.svg', $this->lng->txt('crs_members')); $table_gui->parse(); $this->tpl->setCurrentBlock('member_block'); $this->tpl->setVariable('MEMBERS', $table_gui->getHTML()); $this->tpl->parseCurrentBlock(); } foreach (ilCourseParticipants::getMemberRoles($this->object->getRefId()) as $role_id) { // Do not show table if no user is assigned if (!$GLOBALS['rbacreview']->getNumberOfAssignedUsers(array($role_id))) { continue; } if ($ilUser->getPref('crs_role_hide_' . $role_id)) { $table_gui = new ilCourseParticipantsTableGUI($this, 'role', false, $this->show_tracking, $this->timings_enabled, true, $role_id, $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'role_hide_' . $role_id, 0); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('show')); $this->ctrl->clearParameters($this); } else { $table_gui = new ilCourseParticipantsTableGUI($this, 'role', true, $this->show_tracking, $this->timings_enabled, true, $role_id, $this->object->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP); $this->ctrl->setParameter($this, 'role_hide_' . $role_id, 1); $table_gui->addHeaderCommand($this->ctrl->getLinkTarget($this, 'members'), $this->lng->txt('hide')); $this->ctrl->clearParameters($this); } $table_gui->setTitle(ilObject::_lookupTitle($role_id), 'icon_usr.svg', $this->lng->txt('crs_members')); $table_gui->parse(); $this->tpl->setCurrentBlock('member_block'); $this->tpl->setVariable('MEMBERS', $table_gui->getHTML()); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable('TXT_SELECTED_USER', $this->lng->txt('crs_selected_users')); $this->tpl->setVariable('BTN_FOOTER_EDIT', $this->lng->txt('edit')); $this->tpl->setVariable('BTN_FOOTER_VAL', $this->lng->txt('remove')); $this->tpl->setVariable('BTN_FOOTER_MAIL', $this->lng->txt('crs_mem_send_mail')); $this->tpl->setVariable('ARROW_DOWN', ilUtil::getImagePath('arrow_downright.svg')); }
/** * Render item group * * @param * @return */ function renderItemGroup($a_itgr) { global $ilAccess, $lng; $perm_ok = $ilAccess->checkAccess("read", "", $a_itgr['ref_id']); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']); // if no permission is given, set the items to "rendered" but // do not display the whole block if (!$perm_ok) { foreach ($items as $item) { $this->renderer->hideItem($item["child"]); } return; } $item_list_gui = $this->getItemGUI($a_itgr); $item_list_gui->enableNotes(false); $item_list_gui->enableTags(false); $item_list_gui->enableComments(false); $item_list_gui->enableTimings(false); $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"], $a_itgr["title"], $a_itgr["description"]); $commands_html = $item_list_gui->getCommandsHTML(); $this->renderer->addCustomBlock($a_itgr["ref_id"], $a_itgr["title"], $commands_html); // render item group sub items $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'], $items); $position = 1; foreach ($items as $item) { $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]"); if ($html2 != "") { // :TODO: show it multiple times? $this->renderer->addItemToBlock($a_itgr["ref_id"], $item["type"], $item["child"], $html2, true); } } }
/** * get selected items per type */ function getSelectedItemsPerLocation(&$tpl) { global $ilUser, $rbacsystem, $objDefinition, $ilBench, $ilSetting, $ilObjDataCache, $tree; $output = false; $items = $ilUser->getDesktopItems(); $item_html = array(); $cur_obj_type = ""; if (count($items) > 0) { // preload object data cache $ref_ids = $obj_ids = array(); foreach ($items as $item) { $ref_ids[] = $item["ref_id"]; $obj_ids[] = $item["obj_id"]; } reset($items); $tree->preloadDeleted($ref_ids); $tree->preloadDepthParent($ref_ids); $ilObjDataCache->preloadReferenceCache($ref_ids); include_once "Services/Tracking/classes/class.ilLPStatus.php"; ilLPStatus::preloadListGUIData($obj_ids); include_once "Services/Object/classes/class.ilObjectActivation.php"; ilObjectActivation::preloadData($ref_ids); foreach ($items as $item) { //echo "1"; // get list gui class for each object type if ($cur_obj_type != $item["type"]) { $item_list_gui =& $this->getItemListGUI($item["type"]); if (!$item_list_gui) { continue; } ilObjectActivation::addListGUIActivationProperty($item_list_gui, $item); // notes, comment currently do not work properly $item_list_gui->enableNotes(false); $item_list_gui->enableComments(false); $item_list_gui->enableTags(false); $item_list_gui->enableIcon(true); $item_list_gui->enableDelete(false); $item_list_gui->enableCut(false); $item_list_gui->enableCopy(false); $item_list_gui->enablePayment(false); $item_list_gui->enableLink(false); $item_list_gui->enableInfoScreen(true); if ($this->getCurrentDetailLevel() < 3 || $this->manage) { //echo "3"; $item_list_gui->enableDescription(false); $item_list_gui->enableProperties(false); $item_list_gui->enablePreconditions(false); } if ($this->getCurrentDetailLevel() < 2 || $this->manage) { $item_list_gui->enableCommands(true, true); } } // render item row $ilBench->start("ilPersonalDesktopGUI", "getListHTML"); $item_list_gui->setContainerObject($this); $html = $item_list_gui->getListItemHTML($item["ref_id"], $item["obj_id"], $item["title"], $item["description"]); $ilBench->stop("ilPersonalDesktopGUI", "getListHTML"); if ($html != "") { // BEGIN WebDAV: Use $item_list_gui to determine icon image type $item_html[] = array("html" => $html, "item_ref_id" => $item["ref_id"], "item_obj_id" => $item["obj_id"], "parent_ref" => $item["parent_ref"], "type" => $item["type"], 'item_icon_image_type' => $item_list_gui->getIconImageType()); // END WebDAV: Use $item_list_gui to determine icon image type } } // output block for resource type if (count($item_html) > 0) { $cur_parent_ref = 0; // content row foreach ($item_html as $item) { // add a parent header row for each new parent if ($cur_parent_ref != $item["parent_ref"]) { if ($ilSetting->get("icon_position_in_lists") == "item_rows") { $this->addParentRow($tpl, $item["parent_ref"], false); } else { $this->addParentRow($tpl, $item["parent_ref"]); } $this->resetRowType(); $cur_parent_ref = $item["parent_ref"]; } // BEGIN WebDAV: Use $item_list_gui to determine icon image type. $this->addStandardRow($tpl, $item["html"], $item["item_ref_id"], $item["item_obj_id"], $item['item_icon_image_type'], "th_" . $cur_parent_ref); // END WebDAV: Use $item_list_gui to determine icon image type. $output = true; } } } return $output; }
/** * info screen * * @access protected * @param * @return */ public function infoScreen() { global $ilAccess, $ilUser, $ilCtrl, $tree, $ilToolbar; $this->checkPermission('visible'); $this->tabs_gui->setTabActive('info_short'); $appointment_obj = $this->object->getFirstAppointment(); include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php"; $info = new ilInfoScreenGUI($this); if ($this->object->enabledRegistration()) { include_once './Modules/Session/classes/class.ilEventParticipants.php'; if (ilEventParticipants::_isRegistered($ilUser->getId(), $this->object->getId())) { $ilToolbar->addFormButton($this->lng->txt('event_unregister'), 'join'); } else { if (!isset($_SESSION['sess_hide_info'])) { ilUtil::sendInfo($this->lng->txt('sess_join_info')); } $ilToolbar->addFormButton($this->lng->txt('join_session'), 'join', '', true); } $ilToolbar->setFormAction($this->ctrl->getFormAction($this)); } // Session information if (strlen($this->object->getLocation()) or strlen($this->object->getDetails())) { $info->addSection($this->lng->txt('event_section_information')); } if (strlen($location = $this->object->getLocation())) { $info->addProperty($this->lng->txt('event_location'), nl2br($this->object->getLocation())); } if (strlen($this->object->getDetails())) { $info->addProperty($this->lng->txt('event_details_workflow'), nl2br($this->object->getDetails())); } // Tutor information if ($this->object->hasTutorSettings()) { $info->addSection($this->lng->txt('event_tutor_data')); if (strlen($fullname = $this->object->getName())) { $info->addProperty($this->lng->txt('event_lecturer'), $fullname); } if (strlen($email = $this->object->getEmail())) { $info->addProperty($this->lng->txt('tutor_email'), $email); } if (strlen($phone = $this->object->getPhone())) { $info->addProperty($this->lng->txt('tutor_phone'), $phone); } } $html = ''; include_once './Services/Object/classes/class.ilObjectActivation.php'; include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Modules/Session/classes/class.ilSessionObjectListGUIFactory.php'; $eventItems = ilObjectActivation::getItemsByEvent($this->object->getId()); $parent_id = $tree->getParentId($this->object->getRefId()); $parent_id = ilObject::_lookupObjId($parent_id); $eventItems = ilContainerSorting::_getInstance($parent_id)->sortSubItems('sess', $this->object->getId(), $eventItems); foreach ($eventItems as $item) { $list_gui = ilSessionObjectListGUIFactory::factory($item['type']); $list_gui->setContainerObject($this); $this->modifyItemGUI($list_gui, $item, false); $html .= $list_gui->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); } if (strlen($html)) { $info->addSection($this->lng->txt('event_materials')); $info->addProperty(' ', $html); } // forward the command $this->ctrl->forwardCommand($info); // store read event require_once 'Services/Tracking/classes/class.ilChangeEvent.php'; ilChangeEvent::_recordReadEvent($this->object->getType(), $this->object->getRefId(), $this->object->getId(), $ilUser->getId()); }
private function addReferences($source, $a_object_data) { global $tree, $ilLog; if (!isset($a_object_data['references']) or !count($a_object_data['references'])) { return true; } $original_id = $source->getRefId(); foreach ($a_object_data['references'] as $ref_data) { $new_ref_id = $ref_id = $original_id; if ($tree->getParentId($original_id) != $ref_data['parent_id']) { // New reference requested => create it $new_ref_id = $source->createReference(); $source->putInTree($ref_data['parent_id']); $source->setPermissions($ref_data['parent_id']); } if (isset($ref_data['time_target'])) { include_once './webservice/soap/classes/class.ilObjectXMLWriter.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; if (!isset($ref_data['time_target']['starting_time'])) { $ref_data['time_target']['starting_time'] = time(); } if (!isset($ref_data['time_target']['ending_time'])) { $ref_data['time_target']['ending_time'] = time(); } $items = new ilObjectActivation(); $items->toggleChangeable($ref_data['time_target']['changeable']); $items->setTimingStart($ref_data['time_target']['starting_time']); $items->setTimingEnd($ref_data['time_target']['ending_time']); $items->toggleVisible($ref_data['time_target']['timing_visibility']); $items->setSuggestionStart($ref_data['time_target']['suggestion_start']); $items->setSuggestionEnd($ref_data['time_target']['suggestion_end']); $items->setEarliestStart($ref_data['time_target']['earliest_start']); $items->setLatestEnd($ref_data['time_target']['latest_end']); switch ($ref_data['time_target']['timing_type']) { case ilObjectXMLWriter::TIMING_DEACTIVATED: $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_DEACTIVATED . ' ' . $ref_data['time_target']['timing_type']); $items->setTimingType(ilObjectActivation::TIMINGS_DEACTIVATED); break; case ilObjectXMLWriter::TIMING_TEMPORARILY_AVAILABLE: $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_ACTIVATION . ' ' . $ref_data['time_target']['timing_type']); $items->setTimingType(ilObjectActivation::TIMINGS_ACTIVATION); break; case ilObjectXMLWriter::TIMING_PRESETTING: $ilLog->write(__METHOD__ . ilObjectActivation::TIMINGS_PRESETTING . ' ' . $ref_data['time_target']['timing_type']); $items->setTimingType(ilObjectActivation::TIMINGS_PRESETTING); break; } $items->update($new_ref_id); } } }
/** * render objective * * @access protected * @param int objective id * @return string html */ protected function renderObjective($a_objective_id) { global $ilUser, $lng; include_once './Modules/Course/classes/class.ilCourseObjective.php'; $objective = new ilCourseObjective($this->getContainerObject(), $a_objective_id); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByObjective($a_objective_id); $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('lobj', $a_objective_id, $items); include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id); $pos = 1; foreach ($items as $item) { if ($this->getDetailsLevel($a_objective_id) < self::DETAILS_ALL) { continue; } $chapters = $objectives_lm_obj->getChapters(); $item_list_gui2 = $this->getItemGUI($item); $item_list_gui2->enableIcon(true); if (count($chapters)) { $num = 0; $has_sections = false; foreach ($chapters as $chapter) { if ($chapter['ref_id'] != $item['child']) { continue; } $has_sections = true; include_once './Modules/LearningModule/classes/class.ilLMObject.php'; $details[$num]['desc'] = $lng->txt('obj_' . $chapter['type']) . ' -> '; $details[$num]['target'] = '_top'; $details[$num]['link'] = "ilias.php?baseClass=ilLMPresentationGUI&ref_id=" . $chapter['ref_id'] . '&obj_id=' . $chapter['obj_id']; $details[$num]['name'] = ilLMObject::_lookupTitle($chapter['obj_id']); $num++; } if ($has_sections) { $item_list_gui2->enableItemDetailLinks(true); $item_list_gui2->setItemDetailLinks($details, $lng->txt('crs_suggested_sections') . ': '); } } if ($this->getContainerGUI()->isActiveAdministrationPanel()) { $item_list_gui2->enableCheckbox(true); if ($this->getContainerObject()->getOrderType() == ilContainer::SORT_MANUAL) { $item_list_gui2->setPositionInputField("[lobj][" . $a_objective_id . "][" . $item["ref_id"] . "]", sprintf('%.1f', $pos)); $pos++; } } $this->rendered_items[$item['child']] = true; $sub_item_html = $item_list_gui2->getListItemHTML($item['ref_id'], $item['obj_id'], $item['title'], $item['description']); $this->determineAdminCommands($item["ref_id"], $item_list_gui2->adminCommandsIncluded()); $this->objective_list_gui->addSubItemHTML($sub_item_html); } if ($this->getDetailsLevel($a_objective_id) == self::DETAILS_ALL) { $this->objective_list_gui->enableCommands(false); } else { $this->objective_list_gui->enableCommands(true); } $html = $this->objective_list_gui->getListItemHTML(0, $a_objective_id, $objective->getTitle(), $objective->getDescription()); return $html; }
/** * Append time target settings for items inside of courses * @param int $ref_id Reference id of object * @return void */ public function __appendTimeTargets($a_ref_id) { global $tree; if (!$tree->checkForParentType($a_ref_id, 'crs')) { return; } include_once './Services/Object/classes/class.ilObjectActivation.php'; $time_targets = ilObjectActivation::getItem($a_ref_id); switch ($time_targets['timing_type']) { case ilObjectActivation::TIMINGS_DEACTIVATED: $type = self::TIMING_DEACTIVATED; break; case ilObjectActivation::TIMINGS_ACTIVATION: $type = self::TIMING_TEMPORARILY_AVAILABLE; break; case ilObjectActivation::TIMINGS_PRESETTING: $type = self::TIMING_PRESETTING; break; default: $type = self::TIMING_DEACTIVATED; break; } $this->xmlStartTag('TimeTarget', array('type' => $type)); $vis = $time_targets['visible'] == 0 ? self::TIMING_VISIBILITY_OFF : self::TIMING_VISIBILITY_ON; $this->xmlElement('Timing', array('starting_time' => $time_targets['timing_start'], 'ending_time' => $time_targets['timing_end'], 'visibility' => $vis)); if ($time_targets['changeable'] or 1) { $this->xmlElement('Suggestion', array('starting_time' => $time_targets['suggestion_start'], 'ending_time' => $time_targets['suggestion_end'], 'changeable' => $time_targets['changeable'], 'earliest_start' => $time_targets['earliest_start'], 'latest_end' => $time_targets['latest_end'])); } else { $this->xmlElement('Suggestion', array('starting_time' => $time_targets['suggestion_start'], 'ending_time' => $time_targets['suggestion_end'], 'changeable' => $time_targets['changeable'])); } $this->xmlEndTag('TimeTarget'); return; }
function __getOtherResources() { include_once 'Modules/Course/classes/class.ilCourseObjectiveMaterials.php'; $assigned = ilCourseObjectiveMaterials::_getAllAssignedMaterials($this->course_obj->getId()); foreach (ilObjectActivation::getItems($this->course_obj->getRefId(), false) as $node) { if (in_array($node['ref_id'], $assigned)) { continue; } if ($node['type'] == 'tst') { continue; } $all_lms[] = $node['ref_id']; } return $all_lms ? $all_lms : array(); }
/** * Redraw a list item (ajax) * * @param * @return */ function redrawListItemObject() { global $tpl; $html = null; $item_data = $this->object->getSubItems(false, false, (int) $_GET["child_ref_id"]); $container_view = $this->getContentGUI(); // list item is session material (not part of "_all"-items - see below) include_once './Modules/Session/classes/class.ilEventItems.php'; $event_items = ilEventItems::_getItemsOfContainer($this->object->getRefId()); if (in_array((int) $_GET["child_ref_id"], $event_items)) { include_once './Services/Object/classes/class.ilObjectActivation.php'; foreach ($this->object->items["sess"] as $id) { $items = ilObjectActivation::getItemsByEvent($id['obj_id']); foreach ($items as $event_item) { if ($event_item["child"] == (int) $_GET["child_ref_id"]) { // sessions if ((int) $_GET["parent_ref_id"]) { $event_item["parent"] = (int) $_GET["parent_ref_id"]; } $html = $container_view->renderItem($event_item); } } } } // "normal" list item if (!$html) { foreach ($this->object->items["_all"] as $id) { if ($id["child"] == (int) $_GET["child_ref_id"]) { $html = $container_view->renderItem($id); } } } if ($html) { echo $html; // we need to add onload code manually (rating, comments, etc.) echo $tpl->getOnLoadCodeForAsynch(); } exit; }
function updateTimings() { include_once 'Services/Object/classes/class.ilObjectActivation.php'; global $ilAccess, $ilErr; if (!$ilAccess->checkAccess('write', '', $this->container_obj->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_write'), $ilErr->WARNING); } $this->failed = array(); // Validate $_POST['item'] = is_array($_POST['item']) ? $_POST['item'] : array(); $all_items = array(); foreach ($_POST['item'] as $ref_id => $data) { $item_obj = new ilObjectActivation(); $old_data = ilObjectActivation::getItem($ref_id); $item_obj->setTimingType($_POST['item_active'][$ref_id]['active'] ? ilObjectActivation::TIMINGS_PRESETTING : ilObjectActivation::TIMINGS_DEACTIVATED); $item_obj->setTimingStart($old_data['timing_start']); $item_obj->setTimingEnd($old_data['timing_end']); $item_obj->setSuggestionStart($this->__toUnix($data["sug_start"])); // add duration $data['sug_start']['d'] += abs($data['duration_a']); $item_obj->setSuggestionEnd($this->__toUnix($data['sug_start'], array('h' => 23, 'm' => 55))); $item_obj->setEarliestStart(time()); $item_obj->setLatestEnd($this->__toUnix($data['lim_end'], array('h' => 23, 'm' => 55))); $item_obj->toggleVisible($old_data['visible']); $item_obj->toggleChangeable($_POST['item_change'][$ref_id]['change']); if (!$item_obj->validateActivation()) { $this->failed[$ref_id] = $old_data['title']; } $all_items[$ref_id] =& $item_obj; unset($item_obj); } if (count($this->failed)) { $message = $this->lng->txt('crs_timings_update_error'); $message .= "<br />" . $this->lng->txt('crs_materials') . ': '; $message .= implode(',', $this->failed); ilUtil::sendFailure($message); $this->editTimings(); return false; } // No do update foreach ($all_items as $ref_id => $item_obj_new) { $item_obj_new->update($ref_id); } ilUtil::sendSuccess($this->lng->txt('settings_saved')); $this->editTimings(); return false; }
protected function doDelete() { global $ilDB; if ($this->getId()) { $this->deleteImage(); $this->deleteAllAnswers(); if ($this->ref_id) { ilObjectActivation::deleteAllEntries($this->ref_id); } $ilDB->manipulate("DELETE FROM il_poll" . " WHERE id = " . $ilDB->quote($this->id, "integer")); } }
/** * Add additional information to sub item, e.g. used in * courses for timings information etc. */ function addAdditionalSubItemInformation(&$a_item_data) { include_once './Services/Object/classes/class.ilObjectActivation.php'; ilObjectActivation::addAdditionalSubItemInformation($a_item_data); }
/** * Render item group * * @param * @return */ function renderItemGroup($a_tpl, $a_itgr) { global $ilAccess, $lng; $perm_ok = $ilAccess->checkAccess("read", "", $a_itgr['ref_id']); include_once './Services/Container/classes/class.ilContainerSorting.php'; include_once './Services/Object/classes/class.ilObjectActivation.php'; $items = ilObjectActivation::getItemsByItemGroup($a_itgr['ref_id']); $items = ilContainerSorting::_getInstance($this->getContainerObject()->getId())->sortSubItems('itgr', $a_itgr['obj_id'], $items); // if no permissoin is given, set the items to "rendered" but // do not display the whole block if (!$perm_ok) { foreach ($items as $item) { $this->rendered_items[$item["child"]] = true; } return; } $item_list_gui = $this->getItemGUI($a_itgr); $item_list_gui->enableNotes(false); $item_list_gui->enableTags(false); $item_list_gui->enableComments(false); $item_list_gui->enableTimings(false); $item_list_gui->getListItemHTML($a_itgr["ref_id"], $a_itgr["obj_id"], $a_itgr["title"], $a_itgr["description"]); $commands_html = $item_list_gui->getCommandsHTML(); $this->addSeparatorRow($a_tpl); $a_tpl->setVariable("CB_ID", ' id="bl_cntr_' . $this->bl_cnt . '"'); if ($this->getContainerGUI()->isActiveAdministrationPanel() && !$_SESSION["clipboard"]) { $a_tpl->setCurrentBlock("select_all_row"); $a_tpl->setVariable("CHECKBOXNAME", "bl_cb_" . $this->bl_cnt); $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_" . $this->bl_cnt); $a_tpl->setVariable("SEL_ALL_PARENT", "bl_cntr_" . $this->bl_cnt); $a_tpl->setVariable("TXT_SELECT_ALL", $lng->txt("select_all")); $a_tpl->parseCurrentBlock(); $this->bl_cnt++; } $a_tpl->setCurrentBlock("container_header_row"); $a_tpl->setVariable("BLOCK_HEADER_CONTENT", $a_itgr["title"]); $a_tpl->setVariable("CHR_COMMANDS", $commands_html); $a_tpl->parseCurrentBlock(); $a_tpl->touchBlock("container_row"); $this->resetRowType(); // render item group sub items $position = 1; foreach ($items as $item) { $html2 = $this->renderItem($item, $position++, false, "[itgr][" . $a_itgr['obj_id'] . "]"); if ($html2 != "") { $this->addStandardRow($a_tpl, $html2, $item["child"]); $this->rendered_items[$item["child"]] = true; } } // finish block $a_tpl->setCurrentBlock("container_block"); $a_tpl->parseCurrentBlock(); }