11 $a = $aModuleOverwright ? $aModuleOverwright :
$aModule;
12 if (!$a || $a[
'uri'] !=
'events') {
14 $a = $oMain->_aModule;
23 define(
'CH_EVENTS_PHOTOS_CAT',
'Events');
24 define(
'CH_EVENTS_PHOTOS_TAG',
'events');
26 define(
'CH_EVENTS_VIDEOS_CAT',
'Events');
27 define(
'CH_EVENTS_VIDEOS_TAG',
'events');
29 define(
'CH_EVENTS_SOUNDS_CAT',
'Events');
30 define(
'CH_EVENTS_SOUNDS_TAG',
'events');
32 define(
'CH_EVENTS_FILES_CAT',
'Events');
33 define(
'CH_EVENTS_FILES_TAG',
'events');
35 define(
'CH_EVENTS_MAX_FANS', 1000);
135 $this->_sFilterName =
'ch_events_filter';
136 $this->_sPrefix =
'ch_events';
138 $GLOBALS[
'oChEventsModule'] = &$this;
145 parent::_actionHome(
_t(
'_ch_events_main'));
150 parent::_actionVideos($sUri,
_t(
'_ch_events_caption_videos'));
155 parent::_actionPhotos($sUri,
_t(
'_ch_events_caption_photos'));
160 parent::_actionSounds($sUri,
_t(
'_ch_events_caption_sounds'));
165 parent::_actionFiles($sUri,
_t(
'_ch_events_caption_files'));
170 parent::_actionComments($sUri,
_t(
'_ch_events_caption_comments'));
175 parent::_actionBrowseFans($sUri,
'isAllowedViewParticipants',
'getFansBrowse',
176 $this->_oDb->getParam(
'ch_events_perpage_browse_participants'),
'browse_participants/',
177 _t(
'_ch_events_caption_participants'));
182 parent::_actionView($sUri,
_t(
'_ch_events_msg_pending_approval'));
187 parent::_actionUploadMedia($sUri,
'isAllowedUploadPhotos',
'images', array(
'images_choice',
'images_upload'),
188 _t(
'_ch_events_caption_upload_photos'));
193 parent::_actionUploadMedia($sUri,
'isAllowedUploadVideos',
'videos', array(
'videos_choice',
'videos_upload'),
194 _t(
'_ch_events_caption_upload_videos'));
199 parent::_actionUploadMedia($sUri,
'isAllowedUploadSounds',
'sounds', array(
'sounds_choice',
'sounds_upload'),
200 _t(
'_ch_events_caption_upload_sounds'));
205 parent::_actionUploadMedia($sUri,
'isAllowedUploadFiles',
'files', array(
'files_choice',
'files_upload'),
206 _t(
'_ch_events_caption_upload_files'));
211 parent::_actionBroadcast($iEntryId,
_t(
'_ch_events_caption_broadcast'),
212 _t(
'_ch_events_msg_broadcast_no_participants'),
_t(
'_ch_events_msg_broadcast_message_sent'));
217 parent::_actionInvite($iEntryId,
'ch_events_invitation',
218 $this->_oDb->getParam(
'ch_events_max_email_invitations'),
_t(
'_ch_events_invitation_sent'),
219 _t(
'_ch_events_no_users_msg'),
_t(
'_ch_events_caption_invite'));
225 'EventName' => $aDataEntry[
'Title'],
226 'EventLocation' =>
_t(
$GLOBALS[
'aPreValues'][
'Country'][$aDataEntry[
'Country']][
'LKey']) . (trim($aDataEntry[
'City']) ?
', ' . $aDataEntry[
'City'] :
'') .
', ' . $aDataEntry[
'Place'],
228 'EventUrl' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'view/' . $aDataEntry[
'EntryUri'],
229 'InviterUrl' => $aInviter ?
getProfileLink($aInviter[
'ID']) :
'javascript:void(0);',
230 'InviterNickName' => $aInviter ?
getNickName($aInviter[
'ID']) :
_t(
'_ch_events_user_unknown'),
231 'InvitationText' => nl2br(
process_pass_data(strip_tags($_POST[
'inviter_text']))),
237 parent::_actionCalendar($iYear, $iMonth,
_t(
'_ch_events_calendar'));
243 $this->_oTemplate->displayAccessDenied();
248 $this->_oTemplate->pageStart();
251 $_GET[
'Keyword'] = $sKeyword;
257 if (is_array(
$_GET[
'Country']) && 1 == count(
$_GET[
'Country']) && !
$_GET[
'Country'][0]) {
258 unset(
$_GET[
'Country']);
263 $_GET[
'submit_form'] = 1;
270 if (
$oForm->isSubmittedAndValid()) {
276 $this->_oTemplate->displayPageNotFound();
281 if (
$s =
$o->processing()) {
284 $this->_oTemplate->displayNoData();
291 $this->_oTemplate->addCss(array(
'unit.css',
'main.css',
'twig.css'));
292 $this->_oTemplate->pageCode(
$o->aCurrent[
'title'],
false,
false);
299 $this->_oTemplate->addCss(
'main.css');
300 $this->_oTemplate->pageCode(
_t(
'_ch_events_caption_search'));
305 parent::_actionAdd(
_t(
'_ch_events_caption_add'));
310 parent::_actionEdit($iEntryId,
_t(
'_ch_events_caption_edit'));
315 parent::_actionDelete($iEntryId,
_t(
'_ch_events_event_was_deleted'));
320 parent::_actionMarkFeatured($iEntryId,
_t(
'_ch_events_msg_added_to_featured'),
321 _t(
'_ch_events_msg_removed_from_featured'));
326 parent::_actionJoin($iEntryId,
$iProfileId,
_t(
'_ch_events_event_joined_already'),
327 _t(
'_ch_events_event_joined_already_pending'),
_t(
'_ch_events_event_join_success'),
328 _t(
'_ch_events_event_join_success_pending'),
_t(
'_ch_events_event_leave_success'));
333 header(
'Content-type:text/html;charset=utf-8');
335 $iEventId = (int)$iEventId;
336 if (!($aEvent = $this->_oDb->getEntryByIdAndOwner($iEventId, 0,
true))) {
344 $a =
$oPage->getBlockCode_Participants();
351 parent::_actionSharePopup($iEntryId,
_t(
'_ch_events_caption_share_event'));
356 parent::_actionManageFansPopup($iEntryId,
_t(
'_ch_events_caption_manage_fans'),
'getFans',
362 parent::_actionTags(
_t(
'_ch_events_tags'));
367 parent::_actionCategories(
_t(
'_ch_events_categories'));
372 $aFileInfo = $this->_oDb->getMedia((
int)$iEntryId, (
int)$iMediaId,
'files');
374 if (!$aFileInfo || !($aDataEntry = $this->_oDb->getEntryByIdAndOwner((
int)$iEntryId, 0,
true))) {
375 $this->_oTemplate->displayPageNotFound();
380 $this->_oTemplate->displayAccessDenied();
384 parent::_actionDownload($aFileInfo,
'media_id');
396 if (!$this->_oDb->isAnyPublicContent()) {
402 $o->sUrlStart = CH_WSB_URL_ROOT .
'?';
404 $sDefaultHomepageTab = $this->_oDb->getParam(
'ch_events_homepage_default_tab');
405 $sBrowseMode = $sDefaultHomepageTab;
406 switch (
$_GET[
'ch_events_filter']) {
412 case $sDefaultHomepageTab:
413 $sBrowseMode =
$_GET[
'ch_events_filter'];
417 return $o->ajaxBrowse(
419 $this->_oDb->getParam(
'ch_events_perpage_homepage'),
421 _t(
'_ch_events_tab_upcoming') => array(
422 'href' => CH_WSB_URL_ROOT .
'?ch_events_filter=upcoming',
423 'active' =>
'upcoming' == $sBrowseMode,
426 _t(
'_ch_events_tab_featured') => array(
427 'href' => CH_WSB_URL_ROOT .
'?ch_events_filter=featured',
428 'active' =>
'featured' == $sBrowseMode,
431 _t(
'_ch_events_tab_recent') => array(
432 'href' => CH_WSB_URL_ROOT .
'?ch_events_filter=recent',
433 'active' =>
'recent' == $sBrowseMode,
436 _t(
'_ch_events_tab_top') => array(
437 'href' => CH_WSB_URL_ROOT .
'?ch_events_filter=top',
438 'active' =>
'top' == $sBrowseMode,
441 _t(
'_ch_events_tab_popular') => array(
442 'href' => CH_WSB_URL_ROOT .
'?ch_events_filter=popular',
443 'active' =>
'popular' == $sBrowseMode,
464 return $o->ajaxBrowse(
466 $this->_oDb->getParam(
'ch_events_perpage_profile'),
488 return $o->ajaxBrowse(
490 $this->_oDb->getParam(
'ch_events_perpage_profile'),
505 parent::_serviceGetMemberMenuItem(
_t(
'_ch_events'),
_t(
'_ch_events'),
'calendar');
519 return parent::_serviceGetMemberMenuItem(
_t(
'_ch_events_single'),
_t(
'_ch_events_single'),
'calendar',
false,
520 '&ch_events_filter=add_event');
526 'icon' =>
'calendar',
527 'txt_object' =>
'_ch_events_wall_object',
528 'txt_added_new_single' =>
'_ch_events_wall_added_new',
529 'txt_added_new_title_single' =>
'_ch_events_wall_added_new_title',
530 'txt_added_new_plural' =>
'_ch_events_wall_added_new_items',
531 'txt_added_new_title_plural' =>
'_ch_events_wall_added_new_title_items',
532 'txt_privacy_view_event' =>
'view_event',
533 'obj_privacy' => $this->_oPrivacy,
535 'owner' =>
'ResponsibleID',
540 return parent::_serviceGetWallPost($aEvent, $aParams);
546 'txt_privacy_view_event' =>
'view_event',
547 'obj_privacy' => $this->_oPrivacy
550 return parent::_serviceGetWallAddComment($aEvent, $aParams);
559 'txt_privacy_view_event' =>
'view_event',
560 'obj_privacy' => $this->_oPrivacy
563 return parent::_serviceGetWallPostComment($aEvent, $aParams);
569 $aObjectIds = strpos($aEvent[
'object_id'],
',') !==
false ? explode(
',',
570 $aEvent[
'object_id']) : array($aEvent[
'object_id']);
571 foreach ($aObjectIds
as $iId) {
572 $aItem = $this->_oDb->getEntryByIdAndOwner(
$iId, $aEvent[
'owner_id'], 1);
573 if ($aItem && $aItem[
'EventEnd'] >
time()) {
577 if (
empty($aItems)) {
580 $aEvent[
'object_id'] = join(
',', $aItems);
583 'txt_privacy_view_event' =>
'view_event',
584 'obj_privacy' => $this->_oPrivacy,
585 'templates' => array(
586 'grouped' =>
'wall_outline_grouped'
590 return parent::_serviceGetWallPostOutline($aEvent,
'calendar', $aParams);
595 return parent::_serviceGetSpyPost(
$sAction, $iObjectId, $iSenderId, $aExtraParams, array(
596 'add' =>
'_ch_events_spy_post',
597 'change' =>
'_ch_events_spy_post_change',
598 'join' =>
'_ch_events_spy_join',
599 'rate' =>
'_ch_events_spy_rate',
600 'commentPost' =>
'_ch_events_spy_comment',
607 'change' =>
_t(
'_ch_events_sbs_change'),
608 'commentPost' =>
_t(
'_ch_events_sbs_comment'),
609 'rate' =>
_t(
'_ch_events_sbs_rate'),
610 'join' =>
_t(
'_ch_events_sbs_join'),
613 return parent::_serviceGetSubscriptionParams(
$sAction, $iEntryId, $a);
629 'title' =>
'_ch_events',
630 'title_singular' =>
'_ch_events_single',
631 'icon' =>
'modules/cheetah/events/|map_marker.png',
632 'icon_site' =>
'calendar',
633 'join_table' =>
'ch_events_main',
635 'join_field_id' =>
'ID',
636 'join_field_country' =>
'Country',
637 'join_field_city' =>
'City',
638 'join_field_state' =>
'',
639 'join_field_zip' =>
'',
640 'join_field_address' =>
'Place',
641 'join_field_title' =>
'Title',
642 'join_field_uri' =>
'EntryUri',
643 'join_field_author' =>
'ResponsibleID',
644 'join_field_privacy' =>
'allow_view_event_to',
645 'permalink' =>
'modules/?r=events/view/',
655 if (!$this->_oDb->isModule(
'wmap'))
671 $this->_oTemplate->displayAccessDenied();
677 $sDir = CH_DIRECTORY_PATH_MODULES .
$GLOBALS[
'aModule'][
'path'] .
'classes/';
678 if ($h = opendir($sDir)) {
679 while (
false !== (
$f = readdir($h))) {
680 if (
$f ==
"." ||
$f ==
".." || substr(
$f, -4) !=
'.php') {
683 $s = file_get_contents($sDir .
$f);
684 if (preg_match_all(
"/_t[\s]*\([\s]*['\"]{1}(.*?)['\"]{1}[\s]*\)/",
$s, $m)) {
685 foreach ($m[1]
as $sKey) {
694 echo
"\$aLangContent = array(\n";
696 foreach ($a
as $sKey) {
697 if (preg_match(
'/^_ch_events/', $sKey)) {
698 echo
"\t'$sKey' => '" . (
_t($sKey) == $sKey ?
'' :
_t($sKey)) .
"',\n";
709 $this->_oTemplate->displayAccessDenied();
714 $this->_oTemplate->pageStart();
718 'title' =>
_t(
'_ch_events_pending_approval'),
719 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/home',
721 'name' =>
'actionAdministrationManage',
722 'params' => array(
false,
'administration/home')
725 'admin_entries' => array(
726 'title' =>
_t(
'_ch_events_administration_admin_events'),
727 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/admin_entries',
729 'name' =>
'actionAdministrationManage',
730 'params' => array(
true,
'administration/admin_entries')
734 'title' =>
_t(
'_ch_events_administration_create_event'),
735 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/create',
736 '_func' => array(
'name' =>
'actionAdministrationCreateEntry',
'params' => array()),
739 'title' =>
_t(
'_ch_events_administration_settings'),
740 'href' => CH_WSB_URL_ROOT . $this->_oConfig->getBaseUri() .
'administration/settings',
741 '_func' => array(
'name' =>
'actionAdministrationSettings',
'params' => array()),
753 echo $this->_oTemplate->adminBlock(
$sContent,
_t(
'_ch_events_administration'),
$aMenu);
754 $this->_oTemplate->addCssAdmin(array(
762 $this->_oTemplate->pageCodeAdmin(
_t(
'_ch_events_administration'));
767 return parent::_actionAdministrationSettings(
'Events');
772 return parent::_actionAdministrationManage($isAdminEntries,
'_ch_events_admin_delete',
773 '_ch_events_admin_activate',
$sUrl);
785 parent::_onEventJoinReject($iEntryId,
$iProfileId, $aDataEntry,
'ch_events_join_reject');
790 parent::_onEventFanRemove($iEntryId,
$iProfileId, $aDataEntry,
'ch_events_fan_remove');
795 parent::_onEventFanBecomeAdmin($iEntryId,
$iProfileId, $aDataEntry,
'ch_events_fan_become_admin');
800 parent::_onEventAdminBecomeFan($iEntryId,
$iProfileId, $aDataEntry,
'ch_events_admin_become_fan');
805 parent::_onEventJoinConfirm($iEntryId,
$iProfileId, $aDataEntry,
'ch_events_join_confirm');
813 if ($this->
isAdmin() || $aEvent[
'ResponsibleID'] == $this->_iProfileId) {
819 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_VIEW, $isPerformAction);
825 return $this->_oPrivacy->check(
'view_event', $aEvent[
'ID'], $this->_iProfileId);
834 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_BROWSE, $isPerformAction);
845 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_SEARCH, $isPerformAction);
855 if (!
$GLOBALS[
'logged'][
'member']) {
859 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_ADD, $isPerformAction);
866 if ($this->
isAdmin() || (
$GLOBALS[
'logged'][
'member'] && $aEvent[
'ResponsibleID'] == $this->_iProfileId &&
isProfileActive($this->_iProfileId))) {
870 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_EDIT_ANY_EVENT, $isPerformAction);
881 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_MARK_AS_FEATURED, $isPerformAction);
888 if ($this->
isAdmin() || (
$GLOBALS[
'logged'][
'member'] && $aDataEntry[
'ResponsibleID'] == $this->_iProfileId &&
isProfileActive($this->_iProfileId))) {
892 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_BROADCAST_MESSAGE, $isPerformAction);
899 if ($this->
isAdmin() || (
$GLOBALS[
'logged'][
'member'] && $aEvent[
'ResponsibleID'] == $this->_iProfileId &&
isProfileActive($this->_iProfileId))) {
903 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_DELETE_ANY_EVENT, $isPerformAction);
910 if ($aEvent[
'Status'] !=
'pending') {
917 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_APPROVE, $isPerformAction);
924 if (!$this->_iProfileId) {
927 if ($aDataEntry[
'EventEnd'] <
time()) {
930 $isAllowed = $this->_oPrivacy->check(
'join', $aDataEntry[
'ID'], $this->_iProfileId);
937 if (!$aEvent[
'EventMembershipFilter']) {
941 require_once(CH_DIRECTORY_PATH_INC .
'membership_levels.inc.php');
944 return $aEvent[
'EventMembershipFilter'] == $aMemebrshipInfo[
'ID'];
949 return ($aEvent[
'ResponsibleID'] == $this->_iProfileId && (
$GLOBALS[
'logged'][
'member'] ||
$GLOBALS[
'logged'][
'admin']) &&
isProfileActive($this->_iProfileId));
963 if (($aEvent[
'ResponsibleID'] == $this->_iProfileId &&
$GLOBALS[
'logged'][
'member'] &&
isProfileActive($this->_iProfileId)) || $this->
isAdmin()) {
967 return $this->_oPrivacy->check(
'view_participants', $aEvent[
'ID'], $this->_iProfileId);
972 if (($aEvent[
'ResponsibleID'] == $this->_iProfileId &&
$GLOBALS[
'logged'][
'member'] &&
isProfileActive($this->_iProfileId)) || $this->
isAdmin()) {
976 return $this->_oPrivacy->check(
'comment', $aEvent[
'ID'], $this->_iProfileId);
984 if (!$this->_iProfileId) {
994 return $this->_oPrivacy->check(
'upload_photos', $aDataEntry[
'ID'], $this->_iProfileId);
1002 if (!$this->_iProfileId) {
1012 return $this->_oPrivacy->check(
'upload_videos', $aDataEntry[
'ID'], $this->_iProfileId);
1020 if (!$this->_iProfileId) {
1030 return $this->_oPrivacy->check(
'upload_sounds', $aDataEntry[
'ID'], $this->_iProfileId);
1038 if (!$this->_iProfileId) {
1048 return $this->_oPrivacy->check(
'upload_files', $aDataEntry[
'ID'], $this->_iProfileId);
1056 if (!
$GLOBALS[
'logged'][
'member'] || $aEvent[
'ResponsibleID'] != $this->_iProfileId) {
1060 $aCheck =
checkAction($this->_iProfileId, CH_EVENTS_COMMENTS_DELETE_AND_EDIT, $isPerformAction);
1067 if (($aEvent[
'ResponsibleID'] == $this->_iProfileId &&
$GLOBALS[
'logged'][
'member'] &&
isProfileActive($this->_iProfileId)) || $this->
isAdmin()) {
1071 return $this->_oPrivacy->check(
'rate', $aEvent[
'ID'], $this->_iProfileId);
1096 if ((
$GLOBALS[
'logged'][
'member'] ||
$GLOBALS[
'logged'][
'admin']) && $aDataEntry[
'ResponsibleID'] == $this->_iProfileId &&
isProfileActive($this->_iProfileId)) {
1114 return $this->_oDb->isFan($aDataEntry[
'ID'],
$iProfileId, $isConfirmed) ?
true :
false;
1136 'events comments delete and edit',
1137 'events edit any event',
1138 'events delete any event',
1139 'events mark as featured',
1141 'events broadcast message'
1149 parent::_browseMy(
$aProfile,
_t(
'_ch_events_block_my_events'));
1154 return $this->_oTemplate->filterDateUTC($aEvent[
'EventStart']);
1159 $sFlag = $isFlag ?
' ' .
genFlag($aEvent[
'Country']) :
'';
1161 if ($isCountryLink) {
1162 $sCountry =
'<a href="' . $this->_oConfig->getBaseUri() .
'browse/country/' . strtolower($aEvent[
'Country']) .
'">' .
$sCountry .
'</a>';
1165 return (trim($aEvent[
'Place']) ? $aEvent[
'Place'] .
', ' :
'') . (trim($aEvent[
'City']) ? $aEvent[
'City'] .
', ' :
'') .
$sCountry . $sFlag;
1170 return $this->_oTemplate->parseHtmlByName(
'wall_outline_extra_info', array(
1174 'participants' => $aEntryData[
'FansCount'],
1180 if (
'on' ==
getParam(
'ch_events_only_upcoming_events_on_map'))
1181 return "AND `p`.`Status` = 'approved' AND `EventEnd` > UNIX_TIMESTAMP()";
1183 return "AND `p`.`Status` = 'approved'";