/**
  * Returns an array containing all variables and values which can be exchanged in the certificate
  * The values should be calculated from real data. The $params parameter array should contain all
  * necessary information to calculate the values.
  *
  * @param array $params An array of parameters to calculate the certificate parameter values
  * @return array The certificate variables
  */
 public function getCertificateVariablesForPresentation($params = array())
 {
     global $lng;
     $lng->loadLanguageModule('certificate');
     $user_data = $params["user_data"];
     $vars = $this->getBaseVariablesForPresentation($user_data, $params["last_access"], null);
     $vars["SKILL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTitleForCertificate());
     $vars["SKILL_LEVEL_TITLE"] = ilUtil::prepareFormOutput($this->skill->getLevelTitleForCertificate($this->skill_level_id));
     $vars["SKILL_TRIGGER_TITLE"] = ilUtil::prepareFormOutput($this->skill->getTriggerTitleForCertificate($this->skill_level_id));
     // custom completion date
     $achievement_date = ilBasicSkill::lookupLevelAchievementDate($user_data["usr_id"], $this->skill_level_id);
     if ($achievement_date !== false) {
         $old = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($achievement_date, IL_CAL_DATETIME));
         $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($achievement_date, IL_CAL_DATETIME));
         ilDatePresentation::setUseRelativeDates($old);
     } else {
         $vars["DATE_COMPLETED"] = "";
         $vars["DATETIME_COMPLETED"] = "";
     }
     foreach ($vars as $id => $caption) {
         $insert_tags["[" . $id . "]"] = $caption;
     }
     return $insert_tags;
 }
 public function __construct($user_obj)
 {
     parent::__construct();
     $this->user_obj = $user_obj;
     $this->lng->loadLanguageModule('crs');
     ilDatePresentation::setUseRelativeDates(false);
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     $old_value = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $row['date'] = ilDatePresentation::formatDate(new ilDateTime($row['date'], IL_CAL_UNIX));
     ilDatePresentation::setUseRelativeDates($old_value);
     if (array_key_exists('percentage', $row)) {
         $row['percentage'] = sprintf('%.2f', $row['percentage']) . '%';
     }
     // fill columns
     if (!$this->isObjectiveOrientedPresentationEnabled()) {
         $this->tpl->setVariable('VAL_SCORED', $row['scored']);
         $this->tpl->setVariable('VAL_PASS', $row['pass']);
     }
     $this->tpl->setVariable('VAL_DATE', $row['date']);
     if ($this->isObjectiveOrientedPresentationEnabled()) {
         $this->tpl->setVariable('VAL_LO_OBJECTIVES', $row['objectives']);
         $this->tpl->setVariable('VAL_LO_TRY', sprintf($this->lng->txt('tst_res_lo_try_n'), $row['pass']));
     }
     $this->tpl->setVariable('VAL_ANSWERED', $row['answered']);
     if (isset($row['hints'])) {
         $this->tpl->setVariable('VAL_HINTS', $row['hints']);
     }
     $this->tpl->setVariable('VAL_REACHED', $row['reached']);
     $this->tpl->setVariable('VAL_PERCENTAGE', $row['percentage']);
     if (!$this->pdf_view) {
         $this->tpl->setVariable('VAL_PASS_DETAILS', $row['pass_details']);
     }
 }
 /**
  * send an advanced notification to the owner of the test
  * @param int $owner_id
  * @param string $title
  * @param sting $usr_data
  * @param array $file_names
  */
 public function sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
 {
     $this->initLanguage($owner_id);
     $this->language->loadLanguageModule('assessment');
     $this->initMail();
     $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
     $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('user_has_finished_a_test'));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('title') . ': ' . $title);
     $this->appendBody("\n");
     $this->appendBody($this->language->txt('username') . ': ' . $usr_data);
     $this->appendBody("\n");
     ilDatePresentation::setUseRelativeDates(false);
     $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('tst_attached_xls_file'));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
     $this->appendBody("\n");
     $this->setAttachments($file_names);
     $this->getMail()->appendInstallationSignature(true);
     $this->sendMail(array($owner_id), array('system'));
 }
 public function send()
 {
     global $lng;
     $additional_information = $this->getAdditionalInformation();
     $old_val = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     foreach ($this->getRecipients() as $rcp) {
         try {
             $this->handleCurrentRecipient($rcp);
         } catch (ilMailException $e) {
             continue;
         }
         $this->initMimeMail();
         $this->initLanguageByIso2Code();
         ilDatePresentation::setLanguage($this->getLanguage());
         $date_for_deletion = ilDatePresentation::formatDate(new ilDate($additional_information["date"], IL_CAL_UNIX));
         $this->setSubject($this->getLanguage()->txt('del_mail_subject'));
         $body = sprintf($this->getLanguage()->txt("del_mail_body"), $rcp->fullname, "\n\n", $additional_information["www"], $date_for_deletion);
         $this->appendBody($body);
         $this->appendBody(ilMail::_getInstallationSignature());
         $this->sendMimeMail($this->getCurrentRecipient());
     }
     ilDatePresentation::setUseRelativeDates($old_val);
     ilDatePresentation::setLanguage($lng);
 }
 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($a_set)
 {
     global $ilUser, $ilAccess;
     $this->tpl->setVariable('VAL_ID', $a_set['solution_id']);
     if (strlen($a_set['webpath'])) {
         $this->tpl->setVariable('VAL_FILE', '<a href="' . $a_set['webpath'] . $a_set['value1'] . '" target=\\"_blank\\">' . ilUtil::prepareFormOutput($a_set['value2']) . '</a>');
     } else {
         $this->tpl->setVariable('VAL_FILE', ilUtil::prepareFormOutput($a_set['value2']));
     }
     ilDatePresentation::setUseRelativeDates(false);
     $this->tpl->setVariable('VAL_DATE', ilDatePresentation::formatDate(new ilDateTime($a_set["tstamp"], IL_CAL_UNIX)));
 }
 /**
  * @param array $row
  */
 public function fillRow(array $row)
 {
     $old_value = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $row['date'] = ilDatePresentation::formatDate(new ilDateTime($row['date'], IL_CAL_UNIX));
     ilDatePresentation::setUseRelativeDates($old_value);
     if (array_key_exists('percentage', $row)) {
         $row['percentage'] = sprintf('%.2f', $row['percentage']) . '%';
     }
     if ($this->pdf_view && array_key_exists('pass_details', $row)) {
         unset($row['pass_details']);
     }
     parent::fillRow($row);
 }
 /**
  * Init attendance list object
  * 
  * @return ilAttendanceList 
  */
 protected function initAttendanceList()
 {
     $members_obj = $this->initContainer(true);
     include_once 'Services/Membership/classes/class.ilAttendanceList.php';
     $list = new ilAttendanceList($this, $members_obj);
     $list->setId('sessattlst');
     $event_app = $this->object->getFirstAppointment();
     ilDatePresentation::setUseRelativeDates(false);
     $desc = ilDatePresentation::formatPeriod($event_app->getStart(), $event_app->getEnd());
     ilDatePresentation::setUseRelativeDates(true);
     $desc .= " " . $this->object->getTitle();
     $list->setTitle($this->lng->txt('sess_attendance_list'), $desc);
     $list->addPreset('mark', $this->lng->txt('trac_mark'), true);
     $list->addPreset('comment', $this->lng->txt('trac_comment'), true);
     if ($this->object->enabledRegistration()) {
         $list->addPreset('registered', $this->lng->txt('event_tbl_registered'), true);
     }
     $list->addPreset('participated', $this->lng->txt('event_tbl_participated'), true);
     $list->addBlank($this->lng->txt('sess_signature'));
     $list->addUserFilter('registered', $this->lng->txt('event_list_registered_only'));
     return $list;
 }
 function fillRow($a_poll)
 {
     global $ilCtrl, $lng, $ilUser;
     // handle messages
     $mess = $this->poll_block->getMessage($ilUser->getId());
     if ($mess) {
         $this->tpl->setVariable("TXT_QUESTION", $mess);
         return;
     }
     // nested form problem
     if (!$_SESSION["il_cont_admin_panel"]) {
         // vote
         if ($this->poll_block->mayVote($ilUser->getId())) {
             $this->tpl->setCurrentBlock("answer");
             foreach ($a_poll->getAnswers() as $item) {
                 $this->tpl->setVariable("VALUE_ANSWER", $item["id"]);
                 $this->tpl->setVariable("TXT_ANSWER_VOTE", nl2br($item["answer"]));
                 $this->tpl->parseCurrentBlock();
             }
             $ilCtrl->setParameterByClass("ilobjpollgui", "ref_id", $this->getRefId());
             $url = $ilCtrl->getLinkTargetByClass(array("ilrepositorygui", "ilobjpollgui"), "vote");
             $ilCtrl->clearParametersByClass("ilobjpollgui");
             $url .= "#poll" . $a_poll->getID();
             $this->tpl->setVariable("URL_FORM", $url);
             $this->tpl->setVariable("CMD_FORM", "vote");
             $this->tpl->setVariable("TXT_SUBMIT", $lng->txt("poll_vote"));
         }
         // result
         if ($this->poll_block->maySeeResults($ilUser->getId())) {
             if (!$this->poll_block->mayNotResultsYet($ilUser->getId())) {
                 $perc = $this->poll_block->getPoll()->getVotePercentages();
                 $total = $perc["total"];
                 $perc = $perc["perc"];
                 $this->tpl->setVariable("TOTAL_ANSWERS", sprintf($lng->txt("poll_population"), $total));
                 $this->tpl->setCurrentBlock("answer_result");
                 foreach ($a_poll->getAnswers() as $item) {
                     $this->tpl->setVariable("TXT_ANSWER_RESULT", nl2br($item["answer"]));
                     $this->tpl->setVariable("PERC_ANSWER_RESULT", round($perc[$item["id"]]["perc"]));
                     $this->tpl->parseCurrentBlock();
                 }
             } else {
                 $rel = ilDatePresentation::useRelativeDates();
                 ilDatePresentation::setUseRelativeDates(false);
                 $end = $this->poll_block->getPoll()->getVotingPeriodEnd();
                 $end = ilDatePresentation::formatDate(new ilDateTime($end, IL_CAL_UNIX));
                 ilDatePresentation::setUseRelativeDates($rel);
                 $this->tpl->setVariable("TOTAL_ANSWERS", $lng->txt("poll_block_message_already_voted") . ' ' . sprintf($lng->txt("poll_block_results_available_on"), $end));
             }
         } else {
             if ($this->poll_block->getPoll()->hasUserVoted($ilUser->getId())) {
                 $this->tpl->setVariable("TOTAL_ANSWERS", $lng->txt("poll_block_message_already_voted"));
             }
         }
     }
     $this->tpl->setVariable("ANCHOR_ID", $a_poll->getID());
     $this->tpl->setVariable("TXT_QUESTION", nl2br(trim($a_poll->getQuestion())));
     $desc = trim($a_poll->getDescription());
     if ($desc) {
         $this->tpl->setVariable("TXT_DESC", nl2br($desc));
     }
     $img = $a_poll->getImageFullPath();
     if ($img) {
         $this->tpl->setVariable("URL_IMAGE", $img);
     }
 }
 /**
  * Export the user specific results for the survey
  *
  * Export the user specific results for the survey
  *
  * @access private
  */
 function exportUserSpecificResults($export_format, $export_label, $finished_ids)
 {
     global $ilLog;
     // #13620
     ilDatePresentation::setUseRelativeDates(false);
     $csvfile = array();
     $csvrow = array();
     $csvrow2 = array();
     $questions = array();
     $questions =& $this->object->getSurveyQuestions(true);
     array_push($csvrow, $this->lng->txt("lastname"));
     // #12756
     array_push($csvrow, $this->lng->txt("firstname"));
     array_push($csvrow, $this->lng->txt("login"));
     array_push($csvrow, $this->lng->txt('workingtime'));
     // #13622
     array_push($csvrow, $this->lng->txt('survey_results_finished'));
     array_push($csvrow2, "");
     array_push($csvrow2, "");
     array_push($csvrow2, "");
     array_push($csvrow2, "");
     array_push($csvrow2, "");
     if ($this->object->canExportSurveyCode()) {
         array_push($csvrow, $this->lng->txt("codes"));
         array_push($csvrow2, "");
     }
     /* #8211
     		if ($this->object->getAnonymize() == ilObjSurvey::ANONYMIZE_OFF)
     		{
     			array_push($csvrow, $this->lng->txt("gender"));
     		}		 
     	    */
     $cellcounter = 1;
     foreach ($questions as $question_id => $question_data) {
         include_once "./Modules/SurveyQuestionPool/classes/class.SurveyQuestion.php";
         $question = SurveyQuestion::_instanciateQuestion($question_data["question_id"]);
         switch ($export_label) {
             case "label_only":
                 $question->addUserSpecificResultsExportTitles($csvrow, true);
                 break;
             case "title_only":
                 $question->addUserSpecificResultsExportTitles($csvrow, false);
                 break;
             default:
                 $question->addUserSpecificResultsExportTitles($csvrow, false);
                 $question->addUserSpecificResultsExportTitles($csvrow2, true, false);
                 break;
         }
         $questions[$question_data["question_id"]] = $question;
     }
     array_push($csvfile, $csvrow);
     if (sizeof($csvrow2) && implode("", $csvrow2)) {
         array_push($csvfile, $csvrow2);
     }
     if (!$finished_ids) {
         $participants =& $this->object->getSurveyFinishedIds();
     } else {
         $participants = $finished_ids;
     }
     $finished_data = array();
     foreach ($this->object->getSurveyParticipants($participants) as $item) {
         $finished_data[$item["active_id"]] = $item;
     }
     foreach ($participants as $user_id) {
         if ($user_id < 1) {
             continue;
         }
         $resultset =& $this->object->getEvaluationByUser($questions, $user_id);
         $csvrow = array();
         // #12756
         array_push($csvrow, trim($resultset["lastname"]) ? $resultset["lastname"] : $resultset["name"]);
         // anonymous
         array_push($csvrow, $resultset["firstname"]);
         array_push($csvrow, $resultset["login"]);
         // #10579
         if ($this->object->canExportSurveyCode()) {
             array_push($csvrow, $user_id);
         }
         /* #8211
         			if ($this->object->getAnonymize() == ilObjSurvey::ANONYMIZE_OFF)
         			{
         				array_push($csvrow, $resultset["gender"]);
         			}			
         		    */
         $wt = $this->object->getWorkingtimeForParticipant($user_id);
         array_push($csvrow, $wt);
         $finished = $finished_data[$user_id];
         if ((bool) $finished["finished"]) {
             array_push($csvrow, ilDatePresentation::formatDate(new ilDateTime($finished["finished_tstamp"], IL_CAL_UNIX)));
         } else {
             array_push($csvrow, "-");
         }
         foreach ($questions as $question_id => $question) {
             $question->addUserSpecificResultsData($csvrow, $resultset);
         }
         array_push($csvfile, $csvrow);
     }
     // #11179
     $surveyname = $this->object->getTitle() . " " . $this->lng->txt("svy_eval_user") . " " . date("Y-m-d");
     $surveyname = preg_replace("/\\s/", "_", trim($surveyname));
     $surveyname = ilUtil::getASCIIFilename($surveyname);
     switch ($export_format) {
         case self::TYPE_XLS:
             include_once "./Services/Excel/classes/class.ilExcelWriterAdapter.php";
             $excelfile = ilUtil::ilTempnam();
             $adapter = new ilExcelWriterAdapter($excelfile, FALSE);
             $workbook = $adapter->getWorkbook();
             $workbook->setVersion(8);
             // Use Excel97/2000 Format
             // Creating a worksheet
             $format_bold =& $workbook->addFormat();
             $format_bold->setBold();
             $format_percent =& $workbook->addFormat();
             $format_percent->setNumFormat("0.00%");
             $format_datetime =& $workbook->addFormat();
             $format_datetime->setNumFormat("DD/MM/YYYY hh:mm:ss");
             $format_title =& $workbook->addFormat();
             $format_title->setBold();
             $format_title->setColor('black');
             $format_title->setPattern(1);
             $format_title->setFgColor('silver');
             $format_title_plain =& $workbook->addFormat();
             $format_title_plain->setColor('black');
             $format_title_plain->setPattern(1);
             $format_title_plain->setFgColor('silver');
             // Creating a worksheet
             $pages = floor(count($csvfile[0]) / 250) + 1;
             $worksheets = array();
             for ($i = 0; $i < $pages; $i++) {
                 $worksheets[$i] =& $workbook->addWorksheet();
             }
             $row = 0;
             include_once "./Services/Excel/classes/class.ilExcelUtils.php";
             $contentstartrow = 0;
             foreach ($csvfile as $csvrow) {
                 $col = 0;
                 if ($row == 0) {
                     $worksheet = 0;
                     $mainworksheet =& $worksheets[$worksheet];
                     foreach ($csvrow as $text) {
                         if (is_array($text)) {
                             $textcount = 0;
                             foreach ($text as $string) {
                                 $mainworksheet->writeString($row + $textcount, $col, ilExcelUtils::_convert_text($string, $_POST["export_format"]), $format_title);
                                 $textcount++;
                                 $contentstartrow = max($contentstartrow, $textcount);
                             }
                             $col++;
                         } else {
                             $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]), $format_title);
                         }
                         if ($col % 251 == 0) {
                             $worksheet++;
                             $col = 1;
                             $mainworksheet =& $worksheets[$worksheet];
                             $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]), $format_title);
                         }
                     }
                     $row = $contentstartrow;
                 } else {
                     $worksheet = 0;
                     $mainworksheet =& $worksheets[$worksheet];
                     foreach ($csvrow as $text) {
                         if (is_numeric($text)) {
                             $mainworksheet->writeNumber($row, $col++, $text);
                         } else {
                             $mainworksheet->writeString($row, $col++, ilExcelUtils::_convert_text($text, $_POST["export_format"]));
                         }
                         if ($col % 251 == 0) {
                             $worksheet++;
                             $col = 1;
                             $mainworksheet =& $worksheets[$worksheet];
                             $mainworksheet->writeString($row, 0, ilExcelUtils::_convert_text($csvrow[0], $_POST["export_format"]));
                         }
                     }
                 }
                 $row++;
             }
             $workbook->close();
             ilUtil::deliverFile($excelfile, "{$surveyname}.xls", "application/vnd.ms-excel");
             exit;
             break;
         case self::TYPE_SPSS:
             $csv = "";
             $separator = ";";
             foreach ($csvfile as $idx => $csvrow) {
                 $csvrow =& str_replace("\n", " ", $this->object->processCSVRow($csvrow, TRUE, $separator));
                 $csv .= join($csvrow, $separator) . "\n";
             }
             include_once "./Services/Utilities/classes/class.ilUtil.php";
             ilUtil::deliverData($csv, "{$surveyname}.csv");
             exit;
             break;
     }
 }
 function getExerciseInfo($a_assignment_id)
 {
     global $lng, $ilCtrl, $ilUser;
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($lng->txt("blog_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if (!$times_up) {
         $ilCtrl->setParameter($this, "exc", $exercise_id);
         $ilCtrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $ilCtrl->getLinkTarget($this, "finalize");
         $ilCtrl->setParameter($this, "ass", "");
         $ilCtrl->setParameter($this, "exc", "");
         $info .= " <a class=\"submit emphsubmit\" href=\"" . $submit_link . "\">" . $lng->txt("blog_finalize_blog") . "</a>";
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $ilUser->getId(), true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $ilCtrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $ilCtrl->getLinkTarget($this, "downloadExcSubFile");
         $ilCtrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $info .= "<br />" . sprintf($lng->txt("blog_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), "<a href=\"" . $dl_link . "\" class=\"submit\">" . $lng->txt("download") . "</a>");
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $ilCtrl->setParameter($this, "ass", $a_assignment_id);
             $ilCtrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $ilCtrl->getLinkTarget($this, "downloadExcAssFile");
             $ilCtrl->setParameter($this, "file", "");
             $ilCtrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->add();
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; padding:10px;\" class=\"ilOverlay\">" . $tooltip . "</div>";
     }
     return "<div>" . $info . "</div>";
 }
 public function getTableHTML()
 {
     global $lng, $ilCtrl, $ilUser;
     $this->prepareOutput();
     if (is_object($ilCtrl) && $this->getId() == "") {
         $ilCtrl->saveParameter($this->getParentObject(), $this->getNavParameter());
     }
     if (!$this->getPrintMode()) {
         // set form action
         if ($this->form_action != "" && $this->getOpenFormTag()) {
             $hash = "";
             if (is_object($ilUser) && $ilUser->getPref("screen_reader_optimization")) {
                 $hash = "#" . $this->getTopAnchor();
             }
             $this->tpl->setCurrentBlock("tbl_form_header");
             //$this->tpl->setVariable("FORMACTION", $this->getFormAction() . $hash);
             //$this->tpl->setVariable("FORMNAME", $this->getFormName());
             $this->tpl->parseCurrentBlock();
         }
         if ($this->form_action != "" && $this->getCloseFormTag()) {
             $this->tpl->touchBlock("tbl_form_footer");
         }
     }
     if (!$this->enabled['content']) {
         return $this->render();
     }
     $this->determineOffsetAndOrder();
     $this->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next"));
     $data = $this->getData();
     if ($this->dataExists()) {
         // sort
         if (!$this->getExternalSorting() && $this->enabled["sort"]) {
             $data = ilUtil::sortArray($data, $this->getOrderField(), $this->getOrderDirection(), $this->numericOrdering($this->getOrderField()));
         }
     }
     // fill rows
     if ($this->dataExists()) {
         if ($this->getPrintMode()) {
             ilDatePresentation::setUseRelativeDates(false);
         }
         $this->tpl->addBlockFile("TBL_CONTENT", "tbl_content", $this->row_template, $this->row_template_dir);
         foreach ($data as $set) {
             $this->tpl->setCurrentBlock("tbl_content");
             $this->css_row = $this->css_row != "tblrow1" ? "tblrow1" : "tblrow2";
             $this->tpl->setVariable("CSS_ROW", $this->css_row);
             $this->fillRow($set);
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->parseCurrentBlock();
         }
     } else {
         // add standard no items text (please tell me, if it messes something up, alex, 29.8.2008)
         $no_items_text = trim($this->getNoEntriesText()) != '' ? $this->getNoEntriesText() : $lng->txt("no_items");
         $this->css_row = $this->css_row != "tblrow1" ? "tblrow1" : "tblrow2";
         $this->tpl->setCurrentBlock("tbl_no_entries");
         $this->tpl->setVariable('TBL_NO_ENTRY_CSS_ROW', $this->css_row);
         $this->tpl->setVariable('TBL_NO_ENTRY_COLUMN_COUNT', $this->column_count);
         $this->tpl->setVariable('TBL_NO_ENTRY_TEXT', trim($no_items_text));
         $this->tpl->parseCurrentBlock();
     }
     return $this->render();
 }
Example #13
0
 /**
  * show information screen
  */
 function infoScreen()
 {
     global $ilAccess, $ilTabs, $ilUser, $ilToolbar;
     if (!$this->external_rater_360 && !$ilAccess->checkAccess("visible", "", $this->ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"), $this->ilias->error_obj->MESSAGE);
     }
     $ilTabs->activateTab("info_short");
     include_once "./Modules/Survey/classes/class.ilSurveyExecutionGUI.php";
     $output_gui =& new ilSurveyExecutionGUI($this->object);
     include_once "./Services/InfoScreen/classes/class.ilInfoScreenGUI.php";
     $info = new ilInfoScreenGUI($this);
     $info->enablePrivateNotes();
     // "active" survey?
     $canStart = $this->object->canStartSurvey(null, $this->external_rater_360);
     $showButtons = $canStart["result"];
     if (!$showButtons) {
         if ($canStart["edit_settings"] && $ilAccess->checkAccess("write", "", $this->ref_id)) {
             $canStart["messages"][] = "<a href=\"" . $this->ctrl->getLinkTarget($this, "properties") . "\">&raquo; " . $this->lng->txt("survey_edit_settings") . "</a>";
         }
         ilUtil::sendInfo(implode("<br />", $canStart["messages"]));
     }
     $big_button = false;
     if ($showButtons) {
         // closing survey?
         $is_appraisee = false;
         if ($this->object->get360Mode() && $this->object->isAppraisee($ilUser->getId())) {
             $info->addSection($this->lng->txt("survey_360_appraisee_info"));
             $appr_data = $this->object->getAppraiseesData();
             $appr_data = $appr_data[$ilUser->getId()];
             $info->addProperty($this->lng->txt("survey_360_raters_status_info"), $appr_data["finished"]);
             if (!$appr_data["closed"]) {
                 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                 $button = ilLinkButton::getInstance();
                 $button->setCaption("survey_360_appraisee_close_action");
                 $button->setUrl($this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "confirmappraiseeclose"));
                 $close_button_360 = '<div>' . $button->render() . '</div>';
                 $txt = "survey_360_appraisee_close_action_info";
                 if ($this->object->get360SkillService()) {
                     $txt .= "_skill";
                 }
                 $info->addProperty($this->lng->txt("status"), $close_button_360 . $this->lng->txt($txt));
             } else {
                 ilDatePresentation::setUseRelativeDates(false);
                 $dt = new ilDateTime($appr_data["closed"], IL_CAL_UNIX);
                 $info->addProperty($this->lng->txt("status"), sprintf($this->lng->txt("survey_360_appraisee_close_action_status"), ilDatePresentation::formatDate($dt)));
             }
             $is_appraisee = true;
         }
         // handle code
         // validate incoming
         $code_input = false;
         $anonymous_code = $_POST["anonymous_id"];
         if ($anonymous_code) {
             $code_input = true;
             // if(!$this->object->isUnusedCode($anonymous_code, $ilUser->getId()))
             if (!$this->object->checkSurveyCode($anonymous_code)) {
                 $anonymous_code = null;
             } else {
                 // #15860
                 $this->object->bindSurveyCodeToUser($ilUser->getId(), $anonymous_code);
             }
         }
         if ($anonymous_code) {
             $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         } else {
             $anonymous_code = $_SESSION["anonymous_id"][$this->object->getId()];
             if ($anonymous_code) {
                 $code_input = true;
             }
         }
         // try to find code for current (registered) user from existing run
         if ($this->object->getAnonymize() && !$anonymous_code) {
             $anonymous_code = $this->object->findCodeForUser($ilUser->getId());
         }
         // get existing runs for current user, might generate code
         $participant_status = $this->object->getUserSurveyExecutionStatus($anonymous_code);
         if ($participant_status) {
             $anonymous_code = $participant_status["code"];
             $participant_status = $participant_status["runs"];
         }
         // (final) check for proper anonymous code
         if (!$this->object->isAccessibleWithoutCode() && !$is_appraisee && $code_input && (!$anonymous_code || !$this->object->isAnonymousKey($anonymous_code))) {
             $anonymous_code = null;
             ilUtil::sendInfo($this->lng->txt("wrong_survey_code_used"));
         }
         // :TODO: really save in session?
         $_SESSION["anonymous_id"][$this->object->getId()] = $anonymous_code;
         // code is mandatory and not given yet
         if (!$is_appraisee && !$anonymous_code && !$this->object->isAccessibleWithoutCode()) {
             $info->setFormAction($this->ctrl->getFormAction($this, "infoScreen"));
             $info->addSection($this->lng->txt("anonymization"));
             $info->addProperty("", $this->lng->txt("anonymize_anonymous_introduction"));
             $info->addPropertyTextinput($this->lng->txt("enter_anonymous_id"), "anonymous_id", "", 8, "infoScreen", $this->lng->txt("submit"), true);
         } else {
             // trunk/default
             if (!$this->object->get360Mode()) {
                 if ($anonymous_code) {
                     $info->addHiddenElement("anonymous_id", $anonymous_code);
                 }
                 $survey_started = $this->object->isSurveyStarted($ilUser->getId(), $anonymous_code);
                 if ($survey_started === 1) {
                     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                         if ($this->object->hasViewOwnResults()) {
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption("svy_view_own_results");
                             $button->setUrl($this->ctrl->getLinkTarget($this, "viewUserResults"));
                             $ilToolbar->addButtonInstance($button);
                         }
                         if ($this->object->hasMailOwnResults()) {
                             if ($this->object->hasViewOwnResults()) {
                                 $ilToolbar->addSeparator();
                             }
                             require_once "Services/Form/classes/class.ilTextInputGUI.php";
                             $mail = new ilTextInputGUI($this->lng->txt("email"), "mail");
                             $mail->setSize(25);
                             $mail->setValue($ilUser->getEmail());
                             $ilToolbar->addInputItem($mail, true);
                             $ilToolbar->setFormAction($this->ctrl->getFormAction($this, "mailUserResults"));
                             include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
                             $button = ilSubmitButton::getInstance();
                             $button->setCaption("svy_mail_own_results");
                             $button->setCommand("mailUserResults");
                             $ilToolbar->addButtonInstance($button);
                         }
                     }
                     ilUtil::sendInfo($this->lng->txt("already_completed_survey"));
                 } elseif ($survey_started === 0) {
                     $big_button = array("resume", $this->lng->txt("resume_survey"));
                 } elseif ($survey_started === FALSE) {
                     $big_button = array("start", $this->lng->txt("start_survey"));
                 }
             } else {
                 $appr_ids = array();
                 // use given code (if proper external one)
                 if ($anonymous_code) {
                     $anonymous_id = $this->object->getAnonymousIdByCode($anonymous_code);
                     if ($anonymous_id) {
                         $appr_ids = $this->object->getAppraiseesToRate(0, $anonymous_id);
                     }
                 }
                 // registered user
                 // if an auto-code was generated, we still have to check for the original user id
                 if (!$appr_ids && $ilUser->getId() != ANONYMOUS_USER_ID) {
                     $appr_ids = $this->object->getAppraiseesToRate($ilUser->getId());
                 }
                 if (sizeof($appr_ids)) {
                     // map existing runs to appraisees
                     $active_appraisees = array();
                     if ($participant_status) {
                         foreach ($participant_status as $item) {
                             $active_appraisees[$item["appr_id"]] = $item["finished"];
                         }
                     }
                     $list = array();
                     foreach ($appr_ids as $appr_id) {
                         if ($this->object->isAppraiseeClosed($appr_id)) {
                             // closed
                             $list[$appr_id] = $this->lng->txt("survey_360_appraisee_is_closed");
                         } else {
                             if (array_key_exists($appr_id, $active_appraisees)) {
                                 // already done
                                 if ($active_appraisees[$appr_id]) {
                                     $list[$appr_id] = $this->lng->txt("already_completed_survey");
                                 } else {
                                     $list[$appr_id] = array("resume", $this->lng->txt("resume_survey"));
                                 }
                             } else {
                                 // start
                                 $list[$appr_id] = array("start", $this->lng->txt("start_survey"));
                             }
                         }
                     }
                     $info->addSection($this->lng->txt("survey_360_rate_other_appraisees"));
                     include_once "Services/User/classes/class.ilUserUtil.php";
                     foreach ($list as $appr_id => $item) {
                         $appr_name = ilUserUtil::getNamePresentation($appr_id, false, false, "", true);
                         if (!is_array($item)) {
                             $info->addProperty($appr_name, $item);
                         } else {
                             $this->ctrl->setParameter($output_gui, "appr_id", $appr_id);
                             $href = $this->ctrl->getLinkTarget($output_gui, $item[0]);
                             $this->ctrl->setParameter($output_gui, "appr_id", "");
                             include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
                             $button = ilLinkButton::getInstance();
                             $button->setCaption($item[1], false);
                             $button->setUrl($href);
                             $big_button_360 = '<div>' . $button->render() . '</div>';
                             $info->addProperty($appr_name, $big_button_360);
                         }
                     }
                 } else {
                     if (!$is_appraisee) {
                         ilUtil::sendFailure($this->lng->txt("survey_360_no_appraisees"));
                     }
                 }
             }
         }
         if ($this->object->get360Mode() && $this->object->get360SelfAppraisee() && !$this->object->isAppraisee($ilUser->getId()) && $ilUser->getId() != ANONYMOUS_USER_ID) {
             $link = $this->ctrl->getLinkTargetByClass("ilsurveyparticipantsgui", "addSelfAppraisee");
             $link = '<a href="' . $link . '">' . $this->lng->txt("survey_360_add_self_appraisee") . '</a>';
             $info->addProperty("&nbsp;", $link);
         }
     }
     if ($big_button) {
         $ilToolbar->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
         include_once "Services/UIComponent/Button/classes/class.ilSubmitButton.php";
         $button = ilSubmitButton::getInstance();
         $button->setCaption($big_button[1], false);
         $button->setCommand($big_button[0]);
         $button->setPrimary(true);
         $ilToolbar->addButtonInstance($button);
         $ilToolbar->setCloseFormTag(false);
         $info->setOpenFormTag(false);
     }
     /* #12016
     		else
     		{
     			$info->setFormAction($this->ctrl->getFormAction($output_gui, "infoScreen"));
     		}
     		*/
     if (strlen($this->object->getIntroduction())) {
         $introduction = $this->object->getIntroduction();
         $info->addSection($this->lng->txt("introduction"));
         $info->addProperty("", $this->object->prepareTextareaOutput($introduction) . "<br />" . $info->getHiddenToggleButton());
     } else {
         $info->addSection("");
         $info->addProperty("", $info->getHiddenToggleButton());
     }
     $info->hideFurtherSections(false);
     if (!$this->object->get360Mode()) {
         $info->addSection($this->lng->txt("svy_general_properties"));
         $info->addProperty($this->lng->txt("survey_results_anonymization"), !$this->object->hasAnonymizedResults() ? $this->lng->txt("survey_results_personalized_info") : $this->lng->txt("survey_results_anonymized_info"));
         include_once "./Modules/Survey/classes/class.ilObjSurveyAccess.php";
         if ($ilAccess->checkAccess("write", "", $this->ref_id) || ilObjSurveyAccess::_hasEvaluationAccess($this->object->getId(), $ilUser->getId())) {
             $info->addProperty($this->lng->txt("evaluation_access"), $this->lng->txt("evaluation_access_info"));
         }
     }
     $info->addMetaDataSections($this->object->getId(), 0, $this->object->getType());
     $this->ctrl->forwardCommand($info);
 }
 /**
  * Get variable values
  * 
  * @param array $a_user_data
  * @param datetime $a_last_access
  * @param datetime $a_completion_date
  * @return array 
  */
 protected function getBaseVariablesForPresentation($a_user_data, $a_last_access = null, $a_completion_date = false)
 {
     global $lng;
     $old = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $salutation = "";
     if (strlen($a_user_data["gender"])) {
         $salutation = $lng->txt("salutation_" . $a_user_data["gender"]);
     }
     $birthday = "";
     if ($a_user_data["birthday"]) {
         $birthday = ilDatePresentation::formatDate(new ilDate($a_user_data["birthday"], IL_CAL_DATE));
     }
     $country = $a_user_data["sel_country"];
     if ($country) {
         $lng->loadLanguageModule("meta");
         $country = $lng->txt("meta_c_" . $country);
     } else {
         $country = $a_user_data["country"];
     }
     $vars = array("USER_LOGIN" => ilUtil::prepareFormOutput(trim($a_user_data["login"])), "USER_FULLNAME" => ilUtil::prepareFormOutput(trim($a_user_data["title"] . " " . $a_user_data["firstname"] . " " . $a_user_data["lastname"])), "USER_FIRSTNAME" => ilUtil::prepareFormOutput($a_user_data["firstname"]), "USER_LASTNAME" => ilUtil::prepareFormOutput($a_user_data["lastname"]), "USER_TITLE" => ilUtil::prepareFormOutput($a_user_data["title"]), "USER_SALUTATION" => ilUtil::prepareFormOutput($salutation), "USER_BIRTHDAY" => ilUtil::prepareFormOutput($birthday), "USER_INSTITUTION" => ilUtil::prepareFormOutput($a_user_data["institution"]), "USER_DEPARTMENT" => ilUtil::prepareFormOutput($a_user_data["department"]), "USER_STREET" => ilUtil::prepareFormOutput($a_user_data["street"]), "USER_CITY" => ilUtil::prepareFormOutput($a_user_data["city"]), "USER_ZIPCODE" => ilUtil::prepareFormOutput($a_user_data["zipcode"]), "USER_COUNTRY" => ilUtil::prepareFormOutput($country));
     if ($a_last_access) {
         $vars["USER_LASTACCESS"] = ilDatePresentation::formatDate(new ilDateTime($a_last_access, IL_CAL_DATETIME));
     }
     $vars["DATE"] = ilDatePresentation::formatDate(new ilDate(time(), IL_CAL_UNIX));
     $vars["DATETIME"] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX));
     if ($a_completion_date) {
         $vars["DATE_COMPLETED"] = ilDatePresentation::formatDate(new ilDate($a_completion_date, IL_CAL_DATETIME));
         $vars["DATETIME_COMPLETED"] = ilDatePresentation::formatDate(new ilDateTime($a_completion_date, IL_CAL_DATETIME));
     }
     ilDatePresentation::setUseRelativeDates($old);
     return $vars;
 }
 /**
  * fill row 
  *
  * @access public
  * @param
  * @return
  */
 public function fillRow($data)
 {
     ilDatePresentation::setUseRelativeDates(false);
     $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($data['title']));
     foreach ($this->getSelectedColumns() as $c) {
         if (strcmp($c, 'description') == 0) {
             $this->tpl->setCurrentBlock('description');
             $this->tpl->setVariable("DESCRIPTION", ilUtil::prepareFormOutput($data['description']));
             $this->tpl->parseCurrentBlock();
         }
         if (strcmp($c, 'author') == 0) {
             $this->tpl->setCurrentBlock('author');
             $this->tpl->setVariable("AUTHOR", ilUtil::prepareFormOutput($data['author']));
             $this->tpl->parseCurrentBlock();
         }
         if (strcmp($c, 'ttype') == 0) {
             $this->tpl->setCurrentBlock('ttype');
             $this->tpl->setVariable("TYPE", ilUtil::prepareFormOutput($data['ttype']));
             $this->tpl->parseCurrentBlock();
         }
         if (strcmp($c, 'created') == 0) {
             $this->tpl->setCurrentBlock('created');
             $this->tpl->setVariable('CREATED', ilDatePresentation::formatDate(new ilDateTime($data['created'], IL_CAL_UNIX)));
             $this->tpl->parseCurrentBlock();
         }
         if (strcmp($c, 'updated') == 0) {
             $this->tpl->setCurrentBlock('updated');
             $this->tpl->setVariable('UPDATED', ilDatePresentation::formatDate(new ilDateTime($data['updated'], IL_CAL_UNIX)));
             $this->tpl->parseCurrentBlock();
         }
     }
     if (strcmp($this->outputmode, "detailed") == 0 || strcmp($this->outputmode, "detailed_printview") == 0) {
         $this->tpl->setCurrentBlock("overview_row_detail");
         include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
         $question_gui = assQuestion::_instanciateQuestionGUI($data["question_id"]);
         if (strcmp($this->outputmode, "detailed") == 0) {
             $solutionoutput = $question_gui->getSolutionOutput($active_id = "", $pass = NULL, $graphicalOutput = FALSE, $result_output = FALSE, $show_question_only = FALSE, $show_feedback = FALSE, $show_correct_solution = true, $show_manual_scoring = false);
             if (strlen($solutionoutput) == 0) {
                 $solutionoutput = $question_gui->getPreview();
             }
             $this->tpl->setVariable("DETAILS", $solutionoutput);
         } else {
             $this->tpl->setVariable("DETAILS", $question_gui->getPreview());
         }
         $this->tpl->parseCurrentBlock();
     }
     ilDatePresentation::setUseRelativeDates(true);
 }
Example #16
0
 /**
  * Get formatted mail body text of user profile data.
  *
  * @param	object	  Language object (choose user language of recipient) or null to use language of current user
  */
 function getProfileAsString(&$a_language)
 {
     include_once './Services/AccessControl/classes/class.ilObjRole.php';
     include_once './Services/Utilities/classes/class.ilFormat.php';
     global $lng, $rbacreview;
     $language =& $a_language;
     $language->loadLanguageModule('registration');
     $language->loadLanguageModule('crs');
     $body = '';
     $body .= $language->txt("login") . ": " . $this->getLogin() . "\n";
     if (strlen($this->getUTitle())) {
         $body .= $language->txt("title") . ": " . $this->getUTitle() . "\n";
     }
     if (strlen($this->getGender())) {
         $gender = $this->getGender() == 'm' ? $language->txt('gender_m') : $language->txt('gender_f');
         $body .= $language->txt("gender") . ": " . $gender . "\n";
     }
     if (strlen($this->getFirstname())) {
         $body .= $language->txt("firstname") . ": " . $this->getFirstname() . "\n";
     }
     if (strlen($this->getLastname())) {
         $body .= $language->txt("lastname") . ": " . $this->getLastname() . "\n";
     }
     if (strlen($this->getInstitution())) {
         $body .= $language->txt("institution") . ": " . $this->getInstitution() . "\n";
     }
     if (strlen($this->getDepartment())) {
         $body .= $language->txt("department") . ": " . $this->getDepartment() . "\n";
     }
     if (strlen($this->getStreet())) {
         $body .= $language->txt("street") . ": " . $this->getStreet() . "\n";
     }
     if (strlen($this->getCity())) {
         $body .= $language->txt("city") . ": " . $this->getCity() . "\n";
     }
     if (strlen($this->getZipcode())) {
         $body .= $language->txt("zipcode") . ": " . $this->getZipcode() . "\n";
     }
     if (strlen($this->getCountry())) {
         $body .= $language->txt("country") . ": " . $this->getCountry() . "\n";
     }
     if (strlen($this->getSelectedCountry())) {
         $body .= $language->txt("sel_country") . ": " . $this->getSelectedCountry() . "\n";
     }
     if (strlen($this->getPhoneOffice())) {
         $body .= $language->txt("phone_office") . ": " . $this->getPhoneOffice() . "\n";
     }
     if (strlen($this->getPhoneHome())) {
         $body .= $language->txt("phone_home") . ": " . $this->getPhoneHome() . "\n";
     }
     if (strlen($this->getPhoneMobile())) {
         $body .= $language->txt("phone_mobile") . ": " . $this->getPhoneMobile() . "\n";
     }
     if (strlen($this->getFax())) {
         $body .= $language->txt("fax") . ": " . $this->getFax() . "\n";
     }
     if (strlen($this->getEmail())) {
         $body .= $language->txt("email") . ": " . $this->getEmail() . "\n";
     }
     if (strlen($this->getHobby())) {
         $body .= $language->txt("hobby") . ": " . $this->getHobby() . "\n";
     }
     if (strlen($this->getComment())) {
         $body .= $language->txt("referral_comment") . ": " . $this->getComment() . "\n";
     }
     if (strlen($this->getMatriculation())) {
         $body .= $language->txt("matriculation") . ": " . $this->getMatriculation() . "\n";
     }
     if (strlen($this->getCreateDate())) {
         ilDatePresentation::setUseRelativeDates(false);
         ilDatePresentation::setLanguage($language);
         $date = ilDatePresentation::formatDate(new ilDateTime($this->getCreateDate(), IL_CAL_DATETIME));
         ilDatePresentation::resetToDefaults();
         $body .= $language->txt("create_date") . ": " . $date . "\n";
     }
     foreach ($rbacreview->getGlobalRoles() as $role) {
         if ($rbacreview->isAssigned($this->getId(), $role)) {
             $gr[] = ilObjRole::_lookupTitle($role);
         }
     }
     if (count($gr)) {
         $body .= $language->txt('reg_role_info') . ': ' . implode(',', $gr) . "\n";
     }
     // Time limit
     if ($this->getTimeLimitUnlimited()) {
         $body .= $language->txt('time_limit') . ": " . $language->txt('crs_unlimited') . "\n";
     } else {
         ilDatePresentation::setUseRelativeDates(false);
         ilDatePresentation::setLanguage($language);
         $period = ilDatePresentation::formatPeriod(new ilDateTime($this->getTimeLimitFrom(), IL_CAL_UNIX), new ilDateTime($this->getTimeLimitUntil(), IL_CAL_UNIX));
         ilDatePresentation::resetToDefaults();
         $start = new ilDateTime($this->getTimeLimitFrom(), IL_CAL_UNIX);
         $end = new ilDateTime($this->getTimeLimitUntil(), IL_CAL_UNIX);
         $body .= $language->txt('time_limit') . ': ' . $start->get(IL_CAL_DATETIME);
         $body .= $language->txt('time_limit') . ': ' . $end->get(IL_CAL_DATETIME);
         #$body .= $language->txt('time_limit').': '.$period;
         /*
         $body .= ($language->txt('time_limit').": ".$language->txt('crs_from')." ".
         		  ilFormat::formatUnixTime($this->getTimeLimitFrom(), true)." ".
         		  $language->txt('crs_to')." ".
         		  ilFormat::formatUnixTime($this->getTimeLimitUntil(), true)."\n");
         */
     }
     return $body;
 }
 function createBill()
 {
     global $tpl, $ilObjDataCache;
     $customer = $this->user_obj;
     $transaction = $_GET['transaction'];
     //		$total_price = 0;
     //		$total_vat = 0;
     $i = 0;
     include_once './Services/UICore/classes/class.ilTemplate.php';
     include_once './Services/Utilities/classes/class.ilUtil.php';
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $currency = $genSet->get('currency_unit');
     $user_id = $this->user_obj->getId();
     $bookings = ilPaymentBookings::__readBillByTransaction($user_id, $transaction);
     if ($bookings[$i]['street'] == NULL) {
         $bookings[$i]['street'] = nl2br(utf8_decode($customer->getStreet()));
     }
     if ($bookings[$i]['zipcode'] == NULL) {
         $bookings[$i]['zipcode'] = nl2br(utf8_decode($customer->getZipcode()));
     }
     if ($bookings[$i]['city'] == NULL) {
         $bookings[$i]['city'] = nl2br(utf8_decode($customer->getCity()));
     }
     if ($bookings[$i]['country'] == NULL) {
         $bookings[$i]['country'] = nl2br(utf8_decode($customer->getCountry()));
     }
     if (2 == strlen($bookings[$i]['country'])) {
         $this->lng->loadLanguageModule('meta');
         $bookings[$i]['country'] = utf8_decode($this->lng->txt('meta_c_' . strtoupper($bookings[$i]['country'])));
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.pay_bill.html', 'Services/Payment');
     $tpl = new ilTemplate('tpl.pay_bill.html', true, true, 'Services/Payment');
     if ($tpl->placeholderExists('HTTP_PATH')) {
         $http_path = ilUtil::_getHttpPath();
         $tpl->setVariable('HTTP_PATH', $http_path);
     }
     ilDatePresentation::setUseRelativeDates(false);
     $tpl->setVariable('DATE', utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['order_date'], IL_CAL_UNIX))));
     $tpl->setVariable('TXT_CREDIT', utf8_decode($this->lng->txt('credit')));
     $tpl->setVariable('TXT_DAY_OF_SERVICE_PROVISION', $this->lng->txt('day_of_service_provision'));
     include_once './Services/Payment/classes/class.ilPayMethods.php';
     $str_paymethod = ilPayMethods::getStringByPaymethod($bookings[$i]['b_pay_method']);
     if (strlen(trim($bookings[$i]['transaction_extern']))) {
         $tpl->setVariable('TXT_EXTERNAL_BILL_NO', str_replace('%s', $str_paymethod, utf8_decode($this->lng->txt('external_bill_no'))));
         $tpl->setVariable('EXTERNAL_BILL_NO', $bookings[$i]['transaction_extern']);
     }
     $tpl->setVariable('TXT_POSITION', $this->lng->txt('position'));
     $tpl->setVariable('TXT_AMOUNT', $this->lng->txt('amount'));
     $tpl->setVariable('TXT_UNIT_PRICE', utf8_decode($this->lng->txt('unit_price')));
     $tpl->setVariable('VENDOR_ADDRESS', nl2br(utf8_decode($genSet->get('address'))));
     $tpl->setVariable('VENDOR_ADD_INFO', nl2br(utf8_decode($genSet->get('add_info'))));
     $tpl->setVariable('VENDOR_BANK_DATA', nl2br(utf8_decode($genSet->get('bank_data'))));
     $tpl->setVariable('TXT_BANK_DATA', utf8_decode($this->lng->txt('pay_bank_data')));
     $tpl->setVariable('CUSTOMER_FIRSTNAME', utf8_decode($customer->getFirstName()));
     // $customer['vorname']);
     $tpl->setVariable('CUSTOMER_LASTNAME', utf8_decode($customer->getLastName()));
     //$customer['nachname']);
     if ($bookings['po_box'] == '') {
         $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings[$i]['street']));
     } else {
         $tpl->setVariable('CUSTOMER_STREET', utf8_decode($bookings[$i]['po_box']));
     }
     $tpl->setVariable('CUSTOMER_ZIPCODE', utf8_decode($bookings[$i]['zipcode']));
     $tpl->setVariable('CUSTOMER_CITY', utf8_decode($bookings[$i]['city']));
     $tpl->setVariable('CUSTOMER_COUNTRY', utf8_decode($bookings[$i]['country']));
     $tpl->setVariable('BILL_NO', $transaction);
     $tpl->setVariable('TXT_BILL', utf8_decode($this->lng->txt('pays_bill')));
     $tpl->setVariable('TXT_BILL_NO', utf8_decode($this->lng->txt('pay_bill_no')));
     $tpl->setVariable('TXT_DATE', utf8_decode($this->lng->txt('date')));
     $tpl->setVariable('TXT_ARTICLE', utf8_decode($this->lng->txt('pay_article')));
     $tpl->setVariable('TXT_VAT_RATE', utf8_decode($this->lng->txt('vat_rate')));
     $tpl->setVariable('TXT_VAT_UNIT', utf8_decode($this->lng->txt('vat_unit')));
     $tpl->setVariable('TXT_PRICE', utf8_decode($this->lng->txt('price_a')));
     for ($i = 0; $i < count($bookings[$i]); $i++) {
         $tmp_pobject = new ilPaymentObject($this->user_obj, $bookings[$i]['pobject_id']);
         $obj_id = $ilObjDataCache->lookupObjId($bookings[$i]['ref_id']);
         $obj_type = $ilObjDataCache->lookupType($obj_id);
         $tpl->setCurrentBlock('loop');
         $tpl->setVariable('LOOP_POSITION', $i + 1);
         $tpl->setVariable('LOOP_AMOUNT', '1');
         $tpl->setVariable('LOOP_TXT_PERIOD_OF_SERVICE_PROVISION', utf8_decode($this->lng->txt('period_of_service_provision')));
         $tpl->setVariable('LOOP_OBJ_TYPE', utf8_decode($this->lng->txt($obj_type)));
         $tpl->setVariable('LOOP_TITLE', utf8_decode($bookings[$i]['object_title']) . $assigned_coupons);
         $tpl->setVariable('LOOP_TXT_ENTITLED_RETRIEVE', utf8_decode($this->lng->txt('pay_entitled_retrieve')));
         if ($bookings[$i]['duration'] == 0 && $bookings[$i]['access_enddate'] == NULL) {
             $tpl->setVariable('LOOP_DURATION', utf8_decode($this->lng->txt('unlimited_duration')));
         } else {
             $access_startdate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['access_startdate'], IL_CAL_DATETIME)));
             $access_enddate = utf8_decode(ilDatePresentation::formatDate(new ilDate($bookings[$i]['access_enddate'], IL_CAL_DATETIME)));
             $tpl->setVariable('LOOP_DURATION', $access_startdate . ' - ' . $access_enddate . ' /  ' . $bookings[$i]['duration'] . ' ' . utf8_decode($this->lng->txt('paya_months')));
         }
         // old one
         $tpl->setVariable('LOOP_VAT_RATE', number_format($bookings[$i]['vat_rate'], 2, ',', '.') . ' %');
         $tpl->setVariable('LOOP_VAT_UNIT', number_format($bookings[$i]['vat_unit'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('LOOP_UNIT_PRICE', number_format($bookings[$i]['price'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('LOOP_PRICE', number_format($bookings[$i]['price'], 2, ',', '.') . ' ' . $currency);
         $tpl->parseCurrentBlock('loop');
         $bookings['total'] += (double) $bookings[$i]['price'];
         $bookings['total_vat'] += (double) $bookings[$i]['vat_unit'];
         $bookings['total_discount'] += (double) $bookings[$i]['discount'];
         unset($tmp_pobject);
         $sub_total_amount = $bookings['total'];
     }
     $bookings['total'] += $bookings['total_discount'];
     if ($bookings['total_discount'] < 0) {
         $tpl->setCurrentBlock('cloop');
         $tpl->setVariable('TXT_SUBTOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_subtotal_amount')));
         $tpl->setVariable('SUBTOTAL_AMOUNT', number_format($sub_total_amount, 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('TXT_COUPON', utf8_decode($this->lng->txt('paya_coupons_coupon') . ' ' . $coupon['pcc_code']));
         $tpl->setVariable('BONUS', number_format($bookings['total_discount'], 2, ',', '.') . ' ' . $currency);
         $tpl->parseCurrentBlock();
     }
     if ($bookings['total'] < 0) {
         $bookings['total'] = 0.0;
         //	$bookings['total_vat'] = 0.0;
     }
     $total_net_price = $sub_total_amount - $bookings['total_vat'];
     $tpl->setVariable('TXT_TOTAL_NETPRICE', utf8_decode($this->lng->txt('total_netprice')));
     $tpl->setVariable('TOTAL_NETPRICE', number_format($total_net_price, 2, ',', '.') . ' ' . $currency);
     $tpl->setVariable('TXT_TOTAL_AMOUNT', utf8_decode($this->lng->txt('pay_bmf_total_amount')));
     $tpl->setVariable('TOTAL_AMOUNT', number_format($bookings['total'], 2, ',', '.') . ' ' . $currency);
     if ($bookings['total_vat'] > 0) {
         $tpl->setVariable('TOTAL_VAT', number_format($bookings['total_vat'], 2, ',', '.') . ' ' . $currency);
         $tpl->setVariable('TXT_TOTAL_VAT', utf8_decode($this->lng->txt('plus_vat')));
     }
     if (1 == $bookings[0]['b_pay_method']) {
         $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_unpayed_bill')));
     } else {
         $tpl->setVariable('TXT_PAYMENT_TYPE', utf8_decode($this->lng->txt('pay_payed_bill')));
     }
     if (!@file_exists($genSet->get('pdf_path'))) {
         ilUtil::makeDir($genSet->get('pdf_path'));
     }
     $file_name = time();
     if (@file_exists($genSet->get('pdf_path'))) {
         ilUtil::html2pdf($tpl->get(), $genSet->get('pdf_path') . '/' . $file_name . '.pdf');
     }
     if (@file_exists($genSet->get('pdf_path') . '/' . $file_name . '.pdf')) {
         ilUtil::deliverFile($genSet->get('pdf_path') . '/' . $file_name . '.pdf', $transaction . '.pdf', $a_mime = 'application/pdf');
     }
     @unlink($genSet->get('pdf_path') . '/' . $file_name . '.html');
     @unlink($genSet->get('pdf_path') . '/' . $file_name . '.pdf');
 }
 protected function exportCSV(array $a_data, $a_scale)
 {
     global $lng, $ilClientIniFile, $ilUser;
     ilDatePresentation::setUseRelativeDates(false);
     include_once './Services/Link/classes/class.ilLink.php';
     include_once "./Services/Utilities/classes/class.ilCSVWriter.php";
     $csv = new ilCSVWriter();
     $csv->setSeparator(";");
     $now = time();
     // meta
     $meta = array($lng->txt("trac_name_of_installation") => $ilClientIniFile->readVariable('client', 'name'), $lng->txt("trac_report_date") => ilDatePresentation::formatDate(new ilDateTime($now, IL_CAL_UNIX), IL_CAL_DATETIME), $lng->txt("trac_report_owner") => $ilUser->getFullName());
     foreach ($a_data as $idx => $item) {
         switch ($idx) {
             case "title":
                 $meta[$lng->txt("title")] = $item;
                 break;
             case "active":
                 // nothing to do
                 break;
             case "closed_details":
                 foreach ($item as $detail) {
                     $meta[$a_data["closed"][0] . " - " . $detail[0]] = $detail[1];
                 }
                 break;
             default:
                 $meta[$item[0]] = $item[1];
                 break;
         }
     }
     foreach ($meta as $caption => $value) {
         $csv->addColumn(strip_tags($caption));
         $csv->addColumn(strip_tags($value));
         $csv->addRow();
     }
     $csv->addRow();
     // aggregate data
     $aggr_data = $this->adaptDataToScale($a_scale, $a_data["active"], 700);
     unset($a_data);
     // header
     $first = $aggr_data;
     $first = array_keys(array_shift($first));
     foreach ($first as $column) {
         // split weekday and time slot again
         if ($a_scale == self::SCALE_PERIODIC_WEEK && $column == "slot_begin") {
             $csv->addColumn("weekday");
             $csv->addColumn("time");
         } else {
             $csv->addColumn(strip_tags($column));
         }
     }
     $csv->addRow();
     // data
     foreach ($aggr_data as $row) {
         foreach ($row as $column => $value) {
             if (is_array($value)) {
                 $value = implode(', ', $value);
             }
             switch ($column) {
                 case "slot_begin":
                     // split weekday and time slot again
                     if ($a_scale == self::SCALE_PERIODIC_WEEK) {
                         $csv->addColumn(ilCalendarUtil::_numericDayToString(substr($value, 0, 1)));
                         $value = substr($value, 1, 2) . ":" . substr($value, 3, 2);
                         break;
                     }
                     // fallthrough
                 // fallthrough
                 case "slot_end":
                     $value = date("d.m.Y H:i", $value);
                     break;
             }
             $csv->addColumn(strip_tags($value));
         }
         $csv->addRow();
     }
     // send
     $filename .= "session_statistics_" . date("Ymd", $now) . ".csv";
     header("Content-type: text/comma-separated-values");
     header("Content-Disposition: attachment; filename=\"" . $filename . "\"");
     header("Expires: 0");
     header("Cache-Control: must-revalidate, post-check=0,pre-check=0");
     header("Pragma: public");
     echo $csv->getCSVString();
     exit;
 }
 /**
  *
  */
 protected function showLastResetDate()
 {
     /**
      * @var $ilToolbar ilToolbarGUI
      */
     global $ilToolbar;
     if ($this->object->getLastResetDate() && $this->object->getLastResetDate()->get(IL_CAL_UNIX) != 0) {
         $status = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $ilToolbar->addText(sprintf($this->lng->txt('tos_last_reset_date'), ilDatePresentation::formatDate($this->object->getLastResetDate())));
         ilDatePresentation::setUseRelativeDates($status);
     }
 }
 function getExerciseInfo($a_assignment_id, $a_add_submit = false)
 {
     include_once "Modules/Exercise/classes/class.ilExAssignment.php";
     $ass = new ilExAssignment($a_assignment_id);
     $exercise_id = $ass->getExerciseId();
     if (!$exercise_id) {
         return;
     }
     // is the assignment still open?
     $times_up = false;
     if ($ass->getDeadline() && $ass->getDeadline() - time() <= 0) {
         $times_up = true;
     }
     // exercise goto
     include_once "./Services/Link/classes/class.ilLink.php";
     $exc_ref_id = array_shift(ilObject::_getAllReferences($exercise_id));
     $exc_link = ilLink::_getStaticLink($exc_ref_id, "exc");
     $info = sprintf($this->lng->txt("prtf_exercise_info"), $ass->getTitle(), "<a href=\"" . $exc_link . "\">" . ilObject::_lookupTitle($exercise_id) . "</a>");
     // submit button
     if ($a_add_submit && !$times_up) {
         $this->ctrl->setParameter($this, "exc", $exercise_id);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $submit_link = $this->ctrl->getLinkTarget($this, "finalize");
         $this->ctrl->setParameter($this, "ass", "");
         $this->ctrl->setParameter($this, "exc", "");
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("prtf_finalize_portfolio");
         $button->setPrimary(true);
         $button->setUrl($submit_link);
         $info .= " " . $button->render();
     }
     // submitted files
     $submitted = ilExAssignment::getDeliveredFiles($exercise_id, $a_assignment_id, $this->user_id, true);
     if ($submitted) {
         $submitted = array_pop($submitted);
         $this->ctrl->setParameter($this, "ass", $a_assignment_id);
         $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcSubFile");
         $this->ctrl->setParameter($this, "ass", "");
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
         $button = ilLinkButton::getInstance();
         $button->setCaption("download");
         $button->setUrl($dl_link);
         $info .= "<br />" . sprintf($this->lng->txt("prtf_exercise_submitted_info"), ilDatePresentation::formatDate(new ilDateTime($submitted["ts"], IL_CAL_DATETIME)), $button->render());
         ilDatePresentation::setUseRelativeDates($rel);
     }
     // work instructions incl. files
     $tooltip = "";
     $ass = $ass->getInstruction();
     if ($ass) {
         $tooltip .= nl2br($ass);
     }
     $ass_files = ilExAssignment::getFiles($exercise_id, $a_assignment_id);
     if (count($ass_files) > 0) {
         $tooltip .= "<br /><br />";
         foreach ($ass_files as $file) {
             $this->ctrl->setParameter($this, "ass", $a_assignment_id);
             $this->ctrl->setParameter($this, "file", urlencode($file["name"]));
             $dl_link = $this->ctrl->getLinkTarget($this, "downloadExcAssFile");
             $this->ctrl->setParameter($this, "file", "");
             $this->ctrl->setParameter($this, "ass", "");
             $tooltip .= $file["name"] . ": <a href=\"" . $dl_link . "\">" . $this->lng->txt("download") . "</a>";
         }
     }
     if ($tooltip) {
         $ol_id = "exc_ass_" . $a_assignment_id;
         include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php";
         $overlay = new ilOverlayGUI($ol_id);
         // overlay
         $overlay->setAnchor($ol_id . "_tr");
         $overlay->setTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $overlay->setAutoHide(false);
         // $overlay->setCloseElementId($cl_id);
         $overlay->add();
         // trigger
         $overlay->addTrigger($ol_id . "_tr", "click", $ol_id . "_tr");
         $info .= "<div id=\"" . $ol_id . "_tr\"><a href=\"#\">" . $this->lng->txt("exc_instruction") . "</a></div>" . "<div id=\"" . $ol_id . "\" style=\"display:none; background-color:white; border: 1px solid #bbb; padding: 10px;\">" . $tooltip . "</div>";
     }
     return $info;
 }
Example #21
0
 /**
  * Finalizing output processing
  *
  * @param string $a_output
  * @return string
  */
 function postOutputProcessing($a_output)
 {
     // #8626/#9370
     if (($this->getOutputMode() == "preview" || $this->getOutputMode() == "offline") && !$this->getAbstractOnly() && $this->add_date) {
         if (!$this->isInWorkspace()) {
             $author = "";
             $author_id = $this->getBlogPosting()->getAuthor();
             if ($author_id) {
                 include_once "Services/User/classes/class.ilUserUtil.php";
                 $author = ilUserUtil::getNamePresentation($author_id) . " - ";
             }
         }
         // prepend creation date
         $rel = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         $prefix = "<div class=\"il_BlockInfo\" style=\"text-align:right\">" . $author . ilDatePresentation::formatDate($this->getBlogPosting()->getCreated()) . "</div>";
         ilDatePresentation::setUseRelativeDates($rel);
         $a_output = $prefix . $a_output;
     }
     return $a_output;
 }
Example #22
0
 public function outCertificateWithGivenContentAndVariables($content, $insert_tags)
 {
     global $ilLog;
     ilDatePresentation::setUseRelativeDates(false);
     $form_fields = $this->getFormFieldsFromFO();
     $form_fields['certificate_text'] = $content;
     $xslfo = $this->processXHTML2FO($form_fields);
     $content = $this->exchangeCertificateVariables($xslfo, $insert_tags);
     $content = str_replace('[BR]', "<fo:block/>", $content);
     include_once './Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
     try {
         $pdf_base64 = ilRpcClientFactory::factory('RPCTransformationHandler')->ilFO2PDF($content);
         include_once "./Services/Utilities/classes/class.ilUtil.php";
         ilUtil::deliverData($pdf_base64->scalar, $this->getAdapter()->getCertificateFilename(array()), "application/pdf");
     } catch (XML_RPC2_FaultException $e) {
         $ilLog->write(__METHOD__ . ': ' . $e->getMessage());
         return false;
     } catch (Exception $e) {
         $ilLog->write(__METHOD__ . ': ' . $e->getMessage());
         return false;
     }
     ilDatePresentation::setUseRelativeDates(true);
 }
 /**
  * 
  * @param ilLanguage $lng
  * @return 
  */
 public function appointmentToMailString($lng)
 {
     $body = $lng->txt('cal_details');
     $body .= "\n\n";
     $body .= $lng->txt('title') . ': ' . $this->getTitle() . "\n";
     ilDatePresentation::setUseRelativeDates(false);
     $body .= $lng->txt('date') . ': ' . ilDatePresentation::formatPeriod($this->getStart(), $this->getEnd()) . "\n";
     ilDatePresentation::setUseRelativeDates(true);
     if (strlen($this->getLocation())) {
         $body .= $lng->txt('cal_where') . ': ' . $this->getLocation() . "\n";
     }
     if (strlen($this->getDescription())) {
         $body .= $lng->txt('description') . ': ' . $this->getDescription() . "\n";
     }
     return $body;
 }
 /**
  * Build export meta data
  *
  * @return array 
  */
 protected function getExportMeta()
 {
     global $lng, $ilObjDataCache, $ilUser, $ilClientIniFile;
     /* see spec
     			Name of installation
     			Name of the course
     			Permalink to course
     			Owner of course object
     			Date of report generation
     			Reporting period
     			Name of person who generated the report.
     		*/
     ilDatePresentation::setUseRelativeDates(false);
     include_once './Services/Link/classes/class.ilLink.php';
     $data = array();
     $data[$lng->txt("trac_name_of_installation")] = $ilClientIniFile->readVariable('client', 'name');
     if ($this->obj_id) {
         $data[$lng->txt("trac_object_name")] = $ilObjDataCache->lookupTitle($this->obj_id);
         if ($this->ref_id) {
             $data[$lng->txt("trac_object_link")] = ilLink::_getLink($this->ref_id, ilObject::_lookupType($this->obj_id));
         }
         $data[$lng->txt("trac_object_owner")] = ilObjUser::_lookupFullname(ilObject::_lookupOwner($this->obj_id));
     }
     $data[$lng->txt("trac_report_date")] = ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX), IL_CAL_DATETIME);
     $data[$lng->txt("trac_report_owner")] = $ilUser->getFullName();
     return $data;
 }
 /**
  * Render object evaluation row (has_level table)
  *
  * @param
  * @return
  */
 function renderObjectEvalRow($a_tpl, $a_levels, $a_level_entry)
 {
     $se_level = $a_level_entry["level_id"];
     // check, if current self eval level is in current level data
     $valid_sel_level = false;
     if ($se_level > 0) {
         foreach ($a_levels as $k => $v) {
             if ($v["id"] == $se_level) {
                 $valid_sel_level = true;
             }
         }
     }
     reset($a_levels);
     $found = false;
     foreach ($a_levels as $k => $v) {
         $a_tpl->setCurrentBlock("val_level_td");
         if ($valid_sel_level && !$found) {
             $a_tpl->setVariable("VAL_LEVEL", "x");
             $a_tpl->setVariable("TD_CLASS", "ilSkillSelf");
         } else {
             $a_tpl->setVariable("VAL_LEVEL", " ");
         }
         $a_tpl->parseCurrentBlock();
         if ($v["id"] == $se_level) {
             $found = true;
         }
     }
     $a_tpl->setCurrentBlock("value_row");
     ilDatePresentation::setUseRelativeDates(false);
     $a_tpl->setVariable("TXT_VAL_TITLE", $a_level_entry["trigger_title"] . ", " . ilDatePresentation::formatDate(new ilDateTime($a_level_entry["status_date"], IL_CAL_DATETIME)));
     ilDatePresentation::setUseRelativeDates(true);
     $a_tpl->parseCurrentBlock();
 }
 protected function confirmDeleteAppointment($inRecurrence = false)
 {
     global $tpl, $ilTabs;
     $ilTabs->activateTab('content');
     try {
         $booking_service = new ilViteroBookingSoapConnector();
         $book = $booking_service->getBookingById($_REQUEST['bookid']);
     } catch (ilViteroConnectorException $e) {
         ilUtil::sendFailure($e->getMessage(), true);
         $GLOBALS['ilCtrl']->redirect($this, 'showContent');
     }
     include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
     $confirm = new ilConfirmationGUI();
     $confirm->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
     $confirm->setHeaderText(ilViteroPlugin::getInstance()->txt('sure_delete_appointment'));
     if ($inRecurrence) {
         $start = new ilDateTime($_REQUEST['atime'], IL_CAL_UNIX);
         $confirm->setConfirm($GLOBALS['lng']->txt('delete'), 'deleteBookingInSeries');
     } else {
         $start = ilViteroUtils::parseSoapDate($book->booking->start);
         $confirm->setConfirm($GLOBALS['lng']->txt('delete'), 'deleteBooking');
     }
     ilDatePresentation::setUseRelativeDates(false);
     $confirm->addItem('bookid[]', (int) $_REQUEST['bookid'], ilDatePresentation::formatDate($start));
     if ($inRecurrence) {
         $confirm->addHiddenItem('atime', $_REQUEST['atime']);
     }
     $confirm->setCancel($GLOBALS['lng']->txt('cancel'), 'showContent');
     $tpl->setContent($confirm->getHTML());
 }
 /**
  * Fill data section
  */
 function fillDataSection()
 {
     global $lng;
     $btpl = new ilTemplate("tpl.wiki_advmd_block.html", true, true, "Modules/Wiki");
     // see ilAdvancedMDRecordGUI::parseInfoPage()
     $old_dt = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDValues.php';
     include_once 'Services/ADT/classes/class.ilADTFactory.php';
     $values = new ilAdvancedMDValues($this->record->getRecordId(), $this->obj_id, "wpg", $this->page_id);
     // this correctly binds group and definitions
     $values->read();
     $defs = $values->getDefinitions();
     foreach ($values->getADTGroup()->getElements() as $element_id => $element) {
         $btpl->setCurrentBlock("item");
         $btpl->setVariable("CAPTION", $defs[$element_id]->getTitle());
         if ($element->isNull()) {
             $value = "-";
         } else {
             $value = ilADTFactory::getInstance()->getPresentationBridgeForInstance($element);
             if ($element instanceof ilADTLocation) {
                 $value->setSize("100%", "200px");
             }
             $value = $value->getHTML();
         }
         $btpl->setVariable("VALUE", $value);
         $btpl->parseCurrentBlock();
     }
     /*
     if ($this->isHidden())
     {
     	$btpl->setVariable("HIDDEN_INFO", $lng->txt("wiki_adv_md_hidden"));			
     }
     */
     $this->setDataSection($btpl->get());
     ilDatePresentation::setUseRelativeDates($old_dt);
     return;
 }
 /**
  * Delete own account dialog - action incl. notification email
  */
 protected function deleteOwnAccount4()
 {
     global $ilUser, $ilAuth, $ilSetting, $ilLog;
     if (!(bool) $ilSetting->get('user_delete_own_account') || $ilUser->getId() == SYSTEM_USER_ID || !$ilUser->hasDeletionFlag()) {
         $this->ctrl->redirect($this, "showGeneralSettings");
     }
     // build notification
     include_once "./Services/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification();
     $ntf->setLangModules(array("user"));
     $ntf->addAdditionalInfo("profile", $ilUser->getProfileAsString($this->lng), true);
     // mail message
     ilDatePresentation::setUseRelativeDates(false);
     $ntf->setIntroductionDirect(sprintf($this->lng->txt("user_delete_own_account_email_body"), $ilUser->getLogin(), ILIAS_HTTP_PATH, ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX))));
     $message = $ntf->composeAndGetMessage($ilUser->getId(), null, null, true);
     $subject = $this->lng->txt("user_delete_own_account_email_subject");
     // send notification
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     $user_email = $ilUser->getEmail();
     $admin_mail = $ilSetting->get("user_delete_own_account_email");
     // to user, admin as bcc
     if ($user_email) {
         $mail->sendMimeMail($user_email, null, $admin_mail, $subject, $message, null, true);
     } else {
         if ($admin_mail) {
             $mail->sendMimeMail($admin_mail, null, null, $subject, $message, null, true);
         }
     }
     $ilLog->write("Account deleted: " . $ilUser->getLogin() . " (" . $ilUser->getId() . ")");
     $ilUser->delete();
     // terminate session
     $ilAuth->logout();
     session_destroy();
     ilUtil::redirect("login.php?accdel=1");
 }
 /**
  * Prepares history table and displays it.
  *
  * @global ilTemplate $tpl
  * @global ilLanguage $lng
  * @param array $messages
  * @param ilPropertyFormGUI $durationForm
  */
 private function showMessages($messages, $durationForm, $export = false, $psessions = array(), $from, $to)
 {
     //global $tpl, $ilUser, $ilCtrl, $lng;
     global $tpl, $lng, $ilCtrl;
     include_once 'Modules/Chatroom/classes/class.ilChatroom.php';
     if (!ilChatroom::checkUserPermissions('read', $this->gui->ref_id)) {
         $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", ROOT_FOLDER_ID);
         $ilCtrl->redirectByClass("ilrepositorygui", "");
     }
     $this->gui->switchToVisibleMode();
     $tpl->addCSS('Modules/Chatroom/templates/default/style.css');
     // should be able to grep templates
     if ($export) {
         $roomTpl = new ilTemplate('tpl.history_export.html', true, true, 'Modules/Chatroom');
     } else {
         $roomTpl = new ilTemplate('tpl.history.html', true, true, 'Modules/Chatroom');
     }
     $scopes = array();
     if ($export) {
         ilDatePresentation::setUseRelativeDates(false);
     }
     global $ilUser;
     $time_format = $ilUser->getTimeFormat();
     $prevDate = '';
     $messagesShown = 0;
     $lastDateTime = null;
     foreach ($messages as $message) {
         $message['message']->message = json_decode($message['message']->message);
         switch ($message['message']->type) {
             case 'message':
                 if ($_REQUEST['scope'] && $message['message']->sub == $_REQUEST['scope'] || !$_REQUEST['scope'] && !$message['message']->sub) {
                     $date = new ilDate($message['timestamp'], IL_CAL_UNIX);
                     $dateTime = new ilDateTime($message['timestamp'], IL_CAL_UNIX);
                     $currentDate = ilDatePresentation::formatDate($dateTime);
                     $roomTpl->setCurrentBlock('MESSAGELINE');
                     $roomTpl->setVariable('MESSAGECONTENT', $message['message']->message->content);
                     // oops... it is a message? ^^
                     $roomTpl->setVariable('MESSAGESENDER', $message['message']->user->username);
                     if (null == $lastDateTime || date('d', $lastDateTime->get(IL_CAL_UNIX)) != date('d', $dateTime->get(IL_CAL_UNIX)) || date('m', $lastDateTime->get(IL_CAL_UNIX)) != date('m', $dateTime->get(IL_CAL_UNIX)) || date('Y', $lastDateTime->get(IL_CAL_UNIX)) != date('Y', $dateTime->get(IL_CAL_UNIX))) {
                         $roomTpl->setVariable('MESSAGEDATE', ilDatePresentation::formatDate($date));
                     }
                     if ($prevDate != $currentDate) {
                         switch ($time_format) {
                             case ilCalendarSettings::TIME_FORMAT_24:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'H:i', $ilUser->getTimeZone());
                                 break;
                             case ilCalendarSettings::TIME_FORMAT_12:
                                 $date_string = $dateTime->get(IL_CAL_FKT_DATE, 'g:ia', $ilUser->getTimeZone());
                                 break;
                         }
                         $roomTpl->setVariable('MESSAGETIME', $date_string);
                         $prevDate = $currentDate;
                     }
                     $roomTpl->parseCurrentBlock();
                     $lastDateTime = $dateTime;
                     ++$messagesShown;
                 }
                 break;
         }
     }
     foreach ($psessions as $session) {
         $scopes[$session['proom_id']] = $session['title'];
     }
     if (isset($scopes[''])) {
         unset($scopes['']);
     }
     if (!$messagesShown) {
         //$roomTpl->touchBlock('NO_MESSAGES');
         $roomTpl->setVariable('LBL_NO_MESSAGES', $lng->txt('no_messages'));
     }
     asort($scopes, SORT_STRING);
     $scopes = array($lng->txt('main')) + $scopes;
     if (count($scopes) > 1) {
         $select = new ilSelectInputGUI($lng->txt('scope'), 'scope');
         $select->setOptions($scopes);
         if (isset($_REQUEST['scope'])) {
             $select->setValue($_REQUEST['scope']);
         }
         $durationForm->addItem($select);
     }
     $room = ilChatroom::byObjectId($this->gui->object->getId());
     //if ($room->getSetting('private_rooms_enabled')) {
     $prevUseRelDates = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $unixFrom = $from->getUnixTime();
     $unixTo = $to->getUnixTime();
     if ($unixFrom == $unixTo) {
         $date = new ilDate($unixFrom, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatDate($date);
     } else {
         $date1 = new ilDate($unixFrom, IL_CAL_UNIX);
         $date2 = new ilDate($unixTo, IL_CAL_UNIX);
         $date_sub = ilDatePresentation::formatPeriod($date1, $date2);
     }
     ilDatePresentation::setUseRelativeDates($prevUseRelDates);
     $isPrivateRoom = (bool) (int) $_REQUEST['scope'];
     if ($isPrivateRoom) {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_private_room'), $scopes[(int) $_REQUEST['scope']]) . ' (' . $date_sub . ')');
     } else {
         $roomTpl->setVariable('ROOM_TITLE', sprintf($lng->txt('history_title_general'), $this->gui->object->getTitle()) . ' (' . $date_sub . ')');
     }
     //}
     if ($export) {
         header("Content-Type: text/html");
         header("Content-Disposition: attachment; filename=\"" . urlencode($scopes[(int) $_REQUEST['scope']] . '.html') . "\"");
         echo $roomTpl->get();
         exit;
     }
     $roomTpl->setVariable('PERIOD_FORM', $durationForm->getHTML());
     $tpl->setVariable('ADM_CONTENT', $roomTpl->get());
 }
 protected function fillRowCSV($a_csv, $a_set)
 {
     $a_csv->addColumn($this->lng->txt($a_set["type"]));
     $a_csv->addColumn($a_set["title"]);
     $a_csv->addColumn(ilLearningProgressBaseGUI::_getStatusText($a_set["status"]));
     ilDatePresentation::setUseRelativeDates(false);
     $a_csv->addColumn(ilDatePresentation::formatDate(new ilDateTime($a_set['status_changed'], IL_CAL_DATETIME)));
     ilDatePresentation::resetToDefaults();
     $a_csv->addColumn(sprintf("%d%%", $a_set["percentage"]));
     $a_csv->addColumn($a_set["mark"]);
     $a_csv->addColumn($a_set["comment"]);
     $a_csv->addColumn(ilLPObjSettings::_mode2Text($a_set["u_mode"]));
     /*
     // path
     $path = $this->buildPath($a_set["ref_ids"]);
     if($path)
     {
     	$col = 7;
     	foreach($path as $path_item)
     	{
     		$a_csv->addColumn(strip_tags($path_item));
     		$col++;
     	}
     }
     */
     $a_csv->addRow();
 }