本文整理汇总了PHP中JevDate::getDate方法的典型用法代码示例。如果您正苦于以下问题:PHP JevDate::getDate方法的具体用法?PHP JevDate::getDate怎么用?PHP JevDate::getDate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JevDate
的用法示例。
在下文中一共展示了JevDate::getDate方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: store
/**
* override store function to force rrule to save too!
*
* @param unknown_type $updateNulls
*/
function store($updateNulls = false)
{
$date = JevDate::getDate();
$this->modified = $date->toMySQL();
if (parent::store($updateNulls)) {
// I also need to store custom data
$dispatcher = JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onStoreCustomDetails', array(&$this));
} else {
JError::raiseError(321, "Problem saving event " . $this->_db->getErrorMsg());
}
return $this->evdet_id;
}
示例2: overview
/**
* List Ical Events
*
*/
function overview()
{
// get the view
$this->view =& $this->getView("icalevent", "html");
$this->_checkValidCategories();
$showUnpublishedICS = true;
$showUnpublishedCategories = true;
$db =& JFactory::getDBO();
$icsFile = intval(JFactory::getApplication()->getUserStateFromRequest("icsFile", "icsFile", 0));
$catid = intval(JFactory::getApplication()->getUserStateFromRequest("catidIcalEvents", 'catid', 0));
$catidtop = $catid;
$state = intval(JFactory::getApplication()->getUserStateFromRequest("stateIcalEvents", 'state', 0));
$limit = intval(JFactory::getApplication()->getUserStateFromRequest("viewlistlimit", 'limit', 10));
$limitstart = intval(JFactory::getApplication()->getUserStateFromRequest("view{" . JEV_COM_COMPONENT . "}limitstart", 'limitstart', 0));
$search = JFactory::getApplication()->getUserStateFromRequest("search{" . JEV_COM_COMPONENT . "}", 'search', '');
$search = $db->getEscaped(trim(strtolower($search)));
$created_by = JFactory::getApplication()->getUserStateFromRequest("createdbyIcalEvents", 'created_by', 0);
// Is this a large dataset ?
$query = "SELECT count(rpt.rp_id) from #__jevents_repetition as rpt ";
$db->setQuery($query);
$totalrepeats = $db->loadResult();
$this->_largeDataSet = 0;
$cfg =& JEVConfig::getInstance();
if ($totalrepeats > $cfg->get('largeDataSetLimit', 100000)) {
$this->_largeDataSet = 1;
}
$cfg =& JEVConfig::getInstance();
$cfg->set('largeDataSet', $this->_largeDataSet);
$where = array();
$join = array();
if ($search) {
$where[] = "LOWER(detail.summary) LIKE '%{$search}%'";
}
if (JVersion::isCompatible("1.6.0")) {
$user =& JFactory::getUser();
$params =& JComponentHelper::getParams(JEV_COM_COMPONENT);
$authorisedonly = $params->get("authorisedonly", 0);
$cats = $user->getAuthorisedCategories('com_jevents', 'core.create');
if (isset($user->id) && !$user->authorise('core.create', 'com_jevents') && !$authorisedonly) {
if ($cats > 0 && $catid < 1) {
for ($i = 0; $i < count($cats); $i++) {
$whereCats[$i] = "ev.catid='{$cats[$i]}'";
}
$where[] = '(' . implode(" OR ", $whereCats) . ')';
} else {
if ($cats > 0 && $catid > 0 && in_array($catid, $cats)) {
$where[] = "ev.catid='{$catid}'";
} else {
$where[] = "ev.catid=''";
}
}
} else {
if ($catid > 0) {
$where[] = "ev.catid='{$catid}'";
}
}
} else {
if ($catid > 0) {
$where[] = "ev.catid='{$catid}'";
}
}
if ($created_by === "") {
$where[] = "ev.created_by=0";
} else {
$created_by = intval($created_by);
if ($created_by > 0) {
$where[] = "ev.created_by=" . $db->Quote($created_by);
}
}
if ($icsFile > 0) {
$join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid";
$where[] = "\n icsf.ics_id = {$icsFile}";
if (!$showUnpublishedICS) {
$where[] = "\n icsf.state=1";
}
} else {
if (!$showUnpublishedICS) {
$join[] = " #__jevents_icsfile as icsf ON icsf.ics_id = ev.icsid";
$where[] = "\n icsf.state=1";
} else {
$icsFrom = "";
}
}
$hidepast = intval(JFactory::getApplication()->getUserStateFromRequest("hidepast", "hidepast", 1));
if ($hidepast) {
$datenow =& JevDate::getDate("-1 day");
if (!$this->_largeDataSet) {
$where[] = "\n rpt.endrepeat>'" . $datenow->toMysql() . "'";
}
}
if ($state == 1) {
$where[] = "\n ev.state=1";
} else {
if ($state == 2) {
$where[] = "\n ev.state=0";
}
//.........这里部分代码省略.........
示例3: getNow
/**
* Get JevDate object of current time
*
* @return object JevDate
*/
public static function getNow()
{
/* JevDate object of current time */
static $datenow = null;
if (!isset($datenow)) {
include_once JPATH_SITE . "/components/com_jevents/jevents.defines.php";
$compparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
$tz = $compparams->get("icaltimezonelive", "");
// Now in the set timezone!
$datenow = JevDate::getDate("+0 seconds");
}
return $datenow;
}
示例4: store
/**
* override store function to force rrule to save too!
*
* @param unknown_type $updateNulls
*/
function store($updateNulls = false, $overwriteCreator = false)
{
$user =& JFactory::getUser();
if ($this->ev_id == 0) {
$date =& JevDate::getDate();
$this->created = $date->toMySQL();
}
if (!isset($this->created_by) || is_null($this->created_by) || $this->created_by == 0) {
$this->created_by = $user->id;
}
$this->modified_by = $user->id;
if (!isset($this->created_by_alias) || is_null($this->created_by_alias) || $this->created_by_alias == "") {
$this->created_by_alias = "";
}
// make sure I update existing detail
$matchingDetail = $this->matchingEventDetails();
if (isset($matchingDetail) && isset($matchingDetail->evdet_id)) {
$this->_detail->evdet_id = $matchingDetail->evdet_id;
}
// if existing row preserve created by - unless being overwritten by authorised user
// If user is jevents can deleteall or has backend access then allow them to specify the creator
$jevuser = JEVHelper::getAuthorisedUser();
$creatorid = JRequest::getInt("jev_creatorid", 0);
$access = false;
if ($user->get('id') > 0) {
if (JVersion::isCompatible("1.6.0")) {
//$access = JAccess::check($user->id, "core.deleteall","com_jevents");
$access = $user->authorise('core.deleteall', 'com_jevents');
} else {
// does this logged in have backend access
// Get an ACL object
$acl =& JFactory::getACL();
$grp = $acl->getAroGroup($user->get('id'));
// if no valid group (e.g. anon user) then skip this.
if (!$grp) {
return;
}
$access = $acl->is_group_child_of($grp->name, 'Public Backend');
}
}
if (!($jevuser && $jevuser->candeleteall || $access) || $creatorid == 0) {
if (!is_null($this->ev_id) || $this->ev_id > 0) {
// we can overwrite the creator if refreshing/saving an ical with specified creator
if (isset($matchingDetail) && $matchingDetail->created_by > 0 && !$overwriteCreator) {
$this->created_by = $matchingDetail->created_by;
}
}
}
$db =& JFactory::getDBO();
$detailid = $this->_detail->store($updateNulls);
if (!$detailid) {
JError::raiseError(104, JText::_('PROBLEMS_STORING_EVENT_DETAIL'));
echo $db->getErroMsg() . "<br/>";
return false;
}
$this->detail_id = $detailid;
if (!parent::store($updateNulls)) {
JError::raiseError(105, JText::_('PROBLEMS_STORING_EVENT'));
echo $db->getErrorMsg() . "<br/>";
return false;
}
// I also need to store custom data - when we need the event itself and not just the detail
$dispatcher =& JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onStoreCustomEvent', array(&$this));
if (isset($this->rrule)) {
$this->rrule->eventid = $this->ev_id;
if ($id = $this->rrule->isDuplicate()) {
$this->rrule->rr_id = $id;
}
$this->rrule->store($updateNulls);
echo $db->getErrorMsg() . "<br/>";
}
return true;
}
示例5: listEventsByKeyword
function listEventsByKeyword($keyword, $order, &$limit, &$limitstart, &$total, $useRegX = false)
{
$user = JFactory::getUser();
$adminuser = JEVHelper::isAdminUser($user);
$db = JFactory::getDBO();
$rows_per_page = $limit;
if (empty($limitstart) || !$limitstart) {
$limitstart = 0;
}
$limitstring = "";
if ($rows_per_page > 0) {
$limitstring = "LIMIT {$limitstart}, {$rows_per_page}";
}
$where = "";
$having = "";
if (!JRequest::getInt('showpast', 0)) {
$datenow =& JevDate::getDate("-12 hours");
$having = " AND rpt.endrepeat>'" . $datenow->toMysql() . "'";
}
if (!$order) {
$order = 'publish_up';
}
$order = preg_replace("/[\t ]+/", '', $order);
$orders = explode(",", $order);
// this function adds #__events. to the beginning of each ordering field
function app_db($strng)
{
return '#__events.' . $strng;
}
$order = implode(',', array_map('app_db', $orders));
$total = 0;
// process the new plugins
// get extra data and conditionality from plugins
$extrawhere = array();
$extrajoin = array();
$extrafields = "";
// must have comma prefix
$needsgroup = false;
$filterarray = array("published");
// If there are extra filters from the module then apply them now
$reg =& JFactory::getConfig();
$modparams = $reg->getValue("jev.modparams", false);
if ($modparams && $modparams->getValue("extrafilters", false)) {
$filterarray = array_merge($filterarray, explode(",", $modparams->getValue("extrafilters", false)));
}
$filters = jevFilterProcessing::getInstance($filterarray);
$filters->setWhereJoin($extrawhere, $extrajoin);
$needsgroup = $filters->needsGroupBy();
JPluginHelper::importPlugin('jevents');
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onListIcalEvents', array(&$extrafields, &$extratables, &$extrawhere, &$extrajoin, &$needsgroup));
$catwhere = "\n WHERE ev.catid IN(" . $this->accessibleCategoryList() . ")";
$params = JComponentHelper::getParams("com_jevents");
if ($params->get("multicategory", 0)) {
$extrajoin[] = "\n #__jevents_catmap as catmap ON catmap.evid = rpt.eventid";
$extrajoin[] = "\n #__categories AS catmapcat ON catmap.catid = catmapcat.id";
$extrafields .= ", GROUP_CONCAT(DISTINCT catmap.catid SEPARATOR ',') as catids";
$extrawhere[] = " catmapcat.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$extrawhere[] = " catmap.catid IN(" . $this->accessibleCategoryList() . ")";
$needsgroup = true;
$catwhere = "\n WHERE 1 ";
}
$extrajoin = count($extrajoin) ? " \n LEFT JOIN " . implode(" \n LEFT JOIN ", $extrajoin) : '';
$extrawhere = count($extrawhere) ? ' AND ' . implode(' AND ', $extrawhere) : '';
$extrasearchfields = array();
$dispatcher->trigger('onSearchEvents', array(&$extrasearchfields, &$extrajoin, &$needsgroup));
if (count($extrasearchfields) > 0) {
$extraor = implode(" OR ", $extrasearchfields);
$extraor = " OR " . $extraor;
// replace the ### placeholder with the keyword
$extraor = str_replace("###", $keyword, $extraor);
$searchpart = $useRegX ? "(det.summary RLIKE '{$keyword}' OR det.description RLIKE '{$keyword}' OR det.extra_info RLIKE '{$keyword}' {$extraor})\n" : " (MATCH (det.summary, det.description, det.extra_info) AGAINST ('{$keyword}' IN BOOLEAN MODE) {$extraor})\n";
} else {
$searchpart = $useRegX ? "(det.summary RLIKE '{$keyword}' OR det.description RLIKE '{$keyword}' OR det.extra_info RLIKE '{$keyword}')\n" : "MATCH (det.summary, det.description, det.extra_info) AGAINST ('{$keyword}' IN BOOLEAN MODE)\n";
}
// Now Search Icals
$query = "SELECT count( distinct det.evdet_id) FROM #__jevents_vevent as ev" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventid = ev.ev_id" . "\n LEFT JOIN #__jevents_vevdetail as det ON det.evdet_id = rpt.eventdetail_id" . $extrajoin . $catwhere . "\n AND icsf.state=1 AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ";
$query .= $searchpart;
$query .= $extrawhere;
$query .= $having;
$db->setQuery($query);
//echo $db->explain();
$total += intval($db->loadResult());
if ($total < $limitstart) {
$limitstart = 0;
}
$rows = array();
if ($total == 0) {
return $rows;
}
// Now Search Icals
// New version
$query = "SELECT DISTINCT det.evdet_id FROM #__jevents_vevdetail as det" . "\n LEFT JOIN #__jevents_repetition as rpt ON rpt.eventdetail_id = det.evdet_id" . "\n LEFT JOIN #__jevents_vevent as ev ON ev.ev_id = rpt.eventid" . "\n LEFT JOIN #__jevents_icsfile as icsf ON icsf.ics_id=ev.icsid" . $extrajoin . $catwhere . "\n AND icsf.state=1 AND icsf.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND ev.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user) . ')' : ' <= ' . JEVHelper::getAid($user));
$query .= " AND ";
$query .= $searchpart;
$query .= $extrawhere;
$query .= $having;
$query .= "\n ORDER BY rpt.startrepeat ASC ";
$query .= "\n {$limitstring}";
$db->setQuery($query);
//.........这里部分代码省略.........
示例6: DefaultLoadedFromTemplate
//.........这里部分代码省略.........
$search[] = "{{EDITDIALOG}}";
if ($view) {
ob_start();
$view->eventManagementDialog($event, $mask);
$dialog = ob_get_clean();
$replace[] = $dialog;
} else {
$replace[] = "";
}
$blank[] = "";
echo $dialog;
?>
</div>
<?php
$search[] = "{{EDITBUTTON}}";
$replace[] = ob_get_clean();
$blank[] = "";
} else {
$search[] = "{{EDITBUTTON}}";
$replace[] = "";
$blank[] = "";
$search[] = "{{EDITDIALOG}}";
$replace[] = "";
$blank[] = "";
}
break;
case "{{CREATED}}":
$compparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
$jtz = $compparams->get("icaltimezonelive", "");
if ($jtz == "") {
$jtz = null;
}
$created = JevDate::getDate($event->created(), $jtz);
$search[] = "{{CREATED}}";
$replace[] = $created->toFormat(JText::_("DATE_FORMAT_CREATED"));
$blank[] = "";
break;
case "{{ACCESS}}":
$search[] = "{{ACCESS}}";
$replace[] = $event->getAccessName();
$blank[] = "";
break;
case "{{REPEATSUMMARY}}":
case "{{STARTDATE}}":
case "{{ENDDATE}}":
case "{{STARTTIME}}":
case "{{ENDTIME}}":
case "{{STARTTZ}}":
case "{{ENDTZ}}":
case "{{ISOSTART}}":
case "{{ISOEND}}":
case "{{DURATION}}":
case "{{MULTIENDDATE}}":
if ($template_name == "icalevent.detail_body") {
$search[] = "{{REPEATSUMMARY}}";
$repeatsummary = $view->repeatSummary($event);
if (!$repeatsummary) {
$repeatsummary = $event->repeatSummary();
}
$replace[] = $repeatsummary;
//$replace[] = $event->repeatSummary();
$blank[] = "";
$row = $event;
$start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0);
$start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup());
示例7: store
/**
* override store function to force rrule to save too!
*
* @param unknown_type $updateNulls
*/
function store($updateNulls = false, $overwriteCreator = false)
{
$user = JFactory::getUser();
if ($this->ev_id == 0) {
$date = JevDate::getDate("+0 seconds");
$this->created = $date->toMySQL();
}
if (!isset($this->created_by) || is_null($this->created_by) || $this->created_by == 0) {
$this->created_by = $user->id;
}
$this->modified_by = $user->id;
if (!isset($this->created_by_alias) || is_null($this->created_by_alias) || $this->created_by_alias == "") {
$this->created_by_alias = "";
}
// make sure I update existing detail
$matchingDetail = $this->matchingEventDetails();
if (isset($matchingDetail) && isset($matchingDetail->evdet_id)) {
$this->_detail->evdet_id = $matchingDetail->evdet_id;
}
// if existing row preserve created by - unless being overwritten by authorised user
// If user is jevents can deleteall or has backend access then allow them to specify the creator
$jevuser = JEVHelper::getAuthorisedUser();
$creatorid = JRequest::getInt("jev_creatorid", 0);
$access = false;
if ($user->get('id') > 0) {
//$access = JAccess::check($user->id, "core.deleteall","com_jevents");
$access = $user->authorise('core.deleteall', 'com_jevents');
}
if (!($jevuser && $jevuser->candeleteall || $access) || $creatorid == 0) {
if (!is_null($this->ev_id) || $this->ev_id > 0) {
// we can overwrite the creator if refreshing/saving an ical with specified creator
if (isset($matchingDetail) && $matchingDetail->created_by > 0 && !$overwriteCreator) {
$this->created_by = $matchingDetail->created_by;
}
}
}
// place private reference to created_by in event detail in case needed by plugins
$this->_detail->_created_by = $this->created_by;
$db = JFactory::getDBO();
$detailid = $this->_detail->store($updateNulls);
if (!$detailid) {
JError::raiseError(104, JText::_('PROBLEMS_STORING_EVENT_DETAIL'));
echo $db->getErrorMsg() . "<br/>";
return false;
}
$this->detail_id = $detailid;
// Keep the multiple catids for storing after this
$catids = false;
if (is_array($this->catid)) {
$catids = $this->catid;
$this->catid = $this->catid[0];
}
if (!parent::store($updateNulls)) {
JError::raiseError(105, JText::_('PROBLEMS_STORING_EVENT'));
echo $db->getErrorMsg() . "<br/>";
return false;
}
if ($catids) {
$pairs = array();
$order = 0;
foreach ($catids as $catid) {
if ($catid == "") {
$catid = -1;
} else {
$pairs[] = "({$this->ev_id},{$catid}, {$order})";
$order++;
}
}
$db->setQuery("DELETE FROM #__jevents_catmap where evid = " . $this->ev_id . " AND catid NOT IN (" . implode(",", $catids) . ")");
$sql = $db->getQuery();
$success = $db->query();
if (count($pairs) > 0) {
$db->setQuery("Replace into #__jevents_catmap (evid, catid, ordering) VALUES " . implode(",", $pairs));
$sql = $db->getQuery();
$success = $db->query();
}
}
// I also need to store custom data - when we need the event itself and not just the detail
$dispatcher = JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onStoreCustomEvent', array(&$this));
if (isset($this->rrule)) {
$this->rrule->eventid = $this->ev_id;
if ($id = $this->rrule->isDuplicate()) {
$this->rrule->rr_id = $id;
}
$this->rrule->store($updateNulls);
echo $db->getErrorMsg() . "<br/>";
}
return true;
}
示例8: DefaultLoadedFromTemplate
//.........这里部分代码省略.........
?>
<a href="javascript:void(0)" onclick='clickEditButton()' title="<?php
echo JText::_('JEV_E_EDIT');
?>
">
<?php
echo JEVHelper::imagesite('edit.png', JText::_('JEV_E_EDIT'));
?>
</a>
<div class="jevdialogs">
<?php
$search[] = "{{EDITDIALOG}}";
ob_start();
$view->eventManagementDialog($event, $mask);
$dialog = ob_get_clean();
$replace[] = $dialog;
$blank[] = "";
echo $dialog;
?>
</div>
<?php
$search[] = "{{EDITBUTTON}}";
$replace[] = ob_get_clean();
$blank[] = "";
} else {
$search[] = "{{EDITBUTTON}}";
$replace[] = "";
$blank[] = "";
$search[] = "{{EDITDIALOG}}";
$replace[] = "";
$blank[] = "";
}
$created = JevDate::getDate($event->created());
$search[] = "{{CREATED}}";
$replace[] = $created->toFormat(JText::_("DATE_FORMAT_CREATED"));
$blank[] = "";
if ($template_name == "icalevent.detail_body") {
$search[] = "{{REPEATSUMMARY}}";
$replace[] = $event->repeatSummary();
$blank[] = "";
$row = $event;
$start_date = JEventsHTML::getDateFormat($row->yup(), $row->mup(), $row->dup(), 0);
$start_time = JEVHelper::getTime($row->getUnixStartTime(), $row->hup(), $row->minup());
$stop_date = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn(), 0);
$stop_time = JEVHelper::getTime($row->getUnixEndTime(), $row->hdn(), $row->mindn());
$stop_time_midnightFix = $stop_time;
$stop_date_midnightFix = $stop_date;
if ($row->sdn() == 59 && $row->mindn() == 59) {
$stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1, 0, 0);
$stop_date_midnightFix = JEventsHTML::getDateFormat($row->ydn(), $row->mdn(), $row->ddn() + 1, 0);
}
$search[] = "{{STARTDATE}}";
$replace[] = $start_date;
$blank[] = "";
$search[] = "{{ENDDATE}}";
$replace[] = $stop_date;
$blank[] = "";
$search[] = "{{STARTTIME}}";
$replace[] = $start_time;
$blank[] = "";
$search[] = "{{ENDTIME}}";
$replace[] = $stop_time_midnightFix;
$blank[] = "";
} else {
$row = $event;