Пример #1
0
 /**
  * Controller
  */
 public function process()
 {
     $iRsvp = $this->request()->get('rsvp', 1);
     $iPage = $this->request()->getInt('page');
     $sModule = $this->request()->get('module', false);
     $iItem = $this->request()->getInt('item', false);
     $aCallback = $this->getParam('aCallback', false);
     $iPageSize = 6;
     if (PHPFOX_IS_AJAX) {
         $aCallback = false;
         if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'getEventInvites')) {
             $aCallback = Phpfox::callback($sModule . '.getEventInvites', $iItem);
         }
         $aEvent = Event_Service_Event::instance()->callback($aCallback)->getEvent($this->request()->get('id'), true);
         $this->template()->assign('aEvent', $aEvent);
     } else {
         $aEvent = $this->getParam('aEvent');
         $this->template()->assign('aEvent', $aEvent);
     }
     if ($aCallback !== false) {
         $sModule = $aCallback['module'];
         $iItem = $aCallback['item'];
     }
     list($iCnt, $aInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], $iRsvp, $iPage, $iPageSize);
     Phpfox_Pager::instance()->set(array('ajax' => 'event.listGuests', 'page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'aParams' => array('id' => $aEvent['event_id'], 'module' => $sModule, 'item' => $iItem, 'rsvp' => $iRsvp)));
     $this->template()->assign(array('aInvites' => $aInvites, 'iRsvp' => $iRsvp));
     if (!PHPFOX_IS_AJAX) {
         $sExtra = '';
         if ($aCallback !== false) {
             $sExtra .= '&module=' . $aCallback['module'] . '&item=' . $aCallback['item'];
         }
         $this->template()->assign(array('sHeader' => '', 'aMenu' => array(Phpfox::getPhrase('event.attending') => '#event.listGuests?rsvp=1&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.maybe') => '#event.listGuests?rsvp=2&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.can_t_make_it') => '#event.listGuests?rsvp=3&id=' . $aEvent['event_id'] . $sExtra, Phpfox::getPhrase('event.not_responded') => '#event.listGuests?rsvp=0&id=' . $aEvent['event_id'] . $sExtra), 'sBoxJsId' => 'event_guests'));
         return 'block';
     }
 }
Пример #2
0
 /**
  * Controller
  */
 public function process()
 {
     list($iTotal, $aFeatured) = Event_Service_Event::instance()->getFeatured();
     if (!$iTotal) {
         return false;
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.featured_events'), 'aFeatured' => $aFeatured));
     return 'block';
 }
Пример #3
0
 /**
  * Controller
  */
 public function process()
 {
     $iRsvp = $this->request()->get('rsvp', 1);
     $iPage = $this->request()->getInt('page');
     $iPageSize = 20;
     $aEvent = Event_Service_Event::instance()->getEvent($this->request()->get('id'), true);
     list($iCnt, $aInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], $iRsvp, $iPage, $iPageSize);
     Phpfox_Pager::instance()->set(array('ajax' => 'event.browseList', 'page' => $iPage, 'size' => $iPageSize, 'count' => $iCnt, 'aParams' => array('id' => $aEvent['event_id'], 'rsvp' => $iRsvp)));
     $aLists = array(Phpfox::getPhrase('event.attending') => '1', Phpfox::getPhrase('event.maybe_attending') => '2', Phpfox::getPhrase('event.awaiting_reply') => '0', Phpfox::getPhrase('event.not_attending') => '3');
     $this->template()->assign(array('aEvent' => $aEvent, 'aInvites' => $aInvites, 'bIsInBrowse' => $iPage > 0 ? true : false, 'aLists' => $aLists));
 }
Пример #4
0
 /**
  * Controller
  */
 public function process()
 {
     $iPageSize = 6;
     $aEvent = $this->getParam('aEvent');
     list($iCnt, $aInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], 1, 1, $iPageSize);
     list($iAwaitingCnt, $aAwaitingInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], 0, 1, $iPageSize);
     list($iMaybeCnt, $aMaybeInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], 2, 1, $iPageSize);
     list($iNotAttendingCnt, $aNotAttendingInvites) = Event_Service_Event::instance()->getInvites($aEvent['event_id'], 3, 1, $iPageSize);
     $this->template()->assign(array('iAttendingCnt' => $iCnt, 'aInvites' => $aInvites, 'aAwaitingInvites' => $aAwaitingInvites, 'iAwaitingCnt' => $iAwaitingCnt, 'aMaybeInvites' => $aMaybeInvites, 'iMaybeCnt' => $iMaybeCnt, 'iNotAttendingCnt' => $iNotAttendingCnt, 'aNotAttendingInvites' => $aNotAttendingInvites, 'aFooter' => array(Phpfox::getPhrase('event.view_guest_list') => '#')));
     return 'block';
 }
Пример #5
0
 /**
  * Controller
  */
 public function process()
 {
     if (!Phpfox::isUser()) {
         return false;
     }
     $aEventInvites = Event_Service_Event::instance()->getInviteForUser();
     if (!count($aEventInvites)) {
         return false;
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.invites'), 'aEventInvites' => $aEventInvites));
     return 'block';
 }
Пример #6
0
 /**
  * Controller
  */
 public function process()
 {
     $aEventParent = $this->getParam('aEventParent');
     $aEvents = Event_Service_Event::instance()->getForParentBlock($aEventParent['module'], $aEventParent['item']);
     if (!count($aEvents) && !defined('PHPFOX_IN_DESIGN_MODE')) {
         return false;
     }
     if (!Phpfox::getService('group')->hasAccess($aEventParent['item'], 'can_use_event')) {
         return false;
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.upcoming_events'), 'sBlockJsId' => 'parent_event', 'aEvents' => $aEvents, 'aEventParent' => $aEventParent));
     if (count($aEvents) == 5) {
         $this->template()->assign('aFooter', array('View More' => $this->url()->makeUrl($aEventParent['url'][0], $aEventParent['url'][1])));
     }
     return 'block';
 }
Пример #7
0
 /**
  * Class process method which is used to execute this component.
  */
 public function process()
 {
     if (!Phpfox::isModule('ad')) {
         return false;
     }
     if (defined('PHPFOX_IS_GROUP_VIEW')) {
         return false;
     }
     $aSponsorEvents = Event_Service_Event::instance()->getRandomSponsored();
     if (empty($aSponsorEvents)) {
         return false;
     }
     Phpfox::getService('ad.process')->addSponsorViewsCount($aSponsorEvents['sponsor_id'], 'event');
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.sponsored_event'), 'aSponsorEvents' => $aSponsorEvents, 'aFooter' => array(Phpfox::getPhrase('event.encourage_sponsor') => $this->url()->makeUrl('profile.event', array('sponsor' => 1)))));
     return 'block';
 }
Пример #8
0
 /**
  * Controller
  */
 public function process()
 {
     $aUser = $this->getParam('aUser');
     if (!Phpfox::getService('user.privacy')->hasAccess($aUser['user_id'], 'event.display_on_profile')) {
         return false;
     }
     $aEvents = Event_Service_Event::instance()->getForProfileBlock($aUser['user_id']);
     if (!count($aEvents) && !defined('PHPFOX_IN_DESIGN_MODE')) {
         return false;
     }
     $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.events_i_m_attending'), 'sBlockJsId' => 'profile_event', 'aEvents' => $aEvents));
     if (count($aEvents) == 1) {
         $this->template()->assign('aFooter', array('View More' => $this->url()->makeUrl('event', array('user' => $aUser['user_id']))));
     }
     if (Phpfox::getUserId() == $aUser['user_id']) {
         $this->template()->assign('sDeleteBlock', 'profile');
     }
     return 'block';
 }
Пример #9
0
 /**
  * Controller
  */
 public function process()
 {
     if (!Phpfox::isUser()) {
         return false;
     }
     if (PHPFOX_IS_AJAX) {
         $sModule = $this->request()->get('module', false);
         $iItem = $this->request()->getInt('item', false);
         $aCallback = false;
         if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'getEventInvites')) {
             $aCallback = Phpfox::callback($sModule . '.getEventInvites', $iItem);
         }
     }
     $aEvent = PHPFOX_IS_AJAX ? Event_Service_Event::instance()->callback($aCallback)->getEvent($this->request()->get('id'), true) : $this->getParam('aEvent');
     if (PHPFOX_IS_AJAX) {
         $this->template()->assign(array('aEvent' => $aEvent, 'aCallback' => $aCallback));
     } else {
         $aCallback = $this->getParam('aCallback', false);
         $this->template()->assign(array('sHeader' => Phpfox::getPhrase('event.your_rsvp'), 'aCallback' => $aCallback));
         return 'block';
     }
 }
<?php

if (Phpfox_Request::instance()->get('module') == 'event') {
    $aEvent = Event_Service_Event::instance()->getForEdit($aFeed['parent_user_id'], true);
    if (isset($aEvent['event_id']) && $aEvent['user_id'] == Phpfox::getUserId()) {
        define('PHPFOX_FEED_CAN_DELETE', true);
    }
}
Пример #11
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::isUser(true);
     Phpfox::getUserParam('event.can_create_event', true);
     $bIsEdit = false;
     $bIsSetup = $this->request()->get('req4') == 'setup' ? true : false;
     $sAction = $this->request()->get('req3');
     $aCallback = false;
     $sModule = $this->request()->get('module', false);
     $iItem = $this->request()->getInt('item', false);
     $aEvent = false;
     if ($iEditId = $this->request()->get('id')) {
         if ($aEvent = Event_Service_Event::instance()->getForEdit($iEditId)) {
             $bIsEdit = true;
             $this->setParam('aEvent', $aEvent);
             $this->setParam(array('country_child_value' => $aEvent['country_iso'], 'country_child_id' => $aEvent['country_child_id']));
             $this->template()->setHeader(array('<script type="text/javascript">$Behavior.eventEditCategory = function(){  var aCategories = explode(\',\', \'' . $aEvent['categories'] . '\'); for (i in aCategories) { $(\'#js_mp_holder_\' + aCategories[i]).show(); $(\'#js_mp_category_item_\' + aCategories[i]).attr(\'selected\', true); } }</script>'))->assign(array('aForms' => $aEvent, 'aEvent' => $aEvent));
             if ($aEvent['module_id'] != 'event') {
                 $sModule = $aEvent['module_id'];
                 $iItem = $aEvent['item_id'];
             }
         }
     }
     if ($sModule && $iItem && Phpfox::hasCallback($sModule, 'viewEvent')) {
         $aCallback = Phpfox::callback($sModule . '.viewEvent', $iItem);
         $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
         $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
         if ($sModule == 'pages' && !Phpfox::getService('pages')->hasPerm($iItem, 'event.share_events')) {
             return Phpfox_Error::display(Phpfox::getPhrase('event.unable_to_view_this_item_due_to_privacy_settings'));
         }
     }
     $aValidation = array('title' => Phpfox::getPhrase('event.provide_a_name_for_this_event'), 'location' => Phpfox::getPhrase('event.provide_a_location_for_this_event'));
     $oValidator = Phpfox_Validator::instance()->set(array('sFormName' => 'js_event_form', 'aParams' => $aValidation));
     if ($aVals = $this->request()->get('val')) {
         if ($oValidator->isValid($aVals)) {
             if ($bIsEdit) {
                 if (Event_Service_Process::instance()->update($aEvent['event_id'], $aVals, $aEvent)) {
                     switch ($sAction) {
                         case 'customize':
                             $this->url()->send('event.add.invite.setup', array('id' => $aEvent['event_id']), Phpfox::getPhrase('event.successfully_added_a_photo_to_your_event'));
                             break;
                         default:
                             $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title'], true, Phpfox::getPhrase('event.successfully_invited_guests_to_this_event'));
                             break;
                     }
                 } else {
                     $aVals['event_id'] = $aEvent['event_id'];
                     $this->template()->assign(array('aForms' => $aVals, 'aEvent' => $aVals));
                 }
             } else {
                 if (($iFlood = Phpfox::getUserParam('event.flood_control_events')) !== 0) {
                     $aFlood = array('action' => 'last_post', 'params' => array('field' => 'time_stamp', 'table' => Phpfox::getT('event'), 'condition' => 'user_id = ' . Phpfox::getUserId(), 'time_stamp' => $iFlood * 60));
                     // actually check if flooding
                     if (Phpfox::getLib('spam')->check($aFlood)) {
                         Phpfox_Error::set(Phpfox::getPhrase('event.you_are_creating_an_event_a_little_too_soon') . ' ' . Phpfox::getLib('spam')->getWaitTime());
                     }
                 }
                 if (Phpfox_Error::isPassed()) {
                     if ($iId = Event_Service_Process::instance()->add($aVals, $aCallback !== false ? $sModule : 'event', $aCallback !== false ? $iItem : 0)) {
                         $aEvent = Event_Service_Event::instance()->getForEdit($iId);
                         $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title'], true, Phpfox::getPhrase('event.event_successfully_added'));
                     }
                 }
             }
         }
         $sStep = isset($aVals['step']) ? $aVals['step'] : '';
         $sAction = isset($aVals['action']) ? $aVals['action'] : '';
         $this->template()->assign('aForms', $aVals);
     }
     if ($bIsEdit) {
         $aMenus = array('detail' => Phpfox::getPhrase('event.event_details'), 'customize' => 'Banner', 'invite' => Phpfox::getPhrase('event.invite_guests'));
         if (!$bIsSetup) {
             $aMenus['manage'] = Phpfox::getPhrase('event.manage_guest_list');
             // $aMenus['email'] = Phpfox::getPhrase('event.mass_email');
         }
         $this->template()->buildPageMenu('js_event_block', $aMenus, array('link' => $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']), 'phrase' => Phpfox::getPhrase('event.view_this_event')));
     }
     $this->template()->setTitle($bIsEdit ? Phpfox::getPhrase('event.managing_event') . ': ' . $aEvent['title'] : Phpfox::getPhrase('event.create_an_event'))->setFullSite()->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback === false ? $this->url()->makeUrl('event') : $this->url()->makeUrl($aCallback['url_home_pages']))->setBreadcrumb($bIsEdit ? Phpfox::getPhrase('event.managing_event') . ': ' . $aEvent['title'] : Phpfox::getPhrase('event.create_new_event'), $bIsEdit ? $this->url()->makeUrl('event.add', array('id' => $aEvent['event_id'])) : $this->url()->makeUrl('event.add'), true)->setEditor()->setPhrase(array('core.select_a_file_to_upload'))->setHeader('cache', array('add.js' => 'module_event', 'pager.css' => 'style_css', 'progress.js' => 'static_script', 'country.js' => 'module_core'))->setHeader(array('<script type="text/javascript">$Behavior.eventProgressBarSettings = function(){ if ($Core.exists(\'#js_event_block_customize_holder\')) { oProgressBar = {holder: \'#js_event_block_customize_holder\', progress_id: \'#js_progress_bar\', uploader: \'#js_progress_uploader\', add_more: false, max_upload: 1, total: 1, frame_id: \'js_upload_frame\', file_id: \'image\'}; $Core.progressBarInit(); } }</script>'))->assign(array('sCreateJs' => $oValidator->createJS(), 'sGetJsForm' => $oValidator->getJsForm(false), 'bIsEdit' => $bIsEdit, 'bIsSetup' => $bIsSetup, 'sCategories' => Phpfox::getService('event.category')->get(), 'sModule' => $aCallback !== false ? $sModule : '', 'iItem' => $aCallback !== false ? $iItem : '', 'aCallback' => $aCallback, 'iMaxFileSize' => Phpfox::getUserParam('event.max_upload_size_event') === 0 ? null : Phpfox::getLib('phpfox.file')->filesize(Phpfox::getUserParam('event.max_upload_size_event') / 1024 * 1048576), 'bCanSendEmails' => $bIsEdit ? Event_Service_Event::instance()->canSendEmails($aEvent['event_id']) : false, 'iCanSendEmailsTime' => $bIsEdit ? Event_Service_Event::instance()->getTimeLeft($aEvent['event_id']) : false, 'sJsEventAddCommand' => isset($aEvent['event_id']) ? "if (confirm('" . Phpfox::getPhrase('event.are_you_sure', array('phpfox_squote' => true)) . "')) { \$('#js_submit_upload_image').show(); \$('#js_event_upload_image').show(); \$('#js_event_current_image').remove(); \$.ajaxCall('event.deleteImage', 'id={$aEvent['event_id']}'); } return false;" : '', 'sTimeSeparator' => Phpfox::getPhrase('event.time_separator')));
 }
Пример #12
0
 public function addFeedComment()
 {
     Phpfox::isUser(true);
     $aVals = (array) $this->get('val');
     if (Phpfox::getLib('parse.format')->isEmpty($aVals['user_status'])) {
         $this->alert(Phpfox::getPhrase('user.add_some_text_to_share'));
         $this->call('$Core.activityFeedProcess(false);');
         return;
     }
     $aEvent = Event_Service_Event::instance()->getForEdit($aVals['callback_item_id'], true);
     if (!isset($aEvent['event_id'])) {
         $this->alert(Phpfox::getPhrase('event.unable_to_find_the_event_you_are_trying_to_comment_on'));
         $this->call('$Core.activityFeedProcess(false);');
         return;
     }
     $sLink = Phpfox::permalink('event', $aEvent['event_id'], $aEvent['title']);
     $aCallback = array('module' => 'event', 'table_prefix' => 'event_', 'link' => $sLink, 'email_user_id' => $aEvent['user_id'], 'subject' => Phpfox::getPhrase('event.full_name_wrote_a_comment_on_your_event_title', array('full_name' => Phpfox::getUserBy('full_name'), 'title' => $aEvent['title'])), 'message' => Phpfox::getPhrase('event.full_name_wrote_a_comment_on_your_event_message', array('full_name' => Phpfox::getUserBy('full_name'), 'link' => $sLink, 'title' => $aEvent['title'])), 'notification' => 'event_comment', 'feed_id' => 'event_comment', 'item_id' => $aEvent['event_id']);
     $aVals['parent_user_id'] = $aVals['callback_item_id'];
     if (isset($aVals['user_status']) && ($iId = Phpfox::getService('feed.process')->callback($aCallback)->addComment($aVals))) {
         Phpfox_Database::instance()->updateCounter('event', 'total_comment', 'event_id', $aEvent['event_id']);
         Feed_Service_Feed::instance()->callback($aCallback)->processAjax($iId);
     } else {
         $this->call('$Core.activityFeedProcess(false);');
     }
 }
Пример #13
0
 /**
  * Controller
  */
 public function process()
 {
     if ($this->request()->get('req2') == 'view' && ($sLegacyTitle = $this->request()->get('req3')) && !empty($sLegacyTitle)) {
         Phpfox::getService('core')->getLegacyItem(array('field' => array('event_id', 'title'), 'table' => 'event', 'redirect' => 'event', 'title' => $sLegacyTitle));
     }
     Phpfox::getUserParam('event.can_access_event', true);
     $sEvent = $this->request()->get('req2');
     if (Phpfox::isUser() && Phpfox::isModule('notification')) {
         if ($this->request()->getInt('comment-id')) {
             Phpfox::getService('notification.process')->delete('event_comment', $this->request()->getInt('comment-id'), Phpfox::getUserId());
             Phpfox::getService('notification.process')->delete('event_comment_feed', $this->request()->getInt('comment-id'), Phpfox::getUserId());
             Phpfox::getService('notification.process')->delete('event_comment_like', $this->request()->getInt('comment-id'), Phpfox::getUserId());
         }
         Phpfox::getService('notification.process')->delete('event_like', $this->request()->getInt('req2'), Phpfox::getUserId());
         Phpfox::getService('notification.process')->delete('event_invite', $this->request()->getInt('req2'), Phpfox::getUserId());
     }
     if (!($aEvent = Event_Service_Event::instance()->getEvent($sEvent))) {
         return Phpfox_Error::display(Phpfox::getPhrase('event.the_event_you_are_looking_for_does_not_exist_or_has_been_removed'), 404);
     }
     Phpfox::getService('core.redirect')->check($aEvent['title']);
     if (Phpfox::isModule('privacy')) {
         Privacy_Service_Privacy::instance()->check('event', $aEvent['event_id'], $aEvent['user_id'], $aEvent['privacy'], $aEvent['is_friend']);
     }
     $this->setParam('aEvent', $aEvent);
     $bCanPostComment = true;
     if (isset($aEvent['privacy_comment']) && $aEvent['user_id'] != Phpfox::getUserId() && !Phpfox::getUserParam('privacy.can_comment_on_all_items')) {
         switch ($aEvent['privacy_comment']) {
             // Everyone is case 0. Skipped.
             // Friends only
             case 1:
                 if (!Friend_Service_Friend::instance()->isFriend(Phpfox::getUserId(), $aEvent['user_id'])) {
                     $bCanPostComment = false;
                 }
                 break;
                 // Friend of friends
             // Friend of friends
             case 2:
                 if (!Friend_Service_Friend::instance()->isFriendOfFriend($aEvent['user_id'])) {
                     $bCanPostComment = false;
                 }
                 break;
                 // Only me
             // Only me
             case 3:
                 $bCanPostComment = false;
                 break;
         }
     }
     $aCallback = false;
     if ($aEvent['item_id'] && Phpfox::hasCallback($aEvent['module_id'], 'viewEvent')) {
         $aCallback = Phpfox::callback($aEvent['module_id'] . '.viewEvent', $aEvent['item_id']);
         $this->template()->setBreadcrumb($aCallback['breadcrumb_title'], $aCallback['breadcrumb_home']);
         $this->template()->setBreadcrumb($aCallback['title'], $aCallback['url_home']);
         if ($aEvent['module_id'] == 'pages' && !Phpfox::getService('pages')->hasPerm($aCallback['item_id'], 'event.view_browse_events')) {
             return Phpfox_Error::display('Unable to view this item due to privacy settings.');
         }
     }
     if (Phpfox::getUserId()) {
         $bIsBlocked = Phpfox::getService('user.block')->isBlocked($aEvent['user_id'], Phpfox::getUserId());
         if ($bIsBlocked) {
             $bCanPostComment = false;
         }
     }
     $this->setParam('aFeedCallback', array('module' => 'event', 'table_prefix' => 'event_', 'ajax_request' => 'event.addFeedComment', 'item_id' => $aEvent['event_id'], 'disable_share' => $bCanPostComment ? false : true));
     if ($aEvent['view_id'] == '1') {
         $this->template()->setHeader('<script type="text/javascript">$Behavior.eventIsPending = function(){ $(\'#js_block_border_feed_display\').addClass(\'js_moderation_on\').hide(); }</script>');
     }
     if (Phpfox::getUserId() == $aEvent['user_id']) {
         if (Phpfox::isModule('notification')) {
             Phpfox::getService('notification.process')->delete('event_approved', $this->request()->getInt('req2'), Phpfox::getUserId());
         }
         define('PHPFOX_FEED_CAN_DELETE', true);
     }
     $this->template()->setTitle($aEvent['title'])->setMeta('description', $aEvent['description'])->setMeta('keywords', $this->template()->getKeywords($aEvent['title']))->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback === false ? $this->url()->makeUrl('event') : $this->url()->makeUrl($aCallback['url_home_pages']))->setBreadcrumb($aEvent['title'], $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']), true)->setEditor(array('load' => 'simple'))->setHeader('cache', array('jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script', 'comment.css' => 'style_css', 'pager.css' => 'style_css', 'feed.js' => 'module_feed', 'event.js' => 'module_event'))->assign(array('aEvent' => $aEvent, 'aCallback' => $aCallback, 'sMicroPropType' => 'Event'));
     ($sPlugin = Phpfox_Plugin::get('event.component_controller_view_process_end')) ? eval($sPlugin) : false;
 }
Пример #14
0
    public function massEmail($iId, $iPage, $sSubject, $sText)
    {
        Phpfox::isUser(true);
        Phpfox::getUserParam('event.can_mass_mail_own_members', true);
        $aEvent = Event_Service_Event::instance()->getEvent($iId, true);
        if (!isset($aEvent['event_id'])) {
            return false;
        }
        if ($aEvent['user_id'] != Phpfox::getUserId()) {
            return false;
        }
        if ($sPlugin = Phpfox_Plugin::get('event.service_process_massemail__start')) {
            return eval($sPlugin);
        }
        Phpfox::getService('ban')->checkAutomaticBan($sText);
        list($iCnt, $aGuests) = Event_Service_Event::instance()->getInvites($iId, 1, $iPage, 20);
        $sLink = Phpfox_Url::instance()->permalink('event', $aEvent['event_id'], $aEvent['title']);
        $sText = '<br />
		' . Phpfox::getPhrase('event.notice_this_is_a_newsletter_sent_from_the_event') . ': ' . $aEvent['title'] . '<br />
		<a href="' . $sLink . '">' . $sLink . '</a>
		<br /><br />
		' . $sText;
        foreach ($aGuests as $aGuest) {
            if ($aGuest['user_id'] == Phpfox::getUserId()) {
                continue;
            }
            Phpfox::getLib('mail')->to($aGuest['user_id'])->subject($sSubject)->message($sText)->notification('event.mass_emails')->send();
        }
        if ($sPlugin = Phpfox_Plugin::get('event.service_process_massemail__end')) {
            return eval($sPlugin);
        }
        $this->database()->update($this->_sTable, array('mass_email' => PHPFOX_TIME), 'event_id = ' . $aEvent['event_id']);
        return $iCnt;
    }
<?php

if ($sFriendModuleId == 'event') {
    $aInviteCache = Event_Service_Event::instance()->isAlreadyInvited($this->getParam('friend_item_id', '0'), $aFriends);
    if (is_array($aInviteCache)) {
        foreach ($aFriends as $iKey => $aFriend) {
            if (isset($aInviteCache[$aFriend['user_id']])) {
                $aFriends[$iKey]['is_active'] = $aInviteCache[$aFriend['user_id']];
            }
        }
        $this->template()->assign(array('aFriends' => $aFriends));
    }
}
Пример #16
0
 /**
  * Controller
  */
 public function process()
 {
     Phpfox::getUserParam('event.can_access_event', true);
     $aParentModule = $this->getParam('aParentModule');
     if ($aParentModule === null && $this->request()->getInt('req2') > 0) {
         return Phpfox_Module::instance()->setController('event.view');
     }
     if (($sLegacyTitle = $this->request()->get('req2')) && !empty($sLegacyTitle)) {
         if ($this->request()->get('req3') != '') {
             $sLegacyTitle = $this->request()->get('req3');
         }
         $aLegacyItem = Phpfox::getService('core')->getLegacyItem(array('field' => array('category_id', 'name'), 'table' => 'event_category', 'redirect' => 'event.category', 'title' => $sLegacyTitle, 'search' => 'name_url'));
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true)) && $aEvent['module_id'] != 'event' && Phpfox::hasCallback($aEvent['module_id'], 'getEventRedirect')) {
         if ($sForward = Phpfox::callback($aEvent['module_id'] . '.getEventRedirect', $aEvent['event_id'])) {
             Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
             $this->url()->forward($sForward);
         }
     }
     if ($iDeleteId = $this->request()->getInt('delete')) {
         if ($mDeleteReturn = Event_Service_Process::instance()->delete($iDeleteId)) {
             if (is_bool($mDeleteReturn)) {
                 $this->url()->send('event', null, Phpfox::getPhrase('event.event_successfully_deleted'));
             } else {
                 $this->url()->forward($mDeleteReturn, Phpfox::getPhrase('event.event_successfully_deleted'));
             }
         }
     }
     if (($iRedirectId = $this->request()->getInt('redirect')) && ($aEvent = Event_Service_Event::instance()->getEvent($iRedirectId, true))) {
         Phpfox::getService('notification.process')->delete('event_invite', $aEvent['event_id'], Phpfox::getUserId());
         $this->url()->permalink('event', $aEvent['event_id'], $aEvent['title']);
     }
     $bIsUserProfile = false;
     if (defined('PHPFOX_IS_AJAX_CONTROLLER')) {
         $bIsUserProfile = true;
         $aUser = Phpfox::getService('user')->get($this->request()->get('profile_id'));
         $this->setParam('aUser', $aUser);
     }
     if (defined('PHPFOX_IS_USER_PROFILE')) {
         $bIsUserProfile = true;
         $aUser = $this->getParam('aUser');
     }
     $oServiceEventBrowse = Phpfox::getService('event.browse');
     $sCategory = null;
     $sView = $this->request()->get('view', false);
     $aCallback = $this->getParam('aCallback', false);
     $this->search()->set(array('type' => 'event', 'field' => 'm.event_id', 'search_tool' => array('default_when' => 'upcoming', 'when_field' => 'start_time', 'when_upcoming' => true, 'table_alias' => 'm', 'search' => array('action' => $aParentModule === null ? $bIsUserProfile === true ? $this->url()->makeUrl($aUser['user_name'], array('event', 'view' => $this->request()->get('view'))) : $this->url()->makeUrl('event', array('view' => $this->request()->get('view'))) : $aParentModule['url'] . 'event/view_' . $this->request()->get('view') . '/', 'default_value' => Phpfox::getPhrase('event.search_events'), 'name' => 'search', 'field' => 'm.title'), 'sort' => array('latest' => array('m.start_time', Phpfox::getPhrase('event.latest'), 'ASC'), 'most-liked' => array('m.total_like', Phpfox::getPhrase('event.most_liked')), 'most-talked' => array('m.total_comment', Phpfox::getPhrase('event.most_discussed'))), 'show' => array(12, 15, 18, 21))));
     $aBrowseParams = array('module_id' => 'event', 'alias' => 'm', 'field' => 'event_id', 'table' => Phpfox::getT('event'), 'hide_view' => array('pending', 'my'));
     switch ($sView) {
         case 'pending':
             if (Phpfox::getUserParam('event.can_approve_events')) {
                 $this->search()->setCondition('AND m.view_id = 1');
             }
             break;
         case 'my':
             Phpfox::isUser(true);
             $this->search()->setCondition('AND m.user_id = ' . Phpfox::getUserId());
             break;
         default:
             if ($bIsUserProfile) {
                 $this->search()->setCondition('AND m.view_id ' . ($aUser['user_id'] == Phpfox::getUserId() ? 'IN(0,2)' : '= 0') . ' AND m.module_id = "event" AND m.privacy IN(' . (Phpfox::getParam('core.section_privacy_item_browsing') ? '%PRIVACY%' : Phpfox::getService('core')->getForBrowse($aUser)) . ') AND m.user_id = ' . (int) $aUser['user_id']);
             } elseif ($aParentModule !== null) {
                 $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.module_id = \'' . Phpfox_Database::instance()->escape($aParentModule['module_id']) . '\' AND m.item_id = ' . (int) $aParentModule['item_id'] . '');
             } else {
                 switch ($sView) {
                     case 'attending':
                         $oServiceEventBrowse->attending(1);
                         break;
                     case 'may-attend':
                         $oServiceEventBrowse->attending(2);
                         break;
                     case 'not-attending':
                         $oServiceEventBrowse->attending(3);
                         break;
                     case 'invites':
                         $oServiceEventBrowse->attending(0);
                         break;
                 }
                 if ($sView == 'attending') {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%)');
                 } else {
                     $this->search()->setCondition('AND m.view_id = 0 AND m.privacy IN(%PRIVACY%) AND m.item_id = ' . ($aCallback !== false ? (int) $aCallback['item'] : 0) . '');
                 }
                 if ($this->request()->getInt('user') && ($aUserSearch = Phpfox::getService('user')->getUser($this->request()->getInt('user')))) {
                     $this->search()->setCondition('AND m.user_id = ' . (int) $aUserSearch['user_id']);
                     $this->template()->setBreadcrumb($aUserSearch['full_name'] . '\'s Events', $this->url()->makeUrl('event', array('user' => $aUserSearch['user_id'])), true);
                 }
             }
             break;
     }
     if ($this->request()->getInt('sponsor') == 1) {
         $this->search()->setCondition('AND m.is_sponsor != 1');
         Phpfox::addMessage(Phpfox::getPhrase('event.sponsor_help'));
     }
     if ($this->request()->get('req2') == 'category') {
         $sCategory = $this->request()->getInt('req3');
         $this->search()->setCondition('AND mcd.category_id = ' . (int) $sCategory);
     }
     if ($sView == 'featured') {
         $this->search()->setCondition('AND m.is_featured = 1');
     }
     $this->setParam('sCategory', $sCategory);
     $oServiceEventBrowse->callback($aCallback)->category($sCategory);
     $this->search()->browse()->params($aBrowseParams)->execute();
     $aFilterMenu = array();
     $bSetFilterMenu = !defined('PHPFOX_IS_USER_PROFILE') && !defined('PHPFOX_IS_PAGES_VIEW');
     if ($sPlugin = Phpfox_Plugin::get('event.component_controller_index_set_filter_menu_1')) {
         eval($sPlugin);
         if (isset($mReturnFromPlugin)) {
             return $mReturnFromPlugin;
         }
     }
     if ($bSetFilterMenu) {
         $aFilterMenu = array(Phpfox::getPhrase('event.all_events') => '', Phpfox::getPhrase('event.my_events') => 'my');
         if (Phpfox::isModule('friend') && !Phpfox::getParam('core.friends_only_community')) {
             $aFilterMenu[Phpfox::getPhrase('event.friends_events')] = 'friend';
         }
         list($iTotalFeatured, $aFeatured) = Event_Service_Event::instance()->getFeatured();
         if ($iTotalFeatured) {
             $aFilterMenu[Phpfox::getPhrase('event.featured_events') . '<span class="pending">' . $iTotalFeatured . '</span>'] = 'featured';
         }
         if (Phpfox::getUserParam('event.can_approve_events')) {
             $iPendingTotal = Event_Service_Event::instance()->getPendingTotal();
             if ($iPendingTotal) {
                 $aFilterMenu[Phpfox::getPhrase('event.pending_events') . '<span class="pending">' . $iPendingTotal . '</span>'] = 'pending';
             }
         }
         $aFilterMenu[] = true;
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_attending')] = 'attending';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_may_attend')] = 'may-attend';
         $aFilterMenu[Phpfox::getPhrase('event.events_i_m_not_attending')] = 'not-attending';
         $aFilterMenu[Phpfox::getPhrase('event.event_invites')] = 'invites';
         $this->template()->buildSectionMenu('event', $aFilterMenu);
     }
     $this->template()->setTitle($bIsUserProfile ? Phpfox::getPhrase('event.full_name_s_events', array('full_name' => $aUser['full_name'])) : Phpfox::getPhrase('event.events'))->setBreadcrumb(Phpfox::getPhrase('event.events'), $aCallback !== false ? $this->url()->makeUrl($aCallback['url_home'][0], array_merge($aCallback['url_home'][1], array('event'))) : ($bIsUserProfile ? $this->url()->makeUrl($aUser['user_name'], 'event') : $this->url()->makeUrl('event')))->setHeader('cache', array('country.js' => 'module_core', 'browse.css' => 'module_event', 'feed.js' => 'module_feed'))->assign(array('aEvents' => $this->search()->browse()->getRows(), 'sView' => $sView, 'aCallback' => $aCallback, 'sParentLink' => $aCallback !== false ? $aCallback['url_home'][0] . '.' . implode('.', $aCallback['url_home'][1]) . '.event' : 'event', 'sApproveLink' => $this->url()->makeUrl('event', array('view' => 'pending'))));
     if ($sCategory !== null) {
         $aCategories = Phpfox::getService('event.category')->getParentBreadcrumb($sCategory);
         $iCnt = 0;
         foreach ($aCategories as $aCategory) {
             $iCnt++;
             $this->template()->setTitle($aCategory[0]);
             if ($aCallback !== false) {
                 $sHomeUrl = '/' . Phpfox_Url::instance()->doRewrite($aCallback['url_home'][0]) . '/' . implode('/', $aCallback['url_home'][1]) . '/' . Phpfox_Url::instance()->doRewrite('event') . '/';
                 $aCategory[1] = preg_replace('/^http:\\/\\/(.*?)\\/' . Phpfox_Url::instance()->doRewrite('event') . '\\/(.*?)$/i', 'http://\\1' . $sHomeUrl . '\\2', $aCategory[1]);
             }
             $this->template()->setBreadcrumb($aCategory[0], $aCategory[1], empty($sView) ? true : false);
         }
     }
     if ($aCallback !== false) {
         $this->template()->rebuildMenu('event.index', $aCallback['url_home']);
     }
     Phpfox_Pager::instance()->set(array('page' => $this->search()->getPage(), 'size' => $this->search()->getDisplay(), 'count' => $this->search()->browse()->getCount()));
     $this->setParam('global_moderation', array('name' => 'event', 'ajax' => 'event.moderation', 'menu' => array(array('phrase' => Phpfox::getPhrase('event.delete'), 'action' => 'delete'), array('phrase' => Phpfox::getPhrase('event.approve'), 'action' => 'approve'))));
 }
Пример #17
0
 public function pendingApproval()
 {
     return array('phrase' => Phpfox::getPhrase('event.events'), 'value' => Event_Service_Event::instance()->getPendingTotal(), 'link' => Phpfox_Url::instance()->makeUrl('event', array('view' => 'pending')));
 }