예제 #1
0
 /**
  * Method to display group creation form
  **/
 public function create($data)
 {
     $config = CFactory::getConfig();
     $document = JFactory::getDocument();
     $document->setTitle(JText::_('COM_COMMUNITY_GROUPS_CREATE_NEW_GROUP'));
     $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js');
     CAssets::attach($js, 'js');
     $this->showSubmenu();
     $my = CFactory::getUser();
     $model = CFactory::getModel('groups');
     $totalGroup = $model->getGroupsCreationCount($my->id);
     //initialize default value
     $group =& JTable::getInstance('Group', 'CTable');
     $group->name = JRequest::getVar('name', '', 'POST');
     $group->description = JRequest::getVar('description', '', 'POST');
     $group->email = JRequest::getVar('email', '', 'POST');
     $group->website = JRequest::getVar('website', '', 'POST');
     $group->categoryid = JRequest::getVar('categoryid', '');
     $params = $group->getParams();
     $photopermission = $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ADMINS || $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ALL || $params->get('photopermission') == '' ? 1 : 0;
     $videopermission = $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS || $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS || $params->get('videopermission') == '' ? 1 : 0;
     $eventpermission = $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS || $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS || $params->get('eventpermission') == '' ? 1 : 0;
     $group->discussordering = JRequest::getInt('discussordering', $params->get('discussordering'), 'POST');
     $group->grouprecentphotos = JRequest::getInt('grouprecentphotos', $params->get('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT), 'POST');
     $group->grouprecentvideos = JRequest::getInt('grouprecentvideos', $params->get('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT), 'POST');
     $group->grouprecentevents = JRequest::getInt('grouprecentevents', $params->get('grouprecentevents', GROUP_EVENT_RECENT_LIMIT), 'POST');
     $group->photopermission = JRequest::getInt('photopermission-admin', $photopermission, 'POST');
     $group->videopermission = JRequest::getInt('videopermission-admin', $videopermission, 'POST');
     $group->eventpermission = JRequest::getInt('eventpermission-admin', $eventpermission, 'POST');
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-groups-form'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     // Load category tree
     CFactory::load('helpers', 'category');
     $cTree = CCategoryHelper::getCategories($data->categories);
     $lists['categoryid'] = CCategoryHelper::getSelectList('groups', $cTree, $group->categoryid);
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     CFactory::load('libraries', 'editor');
     $editor = new CEditor($editorType);
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('config', $config)->set('lists', $lists)->set('categories', $data->categories)->set('group', $group)->set('groupCreated', $totalGroup)->set('groupCreationLimit', $config->get('groupcreatelimit'))->set('params', $group->getParams())->set('isNew', true)->set('editor', $editor)->fetch('groups.forms');
 }
예제 #2
0
 /**
  * Add default items for status box
  */
 static function addDefaultStatusCreator(&$status)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $my = CFactory::getUser();
     $userid = $jinput->get('userid', $my->id, 'INT');
     //JRequest::getVar('userid', $my->id);
     $user = CFactory::getUser($userid);
     $config = CFactory::getConfig();
     $template = new CTemplate();
     $isMine = COwnerHelper::isMine($my->id, $user->id);
     /* Message creator */
     $creator = new CUserStatusCreator('message');
     $creator->title = JText::_('COM_COMMUNITY_STATUS');
     $creator->html = $template->fetch('status.message');
     $status->addCreator($creator);
     if ($isMine) {
         if ($config->get('enablephotos')) {
             /* Photo creator */
             $creator = new CUserStatusCreator('photo');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_PHOTO');
             $creator->html = $template->fetch('status.photo');
             $status->addCreator($creator);
         }
         if ($config->get('enablevideos')) {
             /* Video creator */
             $creator = new CUserStatusCreator('video');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_VIDEO');
             $creator->html = $template->fetch('status.video');
             $status->addCreator($creator);
         }
         if ($config->get('enableevents') && ($config->get('createevents') || COwnerHelper::isCommunityAdmin())) {
             /* Event creator */
             //CFactory::load( 'helpers' , 'event' );
             $dateSelection = CEventHelper::getDateSelection();
             $model = CFactory::getModel('events');
             $categories = $model->getCategories();
             // Load category tree
             $cTree = CCategoryHelper::getCategories($categories);
             $lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree);
             $template->set('startDate', $dateSelection->startDate);
             $template->set('endDate', $dateSelection->endDate);
             $template->set('startHourSelect', $dateSelection->startHour);
             $template->set('endHourSelect', $dateSelection->endHour);
             $template->set('startMinSelect', $dateSelection->startMin);
             $template->set('repeatEnd', $dateSelection->endDate);
             $template->set('enableRepeat', $my->authorise('community.view', 'events.repeat'));
             $template->set('endMinSelect', $dateSelection->endMin);
             $template->set('startAmPmSelect', $dateSelection->startAmPm);
             $template->set('endAmPmSelect', $dateSelection->endAmPm);
             $template->set('lists', $lists);
             $creator = new CUserStatusCreator('event');
             $creator->title = JText::_('COM_COMMUNITY_SINGULAR_EVENT');
             $creator->html = $template->fetch('status.event');
             $status->addCreator($creator);
         }
     }
 }
예제 #3
0
 static function getEventInstance()
 {
     $template = new CTemplate();
     $my = CFactory::getUser();
     //CFactory::load( 'helpers' , 'event' );
     $dateSelection = CEventHelper::getDateSelection();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     // Load category tree
     $cTree = CCategoryHelper::getCategories($categories);
     $lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree);
     $template->set('startDate', $dateSelection->startDate);
     $template->set('endDate', $dateSelection->endDate);
     $template->set('startHourSelect', $dateSelection->startHour);
     $template->set('endHourSelect', $dateSelection->endHour);
     $template->set('startMinSelect', $dateSelection->startMin);
     $template->set('endMinSelect', $dateSelection->endMin);
     $template->set('startAmPmSelect', $dateSelection->startAmPm);
     $template->set('endAmPmSelect', $dateSelection->endAmPm);
     $template->set('repeatEnd', $dateSelection->endDate);
     $template->set('enableRepeat', $my->authorise('community.view', 'events.repeat'));
     $template->set('lists', $lists);
     $creator = new CUserStatusCreator('event');
     $creator->title = JText::_('COM_COMMUNITY_EVENTS');
     $creator->html = $template->fetch('status.event');
     return $creator;
 }
예제 #4
0
 /**
  * Method to display the create / edit event's form.
  * Both views share the same template file.
  * */
 public function _displayForm($event)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     $now = JFactory::getDate();
     $groupid = $jinput->get('groupid', '', 'INT');
     //J1.6 returns timezone as string, not integer offset.
     $systemOffset = new JDate('now', $mainframe->getCfg('offset'));
     $systemOffset = $systemOffset->getOffsetFromGMT(true);
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     $editor = new CEditor($editorType);
     $totalEventCount = $model->getEventsCreationCount($my->id);
     if ($event->catid == null) {
         $event->catid = JRequest::getInt('categoryid', 0);
     }
     $event->startdatetime = $jinput->post->get('startdatetime', '00:01', 'NONE');
     $event->enddatetime = $jinput->post->get('enddatetime', '23:59', 'NONE');
     $timezones = CTimeHelper::getBeautifyTimezoneList();
     $helper = CEventHelper::getHandler($event);
     $startDate = $event->getStartDate(false);
     $endDate = $event->getEndDate(false);
     $repeatEndDate = $event->getRepeatEndDate();
     $dateSelection = CEventHelper::getDateSelection($startDate, $endDate);
     // Load category tree
     $cTree = CCategoryHelper::getCategories($categories);
     $lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree, $event->catid, true);
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('createEvent'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     //to invite group members if this event creation belongs to a group and members is more than 1
     $showGroupMemberInvitation = false;
     if ($groupid) {
         $group = JTable::getInstance('Group', 'CTable');
         $group->load($groupid);
         $showGroupMemberInvitation = $group->getMembersCount() > 1 ? true : false;
     }
     $tmpl = new CTemplate();
     echo $tmpl->set('startDate', $startDate)->set('showGroupMemberInvitation', $showGroupMemberInvitation)->set('endDate', $endDate)->set('enableRepeat', $my->authorise('community.view', 'events.repeat'))->set('repeatEndDate', $repeatEndDate)->set('startHourSelect', $dateSelection->startHour)->set('endHourSelect', $dateSelection->endHour)->set('startMinSelect', $dateSelection->startMin)->set('endMinSelect', $dateSelection->endMin)->set('startAmPmSelect', $dateSelection->startAmPm)->set('endAmPmSelect', $dateSelection->endAmPm)->set('timezones', $timezones)->set('params', new CParameter($event->params))->set('config', $config)->set('systemOffset', $systemOffset)->set('lists', $lists)->set('categories', $categories)->set('event', $event)->set('editor', $editor)->set('helper', $helper)->set('now', $now->format('%Y-%m-%d'))->set('eventCreated', $totalEventCount)->set('eventcreatelimit', $config->get('eventcreatelimit'))->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->fetch('events.forms');
 }
예제 #5
0
 public function getUploadVideoHtml($creatorType = VIDEO_USER_TYPE, $contextid = 0)
 {
     $filter = JFilterInput::getInstance();
     $creatorType = $filter->clean($creatorType, 'string');
     $contextid = $filter->clean($contextid, 'int');
     $my = CFactory::getUser();
     $user = CFactory::getRequestUser();
     $params = $user->getParams();
     $permissions = $params->get('privacyVideoView');
     $model = CFactory::getModel('videos');
     $category = $model->getAllCategories();
     $cTree = CCategoryHelper::getCategories($category);
     $categories = CCategoryHelper::getSelectList('videos', $cTree, null, true);
     $config = CFactory::getConfig();
     $uploadLimit = $config->get('maxvideouploadsize', ini_get('upload_max_filesize'));
     list($totalVideos, $videoUploadLimit) = $this->_getParameter($creatorType, $config);
     $tmpl = new CTemplate();
     $tmpl->set('categories', $categories);
     $tmpl->set('uploadLimit', $uploadLimit);
     $tmpl->set('creatorType', $creatorType);
     $tmpl->set('groupid', $creatorType == VIDEO_GROUP_TYPE ? $contextid : '');
     $tmpl->set('eventid', $creatorType == VIDEO_EVENT_TYPE ? $contextid : '');
     $tmpl->set('permissions', $permissions);
     $tmpl->set('videoUploaded', $totalVideos);
     $tmpl->set('videoUploadLimit', $videoUploadLimit);
     $tmpl->set('enableLocation', $config->get('videosmapdefault'));
     $html = $tmpl->fetch('videos.upload');
     return $html;
 }
예제 #6
0
 /**
  * Method to display group creation form
  * */
 public function create($data)
 {
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', JText::_('COM_COMMUNITY_GROUPS_CREATE_NEW_GROUP'));
     $config = CFactory::getConfig();
     // $js = 'assets/validate-1.5.min.js';
     // CFactory::attach($js, 'js');
     $my = CFactory::getUser();
     $model = CFactory::getModel('groups');
     $totalGroup = $model->getGroupsCreationCount($my->id);
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     //initialize default value
     $group = JTable::getInstance('Group', 'CTable');
     $group->approvals = $jinput->get('approvals', '', 'INT');
     $group->unlisted = $jinput->get('unlisted', '', 'INT');
     $group->name = $jinput->post->get('name', '', 'STRING');
     //JRequest::getVar('name', '', 'POST');
     $group->summary = $jinput->post->get('summary', '', 'STRING');
     //JRequest::getVar('summary', '', 'POST');
     $group->description = $jinput->post->get('description', '', 'RAW');
     //JRequest::getVar('description', '', 'POST');
     $group->email = $jinput->post->get('email', '', 'STRING');
     //JRequest::getVar('email', '', 'POST');
     $group->website = $jinput->post->get('website', '', 'STRING');
     //JRequest::getVar('website', '', 'POST');
     $group->categoryid = $jinput->get('categoryid', '', 'INT');
     //JRequest::getVar('categoryid', '');
     $params = $group->getParams();
     $photopermission = $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ADMINS || $params->get('photopermission') == GROUP_PHOTO_PERMISSION_ALL || $params->get('photopermission') == '' ? 1 : 0;
     $videopermission = $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS || $params->get('videopermission') == GROUP_VIDEO_PERMISSION_ADMINS || $params->get('videopermission') == '' ? 1 : 0;
     $eventpermission = $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS || $params->get('eventpermission') == GROUP_EVENT_PERMISSION_ADMINS || $params->get('eventpermission') == '' ? 1 : 0;
     $group->discussordering = 0;
     //JRequest::getInt('discussordering', $params->get('discussordering'), 'POST');
     $group->grouprecentphotos = JRequest::getInt('grouprecentphotos', $params->get('grouprecentphotos', GROUP_PHOTO_RECENT_LIMIT), 'POST');
     $group->grouprecentvideos = JRequest::getInt('grouprecentvideos', $params->get('grouprecentvideos', GROUP_VIDEO_RECENT_LIMIT), 'POST');
     $group->grouprecentevents = JRequest::getInt('grouprecentevents', $params->get('grouprecentevents', GROUP_EVENT_RECENT_LIMIT), 'POST');
     $group->photopermission = JRequest::getInt('photopermission-admin', $photopermission, 'POST');
     $group->videopermission = JRequest::getInt('videopermission-admin', $videopermission, 'POST');
     $group->eventpermission = JRequest::getInt('eventpermission-admin', $eventpermission, 'POST');
     $app = CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('jsform-groups-form'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     // Load category tree
     $cTree = CCategoryHelper::getCategories($data->categories);
     $lists['categoryid'] = CCategoryHelper::getSelectList('groups', $cTree, $group->categoryid, true);
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     $editor = new CEditor($editorType);
     $tmpl = new CTemplate();
     echo $tmpl->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->set('config', $config)->set('lists', $lists)->set('categories', $data->categories)->set('group', $group)->set('groupCreated', $totalGroup)->set('groupCreationLimit', $config->get('groupcreatelimit'))->set('params', $group->getParams())->set('isNew', true)->set('editor', $editor)->fetch('groups.forms');
 }
예제 #7
0
 /**
  * Method to display the create / edit event's form.
  * Both views share the same template file.	 
  **/
 public function _displayForm($event)
 {
     $mainframe = JFactory::getApplication();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     $now = JFactory::getDate();
     //J1.6 returns timezone as string, not integer offset.
     if (method_exists('JDate', 'getOffsetFromGMT')) {
         $systemOffset = new CDate('now', $mainframe->getCfg('offset'));
         $systemOffset = $systemOffset->getOffsetFromGMT(true);
     } else {
         $systemOffset = $mainframe->getCfg('offset');
     }
     $now->setOffset($systemOffset);
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     CFactory::load('libraries', 'editor');
     $editor = new CEditor($editorType);
     $totalEventCount = $model->getEventsCreationCount($my->id);
     if ($event->catid == NULL) {
         $event->catid = JRequest::getInt('categoryid', 0, 'GET');
     }
     $event->startdatetime = JRequest::getVar('startdatetime', '00:01', 'POST');
     $event->enddatetime = JRequest::getVar('enddatetime', '23:59', 'POST');
     CFactory::load('helpers', 'time');
     $timezones = CTimeHelper::getTimezoneList();
     CFactory::load('helpers', 'event');
     $helper = CEventHelper::getHandler($event);
     $startDate = $event->getStartDate(false);
     $endDate = $event->getEndDate(false);
     $allday = false;
     if ($startDate->toFormat('%Y-%m-%d') == $endDate->toFormat('%Y-%m-%d') && $startDate->toFormat('%H:%M:%S') == '00:00:00' && $endDate->toFormat('%H:%M:%S') == '23:59:59') {
         $allday = true;
     }
     $dateSelection = CEventHelper::getDateSelection($startDate, $endDate);
     // Load category tree
     CFactory::load('helpers', 'category');
     $cTree = CCategoryHelper::getCategories($categories);
     $lists['categoryid'] = CCategoryHelper::getSelectList('events', $cTree, $event->catid);
     CFactory::load('libraries', 'apps');
     $app =& CAppPlugins::getInstance();
     $appFields = $app->triggerEvent('onFormDisplay', array('createEvent'));
     $beforeFormDisplay = CFormElement::renderElements($appFields, 'before');
     $afterFormDisplay = CFormElement::renderElements($appFields, 'after');
     $tmpl = new CTemplate();
     echo $tmpl->set('startDate', $startDate)->set('endDate', $endDate)->set('startHourSelect', $dateSelection->startHour)->set('endHourSelect', $dateSelection->endHour)->set('startMinSelect', $dateSelection->startMin)->set('endMinSelect', $dateSelection->endMin)->set('startAmPmSelect', $dateSelection->startAmPm)->set('endAmPmSelect', $dateSelection->endAmPm)->set('timezones', $timezones)->set('config', $config)->set('systemOffset', $systemOffset)->set('lists', $lists)->set('categories', $categories)->set('event', $event)->set('editor', $editor)->set('helper', $helper)->set('now', $now->toFormat('%Y-%m-%d'))->set('eventCreated', $totalEventCount)->set('eventcreatelimit', $config->get('eventcreatelimit'))->set('allday', $allday)->set('beforeFormDisplay', $beforeFormDisplay)->set('afterFormDisplay', $afterFormDisplay)->fetch('events.forms');
 }