class cmfcCalendarV1Gregorian in Calendar Systems 5
Same name and namespace in other branches
- 8 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 8.2 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 6.3 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 6 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 7.3 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 7 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
- 7.2 calendar/v1/calendarSystems/gregorian.class.inc.php \cmfcCalendarV1Gregorian
@desc
Hierarchy
- class \PEAR
- class \cmfcClassesCore
- class \cmfcCalendarV1
- class \cmfcCalendarV1Gregorian
- class \cmfcCalendarV1
- class \cmfcClassesCore
Expanded class hierarchy of cmfcCalendarV1Gregorian
File
- calendar/
v1/ calendarSystems/ gregorian.class.inc.php, line 13
View source
class cmfcCalendarV1Gregorian extends cmfcCalendarV1 {
var $_monthsName = array(
'1' => 'January',
'2' => 'February',
'3' => 'March',
'4' => 'April',
'5' => 'May',
'6' => 'June',
'7' => 'July',
'8' => 'August',
'9' => 'September',
'10' => 'October',
'11' => 'November',
'12' => 'December',
);
var $_monthsShortName = array(
'1' => 'فرو',
'2' => 'ارد',
'3' => 'خرد',
'4' => 'تير',
'5' => 'مرد',
'6' => 'شهر',
'7' => 'مهر',
'8' => 'آبا',
'9' => 'آذر',
'10' => 'دى',
'11' => 'بهم',
'12' => 'اسف',
);
var $_weeksName = array(
'0' => 'يكشنبه',
//Sunday
'1' => 'دوشنبه',
'2' => 'سه شنبه',
'3' => 'چهارشنبه',
'4' => 'پنجشنبه',
'5' => 'جمعه',
'6' => 'شنبه',
);
var $_weeksShortName = array(
'0' => 'ي',
//Sunday
'1' => 'د',
'2' => 'س',
'3' => 'چ',
'4' => 'پ',
'5' => 'ج',
'6' => 'ش',
);
var $_meridiemsName = array(
'am' => 'قبل‏ازظهر',
'pm' => 'بعدازظهر',
);
var $_meridiemsShortName = array(
'am' => 'ق.ظ',
'pm' => 'ب.ظ',
);
var $_weekDaysHoliday = array(
0,
1,
);
function timestampToStr($format, $timestamp = null) {
if (is_null($timestamp)) {
$timestamp = $this
->phpTime();
}
return $this
->phpDate($format, $timestamp);
}
function strToTimestamp($string) {
return strtotime($string);
}
function timestampToInfoArray($timestamp = null) {
if (is_null($timestamp)) {
$timestamp = $this
->phpTime();
}
$arr = $this
->phpGetDate($timestamp);
$arr['month'] = $arr['mon'];
$arr['day'] = $arr['mday'];
$arr['monthName'] = $this
->getMonthName($arr['month']);
$arr['monthShortName'] = $this
->getMonthShortName($arr['month']);
$arr['monthFirstDayWeekday'] = $this
->phpDate('w', $this
->infoArrayToTimestamp(array(
'year' => $arr['year'],
'month' => $arr['month'],
'day' => '1',
))) + 1;
$arr['monthDaysNumber'] = $this
->phpDate('t', $timestamp);
$arr['weekday']++;
$arr['weekday'] = $arr['wday'];
$arr['weekdayName'] = $this
->getWeekName($arr['weekday']);
$arr['weekdayShortName'] = $this
->getWeekShortName($arr['weekday']);
return $arr;
}
function infoArrayToTimestamp($arr) {
return mktime(0, 0, 0, $arr['month'], $arr['day'], $arr['year']);
}
function dateDiff($first, $second) {
$first_date = explode("-", $first);
$first_date = mktime(0, 0, 0, $first_date[1], $first_date[2], $first_date[0]);
//echo $first_date[1];
$second_date = explode("-", $second);
$second_date = mktime(0, 0, 0, $second_date[1], $second_date[2], $second_date[0]);
$totalsec = $second_date - $first_date;
return $totalday = round($totalsec / 86400);
}
/**
* translate number of month to name of month
*/
function getWeekName($weekNumber) {
return html_entity_decode($this->_weeksName[$weekNumber]);
}
function getWeekShortName($weekNumber) {
return html_entity_decode($this->_weeksShortName[$weekNumber]);
}
/**
* translate number of month to name of month
*/
function getMonthName($month) {
return html_entity_decode($this->_monthsName[$month]);
}
function getMonthShortName($month) {
return html_entity_decode($this->_monthsShortName[$month]);
}
function getMeridiemName($m) {
return html_entity_decode($this->_meridiemsName[$m]);
}
function getMeridiemShortName($m) {
return html_entity_decode($this->_meridiemsShortName[$m]);
}
function dateTimeDiff($first_timestamp, $second_timestamp) {
// Author: Tone.
// Date : 15-12-2003.
// Ref: Dates go in "2003-12-31".
// Ref: Times go in "12:59:13".
// Ref: mktime(HOUR,MIN,SEC,MONTH,DAY,YEAR).
// Splits the dates into parts, to be reformatted for mktime.
// $first_datetime = getdate($first_datetime);
// $second_datetime = getdate($second_datetime);
// makes the dates and times into unix timestamps.
// $first_unix = mktime($first_datetime['hours'], $first_time_ex[1], $first_time_ex[2], $first_date_ex[1], $first_date_ex[2], $first_date_ex[0]);
// $second_unix = mktime($second_time_ex[0], $second_time_ex[1], $second_time_ex[2], $second_date_ex[1], $second_date_ex[2], $second_date_ex[0]);
// Gets the difference between the two unix timestamps.
if (empty($first_timestamp) or $first_timestamp < 0 or empty($second_timestamp) or $second_timestamp < 0) {
return false;
}
$timediff = $first_timestamp - $second_timestamp;
// Works out the days, hours, mins and secs.
$days = intval($timediff / 86400);
$remain = $timediff % 86400;
$hours = intval($remain / 3600);
$remain = $remain % 3600;
$mins = intval($remain / 60);
$secs = $remain % 60;
// Returns a pre-formatted string. Can be chagned to an array.
$result['days'] = $days;
$result['hours'] = $hours;
$result['minutes'] = $mins;
return $result;
}
function jGetDate($timestamp = "", $transNumber = 1) {
if ($timestamp == "") {
$timestamp = $this
->phpTime();
}
return array(
0 => $timestamp,
"seconds" => jdate("s", $timestamp, $transNumber),
"minutes" => jdate("i", $timestamp, $transNumber),
"hours" => jdate("G", $timestamp, $transNumber),
"mday" => jdate("j", $timestamp, $transNumber),
"wday" => jdate("w", $timestamp, $transNumber),
"mon" => jdate("n", $timestamp, $transNumber),
"year" => jdate("Y", $timestamp, $transNumber),
"yday" => cmfcDateTime::yearTotalDays(jdate("m", $timestamp, $transNumber), jdate("d", $timestamp, $transNumber), jdate("Y", $timestamp, $transNumber)),
"weekday" => jdate("l", $timestamp, $transNumber),
"month" => jdate("F", $timestamp, $transNumber),
);
}
function change_to_miladi($date) {
$date = explode("-", $date);
$date = cmfcDateTime::jalaliToGregorian($date[0], $date[1], $date[2]);
//$date[1] = $date[1] -1;
$date = $date[0] . "-" . $date[1] . "-15";
return $date;
}
function date_fa($date) {
list($year, $month, $day) = preg_split('/-/', $date);
list($jyear, $jmonth, $jday) = cmfcDateTime::gregorianToJalali($year, $month, $day);
$date = jmaketime(0, 0, 0, $jmonth, $jday, $jyear);
$date = jdate("d M Y", $date);
return $date;
}
function date_en($date) {
$date = explode("-", $date);
$date = date("F j, Y", mktime(0, 0, 0, $date[1], $date[2], $date[0]));
return $date;
}
function dateByLanguage($format, $time_stamp, $lang) {
if ($lang == 'fa') {
return cmfcJalaliDateTime::smartGet($format, $time_stamp, 1);
}
else {
return date($format, cmfcJalaliDateTime::toTimeStamp($time_stamp));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
cmfcCalendarV1:: |
property |
Overrides cmfcClassesCore:: |
||
cmfcCalendarV1:: |
property |
Overrides cmfcClassesCore:: |
||
cmfcCalendarV1:: |
property |
Overrides cmfcClassesCore:: |
||
cmfcCalendarV1:: |
property | |||
cmfcCalendarV1:: |
property | |||
cmfcCalendarV1:: |
property | |||
cmfcCalendarV1:: |
function | * For supporting timezone , use this class date and time functions like phpDate | ||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | convert seconds to days,hours,minuts,seconds as array | ||
cmfcCalendarV1:: |
function |
Overrides cmfcClassesCore:: |
||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1:: |
function | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
property | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function |
Date : 15-12-2003. Overrides cmfcCalendarV1:: |
||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | translate number of month to name of month | ||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function | translate number of month to name of month | ||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function |
Overrides cmfcCalendarV1:: |
||
cmfcCalendarV1Gregorian:: |
function | |||
cmfcCalendarV1Gregorian:: |
function |
Overrides cmfcCalendarV1:: |
||
cmfcCalendarV1Gregorian:: |
function |
Overrides cmfcCalendarV1:: |
||
cmfcCalendarV1Gregorian:: |
function |
Overrides cmfcCalendarV1:: |
||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | * PEAR::Log object used for error logging by ErrorStack * * * @access public | ||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
property | * | ||
cmfcClassesCore:: |
property | |||
cmfcClassesCore:: |
function | * @example * <code> * $object->addCommandHandler('commandName','functionName') * $object->addCommandHandler('commandName',array(&$myObject,'methodName')) * </code> | ||
cmfcClassesCore:: |
function | Register the reference to an object object | ||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | * there is no __construct function in php4 or down , so this function is solution , now it's possible * for all chid of this base class to have __construct functions * | ||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | * works fine in both php4 & 5. but you should use & when you call the function. $b=&$ins->getOption('property') | ||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function |
Tell whether a value is a PEAR error. Overrides PEAR:: |
||
cmfcClassesCore:: |
function | Calls the update() function using the reference to each registered observer - used by children of Observable | ||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function |
conditionally includes PEAR base class and raise an error
@example
<code>
return $this->raiseError('', CMF_Language_Error_Unknown_Short_Name,
* PEAR_ERROR_RETURN,NULL,
* array('shortName'=>$shortName)
… Overrides PEAR:: |
||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | * fill all of object variables with their default values except $base_properties * $base_properties=array('local_language_name','db','event_system','configurations','table_name_prefix'); *… | ||
cmfcClassesCore:: |
function | memento design pattern will load the object previous state @todo - should become complete | ||
cmfcClassesCore:: |
function | * @example * <code> * $this->runCommand('sendEmailAfterActivation',$columnsValues); * </code> | ||
cmfcClassesCore:: |
function | memento design pattern will clone the object for adding undo ability. @todo - should become complete | ||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
cmfcClassesCore:: |
function | |||
PEAR:: |
property | Whether to enable internal debug messages. | ||
PEAR:: |
property | Default error handler (callback) for this object, if error mode is PEAR_ERROR_CALLBACK. | ||
PEAR:: |
property | Default error mode for this object. | ||
PEAR:: |
property | Default error options used for this object when error mode is PEAR_ERROR_TRIGGER. | ||
PEAR:: |
property | Which class to use for error objects. | ||
PEAR:: |
property | An array of expected errors. | ||
PEAR:: |
function | This method deletes all occurences of the specified element from the expected error codes stack. | ||
PEAR:: |
function | This method is used to tell which errors you expect to get. Expected errors are always returned with error mode PEAR_ERROR_RETURN. Expected error codes are stored in a stack, and this method pushes a new element onto it. The list of expected errors… | ||
PEAR:: |
function | If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. Eg. in your method(s) do this: $myVar = &PEAR::getStaticProperty('myclass', 'myVar'); You MUST… | ||
PEAR:: |
function | OS independant PHP extension load. Remember to take care on the correct extension name for case sensitive OSes. | ||
PEAR:: |
function | Constructor. Registers this object in $_PEAR_destructor_object_list for destructor emulation if a destructor object exists. | ||
PEAR:: |
function | Pop the last error handler used | ||
PEAR:: |
function | This method pops one element off the expected error codes stack. | ||
PEAR:: |
function | Push a new error handler on top of the error handler options stack. With this you can easily override the actual error handler for some code and restore it later with popErrorHandling. | ||
PEAR:: |
function | Use this function to register a shutdown method for static classes. | ||
PEAR:: |
function | Sets how errors generated by this object should be handled. Can be invoked both in objects and statically. If called statically, setErrorHandling sets the default behaviour for all PEAR objects. If called in an object, setErrorHandling sets the… | ||
PEAR:: |
function | |||
PEAR:: |
function | |||
PEAR:: |
function | Simpler form of raiseError with fewer options. In most cases message, code and userinfo are enough. | ||
PEAR:: |
function | This method checks unsets an error code if available | ||
PEAR:: |
function | Destructor (the emulated type of...). Does nothing right now, but is included for forward compatibility, so subclass destructors should always call it. |