ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilDatePresentation Class Reference

Class for date presentation. More...

+ Collaboration diagram for ilDatePresentation:

Static Public Member Functions

static setUseRelativeDates ($a_status)
 set use relative dates More...
 
static useRelativeDates ()
 check if relative dates are used More...
 
static setLanguage ($a_lng)
 set language More...
 
static getLanguage ()
 set language More...
 
static resetToDefaults ()
 reset to defaults More...
 
static formatDate (ilDateTime $date)
 Format a date public. More...
 
static formatPeriod (ilDateTime $start, ilDateTime $end)
 Format a period of two date Shows: 14. More...
 
static isToday (ilDateTime $date)
 Check if date is "today". More...
 
static isYesterday (ilDateTime $date)
 Check if date is yesterday. More...
 
static isTomorrow (ilDateTime $date)
 Check if date is tomorrow. More...
 
static secondsToString ($seconds, $force_with_seconds=false, $a_lng=null)
 converts seconds to string: Long: 7 days 4 hour(s) ... More...
 

Static Public Attributes

static $use_relative_dates = true
 
static $today = null
 
static $tomorrow = null
 
static $yesterday = null
 

Static Private Attributes

static $lang = null
 

Detailed Description

Class for date presentation.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 35 of file class.ilDatePresentation.php.

Member Function Documentation

◆ formatDate()

static ilDatePresentation::formatDate ( ilDateTime  $date)
static

Format a date public.

Parameters
object$dateilDate or ilDateTime
Returns
string date presentation in user specific timezone and language

Definition at line 113 of file class.ilDatePresentation.php.

References $ilUser, $lng, ilCalendarUtil\_numericMonthToString(), ilDateTime\get(), IL_CAL_FKT_DATE, IL_CAL_FKT_GETDATE, ilDateTime\isNull(), ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilLearningProgressBaseGUI\__appendUserInfo(), ilChatroomHistoryGUI\__construct(), ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), ilObjGroupAccess\_checkAccess(), ilObjCourseAccess\_checkAccess(), ilObject\_lookupLastUpdate(), ilObjRemoteFileGUI\addCustomInfoFields(), ilInfoScreenGUI\addObjectSections(), ilExAssignmentGUI\addSchedule(), ilExAssignmentGUI\addSubmission(), ilForumMailNotification\appendAttachments(), ilObjBookingPoolGUI\buildDatesBySchedule(), ilMailFolderGUI\cancelDeleteMails(), ilObjSurvey\canStartSurvey(), ilConsultationHoursGUI\confirmDelete(), ilMemberExportGUI\confirmDeleteExportFile(), ilSCORM2004ScoGUI\confirmDeleteExportFile(), ilObjSCORM2004LearningModuleGUI\confirmDeleteExportFile(), ilObjSurveyQuestionPoolGUI\confirmDeleteExportFileObject(), ilObjLanguageFolderGUI\confirmRefreshSelectedObject(), ilCalendarAppointmentGUI\confirmRegister(), ilConsultationHoursGUI\confirmRejectBooking(), ilCalendarAppointmentGUI\confirmUnregister(), ilForum\convertDate(), ilPersonalSettingsGUI\deleteOwnAccount4(), ilObjUser\deleteUserDefinedFieldEntries(), ilTestEvaluationGUI\detailedEvaluation(), ilObjForumGUI\doHistoryCheck(), ilPageObjectGUI\edit(), ilExSubmissionTextGUI\editAssignmentTextObject(), ilExPeerReviewGUI\editPeerReviewObject(), ilCourseContentGUI\editTimings(), ilTestPlayerAbstractGUI\endingTimeReached(), ilSurveyEvaluationGUI\evaluation(), ilSessionStatisticsGUI\exportCSV(), ilSurveyEvaluationGUI\exportEvaluationUser(), ilObjSurveyQuestionPoolGUI\exportObject(), ilObjUserFolderGUI\exportObject(), ilTestExport\exportToCSV(), ilECSSetting\fetchCertificateExpiration(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilNewsForContextTableGUI\fillRow(), ilSubItemSelectionTableGUI\fillRow(), ilTestPersonalDefaultSettingsTableGUI\fillRow(), ilECSServerTableGUI\fillRow(), ilPublicSubmissionsTableGUI\fillRow(), ilHelpModuleTableGUI\fillRow(), ilPageHistoryTableGUI\fillRow(), ilExportSelectionTableGUI\fillRow(), ilAssessmentFolderLogTableGUI\fillRow(), ilForumDraftsTableGUI\fillRow(), ilTestHistoryTableGUI\fillRow(), ilMediaCastTableGUI\fillRow(), ilMemberExportFileTableGUI\fillRow(), ilHistoryTableGUI\fillRow(), ilTestPassManualScoringOverviewTableGUI\fillRow(), ilExcDeliveredFilesTableGUI\fillRow(), ilDclExportTableGUI\fillRow(), ilECSReleasedContentTableGUI\fillRow(), ilAdvancedMDRecordExportFilesTableGUI\fillRow(), ilECSImportedContentTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilLMDownloadTableGUI\fillRow(), ilLanguageTableGUI\fillRow(), ilCalendarInboxSharedTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilSCORMTrackingUsersTableGUI\fillRow(), ilFileVersionTableGUI\fillRow(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilSurveyCodesTableGUI\fillRow(), ilForumPostingDraftsBlockGUI\fillRow(), ilRbacLogTableGUI\fillRow(), ilUserLPTableGUI\fillRow(), ilExAssignmentTeamLogTableGUI\fillRow(), ilSurveyResultsUserTableGUI\fillRow(), ilSearchResultTableGUI\fillRow(), ilPollBlockGUI\fillRow(), ilTestFixedParticipantsTableGUI\fillRow(), ilAssignmentsTableGUI\fillRow(), ilTestParticipantsTableGUI\fillRow(), assFileUploadFileTableGUI\fillRow(), ilExAssignmentListTextTableGUI\fillRow(), ilSurveyMaintenanceTableGUI\fillRow(), ilQuestionPoolPrintViewTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilSurveyAppraiseesTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilAdminSubItemsTableGUI\fillRow(), ilExportTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), ilPDMailBlockGUI\fillRow(), ilExAssignmentPeerReviewTableGUI\fillRow(), ilSubscriberTableGUI\fillRow(), ilBadgePersonalTableGUI\fillRow(), ilCourseParticipantsTableGUI\fillRow(), ilWaitingListTableGUI\fillRow(), ilWebResourceEditableLinkTableGUI\fillRow(), ilPDNotesBlockGUI\fillRow(), ilSurveyQuestionsTableGUI\fillRow(), ilSurveyQuestionbrowserTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilBadgeUserTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilCronManagerTableGUI\fillRow(), ilWorkspaceShareTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), ilNewsForContextBlockGUI\fillRow(), ilBookingReservationsTableGUI\fillRow(), ilTestQuestionBrowserTableGUI\fillRow(), ilUserTableGUI\fillRow(), ilLPProgressTableGUI\fillRowCSV(), ilBookingReservationsTableGUI\fillRowCSV(), ilTermsOfServiceAgreementByLanguageTableGUI\formatCellValue(), ilTermsOfServiceAcceptanceHistoryTableGUI\formatCellValue(), ilTestPassOverviewTableGUI\formatDate(), ilMailAttachmentTableGUI\formatValue(), ilObjTestGUI\formTimingObject(), ilCertificateAdapter\getBaseVariablesForPresentation(), ilCertificateAdapter\getBaseVariablesForPreview(), ilSkillCertificateAdapter\getCertificateVariablesForPresentation(), ilScormMailTemplateLPContext\getDescription(), ilCourseMailTemplateTutorContext\getDescription(), ilExSubmission\getDownloadedFilesInfoForTableGUIS(), ilPublicUserProfileGUI\getEmbeddable(), ilBlogExerciseGUI\getExerciseInfo(), ilPortfolioExerciseGUI\getExerciseInfo(), ilLPTableBaseGUI\getExportMeta(), ilADTDatePresentationBridge\getHTML(), ilADTDateTimePresentationBridge\getHTML(), ilAttendanceList\getHTML(), ilCloudPluginFileTreeGUI\getItemHtml(), ilRegistrationCodesTableGUI\getItems(), ilAccountCodesTableGUI\getItems(), ilBookingObjectsTableGUI\getItems(), ilUserTableGUI\getItems(), ilPollBlock\getMessage(), ilForumExplorerGUI\getNodeContent(), ilNoteGUI\getNoteListHTML(), ilExPeerReviewGUI\getOverviewContent(), ilExAssignmentGUI\getOverviewHeader(), ilNoteGUI\getPDNoteHTML(), ilObjSession\getPresentationTitle(), ilCourseMembershipGUI\getPrintMemberData(), ilObjFileListGUI\getProperties(), ilTestServiceGUI\getResultsSignature(), ilDclBaseRecordModel\getStandardFieldHTML(), ilObjSCORM2004LearningModule\getTrackingDataAgg(), ilObjUserGUI\getValues(), ilTestRandomQuestionSetConfigStateMessageHandler\handle(), ilExerciseManagementGUI\handleIndividualDeadlineCallsObject(), ilLMPresentationGUI\ilPage(), ilObjCourseGUI\infoScreen(), ilObjMediaCastGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilObjSurveyGUI\infoScreen(), ilObjForumListGUI\init(), ilLearningProgressGUI\initCollectionManualForm(), ilAccountCodesTableGUI\initFilter(), ilRegistrationCodesTableGUI\initFilter(), ilForumTopicTableGUI\initMergeThreadsTable(), ilRepositoryUserResultTableGUI\initMultiCommands(), ilPCBlogGUI\initPostingForm(), ilPCSection\insertTimings(), ilObjTest\isExecutable(), ilMailFolderTableGUI\isLuceneSearchEnabled(), ilBadgeProfileGUI\listBackpackGroups(), ilBadgeProfileGUI\listBadges(), ilObjGroupAccess\lookupRegistrationInfo(), ilObjCourseAccess\lookupRegistrationInfo(), ilTestPlayerAbstractGUI\outProcessingTime(), ilSCGroupTableGUI\parse(), ilConsultationHourBookingTableGUI\parse(), ilSCTaskTableGUI\parse(), ilGroupParticipantsTableGUI\parse(), ilCourseParticipantsTableGUI\parse(), ilCronManagerTableGUI\parseJobToData(), ilExerciseSubmissionTableGUI\parseRow(), ilRepositoryUserResultTableGUI\parseUserIds(), ilLPTableBaseGUI\parseValue(), ilTrSummaryTableGUI\parseValue(), ilTestServiceGUI\populatePassFinishDate(), ilLinkCheckerTableGUI\prepareHTML(), ilWikiPageGUI\preview(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), ilSubscriberTableGUI\readSubscriberData(), ilWaitingListTableGUI\readUserData(), ilObjTestGUI\redirectToInfoScreenObject(), ilCronManagerGUI\render(), ilNewsTimelineItemGUI\render(), ilPortfolioPageGUI\renderBlogTeaser(), ilSessionStatisticsGUI\renderCurrentBasics(), ilObjBlogGUI\renderList(), ilBadgeRenderer\renderModal(), ilPageObjectGUI\rollbackConfirmation(), ilCronDeleteInactiveUserReminderMailNotification\send(), ilTestMailNotification\sendAdvancedNotification(), ilObjExercise\sendAssignment(), ilMembershipCronNotifications\sendMail(), ilTestMailNotification\sendSimpleNotification(), ilObjSurveyGUI\sendUserResultsMail(), arIndexTableGUI\setDateFieldData(), arDisplayGUI\setDateTimeData(), ilSkillSelfEvaluationGUI\setSelfEvaluationPresentationForm(), ilObjUserFolderGUI\showActionConfirmation(), ilLPObjectStatisticsGUI\showAggregationInfo(), ilSCORM2004ScoGUI\showExportList(), ilObjSCORM2004LearningModuleGUI\showExportList(), ilObjTermsOfServiceGUI\showLastResetDate(), ilInfoScreenGUI\showLearningProgress(), ilNewsForContextBlockGUI\showNews(), ilPageObjectGUI\showPage(), ilPersonalProfileGUI\showPublicProfileFields(), ilExSubmissionFileGUI\submissionScreenObject(), ilObjTestGUI\timingOverviewObject(), ilPageObject\update(), ilObjUser\updateLogin(), ilCourseArchivesGUI\view(), ilObjFileAccessSettingsGUI\viewDiskQuotaReport(), and ilObjObjectFolderGUI\viewObject().

114  {
115  global $lng,$ilUser;
116 
117  if($date->isNull())
118  {
119  return self::getLanguage()->txt('no_date');
120  }
121 
122  $has_time = !is_a($date,'ilDate');
123 
124  // Converting pure dates to user timezone might return wrong dates
125  if($has_time)
126  {
127  $date_info = $date->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
128  }
129  else
130  {
131  $date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
132  }
133 
134 
135  if(self::isToday($date) and self::useRelativeDates())
136  {
137  $date_str = self::getLanguage()->txt('today');
138  }
139  elseif(self::isTomorrow($date) and self::useRelativeDates())
140  {
141  $date_str = self::getLanguage()->txt('tomorrow');
142  }
143  elseif(self::isYesterday($date) and self::useRelativeDates())
144  {
145  $date_str = self::getLanguage()->txt('yesterday');
146  }
147  else
148  {
149  include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
150  $date_str = $date->get(IL_CAL_FKT_DATE,'d').'. '.
151  ilCalendarUtil::_numericMonthToString($date_info['mon'],false).' '.
152  $date_info['year'];
153  }
154 
155  if(!$has_time)
156  {
157  return $date_str;
158  }
159 
160  switch($ilUser->getTimeFormat())
161  {
163  return $date_str.', '.$date->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
164 
166  return $date_str.', '.$date->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone());
167  }
168  }
static _numericMonthToString($a_month, $a_long=true)
numeric month to string
const IL_CAL_FKT_DATE
$ilUser
Definition: imgupload.php:18
get($a_format, $a_format_str='', $a_tz='')
get formatted date
const IL_CAL_FKT_GETDATE
global $lng
Definition: privfeed.php:17
isNull()
Check if a date is null (Datetime == '0000-00-00 00:00:00', unixtime == 0,...)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatPeriod()

static ilDatePresentation::formatPeriod ( ilDateTime  $start,
ilDateTime  $end 
)
static

Format a period of two date Shows: 14.

Jul 2008 18:00 - 20:00 or: Today 18:00 - 20:00 or: 14. Jul 2008 - 16. Jul 2008 or: 14. Jul 2008, 12:00 - 16. Jul 2008, 14:00

public

Parameters

Definition at line 182 of file class.ilDatePresentation.php.

References $ilUser, ilDateTime\_equals(), ilDateTime\get(), IL_CAL_DATE, IL_CAL_DAY, IL_CAL_FKT_DATE, ilCalendarSettings\TIME_FORMAT_12, and ilCalendarSettings\TIME_FORMAT_24.

Referenced by ilChatroomHistoryGUI\__construct(), ilSessionAppointment\_appointmentToString(), ilObjectActivation\addListGUIActivationProperty(), ilChatroomFormFactory\applyValues(), ilCalendarEntry\appointmentToMailString(), ilObjRemoteCourseGUI\availabilityToString(), ilObjRemoteGroupGUI\availabilityToString(), ilObjRemoteTestGUI\availabilityToString(), ilCalendarAppointmentGUI\book(), ilSessionStatisticsGUI\buildData(), ilCalendarAppointmentGUI\cancelBooking(), ilECSCategoryMappingRule\conditionToString(), ilObjUser\deleteUserDefinedFieldEntries(), ilBookingObjectGUI\displayPostInfo(), ilWikiStatGUI\export(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilCourseParticipantsTableGUI\fillRow(), ilCalendarBlockGUI\getData(), ilCalendarAppointmentPanelGUI\getHTML(), ilTrQuery\getSessionData(), ilObjCourseGUI\infoScreen(), ilObjSessionGUI\initAttendanceList(), ilObjBookingPoolGUI\initBookingNumbersForm(), ilObjCourseAccess\lookupPeriodInfo(), ilConsultationHoursTableGUI\parse(), ilAccountMail\replacePlaceholders(), ilObjBookingPoolGUI\rsvConfirmCancelAggregationForm(), ilAccountMail\send(), ilCalendarAppointmentsTableGUI\setAppointments(), ilCalendarAppointmentGUI\showInfoScreen(), and ilMemberExport\write().

183  {
184  global $ilUser;
185 
186  $has_time = !is_a($start,'ilDate');
187 
188  // Same day
189  if(ilDateTime::_equals($start,$end,IL_CAL_DAY,$ilUser->getTimeZone()))
190  {
191  if(!$has_time)
192  {
193  return self::formatDate($start);
194  }
195  else
196  {
197  $date_str = self::formatDate(
198  new ilDate($start->get(IL_CAL_DATE,'',$ilUser->getTimeZone()),IL_CAL_DATE));
199 
200  // $start == $end
201  if(ilDateTime::_equals($start,$end))
202  {
203  switch($ilUser->getTimeFormat())
204  {
206  return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
207 
209  return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'h:i a',$ilUser->getTimeZone());
210  }
211  }
212  else
213  {
214  switch($ilUser->getTimeFormat())
215  {
217  return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone()).' - '.
218  $end->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
219 
221  return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone()).' - '.
222  $end->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone());
223  }
224  }
225  }
226  }
227  // Different days
228  return self::formatDate($start).' - '.self::formatDate($end);
229  }
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Class for single dates.
const IL_CAL_FKT_DATE
$ilUser
Definition: imgupload.php:18
get($a_format, $a_format_str='', $a_tz='')
get formatted date
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLanguage()

static ilDatePresentation::getLanguage ( )
static

set language

Returns

Definition at line 83 of file class.ilDatePresentation.php.

References $lang, and $lng.

Referenced by ilMailTemplateContext\resolvePlaceholder().

84  {
85  global $lng;
86 
87  return self::$lang ? self::$lang : $lng;
88  }
global $lng
Definition: privfeed.php:17
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the caller graph for this function:

◆ isToday()

static ilDatePresentation::isToday ( ilDateTime  $date)
static

Check if date is "today".

public

Parameters
objectilDateTime DateTime object to check
Returns
bool

Definition at line 241 of file class.ilDatePresentation.php.

References $ilUser, ilDateTime\_equals(), IL_CAL_DAY, IL_CAL_UNIX, and time.

242  {
243  global $ilUser;
244 
245  if(!is_object(self::$today))
246  {
247  self::$today = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
248  }
249  return ilDateTime::_equals(self::$today,$date,IL_CAL_DAY,$ilUser->getTimeZone());
250  }
const IL_CAL_UNIX
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Date and time handling
$ilUser
Definition: imgupload.php:18
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ isTomorrow()

static ilDatePresentation::isTomorrow ( ilDateTime  $date)
static

Check if date is tomorrow.

public

Parameters
objectilDateTime DateTime object to check
Returns
bool

Definition at line 281 of file class.ilDatePresentation.php.

References $ilUser, ilDateTime\_equals(), IL_CAL_DAY, IL_CAL_UNIX, ilDateTime\increment(), and time.

282  {
283  global $ilUser;
284 
285  if(!is_object(self::$tomorrow))
286  {
287  self::$tomorrow = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
288  self::$tomorrow->increment(IL_CAL_DAY,1);
289  }
290 
291  return ilDateTime::_equals(self::$tomorrow,$date,IL_CAL_DAY,$ilUser->getTimeZone());
292  }
const IL_CAL_UNIX
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Date and time handling
$ilUser
Definition: imgupload.php:18
increment($a_type, $a_count=1)
increment
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ isYesterday()

static ilDatePresentation::isYesterday ( ilDateTime  $date)
static

Check if date is yesterday.

public

Parameters
objectilDateTime DateTime object to check
Returns
bool

Definition at line 260 of file class.ilDatePresentation.php.

References $ilUser, ilDateTime\_equals(), IL_CAL_DAY, IL_CAL_UNIX, ilDateTime\increment(), and time.

261  {
262  global $ilUser;
263 
264  if(!is_object(self::$yesterday))
265  {
266  self::$yesterday = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
267  self::$yesterday->increment(IL_CAL_DAY,-1);
268  }
269 
270  return ilDateTime::_equals(self::$yesterday,$date,IL_CAL_DAY,$ilUser->getTimeZone());
271  }
const IL_CAL_UNIX
const IL_CAL_DAY
static _equals(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check if two date are equal.
Date and time handling
$ilUser
Definition: imgupload.php:18
increment($a_type, $a_count=1)
increment
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
+ Here is the call graph for this function:

◆ resetToDefaults()

static ilDatePresentation::resetToDefaults ( )
static

reset to defaults

Returns

Definition at line 96 of file class.ilDatePresentation.php.

References $lng.

Referenced by ilObjUser\deleteUserDefinedFieldEntries(), and ilLPProgressTableGUI\fillRowCSV().

97  {
98  global $lng;
99 
100  self::setLanguage($lng);
101  self::setUseRelativeDates(true);
102  }
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ secondsToString()

static ilDatePresentation::secondsToString (   $seconds,
  $force_with_seconds = false,
  $a_lng = null 
)
static

converts seconds to string: Long: 7 days 4 hour(s) ...

Parameters
int$secondsseconds
bool$force_with_seconds
ilLanguage$a_lng
Returns
string

Definition at line 303 of file class.ilDatePresentation.php.

References $lng, and $rest.

Referenced by ilLearningProgressBaseGUI\__appendLPDetails(), ilLearningProgressBaseGUI\__appendUserInfo(), ilRegistrationMimeMailNotification\__construct(), ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), ilLearningProgressBaseGUI\__showObjectDetails(), ilInfoScreenGUI\addMetaDataSections(), ilCourseContentGUI\editTimings(), ilTimingOverviewTableGUI\fillRow(), ilCalendarAppointmentsTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilCourseMailTemplateTutorContext\getDescription(), ilScormMailTemplateLPContext\getDescription(), ilObjSCORM2004LearningModule\getTrackingDataAgg(), ilObjUserFolderGUI\initFormGeneralSettings(), ilPersonalSettingsGUI\initGeneralSettingsForm(), ilLPTableBaseGUI\parseValue(), ilTrSummaryTableGUI\parseValue(), ilInfoScreenGUI\showLearningProgress(), and ilLearningProgressGUI\showtlt().

304  {
305  global $lng;
306 
307  if($a_lng)
308  {
309  $lng = $a_lng;
310  }
311 
312  $seconds = $seconds ? $seconds : 0;
313 
314  // #13625
315  if($seconds > 0)
316  {
317  $days = floor($seconds / 86400);
318  $rest = $seconds % 86400;
319 
320  $hours = floor($rest / 3600);
321  $rest = $rest % 3600;
322 
323  $minutes = floor($rest / 60);
324  $seconds = $rest % 60;
325  }
326  else
327  {
328  $days = ceil($seconds / 86400);
329  $rest = $seconds % 86400;
330 
331  $hours = ceil($rest / 3600);
332  $rest = $rest % 3600;
333 
334  $minutes = ceil($rest / 60);
335  $seconds = $rest % 60;
336  }
337 
338  if($days)
339  {
340  $message = $days . ' '. ($days == 1 ? $lng->txt('day') : $lng->txt('days'));
341  }
342  if($hours)
343  {
344  if($message)
345  {
346  $message .= ' ';
347  }
348  $message .= ($hours . ' '. ($hours == 1 ? $lng->txt('hour') : $lng->txt('hours')));
349  }
350  if($minutes)
351  {
352  if($message)
353  {
354  $message .= ' ';
355  }
356  $message .= ($minutes . ' '. ($minutes == 1 ? $lng->txt('minute') : $lng->txt('minutes')));
357  }
358  if($force_with_seconds && $seconds)
359  {
360  if($message)
361  {
362  $message .= ' ';
363  }
364  $message .= ($seconds . ' '. ($seconds == 1 ? $lng->txt('second') : $lng->txt('seconds')));
365  }
366  if(!$days and !$hours and !$minutes)
367  {
368  return $seconds .' '. ($seconds == 1 ? $lng->txt('second') : $lng->txt('seconds'));
369  }
370  else
371  {
372  return $message;
373  }
374  }
$rest
Definition: goto.php:48
global $lng
Definition: privfeed.php:17
+ Here is the caller graph for this function:

◆ setLanguage()

static ilDatePresentation::setLanguage (   $a_lng)
static

set language

Returns

Definition at line 72 of file class.ilDatePresentation.php.

References $lang.

Referenced by ilForumMailNotification\appendAttachments(), ilObjUser\deleteUserDefinedFieldEntries(), ilMailTemplateContext\resolvePlaceholder(), and ilCronDeleteInactiveUserReminderMailNotification\send().

73  {
74  self::$lang = $a_lng;
75  }
for($i=1; $i<=count($kw_cases_sel); $i+=1) $lang
Definition: langwiz.php:349
+ Here is the caller graph for this function:

◆ setUseRelativeDates()

static ilDatePresentation::setUseRelativeDates (   $a_status)
static

set use relative dates

Parameters
bool
Returns

Definition at line 50 of file class.ilDatePresentation.php.

Referenced by ilChatroomHistoryGUI\__construct(), ilBookingReservationsTableGUI\__construct(), ilForumMailNotification\appendAttachments(), ilCalendarEntry\appointmentToMailString(), ilSessionStatisticsGUI\buildData(), ilCertificate\createPreview(), ilPersonalSettingsGUI\deleteOwnAccount4(), ilObjUser\deleteUserDefinedFieldEntries(), ilBookingObjectGUI\displayPostInfo(), ilSurveyEvaluationGUI\evaluation(), ilForumExportGUI\executeCommand(), ilSessionStatisticsGUI\exportCSV(), ilSurveyEvaluationGUI\exportEvaluationUser(), ilObjectMetaDataBlockGUI\fillDataSection(), ilLMDownloadTableGUI\fillRow(), ilPollBlockGUI\fillRow(), assFileUploadFileTableGUI\fillRow(), ilQuestionPoolPrintViewTableGUI\fillRow(), ilLPProgressTableGUI\fillRowCSV(), ilTestPassOverviewTableGUI\formatDate(), ilCertificateAdapter\getBaseVariablesForPresentation(), ilCertificateAdapter\getBaseVariablesForPreview(), ilSkillCertificateAdapter\getCertificateVariablesForPresentation(), ilSkillCertificateAdapter\getCertificateVariablesForPreview(), ilBlogExerciseGUI\getExerciseInfo(), ilPortfolioExerciseGUI\getExerciseInfo(), ilLPTableBaseGUI\getExportMeta(), ilAttendanceList\getHTML(), ilTable2GUI\getHTML(), ilObjectMetaDataGUI\getKeyValueList(), ilNoteGUI\getNoteListHTML(), ilCourseMembershipGUI\getPrintMemberData(), ilTestServiceGUI\getResultsSignature(), ilObjSurveyGUI\infoScreen(), ilObjSessionGUI\initAttendanceList(), ilPCSection\insertTimings(), ilBadgeProfileGUI\listBackpackGroups(), ilBadgeProfileGUI\listBadges(), ilCertificate\outCertificate(), ilTestServiceGUI\populatePassFinishDate(), ilBlogPostingGUI\postOutputProcessing(), ilPersonalSkillsGUI\renderObjectEvalRow(), ilPersonalSkillsGUI\renderSelfEvaluationRow(), ilObjBookingPoolGUI\rsvConfirmCancelAggregationForm(), ilMembershipCronNotifications\run(), ilCronDeleteInactiveUserReminderMailNotification\send(), ilTestMailNotification\sendAdvancedNotification(), ilTestMailNotification\sendSimpleNotification(), ilSkillSelfEvaluationGUI\setSelfEvaluationPresentationForm(), ilObjTermsOfServiceGUI\showLastResetDate(), and ilMemberExport\write().

51  {
52  self::$use_relative_dates = $a_status;
53  }
+ Here is the caller graph for this function:

◆ useRelativeDates()

Field Documentation

◆ $lang

ilDatePresentation::$lang = null
staticprivate

Definition at line 38 of file class.ilDatePresentation.php.

◆ $today

ilDatePresentation::$today = null
static

Definition at line 40 of file class.ilDatePresentation.php.

◆ $tomorrow

ilDatePresentation::$tomorrow = null
static

Definition at line 41 of file class.ilDatePresentation.php.

◆ $use_relative_dates

ilDatePresentation::$use_relative_dates = true
static

Definition at line 37 of file class.ilDatePresentation.php.

◆ $yesterday

ilDatePresentation::$yesterday = null
static

Definition at line 42 of file class.ilDatePresentation.php.


The documentation for this class was generated from the following file: