//Load Elxis Corerequire_once($mosConfig_absolute_path.'/includes/Core/elxis.php');
//Persian daterequire_once( $mosConfig_absolute_path.'/includes/pdate.php' );
static function strftime_os($format, $ts = null) { if(defined("_DATETYPE") and _DATETYPE=="persian"){ $dateFunction="pdate"; $strftimeFunction="pstrftime"; } else{ $dateFunction="date"; $strftimeFunction="strftime"; } if( strtoupper(substr(php_uname(), 0, 3)) == 'WIN' ) { if (!$ts) { $ts = time(); } $mapping = array( '%C' => sprintf("%02d", $dateFunction("Y", $ts) / 100), '%D' => '%m/%d/%y', '%e' => sprintf("%' 2d", $dateFunction("j", $ts)), '%h' => '%b', '%n' => "\n", '%r' => date("h:i:s", $ts) . " %p", '%R' => date("H:i", $ts), '%t' => "\t", '%T' => '%H:%M:%S', '%u' => ($w = $dateFunction("w", $ts)) ? $w : 7 ); $format = str_replace( array_keys($mapping), array_values($mapping), $format ); } return $strftimeFunction($format, $ts); }
define('_DATETYPE','persian');
function showCalendar(id) { var el = document.getElementById(id); if (calendar != null) { // we already have one created, so just update it. calendar.hide(); // hide the existing calendar calendar.parseDate(el.value); // set it to a new date } else { // first-time call, create the calendar var cal = new Calendar(true, null, selected, closeHandler); cal.setDateType(CalendarDateType); calendar = cal; // remember the calendar in the global if(CalendarDateType=="jalali"){ cal.setRange(1340, 1450); // min/max year allowed } else{ cal.setRange(1900, 2070); // min/max year allowed } calendar.create(); // create a popup calendar } calendar.sel = el; // inform it about the input field in use calendar.showAtElement(el); // show the calendar next to the input field // catch mousedown on the document Calendar.addEvent(document, "mousedown", checkCalendar); return false;}
static public function loadCalendar() { global $mainframe; if (defined('elxcalincl')) { return; } define('elxcalincl', 1); $lng = (defined('_ELXIS_ADMIN')) ? $GLOBALS['alang'] : $GLOBALS['lang']; $lh = 1; if (headers_sent() || (ob_get_length() > 0)) { $lh = 0; } if (!file_exists($mainframe->getCfg('absolute_path').'/includes/js/calendar/lang/calendar-'.$lng.'.js')) { $lng = 'english'; } $baseurl = $mainframe->getCfg('live_site').'/includes/js/calendar'; if(defined("_DATETYPE") and _DATETYPE=="persian"){ $CalendarDateType="jalali"; } else{ $CalendarDateType="gregorian"; } echo '<script type="text/javascript"> var CalendarDateType="'.$CalendarDateType.'"</script>'."\n"; if ($lh === 0) { echo '<script type="text/javascript">document.write(\'<link rel="stylesheet" type="text/css" media="all" href="'.$baseurl.'/calendar-mos.css" />\');</script>'."\n"; echo '<script type="text/javascript" src="'.$baseurl.'/jalali.js"></script>'."\n"; echo '<script type="text/javascript" src="'.$baseurl.'/calendar.js"></script>'."\n"; echo '<script type="text/javascript" src="'.$baseurl.'/lang/calendar-'.$lng.'.js"></script>'."\n"; } else { $mainframe->addCustomHeadTag('<link rel="stylesheet" type="text/css" media="all" href="'.$baseurl.'/calendar-mos.css" />'); $mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$baseurl.'/jalali.js"></script>'); $mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$baseurl.'/calendar.js"></script>'); $mainframe->addCustomHeadTag('<script type="text/javascript" src="'.$baseurl.'/lang/calendar-'.$lng.'.js" charset="utf-8"></script>'); } }
function mosFormatDate($date, $format='', $offset='',$forSave=false) { global $mosConfig_offset; if ($format == '') { $format = _GEM_DATE_FORMLC; } //%Y-%m-%d %H:%M:%S if ($offset == '') { $offset = $mosConfig_offset; } if ($date && preg_match("/^([0-9]{4})-([0-9]{2})-([0-9]{2})[\s]([0-9]{2}):([0-9]{2}):([0-9]{2})$/", $date, $regs)) { if(defined("_DATETYPE") and _DATETYPE=="persian" and $forSave){ $date = pmktime( $regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1] ); } else{ $date = mktime( $regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1] ); } $date = $date > -1 ? eLOCALE::strftime_os( $format, $date + ($offset*60*60) ,$forSave) : '-'; } return $date;}
static function strftime_os($format, $ts = null,$forSave=false) { if(defined("_DATETYPE") and _DATETYPE=="persian" and !$forSave){ $dateFunction="pdate"; $strftimeFunction="pstrftime"; } else{ $dateFunction="date"; $strftimeFunction="strftime"; } if( strtoupper(substr(php_uname(), 0, 3)) == 'WIN' ) { if (!$ts) { $ts = time(); } $mapping = array( '%C' => sprintf("%02d", $dateFunction("Y", $ts) / 100), '%D' => '%m/%d/%y', '%e' => sprintf("%' 2d", $dateFunction("j", $ts)), '%h' => '%b', '%n' => "\n", '%r' => date("h:i:s", $ts) . " %p", '%R' => date("H:i", $ts), '%t' => "\t", '%T' => '%H:%M:%S', '%u' => ($w = $dateFunction("w", $ts)) ? $w : 7 ); $format = str_replace( array_keys($mapping), array_values($mapping), $format ); } return $strftimeFunction($format, $ts); }
$isNew = ( $row->id < 1 ); if ($isNew) { $row->created = $row->created ? mosFormatDate( $row->created, $adminLanguage->A_CMP_CNT_DROWCRED, -$mainframe->getCfg('offset')) : date( $adminLanguage->A_CMP_CNT_DATEFORMAT ); $row->created_by = $row->created_by ? $row->created_by : $my->id; } else { $row->modified = date( $adminLanguage->A_CMP_CNT_DATEFORMAT ); $row->modified_by = $my->id; $row->created = $row->created ? mosFormatDate( $row->created, $adminLanguage->A_CMP_CNT_DROWCRED, -$mainframe->getCfg('offset')) : date( $adminLanguage->A_CMP_CNT_DATEFORMAT ); $row->created_by = $row->created_by ? $row->created_by : $my->id; }
$isNew = ( $row->id < 1 ); if ($isNew) { $row->created = $row->created ? mosFormatDate( $row->created, $adminLanguage->A_CMP_CNT_DROWCRED, -$mainframe->getCfg('offset'),true) : date( $adminLanguage->A_CMP_CNT_DATEFORMAT ,true ); $row->created_by = $row->created_by ? $row->created_by : $my->id; } else { $row->modified = date( $adminLanguage->A_CMP_CNT_DATEFORMAT ); $row->modified_by = $my->id; $row->created = $row->created ? mosFormatDate( $row->created, $adminLanguage->A_CMP_CNT_DROWCRED, -$mainframe->getCfg('offset'),true) : date( $adminLanguage->A_CMP_CNT_DATEFORMAT, true ); $row->created_by = $row->created_by ? $row->created_by : $my->id; }
if (eUTF::utf8_trim( $row->publish_down ) == $adminLanguage->A_CMP_CNT_PBLINEV) { $row->publish_down = "2060-01-01 00:00:00"; }
if (eUTF::utf8_trim( $row->publish_down ) == $adminLanguage->A_CMP_CNT_PBLINEV) { $row->publish_down = "2060-01-01 00:00:00"; } else{ $row->publish_down = mosFormatDate($row->publish_down, $adminLanguage->A_CMP_CNT_DROWPUB, -$mainframe->getCfg('offset'),true); }
$expdate = ($row->expires == '2060-01-01 00:00:00') ? $adminLanguage->A_NEVER : mosFormatDate($row->expires, _GEM_DATE_FORMLC);
$expdate = ($row->expires == '2060-01-01 00:00:00') ? $adminLanguage->A_NEVER : mosFormatDate($row->expires, _GEM_DATE_FORMLC,true);