public function _addSubmenu() { $mySQLVer = 0; if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL')); $tmpl = new CTemplate(); $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search')); $html = $tmpl->fetch('search.submenu'); $this->addSubmenuItem('index.php?option=com_community&view=search', JText::_('COM_COMMUNITY_SEARCH_FRIENDS'), 'joms.videos.toggleSearchSubmenu(this)', SUBMENU_LEFT, $html); if ($mySQLVer >= 4.1) { $this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH')); } $this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('COM_COMMUNITY_INVITE_FRIENDS')); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('COM_COMMUNITY_FRIENDS_REQUEST_SENT')); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('COM_COMMUNITY_FRIENDS_PENDING_APPROVAL')); }
public function _addSubmenu() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $task = $jinput->get('task', ''); if (JFile::exists(JPATH_COMPONENT . '/libraries/advancesearch.php')) { require_once JPATH_COMPONENT . '/libraries/advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } if ($task != 'sent' && $task != 'pending') { $this->addSubmenuItem('index.php?option=com_community&view=friends', JText::_('COM_COMMUNITY_FRIENDS_VIEW_ALL')); //$this->addSubmenuItem('index.php?option=com_community&view=search&task=advancesearch', JText::_('COM_COMMUNITY_CUSTOM_SEARCH')); //$this->addSubmenuItem('index.php?option=com_community&view=friends&task=invite', JText::_('COM_COMMUNITY_INVITE_FRIENDS')); } $tmpl = new CTemplate(); $tmpl->set('url', CRoute::_('index.php?option=com_community&view=search')); $html = $tmpl->fetch('search.submenu'); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=sent', JText::_('COM_COMMUNITY_FRIENDS_REQUEST_SENT')); $this->addSubmenuItem('index.php?option=com_community&view=friends&task=pending', JText::_('COM_COMMUNITY_FRIENDS_PENDING_APPROVAL')); }
public function advanceSearch() { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $document = JFactory::getDocument(); //load calendar behavior JHtml::_('behavior.calendar'); JHtml::_('behavior.tooltip'); /** * Opengraph */ CHeadHelper::setType('website', JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); //$this->showSubMenu(); $this->addPathway(JText::_('COM_COMMUNITY_TITLE_CUSTOM_SEARCH')); $profileType = $jinput->get('profiletype', 0, 'INT'); $my = CFactory::getUser(); $config = CFactory::getConfig(); $result = null; $fields = CAdvanceSearch::getFields($profileType); $data = new stdClass(); $post = JRequest::get('GET'); $keyList = isset($post['key-list']) ? $post['key-list'] : ''; $avatarOnly = $jinput->get('avatar', '', 'NONE'); if (JString::strlen($keyList) > 0) { //formatting the assoc array $filter = array(); $key = explode(',', $keyList); $joinOperator = isset($post['operator']) ? $post['operator'] : ''; foreach ($key as $idx) { $obj = new stdClass(); $obj->field = $post['field' . $idx]; $obj->condition = $post['condition' . $idx]; $obj->fieldType = $post['fieldType' . $idx]; if ($obj->fieldType == 'email') { $obj->condition = 'equal'; } // we need to check whether the value contain start and end kind of values. // if yes, make them an array. if (isset($post['value' . $idx . '_2'])) { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $endDate = empty($post['value' . $idx . '_2']) ? '01/01/1970' : $post['value' . $idx . '_2']; // Joomla 1.5 uses "/" // Joomla 1.6 uses "-" $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); $edate = explode($delimeter, $endDate); if (isset($sdate[2]) && isset($edate[2])) { $obj->value = array($sdate[0] . '-' . $sdate[1] . '-' . $sdate[2] . ' 00:00:00', $edate[0] . '-' . $edate[1] . '-' . $edate[2] . ' 23:59:59'); } else { $obj->value = array(0, 0); } } else { $obj->value = array($post['value' . $idx], $post['value' . $idx . '_2']); } } else { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $delimeter = '-'; if (strpos($startDate, '/')) { $delimeter = '/'; } $sdate = explode($delimeter, $startDate); if (isset($sdate[2])) { $obj->value = $sdate[2] . '-' . $sdate[1] . '-' . $sdate[0] . ' 00:00:00'; } else { $obj->value = 0; } } else { if ($obj->fieldType == 'checkbox') { if (empty($post['value' . $idx])) { //this mean user didnot check any of the option. $obj->value = ''; } else { $obj->value = isset($post['value' . $idx]) ? implode(',', $post['value' . $idx]) : ''; } } else { $obj->value = isset($post['value' . $idx]) ? $post['value' . $idx] : ''; } } } $filter[] = $obj; } $data->search = CAdvanceSearch::getResult($filter, $joinOperator, $avatarOnly, '', $profileType); $data->filter = $post; } $rows = !empty($data->search) ? $data->search->result : array(); $pagination = !empty($data->search) ? $data->search->pagination : ''; $filter = !empty($data->filter) ? $data->filter : array(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; //filter the user profile type if ($profileType && $row->_profile_id != $profileType) { continue; } $obj = new stdClass(); $obj->user = $row; $obj->friendsCount = $row->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $row->id ? true : false; $resultRows[] = $obj; } if (class_exists('Services_JSON')) { $json = new Services_JSON(); } else { require_once AZRUL_SYSTEM_PATH . '/pc_includes/JSON.php'; $json = new Services_JSON(); } $tmpl = new CTemplate(); $multiprofileArr = array(); $hasMultiprofile = false; //let see if we have any multiprofile enabled if ($config->get('profile_multiprofile')) { $hasMultiprofile = true; //lets get the available profile $profileModel = CFactory::getModel('Profile'); $profiles = $profileModel->getProfileTypes(); if ($profiles) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch'), 'name' => JText::_('COM_COMMUNITY_ALL_PROFILE'), 'selected' => !$profileType ? 1 : 0); foreach ($profiles as $profile) { $multiprofileArr[] = array('url' => CRoute::_('index.php?option=com_community&view=search&task=advancesearch&profiletype=' . $profile->id), 'name' => $profile->name, 'selected' => $profile->id == $profileType ? 1 : 0); } } } $searchForm = $tmpl->set('fields', $fields)->set('hasMultiprofile', $hasMultiprofile)->set('multiprofileArr', $multiprofileArr)->set('keyList', $keyList)->set('profileType', $profileType)->set('avatarOnly', $avatarOnly)->set('filterJson', $json->encode($filter))->set('postresult', isset($post['key-list']))->set('submenu', $this->showSubmenu(false))->fetch('search.advancesearch'); if (isset($post['key-list'])) { //result template $tmplResult = new CTemplate(); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $tmpl->set('featuredList', $featuredList); $searchForm .= $tmplResult->set('my', $my)->set('showFeaturedList', false)->set('multiprofileArr', $multiprofileArr)->set('featuredList', $featuredList)->set('data', $resultRows)->set('isAdvanceSearch', true)->set('hasMultiprofile', $hasMultiprofile)->set('sortings', '')->set('pagination', $pagination)->set('filter', $filter)->set('featuredList', $featuredList)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); } echo $searchForm; }
function showToolbar($data = null) { $mySQLVer = 0; if (JFile::exists(JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php')) { require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'advancesearch.php'; $mySQLVer = CAdvanceSearch::getMySQLVersion(); } require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'toolbar.php'; require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'miniheader.php'; $format = JRequest::getVar('format', 'html', 'get'); if ($format == 'json') { return; } $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); $my = CFactory::getUser(); $userid = JRequest::getInt('userid', ''); $user = CFactory::getUser($userid); // Get the configuration object. $config = CFactory::getConfig(); //JHTML::_('behavior.tooltip'); $js = 'assets/window-1.0'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = 'assets/script-1.2'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $js = '<script type=\'text/javascript\'>'; $js .= '/*<![CDATA[*/'; $js .= 'var js_viewerId = ' . $my->id . '; '; $js .= 'var js_profileId = ' . $user->id . ';'; $js .= '/*]]>*/'; $js .= '</script>'; $mainframe->addCustomHeadTag($js); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } // FOr iPhone, we need to add the stylesheet AFTER the main stylesheet has been loaded // if(JRequest::getVar('screen')=='mobile') // { // $document->addStylesheet( JURI::root() . 'components/com_community/templates/default/css/style.mobile.css' ); // } // This need to be loaded in main messaging library CFactory::load('libraries', 'window'); CWindow::load(); $template = new CTemplateHelper(); $styleIE7 = $template->getTemplateAsset('styleIE7', 'css'); $styleIE6 = $template->getTemplateAsset('styleIE6', 'css'); $css = '<!-- Jom Social --> <!--[if IE 7.0]> <link rel="stylesheet" href="' . $styleIE7->url . '" type="text/css" /> <![endif]--> <!--[if lte IE 6]> <link rel="stylesheet" href="' . $styleIE6->url . '" type="text/css" /> <![endif]-->'; $mainframe->addCustomHeadTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); $task = JRequest::getVar('task', '', 'GET'); $groupId = JRequest::getInt('groupid', '', 'GET'); // Hide the toolbar from unregistered user // but still show the mini header if (empty($my->id)) { if (!empty($groupId) && $task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); echo CMiniHeader::showGroupMiniHeader($groupId); return; } echo CMiniHeader::showMiniHeader($this->_showMiniHeaderUser); return; } /** * Inbox unread count */ $inboxUnread = 0; if (!empty($data['inbox'])) { $inboxUnread = $data['inbox']; } /** * Notification alert */ $notiAlert = 0; $notiAlert = $this->_newNotification(); if (!empty($notiAlert) && $notiAlert > 0) { CFactory::load('libraries', 'window'); CWindow::load(); } $config = CFactory::getConfig(); $logoutLink = CRoute::_('index.php?option=com_community&view=' . $config->get('redirect_logout'), false); $logoutLink = base64_encode($logoutLink); $isFacebookUser = false; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); CFactory::load('models', 'connect'); // Once they reach here, we assume that they are already logged into facebook. // Since CFacebook library handles the security we don't need to worry about any intercepts here. $facebook = new CFacebook(); $connectTable =& JTable::getInstance('Connect', 'CTable'); $fbUser = $facebook->getUser(); $connectTable->load($fbUser); $isFacebookUser = $connectTable->userid == $my->id; } $groupMiniHeader = ''; // Show miniheader if ($task != 'viewgroup') { CFactory::load('libraries', 'miniheader'); $groupMiniHeader = CMiniHeader::showGroupMiniHeader($groupId); } $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('isMine', COwnerHelper::isMine($my->id, $user->id)); $tmpl->set('config', $config); $tmpl->set('inboxUnread', $inboxUnread); $tmpl->set('notiAlert', $notiAlert); $tmpl->set('miniheader', CMiniHeader::showMiniHeader($this->_showMiniHeaderUser)); $tmpl->set('groupMiniHeader', $groupMiniHeader); $tmpl->set('showAdvanceSearch', $mySQLVer > 4.1 ? 1 : 0); $tmpl->set('logoutLink', $logoutLink); $tmpl->set('isFacebookUser', $isFacebookUser); $toolbar = CFactory::getToolbar(); $tmpl->set('customToolbar', $toolbar); echo $tmpl->fetch('toolbar.index'); }
public function display($tpl = null) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $id = $jinput->get('listid', '', 'INT'); //JRequest::getVar( 'listid' , '' ); $list = JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('COM_COMMUNITY_INVALID_ID'); return; } /** * Opengraph */ CHeadHelper::setType('website', $list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($tmpCriterias as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': case 'birthdate': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); if (isset($date[1])) { $delimeter = '-'; if (strpos($date[0], '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $date[0]); $endDate = explode($delimeter, $date[1]); if (isset($startDate[2]) && isset($endDate[2])) { //date format $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { //age format $obj->value = array($date[0], $date[1]); } } else { //wrong data, set to default $obj->value = array(0, 0); } } else { $delimeter = '-'; if (strpos($criteria->value, '/')) { $delimeter = '/'; } $startDate = explode($delimeter, $criteria->value); if (isset($startDate[2])) { //date format $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } else { //age format $obj->value = $criteria->value; } } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } //CFactory::load( 'helpers' , 'time'); $created = CTimeHelper::getDate($list->created); //CFactory::load( 'libraries' , 'advancesearch' ); //CFactory::load( 'libraries' , 'filterbar' ); $sortItems = array('latest' => JText::_('COM_COMMUNITY_SORT_LATEST'), 'online' => JText::_('COM_COMMUNITY_SORT_ONLINE'), 'alphabetical' => JText::_('COM_COMMUNITY_SORT_ALPHABETICAL')); $sorting = $jinput->get->get('sort', 'latest', 'STRING'); //JRequest::getVar( 'sort' , 'latest' , 'GET' ); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $html = $tmpl->set('list', $list)->set('created', $created)->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'))->fetch('memberlist.result'); unset($tmpl); //CFactory::load( 'libraries' , 'tooltip' ); //CFactory::load( 'helpers' , 'owner' ); //CFactory::load( 'libraries' , 'featured' ); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); $alreadyfriend = array(); //CFactory::load( 'helpers' , 'friends' ); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; //record friends if ($obj->addFriend) { $alreadyfriend[$user->id] = $user->id; } $resultRows[] = $obj; } $tmpl = new CTemplate(); echo $tmpl->set('data', $resultRows)->set('alreadyfriend', $alreadyfriend)->set('sortings', '')->set('pagination', $data->pagination)->set('filter', '')->set('featuredList', $featuredList)->set('my', $my)->set('showFeaturedList', false)->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin())->fetch('people.browse'); }
function CToolbar() { $this->_toolbar = array(TOOLBAR_HOME => null, TOOLBAR_PROFILE => null, TOOLBAR_FRIEND => null, TOOLBAR_APP => null, TOOLBAR_INBOX => null); $my =& JFactory::getUser(); $config = CFactory::getConfig(); $mySQLVer = 0; if (JFile::exists(JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'advancesearch.php')) { $mySQLVer = CAdvanceSearch::getMySQLVersion(); } foreach ($this->_toolbar as $key => &$row) { $defaultCoreMenuArray = array(); $default = new stdClass(); switch ($key) { case TOOLBAR_HOME: $default->caption = JText::_('CC HOME'); $default->link = CRoute::_('index.php?option=com_community&view=frontpage'); $default->view = array('frontpage'); break; case TOOLBAR_PROFILE: $default->caption = JText::_('CC PROFILE'); $default->link = CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id); $default->view = array('profile'); $defaultCoreMenuArray['PROFILE_AVATAR'] = $this->_addDefaultItem(JText::_('CC EDIT AVATAR'), CRoute::_('index.php?option=com_community&view=profile&task=uploadAvatar')); if ($config->get('enablevideos')) { if ($config->get('enableprofilevideo')) { $defaultCoreMenuArray['PROFILE_EDIT_PROFILE_VIDEO'] = $this->_addDefaultItem(JText::_('CC EDIT PROFILE VIDEO'), CRoute::_('index.php?option=com_community&view=profile&task=linkVideo')); } } $defaultCoreMenuArray['PROFILE_EDIT_PROFILE'] = $this->_addDefaultItem(JText::_('CC EDIT PROFILE'), CRoute::_('index.php?option=com_community&view=profile&task=edit')); $defaultCoreMenuArray['PROFILE_EDIT_DETAILS'] = $this->_addDefaultItem(JText::_('CC EDIT DETAILS'), CRoute::_('index.php?option=com_community&view=profile&task=editDetails')); $defaultCoreMenuArray['PROFILE_EDIT_PRIVACY'] = $this->_addDefaultItem(JText::_('CC EDIT PRIVACY'), CRoute::_('index.php?option=com_community&view=profile&task=privacy')); $defaultCoreMenuArray['PROFILE_EDIT_PREFERENCES'] = $this->_addDefaultItem(JText::_('CC EDIT PREFERENCES'), CRoute::_('index.php?option=com_community&view=profile&task=preferences')); break; case TOOLBAR_FRIEND: $default->caption = JText::_('CC FRIENDS'); $default->link = CRoute::_('index.php?option=com_community&view=friends&userid=' . $my->id); $default->view = array('friends', 'search'); $defaultCoreMenuArray['FRIEND_SHOW_ALL_FRIENDS'] = $this->_addDefaultItem(JText::_('CC SHOW ALL FRIENDS'), CRoute::_('index.php?option=com_community&view=friends'), false, true); $defaultCoreMenuArray['FRIEND_SEARCH_FRIENDS'] = $this->_addDefaultItem(JText::_('CC SEARCH FRIENDS'), CRoute::_('index.php?option=com_community&view=search')); if ($mySQLVer > 4.1) { $defaultCoreMenuArray['FRIEND_ADVANCE_SEARCH_FRIENDS'] = $this->_addDefaultItem(JText::_('CC CUSTOME SEARCH FRIENDS'), CRoute::_('index.php?option=com_community&view=search&task=advancesearch')); } $defaultCoreMenuArray['FRIEND_INVITE_FRIENDS'] = $this->_addDefaultItem(JText::_('CC INVITE FRIENDS'), CRoute::_('index.php?option=com_community&view=friends&task=invite')); $defaultCoreMenuArray['FRIEND_REQUEST_SENT'] = $this->_addDefaultItem(JText::_('CC REQUEST SENT'), CRoute::_('index.php?option=com_community&view=friends&task=sent')); $defaultCoreMenuArray['FRIEND_PENDING_APPROVAL'] = $this->_addDefaultItem(JText::_('CC PENDING APPROVAL'), CRoute::_('index.php?option=com_community&view=friends&task=pending')); break; case TOOLBAR_APP: $default->caption = JText::_('CC APPLICATIONS'); $default->link = CRoute::_('index.php?option=com_community&view=apps'); $default->view = array('apps', 'groups', 'photos', 'videos', 'events'); $defaultCoreMenuArray['APP_EDIT_APPS'] = $this->_addDefaultItem(JText::_('CC EDIT APPS'), CRoute::_('index.php?option=com_community&view=apps')); if ($config->get('enablegroups')) { $defaultCoreMenuArray['APP_GROUP'] = $this->_addDefaultItem(JText::_('CC GROUP'), CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $my->id)); } if ($config->get('enablephotos')) { $defaultCoreMenuArray['APP_PHOTOS'] = $this->_addDefaultItem(JText::_('CC PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $my->id)); } if ($config->get('enablevideos')) { $defaultCoreMenuArray['APP_VIDEOS'] = $this->_addDefaultItem(JText::_('CC VIDEOS'), CRoute::_('index.php?option=com_community&view=videos&task=myvideos&userid=' . $my->id)); } if ($config->get('enableevents')) { $defaultCoreMenuArray['APP_EVENTS'] = $this->_addDefaultItem(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events&task=myevents&userid=' . $my->id)); } break; case TOOLBAR_INBOX: $default->caption = JText::_('CC INBOX'); $default->link = CRoute::_('index.php?option=com_community&view=inbox'); $default->view = array('inbox'); $defaultCoreMenuArray['INBOX_INBOX'] = $this->_addDefaultItem(JText::_('CC INBOX'), CRoute::_('index.php?option=com_community&view=inbox')); $defaultCoreMenuArray['INBOX_SENT'] = $this->_addDefaultItem(JText::_('CC SENT'), CRoute::_('index.php?option=com_community&view=inbox&task=sent')); $defaultCoreMenuArray['INBOX_WRITE'] = $this->_addDefaultItem(JText::_('CC WRITE'), CRoute::_('index.php?option=com_community&view=inbox&task=write')); default: break; } $default->child = array('prepend' => array(), 'append' => $defaultCoreMenuArray); $row = $default; } }
} else { if ($obj->fieldType == 'checkbox') { if (empty($post['value' . $idx])) { //this mean user didnot check any of the option. $obj->value = ''; } else { $obj->value = isset($post['value' . $idx]) ? implode(',', $post['value' . $idx]) : ''; } } else { $obj->value = isset($post['value' . $idx]) ? $post['value' . $idx] : ''; } } } $filter[] = $obj; } $data->search = CAdvanceSearch::getResult($filter, $joinOperator, $avatarOnly, '', $profileType); $data->filter = $post; } $rows = !empty($data->search) ? $data->search->result : array(); $pagination = !empty($data->search) ? $data->search->pagination : ''; $filter = !empty($data->filter) ? $data->filter : array(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); for ($i = 0; $i < count($rows); $i++) { $row = $rows[$i]; //filter the user profile type if ($profileType && $row->_profile_id != $profileType) { continue; } $obj = new stdClass(); $obj->user = $row;
public function display() { $id = JRequest::getVar('listid', ''); $list =& JTable::getInstance('MemberList', 'CTable'); $list->load($id); if (empty($list->id) || is_null($list->id)) { echo JText::_('CC INVALID ID'); return; } $document =& JFactory::getDocument(); $document->setTitle($list->getTitle()); $tmpCriterias = $list->getCriterias(); $criterias = array(); foreach ($list->getCriterias() as $criteria) { $obj = new stdClass(); $obj->field = $criteria->field; $obj->condition = $criteria->condition; $obj->fieldType = $criteria->type; switch ($criteria->type) { case 'date': if ($criteria->condition == 'between') { $date = explode(',', $criteria->value); $startDate = explode('/', $date[0]); $endDate = explode('/', $date[1]); $obj->value = array($startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00', $endDate[2] . '-' . intval($endDate[1]) . '-' . $endDate[0] . ' 23:59:59'); } else { $startDate = explode('/', $criteria->value); $obj->value = $startDate[2] . '-' . intval($startDate[1]) . '-' . $startDate[0] . ' 00:00:00'; } break; case 'checkbox': default: $obj->value = $criteria->value; break; } $criterias[] = $obj; } CFactory::load('helpers', 'time'); $created = CTimeHelper::getDate($list->created); CFactory::load('libraries', 'advancesearch'); CFactory::load('libraries', 'filterbar'); $sortItems = array('latest' => JText::_('CC SORT LATEST'), 'online' => JText::_('CC SORT ONLINE'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL')); $sorting = JRequest::getVar('sort', 'latest', 'GET'); $data = CAdvanceSearch::getResult($criterias, $list->condition, $list->avataronly, $sorting); $tmpl = new CTemplate(); $tmpl->set('list', $list); $tmpl->set('created', $created); $tmpl->set('sorting', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest')); $html = $tmpl->fetch('memberlist.result'); unset($tmpl); CFactory::load('libraries', 'tooltip'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $my = CFactory::getUser(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); CFactory::load('helpers', 'friends'); foreach ($data->result as $user) { $obj = new stdClass(); $obj->user = $user; $obj->friendsCount = $user->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $user->id); $isFriend = CFriendsHelper::isConnected($user->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $user->id ? true : false; $resultRows[] = $obj; } $tmpl = new CTemplate(); $tmpl->set('data', $resultRows); $tmpl->set('sortings', ''); $tmpl->set('pagination', $data->pagination); $tmpl->set('filter', ''); $tmpl->set('featuredList', $featuredList); $tmpl->set('my', $my); $tmpl->set('showFeaturedList', false); $tmpl->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $html .= $tmpl->fetch('people.browse'); echo $html; }
function advanceSearch() { CFactory::load('libraries', 'advancesearch'); CFactory::load('libraries', 'messaging'); CFactory::load('helpers', 'friends'); CFactory::load('helpers', 'owner'); $document =& JFactory::getDocument(); $document->addStyleSheet("includes/js/calendar/calendar-mos.css"); $document->addScript("includes/js/joomla.javascript.js"); $document->addScript("includes/js/calendar/calendar_mini.js"); $document->addScript("includes/js/calendar/lang/calendar-en-GB.js"); $document->setTitle(JText::_('CC TITLE CUSTOM SEARCH')); $this->showSubMenu(); $this->addPathway(JText::_('CC TITLE CUSTOM SEARCH')); $my = CFactory::getUser(); $config = CFactory::getConfig(); $result = null; $fields = CAdvanceSearch::getFields(); $data = new stdClass(); $post = JRequest::get('GET'); $keyList = isset($post['key-list']) ? $post['key-list'] : ''; $avatarOnly = JRequest::getVar('avatar', ''); if (JString::strlen($keyList) > 0) { //formatting the assoc array $filter = array(); $key = explode(',', $keyList); $joinOperator = $post['operator']; foreach ($key as $idx) { $obj = new stdClass(); $obj->field = $post['field' . $idx]; $obj->condition = $post['condition' . $idx]; $obj->fieldType = $post['fieldType' . $idx]; if ($obj->fieldType == 'email') { $obj->condition = 'equal'; } // we need to check whether the value contain start and end kind of values. // if yes, make them an array. if (isset($post['value' . $idx . '_2'])) { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $endDate = empty($post['value' . $idx . '_2']) ? '01/01/1970' : $post['value' . $idx . '_2']; $sdate = explode('/', $startDate); $edate = explode('/', $endDate); $obj->value = array($sdate[2] . '-' . intval($sdate[1]) . '-' . $sdate[0] . ' 00:00:00', $edate[2] . '-' . intval($edate[1]) . '-' . $edate[0] . ' 23:59:59'); } else { $obj->value = array($post['value' . $idx], $post['value' . $idx . '_2']); } } else { if ($obj->fieldType == 'date') { $startDate = empty($post['value' . $idx]) ? '01/01/1970' : $post['value' . $idx]; $sdate = explode('/', $startDate); $obj->value = $sdate[2] . '-' . intval($sdate[1]) . '-' . $sdate[0] . ' 00:00:00'; } else { if ($obj->fieldType == 'checkbox') { if (empty($post['value' . $idx])) { //this mean user didnot check any of the option. $obj->value = ''; } else { $obj->value = isset($post['value' . $idx]) ? implode(',', $post['value' . $idx]) : ''; } } else { $obj->value = isset($post['value' . $idx]) ? $post['value' . $idx] : ''; } } } $filter[] = $obj; } $data->search = CAdvanceSearch::getResult($filter, $joinOperator, $avatarOnly); $data->filter = $post; } $rows = !empty($data->search) ? $data->search->result : array(); $pagination = !empty($data->search) ? $data->search->pagination : ''; $filter = !empty($data->filter) ? $data->filter : array(); $resultRows = array(); $friendsModel = CFactory::getModel('friends'); for ($i = 0; $i < count($rows); $i++) { $row =& $rows[$i]; $obj = new stdClass(); $obj->user =& $row; $obj->friendsCount = $row->getFriendCount(); $obj->profileLink = CRoute::_('index.php?option=com_community&view=profile&userid=' . $row->id); $isFriend = CFriendsHelper::isConnected($row->id, $my->id); $obj->addFriend = !$isFriend && $my->id != 0 && $my->id != $row->id ? true : false; $resultRows[] = $obj; } if (class_exists('Services_JSON')) { $json = new Services_JSON(); } else { require_once JPATH_ROOT . DS . 'plugins' . DS . 'system' . DS . 'pc_includes' . DS . 'JSON.php'; $json = new Services_JSON(); } $tmpl = new CTemplate(); $tmpl->set('fields', $fields); $tmpl->set('keyList', $keyList); $tmpl->set('avatarOnly', $avatarOnly); $tmpl->set('filterJson', $json->encode($filter)); $tmpl->set('postresult', isset($post['key-list'])); $searchForm = $tmpl->fetch('search.advancesearch'); if (isset($post['key-list'])) { //result template $tmplResult = new CTemplate(); $tmplResult->set('data', $resultRows); $tmplResult->set('sortings', ''); $tmplResult->set('pagination', $pagination); $tmplResult->set('filter', $filter); CFactory::load('libraries', 'tooltip'); CFactory::load('helpers', 'owner'); //JHTML::_('behavior.tooltip'); CFactory::load('libraries', 'featured'); $featured = new CFeatured(FEATURED_USERS); $featuredList = $featured->getItemIds(); $tmpl->set('featuredList', $featuredList); $tmplResult->set('my', $my); $tmplResult->set('showFeaturedList', false); $tmplResult->set('featuredList', $featuredList); $tmplResult->set('featuredList', $featuredList); $tmplResult->set('isCommunityAdmin', COwnerHelper::isCommunityAdmin()); $searchForm .= $tmplResult->fetch('people.browse'); } echo $searchForm; }