本文整理汇总了PHP中ilDatePresentation类的典型用法代码示例。如果您正苦于以下问题:PHP ilDatePresentation类的具体用法?PHP ilDatePresentation怎么用?PHP ilDatePresentation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilDatePresentation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatDateTimeField
/**
* @static
* @param $value string
* @return string
*/
protected static function formatDateTimeField($value)
{
if (!strlen($value)) {
return $value;
}
return ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_DATETIME));
}
示例2: fillRow
/**
* Fill table row
*/
protected function fillRow($d)
{
global $lng, $ilCtrl;
$this->tpl->setVariable("ID", $d["id"]);
if ($d["deadline"] > 0) {
$this->tpl->setVariable("TXT_DEADLINE", ilDatePresentation::formatDate(new ilDateTime($d["deadline"], IL_CAL_UNIX)));
}
if ($d["start_time"] > 0) {
$this->tpl->setVariable("TXT_START_TIME", ilDatePresentation::formatDate(new ilDateTime($d["start_time"], IL_CAL_UNIX)));
}
$this->tpl->setVariable("TXT_INSTRUCTIONS", ilUtil::shortenText($d["instruction"], 200, true));
if ($d["mandatory"]) {
$this->tpl->setVariable("TXT_MANDATORY", $lng->txt("yes"));
} else {
$this->tpl->setVariable("TXT_MANDATORY", $lng->txt("no"));
}
if ($d["peer"]) {
$this->tpl->setVariable("TXT_PEER", $lng->txt("yes") . " (" . $d["peer_min"] . ")");
} else {
$this->tpl->setVariable("TXT_PEER", $lng->txt("no"));
}
$this->tpl->setVariable("TXT_TITLE", $d["title"]);
$this->tpl->setVariable("TXT_TYPE", $d["type"]);
$this->tpl->setVariable("ORDER_VAL", $d["order_val"]);
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$ilCtrl->setParameter($this->parent_obj, "ass_id", $d["id"]);
$this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTarget($this->parent_obj, "editAssignment"));
}
示例3: ilEphorusReportHeaderTableGUI
function ilEphorusReportHeaderTableGUI($a_parent_obj, $a_parent_cmd, $document)
{
global $ilCtrl, $lng;
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->setTopCommands(false);
$this->addColumn($lng->txt("rep_robj_xeph_document_info"));
$this->addColumn("");
$this->setEnableHeader(true);
$this->setRowTemplate("tpl.eph_report_header.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
$this->disable("footer");
$member = ilObjUser::_lookupName($document->user_id);
$a_data = array();
$student = array();
$student["key"] = "student";
$student["value"] = $member["firstname"] . " " . $member["lastname"];
array_push($a_data, $student);
$ilCtrl->setParameter($this->parent_obj, "filename", $document->filename);
$ilCtrl->setParameter($this->parent_obj, "filetitle", $document->filetitle);
$ilCtrl->setParameter($this->parent_obj, "part_id", $document->user_id);
$doc = array();
$doc["key"] = "document";
$doc["value"] = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "downloadSubmittedFile") . "\">" . $document->filetitle . "</a>";
array_push($a_data, $doc);
$ilCtrl->setParameter($this->parent_obj, "filename", "");
$ilCtrl->setParameter($this->parent_obj, "filetitle", "");
$submission_date = array();
$submission_date["key"] = "submission_date";
$submission_date["value"] = ilDatePresentation::formatDate(new ilDateTime($document->date_created, IL_CAL_DATETIME));
array_push($a_data, $submission_date);
$this->setData($a_data);
}
示例4: 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);
}
示例5: sendAdvancedNotification
/**
* 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'));
}
示例6: fillRow
/**
* Fill template row
*
* @param array $a_set
*/
protected function fillRow($a_set)
{
$date = ilDatePresentation::formatDate(new ilDateTime($a_set["tstamp"], IL_CAL_UNIX));
$this->tpl->setVariable("TSTAMP", $date);
$this->tpl->setVariable("TXT_USER", $a_set["user"]);
$this->tpl->setVariable("TXT_DETAILS", $a_set["details"]);
}
示例7: 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']);
}
}
示例8: getHTML
public function getHTML()
{
if (!$this->getADT()->isNull()) {
// :TODO: relative dates?
return ilDatePresentation::formatDate($this->getADT()->getDate());
}
}
示例9: fillRow
protected function fillRow($a_set)
{
$this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["created"], IL_CAL_UNIX)));
$name = ilObjUser::_lookupName($a_set["user_id"]);
$this->tpl->setVariable("LASTNAME", $name["lastname"]);
$this->tpl->setVariable("FIRSTNAME", $name["firstname"]);
$this->tpl->setVariable("LOGIN", $name["login"]);
$this->tpl->setVariable("ACTION", $this->action_map[$a_set["action"]]);
if ($a_set["action"] == ilRbacLog::CHANGE_OWNER) {
$user = ilObjUser::_lookupFullname($a_set["data"][0]);
$changes = array(array("action" => $this->lng->txt("rbac_log_changed_owner"), "operation" => $user));
} else {
if ($a_set["action"] == ilRbacLog::EDIT_TEMPLATE) {
$changes = $this->parseChangesTemplate($a_set["data"]);
} else {
$changes = $this->parseChangesFaPa($a_set["data"]);
}
}
$this->tpl->setCurrentBlock("changes");
foreach ($changes as $change) {
$this->tpl->setVariable("CHANGE_ACTION", $change["action"]);
$this->tpl->setVariable("CHANGE_OPERATION", $change["operation"]);
$this->tpl->parseCurrentBlock();
}
}
示例10: 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;
}
示例11: fillRow
/**
* Fill a single data row.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl;
// box title
if ($a_set["box"] == 0) {
$this->tpl->setVariable("BOX", $this->plugin->txt("leitner_box_0_title"));
} else {
$this->tpl->setVariable("BOX", sprintf($this->plugin->txt("leitner_box_x_title"), $a_set["box"]));
}
// box data
$this->tpl->setVariable("CAPACITY", $a_set["capacity"]);
$this->tpl->setVariable("COUNT", $a_set["count"]);
$this->tpl->setVariable("LAST_TRAINED", ilDatePresentation::formatDate($a_set["last_trained"]));
// actions
if ($a_set["count"]) {
$ilCtrl->setParameter($this->parent, "box", $a_set["box"]);
$this->tpl->setVariable("LINK_TRAINING", $ilCtrl->getLinkTarget($this->parent, "startTraining"));
$this->tpl->setVariable("TXT_TRAINING", $this->plugin->txt("start_training"));
}
// training alert
if ($a_set["count"] >= $a_set["capacity"]) {
$this->tpl->setVariable("SRC_TRAINING_ALERT", $this->plugin->getImagePath("clock.png"));
$this->tpl->setVariable("TXT_TRAINING_ALERT", $this->plugin->txt("training_needed"));
}
}
示例12: fillRow
/**
* Fill table row
*/
protected function fillRow($file)
{
global $lng;
$this->tpl->setVariable("FILE_ID", $file["id"]);
$this->tpl->setVariable("DELIVERED_FILE", $file["filetitle"]);
$date = new ilDateTime($file['timestamp14'], IL_CAL_TIMESTAMP);
$this->tpl->setVariable("DELIVERED_DATE", ilDatePresentation::formatDate($date));
}
示例13: fillRowExcel
protected function fillRowExcel($a_worksheet, &$a_row, $a_set)
{
$a_worksheet->write($a_row, 0, $a_set["login"]);
$a_worksheet->write($a_row, 1, $a_set["firstname"]);
$a_worksheet->write($a_row, 2, $a_set["lastname"]);
$a_worksheet->write($a_row, 3, ilFormat::_secondsToShortString($a_set["online_time"]));
$a_worksheet->write($a_row, 4, ilDatePresentation::formatDate(new ilDateTime($a_set["last_login"], IL_CAL_DATETIME)));
}
示例14: fillRow
/**
* Fill table row
*/
protected function fillRow($file)
{
global $lng;
$this->tpl->setVariable("FILE_ID", $file["returned_id"]);
$this->tpl->setVariable("DELIVERED_FILE", $file["filetitle"]);
$date = new ilDateTime($file['timestamp14'], IL_CAL_TIMESTAMP);
$this->tpl->setVariable("DELIVERED_DATE", ilDatePresentation::formatDate($date));
if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) {
$this->tpl->setVariable("DELIVERED_OWNER", ilUserUtil::getNamePresentation($file["owner_id"]));
}
}
示例15: formatValue
/**
* @param string $column
* @param string $value
* @return string
*/
protected function formatValue($column, $value)
{
switch ($column) {
case 'filecreatedate':
return ilDatePresentation::formatDate(new ilDateTime($value, IL_CAL_UNIX));
case 'filesize':
return ilFormat::formatSize($value);
default:
return $value;
}
}