当前位置: 首页>>代码示例>>PHP>>正文


PHP ilDatePresentation::useRelativeDates方法代码示例

本文整理汇总了PHP中ilDatePresentation::useRelativeDates方法的典型用法代码示例。如果您正苦于以下问题:PHP ilDatePresentation::useRelativeDates方法的具体用法?PHP ilDatePresentation::useRelativeDates怎么用?PHP ilDatePresentation::useRelativeDates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilDatePresentation的用法示例。


在下文中一共展示了ilDatePresentation::useRelativeDates方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fillRow

 /**
  * @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']);
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:32,代码来源:class.ilTestPassOverviewTableGUI.php

示例2: getCertificateVariablesForPresentation

 /**
  * 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:34,代码来源:class.ilSkillCertificateAdapter.php

示例3: send

 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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:25,代码来源:class.ilCronDeleteInactiveUserReminderMailNotification.php

示例4: fillRow

 /**
  * @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);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:17,代码来源:class.ilTestPassOverviewTableGUI.php

示例5: showMessages

 /**
  * 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);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilChatroomHistoryTask.php

示例6: getExerciseInfo

 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>";
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:70,代码来源:class.ilObjBlogGUI.php

示例7: fillDataSection

 /**
  * 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:41,代码来源:class.ilWikiAdvMetaDataBlockGUI.php

示例8: postOutputProcessing

 /**
  * 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;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:27,代码来源:class.ilBlogPostingGUI.php

示例9: getBaseVariablesForPresentation

 /**
  * 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;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:41,代码来源:class.ilCertificateAdapter.php

示例10: showLastResetDate

 /**
  *
  */
 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);
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:16,代码来源:class.ilObjTermsOfServiceGUI.php

示例11: fillRow

 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);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:65,代码来源:class.ilPollBlockGUI.php

示例12: getExerciseInfo

 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:82,代码来源:class.ilObjPortfolioGUI.php

示例13: getNoteListHTML


//.........这里部分代码省略.........
             if ($ilUser->getId() != ANONYMOUS_USER_ID) {
                 if ($a_type == IL_NOTE_PUBLIC) {
                     $txt = $lng->txt("notes_hide_comments");
                 } else {
                     $txt = $lng->txt("hide_" . $suffix . "_notes");
                 }
                 $this->renderLink($tpl, "hide_notes", $txt, "hideNotes", "notes_top");
                 // show all public notes / my notes only switch
                 if ($a_type == IL_NOTE_PUBLIC) {
                     if ($user_setting_notes_public_all == "n") {
                         $this->renderLink($tpl, "all_pub_notes", $lng->txt("notes_all_comments"), "showAllPublicNotes", "notes_top");
                     } else {
                         $this->renderLink($tpl, "my_pub_notes", $lng->txt("notes_my_comments"), "showMyPublicNotes", "notes_top");
                     }
                 }
             }
         }
     }
     // show add new note text area
     if (!$this->edit_note_form && $user_setting_notes_by_type != "n" && !$this->delete_note && $ilUser->getId() != ANONYMOUS_USER_ID) {
         if ($a_init_form) {
             $this->initNoteForm("create", $a_type);
         }
         $tpl->setCurrentBlock("edit_note_form");
         //			$tpl->setVariable("EDIT_FORM", $this->form->getHTML());
         $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
         $tpl->parseCurrentBlock();
         $tpl->parseCurrentBlock();
         $tpl->setCurrentBlock("note_row");
         $tpl->parseCurrentBlock();
     }
     // list all notes
     if ($user_setting_notes_by_type != "n" || !$this->enable_hiding) {
         $reldates = ilDatePresentation::useRelativeDates();
         ilDatePresentation::setUseRelativeDates(false);
         if (sizeof($notes)) {
             if ((int) $_SESSION["comments_sort_asc"] == 1) {
                 $sort_txt = $lng->txt("notes_sort_desc");
                 $sort_cmd = "listSortDesc";
             } else {
                 $sort_txt = $lng->txt("notes_sort_asc");
                 $sort_cmd = "listSortAsc";
             }
             $this->renderLink($tpl, "sort_list", $sort_txt, $sort_cmd, $anch);
         }
         $notes_given = false;
         foreach ($notes as $note) {
             if ($this->edit_note_form && $note->getId() == $_GET["note_id"] && $a_type == $_GET["note_type"]) {
                 if ($a_init_form) {
                     $this->initNoteForm("edit", $a_type, $note);
                 }
                 $tpl->setCurrentBlock("edit_note_form");
                 //					$tpl->setVariable("EDIT_FORM", $this->form->getHTML());
                 $tpl->setVariable("EDIT_FORM", $this->form_tpl->get());
                 $tpl->parseCurrentBlock();
             } else {
                 $cnt_col = 2;
                 // delete note stuff for all private notes
                 if ($this->checkDeletion($note) && !$this->delete_note && !$this->export_html && !$this->print && !$this->edit_note_form && !$this->add_note_form) {
                     $ilCtrl->setParameterByClass("ilnotegui", "note_id", $note->getId());
                     $this->renderLink($tpl, "delete_note", $lng->txt("delete"), "deleteNote", "note_" . $note->getId());
                 }
                 // checkboxes in multiselection mode
                 if ($this->multi_selection && !$this->delete_note) {
                     $tpl->setCurrentBlock("checkbox_col");
                     $tpl->setVariable("CHK_NOTE", "note[]");
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilNoteGUI.php

示例14: displayPostInfo

 public function displayPostInfo()
 {
     global $tpl, $ilUser, $lng, $ilCtrl;
     $id = (int) $_GET["object_id"];
     if (!$id) {
         return;
     }
     // placeholder
     include_once 'Modules/BookingManager/classes/class.ilBookingReservation.php';
     $book_ids = ilBookingReservation::getObjectReservationForUser($id, $ilUser->getId(), true);
     $tmp = array();
     $rsv_ids = explode(";", $_GET["rsv_ids"]);
     foreach ($book_ids as $book_id) {
         if (in_array($book_id, $rsv_ids)) {
             $obj = new ilBookingReservation($book_id);
             $from = $obj->getFrom();
             $to = $obj->getTo();
             if ($from > time()) {
                 $tmp[$from . "-" . $to]++;
             }
         }
     }
     $olddt = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $period = array();
     ksort($tmp);
     foreach ($tmp as $time => $counter) {
         $time = explode("-", $time);
         $time = ilDatePresentation::formatPeriod(new ilDateTime($time[0], IL_CAL_UNIX), new ilDateTime($time[1], IL_CAL_UNIX));
         if ($counter > 1) {
             $time .= " (" . $counter . ")";
         }
         $period[] = $time;
     }
     $book_id = array_shift($book_ids);
     ilDatePresentation::setUseRelativeDates($olddt);
     $obj = new ilBookingReservation($book_id);
     if ($obj->getUserId() != $ilUser->getId()) {
         return;
     }
     include_once 'Modules/BookingManager/classes/class.ilBookingObject.php';
     $obj = new ilBookingObject($id);
     $pfile = $obj->getPostFile();
     $ptext = $obj->getPostText();
     $mytpl = new ilTemplate('tpl.booking_reservation_post.html', true, true, 'Modules/BookingManager');
     $mytpl->setVariable("TITLE", $lng->txt('book_post_booking_information'));
     if ($ptext) {
         // placeholder
         $ptext = str_replace("[OBJECT]", $obj->getTitle(), $ptext);
         $ptext = str_replace("[PERIOD]", implode("<br />", $period), $ptext);
         $mytpl->setVariable("POST_TEXT", nl2br($ptext));
     }
     if ($pfile) {
         $ilCtrl->setParameter($this, "object_id", $obj->getId());
         $url = $ilCtrl->getLinkTarget($this, 'deliverPostFile');
         $ilCtrl->setParameter($this, "object_id", "");
         $mytpl->setVariable("DOWNLOAD", $lng->txt('download'));
         $mytpl->setVariable("URL_FILE", $url);
         $mytpl->setVariable("TXT_FILE", $pfile);
     }
     $mytpl->setVariable("TXT_SUBMIT", $lng->txt('ok'));
     $mytpl->setVariable("URL_SUBMIT", $ilCtrl->getLinkTargetByClass('ilobjbookingpoolgui', 'render'));
     $tpl->setContent($mytpl->get());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:64,代码来源:class.ilBookingObjectGUI.php

示例15: getResultsUserdata

 /**
  * Returns the user data for a test results output
  *
  * @param ilTestSession|ilTestSessionDynamicQuestionSet
  * @param integer $user_id The user ID of the user
  * @param boolean $overwrite_anonymity TRUE if the anonymity status should be overwritten, FALSE otherwise
  * @return string HTML code of the user data for the test results
  * @access public
  */
 function getResultsUserdata($testSession, $active_id, $overwrite_anonymity = FALSE)
 {
     if (!is_object($testSession)) {
         throw new TestException();
     }
     $template = new ilTemplate("tpl.il_as_tst_results_userdata.html", TRUE, TRUE, "Modules/Test");
     include_once './Services/User/classes/class.ilObjUser.php';
     $user_id = $this->object->_getUserIdFromActiveId($active_id);
     if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
         $user = new ilObjUser($user_id);
     } else {
         $user = new ilObjUser();
         $user->setLastname($this->lng->txt("deleted_user"));
     }
     $t = $testSession->getSubmittedTimestamp();
     if (!$t) {
         $t = $this->object->_getLastAccess($testSession->getActiveId());
     }
     $print_date = mktime(date("H"), date("i"), date("s"), date("m"), date("d"), date("Y"));
     $title_matric = "";
     if (strlen($user->getMatriculation()) && ($this->object->getAnonymity() == FALSE || $overwrite_anonymity)) {
         $template->setCurrentBlock("user_matric");
         $template->setVariable("TXT_USR_MATRIC", $this->lng->txt("matriculation"));
         $template->parseCurrentBlock();
         $template->setCurrentBlock("user_matric_value");
         $template->setVariable("VALUE_USR_MATRIC", $user->getMatriculation());
         $template->parseCurrentBlock();
         $template->touchBlock("user_matric_separator");
         $title_matric = " - " . $this->lng->txt("matriculation") . ": " . $user->getMatriculation();
     }
     $invited_user = array_pop($this->object->getInvitedUsers($user_id));
     if (strlen($invited_user["clientip"])) {
         $template->setCurrentBlock("user_clientip");
         $template->setVariable("TXT_CLIENT_IP", $this->lng->txt("client_ip"));
         $template->parseCurrentBlock();
         $template->setCurrentBlock("user_clientip_value");
         $template->setVariable("VALUE_CLIENT_IP", $invited_user["clientip"]);
         $template->parseCurrentBlock();
         $template->touchBlock("user_clientip_separator");
         $title_client = " - " . $this->lng->txt("clientip") . ": " . $invited_user["clientip"];
     }
     $template->setVariable("TXT_TEST_TITLE", $this->lng->txt("title"));
     $template->setVariable("VALUE_TEST_TITLE", $this->object->getTitle());
     $template->setVariable("TXT_USR_NAME", $this->lng->txt("name"));
     $uname = $this->object->userLookupFullName($user_id, $overwrite_anonymity);
     $template->setVariable("VALUE_USR_NAME", $uname);
     $template->setVariable("TXT_TEST_DATE", $this->lng->txt("tst_tst_date"));
     $template->setVariable("TXT_PRINT_DATE", $this->lng->txt("tst_print_date"));
     $old_value = ilDatePresentation::useRelativeDates();
     ilDatePresentation::setUseRelativeDates(false);
     $template->setVariable("VALUE_TEST_DATE", ilDatePresentation::formatDate(new ilDateTime(ilUtil::date_mysql2time($t), IL_CAL_UNIX)));
     $template->setVariable("VALUE_PRINT_DATE", ilDatePresentation::formatDate(new ilDateTime($print_date, IL_CAL_UNIX)));
     ilDatePresentation::setUseRelativeDates($old_value);
     // change the pagetitle
     $pagetitle = ": " . $this->object->getTitle() . $title_matric . $title_client;
     $this->tpl->setHeaderPageTitle($pagetitle);
     return $template->get();
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilTestServiceGUI.php


注:本文中的ilDatePresentation::useRelativeDates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。