本文整理汇总了PHP中JEVHelper::canEditEvent方法的典型用法代码示例。如果您正苦于以下问题:PHP JEVHelper::canEditEvent方法的具体用法?PHP JEVHelper::canEditEvent怎么用?PHP JEVHelper::canEditEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JEVHelper
的用法示例。
在下文中一共展示了JEVHelper::canEditEvent方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: canUserEdit
function canUserEdit()
{
$is_event_creator = JEVHelper::isEventCreator();
$user = JFactory::getUser();
// are we authorised to do anything with this category or calendar
$jevuser = JEVHelper::getAuthorisedUser();
if ($this->_icsid > 0 && $jevuser && $jevuser->calendars != "" && $jevuser->calendars != "all") {
$allowedcals = explode("|", $jevuser->calendars);
if (!in_array($this->_icsid, $allowedcals)) {
return false;
}
}
if ($this->_catid > 0 && $jevuser && $jevuser->categories != "" && $jevuser->categories != "all") {
$allowedcats = explode("|", $jevuser->categories);
if (!in_array($this->_catid, $allowedcats)) {
return false;
}
}
// if can create events and this was created by this user then can edit (not valid for anon users)
if ($is_event_creator && $this->isEditable() && $this->created_by() == $user->id && $user->id > 0) {
return true;
}
// if "event publisher" or "event editor" can always edit event
if (JEVHelper::canEditEvent($this)) {
return true;
}
if (JEVHelper::canPublishEvent($this)) {
return true;
}
return false;
}
示例2: doSave
private function doSave(&$msg)
{
if (!JEVHelper::isEventCreator()) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
// clean out the cache
$cache = JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
$option = JEV_COM_COMPONENT;
$rp_id = intval(JRequest::getVar("rp_id", "0"));
$cid = JRequest::getVar("cid", array());
if (count($cid) > 0 && $rp_id == 0) {
$rp_id = intval($cid[0]);
}
if ($rp_id == 0) {
$this->setRedirect('index.php?option=' . $option . '&task=icalrepeat.list&cid[]=' . $rp_id, "1Cal rpt NOT SAVED");
$this->redirect();
}
// I should be able to do this in one operation but that can come later
$event = $this->queryModel->listEventsById(intval($rp_id), 1, "icaldb");
if (!JEVHelper::canEditEvent($event)) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
$db = JFactory::getDBO();
$rpt = new iCalRepetition($db);
$rpt->load($rp_id);
$query = "SELECT detail_id FROM #__jevents_vevent WHERE ev_id={$rpt->eventid}";
$db->setQuery($query);
$eventdetailid = $db->loadResult();
$data["UID"] = JRequest::getVar("uid", md5(uniqid(rand(), true)));
$data["X-EXTRAINFO"] = JRequest::getVar("extra_info", "");
$data["LOCATION"] = JRequest::getVar("location", "");
$data["allDayEvent"] = JRequest::getVar("allDayEvent", "off");
$data["CONTACT"] = JRequest::getVar("contact_info", "");
// allow raw HTML (mask =2)
$data["DESCRIPTION"] = JRequest::getVar("jevcontent", "", 'request', 'html', 2);
$data["publish_down"] = JRequest::getVar("publish_down", "2006-12-12");
$data["publish_up"] = JRequest::getVar("publish_up", "2006-12-12");
// Alternative date format handling
if (JRequest::getVar("publish_up2", false)) {
$data["publish_up"] = JRequest::getVar("publish_up2", $data["publish_up"]);
}
if (JRequest::getVar("publish_down2", false)) {
$data["publish_down"] = JRequest::getVar("publish_down2", $data["publish_down"]);
}
$interval = JRequest::getVar("rinterval", 1);
$data["SUMMARY"] = JRequest::getVar("title", "");
$data["MULTIDAY"] = JRequest::getInt("multiday", "1");
$data["NOENDTIME"] = JRequest::getInt("noendtime", 0);
$ics_id = JRequest::getVar("ics_id", 0);
if ($data["allDayEvent"] == "on") {
$start_time = "00:00";
} else {
$start_time = JRequest::getVar("start_time", "08:00");
}
$publishstart = $data["publish_up"] . ' ' . $start_time . ':00';
$data["DTSTART"] = JevDate::strtotime($publishstart);
if ($data["allDayEvent"] == "on") {
$end_time = "23:59";
$publishend = $data["publish_down"] . ' ' . $end_time . ':59';
} else {
$end_time = JRequest::getVar("end_time", "15:00");
$publishend = $data["publish_down"] . ' ' . $end_time . ':00';
}
$data["DTEND"] = JevDate::strtotime($publishend);
// iCal for whole day uses 00:00:00 on the next day JEvents uses 23:59:59 on the same day
list($h, $m, $s) = explode(":", $end_time . ':00');
if ($h + $m + $s == 0 && $data["allDayEvent"] == "on" && $data["DTEND"] > $data["DTSTART"]) {
$publishend = JevDate::strftime('%Y-%m-%d 23:59:59', $data["DTEND"] - 86400);
$data["DTEND"] = JevDate::strtotime($publishend);
}
$data["X-COLOR"] = JRequest::getVar("color", "");
// Add any custom fields into $data array - allowing HTML (which can be cleaned up later by plugins)
$array = JRequest::get("post", 2);
foreach ($array as $key => $value) {
if (strpos($key, "custom_") === 0) {
$data[$key] = $value;
}
// convert jform data to data format used before
if (strpos($key, "jform") === 0 && is_array($value)) {
foreach ($value as $cfkey => $cfvalue) {
$data["custom_" . $cfkey] = $cfvalue;
}
}
}
$detail = iCalEventDetail::iCalEventDetailFromData($data);
// if we already havea unique event detail then edit this one!
if ($eventdetailid != $rpt->eventdetail_id) {
$detail->evdet_id = $rpt->eventdetail_id;
}
$detail->priority = intval(JArrayHelper::getValue($array, "priority", 0));
$detail->store();
// KEEP THE ORIGINAL START REPEAT FOR THE EXCEPTION HANDLING
$original_start = $rpt->startrepeat;
// populate rpt with data
//$start = JevDate::strtotime($data["publish_up"] . ' ' . $start_time . ':00');
//$end = JevDate::strtotime($data["publish_down"] . ' ' . $end_time . ':00');
$start = $data["DTSTART"];
//.........这里部分代码省略.........
示例3: simulateSaveRepeat
function simulateSaveRepeat($requestObject)
{
include_once JPATH_SITE . "/components/com_jevents/jevents.defines.php";
if (!JEVHelper::isEventCreator()) {
throwerror(JText::_('ALERTNOTAUTH'));
}
// Convert formdata to array
$formdata = array();
foreach (get_object_vars($requestObject->formdata) as $k => $v) {
$k = str_replace("[]", "", $k);
$formdata[$k] = $v;
}
$array = JRequest::_cleanVar($formdata, JREQUEST_ALLOWHTML);
if (!array_key_exists("rp_id", $array) || intval($array["rp_id"]) <= 0) {
throwerror(JText::_("Not a repeat", true));
}
$rp_id = intval($array["rp_id"]);
$dataModel = new JEventsDataModel("JEventsAdminDBModel");
$queryModel = new JEventsDBModel($dataModel);
// I should be able to do this in one operation but that can come later
$event = $queryModel->listEventsById(intval($rp_id), 1, "icaldb");
if (!JEVHelper::canEditEvent($event)) {
throwerror(JText::_('ALERTNOTAUTH'));
}
$db =& JFactory::getDBO();
$rpt = new iCalRepetition($db);
$rpt->load($rp_id);
$query = "SELECT detail_id FROM #__jevents_vevent WHERE ev_id={$rpt->eventid}";
$db->setQuery($query);
$eventdetailid = $db->loadResult();
$data["UID"] = valueIfExists($array, "uid", md5(uniqid(rand(), true)));
$data["X-EXTRAINFO"] = valueIfExists($array, "extra_info", "");
$data["LOCATION"] = valueIfExists($array, "location", "");
$data["allDayEvent"] = valueIfExists($array, "allDayEvent", "off");
$data["CONTACT"] = valueIfExists($array, "contact_info", "");
// allow raw HTML (mask =2)
$data["DESCRIPTION"] = valueIfExists($array, "jevcontent", "", 'request', 'html', 2);
$data["publish_down"] = valueIfExists($array, "publish_down", "2006-12-12");
$data["publish_up"] = valueIfExists($array, "publish_up", "2006-12-12");
$interval = valueIfExists($array, "rinterval", 1);
$data["SUMMARY"] = valueIfExists($array, "title", "");
$data["MULTIDAY"] = intval(valueIfExists($array, "multiday", "1"));
$data["NOENDTIME"] = intval(valueIfExists($array, "noendtime", 0));
$ics_id = valueIfExists($array, "ics_id", 0);
if ($data["allDayEvent"] == "on") {
$start_time = "00:00";
} else {
$start_time = valueIfExists($array, "start_time", "08:00");
}
$publishstart = $data["publish_up"] . ' ' . $start_time . ':00';
$data["DTSTART"] = JevDate::strtotime($publishstart);
if ($data["allDayEvent"] == "on") {
$end_time = "23:59";
$publishend = $data["publish_down"] . ' ' . $end_time . ':59';
} else {
$end_time = valueIfExists($array, "end_time", "15:00");
$publishend = $data["publish_down"] . ' ' . $end_time . ':00';
}
$data["DTEND"] = JevDate::strtotime($publishend);
// iCal for whole day uses 00:00:00 on the next day JEvents uses 23:59:59 on the same day
list($h, $m, $s) = explode(":", $end_time . ':00');
if ($h + $m + $s == 0 && $data["allDayEvent"] == "on" && $data["DTEND"] > $data["DTSTART"]) {
$publishend = JevDate::strftime('%Y-%m-%d 23:59:59', $data["DTEND"] - 86400);
$data["DTEND"] = JevDate::strtotime($publishend);
}
$data["X-COLOR"] = valueIfExists($array, "color", "");
// Add any custom fields into $data array
foreach ($array as $key => $value) {
if (strpos($key, "custom_") === 0) {
$data[$key] = $value;
}
}
// populate rpt with data
$start = $data["DTSTART"];
$end = $data["DTEND"];
$rpt->startrepeat = JevDate::strftime('%Y-%m-%d %H:%M:%S', $start);
$rpt->endrepeat = JevDate::strftime('%Y-%m-%d %H:%M:%S', $end);
$rpt->duplicatecheck = md5($rpt->eventid . $start);
$rpt->rp_id = $rp_id;
$rpt->event = $event;
return $rpt;
}
示例4: doSave
private function doSave(&$msg)
{
if (!JEVHelper::isEventCreator()) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
// clean out the cache
$cache =& JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
// JREQUEST_ALLOWHTML requires at least Joomla 1.5 svn9979 (past 1.5 stable)
$array = JRequest::get('request', JREQUEST_ALLOWHTML);
// Should we allow raw content through unfiltered
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("allowraw", 0)) {
$array['jevcontent'] = JRequest::getString("jevcontent", "", "POST", JREQUEST_ALLOWRAW);
}
if (!JEVHelper::canCreateEvent($array)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
$rrule = SaveIcalEvent::generateRRule($array);
// ensure authorised
if (isset($array["evid"]) && $array["evid"] > 0) {
$event = $this->queryModel->getEventById(intval($array["evid"]), 1, "icaldb");
if (!$event || !JEVHelper::canEditEvent($event)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
}
$clearout = false;
// remove all exceptions since they are no longer needed
if (isset($array["evid"]) && $array["evid"] > 0) {
$clearout = true;
}
if ($event = SaveIcalEvent::save($array, $this->queryModel, $rrule)) {
$row = new jIcalEventDB($event);
if (JEVHelper::canPublishEvent($row)) {
$msg = JText::_("Event_Saved", true);
} else {
$msg = JText::_("EVENT_SAVED_UNDER_REVIEW", true);
}
if ($clearout) {
$db = JFactory::getDBO();
$query = "DELETE FROM #__jevents_exception WHERE eventid = " . $array["evid"];
$db->setQuery($query);
$db->query();
// TODO clear out old exception details
}
} else {
$msg = JText::_("Event Not Saved", true);
}
return $row;
}
示例5: save
//.........这里部分代码省略.........
if (!JVersion::isCompatible("1.6.0")) {
$vevent->access = $vevent->access > $user->aid ? $user->aid : $vevent->access;
}
$vevent->state = intval(JArrayHelper::getValue($array, "state", 0));
// Shouldn't really do this like this
$vevent->_detail->priority = intval(JArrayHelper::getValue($array, "priority", 0));
// FRONT END AUTO PUBLISHING CODE
$frontendPublish = JEVHelper::isEventPublisher();
if (!$frontendPublish) {
$frontendPublish = JEVHelper::canPublishOwnEvents($ev_id);
}
// Always unpublish if no Publisher otherwise publish automatically (for new events)
// Should we always notify of new events
$notifyAdmin = $cfg->get("com_notifyallevents", 0);
if (!JFactory::getApplication()->isAdmin()) {
if ($frontendPublish && $ev_id == 0) {
$vevent->state = 1;
} else {
if (!$frontendPublish) {
$vevent->state = 0;
// In this case we send a notification email to admin
$notifyAdmin = true;
}
}
}
$vevent->icsid = $ics_id;
if ($ev_id > 0) {
$vevent->ev_id = $ev_id;
}
$rp_id = intval(JArrayHelper::getValue($array, "rp_id", 0));
if ($rp_id > 0) {
// I should be able to do this in one operation but that can come later
$testevent = $queryModel->listEventsById(intval($rp_id), 1, "icaldb");
if (!JEVHelper::canEditEvent($testevent)) {
JError::raiseError(403, JText::_('ALERTNOTAUTH'));
}
}
$db =& JFactory::getDBO();
$success = true;
//echo "class = ".get_class($vevent);
if (!$dryrun) {
if (!$vevent->store()) {
echo $db->getErrorMsg() . "<br/>";
$success = false;
JError::raiseWarning(101, JText::_('COULD_NOT_SAVE_EVENT_'));
}
} else {
// need a value for eventid to pretend we have saved the event so we can get the repetitions
if (!isset($vevent->ev_id)) {
$vevent->ev_id = 0;
}
$vevent->rrule->eventid = $vevent->ev_id;
}
// Only update the repetitions if the event edit says the reptitions will have changed or a new event
if ($newevent || JRequest::getInt("updaterepeats", 1)) {
$repetitions = $vevent->getRepetitions(true);
if (!$dryrun) {
if (!$vevent->storeRepetitions()) {
echo $db->getErrorMsg() . "<br/>";
$success = false;
JError::raiseWarning(101, JText::_('COULD_NOT_SAVE_REPETITIONS'));
}
}
}
$res = $dispatcher->trigger('onAfterSaveEvent', array(&$vevent, $dryrun));
if ($dryrun) {
示例6: DefaultEventManagementDialog
/**
* Creates mini event dialog for view detail page etc.
* note this must be contained in a position:relative block element in order to work
*
* @param Jevent or descendent $row
*/
function DefaultEventManagementDialog($view, $row, $mask, $bootstrap = false)
{
JevHtmlBootstrap::modal("action_dialogJQ" . $row->rp_id());
$user = JFactory::getUser();
if ($user->get("id") == 0) {
return "";
}
if (JEVHelper::canEditEvent($row) || JEVHelper::canPublishEvent($row) || JEVHelper::canDeleteEvent($row)) {
$popup = false;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("editpopup", 0) && JEVHelper::isEventCreator()) {
JevHtmlBootstrap::modal();
JEVHelper::script('editpopupJQ.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
$popup = true;
$popupw = $params->get("popupw", 800);
$popuph = $params->get("popuph", 600);
}
if (JRequest::getInt("pop", 0)) {
// do not call the modal scripts if already in a popup window!
$popup = false;
}
$hasrepeat = false;
$pathIMG = JURI::root() . 'components/' . JEV_COM_COMPONENT . '/assets/images';
$editImg = JHtml::image('com_jevents/icons-32/edit.png', JText::_("EDIT_EVENT"), null, true);
$editLink = $row->editLink();
$editLink = $popup ? "javascript:jevEditPopupNoHeader('" . $editLink . "');" : $editLink;
$editCopyImg = JHtml::image('com_jevents/icons-32/copy.png', JText::_("COPY_AND_EDIT_EVENT"), null, true);
$editCopyLink = $row->editCopyLink();
$editCopyLink = $popup ? "javascript:jevEditPopupNoHeader('" . $editCopyLink . "');" : $editCopyLink;
$deleteImg = JHtml::image('com_jevents/icons-32/discard.png', JText::_("DELETE_EVENT"), null, true);
$deleteLink = $row->deleteLink();
if ($row->until() != $row->dtstart() || $row->count() > 1) {
$hasrepeat = true;
$editRepeatImg = JHtml::image('com_jevents/icons-32/edit.png', JText::_("EDIT_REPEAT"), null, true);
$editRepeatLink = $row->editRepeatLink();
$editRepeatLink = $popup ? "javascript:jevEditPopupNoHeader('" . $editRepeatLink . "');" : $editRepeatLink;
$deleteRepeatImg = JHtml::image('com_jevents/icons-32/discard.png', JText::_("DELETE_THIS_REPEAT"), null, true);
$deleteRepeatLink = $row->deleteRepeatLink();
$deleteFutureImg = JHtml::image('com_jevents/icons-32/discards.png', JText::_("JEV_DELETE_FUTURE_REPEATS"), null, true);
$deleteFutureLink = $row->deleteFutureLink();
$deleteImg = JHtml::image('com_jevents/icons-32/discards.png', JText::_("DELETE_ALL_REPEATS"), null, true);
} else {
$editRepeatLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
if (!JEVHelper::canEditEvent($row)) {
$editLink = "";
$editRepeatLink = "";
$editCopyLink = "";
}
if (!JEVHelper::canDeleteEvent($row)) {
$deleteLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
$publishLink = "";
if (JEVHelper::canPublishEvent($row)) {
if ($row->published() > 0) {
$publishImg = JHtml::image('com_jevents/icons-32/cancel.png', JText::_("UNPUBLISH_EVENT"), null, true);
$publishLink = $row->unpublishLink();
$publishText = JText::_('UNPUBLISH_EVENT');
} else {
$publishImg = JHtml::image('com_jevents/icons-32/accept.png', JText::_("PUBLISH_EVENT"), null, true);
$publishLink = $row->publishLink();
$publishText = JText::_('PUBLISH_EVENT');
}
}
if ($publishLink . $editRepeatLink . $editLink . $deleteRepeatLink . $deleteLink . $deleteFutureLink == "") {
return false;
}
?>
<div id="action_dialogJQ<?php
echo $row->rp_id();
?>
" class="action_dialogJQ modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title" id="myModalLabel"><?php
echo JText::_("JEV_MANAGE_EVENT");
?>
</h4>
</div>
<div class="modal-body">
<?php
if ($publishLink != "") {
?>
<a href="<?php
echo $publishLink;
?>
" id="publish_reccur" title="<?php
echo $publishText;
//.........这里部分代码省略.........
示例7: edit
function edit($tpl = null)
{
$document = JFactory::getDocument();
include JEV_ADMINLIBS . "/editStrings.php";
$document->addScriptDeclaration($editStrings);
JEVHelper::script('editicalJQ.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
JEVHelper::script('JevStdRequiredFieldsJQ.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
if ($this->row->title() <= "") {
// Set toolbar items for the page
JToolBarHelper::title(JText::_('CREATE_ICAL_EVENT'), 'jevents');
$document->setTitle(JText::_('CREATE_ICAL_EVENT'));
} else {
// Set toolbar items for the page
JToolBarHelper::title(JText::_('EDIT_ICAL_EVENT'), 'jevents');
$document->setTitle(JText::_('EDIT_ICAL_EVENT'));
}
$bar = JToolBar::getInstance('toolbar');
if ($this->id > 0) {
if ($this->editCopy) {
if (JEVHelper::isEventEditor() || JEVHelper::canEditEvent($this->row)) {
$this->toolbarConfirmButton("icalevent.apply", JText::_("JEV_SAVE_COPY_WARNING"), 'apply', 'apply', 'JEV_SAVE', false);
}
//$this->toolbarConfirmButton("icalevent.savenew", JText::_("JEV_SAVE_COPY_WARNING"), 'save', 'save', 'JEV_SAVE_NEW', false);
$this->toolbarConfirmButton("icalevent.save", JText::_("JEV_SAVE_COPY_WARNING"), 'save', 'save', 'JEV_SAVE_CLOSE', false);
} else {
if (JEVHelper::isEventEditor() || JEVHelper::canEditEvent($this->row)) {
$this->toolbarConfirmButton("icalevent.apply", JText::_("JEV_SAVE_ICALEVENT_WARNING"), 'apply', 'apply', 'JEV_SAVE', false);
}
//$this->toolbarConfirmButton("icalevent.savenew", JText::_("JEV_SAVE_ICALEVENT_WARNING"), 'save', 'save', 'JEV_SAVE_NEW', false);
$this->toolbarConfirmButton("icalevent.save", JText::_("JEV_SAVE_ICALEVENT_WARNING"), 'save', 'save', 'JEV_SAVE_CLOSE', false);
}
} else {
$canEditOwn = false;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if (!$params->get("authorisedonly", 0)) {
$juser = JFactory::getUser();
$canEditOwn = $juser->authorise('core.edit.own', 'com_jevents');
}
if (JEVHelper::isEventEditor() || $canEditOwn) {
$this->toolbarButton("icalevent.apply", 'apply', 'apply', 'JEV_SAVE', false);
}
//JToolBarHelper::save('icalevent.savenew', "JEV_Save_New");
$this->toolbarButton("icalevent.save", 'save', 'save', 'JEV_SAVE_CLOSE', false);
}
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$evedrd = $params->get("editreturnto", "day.listevents");
if ($params->get("editpopup", 0)) {
$document->addStyleDeclaration("div#toolbar-box{margin:10px 10px 0px 10px;} div#jevents {margin:0px 10px 10px 10px;} ");
$this->toolbarButton("icalevent.close", 'cancel', 'cancel', 'Cancel', false);
JRequest::setVar('tmpl', 'component');
//force the component template
} else {
if ($this->id > 0) {
$this->toolbarButton("icalrepeat.detail", 'cancel', 'cancel', 'Cancel', false);
} else {
$this->toolbarButton($evedrd, 'cancel', 'cancel', 'Cancel', false);
}
}
// I pass in the rp_id so that I can return to the repeat I was viewing before editing
$this->assign("rp_id", JRequest::getInt("rp_id", 0));
$this->_adminStart();
// load Joomla javascript classes
JHTML::_('behavior.core');
$this->setLayout("edit");
JEVHelper::componentStylesheet($this, "editextra.css");
jimport('joomla.filesystem.file');
// Lets check if we have editted before! if not... rename the custom file.
if (JFile::exists(JPATH_SITE . "/components/com_jevents/assets/css/jevcustom.css")) {
// It is definitely now created, lets load it!
JEVHelper::stylesheet('jevcustom.css', 'components/' . JEV_COM_COMPONENT . '/assets/css/');
}
$this->setupEditForm();
parent::displaytemplate($tpl);
$this->_adminEnd();
}
示例8: getEventData
function getEventData($rpid, $jevtype, $year, $month, $day, $uid = "")
{
$data = array();
$pop = intval(JRequest::getVar('pop', 0));
$Itemid = JEVHelper::getItemid();
$db = JFactory::getDBO();
$user = JFactory::getUser();
$cfg = JEVConfig::getInstance();
$row = $this->queryModel->listEventsById($rpid, 1, $jevtype);
// include unpublished events for publishers and above
// if the event is not published then make sure the user can edit or publish it or created it before allowing it to be seen!
if ($row && $row->published() != 1) {
if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) {
$row = null;
}
}
$num_row = count($row);
// No matching rows - use uid as alternative
if ($num_row == 0 && JString::strlen($uid) > 0) {
$rpid = $this->queryModel->findMatchingRepeat($uid, $year, $month, $day);
if (isset($rpid) && $rpid > 0) {
$row = $this->queryModel->listEventsById($rpid, 1, $jevtype);
// include unpublished events for publishers and above
if ($row && !$row->published()) {
if ($user->id != $row->created_by() && !JEVHelper::canEditEvent($row) && !JEVHelper::canPublishEvent($row) && !JEVHelper::isAdminUser($user)) {
$row = null;
}
}
$num_row = count($row);
}
}
if ($num_row) {
// process the new plugins
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onGetEventData', array(&$row));
$params = new JRegistry(null);
$row->contactlink = JEventsHTML::getUserMailtoLink($row->id(), $row->created_by(), false, $row);
$event_up = new JEventDate($row->publish_up());
$row->start_date = JEventsHTML::getDateFormat($event_up->year, $event_up->month, $event_up->day, 0);
$row->start_time = JEVHelper::getTime($row->getUnixStartTime());
$event_down = new JEventDate($row->publish_down());
$row->stop_date = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day, 0);
$row->stop_time = JEVHelper::getTime($row->getUnixEndTime());
$row->stop_time_midnightFix = $row->stop_time;
$row->stop_date_midnightFix = $row->stop_date;
if ($event_down->second == 59) {
$row->stop_time_midnightFix = JEVHelper::getTime($row->getUnixEndTime() + 1);
$row->stop_date_midnightFix = JEventsHTML::getDateFormat($event_down->year, $event_down->month, $event_down->day + 1, 0);
}
// *******************
// ** This cloaking should be done by mambot/Joomla function
// *******************
// Parse http and wrap in <a> tag
// trigger content plugin
JPluginHelper::importPlugin('content');
$pattern = '[a-zA-Z0-9&?_.,=%\\-\\/]';
// Addresse
if (!is_numeric($row->location())) {
// don't convert address that already has a link tag
if (strpos($row->location(), '<a href=') === false) {
$row->location(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->location()));
}
$tmprow = new stdClass();
$tmprow->text = $row->location();
$dispatcher = JEventDispatcher::getInstance();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->location($tmprow->text);
}
//Contact
if (strpos($row->contact_info(), '<a href=') === false) {
$row->contact_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->contact_info()));
}
$tmprow = new stdClass();
$tmprow->text = $row->contact_info();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->contact_info($tmprow->text);
//Extra
if (strpos($row->extra_info(), '<a href=') === false) {
$row->extra_info(preg_replace('#(http://)(' . $pattern . '*)#i', '<a href="\\1\\2">\\1\\2</a>', $row->extra_info()));
}
//$row->extra_info(eregi_replace('[^(href=|href="|href=\')](((f|ht){1}tp://)[-a-zA-Z0-9@:%_\+.~#?&//=]+)','\\1', $row->extra_info()));
$tmprow = new stdClass();
$tmprow->text = $row->extra_info();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$tmprow, &$params, 0));
$row->extra_info($tmprow->text);
$mask = JFactory::getApplication()->getCfg('hideAuthor') ? MASK_HIDEAUTHOR : 0;
$mask |= JFactory::getApplication()->getCfg('hideCreateDate') ? MASK_HIDECREATEDATE : 0;
$mask |= JFactory::getApplication()->getCfg('hideModifyDate') ? MASK_HIDEMODIFYDATE : 0;
$mask |= JFactory::getApplication()->getCfg('hidePdf') ? MASK_HIDEPDF : 0;
$mask |= JFactory::getApplication()->getCfg('hidePrint') ? MASK_HIDEPRINT : 0;
$mask |= JFactory::getApplication()->getCfg('hideEmail') ? MASK_HIDEEMAIL : 0;
//$mask |= JFactory::getApplication()->getCfg( 'vote' ) ? MASK_VOTES : 0;
$mask |= JFactory::getApplication()->getCfg('vote') ? MASK_VOTES | MASK_VOTEFORM : 0;
$mask |= $pop ? MASK_POPUP | MASK_IMAGES | MASK_BACKTOLIST : 0;
// Do main mambot processing here
// process bots
//$row->text = $row->content;
$params->set("image", 1);
$row->text = $row->content();
$dispatcher->trigger('onContentPrepare', array('com_jevents', &$row, &$params, 0));
//.........这里部分代码省略.........
示例9: DefaultViewEventRowAdmin
function DefaultViewEventRowAdmin($view, $row, $manage = false)
{
$popup = false;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("editpopup", 0)) {
JHTML::_('behavior.modal');
JEVHelper::script('editpopup.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
$popup = true;
$popupw = $params->get("popupw", 800);
$popuph = $params->get("popuph", 600);
}
$editLink = $row->editLink(true);
$editLink = $popup ? "javascript:jevEditPopup('" . $editLink . "',{$popupw}, {$popuph});" : $editLink;
$modifylink = "";
if (!$manage && JEVHelper::canEditEvent($row)) {
$modifylink = '<a href="' . $row->editlink(true) . '" title="' . JText::_('JEV_MODIFY') . '"><b>' . JText::_('JEV_MODIFY') . "</b></a>\n";
$modifylink = '<a href="' . $editLink . '" title="' . JText::_('JEV_MODIFY') . '"><b>' . JText::_('JEV_MODIFY') . "</b></a>\n";
}
$deletelink = "";
if (!$manage && JEVHelper::canDeleteEvent($row)) {
$deletelink = '<a href="' . $row->deletelink(false) . "&rettask=admin.listevents" . '" title="' . JText::_('JEV_DELETE') . '"><b>' . JText::_('JEV_DELETE') . "</b></a>\n";
}
if (!$manage && JEVHelper::canPublishEvent($row)) {
if ($row->published()) {
$publishlink = '<a href="' . $row->unpublishlink(false) . "&rettask=admin.listevents" . '" title="' . JText::_('UNPUBLISH') . '"><b>' . JText::_('UNPUBLISH') . "</b></a>\n";
} else {
$publishlink = '<a href="' . $row->publishlink(false) . "&rettask=admin.listevents" . '" title="' . JText::_('PUBLISH') . '"><b>' . JText::_('PUBLISH') . "</b></a>\n";
}
} else {
$publishlink = "";
}
$eventlink = $row->viewDetailLink($row->yup(), $row->mup(), $row->dup(), false);
$eventlink = JRoute::_($eventlink . $view->datamodel->getCatidsOutLink());
$border = "border-color:" . $row->bgcolor() . ";";
?>
<li class="ev_td_li" style="<?php
echo $border;
?>
">
<a class="<?php
echo $row->state() ? 'ev_link_row' : 'ev_link_unpublished';
?>
" href="<?php
echo $eventlink;
?>
" title="<?php
echo JEventsHTML::special($row->title()) . ($row->state() ? '' : JText::_('JEV_UNPUBLISHED'));
?>
"><?php
echo $row->title() . ($row->state() ? '' : JText::_('JEV_UNPUBLISHED'));
?>
</a>
<?php
echo JText::_('JEV_BY');
?>
<i><?php
echo $row->contactlink('', true);
?>
</i>
<?php
echo $deletelink;
?>
<?php
echo $modifylink;
?>
<?php
echo $publishlink;
?>
</li>
<?php
}
示例10: DefaultEventManagementDialog16
function DefaultEventManagementDialog16($view, $row, $mask, $bootstrap = false)
{
$user = JFactory::getUser();
if ($user->get("id") == 0) {
return "";
}
if ((JEVHelper::canEditEvent($row) || JEVHelper::canPublishEvent($row) || JEVHelper::canDeleteEvent($row)) && !($mask & MASK_POPUP)) {
$popup = false;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("editpopup", 0) && JEVHelper::isEventCreator()) {
JEVHelper::script('editpopup.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
$popup = true;
$popupw = $params->get("popupw", 800);
$popuph = $params->get("popuph", 600);
}
$hasrepeat = false;
$pathIMG = JURI::root() . 'components/' . JEV_COM_COMPONENT . '/assets/images';
$editImg = $pathIMG . "/edit_f2.png";
$editLink = $row->editLink();
$editLink = $popup ? "javascript:jevEditPopup('" . $editLink . "',{$popupw}, {$popuph});" : $editLink;
$editCopyImg = $pathIMG . "/copy_f2.png";
$editCopyLink = $row->editCopyLink();
$editCopyLink = $popup ? "javascript:jevEditPopup('" . $editCopyLink . "',{$popupw}, {$popuph});" : $editCopyLink;
$deleteImg = $pathIMG . "/delete_f2.png";
$deleteLink = $row->deleteLink();
if ($row->until() != $row->dtstart() || $row->count() > 1) {
$hasrepeat = true;
$editRepeatImg = $pathIMG . "/edit_f2.png";
$editRepeatLink = $row->editRepeatLink();
$editRepeatLink = $popup ? "javascript:jevEditPopup('" . $editRepeatLink . "',{$popupw}, {$popuph});" : $editRepeatLink;
$deleteRepeatImg = $pathIMG . "/delete_f2.png";
$deleteRepeatLink = $row->deleteRepeatLink();
$deleteFutureImg = $pathIMG . "/delete_f2.png";
$deleteFutureLink = $row->deleteFutureLink();
} else {
$editRepeatLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
if (!JEVHelper::canEditEvent($row)) {
$editLink = "";
$editRepeatLink = "";
$editCopyLink = "";
}
if (!JEVHelper::canDeleteEvent($row)) {
$deleteLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
$publishLink = "";
if (JEVHelper::canPublishEvent($row)) {
if ($row->published() > 0) {
$publishImg = $pathIMG . "/publish_r.png";
$publishLink = $row->unpublishLink();
$publishText = JText::_('UNPUBLISH_EVENT');
} else {
$publishImg = $pathIMG . "/publish_g.png";
$publishLink = $row->publishLink();
$publishText = JText::_('PUBLISH_EVENT');
}
}
if ($publishLink . $editRepeatLink . $editLink . $deleteRepeatLink . $deleteLink . $deleteFutureLink == "") {
return false;
}
?>
<div id="action_dialog" >
<div class="close_dialog" >
<a href="javascript:void(0)" onclick="closedialog()" >x</a>
</div>
<?php
if ($publishLink != "") {
?>
<a href="<?php
echo $publishLink;
?>
" id="publish_reccur" title="<?php
echo $publishText;
?>
" ><img src="<?php
echo $publishImg;
?>
" alt="" /><?php
echo $publishText;
?>
</a><br/>
<?php
}
?>
<?php
if ($editRepeatLink != "") {
?>
<a href="<?php
echo $editRepeatLink;
?>
" id="edit_reccur" title="edit event" ><img src="<?php
echo $editRepeatImg;
?>
" alt="" /><?php
echo JText::_('EDIT_REPEAT');
?>
//.........这里部分代码省略.........
示例11: DefaultLoadedFromTemplate
//.........这里部分代码省略.........
" name="image" alt="<?php
echo JText::_('JEV_SAVEICAL');
?>
" class="jev_ev_sml nothumb"/>
</a>
<div class="jevdialogs">
<?php
$search[] = "{{ICALDIALOG}}";
if ($view) {
ob_start();
$view->eventIcalDialog($event, $mask);
$dialog = ob_get_clean();
$replace[] = $dialog;
} else {
$replace[] = "";
}
$blank[] = "";
echo $dialog;
?>
</div>
<?php
$search[] = "{{ICALBUTTON}}";
$replace[] = ob_get_clean();
$blank[] = "";
} else {
$search[] = "{{ICALBUTTON}}";
$replace[] = "";
$blank[] = "";
$search[] = "{{ICALDIALOG}}";
$replace[] = "";
$blank[] = "";
}
if (JEVHelper::canEditEvent($event) || JEVHelper::canPublishEvent($event) || JEVHelper::canDeleteEvent($event)) {
JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/");
ob_start();
?>
<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}}";
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 {
示例12: DefaultEventManagementDialog
/**
* Creates mini event dialog for view detail page etc.
* note this must be contained in a position:relative block element in order to work
*
* @param Jevent or descendent $row
*/
function DefaultEventManagementDialog($view, $row, $mask)
{
if ((JEVHelper::canEditEvent($row) || JEVHelper::canPublishEvent($row) || JEVHelper::canDeleteEvent($row)) && !($mask & MASK_POPUP)) {
$popup = false;
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("editpopup", 0)) {
JHTML::_('behavior.modal');
JEVHelper::script('editpopup.js', 'components/' . JEV_COM_COMPONENT . '/assets/js/');
$popup = true;
$popupw = $params->get("popupw", 800);
$popuph = $params->get("popuph", 600);
}
$hasrepeat = false;
if (JVersion::isCompatible("1.6.0")) {
$pathIMG = JURI::root() . 'components/' . JEV_COM_COMPONENT . '/assets/images';
} else {
$pathIMG = JURI::root() . 'administrator/images';
}
$editImg = $pathIMG . "/edit_f2.png";
$editLink = $row->editLink();
$editLink = $popup ? "javascript:jevEditPopup('" . $editLink . "',{$popupw}, {$popuph});" : $editLink;
$editCopyImg = $pathIMG . "/copy_f2.png";
$editCopyLink = $row->editCopyLink();
$editCopyLink = $popup ? "javascript:jevEditPopup('" . $editCopyLink . "',{$popupw}, {$popuph});" : $editCopyLink;
$deleteImg = $pathIMG . "/delete_f2.png";
$deleteLink = $row->deleteLink();
if ($row->until() != $row->dtstart() || $row->count() > 1) {
$hasrepeat = true;
$editRepeatImg = $pathIMG . "/edit_f2.png";
$editRepeatLink = $row->editRepeatLink();
$editRepeatLink = $popup ? "javascript:jevEditPopup('" . $editRepeatLink . "',{$popupw}, {$popuph});" : $editRepeatLink;
$deleteRepeatImg = $pathIMG . "/delete_f2.png";
$deleteRepeatLink = $row->deleteRepeatLink();
$deleteFutureImg = $pathIMG . "/delete_f2.png";
$deleteFutureLink = $row->deleteFutureLink();
} else {
$editRepeatLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
if (!JEVHelper::canEditEvent($row)) {
$editLink = "";
$editRepeatLink = "";
$editCopyLink = "";
}
if (!JEVHelper::canDeleteEvent($row)) {
$deleteLink = "";
$deleteRepeatLink = "";
$deleteFutureLink = "";
}
$publishLink = "";
if (JEVHelper::canPublishEvent($row)) {
if ($row->published() > 0) {
$publishImg = $pathIMG . "/publish_r.png";
$publishLink = $row->unpublishLink();
$publishText = JText::_('UNPUBLISH_EVENT');
} else {
$publishImg = $pathIMG . "/publish_g.png";
$publishLink = $row->publishLink();
$publishText = JText::_('PUBLISH_EVENT');
}
}
if ($publishLink . $editRepeatLink . $editLink . $deleteRepeatLink . $deleteLink . $deleteFutureLink == "") {
return false;
}
?>
<div id="action_dialog" style="position:absolute;right:0px;background-color:#dedede;border:solid 1px #000000;width:200px;padding:10px;visibility:hidden;z-index:999;">
<div style="width:12px!important;position:absolute;right:0px;top:0px;background-color:#ffffff;;border:solid #000000;border-width:0 0 1px 1px;text-align:center;">
<a href="javascript:void(0)" onclick="closedialog()" style="font-weight:bold;text-decoration:none;color:#000000;">x</a>
</div>
<?php
if ($publishLink != "") {
?>
<a href="<?php
echo $publishLink;
?>
" id="publish_reccur" title="<?php
echo $publishText;
?>
" style="text-decoration:none;"><img src="<?php
echo $publishImg;
?>
" style="width:20px;height:20px;border:0px;margin-right:1em;vertical-align:middle;" alt="" /><?php
echo $publishText;
?>
</a><br/>
<?php
}
?>
<?php
if ($editRepeatLink != "") {
?>
<a href="<?php
echo $editRepeatLink;
//.........这里部分代码省略.........
示例13: DefaultLoadedFromTemplate
//.........这里部分代码省略.........
">
<img src="<?php
echo JURI::root() . 'administrator/components/' . JEV_COM_COMPONENT . '/assets/images/jevents_event_sml.png';
?>
" align="middle" name="image" alt="<?php
echo JText::_('JEV_SAVEICAL');
?>
" style="height:24px;"/>
</a>
<div class="jevdialogs">
<?php
$search[] = "{{ICALDIALOG}}";
ob_start();
$view->eventIcalDialog($event, $mask);
$dialog = ob_get_clean();
$replace[] = $dialog;
$blank[] = "";
echo $dialog;
?>
</div>
<?php
$search[] = "{{ICALBUTTON}}";
$replace[] = ob_get_clean();
$blank[] = "";
} else {
$search[] = "{{ICALBUTTON}}";
$replace[] = "";
$blank[] = "";
$search[] = "{{ICALDIALOG}}";
$replace[] = "";
$blank[] = "";
}
if ((JEVHelper::canEditEvent($event) || JEVHelper::canPublishEvent($event) || JEVHelper::canDeleteEvent($event)) && !($mask & MASK_POPUP)) {
JEVHelper::script('view_detail.js', 'components/' . JEV_COM_COMPONENT . "/assets/js/");
ob_start();
?>
<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}}";
示例14: doSave
private function doSave(&$msg)
{
if (!JEVHelper::isEventCreator()) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
// clean out the cache
$cache = JFactory::getCache('com_jevents');
$cache->clean(JEV_COM_COMPONENT);
// JREQUEST_ALLOWHTML requires at least Joomla 1.5 svn9979 (past 1.5 stable)
$array = JRequest::get('request', JREQUEST_ALLOWHTML);
// Should we allow raw content through unfiltered
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
if ($params->get("allowraw", 0)) {
$array['jevcontent'] = JRequest::getString("jevcontent", "", "POST", JREQUEST_ALLOWRAW);
$array['extra_info'] = JRequest::getString("extra_info", "", "POST", JREQUEST_ALLOWRAW);
}
// convert nl2br if there is no HTML
if (strip_tags($array['jevcontent']) == $array['jevcontent']) {
$array['jevcontent'] = nl2br($array['jevcontent']);
}
if (strip_tags($array['extra_info']) == $array['extra_info']) {
$array['extra_info'] = nl2br($array['extra_info']);
}
// convert event data to objewct so we can test permissions
$eventobj = new stdClass();
foreach ($array as $key => $val) {
$newkey = "_" . $key;
$eventobj->{$newkey} = $val;
}
$eventobj->_icsid = $eventobj->_ics_id;
if (is_array($eventobj->_catid)) {
$eventobj->_catid = current($eventobj->_catid);
}
if (!JEVHelper::canCreateEvent($eventobj)) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
$rrule = SaveIcalEvent::generateRRule($array);
// ensure authorised
if (isset($array["evid"]) && $array["evid"] > 0) {
$event = $this->queryModel->getEventById(intval($array["evid"]), 1, "icaldb");
if (!$event || !JEVHelper::canEditEvent($event)) {
throw new Exception(JText::_('ALERTNOTAUTH'), 403);
return false;
}
}
$clearout = false;
// remove all exceptions since they are no longer needed
if (isset($array["evid"]) && $array["evid"] > 0 && JRequest::getInt("updaterepeats", 1)) {
$clearout = true;
}
if ($event = SaveIcalEvent::save($array, $this->queryModel, $rrule)) {
$row = new jIcalEventRepeat($event);
if (JEVHelper::canPublishEvent($row)) {
$msg = JText::_("Event_Saved", true);
} else {
$msg = JText::_("EVENT_SAVED_UNDER_REVIEW", true);
}
if ($clearout) {
$db = JFactory::getDBO();
$query = "DELETE FROM #__jevents_exception WHERE eventid = " . $array["evid"];
$db->setQuery($query);
$db->query();
// TODO clear out old exception details
}
} else {
$msg = JText::_("Event Not Saved", true);
$row = null;
}
return $row;
}