/** * @param array $row * @return array */ protected function prepareRow(array &$row) { $unique_id = md5($row['usr_id'] . $row['ts']); $this->ctrl->setParameter($this->getParentObject(), 'tosv_id', $row['tosv_id']); $row['content_link'] = $this->ctrl->getLinkTarget($this->getParentObject(), 'getAcceptedContentAsynch', '', true, false); $this->ctrl->setParameter($this->getParentObject(), 'tosv_id', ''); $row['img_down'] = ilGlyphGUI::get(ilGlyphGUI::SEARCH); $row['id'] = $unique_id; $modal = ilModalGUI::getInstance(); $modal->setHeading($this->lng->txt('tos_agreement_document')); $modal->setId('tos_' . $unique_id); $modal->setBody(''); $row['modal'] = $modal->getHTML(); }
/** * @return string */ public function getHtml() { global $ilCtrl; $tpl = new ilTemplate("tpl.dcl_tree.html", true, true, "Modules/DataCollection"); $tpl->setVariable("FIELD_ID", $this->getPostVar()); $tpl->setVariable("AJAX_LINK", $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", "searchObjects")); $tpl->setVariable("LOADER_PATH", ilUtil::getImagePath("loader.svg")); $out = $this->title_input->getToolbarHTML(); $out .= "<a href='#' style='display:inline-block;' id='remove_{$this->getPostVar()}'>" . ilGlyphGUI::get(ilGlyphGUI::REMOVE) . "</a>"; $out .= $this->search_input->getTableFilterHTML(); $out .= $this->hidden_input->getToolbarHTML(); $out .= "<a href='#' id='search_button_" . $this->getPostVar() . "'>" . $this->lng->txt('search') . "</a>"; $out .= $tpl->get(); return $out; }
/** * @param array $row * @return array */ protected function prepareRow(array &$row) { if (is_string($row['agreement_document']) && strlen($row['agreement_document'])) { $unique_id = md5($row['language']); $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', rawurlencode($row['agreement_document'])); $row['content_link'] = $this->ctrl->getLinkTarget($this->getParentObject(), 'getAgreementTextByFilenameAsynch', '', true, false); $this->ctrl->setParameter($this->getParentObject(), 'agreement_document', ''); $row['img_down'] = ilGlyphGUI::get(ilGlyphGUI::SEARCH); $row['id'] = $unique_id; $modal = ilModalGUI::getInstance(); $modal->setHeading($this->lng->txt('tos_agreement_document')); $modal->setId('tos_' . $unique_id); $modal->setBody(''); $row['modal'] = $modal->getHTML(); } else { $row['missing_agreement_css_class'] = 'warning'; } }
/** * @param ilTemplate $tpl */ public function insert(ilTemplate $tpl) { /** * @var $lng ilLanguage */ global $lng; $local_tpl = new ilTemplate('tpl.prop_tos_signed_document.html', true, true, 'Services/TermsOfService'); require_once 'Services/UIComponent/Modal/classes/class.ilModalGUI.php'; $modal = ilModalGUI::getInstance(); $modal->setHeading($lng->txt('tos_agreement_document')); $modal->setId('accepted_tos_' . $this->entity->getUserId()); $modal->setBody($this->entity->getText()); require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php'; $local_tpl->setVariable('MODAL_TRIGGER_HTML', ilGlyphGUI::get(ilGlyphGUI::SEARCH)); $local_tpl->setVariable('MODAL', $modal->getHTML()); $local_tpl->setVariable('MODAL_ID', 'accepted_tos_' . $this->entity->getUserId()); $tpl->setCurrentBlock('prop_generic'); $tpl->setVariable('PROP_GENERIC', $local_tpl->get()); $tpl->parseCurrentBlock(); }
/** * Insert help texts */ function insertHelp($a_tpl) { global $lng; $a_tpl->setCurrentBlock("help"); $a_tpl->setVariable("TXT_ADD_EL", $lng->txt("cont_add_elements")); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $a_tpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD)); $a_tpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG)); $a_tpl->setVariable("TXT_DRAG", $lng->txt("cont_drag_and_drop_elements")); $a_tpl->setVariable("TXT_SEL", $lng->txt("cont_double_click_to_delete")); $a_tpl->parseCurrentBlock(); }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_matrixrowwizardinput.html", true, true, "Modules/SurveyQuestionPool"); $i = 0; if (is_object($this->values)) { for ($i = 0; $i < $this->values->getCategoryCount(); $i++) { $cat = $this->values->getCategory($i); $tpl->setCurrentBlock("prop_text_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($cat->title)); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_label_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($cat->label)); $tpl->parseCurrentBlock(); if ($this->getUseOtherAnswer()) { $tpl->setCurrentBlock("other_answer_checkbox"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("OTHER_ID", $this->getPostVar() . "[other][{$i}]"); $tpl->setVariable("ROW_NUMBER", $i); if ($cat->other) { $tpl->setVariable("CHECKED_OTHER", ' checked="checked"'); } $tpl->parseCurrentBlock(); } if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("ROW_NUMBER", $i); $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("ID_LABEL", $this->getPostVar() . "[label][{$i}]"); $tpl->setVariable("SIZE", $this->getSize()); $tpl->setVariable("SIZE_LABEL", 15); $tpl->setVariable("MAXLENGTH", $this->getMaxLength()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED", " disabled=\"disabled\""); $tpl->setVariable("DISABLED_LABEL", " disabled=\"disabled\""); } $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); } } if ($this->getShowWizard()) { $tpl->setCurrentBlock("wizard"); $tpl->setVariable("CMD_WIZARD", 'cmd[wizard' . $this->getFieldId() . ']'); $tpl->setVariable("WIZARD_BUTTON", ilUtil::getImagePath('wizard.svg')); $tpl->setVariable("WIZARD_TEXT", $lng->txt('add_phrase')); $tpl->parseCurrentBlock(); } if ($this->getShowSavePhrase()) { $tpl->setCurrentBlock('savephrase'); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("VALUE_SAVE_PHRASE", $lng->txt('save_phrase')); $tpl->parseCurrentBlock(); } if ($this->getUseOtherAnswer()) { $tpl->setCurrentBlock('other_answer_title'); $tpl->setVariable("OTHER_TEXT", $lng->txt('use_other_answer')); $tpl->parseCurrentBlock(); } $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("ANSWER_TEXT", $this->getCategoryText()); $tpl->setVariable("LABEL_TEXT", $this->getLabelText()); $tpl->setVariable("ACTIONS_TEXT", $lng->txt('actions')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Modules/SurveyQuestionPool/templates/default/matrixrowwizard.js"); }
/** * Show search form * @return boolean */ protected function showSearchForm() { global $ilCtrl, $lng; $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.lucene_search.html', 'Services/Search'); // include js needed include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; ilOverlayGUI::initJavascript(); $this->tpl->addJavascript("./Services/Search/js/Search.js"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $this->tpl->setVariable("FORM_ACTION", $ilCtrl->getFormAction($this, 'performSearch')); $this->tpl->setVariable("TERM", ilUtil::prepareFormOutput($this->search_cache->getQuery())); include_once "./Services/UIComponent/Button/classes/class.ilSubmitButton.php"; $btn = ilSubmitButton::getInstance(); $btn->setCommand("performSearch"); $btn->setCaption("search"); $this->tpl->setVariable("SUBMIT_BTN", $btn->render()); $this->tpl->setVariable("TXT_OPTIONS", $lng->txt("options")); $this->tpl->setVariable("ARR_IMG", ilGlyphGUI::get(ilGlyphGUI::CARET)); $this->tpl->setVariable("TXT_COMBINATION", $lng->txt("search_term_combination")); $this->tpl->setVariable('TXT_COMBINATION_DEFAULT', ilSearchSettings::getInstance()->getDefaultOperator() == ilSearchSettings::OPERATOR_AND ? $lng->txt('search_all_words') : $lng->txt('search_any_word')); $this->tpl->setVariable("TXT_AREA", $lng->txt("search_area")); if (ilSearchSettings::getInstance()->isLuceneItemFilterEnabled()) { $this->tpl->setCurrentBlock("type_sel"); $this->tpl->setVariable('TXT_TYPE_DEFAULT', $lng->txt("search_off")); $this->tpl->setVariable("ARR_IMGT", ilGlyphGUI::get(ilGlyphGUI::CARET)); $this->tpl->setVariable("TXT_FILTER_BY_TYPE", $lng->txt("search_filter_by_type")); $this->tpl->setVariable('FORM', $this->form->getHTML()); $this->tpl->parseCurrentBlock(); } // search area form $this->tpl->setVariable('SEARCH_AREA_FORM', $this->getSearchAreaForm()->getHTML()); $this->tpl->setVariable("TXT_CHANGE", $lng->txt("change")); return true; }
/** * fill data section * * @access protected * */ protected function show() { global $lng, $ilUser; // config $raster = 15; if ($this->user_settings->getDayStart()) { // push starting point to last "slot" of hour BEFORE morning aggregation $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster); } else { $morning_aggr = 0; } $evening_aggr = $this->user_settings->getDayEnd() * 60; $this->tpl = new ilTemplate('tpl.day_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $no_add = true; } elseif ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $no_add = true; } else { $user_id = $ilUser->getId(); $no_add = false; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_DAY, $user_id); $this->scheduler->addSubitemCalendars(true); $this->scheduler->calculate(); $daily_apps = $this->scheduler->getByDay($this->seed, $this->timezone); $hours = $this->parseInfoIntoRaster($daily_apps, $morning_aggr, $evening_aggr, $raster); $colspan = $this->calculateColspan($hours); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::DAY); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); // add milestone link include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; if (!$no_add) { $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $this->seed->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app1"); $this->tpl->setVariable('H_NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->setVariable('NEW_APP_LINK', $new_app_url); $this->tpl->parseCurrentBlock(); } $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); } $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); $this->tpl->setVariable('HEADER_DATE', $this->seed_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($this->seed_info['mon'], false)); $this->tpl->setVariable('HEADER_DAY', ilCalendarUtil::_numericDayToString($this->seed_info['wday'], true)); $this->tpl->setVariable('HCOLSPAN', $colspan - 1); $this->tpl->setVariable('TXT_TIME', $lng->txt("time")); // show fullday events foreach ($daily_apps as $event) { if ($event['fullday']) { $this->showFulldayAppointment($event); } } $this->tpl->setCurrentBlock('fullday_apps'); $this->tpl->setVariable('TXT_F_DAY', $lng->txt("cal_all_day")); $this->tpl->setVariable('COLSPAN', $colspan - 1); $this->tpl->parseCurrentBlock(); // parse the hour rows foreach ($hours as $numeric => $hour) { if (!($numeric % 60) || $numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { if (!$no_add) { $this->tpl->setCurrentBlock("new_app2"); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($numeric / 60)); $this->tpl->setVariable('NEW_APP_HOUR_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add')); $this->tpl->setVariable('NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->parseCurrentBlock(); } // aggregation rows if ($numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('TIME_ROWSPAN', 1); } else { $this->tpl->setVariable('TIME_ROWSPAN', 60 / $raster); } $this->tpl->setCurrentBlock('time_txt'); $this->tpl->setVariable('TIME', $hour['txt']); $this->tpl->parseCurrentBlock(); } foreach ($hour['apps_start'] as $app) { $this->showAppointment($app); } if ($ilUser->prefs["screen_reader_optimization"]) { $this->tpl->touchBlock('scrd_app_cell'); } for ($i = $colspan - 1; $i > $hour['apps_num']; $i--) { $this->tpl->setCurrentBlock('empty_cell'); $this->tpl->setVariable('EMPTY_WIDTH', 100 / (int) ($colspan - 1) . '%'); // last "slot" of hour needs border if ($numeric % 60 == 60 - $raster || $numeric == $morning_aggr && $morning_aggr || $numeric == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('EMPTY_STYLE', ' calempty_border'); } $this->tpl->parseCurrentBlock(); } $this->tpl->touchBlock('time_row'); } }
/** * Get Html for MP3 Player */ function getMp3PlayerHtml($a_preview = false) { global $tpl, $lng; include_once "./Services/YUI/classes/class.ilYuiUtil.php"; ilYuiUtil::initConnection(); $tpl->addJavascript("./Services/MediaObjects/js/MediaObjects.js"); if (!self::$lightbox_initialized && $a_preview) { include_once "./Services/UIComponent/Lightbox/classes/class.ilLightboxGUI.php"; $lb = new ilLightboxGUI("media_lightbox"); $lb->setWidth("660px"); $lb->addLightbox(); self::$lightbox_initialized = true; } require_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php'; include_once "./Services/MediaObjects/classes/class.ilExternalMediaAnalyzer.php"; // youtube /* if (ilExternalMediaAnalyzer::isYouTube($this->getFile())) { $p = ilExternalMediaAnalyzer::extractYouTubeParameters($this->getFile()); $html = '<object width="320" height="240">'. '<param name="movie" value="http://www.youtube.com/v/'.$p["v"].'?fs=1">'. '</param><param name="allowFullScreen" value="true"></param>'. '<param name="allowscriptaccess" value="always">'. '</param><embed src="http://www.youtube.com/v/'.$p["v"].'?fs=1" '. 'type="application/x-shockwave-flash" allowscriptaccess="always" '. 'allowfullscreen="true" width="320" height="240"></embed></object>'; return $html; } // vimeo if (ilExternalMediaAnalyzer::isVimeo($this->getFile())) { $p = ilExternalMediaAnalyzer::extractVimeoParameters($this->getFile()); $html = '<iframe src="http://player.vimeo.com/video/'.$p["id"].'" width="320" height="240" '. 'frameborder="0"></iframe>'; return $html; } */ $mimeType = $this->mimeType == "" ? ilObjMediaObject::getMimeType(basename($this->getFile())) : $this->mimeType; include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php"; // video tag if (in_array($mimeType, array("video/mp4", "video/m4v", "video/rtmp", "video/x-flv", "video/webm", "video/youtube", "video/vimeo", "video/ogg"))) { ilPlayerUtil::initMediaElementJs(); if ($mimeType == "video/quicktime") { $mimeType = "video/mov"; } $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects"); // preview if ($a_preview) { if ($this->getDownloadLink() != "") { $mp_tpl->setCurrentBlock("download"); $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download")); $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink()); $mp_tpl->parseCurrentBlock(); } $mp_tpl->setCurrentBlock("preview"); if ($this->getVideoPreviewPic() != "") { $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic()); } else { $mp_tpl->setVariable("IMG_SRC", ilUtil::getImagePath("mcst_preview.svg")); } $mp_tpl->setVariable("IMG_ALT", $this->video_preview_pic_alt); $mp_tpl->setVariable("PTITLE", $this->getTitle()); $mp_tpl->parseCurrentBlock(); } // sources $mp_tpl->setCurrentBlock("source"); $mp_tpl->setVariable("FILE", $this->getFile()); $mp_tpl->setVariable("MIME", $mimeType); $mp_tpl->parseCurrentBlock(); if (in_array($this->getAlternativeVideoMimeType(), array("video/mp4", "video/webm"))) { $mp_tpl->setCurrentBlock("source"); $mp_tpl->setVariable("FILE", $this->getAlternativeVideoFile()); $mp_tpl->setVariable("MIME", $this->getAlternativeVideoMimeType()); $mp_tpl->parseCurrentBlock(); } $mp_tpl->setCurrentBlock("mejs_video"); if ($a_preview) { $mp_tpl->setVariable("CLASS", "ilNoDisplay"); } $mp_tpl->setVariable("PLAYER_NR", $this->id . "_" . $this->current_nr); $mp_tpl->setVariable("EVENT_URL", $this->event_callback_url); $height = $this->getDisplayHeight(); $width = $this->getDisplayWidth(); if (is_int(strpos($mimeType, "audio/mpeg"))) { $height = "30"; } $mp_tpl->setVariable("DISPLAY_HEIGHT", $height); $mp_tpl->setVariable("DISPLAY_WIDTH", $width); $mp_tpl->setVariable("PREVIEW_PIC", $this->getVideoPreviewPic()); $mp_tpl->setVariable("SWF_FILE", ilPlayerUtil::getFlashVideoPlayerFilename(true)); $mp_tpl->setVariable("FFILE", $this->getFile()); $mp_tpl->setVariable("TITLE", $this->getTitle()); $mp_tpl->setVariable("DESCRIPTION", $this->getDescription()); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; if ($a_preview) { $mp_tpl->setVariable("CLOSE", ilGlyphGUI::get(ilGlyphGUI::CLOSE)); } $mp_tpl->parseCurrentBlock(); $r = $mp_tpl->get(); if (!$a_preview) { $tpl->addOnLoadCode("new MediaElementPlayer('#player_" . $this->id . "_" . $this->current_nr . "');"); } //echo htmlentities($r); return $r; } // audio/mpeg if (is_int(strpos($mimeType, "audio/mpeg")) || in_array($mimeType, array("application/ogg", "audio/ogg"))) { ilPlayerUtil::initMediaElementJs(); $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects"); $preview_output = false; if ($this->getVideoPreviewPic() != "" || $this->getForceAudioPreview()) { if ($this->getDownloadLink() != "") { $mp_tpl->setCurrentBlock("adownload"); $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download")); $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink()); $mp_tpl->parseCurrentBlock(); } $mp_tpl->setCurrentBlock("apreview"); if ($this->getVideoPreviewPic() != "") { $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic()); } else { $mp_tpl->setVariable("IMG_SRC", ilUtil::getImagePath("mcst_preview.svg")); } $mp_tpl->setVariable("PTITLE", $this->getTitle()); $mp_tpl->parseCurrentBlock(); $preview_output = true; } $mp_tpl->setCurrentBlock("audio"); if ($preview_output) { $mp_tpl->setVariable("ASTYLE", "margin-top:-30px"); } $mp_tpl->setVariable("AFILE", $this->getFile()); $mp_tpl->setVariable("APLAYER_NR", $this->id . "_" . $this->current_nr); $mp_tpl->setVariable("AEVENT_URL", $this->event_callback_url); $mp_tpl->setVariable("AHEIGHT", "30"); $mp_tpl->setVariable("AWIDTH", "320"); $mp_tpl->parseCurrentBlock(); return $mp_tpl->get(); } // images if (is_int(strpos($mimeType, "image/"))) { $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects"); if ($this->getDownloadLink() != "") { $mp_tpl->setCurrentBlock("idownload"); $mp_tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download")); $mp_tpl->setVariable("HREF_DOWNLOAD", $this->getDownloadLink()); $mp_tpl->parseCurrentBlock(); } $mp_tpl->setCurrentBlock("ipreview"); if ($this->getVideoPreviewPic() != "") { $mp_tpl->setVariable("IMG_SRC", $this->getVideoPreviewPic()); } else { $mp_tpl->setVariable("IMG_SRC", $this->getFile()); } $mp_tpl->setVariable("PTITLE", $this->getTitle()); $mp_tpl->parseCurrentBlock(); $mp_tpl->setCurrentBlock("image"); $mp_tpl->setVariable("IFILE", $this->getFile()); $mp_tpl->setVariable("IPLAYER_NR", $this->id . "_" . $this->current_nr); $mp_tpl->setVariable("ITITLE", $this->getTitle()); $mp_tpl->setVariable("IDESCRIPTION", $this->getDescription()); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $mp_tpl->setVariable("ICLOSE", ilGlyphGUI::get(ilGlyphGUI::CLOSE)); $height = $this->getDisplayHeight(); $width = $this->getDisplayWidth(); $mp_tpl->setVariable("IHEIGHT", $height); $mp_tpl->setVariable("IWIDTH", $width); $mp_tpl->parseCurrentBlock(); return $mp_tpl->get(); } // fallback, no preview mode $mimeType = $this->mimeType == "" ? ilObjMediaObject::getMimeType(basename($this->getFile())) : $this->mimeType; if (strpos($mimeType, "flv") === false && strpos($mimeType, "audio/mpeg") === false && strpos($mimeType, "image/png") === false && strpos($mimeType, "image/gif") === false) { $html = '<embed src="' . $this->getFile() . '" ' . 'type="' . $mimeType . '" ' . 'ShowControls="1" ' . 'autoplay="false" autostart="false" ' . 'width="320" height="240" scale="aspect" ></embed>'; return $html; } return; $tpl->addJavaScript("./Services/MediaObjects/flash_flv_player/swfobject.js"); $mp_tpl = new ilTemplate("tpl.flv_player.html", true, true, "Services/MediaObjects"); $mp_tpl->setCurrentBlock("default"); $mp_tpl->setVariable("FILE", urlencode($this->getFile())); $mp_tpl->setVariable("PLAYER_NR", $this->current_nr); $mp_tpl->setVariable("DISPLAY_HEIGHT", strpos($mimeType, "audio/mpeg") === false ? "240" : "20"); $mp_tpl->setVariable("DISPLAY_WIDTH", "320"); $mp_tpl->parseCurrentBlock(); return $mp_tpl->get(); }
/** * Get HTML for multiple value icons * * @param bool $a_sortable * @return string; */ protected function getMultiIconsHTML() { global $lng; $id = $this->getFieldId(); $tpl = new ilTemplate("tpl.multi_icons.html", true, true, "Services/Form"); $html = ""; if ($this->multi_addremove) { $tpl->setCurrentBlock("addremove"); $tpl->setVariable("ID", $id); $tpl->setVariable("TXT_ADD", $lng->txt("add")); $tpl->setVariable("TXT_REMOVE", $lng->txt("remove")); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("SRC_ADD", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("SRC_REMOVE", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); } if ($this->multi_sortable) { $tpl->setCurrentBlock("sortable"); $tpl->setVariable("ID", $id); $tpl->setVariable("TXT_DOWN", $lng->txt("down")); $tpl->setVariable("TXT_UP", $lng->txt("up")); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("SRC_UP", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("SRC_DOWN", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } return $tpl->get(); }
/** * @param $question_id * @param $question_pool_id * * @return ilPropertyFormGUI */ protected function buildAdjustQuestionForm($question_id, $question_pool_id) { require_once './Services/Form/classes/class.ilPropertyFormGUI.php'; require_once './Modules/TestQuestionPool/classes/class.assQuestion.php'; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this)); $form->setMultipart(FALSE); $form->setTableWidth("100%"); $form->setId("adjustment"); /** @var $question assQuestionGUI|ilGuiQuestionScoringAdjustable|ilGuiAnswerScoringAdjustable */ $question = assQuestion::instantiateQuestionGUI($question_id); $form->setTitle($question->object->getTitle() . '<br /><small>(' . $question->outQuestionType() . ')</small>'); $hidden_question_id = new ilHiddenInputGUI('q_id'); $hidden_question_id->setValue($question_id); $form->addItem($hidden_question_id); $hidden_qpl_id = new ilHiddenInputGUI('qpl_id'); $hidden_qpl_id->setValue($question_pool_id); $form->addItem($hidden_qpl_id); $this->populateScoringAdjustments($question, $form); $manscoring_section = new ilFormSectionHeaderGUI(); $manscoring_section->setTitle($this->lng->txt('manscoring')); $form->addItem($manscoring_section); $manscoring_preservation = new ilCheckboxInputGUI($this->lng->txt('preserve_manscoring'), 'preserve_manscoring'); $manscoring_preservation->setChecked(true); $manscoring_preservation->setInfo($this->lng->txt('preserve_manscoring_info')); $form->addItem($manscoring_preservation); $form->addCommandButton("savescoringfortest", $this->lng->txt("save")); $participants = $this->object->getParticipants(); $active_ids = array_keys($participants); $results = array(); foreach ($active_ids as $active_id) { $passes[] = $this->object->_getPass($active_id); foreach ($passes as $key => $pass) { for ($i = 0; $i <= $pass; $i++) { $results[] = $question->object->getSolutionValues($active_id, $i); } } } $relevant_answers = array(); foreach ($results as $result) { foreach ($result as $answer) { if ($answer['question_fi'] == $question->object->getId()) { $relevant_answers[] = $answer; } } } $answers_view = $question->getAggregatedAnswersView($relevant_answers); include_once 'Services/jQuery/classes/class.iljQueryUtil.php'; iljQueryUtil::initjQuery(); include_once 'Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initPanel(); ilYuiUtil::initOverlay(); $this->tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js'); $this->tpl->addJavaScript("./Services/JavaScript/js/Basic.js"); $container = new ilTemplate('tpl.il_as_tst_adjust_answer_aggregation_container.html', true, true, 'Modules/Test'); $container->setVariable('FORM_ELEMENT_NAME', 'aggr_usr_answ'); $container->setVariable('CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $this->lng->txt('close')))); $container->setVariable('TXT_SHOW_ANSWER_OVERVIEW', $this->lng->txt('show_answer_overview')); $container->setVariable('TXT_CLOSE', $this->lng->txt('close')); $container->setVariable('ANSWER_OVERVIEW', $answers_view); $custom_input = new ilCustomInputGUI('', 'aggr_usr_answ'); $custom_input->setHtml($container->get()); $form->addItem($custom_input); return $form; }
public function viewThreadObject() { /** * @var $tpl ilTemplate * @var $lng ilLanguage * @var $ilUser ilObjUser * @var $ilAccess ilAccessHandler * @var $rbacreview ilRbacReview * @var $ilNavigationHistory ilNavigationHistory * @var $ilCtrl ilCtrl * @var $ilToolbar ilToolbarGUI */ global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator; $tpl->addCss('./Modules/Forum/css/forum_tree.css'); if (!isset($_SESSION['viewmode'])) { $_SESSION['viewmode'] = $this->objProperties->getDefaultView(); } // quick and dirty: check for treeview if (!isset($_SESSION['thread_control']['old'])) { $_SESSION['thread_control']['old'] = $_GET['thr_pk']; $_SESSION['thread_control']['new'] = $_GET['thr_pk']; } else { if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) { $_SESSION['thread_control']['new'] = $_GET['thr_pk']; } } if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) { $_SESSION['viewmode'] = $_GET['viewmode']; } if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) { $_SESSION['viewmode'] = ilForumProperties::VIEW_TREE; } else { $_SESSION['viewmode'] = ilForumProperties::VIEW_DATE; } if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } // init objects $oForumObjects = $this->getForumObjects(); /** * @var $forumObj ilObjForum */ $forumObj = $oForumObjects['forumObj']; /** * @var $frm ilForum */ $frm = $oForumObjects['frm']; /** * @var $file_obj ilFileDataForum */ $file_obj = $oForumObjects['file_obj']; // download file if ($_GET['file']) { if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) { ilUtil::sendFailure($this->lng->txt('error_reading_file')); } else { ilUtil::deliverFile($path['path'], $path['clean_filename']); } } if (!$this->objCurrentTopic->getId()) { $ilCtrl->redirect($this, 'showThreads'); } // Set context for login $append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : ''); $tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append); // delete temporary media object (not in case a user adds media objects and wants to save an invalid form) if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') { try { include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php'; $mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId()); foreach ($mobs as $mob) { if (ilObjMediaObject::_exists($mob)) { ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId()); $mob_obj = new ilObjMediaObject($mob); $mob_obj->delete(); } } } catch (Exception $e) { } } require_once './Modules/Forum/classes/class.ilObjForum.php'; require_once './Modules/Forum/classes/class.ilFileDataForum.php'; $lng->loadLanguageModule('forum'); // add entry to navigation history if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) { $ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm'); } // save last access $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId()); $this->prepareThreadScreen($forumObj); $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum'); if (isset($_GET['anchor'])) { $tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']); } if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) { $orderField = 'frm_posts_tree.fpt_date'; $this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC'); } else { $orderField = 'frm_posts_tree.rgt'; $this->objCurrentTopic->setOrderDirection('DESC'); } // get forum- and thread-data $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($frm->getForumId())); if (is_array($topicData = $frm->getOneTopic())) { // Visit-Counter for topic $this->objCurrentTopic->updateVisits(); $tpl->setTitle($lng->txt('forums_thread') . " \"" . $this->objCurrentTopic->getSubject() . "\""); // ******************************************************************************** // build location-links $ilLocator->addRepositoryItems(); $ilLocator->addItem($this->object->getTitle(), $ilCtrl->getLinkTarget($this, ""), "_top"); $tpl->setLocator(); // set tabs // menu template (contains linkbar) /** @var $menutpl ilTemplate */ $menutpl = new ilTemplate('tpl.forums_threads_menu.html', true, true, 'Modules/Forum'); include_once "./Services/Accessibility/classes/class.ilAccessKeyGUI.php"; // mark all as read if ($ilUser->getId() != ANONYMOUS_USER_ID && $forumObj->getCountUnread($ilUser->getId(), (int) $this->objCurrentTopic->getId())) { $this->ctrl->setParameter($this, 'mark_read', '1'); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $ilToolbar->addButton($this->lng->txt('forums_mark_read'), $this->ctrl->getLinkTarget($this, 'viewThread'), '', ilAccessKey::MARK_ALL_READ); $this->ctrl->clearParameters($this); } // print thread $this->ctrl->setParameterByClass('ilforumexportgui', 'print_thread', $this->objCurrentTopic->getId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_top_fk', $this->objCurrentTopic->getForumId()); $ilToolbar->addButton($this->lng->txt('forums_print_thread'), $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printThread')); $this->ctrl->clearParametersByClass('ilforumexportgui'); $this->addHeaderAction(); if ($_GET['mark_read']) { $forumObj->markThreadRead($ilUser->getId(), (int) $this->objCurrentTopic->getId()); ilUtil::sendInfo($lng->txt('forums_thread_marked'), true); } // delete post and its sub-posts require_once './Modules/Forum/classes/class.ilForum.php'; if ($_GET['action'] == 'ready_delete' && $_POST['confirm'] != '') { if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $this->objCurrentPost->isOwner($ilUser->getId()) && !$this->objCurrentPost->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) { $frm = new ilForum(); $frm->setForumId($forumObj->getId()); $frm->setForumRefId($forumObj->getRefId()); $dead_thr = $frm->deletePost($this->objCurrentPost->getId()); // if complete thread was deleted ... if ($dead_thr == $this->objCurrentTopic->getId()) { $frm->setMDB2WhereCondition('top_frm_fk = %s ', array('integer'), array($forumObj->getId())); $topicData = $frm->getOneTopic(); ilUtil::sendInfo($lng->txt('forums_post_deleted'), true); if ($topicData['top_num_threads'] > 0) { $this->ctrl->redirect($this, 'showThreads'); } else { $this->ctrl->redirect($this, 'createThread'); } } ilUtil::sendInfo($lng->txt('forums_post_deleted')); } } // form processing (censor) if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'ready_censor') { if (($_POST['confirm'] != '' || $_POST['no_cs_change'] != '') && $_GET['action'] == 'ready_censor') { $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId(), 1); } else { if (($_POST['cancel'] != '' || $_POST['yes_cs_change'] != '') && $_GET['action'] == 'ready_censor') { $frm->postCensorship($this->handleFormInput($_POST['formData']['cens_message']), $this->objCurrentPost->getId()); } } } // get complete tree of thread $first_node = $this->objCurrentTopic->getFirstPostNode(); $this->objCurrentTopic->setOrderField($orderField); $subtree_nodes = $this->objCurrentTopic->getPostTree($first_node); // no posts if (!($posNum = count($subtree_nodes))) { ilUtil::sendInfo($this->lng->txt('forums_no_posts_available')); } $pageHits = $frm->getPageHits(); $z = 0; // navigation to browse if ($posNum > $pageHits) { $params = array('ref_id' => $_GET['ref_id'], 'thr_pk' => $this->objCurrentTopic->getId(), 'orderby' => $_GET['orderby']); if (!$_GET['offset']) { $Start = 0; } else { $Start = $_GET['offset']; } $linkbar = ilUtil::Linkbar($ilCtrl->getLinkTarget($this, 'viewThread'), $posNum, $pageHits, $Start, $params); if ($linkbar != '') { $menutpl->setCurrentBlock('linkbar'); $menutpl->setVariable('LINKBAR', $linkbar); $menutpl->parseCurrentBlock(); } } $tpl->setVariable('THREAD_MENU', $menutpl->get()); // assistance val for anchor-links $jump = 0; // generate post-dates foreach ($subtree_nodes as $node) { /** * @var $node ilForumPost */ $this->ctrl->clearParameters($this); if ($this->objCurrentPost->getId() && $this->objCurrentPost->getId() == $node->getId()) { $jump++; } if ($posNum > $pageHits && $z >= $Start + $pageHits) { // if anchor-link was not found ... if ($this->objCurrentPost->getId() && $jump < 1) { $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId()); $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'offset', $Start + $pageHits); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->redirect($this, 'viewThread', $this->objCurrentPost->getId()); exit; } else { break; } } if ($posNum > $pageHits && $z >= $Start || $posNum <= $pageHits) { if ($this->objCurrentPost->getId() == $node->getId()) { # actions for "active" post if ($this->is_moderator || $node->isActivated()) { // reply/edit if (!$this->objCurrentTopic->isClosed() && ($_GET['action'] == 'showreply' || $_GET['action'] == 'showedit')) { if ($_GET['action'] == 'showedit' && (!$this->is_moderator && !$node->isOwner($ilUser->getId()) || $ilUser->getId() == ANONYMOUS_USER_ID || $node->isCensored())) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } else { if ($_GET['action'] == 'showreply' && !$ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id'])) { $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE); } } $tpl->setVariable('REPLY_ANKER', $this->objCurrentPost->getId()); $oEditReplyForm = $this->getReplyEditForm(); switch ($this->objProperties->getSubjectSetting()) { case 'add_re_to_subject': $subject = $this->getModifiedReOnSubject(true); break; case 'preset_subject': $subject = $this->objCurrentPost->getSubject(); break; case 'empty_subject': default: $subject = NULL; break; } switch ($_GET['action']) { case 'showreply': if ($this->ctrl->getCmd() == 'savePost') { $oEditReplyForm->setValuesByPost(); } else { if ($this->ctrl->getCmd() == 'quotePost') { require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName()); $oEditReplyForm->setValuesByPost(); $oEditReplyForm->getItemByPostVar('message')->setValue(ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($node->getMessage(), 1, $authorinfo->getAuthorName()) . "\n" . $oEditReplyForm->getInput('message'), 1)); } else { $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $subject, 'message' => '', 'notify' => 0, 'userfile' => '', 'del_file' => array())); } } $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId()); $jsTpl = new ilTemplate('tpl.forum_post_quoation_ajax_handler.html', true, true, 'Modules/Forum/'); $jsTpl->setVariable('IL_FRM_QUOTE_CALLBACK_SRC', $this->ctrl->getLinkTarget($this, 'getQuotationHTMLAsynch', '', true)); $this->ctrl->clearParameters($this); $this->tpl->setVariable('FORM_ADDITIONAL_JS', $jsTpl->get()); break; case 'showedit': if ($this->ctrl->getCmd() == 'savePost') { $oEditReplyForm->setValuesByPost(); } else { $oEditReplyForm->setValuesByArray(array('alias' => '', 'subject' => $this->objCurrentPost->getSubject(), 'message' => ilRTE::_replaceMediaObjectImageSrc($frm->prepareText($this->objCurrentPost->getMessage(), 2), 1), 'notify' => $this->objCurrentPost->isNotificationEnabled() ? true : false, 'userfile' => '', 'del_file' => array())); } break; } $this->ctrl->setParameter($this, 'pos_pk', $this->objCurrentPost->getId()); $this->ctrl->setParameter($this, 'thr_pk', $this->objCurrentPost->getThreadId()); $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'action', $_GET['action']); $tpl->setVariable('FORM', $oEditReplyForm->getHTML()); $this->ctrl->clearParameters($this); } else { if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'delete') { if ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies() && $ilUser->getId() != ANONYMOUS_USER_ID) { // confirmation: delete $tpl->setVariable('FORM', $this->getDeleteFormHTML()); } } else { if (!$this->objCurrentTopic->isClosed() && $_GET['action'] == 'censor') { if ($this->is_moderator) { // confirmation: censor / remove censorship $tpl->setVariable('FORM', $this->getCensorshipFormHTML()); } } else { if (!$this->objCurrentTopic->isClosed() && $this->displayConfirmPostActivation()) { if ($this->is_moderator) { // confirmation: activate $tpl->setVariable('FORM', $this->getActivationFormHTML()); } } } } } } } // if ($this->objCurrentPost->getId() == $node->getId()) if ($this->objCurrentPost->getId() != $node->getId() || $_GET['action'] != 'showreply' && $_GET['action'] != 'showedit' && $_GET['action'] != 'censor' && $_GET['action'] != 'delete' && !$this->displayConfirmPostActivation()) { if ($this->is_moderator || $node->isActivated()) { // button: reply if (!$this->objCurrentTopic->isClosed() && $ilAccess->checkAccess('add_reply', '', (int) $_GET['ref_id']) && !$node->isCensored()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'showreply'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('reply')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: edit article if (!$this->objCurrentTopic->isClosed() && ($node->isOwner($ilUser->getId()) || $this->is_moderator) && !$node->isCensored() && $ilUser->getId() != ANONYMOUS_USER_ID) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'showedit'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('edit')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: print if (!$node->isCensored()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameterByClass('ilforumexportgui', 'print_post', $node->getId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'top_pk', $node->getForumId()); $this->ctrl->setParameterByClass('ilforumexportgui', 'thr_pk', $node->getThreadId()); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTargetByClass('ilforumexportgui', 'printPost')); $tpl->setVariable('COMMANDS_TXT', $lng->txt('print')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } # buttons for every post except the "active" if (!$this->objCurrentTopic->isClosed() && ($this->is_moderator || $node->isOwner($ilUser->getId()) && !$node->hasReplies()) && $ilUser->getId() != ANONYMOUS_USER_ID) { // button: delete $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'delete'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('delete')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } if (!$this->objCurrentTopic->isClosed() && $this->is_moderator) { // button: censor $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'action', 'censor'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('censorship')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); // button: activation/deactivation $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); if (!$node->isActivated()) { $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'askForPostActivation', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('activate_post')); } $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: mark read if ($ilUser->getId() != ANONYMOUS_USER_ID && !$node->isPostRead()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('is_read')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } // button: mark unread if ($ilUser->getId() != ANONYMOUS_USER_ID && $node->isPostRead()) { $tpl->setCurrentBlock('commands'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $tpl->setVariable('COMMANDS_COMMAND', $this->ctrl->getLinkTarget($this, 'markPostUnread', $node->getId())); $tpl->setVariable('COMMANDS_TXT', $lng->txt('unread')); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } } } // if ($this->objCurrentPost->getId() != $node->getId()) // download post attachments $tmp_file_obj = new ilFileDataForum($forumObj->getId(), $node->getId()); if (count($tmp_file_obj->getFilesOfPost())) { if ($node->getId() != $this->objCurrentPost->getId() || $_GET['action'] != 'showedit') { foreach ($tmp_file_obj->getFilesOfPost() as $file) { $tpl->setCurrentBlock('attachment_download_row'); $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'file', $file['md5']); $tpl->setVariable('HREF_DOWNLOAD', $this->ctrl->getLinkTarget($this, 'viewThread')); $tpl->setVariable('TXT_FILENAME', $file['name']); $this->ctrl->clearParameters($this); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('attachments'); $tpl->setVariable('TXT_ATTACHMENTS_DOWNLOAD', $lng->txt('forums_attachments')); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable('DOWNLOAD_IMG', ilGlyphGUI::get(ilGlyphGUI::ATTACHMENT, $lng->txt('forums_download_attachment'))); $tpl->parseCurrentBlock(); } } $tpl->setCurrentBlock('posts_row'); // anker for every post $tpl->setVariable('POST_ANKER', $node->getId()); //permanent link for every post // $tpl->setVariable('PERMA_LINK', ILIAS_HTTP_PATH."/goto.php?target="."frm"."_".$this->object->getRefId()."_".$node->getThreadId()."_".$node->getId()."&client_id=".CLIENT_ID); $tpl->setVariable('TXT_PERMA_LINK', $lng->txt('perma_link')); $tpl->setVariable('PERMA_TARGET', '_top'); if ($this->objProperties->getMarkModeratorPosts() == 1) { if ($node->getIsAuthorModerator() === null && ($is_moderator = ilForum::_isModerator($_GET['ref_id'], $node->getPosAuthorId()))) { $rowCol = 'ilModeratorPosting'; } elseif ($node->getIsAuthorModerator()) { $rowCol = 'ilModeratorPosting'; } else { $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2'); } } else { $rowCol = ilUtil::switchColor($z, 'tblrow1', 'tblrow2'); } if ($_GET['action'] != 'delete' && $_GET['action'] != 'censor' && !$this->displayConfirmPostActivation() || $this->objCurrentPost->getId() != $node->getId()) { $tpl->setVariable('ROWCOL', ' ' . $rowCol); } else { // highlight censored posts $rowCol = 'tblrowmarked'; } // post is censored if ($node->isCensored()) { // display censorship advice if ($_GET['action'] != 'censor') { $tpl->setVariable('TXT_CENSORSHIP_ADVICE', $this->lng->txt('post_censored_comment_by_moderator')); } // highlight censored posts $rowCol = 'tblrowmarked'; } // set row color $tpl->setVariable('ROWCOL', ' ' . $rowCol); // if post is not activated display message for the owner if (!$node->isActivated() && $node->isOwner($ilUser->getId())) { $tpl->setVariable('POST_NOT_ACTIVATED_YET', $this->lng->txt('frm_post_not_activated_yet')); } // Author $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $backurl = urlencode($this->ctrl->getLinkTarget($this, 'viewThread', $node->getId())); $this->ctrl->clearParameters($this); $this->ctrl->setParameter($this, 'backurl', $backurl); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'user', $node->getDisplayUserId()); require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getDisplayUserId(), $node->getUserAlias(), $node->getImportName(), array('href' => $this->ctrl->getLinkTarget($this, 'showUser'))); $this->ctrl->clearParameters($this); if ($authorinfo->hasSuffix()) { $tpl->setVariable('AUTHOR', $authorinfo->getSuffix()); $tpl->setVariable('USR_NAME', $node->getUserAlias()); } else { $tpl->setVariable('AUTHOR', $authorinfo->getLinkedAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('USR_NAME', $authorinfo->getAuthorName(true)); } } $tpl->setVariable('USR_IMAGE', $authorinfo->getProfilePicture()); if ($authorinfo->getAuthor()->getId() && ilForum::_isModerator((int) $_GET['ref_id'], $node->getPosAuthorId())) { if ($authorinfo->getAuthor()->getGender() == 'f') { $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_f')); } else { if ($authorinfo->getAuthor()->getGender() == 'm') { $tpl->setVariable('ROLE', $this->lng->txt('frm_moderator_m')); } } } // get create- and update-dates if ($node->getUpdateUserId() > 0) { $spanClass = ''; // last update from moderator? $posMod = $frm->getModeratorFromPost($node->getId()); if (is_array($posMod) && $posMod['top_mods'] > 0) { $MODS = $rbacreview->assignedUsers($posMod['top_mods']); if (is_array($MODS)) { if (in_array($node->getUpdateUserId(), $MODS)) { $spanClass = 'moderator_small'; } } } $node->setChangeDate($node->getChangeDate()); if ($spanClass == '') { $spanClass = 'small'; } $this->ctrl->setParameter($this, 'backurl', $backurl); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'user', $node->getUpdateUserId()); require_once 'Modules/Forum/classes/class.ilForumAuthorInformation.php'; $authorinfo = new ilForumAuthorInformation($node->getPosAuthorId(), $node->getUpdateUserId(), '', '', array('href' => $this->ctrl->getLinkTarget($this, 'showUser'))); $this->ctrl->clearParameters($this); $tpl->setVariable('POST_UPDATE_TXT', $lng->txt('edited_on') . ': ' . $frm->convertDate($node->getChangeDate()) . ' - ' . strtolower($lng->txt('by'))); $tpl->setVariable('UPDATE_AUTHOR', $authorinfo->getLinkedAuthorShortName()); if ($authorinfo->getAuthorName(true)) { $tpl->setVariable('UPDATE_USR_NAME', $authorinfo->getAuthorName(true)); } } // if ($node->getUpdateUserId() > 0)*/ // Author end // prepare post $node->setMessage($frm->prepareText($node->getMessage())); if ($ilUser->getId() == ANONYMOUS_USER_ID || $node->isPostRead()) { $tpl->setVariable('SUBJECT', $node->getSubject()); } else { $this->ctrl->setParameter($this, 'pos_pk', $node->getId()); $this->ctrl->setParameter($this, 'thr_pk', $node->getThreadId()); $this->ctrl->setParameter($this, 'offset', $Start); $this->ctrl->setParameter($this, 'orderby', $_GET['orderby']); $this->ctrl->setParameter($this, 'viewmode', $_SESSION['viewmode']); $mark_post_target = $this->ctrl->getLinkTarget($this, 'markPostRead', $node->getId()); $tpl->setVariable('SUBJECT', "<a href=\"" . $mark_post_target . "\"><b>" . $node->getSubject() . "</b></a>"); } $tpl->setVariable('POST_DATE', $frm->convertDate($node->getCreateDate())); if (!$node->isCensored() || $this->objCurrentPost->getId() == $node->getId() && $_GET['action'] == 'censor') { // post from moderator? $modAuthor = $frm->getModeratorFromPost($node->getId()); $spanClass = ""; if (is_array($modAuthor) && $modAuthor['top_mods'] > 0) { unset($MODS); $MODS = $rbacreview->assignedUsers($modAuthor['top_mods']); if (is_array($MODS)) { if (in_array($node->getDisplayUserId(), $MODS)) { $spanClass = 'moderator'; } } } // possible bugfix for mantis #8223 if ($node->getMessage() == strip_tags($node->getMessage())) { // We can be sure, that there are not html tags $node->setMessage(nl2br($node->getMessage())); } if ($spanClass != "") { $tpl->setVariable('POST', "<span class=\"" . $spanClass . "\">" . ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1) . "</span>"); } else { $tpl->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($node->getMessage(), 1)); } } else { $tpl->setVariable('POST', "<span class=\"moderator\">" . nl2br($node->getCensorshipComment()) . "</span>"); } $tpl->parseCurrentBlock(); } $z++; } } else { $tpl->setCurrentBlock('posts_no'); $tpl->setVariable('TXT_MSG_NO_POSTS_AVAILABLE', $lng->txt('forums_posts_not_available')); $tpl->parseCurrentBlock(); } $oThreadToolbar = clone $ilToolbar; $oThreadToolbar->addSeparator(); $oThreadToolbar->addButton($this->lng->txt('top_of_page'), '#frm_page_top'); $tpl->setVariable('THREAD_TOOLBAR', $oThreadToolbar->getHTML()); $tpl->setVariable('TPLPATH', $tpl->vars['TPLPATH']); // permanent link include_once 'Services/PermanentLink/classes/class.ilPermanentLinkGUI.php'; $permalink = new ilPermanentLinkGUI('frm', $this->object->getRefId(), '_' . $this->objCurrentTopic->getId()); $this->tpl->setVariable('PRMLINK', $permalink->getHTML()); // Render tree if ($_SESSION['viewmode'] == 'answers' || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) { $tpl->setLeftNavContent($this->getForumExplorer()); } return true; }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_essaykeywordswizardinput.html", true, true, "Modules/TestQuestionPool"); $i = 0; foreach ($this->values as $value) { if ($this->getSingleline()) { if (is_object($value)) { $tpl->setCurrentBlock("prop_text_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext())); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_points_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPointsChecked())); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('singleline'); $tpl->setVariable("SIZE", $this->getSize()); $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i); $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar()); $tpl->setVariable("MAXLENGTH", $this->getMaxLength()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\""); } $tpl->parseCurrentBlock(); } else { if (!$this->getSingleline()) { if (is_object($value)) { $tpl->setCurrentBlock("prop_points_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints())); $tpl->parseCurrentBlock(); } } } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("ROW_NUMBER", $i); $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\""); } $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); $i++; } $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("TEXT_YES", $lng->txt('yes')); $tpl->setVariable("TEXT_NO", $lng->txt('no')); $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header')); $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question')); $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text')); $tpl->setVariable("POINTS_TEXT", $lng->txt('points')); $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions')); $tpl->setVariable("POINTS_CHECKED_TEXT", $lng->txt('checkbox_checked')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/essaykeywordwizard.js"); }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { $tpl = new ilTemplate("tpl.prop_textwizardinput.html", true, true, "Services/Form"); $i = 0; foreach ($this->values as $value) { if (strlen($value)) { $tpl->setCurrentBlock("prop_text_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value)); $tpl->parseCurrentBlock(); } if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getFieldId() . "[{$i}]"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("ID", $this->getFieldId() . "[{$i}]"); $tpl->setVariable("SIZE", $this->getSize()); $tpl->setVariable("MAXLENGTH", $this->getMaxLength()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED", " disabled=\"disabled\""); } else { $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); } $tpl->parseCurrentBlock(); $i++; } $tpl->setVariable("ELEMENT_ID", $this->getFieldId()); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); if (!$this->getDisabled()) { global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Services/Form/templates/default/textwizard.js"); } }
/** * Insert property html * */ public function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime_duration.html", true, true, "Services/Form"); // Init start if (is_a($this->getStart(), 'ilDate')) { $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getStart(), 'ilDateTime')) { $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setStart(new ilDateTime(time(), IL_CAL_UNIX)); $start_info = $this->getStart()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input['start'])) { $start_info['year'] = $this->invalid_input['start']['y']; $start_info['mon'] = $this->invalid_input['start']['m']; $start_info['mday'] = $this->invalid_input['start']['d']; } // Init end if (is_a($this->getEnd(), 'ilDate')) { $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getEnd(), 'ilDateTime')) { $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setEnd(new ilDateTime(time(), IL_CAL_UNIX)); $end_info = $this->getEnd()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input['end'])) { $end_info['year'] = $this->invalid_input['end']['y']; $end_info['mon'] = $this->invalid_input['end']['m']; $end_info['mday'] = $this->invalid_input['end']['d']; } $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } if (strlen($this->getStartText())) { $tpl->setVariable('TXT_START', $this->getStartText()); } if (strlen($this->getEndText())) { $tpl->setVariable('TXT_END', $this->getEndText()); } // Toggle fullday if ($this->enabledToggleFullTime()) { $tpl->setCurrentBlock('toggle_fullday'); $tpl->setVariable('FULLDAY_POSTVAR', $this->getPostVar()); $tpl->setVariable('FULLDAY_TOGGLE_NAME', $this->getPostVar() . '[fulltime]'); $tpl->setVariable('FULLDAY_TOGGLE_CHECKED', $this->toggle_fulltime_checked ? 'checked="checked"' : ''); $tpl->setVariable('FULLDAY_TOGGLE_DISABLED', $this->getDisabled() ? 'disabled="disabled"' : ''); $tpl->setVariable('TXT_TOGGLE_FULLDAY', $this->toggle_fulltime_txt); $tpl->parseCurrentBlock(); } $tpl->setVariable('POST_VAR', $this->getPostVar()); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_START_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("START_ID", $this->getPostVar()); $tpl->setVariable("DATE_ID_START", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_START", $this->getPostVar() . "[start][date]"); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->setVariable("START_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[start][date]", $start_info['year'], $start_info['mon'], $start_info['mday'], $this->getStartYear(), true, array('disabled' => $this->getDisabled(), 'select_attributes' => array('onchange' => 'ilUpdateEndDate();')), $this->getShowEmpty())); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_END_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("END_ID", $this->getPostVar()); $tpl->setVariable("DATE_ID_END", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_END", $this->getPostVar() . "[end][date]"); $tpl->setVariable("END_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[end][date]", $end_info['year'], $end_info['mon'], $end_info['mday'], $this->getStartYear(), true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); if ($this->getShowTime()) { $tpl->setCurrentBlock("show_start_time"); $tpl->setVariable("START_TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[start][time]", !$this->getShowSeconds(), $start_info['hours'], $start_info['minutes'], $start_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled(), 'select_attributes' => array('onchange' => 'ilUpdateEndDate();')))); $tpl->setVariable("TXT_START_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("show_end_time"); $tpl->setVariable("END_TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[end][time]", !$this->getShowSeconds(), $end_info['hours'], $end_info['minutes'], $end_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled()))); $tpl->setVariable("TXT_END_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); } if ($this->getShowTime()) { $tpl->setVariable("DELIM", "<br />"); } return $tpl->get(); }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate($this->getTemplate(), true, true, "Modules/TestQuestionPool"); $i = 0; foreach ($this->values as $value) { if ($this->getSingleline()) { if (is_object($value)) { $tpl->setCurrentBlock("prop_text_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getAnswertext())); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_points_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints())); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('singleline'); $tpl->setVariable("SIZE", $this->getSize()); $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i); $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar()); $tpl->setVariable("MAXLENGTH", $this->getMaxLength()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\""); } $tpl->parseCurrentBlock(); } else { if (!$this->getSingleline()) { if (is_object($value)) { $tpl->setCurrentBlock("prop_points_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->getPoints())); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('multiline'); $tpl->setVariable("PROPERTY_VALUE", $this->qstObject->prepareTextareaOutput($value->getAnswertext())); $tpl->setVariable("MULTILINE_ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("MULTILINE_ROW_NUMBER", $i); $tpl->setVariable("MULTILINE_POST_VAR", $this->getPostVar()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_MULTILINE", " disabled=\"disabled\""); } $tpl->parseCurrentBlock(); } } if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("ROW_NUMBER", $i); $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("POINTS_ID", $this->getPostVar() . "[points][{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_POINTS", " disabled=\"disabled\""); } $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); $i++; } $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("ANSWER_TEXT", $this->getTextInputLabel($lng)); $tpl->setVariable("POINTS_TEXT", $this->getPointsInputLabel($lng)); $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/answerwizard.js"); }
/** * get notes/comments list as html code */ function getNoteListHTML($a_type = IL_NOTE_PRIVATE, $a_init_form = true) { global $lng, $ilCtrl, $ilUser; include_once "./Services/User/classes/class.ilUserUtil.php"; $suffix = $a_type == IL_NOTE_PRIVATE ? "private" : "public"; /* user settings are deprecated $user_setting_notes_public_all = $ilUser->getPref("notes_pub_all"); $user_setting_notes_by_type = $ilUser->getPref("notes_".$suffix); */ $user_setting_notes_public_all = "y"; $user_setting_notes_by_type = "y"; if ($this->delete_note || $this->export_html || $this->print) { if ($_GET["note_id"] != "") { $filter = $_GET["note_id"]; } else { $filter = $_POST["note"]; } } $notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_type, $this->inc_sub, $filter, $user_setting_notes_public_all, $this->repository_mode, (bool) $_SESSION["comments_sort_asc"]); $all_notes = ilNote::_getNotesOfObject($this->rep_obj_id, $this->obj_id, $this->obj_type, $a_type, $this->inc_sub, $filter, "", $this->repository_mode); $tpl = new ilTemplate("tpl.notes_list.html", true, true, "Services/Notes"); if ($this->ajax) { include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setCurrentBlock("close_img"); $tpl->setVariable("CLOSE_IMG", ilGlyphGUI::get(ilGlyphGUI::CLOSE)); $tpl->parseCurrentBlock(); } // show counter if notes are hidden $cnt_str = count($all_notes) > 0 ? " (" . count($all_notes) . ")" : ""; // title if ($this->ajax) { switch ($this->obj_type) { case "catr": case "crsr": include_once "Services/ContainerReference/classes/class.ilContainerReference.php"; $title = ilContainerReference::_lookupTitle($this->rep_obj_id); break; default: $title = ilObject::_lookupTitle($this->rep_obj_id); break; } $img = ilUtil::img(ilObject::_getIcon($this->rep_obj_id, "tiny")); // add sub-object if given if ($this->obj_id) { $sub_title = $this->getSubObjectTitle($this->rep_obj_id, $this->obj_id); if ($sub_title) { $title .= " - " . $sub_title; } } $tpl->setCurrentBlock("title"); $tpl->setVariable("TITLE", $img . " " . $title); $tpl->parseCurrentBlock(); } if ($this->delete_note) { $cnt_str = ""; } if ($a_type == IL_NOTE_PRIVATE) { $tpl->setVariable("TXT_NOTES", $lng->txt("private_notes") . $cnt_str); $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PRIVATE); } else { $tpl->setVariable("TXT_NOTES", $lng->txt("notes_public_comments") . $cnt_str); $ilCtrl->setParameterByClass("ilnotegui", "note_type", IL_NOTE_PUBLIC); } $anch = $this->anchor_jump ? "notes_top" : ""; $tpl->setVariable("FORMACTION", $ilCtrl->getFormAction($this, "getNotesHTML", $anch)); if ($this->ajax) { $os = "onsubmit = \"ilNotes.cmdAjaxForm(event, '" . $ilCtrl->getFormActionByClass("ilnotegui", "", "", true) . "'); return false;\""; $tpl->setVariable("ON_SUBMIT_FORM", $os); $tpl->setVariable("FORM_ID", "Ajax"); } if ($this->export_html || $this->print) { $tpl->touchBlock("print_style"); } // show add new note button if (!$this->add_note_form && !$this->edit_note_form && !$this->delete_note && !$this->export_html && !$this->print && $ilUser->getId() != ANONYMOUS_USER_ID) { if (!$this->inc_sub) { // are displayed if ($this->rep_obj_id > 0 || $a_type != IL_NOTE_PUBLIC) { $tpl->setCurrentBlock("add_note_btn"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("notes_add_comment")); } else { $tpl->setVariable("TXT_ADD_NOTE", $lng->txt("add_note")); } $tpl->setVariable("LINK_ADD_NOTE", $ilCtrl->getLinkTargetByClass("ilnotegui", "addNoteForm") . "#note_edit"); $tpl->parseCurrentBlock(); } } } // show show/hide button for note list if (count($all_notes) > 0 && $this->enable_hiding && !$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { if ($user_setting_notes_by_type == "n") { if ($a_type == IL_NOTE_PUBLIC) { $txt = $lng->txt("notes_show_comments"); } else { $txt = $lng->txt("show_" . $suffix . "_notes"); } $this->renderLink($tpl, "show_notes", $txt, "showNotes", "notes_top"); } else { // never individually hide for anonymous users if ($ilUser->getId() != ANONYMOUS_USER_ID) { if ($a_type == IL_NOTE_PUBLIC) { $txt = $lng->txt("notes_hide_comments"); } else { $txt = $lng->txt("hide_" . $suffix . "_notes"); } $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top"); // show all public notes / my notes only switch if ($a_type == IL_NOTE_PUBLIC) { if ($user_setting_notes_public_all == "n") { $this->renderLink($tpl, "all_pub_notes", $lng->txt("notes_all_comments"), "showAllPublicNotes", "notes_top"); } else { $this->renderLink($tpl, "my_pub_notes", $lng->txt("notes_my_comments"), "showMyPublicNotes", "notes_top"); } } } } } // show add new note text area if (!$this->edit_note_form && $user_setting_notes_by_type != "n" && !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID) { if ($a_init_form) { $this->initNoteForm("create", $a_type); } $tpl->setCurrentBlock("edit_note_form"); // $tpl->setVariable("EDIT_FORM", $this->form->getHTML()); $tpl->setVariable("EDIT_FORM", $this->form_tpl->get()); $tpl->parseCurrentBlock(); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("note_row"); $tpl->parseCurrentBlock(); } // list all notes if ($user_setting_notes_by_type != "n" || !$this->enable_hiding) { $reldates = ilDatePresentation::useRelativeDates(); ilDatePresentation::setUseRelativeDates(false); if (sizeof($notes)) { if ((int) $_SESSION["comments_sort_asc"] == 1) { $sort_txt = $lng->txt("notes_sort_desc"); $sort_cmd = "listSortDesc"; } else { $sort_txt = $lng->txt("notes_sort_asc"); $sort_cmd = "listSortAsc"; } $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch); } $notes_given = false; foreach ($notes as $note) { if ($this->edit_note_form && $note->getId() == $_GET["note_id"] && $a_type == $_GET["note_type"]) { if ($a_init_form) { $this->initNoteForm("edit", $a_type, $note); } $tpl->setCurrentBlock("edit_note_form"); // $tpl->setVariable("EDIT_FORM", $this->form->getHTML()); $tpl->setVariable("EDIT_FORM", $this->form_tpl->get()); $tpl->parseCurrentBlock(); } else { $cnt_col = 2; // delete note stuff for all private notes if ($this->checkDeletion($note) && !$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId()); $this->renderLink($tpl, "delete_note", $lng->txt("delete"), "deleteNote", "note_" . $note->getId()); } // checkboxes in multiselection mode if ($this->multi_selection && !$this->delete_note) { $tpl->setCurrentBlock("checkbox_col"); $tpl->setVariable("CHK_NOTE", "note[]"); $tpl->setVariable("CHK_NOTE_ID", $note->getId()); $tpl->parseCurrentBlock(); $cnt_col = 1; } // edit note stuff for all private notes if ($this->checkEdit($note)) { if (!$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) { $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId()); $this->renderLink($tpl, "edit_note", $lng->txt("edit"), "editNoteForm", "note_edit"); } } $tpl->setVariable("CNT_COL", $cnt_col); // output author account if ($a_type == IL_NOTE_PUBLIC && ilObject::_exists($note->getAuthor())) { //$tpl->setCurrentBlock("author"); //$tpl->setVariable("VAL_AUTHOR", ilObjUser::_lookupLogin($note->getAuthor())); //$tpl->parseCurrentBlock(); $tpl->setCurrentBlock("user_img"); $tpl->setVariable("USR_IMG", ilObjUser::_getPersonalPicturePath($note->getAuthor(), "xxsmall")); $tpl->setVariable("USR_ALT", $lng->txt("user_image") . ": " . ilObjUser::_lookupLogin($note->getAuthor())); $tpl->parseCurrentBlock(); $tpl->setVariable("TXT_USR", ilUserUtil::getNamePresentation($note->getAuthor(), false, false) . " - "); } // last edited if ($note->getUpdateDate() != null) { $tpl->setVariable("TXT_LAST_EDIT", $lng->txt("last_edited_on")); $tpl->setVariable("DATE_LAST_EDIT", ilDatePresentation::formatDate(new ilDate($note->getUpdateDate(), IL_CAL_DATETIME))); } else { $tpl->setVariable("VAL_DATE", ilDatePresentation::formatDate(new ilDate($note->getCreationDate(), IL_CAL_DATETIME))); } // hidden note ids for deletion if ($this->delete_note) { $tpl->setCurrentBlock("delete_ids"); $tpl->setVariable("HID_NOTE", "note[]"); $tpl->setVariable("HID_NOTE_ID", $note->getId()); $tpl->parseCurrentBlock(); } $target = $note->getObject(); // target objects $this->showTargets($tpl, $this->rep_obj_id, $note->getId(), $target["obj_type"], $target["obj_id"]); $rowclass = $rowclass != "tblrow1" ? "tblrow1" : "tblrow2"; if (!$this->export_html && !$this->print) { $tpl->setCurrentBlock("note_img"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("IMG_NOTE", $this->comment_img[$note->getLabel()]["img"]); $tpl->setVariable("ALT_NOTE", $this->comment_img[$note->getLabel()]["alt"]); } else { $tpl->setVariable("IMG_NOTE", $this->note_img[$note->getLabel()]["img"]); $tpl->setVariable("ALT_NOTE", $this->note_img[$note->getLabel()]["alt"]); } $tpl->parseCurrentBlock(); } else { switch ($note->getLabel()) { case IL_NOTE_UNLABELED: $tpl->setVariable("EXP_ICON", "[ ]"); break; case IL_NOTE_IMPORTANT: $tpl->setVariable("EXP_ICON", "[!]"); break; case IL_NOTE_QUESTION: $tpl->setVariable("EXP_ICON", "[?]"); break; case IL_NOTE_PRO: $tpl->setVariable("EXP_ICON", "[+]"); break; case IL_NOTE_CONTRA: $tpl->setVariable("EXP_ICON", "[-]"); break; } } $tpl->setCurrentBlock("note"); $tpl->setVariable("ROWCLASS", $rowclass); $text = trim($note->getText()) != "" ? nl2br($note->getText()) : "<p class='subtitle'>" . $lng->txt("note_content_removed") . "</p>"; $tpl->setVariable("NOTE_TEXT", $text); $tpl->setVariable("VAL_SUBJECT", $note->getSubject()); $tpl->setVariable("NOTE_ID", $note->getId()); $tpl->setVariable("CLASS", $a_type == IL_NOTE_PUBLIC ? "ilComment" : "ilNote"); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("note_row"); $tpl->parseCurrentBlock(); $notes_given = true; } if (!$notes_given) { $tpl->setCurrentBlock("no_notes"); if ($a_type == IL_NOTE_PUBLIC) { $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_comments")); } /* else { $tpl->setVariable("NO_NOTES", $lng->txt("notes_no_notes")); }*/ $tpl->parseCurrentBlock(); } ilDatePresentation::setUseRelativeDates($reldates); // multiple items commands if ($this->multi_selection && !$this->delete_note && !$this->edit_note_form && count($notes) > 0) { if ($a_type == IL_NOTE_PRIVATE) { $tpl->setCurrentBlock("delete_cmd"); $tpl->setVariable("TXT_DELETE_NOTES", $this->lng->txt("delete")); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("multiple_commands"); $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all")); $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $tpl->setVariable("ALT_ARROW", $this->lng->txt("actions")); $tpl->setVariable("TXT_PRINT_NOTES", $this->lng->txt("print")); $tpl->setVariable("TXT_EXPORT_NOTES", $this->lng->txt("exp_html")); $tpl->parseCurrentBlock(); } // delete / cancel row if ($this->delete_note) { $tpl->setCurrentBlock("delete_cancel"); $tpl->setVariable("TXT_DEL_NOTES", $this->lng->txt("delete")); $tpl->setVariable("TXT_CANCEL_DEL_NOTES", $this->lng->txt("cancel")); $tpl->parseCurrentBlock(); } // print if ($this->print) { $tpl->touchBlock("print_js"); $tpl->setCurrentBlock("print_back"); $tpl->setVariable("LINK_BACK", $this->ctrl->getLinkTarget($this, "showNotes")); $tpl->setVariable("TXT_BACK", $this->lng->txt("back")); $tpl->parseCurrentBlock(); } } // message switch ($_GET["note_mess"] != "" ? $_GET["note_mess"] : $this->note_mess) { case "mod": $mtype = "success"; $mtxt = $lng->txt("msg_obj_modified"); break; case "ntsdel": $mtype = "success"; $mtxt = $a_type == IL_NOTE_PRIVATE ? $lng->txt("notes_notes_deleted") : $lng->txt("notes_comments_deleted"); break; case "ntdel": $mtype = "success"; $mtxt = $a_type == IL_NOTE_PRIVATE ? $lng->txt("notes_note_deleted") : $lng->txt("notes_comment_deleted"); break; case "frmfld": $mtype = "failure"; $mtxt = $lng->txt("form_input_not_valid"); break; case "qdel": $mtype = "question"; $mtxt = $lng->txt("info_delete_sure"); break; case "noc": $mtype = "failure"; $mtxt = $lng->txt("no_checkbox"); break; } if ($mtxt != "") { $tpl->setVariable("MESS", $tpl->getMessageHTML($mtxt, $mtype)); } else { $tpl->setVariable("MESS", ""); } if ($this->delete_note && count($notes) == 0) { return ""; } else { return $tpl->get(); } }
/** * Insert property html * */ function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form"); if (is_object($this->getDate())) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } else { $date_info = array('year' => $_POST[$this->getPostVar()]['date']['y'], 'mon' => $_POST[$this->getPostVar()]['date']['m'], 'mday' => $_POST[$this->getPostVar()]['date']['d']); } $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("prop_date"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_DATE_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar() . "[date]"); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->setVariable("DATE_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[date]", $date_info['year'], $date_info['mon'], $date_info['mday'], $this->startyear, true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); $tpl->parseCurrentBlock(); return $tpl->get(); }
/** * fill data section * * @access public * */ public function show() { global $tpl, $ilUser; $this->tpl = new ilTemplate('tpl.month_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::MONTH); $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); for ($i = (int) $this->user_settings->getWeekStart(); $i < 7 + (int) $this->user_settings->getWeekStart(); $i++) { $this->tpl->setCurrentBlock('month_header_col'); $this->tpl->setVariable('TXT_WEEKDAY', ilCalendarUtil::_numericDayToString($i, true)); $this->tpl->parseCurrentBlock(); } if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $disable_empty = true; $no_add = true; } else { if ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = true; } else { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = false; } } $is_portfolio_embedded = false; if (ilCalendarCategories::_getInstance()->getMode() == ilCalendarCategories::MODE_PORTFOLIO_CONSULTATION) { $no_add = true; $is_portfolio_embedded = true; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_MONTH, $user_id); $this->scheduler->addSubitemCalendars(true); if (sizeof($this->schedule_filters)) { foreach ($this->schedule_filters as $filter) { $this->scheduler->addFilter($filter); } } $this->scheduler->calculate(); include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); $counter = 0; foreach (ilCalendarUtil::_buildMonthDayList($this->seed->get(IL_CAL_FKT_DATE, 'm'), $this->seed->get(IL_CAL_FKT_DATE, 'Y'), $this->user_settings->getWeekStart())->get() as $date) { $counter++; $has_events = (bool) $this->showEvents($date); if (!$no_add) { include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app"); $this->tpl->setVariable('ADD_LINK', $new_app_url); $this->tpl->setVariable('NEW_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->parseCurrentBlock(); } } $day = $date->get(IL_CAL_FKT_DATE, 'j'); $month = $date->get(IL_CAL_FKT_DATE, 'n'); if ($day == 1) { $month_day = '1 ' . ilCalendarUtil::_numericMonthToString($month, false); } else { $month_day = $day; } if (!$is_portfolio_embedded && (!$disable_empty || $has_events)) { $this->tpl->setCurrentBlock('month_day_link'); $this->ctrl->clearParametersByClass('ilcalendardaygui'); $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE)); $this->tpl->setVariable('OPEN_DAY_VIEW', $this->ctrl->getLinkTargetByClass('ilcalendardaygui', '')); $this->ctrl->clearParametersByClass('ilcalendardaygui'); } else { $this->tpl->setCurrentBlock('month_day_no_link'); } $this->tpl->setVariable('MONTH_DAY', $month_day); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock('month_col'); include_once './Services/Calendar/classes/class.ilCalendarUtil.php'; if (ilCalendarUtil::_isToday($date)) { $this->tpl->setVariable('TD_CLASS', 'caltoday'); } elseif (ilDateTime::_equals($date, $this->seed, IL_CAL_MONTH)) { $this->tpl->setVariable('TD_CLASS', 'calstd'); } elseif (ilDateTime::_before($date, $this->seed, IL_CAL_MONTH)) { $this->tpl->setVariable('TD_CLASS', 'calprev'); } else { $this->tpl->setVariable('TD_CLASS', 'calnext'); } $this->tpl->parseCurrentBlock(); if ($counter and !($counter % 7)) { $this->tpl->setCurrentBlock('month_row'); $this->tpl->parseCurrentBlock(); } } }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_matchingpairinput.html", true, true, "Modules/TestQuestionPool"); $i = 0; foreach ($this->pairs as $pair) { $counter = 1; $tpl->setCurrentBlock("option_term"); $tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select'))); $tpl->setVariable("VALUE_OPTION", 0); $tpl->parseCurrentBlock(); foreach ($this->terms as $term) { $tpl->setCurrentBlock("option_term"); $tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($term->identifier)); $tpl->setVariable("TEXT_OPTION", $lng->txt('term') . " " . $counter); if ($pair->term->identifier == $term->identifier) { $tpl->setVariable('SELECTED_OPTION', ' selected="selected"'); } $tpl->parseCurrentBlock(); $counter++; } $counter = 1; $tpl->setCurrentBlock("option_definition"); $tpl->setVariable("TEXT_OPTION", ilUtil::prepareFormOutput($lng->txt('please_select'))); $tpl->setVariable("VALUE_OPTION", 0); $tpl->parseCurrentBlock(); foreach ($this->definitions as $definition) { $tpl->setCurrentBlock("option_definition"); $tpl->setVariable("VALUE_OPTION", ilUtil::prepareFormOutput($definition->identifier)); $tpl->setVariable("TEXT_OPTION", $lng->txt('definition') . " " . $counter); if ($pair->definition->identifier == $definition->identifier) { $tpl->setVariable('SELECTED_OPTION', ' selected="selected"'); } $tpl->parseCurrentBlock(); $counter++; } if (strlen($pair->points)) { $tpl->setCurrentBlock('points_value'); $tpl->setVariable('POINTS_VALUE', $pair->points); $tpl->parseCurrentBlock(); } if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("ROW_NUMBER", $i); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->parseCurrentBlock(); $i++; } $tpl->setCurrentBlock('term_ids'); $ids = array(); foreach ($this->terms as $term) { array_push($ids, $term->identifier); } $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("TERM_IDS", join($ids, ",")); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock('definition_ids'); $ids = array(); foreach ($this->definitions as $definition) { array_push($ids, $definition->identifier); } $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("DEFINITION_IDS", join($ids, ",")); $tpl->parseCurrentBlock(); $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("TEXT_POINTS", $lng->txt('points')); $tpl->setVariable("TEXT_DEFINITION", $lng->txt('definition')); $tpl->setVariable("TEXT_TERM", $lng->txt('term')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/matchingpairwizard.js"); }
/** * generates frame layout */ function layout($a_xml = "main.xml", $doShow = true) { global $tpl, $ilSetting, $ilCtrl, $ilUser; $layout = $this->determineLayout(); // xmldocfile is deprecated! Use domxml_open_file instead. // But since using relative pathes with domxml under windows don't work, // we need another solution: $xmlfile = file_get_contents("./Modules/LearningModule/layouts/lm/" . $layout . "/" . $a_xml); if (!($doc = domxml_open_mem($xmlfile))) { include_once "./Modules/LearningModule/exceptions/class.ilLMPresentationException.php"; throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Error reading " . $layout . "/" . $a_xml . "."); } $this->layout_doc = $doc; //echo ":".htmlentities($xmlfile).":$layout:$a_xml:"; // get current frame node $xpc = xpath_new_context($doc); $path = empty($_GET["frame"]) || $_GET["frame"] == "_blank" ? "/ilLayout/ilFrame[1]" : "//ilFrame[@name='" . $_GET["frame"] . "']"; $result = xpath_eval($xpc, $path); $found = $result->nodeset; if (count($found) != 1) { include_once "./Modules/LearningModule/exceptions/class.ilLMPresentationException.php"; throw new ilLMPresentationException("ilLMPresentation: XML File invalid. Found " . count($found) . " nodes for " . " path " . $path . " in " . $layout . "/" . $a_xml . ". LM Layout is " . $this->lm->getLayout()); } $node = $found[0]; // ProcessFrameset // node is frameset, if it has cols or rows attribute $attributes = $this->attrib2arr($node->attributes()); $this->frames = array(); if (!empty($attributes["rows"]) || !empty($attributes["cols"])) { $content .= $this->buildTag("start", "frameset", $attributes); //$this->frames = array(); $this->processNodes($content, $node); $content .= $this->buildTag("end", "frameset"); $this->tpl = new ilTemplate("tpl.frameset.html", true, true, "Modules/LearningModule"); $this->renderPageTitle(); $this->tpl->setVariable("FS_CONTENT", $content); if (!$doshow) { $content = $this->tpl->get(); } } else { // ProcessContentTag //if ((empty($attributes["template"]) || !empty($_GET["obj_type"]))) if ((empty($attributes["template"]) || !empty($_GET["obj_type"])) && ($_GET["frame"] != "_blank" || $_GET["obj_type"] != "MediaObject")) { // we got a variable content frame (can display different // object types (PageObject, MediaObject, GlossarItem) // and contains elements for them) // determine object type if (empty($_GET["obj_type"])) { $obj_type = "PageObject"; } else { $obj_type = $_GET["obj_type"]; } // get object specific node $childs = $node->child_nodes(); $found = false; foreach ($childs as $child) { if ($child->node_name() == $obj_type) { $found = true; $attributes = $this->attrib2arr($child->attributes()); $node = $child; //echo "<br>2node:".$node->node_name(); break; } } if (!$found) { echo "ilLMPresentation: No template specified for frame '" . $_GET["frame"] . "' and object type '" . $obj_type . "'."; exit; } } // get template $in_module = $attributes["template_location"] == "module" ? true : false; if ($in_module) { $this->tpl = new ilTemplate($attributes["template"], true, true, $in_module); $this->tpl->setBodyClass(""); } else { $this->tpl = $tpl; } // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } include_once "./Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery($this->tpl); iljQueryUtil::initjQueryUI($this->tpl); include_once "./Services/UICore/classes/class.ilUIFramework.php"; ilUIFramework::init($this->tpl); // to make e.g. advanced seletions lists work: $GLOBALS["tpl"] = $this->tpl; $childs = $node->child_nodes(); foreach ($childs as $child) { $child_attr = $this->attrib2arr($child->attributes()); switch ($child->node_name()) { case "ilMainMenu": $this->ilMainMenu(); $this->renderPageTitle(); break; case "ilTOC": $this->ilTOC($child_attr["target_frame"]); break; case "ilPage": switch ($this->lm->getType()) { case "lm": unset($_SESSION["tr_id"]); unset($_SESSION["bib_id"]); unset($_SESSION["citation"]); $content = $this->ilPage($child); break; } break; case "ilGlossary": $content = $this->ilGlossary($child); break; case "ilLMNavigation": $this->ilLMNavigation(); break; case "ilMedia": $this->ilMedia(); break; case "ilLocator": $this->ilLocator(); break; case "ilJavaScript": $this->ilJavaScript($child_attr["inline"], $child_attr["file"], $child_attr["location"]); break; case "ilLMMenu": $this->ilLMMenu(); break; case "ilLMHead": $this->ilLMHead(); break; case "ilLMSubMenu": $this->ilLMSubMenu(); break; case "ilLMNotes": $this->ilLMNotes(); break; } } // TODO: Very dirty hack to force the import of JavaScripts in learning content in the FAQ frame (e.g. if jsMath is in the content) // Unfortunately there is no standardized way to do this somewhere else. Calling fillJavaScripts always in ilTemplate causes multiple additions of the the js files. // 19.7.2014: outcommented, since fillJavaScriptFiles is called in the next blocks, and the // following lines would add the js files two times // if (strcmp($_GET["frame"], "topright") == 0) $this->tpl->fillJavaScriptFiles(); // if (strcmp($_GET["frame"], "right") == 0) $this->tpl->fillJavaScriptFiles(); // if (strcmp($_GET["frame"], "botright") == 0) $this->tpl->fillJavaScriptFiles(); if (!$this->offlineMode()) { include_once "./Services/Accordion/classes/class.ilAccordionGUI.php"; ilAccordionGUI::addJavaScript(); ilAccordionGUI::addCss(); $this->tpl->addJavascript("./Modules/LearningModule/js/LearningModule.js"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $close_call = "il.LearningModule.setCloseHTML('" . ilGlyphGUI::get(ilGlyphGUI::CLOSE) . "');"; $this->tpl->addOnLoadCode($close_call); //$store->set("cf_".$this->lm->getId()); // handle initial content if ($_GET["frame"] == "") { include_once "./Services/Authentication/classes/class.ilSessionIStorage.php"; $store = new ilSessionIStorage("lm"); $last_frame_url = $store->get("cf_" . $this->lm->getId()); if ($last_frame_url != "") { $this->tpl->addOnLoadCode("il.LearningModule.setLastFrameUrl('" . $last_frame_url . "', 'center_bottom');"); } if (in_array($layout, array("toc2windyn"))) { $this->tpl->addOnLoadCode("il.LearningModule.setSaveUrl('" . $ilCtrl->getLinkTarget($this, "saveFrameUrl", "", false, false) . "');\n\t\t\t\t\t\t\til.LearningModule.openInitFrames();\n\t\t\t\t\t\t\t"); } $this->tpl->addOnLoadCode("il.LearningModule.setTocRefreshUrl('" . $ilCtrl->getLinkTarget($this, "refreshToc", "", false, false) . "');\n\t\t\t\t\t\t\t"); } // from main menu // $this->tpl->addJavascript("./Services/JavaScript/js/Basic.js"); $this->tpl->addJavascript("./Services/Navigation/js/ServiceNavigation.js"); $this->tpl->fillJavaScriptFiles(); $this->tpl->fillScreenReaderFocus(); $this->tpl->fillCssFiles(); } else { // reset standard css files $this->tpl->resetJavascript(); $this->tpl->resetCss(); include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php"; foreach (ilObjContentObject::getSupplyingExportFiles() as $f) { if ($f["type"] == "js") { $this->tpl->addJavascript($f["target"]); } if ($f["type"] == "css") { $this->tpl->addCSS($f["target"]); } } $this->tpl->fillJavaScriptFiles(true); $this->tpl->fillCssFiles(true); } $this->tpl->fillBodyClass(); } if ($doShow) { // (horrible) workaround for preventing template engine // from hiding paragraph text that is enclosed // in curly brackets (e.g. "{a}", see ilPageObjectGUI::showPage()) $this->tpl->fillTabs(); if ($this->fill_on_load_code) { $this->tpl->fillOnLoadCode(); } $content = $this->tpl->get(); $content = str_replace("{", "{", $content); $content = str_replace("}", "}", $content); header('Content-type: text/html; charset=UTF-8'); echo $content; } else { $this->tpl->fillLeftNav(); $this->tpl->fillOnLoadCode(); $content = $this->tpl->get(); } return $content; }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_filewizardinput.html", true, true, "Services/Form"); $i = 0; foreach ($this->filenames as $value) { if (strlen($value)) { $tpl->setCurrentBlock("image"); $tpl->setVariable("SRC_IMAGE", $this->getImagePathWeb() . ilUtil::prepareFormOutput($value)); $tpl->setVariable("PICTURE_FILE", ilUtil::prepareFormOutput($value)); $tpl->setVariable("ID", $this->getFieldId() . "[{$i}]"); $tpl->setVariable("ALT_IMAGE", ilUtil::prepareFormOutput($value)); $tpl->parseCurrentBlock(); } if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getFieldId() . "[{$i}]"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $this->outputSuffixes($tpl, "allowed_image_suffixes"); $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("ID", $this->getFieldId() . "[{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ALT_ADD", $lng->txt("add")); $tpl->setVariable("ALT_REMOVE", $lng->txt("remove")); if ($this->getDisabled()) { $tpl->setVariable("DISABLED", " disabled=\"disabled\""); } include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->setVariable("TXT_MAX_SIZE", $lng->txt("file_notice") . " " . $this->getMaxFileSizeString()); $tpl->parseCurrentBlock(); $i++; } $tpl->setVariable("ELEMENT_ID", $this->getFieldId()); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Services/Form/templates/default/filewizard.js"); }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_imagewizardinput.html", true, true, "Modules/TestQuestionPool"); $i = 0; foreach ($this->values as $value) { if (strlen($value)) { $imagename = $this->qstObject->getImagePathWeb() . $value; if ($this->qstObject->getThumbSize()) { if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value)) { $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value; } } $tpl->setCurrentBlock('image'); $tpl->setVariable('SRC_IMAGE', $imagename); $tpl->setVariable('IMAGE_NAME', $value); $tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value)); $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file")); $tpl->setVariable("IMAGE_ROW_NUMBER", $i); $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('addimage'); $tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][{$i}]"); $tpl->setVariable("IMAGE_SUBMIT", $lng->txt("upload")); $tpl->setVariable("IMAGE_ROW_NUMBER", $i); $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar()); $tpl->parseCurrentBlock(); if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("ROW_NUMBER", $i); $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); $i++; } if (is_array($this->getSuffixes())) { $suff_str = $delim = ""; foreach ($this->getSuffixes() as $suffix) { $suff_str .= $delim . "." . $suffix; $delim = ", "; } $tpl->setCurrentBlock('allowed_image_suffixes'); $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str); $tpl->parseCurrentBlock(); } /* $tpl->setCurrentBlock("image_heading"); $tpl->setVariable("ANSWER_IMAGE", $lng->txt('answer_image')); $tpl->parseCurrentBlock(); */ $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo()); $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("TEXT_YES", $lng->txt('yes')); $tpl->setVariable("TEXT_NO", $lng->txt('no')); $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header')); $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question')); $tpl->setVariable("ANSWER_TEXT", $lng->txt('answer_text')); $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); global $tpl; $tpl->addJavascript("./Services/Form/js/ServiceFormWizardInput.js"); $tpl->addJavascript("./Modules/TestQuestionPool/templates/default/imagewizard.js"); }
/** * Render single of dnd page view * * @param ilTemplate $a_tpl * @param string $a_type * @param int $a_id * @param string $a_content * @param array $a_menu * @param bool $a_spacer * @param string $a_subtitle * @param string $a_heading */ function renderPageNode(ilTemplate $a_tpl, $a_type, $a_id, $a_content = null, array $a_menu = null, $a_spacer = false, $a_subtitle = false, $a_status = false, $a_heading = false) { global $ilCtrl, $lng; $node_id = $a_type . "_" . $a_id; if ($a_spacer) { if ($a_menu) { // drop area menu foreach ($a_menu as $mcnt => $menu_item) { $ilCtrl->setParameter($this, "il_hform_node", $node_id); $ilCtrl->setParameter($this, "il_hform_subcmd", $menu_item["cmd"]); $url = $ilCtrl->getLinkTarget($this, "renderPage"); $ilCtrl->setParameter($this, "il_hform_subcmd", ""); $ilCtrl->setParameter($this, "il_hform_node", ""); $a_tpl->setCurrentBlock("menu_cmd"); $a_tpl->setVariable("TXT_MENU_CMD", $menu_item["text"]); $a_tpl->setVariable("URL_MENU_CMD", $url); $a_tpl->parseCurrentBlock(); } } $a_tpl->setCurrentBlock("drop_area"); include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $a_tpl->setVariable("ICON_ADD", ilGlyphGUI::get(ilGlyphGUI::ADD)); $a_tpl->setVariable("DROP_ID", $a_id); $a_tpl->parseCurrentBlock(); } else { if ($a_menu) { // question action menu foreach ($a_menu as $mcnt => $menu_item) { $ilCtrl->setParameter($this, "il_hform_node", $node_id); $ilCtrl->setParameter($this, "il_hform_subcmd", $menu_item["cmd"]); $url = $ilCtrl->getLinkTarget($this, "renderPage"); $ilCtrl->setParameter($this, "il_hform_subcmd", ""); $ilCtrl->setParameter($this, "il_hform_node", ""); $a_tpl->setCurrentBlock("action_cmd"); $a_tpl->setVariable("TXT_ACTION_CMD", $menu_item["text"]); $a_tpl->setVariable("URL_ACTION_CMD", $url); $a_tpl->parseCurrentBlock(); } } } if ($a_content !== null) { $drag = ""; $selectable = false; switch ($a_type) { case "block": $caption = $lng->txt("questionblock"); break; case "question": if ($a_heading) { $a_content = "<div class=\"questionheading\">" . $a_heading . "</div>" . $a_content; } $caption = $lng->txt("question") . ": " . $a_subtitle; $drag = "_drag"; $selectable = true; break; case "heading": $caption = $lng->txt("heading"); break; default: return; } if ($a_status) { $caption .= " (" . $a_status . ")"; } $a_tpl->setCurrentBlock("list_item"); $a_tpl->setVariable("NODE_ID", $node_id); $a_tpl->setVariable("NODE_DRAG", $drag); $a_tpl->setVariable("TXT_NODE_TYPE", $caption); $a_tpl->setVariable("TXT_NODE_CONTENT", $a_content); if ($selectable) { $a_tpl->setVariable("SELECTABLE", " selectable"); } $a_tpl->parseCurrentBlock(); } $a_tpl->touchBlock("element"); }
/** * set all template variables (images, scripts, target frames, ...) */ function setTemplateVars() { global $rbacsystem, $lng, $ilias, $tree, $ilUser, $ilSetting, $ilPluginAdmin; if ($this->logo_only) { $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL()); $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg")); return; } // get user interface plugins $pl_names = $ilPluginAdmin->getActivePluginsForSlot(IL_COMP_SERVICE, "UIComponent", "uihk"); if ($this->getMode() != self::MODE_TOPBAR_REDUCED && $this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) { // search include_once 'Services/Search/classes/class.ilSearchSettings.php'; if ($rbacsystem->checkAccess('search', ilSearchSettings::_getSearchSettingRefId())) { include_once './Services/Search/classes/class.ilMainMenuSearchGUI.php'; $main_search = new ilMainMenuSearchGUI(); $html = ""; // user interface plugin slot + default rendering include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php"; $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_search", array("main_menu_gui" => $this, "main_menu_search_gui" => $main_search)); if (!$uip->replaced()) { $html = $main_search->getHTML(); } $html = $uip->getHTML($html); if (strlen($html)) { $this->tpl->setVariable('SEARCHBOX', $html); } } $this->renderStatusBox($this->tpl); // online help $this->renderHelpButtons(); } if ($this->getMode() == self::MODE_FULL) { $mmle_html = ""; // user interface plugin slot + default rendering include_once "./Services/UIComponent/classes/class.ilUIHookProcessor.php"; $uip = new ilUIHookProcessor("Services/MainMenu", "main_menu_list_entries", array("main_menu_gui" => $this)); if (!$uip->replaced()) { $mmle_tpl = new ilTemplate("tpl.main_menu_list_entries.html", true, true, "Services/MainMenu"); $mmle_html = $this->renderMainMenuListEntries($mmle_tpl); } $mmle_html = $uip->getHTML($mmle_html); $this->tpl->setVariable("MAIN_MENU_LIST_ENTRIES", $mmle_html); } if ($this->getMode() != self::MODE_TOPBAR_MEMBERVIEW) { $link_dir = defined("ILIAS_MODULE") ? "../" : ""; // login stuff if ($_SESSION["AccountId"] == ANONYMOUS_USER_ID) { include_once 'Services/Registration/classes/class.ilRegistrationSettingsGUI.php'; if (ilRegistrationSettings::_lookupRegistrationType() != IL_REG_DISABLED) { $this->tpl->setCurrentBlock("registration_link"); $this->tpl->setVariable("TXT_REGISTER", $lng->txt("register")); $this->tpl->setVariable("LINK_REGISTER", $link_dir . "register.php?client_id=" . rawurlencode(CLIENT_ID) . "&lang=" . $ilias->account->getCurrentLanguage()); $this->tpl->parseCurrentBlock(); } // language selection $selection = self::getLanguageSelection(); if ($selection) { // bs-patch start global $ilUser, $lng; $this->tpl->setVariable("TXT_LANGSELECT", $lng->txt("language")); // bs-patch end $this->tpl->setVariable("LANG_SELECT", $selection); } $this->tpl->setCurrentBlock("userisanonymous"); $this->tpl->setVariable("TXT_NOT_LOGGED_IN", $lng->txt("not_logged_in")); $this->tpl->setVariable("TXT_LOGIN", $lng->txt("log_in")); // #13058 $target_str = $this->getLoginTargetPar() != "" ? $this->getLoginTargetPar() : ilTemplate::buildLoginTarget(); $this->tpl->setVariable("LINK_LOGIN", $link_dir . "login.php?target=" . $target_str . "&client_id=" . rawurlencode(CLIENT_ID) . "&cmd=force_login&lang=" . $ilias->account->getCurrentLanguage()); $this->tpl->parseCurrentBlock(); } else { if ($this->getMode() != self::MODE_TOPBAR_REDUCED) { $notificationSettings = new ilSetting('notifications'); $chatSettings = new ilSetting('chatroom'); /** * @var $tpl ilTemplate */ global $tpl; if ($chatSettings->get('chat_enabled') && $notificationSettings->get('enable_osd')) { $this->tpl->touchBlock('osd_enabled'); $this->tpl->touchBlock('osd_container'); include_once "Services/jQuery/classes/class.iljQueryUtil.php"; iljQueryUtil::initjQuery(); include_once 'Services/MediaObjects/classes/class.ilPlayerUtil.php'; ilPlayerUtil::initMediaElementJs(); $tpl->addJavaScript('Services/Notifications/templates/default/notifications.js'); $tpl->addCSS('Services/Notifications/templates/default/osd.css'); require_once 'Services/Notifications/classes/class.ilNotificationOSDHandler.php'; require_once 'Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php'; $notifications = ilNotificationOSDHandler::getNotificationsForUser($ilUser->getId()); $this->tpl->setVariable('NOTIFICATION_CLOSE_HTML', json_encode(ilGlyphGUI::get(ilGlyphGUI::CLOSE, $lng->txt('close')))); $this->tpl->setVariable('INITIAL_NOTIFICATIONS', json_encode($notifications)); $this->tpl->setVariable('OSD_POLLING_INTERVALL', $notificationSettings->get('osd_polling_intervall') ? $notificationSettings->get('osd_polling_intervall') : '5'); $this->tpl->setVariable('OSD_PLAY_SOUND', $chatSettings->get('play_invitation_sound') && $ilUser->getPref('chat_play_invitation_sound') ? 'true' : 'false'); foreach ($notifications as $notification) { if ($notification['type'] == 'osd_maint') { continue; } $this->tpl->setCurrentBlock('osd_notification_item'); $this->tpl->setVariable('NOTIFICATION_ICON_PATH', $notification['data']->iconPath); $this->tpl->setVariable('NOTIFICATION_TITLE', $notification['data']->title); $this->tpl->setVariable('NOTIFICATION_LINK', $notification['data']->link); $this->tpl->setVariable('NOTIFICATION_LINKTARGET', $notification['data']->linktarget); $this->tpl->setVariable('NOTIFICATION_ID', $notification['notification_osd_id']); $this->tpl->setVariable('NOTIFICATION_SHORT_DESCRIPTION', $notification['data']->shortDescription); $this->tpl->parseCurrentBlock(); } } } $this->tpl->setCurrentBlock("userisloggedin"); $this->tpl->setVariable("TXT_LOGIN_AS", $lng->txt("login_as")); $user_img_src = $ilias->account->getPersonalPicturePath("small", true); $user_img_alt = $ilias->account->getFullname(); $this->tpl->setVariable("USER_IMG", ilUtil::img($user_img_src, $user_img_alt)); $this->tpl->setVariable("USR_LINK_PROFILE", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToProfile"); $this->tpl->setVariable("USR_TXT_PROFILE", $lng->txt("personal_profile")); $this->tpl->setVariable("USR_LINK_SETTINGS", "ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToSettings"); $this->tpl->setVariable("USR_TXT_SETTINGS", $lng->txt("personal_settings")); $this->tpl->setVariable("TXT_LOGOUT2", $lng->txt("logout")); $this->tpl->setVariable("LINK_LOGOUT2", $link_dir . "logout.php?lang=" . $ilias->account->getCurrentLanguage()); $this->tpl->setVariable("USERNAME", $ilias->account->getFullname()); $this->tpl->setVariable("LOGIN", $ilias->account->getLogin()); $this->tpl->setVariable("MATRICULATION", $ilias->account->getMatriculation()); $this->tpl->setVariable("EMAIL", $ilias->account->getEmail()); $this->tpl->parseCurrentBlock(); } } else { // member view info $this->tpl->setVariable("TOPBAR_CLASS", " ilMemberViewMainHeader"); $this->tpl->setVariable("MEMBER_VIEW_INFO", $lng->txt("mem_view_long")); } if (!$this->topbar_back_url) { include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php"; $header_top_title = ilObjSystemFolder::_getHeaderTitle(); if (trim($header_top_title) != "" && $this->tpl->blockExists("header_top_title")) { $this->tpl->setCurrentBlock("header_top_title"); $this->tpl->setVariable("TXT_HEADER_TITLE", $header_top_title); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("header_back_bl"); $this->tpl->setVariable("URL_HEADER_BACK", $this->topbar_back_url); $this->tpl->setVariable("TXT_HEADER_BACK", $this->topbar_back_caption ? $this->topbar_back_caption : $lng->txt("back")); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); if ($this->getMode() == self::MODE_FULL) { // $this->tpl->setVariable("TXT_LOGOUT", $lng->txt("logout")); $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL()); $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg")); } include_once "./Modules/SystemFolder/classes/class.ilObjSystemFolder.php"; // set link to return to desktop, not depending on a specific position in the hierarchy //$this->tpl->setVariable("SCRIPT_START", $this->getScriptTarget("start.php")); /* else { $this->tpl->setVariable("HEADER_URL", $this->getHeaderURL()); $this->tpl->setVariable("HEADER_ICON", ilUtil::getImagePath("HeaderIcon.svg")); } */ $this->tpl->setVariable("TXT_MAIN_MENU", $lng->txt("main_menu")); $this->tpl->parseCurrentBlock(); }
/** * Insert property html * */ function render() { global $lng, $ilUser; $tpl = new ilTemplate("tpl.prop_datetime.html", true, true, "Services/Form"); $lng->loadLanguageModule("jscalendar"); require_once "./Services/Calendar/classes/class.ilCalendarUtil.php"; ilCalendarUtil::initJSCalendar(); if (strlen($this->getActivationPostVar())) { $tpl->setCurrentBlock('prop_date_activation'); $tpl->setVariable('CHECK_ENABLED_DATE', $this->getActivationPostVar()); $tpl->setVariable('TXT_DATE_ENABLED', $this->activation_title); $tpl->setVariable('CHECKED_ENABLED', $this->activation_checked ? 'checked="checked"' : ''); $tpl->setVariable('CHECKED_DISABLED', $this->getDisabled() ? 'disabled="disabled" ' : ''); $tpl->parseCurrentBlock(); } if ($this->getMode() == self::MODE_SELECT) { if (is_a($this->getDate(), 'ilDate')) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', 'UTC'); } elseif (is_a($this->getDate(), 'ilDateTime')) { $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } else { $this->setDate(new ilDateTime(time(), IL_CAL_UNIX)); $date_info = $this->getDate()->get(IL_CAL_FKT_GETDATE, '', $ilUser->getTimeZone()); } // display invalid input again if (is_array($this->invalid_input)) { $date_info['year'] = $this->invalid_input['y']; $date_info['mon'] = $this->invalid_input['m']; $date_info['mday'] = $this->invalid_input['d']; } } if ($this->getMode() == self::MODE_SELECT) { $tpl->setCurrentBlock("prop_date_input_select_setup"); $tpl->setVariable("INPUT_FIELDS_DATE", $this->getPostVar() . "[date]"); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date"); $tpl->setVariable("DATE_SELECT", ilUtil::makeDateSelect($this->getPostVar() . "[date]", $date_info['year'], $date_info['mon'], $date_info['mday'], $this->startyear, true, array('disabled' => $this->getDisabled()), $this->getShowEmpty())); } else { $value = $this->getDate(); if ($value) { $value = substr($this->getDate()->get(IL_CAL_DATETIME), 0, 10); $day = substr($value, 8, 2); $month = substr($value, 5, 2); $year = substr($value, 0, 4); } switch ($ilUser->getDateFormat()) { case ilCalendarSettings::DATE_FORMAT_DMY: if ($value) { $value = date("d.m.Y", mktime(0, 0, 0, $month, $day, $year)); } $format = "%d.%m.%Y"; $input_hint = $lng->txt("dd_mm_yyyy"); break; case ilCalendarSettings::DATE_FORMAT_YMD: if ($value) { $value = date("Y-m-d", mktime(0, 0, 0, $month, $day, $year)); } $format = "%Y-%m-%d"; $input_hint = $lng->txt("yyyy_mm_dd"); break; case ilCalendarSettings::DATE_FORMAT_MDY: if ($value) { $value = date("m/d/Y", mktime(0, 0, 0, $month, $day, $year)); } $format = "%m/%d/%Y"; $input_hint = $lng->txt("mm_dd_yyyy"); break; } $tpl->setCurrentBlock("prop_date_input_field"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("DATE_VALUE", $value); $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : ""); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date_input_field_info"); $tpl->setVariable("TXT_INPUT_FORMAT", $input_hint); $tpl->parseCurrentBlock(); $tpl->setCurrentBlock("prop_date_input_field_setup"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("DATE_FIELD_FORMAT", $format); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("prop_date"); include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $tpl->setVariable("IMG_DATE_CALENDAR", ilGlyphGUI::get(ilGlyphGUI::CALENDAR, $lng->txt("open_calendar"))); $tpl->setVariable("DATE_ID", $this->getPostVar()); include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php'; $tpl->setVariable('DATE_FIRST_DAY', ilCalendarUserSettings::_getInstance()->getWeekStart()); $tpl->parseCurrentBlock(); if ($this->getShowTime()) { if ($this->getMode() == self::MODE_INPUT) { $value = $this->getDate(); if ($value) { if (!$this->getShowSeconds()) { $value = substr($value->get(IL_CAL_DATETIME), 11, 5); if ($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12) { $value = date("g:ia", mktime(substr($value, 0, 2), substr($value, 3, 2))); } } else { $value = substr($value->get(IL_CAL_DATETIME), 11, 8); if ($ilUser->getTimeFormat() == ilCalendarSettings::TIME_FORMAT_12) { $value = date("g:i:sa", mktime(substr($value, 0, 2), substr($value, 3, 2), substr($value, 6, 2))); } } } $tpl->setCurrentBlock("prop_time_input_field"); $tpl->setVariable("DATE_ID", $this->getPostVar()); $tpl->setVariable("TIME_VALUE", $value); $tpl->setVariable("DISABLED", $this->getDisabled() ? " disabled=\"disabled\"" : ""); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("prop_time"); if ($this->getMode() == self::MODE_SELECT) { $tpl->setVariable("TIME_SELECT", ilUtil::makeTimeSelect($this->getPostVar() . "[time]", !$this->getShowSeconds(), $date_info['hours'], $date_info['minutes'], $date_info['seconds'], true, array('minute_steps' => $this->getMinuteStepSize(), 'disabled' => $this->getDisabled()))); } $tpl->setVariable("TXT_TIME", $this->getShowSeconds() ? "(" . $lng->txt("hh_mm_ss") . ")" : "(" . $lng->txt("hh_mm") . ")"); $tpl->parseCurrentBlock(); } return $tpl->get(); }
/** * Get Legend * * @return string legend html */ function getLegend() { global $lng; include_once "./Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; $ttpl = new ilTemplate("tpl.hierarchy_form_legend.html", true, true, "Services/Form"); if ($this->getDragIcon() != "") { $ttpl->setCurrentBlock("help_drag"); $ttpl->setVariable("IMG_DRAG", $this->getDragIcon()); $ttpl->setVariable("DRAG_ARROW", ilGlyphGUI::get(ilGlyphGUI::DRAG)); $ttpl->setVariable("TXT_DRAG", $lng->txt("form_hierarchy_drag_drop_help")); $ttpl->setVariable("PLUS", ilGlyphGUI::get(ilGlyphGUI::ADD)); $ttpl->parseCurrentBlock(); } // additional help items foreach ($this->getHelpItems() as $help) { if ($help["image"] != "") { $ttpl->setCurrentBlock("help_img"); $ttpl->setVariable("IMG_HELP", $help["image"]); $ttpl->parseCurrentBlock(); } $ttpl->setCurrentBlock("help_item"); $ttpl->setVariable("TXT_HELP", $help["text"]); $ttpl->parseCurrentBlock(); } $ttpl->setVariable("TXT_ADD_EL", $lng->txt("form_hierarchy_add_elements")); $ttpl->setVariable("PLUS2", ilGlyphGUI::get(ilGlyphGUI::ADD)); return $ttpl->get(); }
/** * fill row * * @access public * @param * @return */ public function fillRow($data) { global $ilUser, $ilAccess; $q_id = $data["question_id"]; $this->tpl->setVariable("QUESTION_ID", $q_id); if (isset($this->visibleOptionalColumns['qid'])) { $this->tpl->setVariable("QUESTION_ID_PRESENTATION", $q_id); } if ($this->getWriteAccess() && !$this->getTotal() && $data["obj_fi"] > 0) { if (!$data['complete']) { $this->tpl->setVariable("IMAGE_WARNING", ilUtil::getImagePath("icon_alert.svg")); $this->tpl->setVariable("ALT_WARNING", $this->lng->txt("warning_question_not_complete")); $this->tpl->setVariable("TITLE_WARNING", $this->lng->txt("warning_question_not_complete")); } $qpl_ref_id = current(ilObject::_getAllReferences($data["obj_fi"])); $this->tpl->setVariable("QUESTION_TITLE", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&eqid={$q_id}&eqpl={$qpl_ref_id}" . "\">" . $data["title"] . "</a>"); // obligatory checkbox (when obligation is possible) if ($data["obligationPossible"]) { $CHECKED = $data["obligatory"] ? "checked=\"checked\" " : ""; $OBLIGATORY = "<input type=\"checkbox\" name=\"obligatory[{$q_id}]\" value=\"1\" {$CHECKED}/>"; } else { $OBLIGATORY = ""; } } else { global $lng; $this->tpl->setVariable("QUESTION_TITLE", $data["title"]); // obligatory icon if ($data["obligatory"]) { $OBLIGATORY = "<img src=\"" . ilUtil::getImagePath("obligatory.gif", "Modules/Test") . "\" alt=\"" . $lng->txt("question_obligatory") . "\" title=\"" . $lng->txt("question_obligatory") . "\" />"; } else { $OBLIGATORY = ''; } } if ($this->parent_obj->object->areObligationsEnabled()) { $this->tpl->setVariable("QUESTION_OBLIGATORY", $OBLIGATORY); } $this->tpl->setVariable("QUESTION_SEQUENCE", $this->lng->txt("tst_sequence")); if ($this->getWriteAccess() && !$this->getTotal()) { if ($data["sequence"] != 1) { $this->tpl->setVariable("BUTTON_UP", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&up=" . $data["question_id"] . "\">" . ilGlyphGUI::get(ilGlyphGUI::UP, $this->lng->txt('up')) . "</a>"); } if ($data["sequence"] != count($this->getData())) { $this->tpl->setVariable("BUTTON_DOWN", "<a href=\"" . $this->ctrl->getLinkTarget($this->getParentObject(), "questions") . "&down=" . $data["question_id"] . "\">" . ilGlyphGUI::get(ilGlyphGUI::DOWN, $this->lng->txt('down')) . "</a>"); } } if (isset($this->visibleOptionalColumns['description'])) { if ($data["description"]) { $this->tpl->setVariable("QUESTION_COMMENT", $data["description"] ? $data["description"] : ' '); } else { $this->tpl->touchBlock('question_comment_block'); } } include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php"; $this->tpl->setVariable("QUESTION_TYPE", assQuestion::_getQuestionTypeName($data["type_tag"])); $this->tpl->setVariable("QUESTION_POINTS", $data["points"]); $this->totalPoints += $data["points"]; $this->totalWorkingTime = assQuestion::sumTimesInISO8601FormatH_i_s_Extended($this->totalWorkingTime, $data['working_time']); if (isset($this->visibleOptionalColumns['author'])) { $this->tpl->setVariable("QUESTION_AUTHOR", $data["author"]); } if (isset($this->visibleOptionalColumns['working_time'])) { $this->tpl->setVariable("QUESTION_WORKING_TIME", $data["working_time"]); } if (ilObject::_lookupType($data["orig_obj_fi"]) == 'qpl') { $this->tpl->setVariable("QUESTION_POOL", ilObject::_lookupTitle($data["orig_obj_fi"])); } else { $this->tpl->setVariable("QUESTION_POOL", $this->lng->txt('tst_question_not_from_pool_info')); } $this->position += 10; $field = "<input type=\"text\" name=\"order[q_" . $data["question_id"] . "]\" value=\"" . $this->position . "\" maxlength=\"3\" style=\"width:30px\" />"; $this->tpl->setVariable("QUESTION_POSITION", $field); }
/** * Insert property html * * @return int Size */ function insert(&$a_tpl) { global $lng; $tpl = new ilTemplate("tpl.prop_matchingwizardinput.html", true, true, "Modules/TestQuestionPool"); $i = 0; foreach ($this->values as $value) { if (!$this->hideImages) { if (strlen($value->picture)) { $imagename = $this->qstObject->getImagePathWeb() . $value->picture; if ($this->qstObject->getThumbSize()) { if (@file_exists($this->qstObject->getImagePath() . $this->qstObject->getThumbPrefix() . $value->picture)) { $imagename = $this->qstObject->getImagePathWeb() . $this->qstObject->getThumbPrefix() . $value->picture; } } $tpl->setCurrentBlock('image'); $tpl->setVariable('SRC_IMAGE', $imagename); $tpl->setVariable('IMAGE_NAME', $value->picture); $tpl->setVariable('ALT_IMAGE', ilUtil::prepareFormOutput($value->text)); $tpl->setVariable("TXT_DELETE_EXISTING", $lng->txt("delete_existing_file")); $tpl->setVariable("IMAGE_ROW_NUMBER", $i); $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar()); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock('addimage'); $tpl->setVariable("IMAGE_ID", $this->getPostVar() . "[image][{$i}]"); $tpl->setVariable("IMAGE_SUBMIT", $lng->txt("upload")); $tpl->setVariable("IMAGE_ROW_NUMBER", $i); $tpl->setVariable("IMAGE_POST_VAR", $this->getPostVar()); $tpl->parseCurrentBlock(); } if (is_object($value)) { $tpl->setCurrentBlock("prop_text_propval"); $tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($value->text)); $tpl->parseCurrentBlock(); } // this block does not exist in the template // $tpl->setCurrentBlock('singleline'); $tpl->setVariable("SIZE", $this->getSize()); $tpl->setVariable("SINGLELINE_ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("SINGLELINE_ROW_NUMBER", $i); $tpl->setVariable("SINGLELINE_POST_VAR", $this->getPostVar()); $tpl->setVariable("MAXLENGTH", $this->getMaxLength()); if ($this->getDisabled()) { $tpl->setVariable("DISABLED_SINGLELINE", " disabled=\"disabled\""); } $tpl->parseCurrentBlock(); if ($this->getAllowMove()) { $tpl->setCurrentBlock("move"); $tpl->setVariable("CMD_UP", "cmd[up" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_DOWN", "cmd[down" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ID", $this->getPostVar() . "[{$i}]"); $tpl->setVariable("UP_BUTTON", ilGlyphGUI::get(ilGlyphGUI::UP)); $tpl->setVariable("DOWN_BUTTON", ilGlyphGUI::get(ilGlyphGUI::DOWN)); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("row"); $tpl->setVariable("POST_VAR", $this->getPostVar()); $tpl->setVariable("ROW_NUMBER", $i + 1); $tpl->setVariable("ROW_IDENTIFIER", $value->identifier); $tpl->setVariable("ID", $this->getPostVar() . "[answer][{$i}]"); $tpl->setVariable("CMD_ADD", "cmd[add" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("CMD_REMOVE", "cmd[remove" . $this->getFieldId() . "][{$i}]"); $tpl->setVariable("ADD_BUTTON", ilGlyphGUI::get(ilGlyphGUI::ADD)); $tpl->setVariable("REMOVE_BUTTON", ilGlyphGUI::get(ilGlyphGUI::REMOVE)); $tpl->parseCurrentBlock(); $i++; } if (!$this->hideImages) { if (is_array($this->getSuffixes())) { $suff_str = $delim = ""; foreach ($this->getSuffixes() as $suffix) { $suff_str .= $delim . "." . $suffix; $delim = ", "; } $tpl->setCurrentBlock('allowed_image_suffixes'); $tpl->setVariable("TXT_ALLOWED_SUFFIXES", $lng->txt("file_allowed_suffixes") . " " . $suff_str); $tpl->parseCurrentBlock(); } $tpl->setCurrentBlock("image_heading"); $tpl->setVariable("ANSWER_IMAGE", $this->image_name); $tpl->setVariable("TXT_MAX_SIZE", ilUtil::getFileSizeInfo()); $tpl->parseCurrentBlock(); } $tpl->setVariable("ELEMENT_ID", $this->getPostVar()); $tpl->setVariable("TEXT_YES", $lng->txt('yes')); $tpl->setVariable("TEXT_NO", $lng->txt('no')); $tpl->setVariable("DELETE_IMAGE_HEADER", $lng->txt('delete_image_header')); $tpl->setVariable("DELETE_IMAGE_QUESTION", $lng->txt('delete_image_question')); $tpl->setVariable("ANSWER_TEXT", $this->text_name); $tpl->setVariable("NUMBER_TEXT", $lng->txt('row')); $tpl->setVariable("COMMANDS_TEXT", $lng->txt('actions')); $a_tpl->setCurrentBlock("prop_generic"); $a_tpl->setVariable("PROP_GENERIC", $tpl->get()); $a_tpl->parseCurrentBlock(); }
/** * fill data section * * @access public * */ public function show() { global $ilUser, $lng; // config $raster = 15; if ($this->user_settings->getDayStart()) { // push starting point to last "slot" of hour BEFORE morning aggregation $morning_aggr = ($this->user_settings->getDayStart() - 1) * 60 + (60 - $raster); } else { $morning_aggr = 0; } $evening_aggr = $this->user_settings->getDayEnd() * 60; $this->tpl = new ilTemplate('tpl.week_view.html', true, true, 'Services/Calendar'); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDragDrop(); ilYuiUtil::initPanel(); $navigation = new ilCalendarHeaderNavigationGUI($this, $this->seed, ilDateTime::WEEK); $this->tpl->setVariable('NAVIGATION', $navigation->getHTML()); if (isset($_GET["bkid"])) { $user_id = $_GET["bkid"]; $disable_empty = true; $no_add = true; } elseif ($ilUser->getId() == ANONYMOUS_USER_ID) { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = true; } else { $user_id = $ilUser->getId(); $disable_empty = false; $no_add = false; } include_once 'Services/Calendar/classes/class.ilCalendarSchedule.php'; $this->scheduler = new ilCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $user_id, $disable_empty); $this->scheduler->addSubitemCalendars(true); $this->scheduler->calculate(); $counter = 0; $hours = null; $all_fullday = array(); foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $daily_apps = $this->scheduler->getByDay($date, $this->timezone); $hours = $this->parseHourInfo($daily_apps, $date, $counter, $hours, $morning_aggr, $evening_aggr, $raster); $this->weekdays[] = $date; $num_apps[$date->get(IL_CAL_DATE)] = count($daily_apps); $all_fullday[] = $daily_apps; $counter++; } $colspans = $this->calculateColspans($hours); include_once 'Services/Calendar/classes/class.ilCalendarSettings.php'; $settings = ilCalendarSettings::_getInstance(); include_once "Services/UIComponent/Glyph/classes/class.ilGlyphGUI.php"; // Table header $counter = 0; foreach (ilCalendarUtil::_buildWeekDayList($this->seed, $this->user_settings->getWeekStart())->get() as $date) { $date_info = $date->get(IL_CAL_FKT_GETDATE, '', 'UTC'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $date->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendardaygui', 'seed', $date->get(IL_CAL_DATE)); if (!$no_add) { $new_app_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add'); if ($settings->getEnableGroupMilestones()) { $new_ms_url = $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'addMilestone'); $this->tpl->setCurrentBlock("new_ms"); $this->tpl->setVariable('DD_ID', $date->get(IL_CAL_UNIX)); $this->tpl->setVariable('DD_TRIGGER', ilGlyphGUI::get(ilGlyphGUI::ADD)); $this->tpl->setVariable('URL_DD_NEW_APP', $new_app_url); $this->tpl->setVariable('TXT_DD_NEW_APP', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('URL_DD_NEW_MS', $new_ms_url); $this->tpl->setVariable('TXT_DD_NEW_MS', $this->lng->txt('cal_new_ms')); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("new_app"); $this->tpl->setVariable('NEW_APP_LINK', $new_app_url); $this->tpl->setVariable('NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); // $this->tpl->setVariable('NEW_APP_ALT',$this->lng->txt('cal_new_app')); $this->tpl->parseCurrentBlock(); } $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); } $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), true); $daydate = $date_info['mday'] . ' ' . ilCalendarUtil::_numericMonthToString($date_info['mon'], false); if (!$disable_empty || $num_apps[$date->get(IL_CAL_DATE)] > 0) { $link = $this->ctrl->getLinkTargetByClass('ilcalendardaygui', ''); $this->ctrl->clearParametersByClass('ilcalendardaygui'); $this->tpl->setCurrentBlock("day_view1_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->setVariable('DAY_VIEW_LINK', $link); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("day_view1_no_link"); $this->tpl->setVariable('HEADER_DATE', $daydate); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("day_view2_no_link"); $this->tpl->setVariable('DAYNAME', $dayname); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock('day_header_row'); $this->tpl->setVariable('DAY_COLSPAN', max($colspans[$counter], 1)); $this->tpl->parseCurrentBlock(); $counter++; } // show fullday events $counter = 0; foreach ($all_fullday as $daily_apps) { foreach ($daily_apps as $event) { if ($event['fullday']) { $this->showFulldayAppointment($event); } } $this->tpl->setCurrentBlock('f_day_row'); $this->tpl->setVariable('COLSPAN', max($colspans[$counter], 1)); $this->tpl->parseCurrentBlock(); $counter++; } $this->tpl->setCurrentBlock('fullday_apps'); $this->tpl->setVariable('TXT_F_DAY', $lng->txt("cal_all_day")); $this->tpl->parseCurrentBlock(); $new_link_counter = 0; foreach ($hours as $num_hour => $hours_per_day) { $first = true; foreach ($hours_per_day as $num_day => $hour) { if ($first) { if (!($num_hour % 60) || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $first = false; // aggregation rows if ($num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $this->tpl->setVariable('TIME_ROWSPAN', 1); } else { $this->tpl->setVariable('TIME_ROWSPAN', 60 / $raster); } $this->tpl->setCurrentBlock('time_txt'); $this->tpl->setVariable('TIME', $hour['txt']); $this->tpl->parseCurrentBlock(); } } foreach ($hour['apps_start'] as $app) { $this->showAppointment($app); } // screen reader: appointments are divs, now output cell if ($ilUser->prefs["screen_reader_optimization"]) { $this->tpl->setCurrentBlock('scrd_day_cell'); $this->tpl->setVariable('TD_CLASS', 'calstd'); $this->tpl->parseCurrentBlock(); } #echo "NUMDAY: ".$num_day; #echo "COLAPANS: ".max($colspans[$num_day],1).'<br />'; $num_apps = $hour['apps_num']; $colspan = max($colspans[$num_day], 1); // Show new apointment link if (!$hour['apps_num'] && !$ilUser->prefs["screen_reader_optimization"] && !$no_add) { $this->tpl->setCurrentBlock('new_app_link'); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'idate', $this->weekdays[$num_day]->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'seed', $this->seed->get(IL_CAL_DATE)); $this->ctrl->setParameterByClass('ilcalendarappointmentgui', 'hour', floor($num_hour / 60)); $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->ctrl->getLinkTargetByClass('ilcalendarappointmentgui', 'add')); $this->ctrl->clearParametersByClass('ilcalendarappointmentgui'); $this->tpl->setVariable('DAY_NEW_APP_SRC', ilGlyphGUI::get(ilGlyphGUI::ADD, $this->lng->txt('cal_new_app'))); $this->tpl->setVariable('DAY_NEW_APP_ALT', $this->lng->txt('cal_new_app')); $this->tpl->setVariable('DAY_NEW_ID', ++$new_link_counter); $this->tpl->parseCurrentBlock(); } for ($i = $colspan; $i > $hour['apps_num']; $i--) { if ($ilUser->prefs["screen_reader_optimization"]) { continue; } $this->tpl->setCurrentBlock('day_cell'); // last "slot" of hour needs border $empty_border = ''; if ($num_hour % 60 == 60 - $raster || $num_hour == $morning_aggr && $morning_aggr || $num_hour == $evening_aggr && $evening_aggr) { $empty_border = ' calempty_border'; } if ($i == $hour['apps_num'] + 1) { $this->tpl->setVariable('TD_CLASS', 'calempty calrightborder' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } else { $this->tpl->setVariable('TD_CLASS', 'calempty' . $empty_border); #$this->tpl->setVariable('TD_STYLE',$add_style); } if (!$hour['apps_num']) { $this->tpl->setVariable('DAY_ID', $new_link_counter); } $this->tpl->setVariable('TD_ROWSPAN', 1); $this->tpl->parseCurrentBlock(); } } $this->tpl->touchBlock('time_row'); } $this->tpl->setVariable("TXT_TIME", $lng->txt("time")); }