Example #1
0
 private static function _getCatId($rows, $id)
 {
     if ($rows[$id]['parent'] > 0 && $rows[$id]['parent'] != $rows[$id]['id']) {
         return CCategoryHelper::_getCatId($rows, $rows[$id]['parent']) . ',' . $rows[$id]['id'];
     } else {
         return $rows[$id]['id'];
     }
 }
 /**
  * Generate category children
  *
  * @access  public
  * @returns Array  of category id
  * @since   Jomsocial 2.6
  **/
 public static function getCategoryChilds($rows, $catId)
 {
     // Reset array key
     foreach ($rows as $key => $row) {
         $row = (array) $row;
         $tmpRows[$row['id']] = $row;
     }
     self::$row = $tmpRows;
     $catTree = self::_getCatTree($catId);
     return $catTree;
 }
Example #3
0
 /**
  * Method to display the create / edit event's form.
  * Both views share the same template file.	 
  **/
 function _displayForm($event)
 {
     $mainframe = JFactory::getApplication();
     $my = CFactory::getUser();
     $config = CFactory::getConfig();
     $model = CFactory::getModel('events');
     $categories = $model->getCategories();
     $now = JFactory::getDate();
     $now->setOffset($mainframe->getCfg('offset'));
     jimport('joomla.html.editor');
     $editorType = $config->get('allowhtml') ? $config->get('htmleditor', 'none') : 'none';
     $editor = new JEditor($editorType);
     $totalEventCount = $model->getEventsCreationCount($my->id);
     $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);
     $hours = array();
     $startAmPmSelect = "";
     $endAmPmSelect = "";
     if ($config->get('eventshowampm')) {
         for ($i = 1; $i <= 12; $i++) {
             $hours[] = JHTML::_('select.option', $i, "{$i}");
         }
         // Cannot user ->toFormat('%p') since it is dependent on current locale
         // and would return a null if the system is configured for 24H
         $startAmPm = $startDate->toFormat('%H') >= 12 ? 'PM' : 'AM';
         $endAmPm = $endDate->toFormat('%H') >= 12 ? 'PM' : 'AM';
         $amPmSelect = array();
         $amPmSelect[] = JHTML::_('select.option', 'AM', "am");
         $amPmSelect[] = JHTML::_('select.option', 'PM', "pm");
         $startAmPmSelect = JHTML::_('select.genericlist', $amPmSelect, 'starttime-ampm', array('class' => 'required inputbox'), 'value', 'text', $startAmPm, false);
         $endAmPmSelect = JHTML::_('select.genericlist', $amPmSelect, 'endtime-ampm', array('class' => 'required inputbox'), 'value', 'text', $endAmPm, false);
         $selectedStartHour = intval($startDate->toFormat('%I'));
         $selectedEndHour = intval($endDate->toFormat('%I'));
     } else {
         for ($i = 0; $i <= 23; $i++) {
             $hours[] = JHTML::_('select.option', $i, sprintf("%02d", $i));
         }
         $selectedStartHour = intval($startDate->toFormat('%H'));
         $selectedEndHour = intval($endDate->toFormat('%H'));
     }
     $startHourSelect = JHTML::_('select.genericlist', $hours, 'starttime-hour', array('class' => 'required inputbox'), 'value', 'text', $selectedStartHour, false);
     $endHourSelect = JHTML::_('select.genericlist', $hours, 'endtime-hour', array('class' => 'required inputbox'), 'value', 'text', $selectedEndHour, false);
     $minutes = array();
     $minutes[] = JHTML::_('select.option', 0, "00");
     $minutes[] = JHTML::_('select.option', 15, "15");
     $minutes[] = JHTML::_('select.option', 30, "30");
     $minutes[] = JHTML::_('select.option', 45, "45");
     $startMinSelect = JHTML::_('select.genericlist', $minutes, 'starttime-min', array('class' => 'required inputbox'), 'value', 'text', $startDate->toFormat('%M'), false);
     $endMinSelect = JHTML::_('select.genericlist', $minutes, 'endtime-min', array('class' => 'required inputbox'), 'value', 'text', $endDate->toFormat('%M'), false);
     // Load category tree
     CFactory::load('helpers', 'category');
     $cTree = CCategoryHelper::getCategories($categories);
     $lists['categoryid'] = JHTML::_('select.genericlist', $cTree, 'catid', 'size="1"', 'id', 'nodeText', $event->catid);
     $tmpl = new CTemplate();
     $tmpl->set('startDate', $startDate);
     $tmpl->set('endDate', $endDate);
     $tmpl->set('startHourSelect', $startHourSelect);
     $tmpl->set('endHourSelect', $endHourSelect);
     $tmpl->set('startMinSelect', $startMinSelect);
     $tmpl->set('endMinSelect', $endMinSelect);
     $tmpl->set('startAmPmSelect', $startAmPmSelect);
     $tmpl->set('endAmPmSelect', $endAmPmSelect);
     $tmpl->set('timezones', $timezones);
     $tmpl->set('config', $config);
     $tmpl->set('lists', $lists);
     $tmpl->set('categories', $categories);
     $tmpl->set('event', $event);
     $tmpl->set('editor', $editor);
     $tmpl->set('helper', $helper);
     $tmpl->set('now', $now->toFormat('%Y-%m-%d'));
     $tmpl->set('eventCreated', $totalEventCount);
     $tmpl->set('eventcreatelimit', $config->get('eventcreatelimit'));
     echo $tmpl->fetch('events.forms');
 }
Example #4
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);
         }
     }
 }
Example #5
0
 /**
  * showGroupsCategory
  **/
 public function getGroupsCategories($category)
 {
     $model = CFactory::getModel('groups');
     $categories = $model->getCategoriesCount();
     CFactory::load('helpers', 'category');
     $categories = CCategoryHelper::getParentCount($categories, $category);
     return $categories;
 }
Example #6
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;
 }
Example #7
0
 public function _getEventsCategories($categoryId)
 {
     $model = CFactory::getModel('events');
     $categories = $model->getCategoriesCount();
     $categories = CCategoryHelper::getParentCount($categories, $categoryId);
     return $categories;
 }
Example #8
0
 */
defined('_JEXEC') or die('Restricted access');
include_once JPATH_BASE . '/components/com_community/defines.community.php';
require_once JPATH_BASE . '/components/com_community/libraries/core.php';
JFactory::getLanguage()->isRTL() ? CTemplate::addStylesheet('style.rtl') : CTemplate::addStylesheet('style');
$default = $params->get('default');
$upcomingOnly = $params->get('upcomingOnly', false);
$default = $params->get('default');
$model = CFactory::getModel('Events');
/* Follow component */
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$categoryId = JRequest::getInt('categoryid', 0);
$category = JTable::getInstance('EventCategory', 'CTable');
$category->load($categoryId);
$sorted = $jinput->get->get('sort', 'startdate', 'STRING');
//JRequest::getVar( 'sort' , 'startdate' , 'GET' );
$eventparent = $jinput->get->get('parent', '', 'INT');
$event = JTable::getInstance('Event', 'CTable');
$handler = CEventHelper::getHandler($event);
$categories = $model->getAllCategories();
$categoryIds = CCategoryHelper::getCategoryChilds($categories, $category->id);
$result = $model->getEvents($categoryIds, null, $sorted, null, true, false, null, array('parent' => $eventparent), $handler->getContentTypes(), 0, $default, $upcomingOnly, false);
//$result = $model->getEvents(null, null, null, null, true, false, null, null, CEventHelper::ALL_TYPES, 0, $default);
$events = array();
foreach ($result as $row) {
    $event = JTable::getInstance('Event', 'CTable');
    $event->bind($row);
    $events[] = $event;
}
require JModuleHelper::getLayoutPath('mod_community_events', $params->get('layout', 'default'));
Example #9
0
 /**
  * Loads the categories
  *
  * @access	public
  * @return	array	An array of categories object
  * @since	1.2
  */
 public function getCategories($categoryId = null)
 {
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $cache = CFactory::getFastCache();
     $cacheid = serialize(func_get_args()) . serialize(JRequest::get());
     if ($data = $cache->get($cacheid)) {
         return $data;
     }
     $my = CFactory::getUser();
     $permissions = $my->id == 0 ? 0 : 20;
     $groupId = $jinput->get->get('groupid', '', 'INT');
     //JRequest::getVar('groupid' , '' , 'GET');
     $conditions = '';
     $db = $this->getDBO();
     if (!empty($groupId)) {
         $conditions = ' AND v.' . $db->quoteName('creator_type') . ' = ' . $db->quote(VIDEO_GROUP_TYPE);
         //$conditions	.= ' AND b.groupid = ' . $groupId;
         $conditions .= ' AND g.' . $db->quoteName('id') . ' = ' . $db->Quote($groupId);
     } else {
         $conditions .= ' AND (g.' . $db->quoteName('approvals') . ' = ' . $db->Quote('0') . ' OR g.' . $db->quoteName('approvals') . ' IS NULL)';
     }
     $allcats = $this->getAllCategories($categoryId);
     $allCatsNoFilter = $this->getAllCategories();
     $result = array();
     foreach ($allcats as $cat) {
         $categoryIds = CCategoryHelper::getCategoryChilds($allCatsNoFilter, $cat->id);
         if ((int) $cat->id > 0) {
             $categoryIds[] = (int) $cat->id;
         }
         if (is_array($categoryIds)) {
             $categoryIds = implode($categoryIds, ',');
             $categoryCondition = $db->quoteName('category_id') . ' IN (' . $categoryIds . ') ';
         } else {
             $categoryCondition = $db->quoteName('category_id') . ' = ' . $db->Quote($cat->id);
         }
         $query = ' SELECT COUNT(v.' . $db->quoteName('id') . ') AS count' . ' FROM ' . $db->quoteName('#__community_videos') . ' AS v' . ' LEFT JOIN ' . $db->quoteName('#__community_groups') . ' AS g ON g.' . $db->quoteName('id') . ' = v.' . $db->quoteName('groupid') . ' WHERE v.' . $categoryCondition . ' AND v.' . $db->quoteName('status') . ' = ' . $db->Quote('ready') . ' AND v.' . $db->quoteName('published') . ' = ' . $db->Quote(1) . ' AND v.' . $db->quoteName('permissions') . ' <= ' . $db->Quote($permissions) . $conditions;
         $db->setQuery($query);
         $cat->count = $db->loadResult();
         $result[] = $cat;
     }
     if ($db->getErrorNum()) {
         JError::raiseError(500, $db->stderr());
     }
     $cache->store($result, $cacheid, array(COMMUNITY_CACHE_TAG_VIDEOS_CAT));
     return $result;
 }
Example #10
0
 public function myvideos($id = null)
 {
     $document = JFactory::getDocument();
     $my = CFactory::getUser();
     $userid = JRequest::getInt('userid', $my->id);
     $user = CFactory::getUser($userid);
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $categoryId = $jinput->get('catid', 0, 'INT');
     $categoryId = $jinput->get('catid', 0, 'INT');
     $category = JTable::getInstance('VideosCategory', 'CTable');
     $category->load($categoryId);
     // Set document title
     $blocked = $user->isBlocked();
     if ($blocked && !COwnerHelper::isCommunityAdmin()) {
         $tmpl = new CTemplate();
         echo $tmpl->fetch('profile.blocked');
         return;
     }
     if ($my->id == $user->id) {
         $title = JText::_('COM_COMMUNITY_VIDEOS_MY');
     } else {
         $title = JText::sprintf('COM_COMMUNITY_VIDEOS_USERS_VIDEO_TITLE', $user->getDisplayName());
     }
     /**
      * Opengraph
      */
     CHeadHelper::setType('website', $title);
     // Set pathway
     $mainframe = JFactory::getApplication();
     $jinput = $mainframe->input;
     $this->addPathway(JText::_('COM_COMMUNITY_VIDEOS'), CRoute::_('index.php?option=com_community&view=videos'));
     $this->addPathway($title);
     $feedLink = CRoute::_('index.php?option=com_community&view=videos&userid=' . $user->id . '&format=feed');
     $feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('COM_COMMUNITY_SUBSCRIBE_MY_VIDEOS_FEED') . '" href="' . $feedLink . '"/>';
     $document->addCustomTag($feed);
     // Show the mini header when viewing other's photos
     if ($my->id != $user->id) {
         $this->attachMiniHeaderUser($user->id);
     }
     // Display submenu
     $this->_addSubmenu();
     // Get data from DB
     $model = CFactory::getModel('videos');
     //CFactory::load( 'helpers' , 'friends' );
     if ($my->id == $user->id || COwnerHelper::isCommunityAdmin()) {
         $permission = 40;
     } elseif (CFriendsHelper::isConnected($my->id, $user->id)) {
         $permission = 30;
     } elseif ($my->id != 0) {
         $permission = 20;
     } else {
         $permission = 10;
     }
     // Get in category and it's children.
     $categories = $model->getAllCategories();
     $categoryIds = CCategoryHelper::getCategoryChilds($categories, $category->id);
     $categoryIds[] = $categoryId;
     $filters = array('creator' => $user->id, 'category_id' => $categoryIds, 'status' => 'ready', 'sorting' => $jinput->get('sort', 'latest', 'STRING'), 'permissions' => $permission);
     $videos = $model->getVideos($filters);
     $sortItems = $this->_getSortOptions();
     //pagination
     $pagination = $model->getPagination();
     $videosHTML = $this->_getVideosHTML($videos, $pagination);
     //This is local file
     $categories = $this->getFullVideoCategories();
     $sortItems = $this->_getSortOptions();
     $allVideosUrl = 'index.php?option=com_community&view=videos';
     $catVideoUrl = 'index.php?option=com_community&view=videos&task=myvideos&userid=' . $userid . '&catid=';
     $pendingVideos = $this->model->hasPendingVideos($my->id, VIDEO_USER_TYPE);
     $tmpl = new CTemplate();
     $tmpl->set('user', $user)->set('sort', $jinput->get('sort', 'latest', 'STRING'))->set('currentTask', JRequest::getCmd('task', ''))->set('isMyVideo', true)->set('videosHTML', $videosHTML)->set('$category', $category)->set('categories', $categories)->set('currentUrl', CRoute::getURI())->set('allVideosUrl', $allVideosUrl)->set('catVideoUrl', $catVideoUrl)->set('categories', $this->getFullVideoCategories())->set('category', $category)->set('categoryId', $categoryId)->set('pendingVideos', $pendingVideos)->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->set('submenu', $this->showSubmenu(false))->set('pagination', $pagination);
     if ($userid == $my->id) {
         $tmpl->set('canCreate', $my->authorise('community.create', 'videos'));
     } else {
         $tmpl->set('canCreate', 0);
     }
     echo $tmpl->fetch('videos/base');
 }
Example #11
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;
 }
Example #12
0
 * @url https://www.jomsocial.com/license-agreement
 * The PHP code portions are distributed under the GPL license. If not otherwise stated, all images, manuals, cascading style sheets, and included JavaScript *are NOT GPL, and are released under the IJOOMLA Proprietary Use License v1.0
 * More info at https://www.jomsocial.com/license-agreement
 */
defined('_JEXEC') or die;
// Event categories.
$rawEventCategories = CFactory::getModel('events')->getCategories();
$eventCategories = array();
if (count($rawEventCategories) >= 1) {
    foreach ($rawEventCategories as $index => $value) {
        $eventCategories[] = array('id' => $value->id, 'name' => JText::_($value->name));
    }
}
// Video categories.
$rawVideoCategories = CFactory::getModel('videos')->getAllCategories();
$rawVideoCategories = CCategoryHelper::getCategories($rawVideoCategories);
foreach ($rawVideoCategories as $key => $row) {
    $nodeText[$key] = $row['nodeText'];
}
array_multisort(array_map('strtolower', $nodeText), SORT_ASC, $rawVideoCategories);
$videoCategories = array();
if (count($rawVideoCategories) >= 1) {
    foreach ($rawVideoCategories as $index => $value) {
        $videoCategories[] = array('id' => $value['id'], 'name' => JText::_($value['name']), 'parent' => $value['parent']);
    }
}
?>

<script>
  joms || (joms = {});
  joms.constants || (joms.constants = {});
Example #13
0
 /**
  * Method to display group creation form
  **/
 function create($data)
 {
     $config = CFactory::getConfig();
     $document =& JFactory::getDocument();
     $document->setTitle(JText::_('CC CREATE NEW GROUP TITLE'));
     $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', '');
     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'] = JHTML::_('select.genericlist', $cTree, 'categoryid', 'size="1"', 'id', 'nodeText');
     $tmpl = new CTemplate();
     $tmpl->set('beforeFormDisplay', $beforeFormDisplay);
     $tmpl->set('afterFormDisplay', $afterFormDisplay);
     $tmpl->set('config', $config);
     $tmpl->set('lists', $lists);
     $tmpl->set('categories', $data->categories);
     $tmpl->set('group', $group);
     $tmpl->set('groupCreated', $totalGroup);
     $tmpl->set('groupCreationLimit', $config->get('groupcreatelimit'));
     $tmpl->set('params', $group->getParams());
     $tmpl->set('isNew', true);
     echo $tmpl->fetch('groups.forms');
 }
Example #14
0
 /**
  * showAllGroups
  * */
 public function getShowAllGroups($category, $sorted)
 {
     $model = CFactory::getModel('groups');
     // Get group in category and it's children.
     $categories = $model->getAllCategories();
     $categoryIds = CCategoryHelper::getCategoryChilds($categories, $category);
     if ((int) $category > 0) {
         $categoryIds[] = (int) $category;
     }
     // It is safe to pass 0 as the category id as the model itself checks for this value.
     $data = new StdClass();
     $data->groups = $model->getAllGroups($categoryIds, $sorted);
     // Get pagination object
     $data->pagination = $model->getPagination();
     // Get the template for the group lists
     $groupsHTML['HTML'] = $this->_getGroupsHTML($data->groups, $data->pagination);
     return $groupsHTML;
 }