public function postSuggestion() { $this->loadSuggestion(); if ($this->event->post()) { if (PHPWS_Core::isPosted()) { $this->title = dgettext('calendar', 'Duplicate suggestion.'); $this->content = dgettext('calendar', 'You may try to suggest a different event.'); return true; } if (!isset($_SESSION['Calendar_Total_Suggestions'])) { $_SESSION['Calendar_Total_Suggestions'] = 0; } if (!$this->allowSuggestion()) { $this->title = dgettext('calendar', 'Sorry'); $this->content = dgettext('calendar', 'You have exceeded your allowed event submissions.'); return true; } $result = $this->event->save(); $_SESSION['Calendar_Total_Suggestions']++; if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); if (PHPWS_Calendar::isJS()) { javascript('close_refresh', array('timeout' => 5, 'refresh' => 0)); Layout::nakedDisplay('Event suggestion failed to save. Try again later.'); exit; } else { $this->title = dgettext('calendar', 'Sorry'); $this->content = dgettext('calendar', 'Unable to save your event suggestion.'); return true; } } else { if (PHPWS_Calendar::isJS()) { javascript('alert', array('content' => dgettext('calendar', 'Event submitted for approval.'))); javascript('close_refresh', array('timeout' => 1, 'refresh' => 0)); Layout::nakedDisplay(); exit; } else { $this->title = dgettext('calendar', 'Event saved'); $this->content = dgettext('calendar', 'An administrator will review your submission. Thank you.'); return true; } } } else { return false; } }
<?php /** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ $mini_cal_display = PHPWS_Settings::get('calendar', 'display_mini'); if ($mini_cal_display == MINI_CAL_SHOW_ALWAYS || $mini_cal_display == MINI_CAL_SHOW_FRONT && PHPWS_Core::atHome()) { Layout::addStyle('calendar'); $Calendar = new PHPWS_Calendar(); $Calendar->loadUser(); if (PHPWS_Settings::get('calendar', 'mini_grid')) { $lil_calendar = $Calendar->user->mini_month(); Layout::add($lil_calendar, 'calendar', 'minimonth'); } $upcoming = $Calendar->user->upcomingEvents(); if ($upcoming) { Layout::add($upcoming, 'calendar', 'upcoming'); } }
public function postSchedule() { $default_public = PHPWS_Settings::get('calendar', 'public_schedule'); if ($this->calendar->schedule->post()) { if (!$this->allowSchedulePost()) { Current_User::disallow(); return; } $result = $this->calendar->schedule->save(); if (PHPWS_Error::isError($result)) { PHPWS_Error::log($result); if (PHPWS_Calendar::isJS()) { $this->sendMessage(dgettext('calendar', 'An error occurred when saving your schedule.'), null, false); javascript('close_refresh'); Layout::nakedDisplay(); exit; } else { $this->sendMessage(dgettext('calendar', 'An error occurred when saving your schedule.'), 'aop=schedules'); } } else { if ($this->calendar->schedule->public && $default_public < 1) { PHPWS_Settings::set('calendar', 'public_schedule', $this->calendar->schedule->id); PHPWS_Settings::save('calendar'); } if (!$this->calendar->schedule->public && $this->calendar->schedule->id == $default_public) { PHPWS_Settings::set('calendar', 'public_schedule', 0); PHPWS_Settings::save('calendar'); } if (PHPWS_Calendar::isJS()) { javascript('close_refresh'); Layout::nakedDisplay(); exit; } else { $this->sendMessage(dgettext('calendar', 'Schedule saved.'), 'aop=schedules'); } } } else { $this->message = $this->calendar->schedule->_error; $this->editSchedule(); } }
<?php /** * @author Matthew McNaney <mcnaney at gmail dot com> * @version $Id$ */ if (!defined('PHPWS_SOURCE_DIR')) { include '../../core/conf/404.html'; exit; } // If a admin action is called and the user has permissions enter in the admin functions // otherwise go into user functions PHPWS_Core::initModClass('calendar', 'Calendar.php'); $Calendar = new PHPWS_Calendar(); if ((isset($_REQUEST['aop']) || isset($_REQUEST['tab'])) && Current_User::allow('Calendar')) { $Calendar->admin(); } else { $Calendar->user(); }