本文整理汇总了PHP中JEVHelper::getYMD方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::getYMD方法的具体用法?PHP JEVHelper::getYMD怎么用?PHP JEVHelper::getYMD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::getYMD方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _adminStart
function _adminStart()
{
$dispatcher = JEventDispatcher::getInstance();
list($this->year, $this->month, $this->day) = JEVHelper::getYMD();
$this->Itemid = JEVHelper::getItemid();
$this->datamodel = new JEventsDataModel();
$dispatcher->trigger('onJEventsHeader', array($this));
?>
<div style="clear:both"
<?php
$mainframe = JFactory::getApplication();
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
echo !JFactory::getApplication()->isAdmin() && $params->get("darktemplate", 0) ? "class='jeventsdark'" : "class='jeventslight'";
?>
>
<div id="toolbar-box" >
<?php
$bar = JToolBar::getInstance('toolbar');
$barhtml = $bar->render();
//$barhtml = str_replace('href="#"','href="javascript void();"',$barhtml);
//$barhtml = str_replace('submitbutton','return submitbutton',$barhtml);
echo $barhtml;
if (JevJoomlaVersion::isCompatible("3.0")) {
// JFactory::getApplication()->JComponentTitle;
$title = "";
} else {
$title = JFactory::getApplication()->get('JComponentTitle');
}
echo $title;
?>
</div>
<?php
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onJEventsFooter', array($this));
}
示例2: listevents
function listevents()
{
list($year, $month, $day) = JEVHelper::getYMD();
$Itemid = JEVHelper::getItemid();
// get the view
$document =& JFactory::getDocument();
$viewType = $document->getType();
$cfg =& JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "day";
$this->addViewPath($this->_basePath . DS . "views" . DS . $theme);
$this->view =& $this->getView($view, $viewType, $theme, array('base_path' => $this->_basePath, "template_path" => $this->_basePath . DS . "views" . DS . $theme . DS . $view . DS . 'tmpl', "name" => $theme . DS . $view));
// Set the layout
$this->view->setLayout('listevents');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
// View caching logic -- simple... are we logged in?
$cfg =& JEVConfig::getInstance();
$useCache = intval($cfg->get('com_cache', 0));
$user =& JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache =& JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例3: ajax
function ajax()
{
$modid = intval(JRequest::getVar('modid', 0));
if ($modid <= 0) {
echo "<script>alert('bad mod id');</script>";
return;
}
// load language constants
JEVHelper::loadLanguage('modcal');
list($year, $month, $day) = JEVHelper::getYMD();
$user = JFactory::getUser();
$query = "SELECT id, params" . "\n FROM #__modules AS m" . "\n WHERE m.published = 1" . "\n AND m.id = " . $modid . "\n AND m.access " . (version_compare(JVERSION, '1.6.0', '>=') ? ' IN (' . JEVHelper::getAid($user, 'string') . ')' : ' <= ' . JEVHelper::getAid($user)) . "\n AND m.client_id != 1";
$db =& JFactory::getDBO();
$db->setQuery($query);
$modules = $db->loadObjectList();
if (count($modules) <= 0) {
if (!$modid <= 0) {
echo "<script>alert('bad mod id');</script>";
return;
}
}
$params = new JParameter($modules[0]->params);
$cfg =& JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$theme = $params->get("com_calViewName", $theme);
$modtheme = $params->get("com_calViewName", $theme);
if ($modtheme == "") {
$modtheme = $theme;
}
$theme = $modtheme;
//require(JModuleHelper::getLayoutPath('mod_jevents_cal',$theme.DS."calendar"));
require_once JPATH_SITE . '/modules/mod_jevents_cal/helper.php';
$jevhelper = new modJeventsCalHelper();
$viewclass = $jevhelper->getViewClass($theme, 'mod_jevents_cal', $theme . DS . "calendar", $params);
$modview = new $viewclass($params, $modid);
?>
<script type="text/javascript">
var doitdone = false;
function doit(){
if (doitdone) return;
doitdone = true;
var sillydiv=document.getElementById('silly');
parent.navLoaded(sillydiv,<?php
echo $modid;
?>
);
}
window.onload=doit;
</script>
<?php
echo "<div id='silly'>";
echo $modview->getAjaxCal($modid, $month, $year);
echo "</div>";
?>
<script type="text/javascript">
doit();
</script>
<?php
}
示例4: detail
function detail()
{
// Do we have to be logged in to see this event
$user = JFactory::getUser();
if (JRequest::getInt("login", 0) && $user->id == 0) {
$uri = JURI::getInstance();
$link = $uri->toString();
$comuser = version_compare(JVERSION, '1.6.0', '>=') ? "com_users" : "com_user";
$link = 'index.php?option=' . $comuser . '&view=login&return=' . base64_encode($link);
$link = JRoute::_($link);
$this->setRedirect($link, JText::_('JEV_LOGIN_TO_VIEW_EVENT'));
return;
}
$evid = JRequest::getInt("rp_id", 0);
if ($evid == 0) {
$evid = JRequest::getInt("evid", 0);
// In this case I do not have a repeat id so I
}
// if cancelling from save of copy and edit use the old event id
if ($evid == 0) {
$evid = JRequest::getInt("old_evid", 0);
}
$pop = intval(JRequest::getVar('pop', 0));
list($year, $month, $day) = JEVHelper::getYMD();
$Itemid = JEVHelper::getItemid();
$uid = urldecode(JRequest::getVar('uid', ""));
$document =& JFactory::getDocument();
$viewType = $document->getType();
$cfg =& JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "icalevent";
$this->addViewPath($this->_basePath . DS . "views" . DS . $theme);
$this->view =& $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . DS . "views" . DS . $theme . DS . $view . DS . 'tmpl', "name" => $theme . DS . $view));
// Set the layout
$this->view->setLayout("detail");
$this->view->assign("Itemid", $Itemid);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
$this->view->assign("pop", $pop);
$this->view->assign("evid", $evid);
$this->view->assign("jevtype", "icaldb");
$this->view->assign("uid", $uid);
// View caching logic -- simple... are we logged in?
$cfg =& JEVConfig::getInstance();
$useCache = intval($cfg->get('com_cache', 0));
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache =& JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例5: results
function results()
{
list($year, $month, $day) = JEVHelper::getYMD();
$Itemid = JEVHelper::getItemid();
$db = JFactory::getDBO();
$keyword = JRequest::getString('keyword', '');
// limit searchword to a maximum of characters
$upper_limit = 20;
if (strlen($keyword) > $upper_limit) {
$keyword = substr($keyword, 0, $upper_limit - 1);
}
// Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390
$limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0)));
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15)));
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "search";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout('results');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
$this->view->assign("keyword", $keyword);
$this->view->assign("limit", $limit);
$this->view->assign("limitstart", $limitstart);
// View caching logic -- simple... are we logged in?
$cfg = JEVConfig::getInstance();
$joomlaconf = JFactory::getConfig();
$useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1);
$user = JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache = JFactory::getCache(JEV_COM_COMPONENT, 'view');
$uri = JURI::getInstance();
$url = $uri->toString();
$cache->get($this->view, 'display', base64_encode($keyword . $Itemid . $limit . $limitstart . $month . $day . $year . $url));
}
}
示例6: listevents
function listevents()
{
$is_event_editor = JEVHelper::isEventCreator();
$Itemid = JEVHelper::getItemid();
$user = JFactory::getUser();
if (!$is_event_editor) {
$returnlink = JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=month.calendar&Itemid=' . $Itemid, false);
$this->setRedirect($returnlink, html_entity_decode(JText::_('JEV_NOPERMISSION')));
$this->redirect();
return;
}
list($year, $month, $day) = JEVHelper::getYMD();
// Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390
$limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0)));
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15)));
$Itemid = JEVHelper::getItemid();
$task = $this->_task;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$adminuser = $params->get("jevadmin", -1);
if (JEVHelper::isAdminUser($user) || $user->id == $adminuser) {
$creator_id = 'ADMIN';
} else {
$creator_id = $user->id;
}
// get the view
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "admin";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout('listevents');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("limitstart", $limitstart);
$this->view->assign("limit", $limit);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $task);
$this->view->assign("creator_id", $creator_id);
$this->view->display();
}
示例7: _createfilterHTML
function _createfilterHTML()
{
// setup for all required function and classes
$file = JPATH_SITE . '/components/com_jevents/mod.defines.php';
if (file_exists($file)) {
include_once $file;
}
$reg = JevRegistry::getInstance("jevents");
$this->datamodel = $reg->getReference("jevents.datamodel", false);
if (!$this->datamodel) {
$this->datamodel = new JEventsDataModel();
$this->datamodel->setupComponentCatids();
}
$filterList = array();
$filterList["title"] = JText::_("JEV_SELECT_MATCHING_EVENT");
$options = array();
// only if other filters are active to we offer a choice
if (JRequest::getInt("eventlist") == 1) {
$options[] = JHTML::_('select.option', "0", JText::_("JEV_SELECT_MATCHING_EVENT"), "value", "text");
list($year, $month, $day) = JEVHelper::getYMD();
$tenyear = $year + 10;
// next 100 matching events
$events = $this->datamodel->queryModel->listIcalEventsByRange("{$year}-{$month}-{$day}", "{$tenyear}-{$month}-{$day}", 0, 100, false, "rpt.startrepeat asc, rpt.endrepeat ASC, det.summary ASC");
if ($events && count($events) > 0) {
$Itemid = $this->datamodel->myItemid;
foreach ($events as $event) {
$link = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), true, $Itemid);
$options[] = JHTML::_('select.option', $link, $event->title(), "value", "text");
}
}
} else {
$options[] = JHTML::_('select.option', "0", JText::_("JEV_NO_MATCHING_EVENTS"), "value", "text");
}
$filterList["html"] = JHTML::_('select.genericlist', $options, 'eventlist_fv', 'class="inputbox" size="1" onchange="document.location.replace(this.value);"', 'value', 'text', 0);
$filterList["html"] .= "<input type='hidden' name='eventlist' id='eventlistid' value='1' />";
$script = "function resetEventlist(){document.getElementById('eventlistid').value=0;}\n";
$script .= "try {JeventsFilters.filters.push({action:'resetEventlist()',id:'eventlist_fv',value:0});} catch (e) {}\n";
$document = JFactory::getDocument();
$document->addScriptDeclaration($script);
return $filterList;
}
示例8: listevents
function listevents()
{
list($year, $month, $day) = JEVHelper::getYMD();
// Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390
$limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0)));
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$limit = intval(JFactory::getApplication()->getUserStateFromRequest('jevlistlimit', 'limit', $params->get("com_calEventListRowsPpg", 15)));
// $catid = intval( JRequest::getVar( 'catid', 0 ) );
$catids = JRequest::getVar('catids', "");
$catids = explode("|", $catids);
$Itemid = JEVHelper::getItemid();
// get the view
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "cat";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout('listevents');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("limitstart", $limitstart);
$this->view->assign("limit", $limit);
$this->view->assign("catids", $catids);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
// View caching logic -- simple... are we logged in?
$cfg = JEVConfig::getInstance();
$joomlaconf = JFactory::getConfig();
$useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1);
$user = JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache = JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例9: eventdata
function eventdata()
{
$this->datamodel = new JEventsDataModel();
list($year, $month, $day) = JEVHelper::getYMD();
$start = JRequest::getVar('start', "{$year}-{$month}-{$day}");
$end = JRequest::getVar('end', "{$year}-{$month}-{$day}");
$limitstart = 0;
$limit = 0;
$myItemid = JEVHelper::getItemid();
// Force repeats to show
$cfg = JEVConfig::getInstance();
$cfg->set("com_showrepeats", true);
// TODO Check for sanity of $start and $end
$this->datamodel = new JEventsDataModel();
$data = $this->datamodel->getRangeData($start, $end, $limitstart, $limit);
$events = array();
foreach ($data['rows'] as $event) {
$eventArray = array();
$eventArray['title'] = $event->title();
$eventArray['start'] = $event->yup() . "-" . $event->mup() . "-" . $event->dup() . " " . date("H:i", $event->getUnixStartTime());
$eventArray['end'] = $event->yup() . "-" . $event->mup() . "-" . $event->dup() . " " . date("H:i", $event->getUnixStartTime());
$eventArray['textcolor'] = $event->fgcolor();
$eventArray['backgroundColor'] = $event->bgcolor();
$link = $event->viewDetailLink($event->yup(), $event->mup(), $event->dup(), false, $myItemid);
$eventArray['url'] = JRoute::_($link . $this->datamodel->getCatidsOutLink());
if ($event->hasrepetition()) {
$eventArray['id'] = $event->ev_id();
}
$events[] = $eventArray;
}
// Get the document object.
$document =& JFactory::getDocument();
// Set the MIME type for JSON output.
$document->setMimeEncoding('application/json');
// Change the suggested filename.
JResponse::setHeader('Content-Disposition', 'attachment;filename="eventdata.json"');
// Output the JSON data.
echo json_encode($events);
exit;
}
示例10: listevents
function listevents()
{
JRequest::setVar("tmpl", "component");
list($year, $month, $day) = JEVHelper::getYMD();
// Joomla unhelpfully switched limitstart to start when sef is enabled! includes/router.php line 390
$limitstart = intval(JRequest::getVar('start', JRequest::getVar('limitstart', 0)));
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$limit = $params->get("com_calEventListRowsPpg", 15);
// Crawler should list at least 100 events for efficiency
$limit = intval($limit) < 100 ? 100 : $limit;
$Itemid = JEVHelper::getItemid();
// get the view
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = "default";
$view = "crawler";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout('listevents');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("limitstart", $limitstart);
$this->view->assign("limit", $limit);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
// View caching logic -- simple... are we logged in?
$cfg = JEVConfig::getInstance();
$joomlaconf = JFactory::getConfig();
$useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1);
$user = JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache = JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例11: listevents
function listevents()
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$fixedDay = $params->get('fixedday', '');
if ($fixedDay) {
$year = date('Y', strtotime($fixedDay));
$month = date('m', strtotime($fixedDay));
$day = date('d', strtotime($fixedDay));
} else {
list($year, $month, $day) = JEVHelper::getYMD();
}
$Itemid = JEVHelper::getItemid();
// get the view
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "day";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout('listevents');
$this->view->assign("Itemid", $Itemid);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
// View caching logic -- simple... are we logged in?
$cfg = JEVConfig::getInstance();
$joomlaconf = JFactory::getConfig();
$useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1);
$user = JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache = JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例12: detail
function detail()
{
$evid = JRequest::getInt("evid", 0);
$pop = intval(JRequest::getVar('pop', 0));
list($year, $month, $day) = JEVHelper::getYMD();
$Itemid = JEVHelper::getItemid();
// get the view
$document = JFactory::getDocument();
$viewType = $document->getType();
$cfg = JEVConfig::getInstance();
$theme = JEV_CommonFunctions::getJEventsViewName();
$view = "jevent";
$this->addViewPath($this->_basePath . '/' . "views" . '/' . $theme);
$this->view = $this->getView($view, $viewType, $theme . "View", array('base_path' => $this->_basePath, "template_path" => $this->_basePath . '/' . "views" . '/' . $theme . '/' . $view . '/' . 'tmpl', "name" => $theme . '/' . $view));
// Set the layout
$this->view->setLayout("detail");
$this->view->assign("Itemid", $Itemid);
$this->view->assign("month", $month);
$this->view->assign("day", $day);
$this->view->assign("year", $year);
$this->view->assign("task", $this->_task);
$this->view->assign("pop", $pop);
$this->view->assign("evid", $evid);
$this->view->assign("jevtype", "jevent");
// View caching logic -- simple... are we logged in?
$cfg = JEVConfig::getInstance();
$joomlaconf = JFactory::getConfig();
$useCache = intval($cfg->get('com_cache', 0)) && $joomlaconf->get('caching', 1);
$user = JFactory::getUser();
if ($user->get('id') || !$useCache) {
$this->view->display();
} else {
$cache = JFactory::getCache(JEV_COM_COMPONENT, 'view');
$cache->get($this->view, 'display');
}
}
示例13: _adminStart
function _adminStart()
{
$dispatcher =& JDispatcher::getInstance();
list($this->year, $this->month, $this->day) = JEVHelper::getYMD();
$this->Itemid = JEVHelper::getItemid();
$this->datamodel = new JEventsDataModel();
$dispatcher->trigger('onJEventsHeader', array($this));
?>
<div style="clear:both">
<div id="toolbar-box" >
<?php
$bar =& JToolBar::getInstance('toolbar');
$barhtml = $bar->render();
//$barhtml = str_replace('href="#"','href="javascript void();"',$barhtml);
//$barhtml = str_replace('submitbutton','return submitbutton',$barhtml);
echo $barhtml;
$title = JFactory::getApplication()->get('JComponentTitle');
echo $title;
?>
</div>
<?php
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onJEventsFooter', array($this));
}
示例14: notifyAuthorPublished
function notifyAuthorPublished($event)
{
JLoader::register('JEventsCategory', JEV_ADMINPATH . "/libraries/categoryClass.php");
$db = JFactory::getDBO();
$cat = new JEventsCategory($db);
$cat->load($event->catid());
$adminuser = $cat->getAdminUser();
$adminEmail = $adminuser->email;
$adminName = $adminuser->name;
$config = new JConfig();
$sitename = $config->sitename;
$subject = JText::sprintf('JEV_NOTIFY_AUTHOR_SUBJECT', $sitename);
$Itemid = JEVHelper::getItemid();
// reload the event to get the reptition ids
$evid = intval($event->ev_id());
$dataModel = new JEventsDataModel("JEventsAdminDBModel");
$queryModel = new JEventsDBModel($dataModel);
$testevent = $queryModel->getEventById($evid, 1, "icaldb");
// attach anonymous creator etc.
JPluginHelper::importPlugin('jevents');
$dispatcher =& JDispatcher::getInstance();
$dispatcher->trigger('onDisplayCustomFields', array(&$event));
$rp_id = $testevent->rp_id();
list($year, $month, $day) = JEVHelper::getYMD();
$uri =& JURI::getInstance(JURI::base());
if (JFactory::getApplication()->isAdmin()) {
$root = $uri->toString(array('scheme', 'host', 'port', 'path'));
$root = str_replace("/administrator", "", $root);
$detaillink = '<a href="' . $root . 'index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}" . '">' . $event->title() . '</a>' . "\n";
} else {
$root = $uri->toString(array('scheme', 'host', 'port'));
$detaillink = '<a href="' . $root . JRoute::_('index.php?option=' . JEV_COM_COMPONENT . '&task=icalrepeat.detail&rp_id=' . $evid . '&rp_id=' . $rp_id . '&Itemid=' . $Itemid . "&year={$year}&month={$month}&day={$day}") . '">' . $event->title() . '</a>' . "\n";
}
$content = sprintf(JText::_('JEV_NOTIFY_AUTHOR_Message'), $detaillink, $sitename);
$authorname = "";
$authoremail = "";
if ($event->created_by() > 0) {
$author = JFactory::getUser($event->created_by());
if (!$author) {
return;
}
$authorname = $author->name;
$authoremail = $author->email;
} else {
if (isset($event->authoremail) && $event->authoremail != "") {
$authorname = $event->authorname;
$authoremail = $event->authoremail;
}
}
if ($authoremail == "") {
return;
}
// mail function
$mail =& JFactory::getMailer();
$mail->setSender(array(0 => $adminEmail, 1 => $adminName));
$mail->addRecipient($authoremail);
$mail->setSubject($subject);
$mail->setBody($content);
$mail->IsHTML(true);
$mail->send();
}
示例15: delete
function delete()
{
// clean out the cache
$cache =& JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
/*
// This is covered by canDeleteEvent below
if (!JEVHelper::isEventDeletor()){
JError::raiseError( 403, JText::_( 'ALERTNOTAUTH' ) );
}
*/
$cid = JRequest::getVar('cid', array(0));
JArrayHelper::toInteger($cid);
// front end passes the id as evid
if (count($cid) == 1 && $cid[0] == 0) {
$cid = array(JRequest::getInt("evid", 0));
}
$db =& JFactory::getDBO();
foreach ($cid as $key => $id) {
// I should be able to do this in one operation but that can come later
$event = $this->queryModel->getEventById(intval($id), 1, "icaldb");
if (is_null($event) || !JEVHelper::canDeleteEvent($event)) {
JError::raiseWarning(534, JText::_("JEV_NO_DELETE_ROW"));
unset($cid[$key]);
}
}
if (count($cid) > 0) {
$veventidstring = implode(",", $cid);
// TODO the ruccurences should take care of all of these??
// This would fail if all recurrances have been 'adjusted'
$query = "SELECT DISTINCT (eventdetail_id) FROM #__jevents_repetition WHERE eventid IN ({$veventidstring})";
$db->setQuery($query);
$detailids = $db->loadResultArray();
$detailidstring = implode(",", $detailids);
$query = "DELETE FROM #__jevents_rrule WHERE eventid IN ({$veventidstring})";
$db->setQuery($query);
$db->query();
$query = "DELETE FROM #__jevents_repetition WHERE eventid IN ({$veventidstring})";
$db->setQuery($query);
$db->query();
$query = "DELETE FROM #__jevents_exception WHERE eventid IN ({$veventidstring})";
$db->setQuery($query);
$db->query();
if (strlen($detailidstring) > 0) {
$query = "DELETE FROM #__jevents_vevdetail WHERE evdet_id IN ({$detailidstring})";
$db->setQuery($query);
$db->query();
// I also need to clean out associated custom data
$dispatcher =& JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onDeleteEventDetails', array($detailidstring));
}
$query = "DELETE FROM #__jevents_vevent WHERE ev_id IN ({$veventidstring})";
$db->setQuery($query);
$db->query();
// I also need to delete custom data
$dispatcher =& JDispatcher::getInstance();
// just incase we don't have jevents plugins registered yet
JPluginHelper::importPlugin("jevents");
$res = $dispatcher->trigger('onDeleteCustomEvent', array(&$veventidstring));
}
if (JFactory::getApplication()->isAdmin()) {
$this->setRedirect("index.php?option=" . JEV_COM_COMPONENT . "&task=icalevent.list", "ICal Event(s) deleted");
} else {
$Itemid = JRequest::getInt("Itemid");
list($year, $month, $day) = JEVHelper::getYMD();
$rettask = JRequest::getString("rettask", "day.listevents");
$this->setRedirect(JRoute::_('index.php?option=' . JEV_COM_COMPONENT . "&task={$rettask}&year={$year}&month={$month}&day={$day}&Itemid={$Itemid}", false), "IcalEvent Deleted");
}
}