/**
  * @param ilObjectGUI $a_parent_obj
  * @param string      $a_parent_cmd
  */
 public function __construct(ilObjectGUI $a_parent_obj, $a_parent_cmd)
 {
     /**
      * @var $ilCtrl ilCtrl
      */
     global $ilCtrl;
     $this->ctrl = $ilCtrl;
     // Call this immediately in constructor
     $this->setId('tos_agreement_by_lng');
     $this->setDefaultOrderDirection('ASC');
     $this->setDefaultOrderField('language');
     $this->setExternalSorting(false);
     $this->setExternalSegmentation(false);
     parent::__construct($a_parent_obj, $a_parent_cmd);
     $this->setTitle($this->lng->txt('tos_agreement_by_lng'));
     $this->addColumn($this->lng->txt('language'), 'language');
     $this->addColumn($this->lng->txt('tos_agreement'), 'agreement');
     $this->addColumn($this->lng->txt('tos_agreement_document'), 'agreement_document');
     $this->optionalColumns = (array) $this->getSelectableColumns();
     $this->visibleOptionalColumns = (array) $this->getSelectedColumns();
     foreach ($this->visibleOptionalColumns as $column) {
         $this->addColumn($this->optionalColumns[$column]['txt'], $column);
     }
     $this->setFormAction($this->ctrl->getFormAction($a_parent_obj, 'applyAgreementByLanguageFilter'));
     $this->setRowTemplate('tpl.tos_agreement_by_lng_table_row.html', 'Services/TermsOfService');
     $this->setShowRowsSelector(true);
     require_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     require_once 'Services/YUI/classes/class.ilYuiUtil.php';
     iljQueryUtil::initjQuery();
     ilYuiUtil::initPanel();
     ilYuiUtil::initOverlay();
     $this->initFilter();
     $this->setFilterCommand('applyAgreementByLanguageFilter');
     $this->setResetCommand('resetAgreementByLanguageFilter');
 }
 /**
  * Get initialisation HTML to use interna link editing
  */
 function getInitHTML($a_url)
 {
     global $tpl;
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initPanel(false);
     ilYuiUtil::initConnection();
     ilYuiUtil::initDragDrop();
     $tpl->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
     $tpl->addJavascript("./Services/Link/js/ilIntLink.js");
     $ltpl = new ilTemplate("tpl.int_link_panel.html", true, true, "Services/Link");
     $ltpl->setVariable("IL_INT_LINK_URL", $a_url);
     return $ltpl->get();
 }
 protected function initLearningProgressDetailsLayer()
 {
     global $tpl;
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initPanel();
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     $tpl->addJavascript("./Services/Tracking/js/ilObjStat.js");
 }
예제 #4
0
 /**
  * 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');
     }
 }
 /**
  * @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;
 }
예제 #6
0
 /**
  * display content of page
  */
 function showPage()
 {
     global $tree, $ilUser, $lng, $ilCtrl, $ilSetting, $ilTabs;
     // jquery and jquery ui are always provided for components
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     iljQueryUtil::initjQueryUI();
     //		$this->initSelfAssessmentRendering();
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     ilObjMediaObjectGUI::includePresentationJS($GLOBALS["tpl"]);
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilCOPagePres.js");
     // needed for overlays in iim
     include_once "./Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
     ilOverlayGUI::initJavascript();
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     ilPlayerUtil::initMediaElementJs($GLOBALS["tpl"]);
     // init template
     //if($this->outputToTemplate())
     //{
     if ($this->getOutputMode() == "edit") {
         //echo ":".$this->getTemplateTargetVar().":";
         $tpl = new ilTemplate("tpl.page_edit_wysiwyg.html", true, true, "Services/COPage");
         //$this->tpl->addBlockFile($this->getTemplateTargetVar(), "adm_content", "tpl.page_edit_wysiwyg.html", "Services/COPage");
         // to do: status dependent class
         $tpl->setVariable("CLASS_PAGE_TD", "ilc_Page");
         // user comment
         if ($this->isEnabledChangeComments()) {
             $tpl->setCurrentBlock("change_comment");
             $tpl->setVariable("TXT_ADD_COMMENT", $this->lng->txt("cont_add_change_comment"));
             $tpl->parseCurrentBlock();
         }
         $tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormActionByClass("ilpageeditorgui", "", "", true));
         // determine media, html and javascript mode
         $sel_media_mode = $ilUser->getPref("ilPageEditor_MediaMode") == "disable" ? "disable" : "enable";
         $sel_html_mode = $ilUser->getPref("ilPageEditor_HTMLMode") == "disable" ? "disable" : "enable";
         $sel_js_mode = "disable";
         //if($ilSetting->get("enable_js_edit", 1))
         //{
         $sel_js_mode = ilPageEditorGUI::_doJSEditing() ? "enable" : "disable";
         //}
         // show prepending html
         $tpl->setVariable("PREPENDING_HTML", $this->getPrependingHtml());
         $tpl->setVariable("TXT_CONFIRM_DELETE", $lng->txt("cont_confirm_delete"));
         // presentation view
         if ($this->getViewPageLink() != "") {
             $ilTabs->addNonTabbedLink("pres_view", $this->lng->txt("cont_presentation_view"), $this->getViewPageLink(), $this->getViewPageTarget());
         }
         // show actions drop down
         $this->addActionsMenu($tpl, $sel_media_mode, $sel_html_mode, $sel_js_mode);
         // get js files for JS enabled editing
         if ($sel_js_mode == "enable") {
             $this->insertHelp($tpl);
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initDragDrop();
             ilYuiUtil::initConnection();
             ilYuiUtil::initPanel(false);
             $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
             include_once './Services/Style/classes/class.ilObjStyleSheet.php';
             $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\t\t\t\tpreloader.src = './templates/default/images/loader.svg';\n\t\t\t\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css" . "')");
             //$GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
             $GLOBALS["tpl"]->addJavascript("Services/COPage/tiny/4_1_5/tinymce.js");
             $tpl->touchBlock("init_dragging");
             $cfg = $this->getPageConfig();
             $tpl->setVariable("IL_TINY_MENU", self::getTinyMenu($this->getPageObject()->getParentType(), $cfg->getEnableInternalLinks(), $cfg->getEnableWikiLinks(), $cfg->getEnableKeywords(), $this->getStyleId(), true, true, $cfg->getEnableAnchors()));
             // add int link parts
             include_once "./Services/Link/classes/class.ilInternalLinkGUI.php";
             $tpl->setCurrentBlock("int_link_prep");
             $tpl->setVariable("INT_LINK_PREP", ilInternalLinkGUI::getInitHTML($ilCtrl->getLinkTargetByClass(array("ilpageeditorgui", "ilinternallinkgui"), "", false, true, false)));
             $tpl->parseCurrentBlock();
             include_once "./Services/YUI/classes/class.ilYuiUtil.php";
             ilYuiUtil::initConnection();
             $GLOBALS["tpl"]->addJavaScript("./Services/UIComponent/Explorer/js/ilExplorer.js");
         }
         // multiple actions
         $cnt_pcs = $this->getPageObject()->countPageContents();
         if ($cnt_pcs > 1 || $this->getPageObject()->getParentType() != "qpl" && $cnt_pcs > 0) {
             $tpl->setCurrentBlock("multi_actions");
             if ($sel_js_mode == "enable") {
                 $tpl->setVariable("ONCLICK_DE_ACTIVATE_SELECTED", 'onclick="return ilEditMultiAction(\'activateSelected\');"');
                 $tpl->setVariable("ONCLICK_DELETE_SELECTED", 'onclick="return ilEditMultiAction(\'deleteSelected\');"');
                 $tpl->setVariable("ONCLICK_ASSIGN_CHARACTERISTIC", 'onclick="return ilEditMultiAction(\'assignCharacteristicForm\');"');
                 $tpl->setVariable("ONCLICK_COPY_SELECTED", 'onclick="return ilEditMultiAction(\'copySelected\');"');
                 $tpl->setVariable("ONCLICK_CUT_SELECTED", 'onclick="return ilEditMultiAction(\'cutSelected\');"');
                 $tpl->setVariable("TXT_SELECT_ALL", $this->lng->txt("select_all"));
                 $tpl->setVariable("ONCLICK_SELECT_ALL", 'onclick="return ilEditMultiAction(\'selectAll\');"');
             }
             $tpl->setVariable("TXT_DE_ACTIVATE_SELECTED", $this->lng->txt("cont_ed_enable"));
             $tpl->setVariable("TXT_ASSIGN_CHARACTERISTIC", $this->lng->txt("cont_assign_characteristic"));
             $tpl->setVariable("TXT_DELETE_SELECTED", $this->lng->txt("cont_delete_selected"));
             $tpl->setVariable("TXT_COPY_SELECTED", $this->lng->txt("copy"));
             $tpl->setVariable("TXT_CUT_SELECTED", $this->lng->txt("cut"));
             $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg"));
             $tpl->parseCurrentBlock();
         }
     } else {
         // presentation or preview here
         $tpl = new ilTemplate("tpl.page.html", true, true, "Services/COPage");
         if ($this->getEnabledPageFocus()) {
             $tpl->touchBlock("page_focus");
         }
         include_once "./Services/User/classes/class.ilUserUtil.php";
         // presentation
         if ($this->isPageContainerToBeRendered()) {
             $tpl->touchBlock("page_container_1");
             $tpl->touchBlock("page_container_2");
             $tpl->touchBlock("page_container_3");
         }
         // history
         $c_old_nr = $this->getPageObject()->old_nr;
         if ($c_old_nr > 0 || $this->getCompareMode() || $_GET["history_mode"] == 1) {
             $hist_info = $this->getPageObject()->getHistoryInfo($c_old_nr);
             if (!$this->getCompareMode()) {
                 $ilCtrl->setParameter($this, "history_mode", "1");
                 // previous revision
                 if (is_array($hist_info["previous"])) {
                     $tpl->setCurrentBlock("previous_rev");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["previous"]["nr"]);
                     $tpl->setVariable("HREF_PREV", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 } else {
                     $tpl->setCurrentBlock("previous_rev_disabled");
                     $tpl->setVariable("TXT_PREV_REV", $lng->txt("cont_previous_rev"));
                     $tpl->parseCurrentBlock();
                 }
                 // next revision
                 if ($c_old_nr > 0) {
                     $tpl->setCurrentBlock("next_rev");
                     $tpl->setVariable("TXT_NEXT_REV", $lng->txt("cont_next_rev"));
                     $ilCtrl->setParameter($this, "old_nr", $hist_info["next"]["nr"]);
                     $tpl->setVariable("HREF_NEXT", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                     // latest revision
                     $tpl->setCurrentBlock("latest_rev");
                     $tpl->setVariable("TXT_LATEST_REV", $lng->txt("cont_latest_rev"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("HREF_LATEST", $ilCtrl->getLinkTarget($this, "preview"));
                     $tpl->parseCurrentBlock();
                 }
                 $ilCtrl->setParameter($this, "history_mode", "");
                 // rollback
                 if ($c_old_nr > 0 && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $tpl->setCurrentBlock("rollback");
                     $ilCtrl->setParameter($this, "old_nr", $c_old_nr);
                     $tpl->setVariable("HREF_ROLLBACK", $ilCtrl->getLinkTarget($this, "rollbackConfirmation"));
                     $ilCtrl->setParameter($this, "old_nr", "");
                     $tpl->setVariable("TXT_ROLLBACK", $lng->txt("cont_rollback"));
                     $tpl->parseCurrentBlock();
                 }
             }
             $tpl->setCurrentBlock("hist_nav");
             $tpl->setVariable("TXT_REVISION", $lng->txt("cont_revision"));
             $tpl->setVariable("VAL_REVISION_DATE", ilDatePresentation::formatDate(new ilDateTime($hist_info["current"]["hdate"], IL_CAL_DATETIME)));
             $tpl->setVariable("VAL_REV_USER", ilUserUtil::getNamePresentation($hist_info["current"]["user_id"]));
             $tpl->parseCurrentBlock();
         }
     }
     if ($this->getOutputMode() != IL_PAGE_PRESENTATION && $this->getOutputMode() != IL_PAGE_OFFLINE && $this->getOutputMode() != IL_PAGE_PREVIEW && $this->getOutputMode() != IL_PAGE_PRINT) {
         $tpl->setVariable("FORMACTION", $this->ctrl->getFormActionByClass("ilpageeditorgui"));
     }
     // output media object edit list (of media links)
     if ($this->getOutputMode() == "edit") {
         $links = ilInternalLink::_getTargetsOfSource($this->obj->getParentType() . ":pg", $this->obj->getId(), $this->obj->getLanguage());
         $mob_links = array();
         foreach ($links as $link) {
             if ($link["type"] == "mob") {
                 if (ilObject::_exists($link["id"]) && ilObject::_lookupType($link["id"]) == "mob") {
                     $mob_links[$link["id"]] = ilObject::_lookupTitle($link["id"]) . " [" . $link["id"] . "]";
                 }
             }
         }
         // linked media objects
         if (count($mob_links) > 0) {
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_LINKED_MOBS", $this->lng->txt("cont_linked_mobs"));
             $tpl->setVariable("SEL_MED_LINKS", ilUtil::formSelect(0, "mob_id", $mob_links, false, true));
             $tpl->setVariable("TXT_EDIT_MEDIA", $this->lng->txt("cont_edit_mob"));
             $tpl->setVariable("TXT_COPY_TO_CLIPBOARD", $this->lng->txt("cont_copy_to_clipboard"));
             //$this->tpl->setVariable("TXT_COPY_TO_POOL", $this->lng->txt("cont_copy_to_mediapool"));
             $tpl->parseCurrentBlock();
         }
         // content snippets used
         include_once "./Services/COPage/classes/class.ilPCContentInclude.php";
         $snippets = ilPCContentInclude::collectContentIncludes($this->getPageObject(), $this->getPageObject()->getDomDoc());
         if (count($snippets) > 0) {
             foreach ($snippets as $s) {
                 include_once "./Modules/MediaPool/classes/class.ilMediaPoolPage.php";
                 $sn_arr[$s["id"]] = ilMediaPoolPage::lookupTitle($s["id"]);
             }
             $tpl->setCurrentBlock("med_link");
             $tpl->setVariable("TXT_CONTENT_SNIPPETS_USED", $this->lng->txt("cont_snippets_used"));
             $tpl->setVariable("SEL_SNIPPETS", ilUtil::formSelect(0, "ci_id", $sn_arr, false, true));
             $tpl->setVariable("TXT_SHOW_INFO", $this->lng->txt("cont_show_info"));
             $tpl->parseCurrentBlock();
         }
         // scheduled activation?
         if (!$this->getPageObject()->getActive() && $this->getPageObject()->getActivationStart() != "" && $this->getPageConfig()->getEnableScheduledActivation()) {
             $tpl->setCurrentBlock("activation_txt");
             $tpl->setVariable("TXT_SCHEDULED_ACTIVATION", $lng->txt("cont_scheduled_activation"));
             $tpl->setVariable("SA_FROM", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationStart(), IL_CAL_DATETIME)));
             $tpl->setVariable("SA_TO", ilDatePresentation::formatDate(new ilDateTime($this->getPageObject()->getActivationEnd(), IL_CAL_DATETIME)));
             $tpl->parseCurrentBlock();
         }
     }
     if ($_GET["reloadTree"] == "y") {
         $tpl->setCurrentBlock("reload_tree");
         if ($this->obj->getParentType() == "dbk") {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjdlbookgui", "explorer", "", false, false));
         } else {
             $tpl->setVariable("LINK_TREE", $this->ctrl->getLinkTargetByClass("ilobjlearningmodulegui", "explorer", "", false, false));
         }
         $tpl->parseCurrentBlock();
     }
     //		}
     // get content
     $builded = $this->obj->buildDom();
     // manage hierarchical ids
     if ($this->getOutputMode() == "edit") {
         // add pc ids, if necessary
         if (!$this->obj->checkPCIds()) {
             $this->obj->insertPCIds();
             $this->obj->update(true, true);
         }
         $this->obj->addFileSizes();
         $this->obj->addHierIDs();
         $hids = $this->obj->getHierIds();
         $row1_ids = $this->obj->getFirstRowIds();
         $col1_ids = $this->obj->getFirstColumnIds();
         $litem_ids = $this->obj->getListItemIds();
         $fitem_ids = $this->obj->getFileItemIds();
         // standard menues
         $hids = $this->obj->getHierIds();
         foreach ($hids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_" . $hid);
             $tpl->parseCurrentBlock();
         }
         // column menues for tables
         foreach ($col1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_r" . $hid);
             $tpl->parseCurrentBlock();
         }
         // row menues for tables
         foreach ($row1_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_c" . $hid);
             $tpl->parseCurrentBlock();
         }
         // list item menues
         foreach ($litem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
         // file item menues
         foreach ($fitem_ids as $hid) {
             $tpl->setCurrentBlock("add_dhtml");
             $tpl->setVariable("CONTEXTMENU", "contextmenu_i" . $hid);
             $tpl->parseCurrentBlock();
         }
     } else {
         $this->obj->addFileSizes();
     }
     //echo "<br>-".htmlentities($this->obj->getXMLContent())."-<br><br>";
     //echo "<br>-".htmlentities($this->getLinkXML())."-";
     // set default link xml, if nothing was set yet
     if (!$this->link_xml_set) {
         $this->setDefaultLinkXml();
     }
     //$content = $this->obj->getXMLFromDom(false, true, true,
     //	$this->getLinkXML().$this->getQuestionXML().$this->getComponentPluginsXML());
     $link_xml = $this->getLinkXML();
     // disable/enable auto margins
     if ($this->getStyleId() > 0) {
         if (ilObject::_lookupType($this->getStyleId()) == "sty") {
             include_once "./Services/Style/classes/class.ilObjStyleSheet.php";
             $style = new ilObjStyleSheet($this->getStyleId());
             $template_xml = $style->getTemplateXML();
             $disable_auto_margins = "n";
             if ($style->lookupStyleSetting("disable_auto_margins")) {
                 $disable_auto_margins = "y";
             }
         }
     }
     if ($this->getAbstractOnly()) {
         $content = "<dummy><PageObject><PageContent><Paragraph>" . $this->obj->getFirstParagraphText() . $link_xml . "</Paragraph></PageContent></PageObject></dummy>";
     } else {
         $content = $this->obj->getXMLFromDom(false, true, true, $link_xml . $this->getQuestionXML() . $template_xml . $this->getComponentPluginsXML());
     }
     // check validation errors
     if ($builded !== true) {
         $this->displayValidationError($builded);
     } else {
         $this->displayValidationError($_SESSION["il_pg_error"]);
     }
     unset($_SESSION["il_pg_error"]);
     if (isset($_SESSION["citation_error"])) {
         ilUtil::sendFailure($this->lng->txt("cont_citation_selection_not_valid"));
         ilSession::clear("citation_error");
     }
     // get title
     $pg_title = $this->getPresentationTitle();
     $col_path = ilUtil::getImagePath("col.svg");
     $row_path = ilUtil::getImagePath("row.svg");
     $item_path = ilUtil::getImagePath("item.svg");
     if ($this->getOutputMode() != "offline") {
         $enlarge_path = ilUtil::getImagePath("enlarge.svg");
         $wb_path = ilUtil::getWebspaceDir("output") . "/";
     } else {
         $enlarge_path = "images/enlarge.svg";
         $wb_path = "";
     }
     $pg_title_class = $this->getOutputMode() == "print" ? "ilc_PrintPageTitle" : "";
     // page splitting only for learning modules and
     // digital books
     $enable_split_new = $this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk" ? "y" : "n";
     // page splitting to next page only for learning modules and
     // digital books if next page exists in tree
     if (($this->obj->getParentType() == "lm" || $this->obj->getParentType() == "dbk") && ilObjContentObject::hasSuccessorPage($this->obj->getParentId(), $this->obj->getId())) {
         $enable_split_next = "y";
     } else {
         $enable_split_next = "n";
     }
     $img_path = ilUtil::getImagePath("", false, $this->getOutputMode(), $this->getOutputMode() == "offline");
     if ($this->getPageConfig()->getEnablePCType("Tabs")) {
         //include_once("./Services/YUI/classes/class.ilYuiUtil.php");
         //ilYuiUtil::initTabView();
         include_once "./Services/Accordion/classes/class.ilAccordionGUI.php";
         ilAccordionGUI::addJavaScript();
         ilAccordionGUI::addCss();
     }
     $file_download_link = $this->determineFileDownloadLink();
     $fullscreen_link = $this->determineFullscreenLink();
     $this->sourcecode_download_script = $this->determineSourcecodeDownloadScript();
     // default values for various parameters (should be used by
     // all instances in the future)
     $media_mode = $this->getOutputMode() == "edit" ? $ilUser->getPref("ilPageEditor_MediaMode") : "enable";
     include_once "./Modules/LearningModule/classes/class.ilEditClipboard.php";
     $paste = ilEditClipboard::getAction() == "copy" && $this->getOutputMode() == "edit";
     include_once "./Services/MediaObjects/classes/class.ilPlayerUtil.php";
     $flv_video_player = $this->getOutputMode() != "offline" ? ilPlayerUtil::getFlashVideoPlayerFilename(true) : ilPlayerUtil::getFlashVideoPlayerFilename(true);
     $cfg = $this->getPageConfig();
     // added UTF-8 encoding otherwise umlaute are converted too
     include_once "./Services/Maps/classes/class.ilMapUtil.php";
     $params = array('mode' => $this->getOutputMode(), 'pg_title' => htmlentities($pg_title, ENT_QUOTES, "UTF-8"), 'enable_placeholder' => $cfg->getEnablePCType("PlaceHolder") ? "y" : "n", 'pg_id' => $this->obj->getId(), 'pg_title_class' => $pg_title_class, 'webspace_path' => $wb_path, 'enlarge_path' => $enlarge_path, 'img_col' => $col_path, 'img_row' => $row_path, 'img_item' => $item_path, 'enable_split_new' => $enable_split_new, 'enable_split_next' => $enable_split_next, 'link_params' => $this->link_params, 'file_download_link' => $file_download_link, 'fullscreen_link' => $fullscreen_link, 'img_path' => $img_path, 'parent_id' => $this->obj->getParentId(), 'download_script' => $this->sourcecode_download_script, 'encoded_download_script' => urlencode($this->sourcecode_download_script), 'bib_id' => $this->getBibId(), 'citation' => (int) $this->isEnabledCitation(), 'pagebreak' => $this->lng->txt('dgl_pagebreak'), 'page' => $this->lng->txt('page'), 'citate_page' => $this->lng->txt('citate_page'), 'citate_from' => $this->lng->txt('citate_from'), 'citate_to' => $this->lng->txt('citate_to'), 'citate' => $this->lng->txt('citate'), 'enable_rep_objects' => $cfg->getEnablePCType("Resources") ? "y" : "n", 'enable_login_page' => $cfg->getEnablePCType("LoginPageElement") ? "y" : "n", 'enable_map' => $cfg->getEnablePCType("Map") && ilMapUtil::isActivated() ? "y" : "n", 'enable_tabs' => $cfg->getEnablePCType("Tabs") ? "y" : "n", 'enable_sa_qst' => $cfg->getEnableSelfAssessment() ? "y" : "n", 'enable_file_list' => $cfg->getEnablePCType("FileList") ? "y" : "n", 'enable_content_includes' => $cfg->getEnablePCType("ContentInclude") ? "y" : "n", 'enable_content_templates' => count($this->getPageObject()->getContentTemplates()) > 0 ? "y" : "n", 'paste' => $paste ? "y" : "n", 'media_mode' => $media_mode, 'javascript' => $sel_js_mode, 'paragraph_plugins' => $paragraph_plugin_string, 'disable_auto_margins' => $disable_auto_margins, 'page_toc' => $cfg->getEnablePageToc() ? "y" : "n", 'enable_profile' => $cfg->getEnablePCType("Profile") ? "y" : "n", 'enable_verification' => $cfg->getEnablePCType("Verification") ? "y" : "n", 'enable_blog' => $cfg->getEnablePCType("Blog") ? "y" : "n", 'enable_skills' => $cfg->getEnablePCType("Skills") ? "y" : "n", 'enable_qover' => $cfg->getEnablePCType("QuestionOverview") ? "y" : "n", 'enable_consultation_hours' => $cfg->getEnablePCType("ConsultationHours") ? "y" : "n", 'enable_my_courses' => $cfg->getEnablePCType("MyCourses") ? "y" : "n", 'enable_amd_page_list' => $cfg->getEnablePCType("AMDPageList") ? "y" : "n", 'flv_video_player' => $flv_video_player);
     if ($this->link_frame != "") {
         // todo other link types
         $params["pg_frame"] = $this->link_frame;
     }
     //$content = str_replace("&nbsp;", "", $content);
     // this ensures that cache is emptied with every update
     $params["version"] = ILIAS_VERSION;
     // ensure no cache hit, if included files/media objects have been changed
     $params["incl_elements_date"] = $this->obj->getLastUpdateOfIncludedElements();
     // run xslt
     $md5 = md5(serialize($params) . $link_xml . $template_xml);
     //$a = microtime();
     // check cache (same parameters, non-edit mode and rendered time
     // > last change
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "presentation") && !$this->getCompareMode() && !$this->getAbstractOnly() && $md5 == $this->obj->getRenderMd5() && $this->obj->getLastChange() < $this->obj->getRenderedTime() && $this->obj->getRenderedTime() != "" && $this->obj->old_nr == 0) {
         // cache hit
         $output = $this->obj->getRenderedContent();
     } else {
         $xsl = file_get_contents("./Services/COPage/xsl/page.xsl");
         $args = array('/_xml' => $content, '/_xsl' => $xsl);
         $xh = xslt_create();
         //		echo "<b>XSLT</b>:".htmlentities($xsl).":<br>";
         //		echo "mode:".$this->getOutputMode().":<br>";
         $output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, $params);
         if (($this->getOutputMode() == "presentation" || $this->getOutputMode() == "preview") && !$this->getAbstractOnly() && $this->obj->old_nr == 0) {
             //echo "writerenderedcontent";
             $this->obj->writeRenderedContent($output, $md5);
         }
         //echo xslt_error($xh);
         xslt_free($xh);
     }
     //$b = microtime();
     //echo "$a - $b";
     //echo "<pre>".htmlentities($output)."</pre>";
     // unmask user html
     if (($this->getOutputMode() != "edit" || $ilUser->getPref("ilPageEditor_HTMLMode") != "disable") && !$this->getPageConfig()->getPreventHTMLUnmasking()) {
         $output = str_replace("&lt;", "<", $output);
         $output = str_replace("&gt;", ">", $output);
     }
     $output = str_replace("&amp;", "&", $output);
     $output = ilUtil::insertLatexImages($output);
     // insert page snippets
     $output = $this->insertContentIncludes($output);
     // insert resource blocks
     $output = $this->insertResources($output);
     // insert page toc
     if ($this->getPageConfig()->getEnablePageToc()) {
         $output = $this->insertPageToc($output);
     }
     // insert advanced output trigger
     $output = $this->insertAdvTrigger($output);
     // workaround for preventing template engine
     // from hiding paragraph text that is enclosed
     // in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
     $output = $this->replaceCurlyBrackets($output);
     // remove all newlines (important for code / pre output)
     $output = str_replace("\n", "", $output);
     //echo htmlentities($output);
     $output = $this->postOutputProcessing($output);
     //echo htmlentities($output);
     if ($this->getOutputMode() == "edit" && !$this->getPageObject()->getActive($this->getPageConfig()->getEnableScheduledActivation())) {
         $output = '<div class="il_editarea_disabled">' . $output . '</div>';
     }
     // for all page components...
     include_once "./Services/COPage/classes/class.ilCOPagePCDef.php";
     $defs = ilCOPagePCDef::getPCDefinitions();
     foreach ($defs as $def) {
         ilCOPagePCDef::requirePCClassByName($def["name"]);
         $pc_class = $def["pc_class"];
         $pc_obj = new $pc_class($this->getPageObject());
         // post xsl page content modification by pc elements
         $output = $pc_obj->modifyPageContentPostXsl($output, $this->getOutputMode());
         // javascript files
         $js_files = $pc_obj->getJavascriptFiles($this->getOutputMode());
         foreach ($js_files as $js) {
             $GLOBALS["tpl"]->addJavascript($js);
         }
         // css files
         $css_files = $pc_obj->getCssFiles($this->getOutputMode());
         foreach ($css_files as $css) {
             $GLOBALS["tpl"]->addCss($css);
         }
         // onload code
         $onload_code = $pc_obj->getOnloadCode($this->getOutputMode());
         foreach ($onload_code as $code) {
             $GLOBALS["tpl"]->addOnloadCode($code);
         }
     }
     //		$output = $this->selfAssessmentRendering($output);
     // output
     if ($ilCtrl->isAsynch() && !$this->getRawPageContent() && $this->getOutputMode() == "edit") {
         // e.g. ###3:110dad8bad6df8620071a0a693a2d328###
         if ($_GET["updated_pc_id_str"] != "") {
             echo $_GET["updated_pc_id_str"];
         }
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $tpl->setCurrentBlock("edit_page");
         $tpl->parseCurrentBlock();
         echo $tpl->get("edit_page");
         exit;
     }
     if ($this->outputToTemplate()) {
         $tpl->setVariable($this->getTemplateOutputVar(), $output);
         $this->tpl->setVariable($this->getTemplateTargetVar(), $tpl->get());
         return $output;
     } else {
         if ($this->getRawPageContent()) {
             return $output;
         } else {
             $tpl->setVariable($this->getTemplateOutputVar(), $output);
             return $tpl->get();
         }
     }
 }
예제 #7
0
 /**
  * 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"));
 }
 /**
  *
  */
 private function showManScoringByQuestionParticipantsTable($manPointsPost = array())
 {
     /**
      * @var $tpl      ilTemplate
      * @var $ilAccess ilAccessHandler
      */
     global $tpl, $ilAccess;
     if (!$ilAccess->checkAccess('write', '', $this->ref_id)) {
         ilUtil::sendInfo($this->lng->txt('cannot_edit_test'), true);
         $this->ctrl->redirectByClass('ilobjtestgui', 'infoScreen');
     }
     include_once 'Services/jQuery/classes/class.iljQueryUtil.php';
     iljQueryUtil::initjQuery();
     include_once 'Services/YUI/classes/class.ilYuiUtil.php';
     ilYuiUtil::initPanel();
     ilYuiUtil::initOverlay();
     $mathJaxSetting = new ilSetting('MathJax');
     if ($mathJaxSetting->get("enable")) {
         $tpl->addJavaScript($mathJaxSetting->get("path_to_mathjax"));
     }
     $tpl->addJavascript('./Services/UIComponent/Overlay/js/ilOverlay.js');
     $tpl->addJavaScript("./Services/JavaScript/js/Basic.js");
     $tpl->addJavaScript("./Services/Form/js/Form.js");
     $tpl->addCss($this->object->getTestStyleLocation("output"), "screen");
     require_once 'Modules/Test/classes/tables/class.ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI.php';
     $table = new ilTestManScoringParticipantsBySelectedQuestionAndPassTableGUI($this);
     $table->setManualScoringPointsPostData($manPointsPost);
     $qst_id = $table->getFilterItemByPostVar('question')->getValue();
     $pass_id = $table->getFilterItemByPostVar('pass')->getValue();
     $table_data = array();
     $selected_questionData = null;
     if (is_numeric($qst_id)) {
         $scoring = ilObjAssessmentFolder::_getManualScoring();
         $info = assQuestion::_getQuestionInfo($qst_id);
         $selected_questionData = $info;
         $type = $info["question_type_fi"];
         if (in_array($type, $scoring)) {
             $selected_questionData = $info;
         }
     }
     if ($selected_questionData && is_numeric($pass_id)) {
         $data = $this->object->getCompleteEvaluationData(FALSE);
         foreach ($data->getParticipants() as $active_id => $participant) {
             $testResultData = $this->object->getTestResult($active_id, $pass_id - 1);
             foreach ($testResultData as $questionData) {
                 if (!isset($questionData['qid']) || $questionData['qid'] != $selected_questionData['question_id']) {
                     continue;
                 }
                 $table_data[] = array('pass_id' => $pass_id - 1, 'active_id' => $active_id, 'qst_id' => $questionData['qid'], 'reached_points' => assQuestion::_getReachedPoints($active_id, $questionData['qid'], $pass_id - 1), 'maximum_points' => assQuestion::_getMaximumPoints($questionData['qid']), 'participant' => $participant);
             }
         }
     } else {
         $table->disable('header');
     }
     if ($selected_questionData) {
         $maxpoints = assQuestion::_getMaximumPoints($selected_questionData['question_id']);
         if ($maxpoints == 1) {
             $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('point') . ')';
         } else {
             $maxpoints = ' (' . $maxpoints . ' ' . $this->lng->txt('points') . ')';
         }
         $table->setTitle($this->lng->txt('tst_man_scoring_by_qst') . ': ' . $selected_questionData['title'] . $maxpoints . ' [' . $this->lng->txt('question_id_short') . ': ' . $selected_questionData['question_id'] . ']');
     } else {
         $table->setTitle($this->lng->txt('tst_man_scoring_by_qst'));
     }
     $table->setData($table_data);
     $tpl->setContent($table->getHTML());
 }
예제 #9
0
 /**
  * Init javascript
  */
 function initJavascript($a_ajax_url)
 {
     global $tpl;
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initPanel();
     include_once "./Services/jQuery/classes/class.iljQueryUtil.php";
     iljQueryUtil::initjQuery();
     $tpl->addJavascript("./Services/Notes/js/ilNotes.js");
     $tpl->addOnLoadCode("ilNotes.setAjaxUrl('" . $a_ajax_url . "');");
 }
 /**
  * Edit data of table
  */
 function editData()
 {
     global $lng, $ilCtrl;
     if (!ilPageEditorGUI::_doJSEditing()) {
         return $this->editDataCl();
     }
     //var_dump($_GET);
     //var_dump($_POST);
     $this->setTabs();
     $this->displayValidationError();
     include_once "./Services/COPage/classes/class.ilPCParagraph.php";
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
     $dtpl = $this->tpl;
     //$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
     $dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
     //		$dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
     //		$this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
     //		$this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
     $this->tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this, "updateJS"));
     // get all rows
     $xpc = xpath_new_context($this->dom);
     $path = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $xpc2 = xpath_new_context($this->dom);
         $path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow[{$i}+1]/TableData";
         $res2 =& xpath_eval($xpc2, $path2);
         // if this is the first row -> col icons
         if ($i == 0) {
             for ($j = 0; $j < count($res2->nodeset); $j++) {
                 if ($j == 0) {
                     $dtpl->touchBlock("empty_td");
                 }
                 if ($j == 0) {
                     if (count($res2->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($j == count($res2->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("col_icon");
                 $dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
                 $dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
                 $dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type);
                 $dtpl->setVariable("NR", $j);
                 $dtpl->parseCurrentBlock();
             }
             $dtpl->setCurrentBlock("row");
             $dtpl->parseCurrentBlock();
         }
         for ($j = 0; $j < count($res2->nodeset); $j++) {
             // first col: row icons
             if ($j == 0) {
                 if ($i == 0) {
                     if (count($res->nodeset) == 1) {
                         $move_type = "none";
                     } else {
                         $move_type = "forward";
                     }
                 } else {
                     if ($i == count($res->nodeset) - 1) {
                         $move_type = "backward";
                     } else {
                         $move_type = "both";
                     }
                 }
                 $dtpl->setCurrentBlock("row_icon");
                 $dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
                 $dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
                 $dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type);
                 $dtpl->setVariable("NR", $i);
                 $dtpl->parseCurrentBlock();
             }
             // cell
             if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
                 $dtpl->setCurrentBlock("cell");
                 if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
                     $s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
                 } else {
                     $s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j), true, false);
                     include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
                     $s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent", $this->content_obj->readPCId() . "_" . $i . "_" . $j);
                 }
                 $dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
                 $dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
                 $dtpl->setVariable("PAR_TA_CONTENT", $s_text);
                 $cs = $res2->nodeset[$j]->get_attribute("ColSpan");
                 $rs = $res2->nodeset[$j]->get_attribute("RowSpan");
                 $dtpl->setVariable("WIDTH", "140");
                 $dtpl->setVariable("HEIGHT", "80");
                 if ($cs > 1) {
                     $dtpl->setVariable("COLSPAN", 'colspan="' . $cs . '"');
                     $dtpl->setVariable("WIDTH", 140 + ($cs - 1) * 146);
                 }
                 if ($rs > 1) {
                     $dtpl->setVariable("ROWSPAN", 'rowspan="' . $rs . '"');
                     $dtpl->setVariable("HEIGHT", 80 + ($rs - 1) * 86);
                 }
                 $dtpl->parseCurrentBlock();
             }
         }
         $dtpl->setCurrentBlock("row");
         $dtpl->parseCurrentBlock();
     }
     // init menues
     $types = array("row", "col");
     $moves = array("none", "backward", "both", "forward");
     $commands = array("row" => array("newRowAfter" => "cont_ed_new_row_after", "newRowBefore" => "cont_ed_new_row_before", "moveRowUp" => "cont_ed_row_up", "moveRowDown" => "cont_ed_row_down", "deleteRow" => "cont_ed_delete_row"), "col" => array("newColAfter" => "cont_ed_new_col_after", "newColBefore" => "cont_ed_new_col_before", "moveColLeft" => "cont_ed_col_left", "moveColRight" => "cont_ed_col_right", "deleteCol" => "cont_ed_delete_col"));
     foreach ($types as $type) {
         foreach ($moves as $move) {
             foreach ($commands[$type] as $command => $lang_var) {
                 if ($move == "none" && substr($command, 0, 4) == "move") {
                     continue;
                 }
                 if ($move == "backward" && in_array($command, array("movedown", "moveright")) || $move == "forward" && in_array($command, array("moveup", "moveleft"))) {
                     continue;
                 }
                 $this->tpl->setCurrentBlock("menu_item");
                 $this->tpl->setVariable("MENU_ITEM_TITLE", $lng->txt($lang_var));
                 $this->tpl->setVariable("CMD", $command);
                 $this->tpl->setVariable("TYPE", $type);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("menu");
             $this->tpl->setVariable("TYPE", $type);
             $this->tpl->setVariable("MOVE", $move);
             $this->tpl->parseCurrentBlock();
         }
     }
     $this->tpl->setVariable("FORMACTION2", $ilCtrl->getFormAction($this, "tableAction"));
     $this->tpl->setVariable("TXT_ACTION", $this->lng->txt("cont_table"));
     // js editing preparation
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initDragDrop();
     ilYuiUtil::initConnection();
     ilYuiUtil::initPanel(false);
     $GLOBALS["tpl"]->addJavascript("Services/RTE/tiny_mce_3_3_9_2/il_tiny_mce_src.js");
     $GLOBALS["tpl"]->addJavaScript("./Services/COPage/js/ilcopagecallback.js");
     $GLOBALS["tpl"]->addJavascript("Services/COPage/js/page_editing.js");
     $GLOBALS["tpl"]->addOnloadCode("var preloader = new Image();\n\t\t\tpreloader.src = './templates/default/images/loader.gif';\n\t\t\tilCOPage.setContentCss('" . ilObjStyleSheet::getContentStylePath((int) $this->getStyleId()) . ", " . ilUtil::getStyleSheetLocation() . ", ./Services/COPage/css/tiny_extra.css');\n\t\t\tilCOPage.editTD('cell_0_0');\n\t\t\t\t");
     $this->tpl->setVariable("IL_TINY_MENU", ilPageObjectGUI::getTinyMenu($this->pg_obj->getParentType(), false, $this->pg_obj->getParentType() == "wpg", false, $this->getStyleId(), false, true));
 }
 /**
  * Fills the table with data for whole week.
  */
 public function show($export = false)
 {
     if ($export && isset($_SESSION['weeklySeed'])) {
         $this->seed = $_SESSION['weeklySeed'];
     } else {
         $_SESSION['weeklySeed'] = $this->seed;
     }
     if (!$this->permission->checkPrivilege(PRIVC::SEE_BOOKINGS_OF_ROOMS)) {
         ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action"));
         $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary');
         return false;
     }
     global $ilUser;
     $this->setSubTabs('weekview');
     //intervalsize
     $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.room_week_view.html', true, true, 'Customizing/global/plugins/Services/Repository/RepositoryObject/RoomSharing');
     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;
     }
     $room = new ilRoomSharingRoom($this->pool_id, $this->room_id);
     $this->tpl->setVariable('ROOM', $this->lng->txt('rep_robj_xrs_room_occupation_title') . " " . $room->getName());
     $this->scheduler = new ilRoomSharingCalendarSchedule($this->seed, ilCalendarSchedule::TYPE_WEEK, $user_id, $room);
     $this->scheduler->addSubitemCalendars(true);
     $this->scheduler->calculate();
     $counter = 0;
     $hours = NULL;
     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);
         $counter++;
     }
     $colspans = $this->calculateColspans($hours);
     $settings = ilCalendarSettings::_getInstance();
     $exportLink = $this->ctrl->getLinkTargetByClass("ilroomsharingcalendarweekgui", "export");
     $this->tpl->setCurrentBlock("export_block");
     $this->tpl->setVariable('EXPORT_LINK', $exportLink);
     $this->tpl->parseCurrentBlock();
     // 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));
         $dayname = ilCalendarUtil::_numericDayToString($date->get(IL_CAL_FKT_DATE, 'w'), true);
         $this->days[$counter] = $date;
         $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++;
     }
     $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;
                     $this->timeIntervals[] = $hours_per_day[2];
                     // 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
             $userCanAddBooking = $this->permission->checkPrivilege(PRIVC::ADD_OWN_BOOKINGS);
             $calStuffAllowed = !$hour['apps_num'] && !$ilUser->prefs["screen_reader_optimization"] && !$no_add;
             if ($userCanAddBooking && $calStuffAllowed) {
                 $this->tpl->setCurrentBlock('new_app_link');
                 $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->lng->txt('rep_robj_xrs_room_book'));
                 $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'room', $room->getName());
                 $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'room_id', $room->getId());
                 $_SESSION['last_cmd'] = 'showroom';
                 $date = $this->weekdays[$num_day]->get(IL_CAL_DATE);
                 //convert time into suitable format (HH:ii:ss)
                 $hr = floor($num_hour / 60);
                 $hr = $hr < 10 ? "0" . $hr : $hr;
                 $hr_end = floor(($num_hour + 60) / 60);
                 $hr_end = $hr_end < 10 ? "0" . $hr_end : $hr_end;
                 $min = floor($num_hour % 60);
                 $min = $min < 10 ? "0" . $min : $min;
                 $min_end = floor(($num_hour + 60) % 60);
                 $min_end = $min_end < 10 ? "0" . $min_end : $min_end;
                 $time_from = $hr . ":" . $min . ":00";
                 $time_to = $hr_end . ":" . $min_end . ":00";
                 $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'date', $date);
                 $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'time_from', $time_from);
                 $this->ctrl->setParameterByClass('ilobjroomsharinggui', 'time_to', $time_to);
                 $this->tpl->setVariable('DAY_NEW_APP_LINK', $this->ctrl->getLinkTargetByClass('ilobjroomsharinggui', 'book'));
                 // free the parameters
                 $this->ctrl->clearParametersByClass('ilobjroomsharinggui');
                 $this->tpl->setVariable('DAY_NEW_APP_SRC', ilUtil::getImagePath('date_add.png'));
                 $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", $this->lng->txt("time"));
     if ($export) {
         $this->export();
     }
 }
예제 #12
0
 /**
  * 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();
         }
     }
 }
 /**
  * Render item
  */
 function render($a_mode = "property_form")
 {
     global $lng, $ilCtrl, $ilObjDataCache, $tree;
     include_once "./Services/YUI/classes/class.ilYuiUtil.php";
     ilYuiUtil::initPanel();
     $GLOBALS["tpl"]->addJavascript("./Services/UIComponent/Explorer2/js/Explorer2.js");
     $tpl = new ilTemplate("tpl.prop_expl_select.html", true, true, "Services/UIComponent/Explorer2");
     // set values
     $val = $this->getValue();
     if (is_array($val)) {
         $val_txt = $sep = "";
         foreach ($val as $v) {
             $tpl->setCurrentBlock("node_hid");
             $tpl->setVariable("HID_NAME", $this->getPostVar() . "[]");
             $tpl->setVariable("HID_VAL", $v);
             $tpl->parseCurrentBlock();
             $val_txt .= $sep . $this->getTitleForNodeId($v);
             $sep = ", ";
             $this->explorer_gui->setNodeOpen($v);
             $this->explorer_gui->setNodeSelected($v);
         }
         $tpl->setVariable("VAL_TXT", $val_txt);
     } else {
         if ($val != "") {
             $tpl->setCurrentBlock("node_hid");
             $tpl->setVariable("HID_NAME", $this->getPostVar());
             $tpl->setVariable("HID_VAL", $val);
             $tpl->parseCurrentBlock();
             $tpl->setVariable("VAL_TXT", $this->getTitleForNodeId($val));
             $this->explorer_gui->setNodeOpen($val);
             $this->explorer_gui->setNodeSelected($val);
         }
     }
     $tpl->setVariable("POST_VAR", $this->getPostVar());
     $tpl->setVariable("ID", $this->getFieldId());
     //		$tpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
     $tpl->setVariable("TXT_SELECT", $lng->txt("select"));
     $tpl->setVariable("TXT_RESET", $lng->txt("reset"));
     $tpl->setVariable("EXPL", $this->explorer_gui->getHTML());
     $top_tb = new ilToolbarGUI();
     $top_tb->addButton($lng->txt("select"), "#", "", "", "", "", "submit ilExplSelectInputButS");
     $top_tb->addButton($lng->txt("cancel"), "#", "", "", "", "", "submit ilExplSelectInputButC");
     $tpl->setVariable("TOP_TB", $top_tb->getHTML());
     $tpl->setVariable("BOT_TB", $top_tb->getHTML());
     //$tpl->setVariable("HREF_SELECT",
     //	$ilCtrl->getLinkTargetByClass(array($parent_gui, "ilformpropertydispatchgui", "ilrepositoryselectorinputgui"),
     //	"showRepositorySelection"));
     /*if ($this->getValue() > 0 && $this->getValue() != ROOT_FOLDER_ID)
     		{
     			$tpl->setVariable("TXT_ITEM",
     				$ilObjDataCache->lookupTitle($ilObjDataCache->lookupObjId($this->getValue())));
     		}
     		else
     		{
     			$nd = $tree->getNodeData(ROOT_FOLDER_ID);
     			$title = $nd["title"];
     			if ($title == "ILIAS")
     			{
     				$title = $lng->txt("repository");
     			}
     			if (in_array($nd["type"], $this->getClickableTypes()))
     			{
     				$tpl->setVariable("TXT_ITEM", $title);
     			}
     		}*/
     return $tpl->get();
 }