/** * Do a batch send */ function send($total = 100) { $mailqModel = CFactory::getModel('mailq'); $userModel = CFactory::getModel('user'); $mails = $mailqModel->get($total); $jconfig = JFactory::getConfig(); $mailer = JFactory::getMailer(); $config = CFactory::getConfig(); $senderEmail = $jconfig->getValue('mailfrom'); $senderName = $jconfig->getValue('fromname'); if (empty($mails)) { return; } CFactory::load('helpers', 'string'); foreach ($mails as $row) { // @rule: only send emails that is valid. // @rule: make sure recipient is not blocked! $userid = $userModel->getUserFromEmail($row->recipient); $user = CFactory::getUser($userid); if (!$user->isBlocked() && !JString::stristr($row->recipient, 'foo.bar')) { $mailer->setSender(array($senderEmail, $senderName)); $mailer->addRecipient($row->recipient); $mailer->setSubject($row->subject); $tmpl = new CTemplate(); $raw = isset($row->params) ? $row->params : ''; $params = new JParameter($row->params); $base = $config->get('htmlemail') ? 'email.html' : 'email.text'; if ($config->get('htmlemail')) { $row->body = JString::str_ireplace(array("\r\n", "\r", "\n"), '<br />', $row->body); $mailer->IsHTML(true); } else { //@rule: Some content might contain 'html' tags. Strip them out since this mail should never contain html tags. $row->body = CStringHelper::escape(strip_tags($row->body)); } $tmpl->set('content', $row->body); $tmpl->set('template', rtrim(JURI::root(), '/') . '/components/com_community/templates/' . $config->get('template')); $tmpl->set('sitename', $config->get('sitename')); $row->body = $tmpl->fetch($base); // Replace any occurences of custom variables within the braces scoe { } if (!empty($row->body)) { preg_match_all("/{(.*?)}/", $row->body, $matches, PREG_SET_ORDER); foreach ($matches as $val) { $replaceWith = $params->get($val[1], null); //if the replacement start with 'index.php', we can CRoute it if (strpos($replaceWith, 'index.php') === 0) { $replaceWith = CRoute::getExternalURL($replaceWith); } if (!is_null($replaceWith)) { $row->body = JString::str_ireplace($val[0], $replaceWith, $row->body); } } } unset($tmpl); $mailer->setBody($row->body); $mailer->send(); } $mailqModel->markSent($row->id); $mailer->ClearAllRecipients(); } }
static function getActivityContentHTML($act) { // Ok, the activity could be an upload OR a wall comment. In the future, the content should // indicate which is which $html = ''; $param = new CParameter($act->params); $action = $param->get('action', false); $count = $param->get('count', false); $config = CFactory::getConfig(); switch ($action) { case CAdminstreamsAction::TOP_USERS: $model = CFactory::getModel('user'); $members = $model->getPopularMember($count); $html = ''; //Get Template Page $tmpl = new CTemplate(); $html = $tmpl->set('members', $members)->fetch('activity.members.popular'); return $html; break; case CAdminstreamsAction::TOP_PHOTOS: $model = CFactory::getModel('photos'); $photos = $model->getPopularPhotos($count, 0); $tmpl = new CTemplate(); $html = $tmpl->set('photos', $photos)->fetch('activity.photos.popular'); return $html; break; case CAdminstreamsAction::TOP_VIDEOS: $model = CFactory::getModel('videos'); $videos = $model->getPopularVideos($count); $tmpl = new CTemplate(); $html = $tmpl->set('videos', $videos)->fetch('activity.videos.popular'); return $html; break; } }
function onActivityContentDisplay($args) { $model =& CFactory::getModel('Wall'); $wall =& JTable::getInstance('Wall', 'CTable'); $my = CFactory::getUser(); if (empty($args->content)) { return ''; } $wall->load($args->cid); CFactory::load('libraries', 'privacy'); CFactory::load('libraries', 'comment'); $comment = CComment::stripCommentData($wall->comment); $config = CFactory::getConfig(); $commentcut = false; if (strlen($comment) > $config->getInt('streamcontentlength')) { $origcomment = $comment; $comment = JString::substr($comment, 0, $config->getInt('streamcontentlength')) . ' ...'; $commentcut = true; } if (CPrivacy::isAccessAllowed($my->id, $args->target, 'user', 'privacyProfileView')) { CFactory::load('helpers', 'videos'); CFactory::load('libraries', 'videos'); CFactory::load('libraries', 'wall'); $videoContent = ''; $params = new CParameter($args->params); $videoLink = $params->get('videolink'); $image = $params->get('url'); // For older activities that does not have videoLink , we need to process it the old way. if (!$videoLink) { $html = CWallLibrary::_processWallContent($comment); $tmpl = new CTemplate(); $html = CStringHelper::escape($html); if ($commentcut) { //add read more/less link for content $html .= '<br /><br /><a href="javascript:void(0)" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').hide(); jQuery(\'#origcomment_' . $args->cid . '\').show();" >' . JText::_('COM_COMMUNITY_READ_MORE') . '</a>'; $html = '<div id="shortcomment_' . $args->cid . '">' . $html . '</div>'; $html .= '<div id="origcomment_' . $args->cid . '" style="display:none;">' . $origcomment . '<br /><br /><a href="javascript:void(0);" onclick="jQuery(\'#shortcomment_' . $args->cid . '\').show(); jQuery(\'#origcomment_' . $args->cid . '\').hide();" >' . JText::_('COM_COMMUNITY_READ_LESS') . '</a></div>'; } $tmpl->set('comment', $html); $html = $tmpl->fetch('activity.wall.post'); } else { $html = '<ul class ="cDetailList clrfix">'; $html .= '<li>'; $image = !$image ? rtrim(JURI::root(), '/') . '/components/com_community/assets/playvideo.gif' : $image; $videoLib = new CVideoLibrary(); $provider = $videoLib->getProvider($videoLink); $html .= '<!-- avatar --><div class="avatarWrap"><a href="javascript:void(0);" onclick="joms.activities.showVideo(\'' . $args->id . '\');"><img width="64" src="' . $image . '" class="cAvatar"/></a></div><!-- avatar -->'; $videoPlayer = $provider->getViewHTML($provider->getId(), '300', '300'); $comment = CString::str_ireplace($videoLink, '', $comment); $html .= '<!-- details --><div class="detailWrap alpha">' . $comment . '</div><!-- details -->'; if (!empty($videoPlayer)) { $html .= '<div style="display: none;clear: both;padding-top: 5px;" class="video-object">' . $videoPlayer . '</div>'; } $html .= '</li>'; $html .= '</ul>'; } return $html; } }
public function ajaxInvite() { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $config = CFactory::getConfig(); $tmpl = new CTemplate(); echo $tmpl->set('facebook', $facebook)->set('config', $config)->set('sitename', $config->get('sitename'))->fetch('facebook.inviteframe'); }
/** * Renders the provided elements into their respective HTML formats. * * @param Array formElements An array of CFormElement objects. * @param string position The position of the field 'before' will be loaded before the rest of the form and 'after' will be loaded after the rest of the form loaded. * * returns string html Contents of generated CFormElements. **/ public static function renderElements($formElements, $position) { $tmpl = new CTemplate(); $tmpl->set('formElements', $formElements); $tmpl->set('position', $position); $html = $tmpl->fetch('form.elements'); return trim($html); }
/** * * @param string $tag the tag to seach for * @return string HTML code of item listing */ public function getItemsHTML($tag) { $items = $this->getItems($tag); $tmpl = new CTemplate(); $tmpl->set('items', $items); $html = $tmpl->fetch('tag.list'); return $html; }
static function getActivityContentHTML($act) { // Ok, the activity could be an upload OR a wall comment. In the future, the content should // indicate which is which $html = ''; $param = new JParameter($act->params); $action = $param->get('action', false); $photoid = $param->get('photoid', 0); CFactory::load('models', 'photos'); $url = $param->get('url', false); CFactory::load('helpers', 'albums'); if ($action == 'wall') { // unfortunately, wall post can also have 'photo' as its $act->apps. If the photo id is availble // for (newer activity stream, inside the param), we will show the photo snippet as well. Otherwise // just print out the wall content // Version 1.6 onwards, $params will contain photoid information // older version would have #photoid in the $title, since we link it to the photo $photoid = $param->get('photoid', false); if ($photoid) { $photo = JTable::getInstance('Photo', 'CTable'); $photo->load($act->cid); $helper = new CAlbumsHelper($photo->albumid); if ($helper->showActivity()) { $tmpl = new CTemplate(); $tmpl->set('url', $url); $tmpl->set('photo', $photo); $tmpl->set('param', $param); $tmpl->set('act', $act); return $tmpl->fetch('activity.photos.wall'); } } return ''; } elseif ($action == 'upload' && $photoid > 0) { $albumsHelper = new CAlbumsHelper($act->cid); if ($albumsHelper->isPublic()) { // If content has link to image, we could assume it is "upload photo" action // since old content add this automatically. // The $act->cid will be the album id, Retrive the recent photos uploaded // If $act->activities has data, that means this is an aggregated content // display some of them $photoModel = CFactory::getModel('photos'); $album = JTable::getInstance('Album', 'CTable'); $album->load($act->cid); if (empty($act->activities)) { $acts[] = $act; } else { $acts = $act->activities; } $tmpl = new CTemplate(); $tmpl->set('album', $album); $tmpl->set('acts', $acts); return $tmpl->fetch('activity.photos.upload'); } } return $html; }
function invite() { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $config = CFactory::getConfig(); $tmpl = new CTemplate(); $tmpl->set('facebook', $facebook); $tmpl->set('config', $config); echo $tmpl->fetch('facebook.invite'); }
static function getEventSummary($eventid, $param) { $model = CFactory::getModel('events'); $event =& JTable::getInstance('Event', 'CTable'); $event->load($eventid); $tmpl = new CTemplate(); $tmpl->set('event', $event); $tmpl->set('param', $param); return $tmpl->fetch('activity.events.update'); }
public static function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '') { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $cleanURL = $url; $uri = JFactory::getURI(); $queries = $_REQUEST; $allow = array('option', 'view', 'browse', 'task'); foreach ($queries as $key => $value) { if (!in_array($key, $allow)) { unset($queries[$key]); } } $selectedSort = $jinput->get->get('sort', $defaultSort, 'STRING'); $selectedFilter = $jinput->get->get('filter', $defaultFilter, 'STRING'); $tmpl = new CTemplate(); $tmpl->set('queries', $queries); $tmpl->set('selectedSort', $selectedSort); $tmpl->set('selectedFilter', $selectedFilter); $tmpl->set('sortItems', $sortItems); $tmpl->set('uri', $uri); $tmpl->set('filterItems', $filterItems); $tmpl->set('jinput', $jinput); return $tmpl->fetch('filterbar.html'); }
function getHTML() { $config = CFactory::getConfig(); if ($config->get('enablesharethis')) { $tmpl = new CTemplate(); $tmpl->set('uri', $this->currentURI); return $tmpl->fetch('bookmarks'); } else { return ''; } }
public function export($event) { //CFactory::load( 'helpers' , 'event' ); $handler = CEventHelper::getHandler($event); if (!$handler->showExport()) { echo JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN'); return; } header('Content-type: text/Calendar'); header('Content-Disposition: attachment; filename="calendar.ics"'); $creator = CFactory::getUser($event->creator); $offset = $creator->getUtcOffset(); $date = new JDate($event->startdate); $dtstart = $date->format('Ymd\\THis'); //$date->format('%Y%m%dT%H%M%S'); $date = new JDate($event->enddate); $dtend = $date->format('Ymd\\THis'); //$date->format('%Y%m%dT%H%M%S'); $date = new JDate($event->repeatend); $rend = $date->format('Ymd\\THis'); //$date->format('%Y%m%dT%H%M%S'); $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true); $tmpl = new CTemplate(); $tmpl->set('dtstart', $dtstart); $tmpl->set('dtend', $dtend); $tmpl->set('rend', $rend); $tmpl->set('url', $url); $tmpl->set('event', $event); $raw = $tmpl->fetch('events.ical'); unset($tmpl); echo $raw; exit; }
public function getHTML($url, $sortItems = array(), $defaultSort = '', $filterItems = array(), $defaultFilter = '') { $cleanURL = $url; $uri =& JFactory::getURI(); $queries = JRequest::get('GET'); // If there is Itemid in the querystring, we need to unset it so that CRoute // will generate it's correct Itemid if (isset($queries['Itemid'])) { unset($queries['Itemid']); } // Force link to start with first page if (isset($queries['limitstart'])) { unset($queries['limitstart']); } if (isset($queries['start'])) { unset($queries['start']); } $selectedSort = JRequest::getVar('sort', $defaultSort, 'GET'); $selectedFilter = JRequest::getVar('filter', $defaultFilter, 'GET'); $tmpl = new CTemplate(); $tmpl->set('queries', $queries); $tmpl->set('selectedSort', $selectedSort); $tmpl->set('selectedFilter', $selectedFilter); $tmpl->set('sortItems', $sortItems); $tmpl->set('uri', $uri); $tmpl->set('filterItems', $filterItems); return $tmpl->fetch('filterbar.html'); }
public static function getHTML($nameAttribute, $selectedAccess = 0, $buttonType = COMMUNITY_PRIVACY_BUTTON_SMALL, $access = array(), $type = '') { $template = new CTemplate(); $config = CFactory::getConfig(); // Initialize default options to show if (empty($access)) { $access['public'] = true; $access['members'] = true; $access['friends'] = true; $access['self'] = true; } $classAttribute = $buttonType == COMMUNITY_PRIVACY_BUTTON_SMALL ? 'js_PriContainer' : 'js_PriContainer js_PriContainerLarge'; return $template->set('classAttribute', $classAttribute)->set('access', $access)->set('nameAttribute', $nameAttribute)->set('selectedAccess', $selectedAccess)->set('type', $type)->fetch('privacy'); }
public function showSwitcher() { $uri = JFactory::getURI(); // Will see if there's a nicer solution to this $query = $uri->getQuery(true); unset($query['screen']); $query = $uri->buildQuery($query); $uri->setQuery($query); $uri = $uri->toString(); // Build links $link = array('mobile' => $uri . '&screen=mobile', 'desktop' => $uri . '&screen=desktop'); $tmpl = new CTemplate(); $tmpl->set('link', $link); $tmpl->set('viewtype', JRequest::setVar('screen')); echo $tmpl->fetch('mobile.switcher'); }
public function ajaxIphoneFriends() { $objResponse = new JAXResponse(); $document = JFactory::getDocument(); $viewType = $document->getType(); $view =& $this->getView('friends', '', $viewType); $html = ''; ob_start(); $this->display(); $content = ob_get_contents(); ob_end_clean(); $tmpl = new CTemplate(); $tmpl->set('toolbar_active', 'friends'); $simpleToolbar = $tmpl->fetch('toolbar.simple'); $objResponse->addAssign('social-content', 'innerHTML', $simpleToolbar . $content); return $objResponse->sendResponse(); }
/** * 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); } } }
public function showGroupMiniHeader($groupId) { CMiniHeader::load(); $option = JRequest::getVar('option', '', 'REQUEST'); JFactory::getLanguage()->load('com_community'); CFactory::load('models', 'groups'); $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $my = CFactory::getUser(); // @rule: Test if the group is unpublished, don't display it at all. if (!$group->published) { return ''; } if (!empty($group->id) && $group->id != 0) { $isMember = $group->isMember($my->id); $config = CFactory::getConfig(); $tmpl = new CTemplate(); $tmpl->set('my', $my); $tmpl->set('group', $group); $tmpl->set('isMember', $isMember); $tmpl->set('config', $config); $showMiniHeader = $option == 'com_community' ? $tmpl->fetch('groups.miniheader') : '<div id="community-wrap" style="min-height:50px;">' . $tmpl->fetch('groups.miniheader') . '</div>'; return $showMiniHeader; } }
public function getFileHTML($type = NULL, $id = NULL) { //CFactory::load( 'models' , 'files' ); $model = CFactory::getModel('files'); $data = $model->getFileList($type, $id); $my = CFactory::getUser(); if (!empty($data)) { foreach ($data as $key => $_data) { $data[$key] = $this->convertToMb($_data); $data[$key]->deleteable = $this->checkDeleteable($type, $_data, $my); $data[$key]->user = CFactory::getUser($_data->creator); } } $permission = $my->authorise('community.add', 'files.' . $type, $id); $tmpl = new CTemplate(); $tmpl->set('type', $type)->set('id', $id)->set('data', $data)->set('permission', $permission); return $tmpl->fetch('files.list'); }
public function ajaxBrowse($data) { $mainframe =& JFactory::getApplication(); $my = CFactory::getUser(); // Get application's favicon $addedAppCount = 0; foreach ($data->applications as $appData) { if (JFile::exists(CPluginHelper::getPluginPath('community', $appData->name) . DS . $appData->name . DS . 'favicon_64.png')) { $appData->favicon['64'] = rtrim(JURI::root(), '/') . CPluginHelper::getPluginURI('community', $appData->name) . '/' . $appData->name . '/favicon_64.png'; } else { $appData->favicon['64'] = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_avatar.png'; } // Get total added applications //$addedAppCount = $appData->added == 1 ? $addedAppCount+1 : $addedAppCount; } $tmpl = new CTemplate(); echo $tmpl->set('apps', $data->applications)->set('itemType', 'browse')->fetch('application.item'); }
public function ajaxShowBookmarks($uri) { $filter = JFilterInput::getInstance(); $uri = $filter->clean($uri, 'string'); $config = CFactory::getConfig(); $shareviaemail = $config->get('shareviaemail'); //CFactory::load( 'libraries' , 'bookmarks' ); $bookmarks = new CBookmarks($uri); //CFactory::load( 'libraries' , 'apps' ); $appsLib = CAppPlugins::getInstance(); $appsLib->loadApplications(); // @onLoadBookmarks deprecated. // since 1.5 $appsLib->triggerEvent('onLoadBookmarks', array($bookmarks)); $tmpl = new CTemplate(); $tmpl->set('config', $config)->set('bookmarks', $bookmarks->getBookmarks()); $json = array('title' => JText::_('COM_COMMUNITY_SHARE_THIS'), 'html' => $tmpl->fetch('bookmarks.list'), 'btnShare' => JText::_('COM_COMMUNITY_SHARE_BUTTON'), 'btnCancel' => JText::_('COM_COMMUNITY_CANCEL_BUTTON'), 'viaEmail' => $shareviaemail ? true : false); die(json_encode($json)); }
/** * Load messaging javascript header */ public static function load() { static $loaded = false; if (!$loaded) { $config = CFactory::getConfig(); require_once JPATH_ROOT . '/components/com_community/libraries/core.php'; // $js = 'assets/window-1.0.min.js'; // CFactory::attach($js, 'js'); CTemplate::addStyleSheet('style'); // $css = 'assets/window.css'; // CFactory::attach($css, 'css'); } }
/** * Responsible to return necessary contents to the Invitation library * so that it can add the mails into the queue **/ public function inviteUsers($cid, $users, $emails, $message) { CFactory::load('libraries', 'invitation'); $group =& JTable::getInstance('Group', 'CTable'); $group->load($cid); $content = ''; $text = ''; $title = JText::sprintf('COM_COMMUNITY_GROUPS_JOIN_INVITATION_MESSAGE', $group->name); $params = ''; $my = CFactory::getUser(); if (!$my->authorise('community.view', 'groups.invite.' . $cid, $group)) { return false; } $params = new CParameter(''); $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id); $params->set('groupname', $group->name); CFactory::load('helpers', 'owner'); if ($users) { foreach ($users as $id) { $groupInvite =& JTable::getInstance('GroupInvite', 'CTable'); $groupInvite->groupid = $group->id; $groupInvite->userid = $id; $groupInvite->creator = $my->id; $groupInvite->store(); } } $htmlTemplate = new CTemplate(); $htmlTemplate->set('groupname', $group->name); $htmlTemplate->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id)); $htmlTemplate->set('message', $message); $html = $htmlTemplate->fetch('email.groups.invite.html'); $textTemplate = new CTemplate(); $textTemplate->set('groupname', $group->name); $textTemplate->set('url', CRoute::getExternalURL('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id)); $textTemplate->set('message', $message); $text = $textTemplate->fetch('email.groups.invite.text'); return new CInvitationMail($html, $text, $title, $params); }
/** * Load messaging javascript header */ public static function load() { if (!defined('CMESSAGING_LOADED')) { $config = CFactory::getConfig(); include_once JPATH_ROOT . '/components/com_community/libraries/core.php'; // $js = 'assets/window-1.0.min.js'; // CFactory::attach($js, 'js'); // $js = 'assets/script-1.2.min.js'; // CFactory::attach($js, 'js'); // $css = 'assets/window.css'; // CFactory::attach($css, 'css'); CTemplate::addStyleSheet('style'); } }
/** * Load messaging javascript header */ function load() { static $loaded = false; if (!$loaded) { $config = CFactory::getConfig(); require_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'; $js = 'assets/window-1.0'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); CFactory::load('libraries', 'template'); CTemplate::addStyleSheet('style'); $css = 'assets/window.css'; CAssets::attach($css, 'css'); } }
/** * Responsible to return necessary contents to the Invitation library * so that it can add the mails into the queue **/ public function inviteUsers($cid, $users, $emails, $message) { CFactory::load('libraries', 'invitation'); $group =& JTable::getInstance('Group', 'CTable'); $group->load($cid); $content = ''; $text = ''; $title = JText::sprintf('CC INVITED TO JOIN GROUP', $group->name); $params = ''; $my = CFactory::getUser(); if (!$group->isMember($my->id) && !COwnerHelper::isCommunityAdmin()) { return false; } $params = new JParameter(''); $params->set('url', 'index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $group->id); $params->set('groupname', $group->name); CFactory::load('helpers', 'owner'); if ($users) { foreach ($users as $id) { $groupInvite =& JTable::getInstance('GroupInvite', 'CTable'); $groupInvite->groupid = $group->id; $groupInvite->userid = $id; $groupInvite->creator = $my->id; $groupInvite->store(); } } $htmlTemplate = new CTemplate(); $htmlTemplate->set('groupname', $group->name); $htmlTemplate->set('message', $message); $html = $htmlTemplate->fetch('email.groups.invite.html'); $textTemplate = new CTemplate(); $textTemplate->set('groupname', $group->name); $textTemplate->set('message', $message); $text = $textTemplate->fetch('email.groups.invite.text'); return new CInvitationMail($html, $text, $title, $params); }
public function ajaxShowBookmarks($uri) { $filter = JFilterInput::getInstance(); $uri = $filter->clean($uri, 'string'); CFactory::load('libraries', 'bookmarks'); $bookmarks = new CBookmarks($uri); CFactory::load('libraries', 'apps'); $appsLib =& CAppPlugins::getInstance(); $appsLib->loadApplications(); // @onLoadBookmarks deprecated. // since 1.5 $appsLib->triggerEvent('onLoadBookmarks', array($bookmarks)); $response = new JAXResponse(); $tmpl = new CTemplate(); $tmpl->set('bookmarks', $bookmarks->getBookmarks()); $html = $tmpl->fetch('bookmarks.list'); $total = $bookmarks->getTotalBookmarks(); $height = $total * 10; $actions = '<input type="button" class="button" onclick="joms.bookmarks.email(\'' . $uri . '\');" value="' . JText::_('COM_COMMUNITY_SHARE_BUTTON') . '"/>'; $actions .= '<input type="button" class="button" onclick="cWindowHide();" value="' . JText::_('COM_COMMUNITY_CANCEL_BUTTON') . '"/>'; $response->addAssign('cwin_logo', 'innerHTML', JText::_('COM_COMMUNITY_SHARE_THIS')); $response->addScriptCall('cWindowAddContent', $html, $actions); return $response->sendResponse(); }
public function getFieldHTML($field, $required, $isDropDown = true) { $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomNameTips tipRight' : ''; $optionSize = 1; // the default 'select below' if (!empty($field->options)) { $optionSize += count($field->options); } $dropDown = $isDropDown ? '' : ' size="' . $optionSize . '"'; CFactory::load('helpers', 'string'); $html = '<select id="field' . $field->id . '" name="field' . $field->id . '"' . $dropDown . ' class="select' . $class . '" title="' . CStringHelper::escape(JText::_($field->tips)) . '" style="' . $this->getStyle() . '" size="' . $this->params->get('size') . '">'; $defaultSelected = ''; //@rule: If there is no value, we need to default to a default value if (empty($field->value)) { $defaultSelected .= ' selected="selected"'; } if ($isDropDown) { $html .= '<option value="" ' . $defaultSelected . '>' . JText::_('COM_COMMUNITY_SELECT_BELOW') . '</option>'; } if (!empty($field->options)) { $selectedElement = 0; CFactory::load('libraries', 'template'); foreach ($field->options as $option) { $selected = $option == $field->value ? ' selected="selected"' : ''; if (!empty($selected)) { $selectedElement++; } $html .= '<option value="' . CTemplate::escape($option) . '"' . $selected . '>' . JText::_($option) . '</option>'; } if ($selectedElement == 0) { //if nothing is selected, we default the 1st option to be selected. $eleName = 'field' . $field->id; $html .= <<<HTML \t\t\t\t\t <script type='text/javascript'> \t\t\t\t\t\t var slt = document.getElementById('{$eleName}'); \t\t\t\t\t\t if(slt != null) \t\t\t\t\t\t { \t\t\t\t\t\t slt.options[0].selected = true; \t\t\t\t\t\t } \t\t\t\t\t </script> HTML; } } $html .= '</select>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; return $html; }
/** * Load messaging javascript header */ public function load() { if (!defined('CMESSAGING_LOADED')) { $config = CFactory::getConfig(); include_once JPATH_ROOT . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'; $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'); $css = 'assets/window.css'; CAssets::attach($css, 'css'); CFactory::load('libraries', 'template'); CTemplate::addStyleSheet('style'); // $css = '/templates/'.$config->get('template').'/css/style.css'; // CAssets::attach($css, 'css'); } }
public static function searchEventsAjax() { // Location. $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $location = $jinput->request->get('location', '', 'STRING'); $module = JModuleHelper::getModule('mod_community_search_nearbyevents'); $params = new JRegistry($module->params); $advance = array(); $advance['radius'] = $params->get('event_nearby_radius'); if ($params->get('eventradiusmeasure') == COMMUNITY_EVENT_UNIT_KM) { //find out if radius is in km or miles $advance['radius'] = $advance['radius'] * 0.621371192; } $advance['fromlocation'] = $location; $model = CFactory::getModel('events'); $objs = $model->getEvents(null, null, null, null, null, null, null, $advance); $events = array(); $tmpl = new CTemplate(); if ($objs) { foreach ($objs as $row) { $event = JTable::getInstance('Event', 'CTable'); $event->bind($row); $events[] = $event; } unset($objs); } // Get list of nearby events $tmpl->set('events', $events); $tmpl->set('radius', $params->get('event_nearby_radius')); $tmpl->set('measurement', $params->get('eventradiusmeasure')); $tmpl->set('location', $location); $html = $tmpl->fetch('events.nearbylist'); $json = array('success' => true, 'html' => $html); die(json_encode($json)); }