ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDatePresentation Class Reference

Class for date presentation. More...

+ Collaboration diagram for ilDatePresentation:

Static Public Member Functions

static setUseRelativeDates ($a_status)
 set use relative dates
static useRelativeDates ()
 check if relative dates are used
static setLanguage ($a_lng)
 set language
static getLanguage ()
 set language
static resetToDefaults ()
 reset to defaults
static formatDate (ilDateTime $date)
 Format a date public.
static formatPeriod (ilDateTime $start, ilDateTime $end)
 Format a period of two date Shows: 14.
static isToday (ilDateTime $date)
 Check if date is "today".
static isYesterday (ilDateTime $date)
 Check if date is yesterday.
static isTomorrow (ilDateTime $date)
 Check if date is tomorrow.

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

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 $lng, ilCalendarUtil\_numericMonthToString(), ilDateTime\get(), getLanguage(), 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(), ilLPObjectStatisticsAdminTableGUI\__construct(), ilLPObjectStatisticsDailyTableGUI\__construct(), ilLPObjectStatisticsTableGUI\__construct(), ilAdminUserSearchGUI\__fillUserTable(), ilCourseContentGUI\__renderEvent(), ilCourseContentGUI\__renderItem(), ilCourseContentGUI\__renderUserItem(), ilPurchaseBaseGUI\__sendBill(), ilCourseObjectivePresentationGUI\__showLearningMaterials(), ilObjCourseGUI\__showWaitingList(), ilObject\_lookupLastUpdate(), ilInfoScreenGUI\addObjectSections(), ilObjBookingPoolGUI\buildDatesBySchedule(), ilObjSurvey\canStartSurvey(), ilConsultationHoursGUI\confirmDelete(), ilMemberExportGUI\confirmDeleteExportFile(), ilSCORM2004ScoGUI\confirmDeleteExportFile(), ilObjSCORM2004LearningModuleGUI\confirmDeleteExportFile(), ilObjSurveyQuestionPoolGUI\confirmDeleteExportFileObject(), ilCalendarAppointmentGUI\confirmRegister(), ilCalendarAppointmentGUI\confirmUnregister(), ilForum\convertDate(), ilShopBoughtObjectsGUI\createBill(), ilObjCourseGUI\deleteSubscribers(), ilTestEvaluationGUI\detailedEvaluation(), ilPaymentStatisticGUI\editStatistic(), ilObjPaymentSettingsGUI\editStatisticObject(), ilCourseContentGUI\editTimings(), ilObjSurveyQuestionPoolGUI\exportObject(), ilObjUserFolderGUI\exportObject(), ilECSSetting\fetchCertificateExpiration(), ilObjCourseGUI\fetchPrintMemberData(), ilObjCourseGUI\fetchPrintSubscriberData(), ilMailFolderTableGUI\fetchTableData(), ilGroupRegistrationGUI\fillRegistrationPeriod(), ilCourseRegistrationGUI\fillRegistrationPeriod(), ilECSServerTableGUI\fillRow(), ilNewsForContextTableGUI\fillRow(), ilSubItemSelectionTableGUI\fillRow(), ilPageHistoryTableGUI\fillRow(), ilPublicSubmissionsTableGUI\fillRow(), ilExportSelectionTableGUI\fillRow(), ilMediaCastTableGUI\fillRow(), ilAdvancedMDRecordExportFilesTableGUI\fillRow(), ilExcDeliveredFilesTableGUI\fillRow(), ilECSReleasedContentTableGUI\fillRow(), ilWikiRecentChangesTableGUI\fillRow(), ilECSImportedContentTableGUI\fillRow(), ilSCORMTrackingUsersTableGUI\fillRow(), ilWikiContributorsTableGUI\fillRow(), ilAssessmentFolderLogTableGUI\fillRow(), assFileUploadFileTableGUI\fillRow(), ilCalendarInboxSharedTableGUI\fillRow(), ilTestHistoryTableGUI\fillRow(), ilExerciseMemberTableGUI\fillRow(), ilAssignmentsTableGUI\fillRow(), ilRepositoryUserResultTableGUI\fillRow(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilLanguageTableGUI\fillRow(), ilRbacLogTableGUI\fillRow(), ilCalendarAppointmentsTableGUI\fillRow(), ilUserLPTableGUI\fillRow(), ilSubscriberTableGUI\fillRow(), ilExParticipantTableGUI\fillRow(), ilExportTableGUI\fillRow(), ilSurveyMaintenanceTableGUI\fillRow(), ilTestParticipantsTableGUI\fillRow(), ilWaitingListTableGUI\fillRow(), ilQuestionPoolPrintViewTableGUI\fillRow(), ilTestFixedParticipantsTableGUI\fillRow(), ilPDNewsTableGUI\fillRow(), ilTestExportTableGUI\fillRow(), ilWikiPagesTableGUI\fillRow(), ilGroupParticipantsTableGUI\fillRow(), ilLPProgressTableGUI\fillRow(), ilTestQuestionBrowserTableGUI\fillRow(), ilWebResourceEditableLinkTableGUI\fillRow(), ilSurveyQuestionbrowserTableGUI\fillRow(), ilPDNotesBlockGUI\fillRow(), ilSurveyQuestionsTableGUI\fillRow(), ilPDMailBlockGUI\fillRow(), ilCourseParticipantsTableGUI\fillRow(), ilQuestionBrowserTableGUI\fillRow(), ilTrUserObjectsPropsTableGUI\fillRow(), ilNewsForContextBlockGUI\fillRow(), ilUserTableGUI\fillRow(), ilLPProgressTableGUI\fillRowCSV(), ilUserLPTableGUI\fillRowExcel(), ilLPProgressTableGUI\fillRowExcel(), ilShopCouponsTableGUI\formatDateField(), ilShopCouponsTableGUI\formatDateTimeField(), formatPeriod(), ilMailAttachmentTableGUI\formatValue(), ilCertificateAdapter\getBaseVariablesForPresentation(), ilCertificateAdapter\getBaseVariablesForPreview(), ilSkillCertificateAdapter\getCertificateVariablesForPresentation(), ilObjBlogGUI\getExerciseInfo(), ilObjPortfolioGUI\getExerciseInfo(), ilLPTableBaseGUI\getExportMeta(), ilHistoryGUI\getHistoryTable(), ilAccountCodesTableGUI\getItems(), ilRegistrationCodesTableGUI\getItems(), ilUserTableGUI\getItems(), ilNoteGUI\getNoteListHTML(), ilExAssignmentGUI\getOverviewBody(), ilExAssignmentGUI\getOverviewHeader(), ilTestServiceGUI\getPassOverview(), ilPDMailGUI\getPDMailHTML(), ilNoteGUI\getPDNoteHTML(), ilObjSession\getPresentationTitle(), ilObjUser\getProfileAsString(), ilObjForumListGUI\getProperties(), ilObjSurvey\getSurveyCodesTableData(), ilObjSCORM2004LearningModule\getTrackingDataAgg(), ilHistoryGUI\getVersionsTable(), ilObjCourseGUI\infoScreen(), ilObjMediaCastGUI\infoScreen(), ilObjGroupGUI\infoScreen(), ilObjTestGUI\infoScreen(), ilObjSystemFolderGUI\initCronJobsForm(), ilRegistrationCodesTableGUI\initFilter(), ilAccountCodesTableGUI\initFilter(), ilObjUserGUI\initForm(), ilPCBlogGUI\initPostingForm(), ilObjectListGUI\insertPayment(), ilObjiLincCourseGUI\listUsersGroupObject(), ilObjiLincCourseGUI\listUsersRoleObject(), ilTestOutputGUI\outProcessingTime(), ilConsultationHoursTableGUI\parse(), ilAdvancedMDRecordGUI\parseInfoPage(), ilAdvancedMDSubstitution\parseValue(), ilLPTableBaseGUI\parseValue(), ilTrSummaryTableGUI\parseValue(), ilBlogPostingGUI\postOutputProcessing(), ilLinkCheckerTableGUI\prepareHTML(), ilWikiPageGUI\preview(), ilMailFolderGUI\printMail(), ilObjGroupGUI\readMemberData(), ilObjCourseGUI\readMemberData(), ilObjCourseGUI\removeFromWaitingList(), ilPortfolioPageGUI\renderBlogTeaser(), ilObjBlogGUI\renderList(), ilPageObjectGUI\rollbackConfirmation(), ilObjiLincCourseGUI\searchObject(), ilObjTest\sendAdvancedNotification(), ilObjTest\sendSimpleNotification(), ilSkillSelfEvaluationGUI\setSelfEvaluationPresentationForm(), ilObjUserFolderGUI\showActionConfirmation(), ilShopNewsGUI\showArchive(), ilShopBoughtObjectsGUI\showBillHistory(), ilSCORM2004ScoGUI\showExportList(), ilObjSCORM2004LearningModuleGUI\showExportList(), ilShopBoughtObjectsGUI\showItems(), ilInfoScreenGUI\showLearningProgress(), ilMailFolderGUI\showMail(), ilChatroomHistoryTask\showMessages(), ilShopNewsGUI\showNews(), ilNewsForContextBlockGUI\showNews(), ilPageObjectGUI\showPage(), ilPersonalProfileGUI\showPublicProfileFields(), ilPaymentStatisticGUI\showStatistics(), ilObjSCORM2004LearningModuleGUI\showTrackingItems(), ilObjPaymentSettingsGUI\statisticObject(), ilObjUser\updateLogin(), ilCourseArchivesGUI\view(), and ilObjObjectFolderGUI\viewObject().

{
global $lng,$ilUser;
if($date->isNull())
{
return self::getLanguage()->txt('no_date');
}
$has_time = !is_a($date,'ilDate');
// Converting pure dates to user timezone might return wrong dates
if($has_time)
{
$date_info = $date->get(IL_CAL_FKT_GETDATE,'',$ilUser->getTimeZone());
}
else
{
$date_info = $date->get(IL_CAL_FKT_GETDATE,'','UTC');
}
if(self::isToday($date) and self::useRelativeDates())
{
$date_str = self::getLanguage()->txt('today');
}
elseif(self::isTomorrow($date) and self::useRelativeDates())
{
$date_str = self::getLanguage()->txt('tomorrow');
}
elseif(self::isYesterday($date) and self::useRelativeDates())
{
$date_str = self::getLanguage()->txt('yesterday');
}
else
{
include_once('./Services/Calendar/classes/class.ilCalendarUtil.php');
$date_str = $date->get(IL_CAL_FKT_DATE,'d').'. '.
ilCalendarUtil::_numericMonthToString($date_info['mon'],false).' '.
$date_info['year'];
}
if(!$has_time)
{
return $date_str;
}
switch($ilUser->getTimeFormat())
{
return $date_str.', '.$date->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
return $date_str.', '.$date->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone());
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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
@return

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

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

Referenced by ilCourseContentGUI\__getItemGUI(), ilSessionAppointment\_appointmentToString(), ilObjCourseGUI\_modifyItemGUI(), ilCalendarEntry\appointmentToMailString(), ilObjRemoteCourseGUI\availabilityToString(), ilECSCategoryMappingRule\conditionToString(), ilBookingObjectsTableGUI\fillRow(), ilCalendarChangedAppointmentsTableGUI\fillRow(), ilBookingReservationsTableGUI\fillRow(), ilCalendarAppointmentPanelGUI\getHTML(), ilObjUser\getProfileAsString(), ilTrQuery\getSessionData(), ilChatroomFormFactory\getSessionForm(), ilObjCourseGUI\infoScreen(), ilObjSessionGUI\printAttendanceListObject(), ilObjSessionGUI\printViewMembersObject(), ilCalendarAppointmentGUI\showInfoScreen(), and ilChatroomHistoryTask\showMessages().

{
global $ilUser;
$has_time = !is_a($start,'ilDate');
// Same day
if(ilDateTime::_equals($start,$end,IL_CAL_DAY,$ilUser->getTimeZone()))
{
if(!$has_time)
{
return self::formatDate($start);
}
else
{
$date_str = self::formatDate(
new ilDate($start->get(IL_CAL_DATE,'',$ilUser->getTimeZone()),IL_CAL_DATE));
// $start == $end
if(ilDateTime::_equals($start,$end))
{
switch($ilUser->getTimeFormat())
{
return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'h:i a',$ilUser->getTimeZone());
}
}
else
{
switch($ilUser->getTimeFormat())
{
return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone()).' - '.
$end->get(IL_CAL_FKT_DATE,'H:i',$ilUser->getTimeZone());
return $date_str.', '.$start->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone()).' - '.
$end->get(IL_CAL_FKT_DATE,'g:ia',$ilUser->getTimeZone());
}
}
}
}
// Different days
return self::formatDate($start).' - '.self::formatDate($end);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilDatePresentation::getLanguage ( )
static

set language

Returns

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

References $lang, and $lng.

Referenced by formatDate().

{
global $lng;
}

+ Here is the caller graph for this function:

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 ilDateTime\_equals(), IL_CAL_DAY, and IL_CAL_UNIX.

{
global $ilUser;
if(!is_object(self::$today))
{
self::$today = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
}
return ilDateTime::_equals(self::$today,$date,IL_CAL_DAY,$ilUser->getTimeZone());
}

+ Here is the call graph for this function:

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 ilDateTime\_equals(), IL_CAL_DAY, IL_CAL_UNIX, and ilDateTime\increment().

{
global $ilUser;
if(!is_object(self::$tomorrow))
{
self::$tomorrow = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
self::$tomorrow->increment(IL_CAL_DAY,1);
}
return ilDateTime::_equals(self::$tomorrow,$date,IL_CAL_DAY,$ilUser->getTimeZone());
}

+ Here is the call graph for this function:

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 ilDateTime\_equals(), IL_CAL_DAY, IL_CAL_UNIX, and ilDateTime\increment().

{
global $ilUser;
if(!is_object(self::$yesterday))
{
self::$yesterday = new ilDateTime(time(),IL_CAL_UNIX,$ilUser->getTimeZone());
self::$yesterday->increment(IL_CAL_DAY,-1);
}
return ilDateTime::_equals(self::$yesterday,$date,IL_CAL_DAY,$ilUser->getTimeZone());
}

+ Here is the call graph for this function:

static ilDatePresentation::resetToDefaults ( )
static

reset to defaults

Returns

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

References $lng, setLanguage(), and setUseRelativeDates().

Referenced by ilLPProgressTableGUI\fillRowCSV(), ilLPProgressTableGUI\fillRowExcel(), and ilObjUser\getProfileAsString().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilDatePresentation::setLanguage (   $a_lng)
static

set language

Returns

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

References $lang.

Referenced by resetToDefaults().

{
self::$lang = $a_lng;
}

+ Here is the caller graph for this function:

Field Documentation

ilDatePresentation::$lang = null
staticprivate

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

ilDatePresentation::$today = null
static

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

ilDatePresentation::$tomorrow = null
static

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

ilDatePresentation::$use_relative_dates = true
static

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

Referenced by useRelativeDates().

ilDatePresentation::$yesterday = null
static

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


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