public function __construct($config = array()) { $mainframe = JFactory::getApplication(); $jinput = $mainframe->input; $this->my = CFactory::getUser(); parent::__construct($config); $view = $jinput->request->get('view', ''); $this->set('assets', CAssets::getInstance()); }
/** * Load messaging javascript header */ public 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/minitip-1.0.js'; CAssets::attach($js, 'js'); $css = 'assets/minitip.css'; CAssets::attach($css, 'css'); } }
private function setEditor() { $config = CFactory::getConfig(); $editors = $config->get('editors'); $editorsInArray = explode(',', $editors); $communityEditor = in_array($this->type, $editorsInArray); if ($communityEditor) { if ($this->type == 'jomsocial') { $js = 'assets/editors/ckeditor/ckeditor.js'; CAssets::attach($js, 'js'); } } }
private function setEditor() { $config = CFactory::getConfig(); $editors = $config->get('editors'); $editorsInArray = explode(',', $editors); $communityEditor = in_array($this->type, $editorsInArray); if ($communityEditor) { if ($this->type == 'jomsocial') { // Trigger load default library. CAssets::getInstance(); } } }
/** * 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'); } }
/** * Load messaging javascript header */ 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/friends-1.0.js'; CAssets::attach($js, 'js'); $css = 'assets/window.css'; CAssets::attach($css, 'css'); $css = 'templates/' . $config->get('template') . '/css/style.css'; CAssets::attach($css, 'css'); } }
function getFieldHTML($field, $required) { $config = CFactory::getConfig(); $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); // If maximum is not set, we define it to a default $field->max = empty($field->max) ? 200 : $field->max; $class = $field->required == 1 ? ' required' : ''; $class .= !empty($field->tips) ? ' jomTips tipRight' : ''; CFactory::load('helpers', 'string'); $html = '<textarea id="field' . $field->id . '" name="field' . $field->id . '" class="inputbox textarea' . $class . '" title="' . JText::_($field->name) . '::' . CStringHelper::escape(JText::_($field->tips)) . '">' . $field->value . '</textarea>'; $html .= '<span id="errfield' . $field->id . 'msg" style="display:none;"> </span>'; $html .= '<script type="text/javascript">cvalidate.setMaxLength("#field' . $field->id . '", "' . $field->max . '");</script>'; return $html; }
function load() { $jspath = JPATH_BASE . DS . 'components' . DS . 'com_community'; include_once $jspath . DS . 'libraries' . DS . 'core.php'; include_once $jspath . DS . 'libraries' . DS . 'template.php'; $config = CFactory::getConfig(); $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'); }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { // Trigger load default library. CAssets::getInstance(); if ($this->getLayout() == 'edit') { $this->_displayEditLayout($tpl); return; } $document = JFactory::getDocument(); // Set the titlebar text JToolBarHelper::title(JText::_('COM_COMMUNITY_GROUPS'), 'groups'); // Add the necessary buttons JToolBarHelper::addNew('newGroup', JText::_('COM_COMMUNITY_PROFILES_NEW_GROUP')); JToolBarHelper::deleteList(JText::_('COM_COMMUNITY_GROUP_DELETION_WARNING'), 'deleteGroup', JText::_('COM_COMMUNITY_DELETE')); JToolBarHelper::divider(); JToolBarHelper::publishList('publish', JText::_('COM_COMMUNITY_PUBLISH')); JToolBarHelper::unpublishList('unpublish', JText::_('COM_COMMUNITY_UNPUBLISH')); // Get required data's $groups = $this->get('Groups'); $categories = $this->get('Categories'); $pagination = $this->get('Pagination'); // We need to assign the users object to the groups listing to get the users name. for ($i = 0; $i < count($groups); $i++) { $row =& $groups[$i]; $row->user = CFactory::getUser($row->ownerid); $row->description = strip_tags($row->description, '<strong><a>'); $row->description = CStringHelper::trim($row->description, 200); $row->category = $this->_getCatName($categories, $row->categoryid); } $mainframe = JFactory::getApplication(); $filter_order = $mainframe->getUserStateFromRequest("com_community.groups.filter_order", 'filter_order', 'a.name', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.groups.filter_order_Dir", 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest("com_community.users.search", 'search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; $catHTML = $this->_getCategoriesHTML($categories); $this->assignRef('groups', $groups); $this->assignRef('categories', $catHTML); $this->assignRef('lists', $lists); $this->assignRef('search', $search); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * The default method that will display the output of this view which is called by * Joomla * * @param string template Template file name **/ public function display($tpl = null) { // Trigger load default library. CAssets::getInstance(); $document = JFactory::getDocument(); $config = CFactory::getConfig(); // Get required data's $events = $this->get('Events'); $categories = $this->get('Categories'); $pagination = $this->get('Pagination'); $mainframe = JFactory::getApplication(); $filter_order = $mainframe->getUserStateFromRequest("com_community.events.filter_order", 'filter_order', 'a.title', 'cmd'); $filter_order_Dir = $mainframe->getUserStateFromRequest("com_community.events.filter_order_Dir", 'filter_order_Dir', '', 'word'); $search = $mainframe->getUserStateFromRequest("com_community.events.search", 'search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // We need to assign the users object to the groups listing to get the users name. for ($i = 0; $i < count($events); $i++) { $row =& $events[$i]; $row->user = JFactory::getUser($row->creator); // Truncate the description $row->description = str_ireplace('<p>', '', $row->description); $row->description = str_ireplace('</p>', '', $row->description); $row->description = CStringHelper::trim($row->description, 200); $date = new JDate($row->startdate); $row->startdate = $date->format('Y-m-d'); $row->category = $this->_getCatName($categories, $row->catid); } $catHTML = $this->_getCategoriesHTML($categories); $this->assignRef('events', $events); $this->assignRef('categories', $catHTML); $this->assignRef('search', $search); $this->assignRef('lists', $lists); $this->assignRef('pagination', $pagination); parent::display($tpl); }
/** * Function to add input text box with auto user suggest option. * param - fieldId : string - id of the input box * - $hiddenField : boolean - set true for for a hidden input text that will store the userid * - $hiddenFieldId : string - id of the hidden input box* * - width : int - specify a custom width for the input box * - minChar : int - minimum character for performing auto suggest * - delay : int - delay before getting suggestion from database, milisecond * - cacheLength : int - amount to cache, set to 1 if no cache is needed */ function getAutoSuggestInput($fieldId = 'autoSuggestUserName', $hiddenField = false, $hiddenFieldId = 'autoSuggestUserId', $width = 200, $minChar = 3, $delay = 400, $cacheLength = 10) { $js = 'assets/autocomplete-1.0.js'; CAssets::attach($js, 'js'); $onClickAction = !empty($hiddenField) ? "onclick=\"joms.jQuery(\\'#{$hiddenFieldId}\\').val('+data[1]+');\"" : ""; $autoCLink = CRoute::_('index.php?option=com_community&view=autousersuggest&task=ajaxAutoUserSuggest&no_html=1&tmpl=component'); $js = <<<SHOWJS \t\tjoms.jQuery().ready(function(){ \t\t\tjoms.jQuery("#{$fieldId}").autocomplete("{$autoCLink}", { \t\t\t\tminChars:{$minChar}, \t\t\t\tmatchSubset:1, \t\t\t\tdelay: 200, \t\t\t\tcacheLength:{$cacheLength}, \t\t\t\tmultiple:false, \t\t\t\tformatItem: function(data, i, n, value) { \t\treturn '<div {$onClickAction}><div style="vertical-align: middle; display: inline; width: 45px; float: left;"><img src="'+data[2]+'" width="30" height="30"/></div><div style="vertical-align: middle; line-height: 25px;">'+data[0]+'</div></div>'; \t\t}, \t\tformatResult: function(data, value) { \t\treturn data[0]; \t\t\t\t} \t\t\t}); \t\t\tjoms.jQuery("#{$fieldId}").result(function(event, data, formatted) { \t\t\t\t\tif (data) \t\t\t\t\t\tjoms.jQuery("#{$hiddenFieldId}").val(data[1]); \t\t\t}); \t\t\tjoms.jQuery("#{$fieldId}").val(''); \t\t\tjoms.jQuery("#{$hiddenFieldId}").val(''); \t\t}); SHOWJS; $document =& JFactory::getDocument(); $document->addScriptDeclaration($js); $content = ''; ob_start(); ?> <input name="<?php echo $fieldId; ?> " id="<?php echo $fieldId; ?> " type="text" value="" autocomplete="off" style="width: <?php echo $width; ?> px;"/> <?php if (!empty($hiddenField)) { ?> <input name="<?php echo $hiddenFieldId; ?> " id="<?php echo $hiddenFieldId; ?> " type="hidden" value=""/> <?php } $content = ob_get_contents(); ob_end_clean(); return $content; }
<?php /** * @copyright (C) 2013 iJoomla, Inc. - All rights reserved. * @license GNU General Public License, version 2 (http://www.gnu.org/licenses/gpl-2.0.html) * @author iJoomla.com <*****@*****.**> * @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('Restricted access'); // Trigger load default library. CAssets::getInstance(); ?> <script type="text/javascript"> function getBirthday(years) { if(years=="") { return false; } var now = new Date(); var birthday = new Date(now.getTime()-years*365*24*60*60*1000); var date = birthday.getDate()+"/"+birthday.getMonth()+"/"+birthday.getFullYear(); return date; } function submitSearchForm() {
/** * 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'); }
/** * Displays single photo view * **/ public function photo() { $mainframe =& JFactory::getApplication(); $document = JFactory::getDocument(); $my = CFactory::getUser(); $config = CFactory::getConfig(); // Load window library CFactory::load('libraries', 'window'); CWindow::load(); // Get the configuration object. $config = CFactory::getConfig(); $css = JURI::root() . 'components/com_community/assets/album.css'; $document->addStyleSheet($css); $css = JURI::root() . 'components/com_community/assets/photos.css'; $document->addStyleSheet($css); $js = 'assets/gallery'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $albumId = JRequest::getVar('albumid', '', 'GET'); $defaultId = JRequest::getVar('photoid', '', 'GET'); $userId = JRequest::getVar('userid', '', 'GET'); $user = CFactory::getUser($userId); $handler = $this->_getHandler(); $handler->setMiniHeader(); if (empty($albumId)) { echo JText::_('COM_COMMUNITY_PHOTOS_NO_ALBUMID_ERROR'); return; } CFactory::load('models', 'photos'); CFactory::load('helpers', 'friends'); $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); // Set pathway $pathway =& $mainframe->getPathway(); // Set pathway for group photos // Community > Groups > Group Name > Photos > Album Name $groupId = JRequest::getVar('groupid', '', 'GET'); if (!empty($groupId)) { $group =& JTable::getInstance('Group', 'CTable'); $group->load($groupId); $pathway->addItem(JText::_('COM_COMMUNITY_GROUPS'), CRoute::_('index.php?option=com_community&view=groups')); $pathway->addItem($group->name, CRoute::_('index.php?option=com_community&view=groups&task=viewgroup&groupid=' . $groupId)); $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos&groupid=' . $groupId)); } else { $pathway->addItem(JText::_('COM_COMMUNITY_PHOTOS'), CRoute::_('index.php?option=com_community&view=photos')); $pathway->addItem(JText::sprintf('COM_COMMUNITY_PHOTOS_USER_PHOTOS_TITLE', $user->getDisplayName()), CRoute::_('index.php?option=com_community&view=photos&task=myphotos&userid=' . $userId)); } $pathway->addItem($album->name, ''); // Set document title CFactory::load('helpers', 'string'); $document->setTitle($album->name); if (!$handler->isAlbumBrowsable($albumId)) { return; } $model =& CFactory::getModel('photos'); $photos = $model->getPhotos($albumId, 1000); // @checks: Test if album doesnt have any default photo id. We need to get the first row // of the photos to be the default if ($album->photoid == '0') { $album->photoid = count($photos) >= 1 ? $photos[0]->id : '0'; } // Try to see if there is any photo id in the query $defaultId = !empty($defaultId) ? $defaultId : $album->photoid; // Load the default photo $photo =& JTable::getInstance('Photo', 'CTable'); $photo->load($defaultId); $document->addHeadLink($photo->getThumbURI(), 'image_src', 'rel'); // If default has an id of 0, we need to tell the template to dont process anything $default = $photo->id == 0 ? false : $photo; //friend list for photo tag CFactory::load('libraries', 'phototagging'); $tagging = new CPhotoTagging(); for ($i = 0; $i < count($photos); $i++) { $item =& JTable::getInstance('Photo', 'CTable'); $item->bind($photos[$i]); $photos[$i] = $item; $row =& $photos[$i]; $taggedList = $tagging->getTaggedList($row->id); for ($t = 0; $t < count($taggedList); $t++) { $tagItem =& $taggedList[$t]; $tagUser = CFactory::getUser($tagItem->userid); $canRemoveTag = 0; // 1st we check the tagged user is the photo owner. // If yes, canRemoveTag == true. // If no, then check on user is the tag creator or not. // If yes, canRemoveTag == true // If no, then check on user whether user is being tagged if (COwnerHelper::isMine($my->id, $row->creator) || COwnerHelper::isMine($my->id, $tagItem->created_by) || COwnerHelper::isMine($my->id, $tagItem->userid)) { $canRemoveTag = 1; } $tagItem->user = $tagUser; $tagItem->canRemoveTag = $canRemoveTag; } $row->tagged = $taggedList; } //$friends = $handler->getTaggingUsers(); // Show wall contents CFactory::load('helpers', 'friends'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'bookmarks'); // Load up required objects. $isMine = $handler->isAlbumOwner($album->id); $bookmarks = new CBookmarks($handler->getPhotoExternalURI($photo->id, $album->id)); //Performance issues: blocked users should be handle in sql statment /** * Get ban list */ //$block = CFactory::getModel( 'block' ); //$friendlist = array(); //foreach($friends as $friend){ // Exclude blocked user // if( !$block->getBlockStatus($my->id,$friend->id) ){ // $friendlist[] = $friend; // } //} $this->showSubmenu(); $tmpl = new CTemplate(); echo $tmpl->set('bookmarksHTML', $bookmarks->getHTML())->set('showWall', $handler->isWallAllowed())->set('allowTag', $handler->isTaggable())->set('isOwner', $isMine)->set('isAdmin', COwnerHelper::isCommunityAdmin())->set('photos', $photos)->set('default', $default)->set('album', $album)->set('config', $config)->set('photoCreator', CFactory::getUser($photo->creator))->fetch('photos.photo'); }
/** * Show the application edit page */ function edit() { if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $appsModel = CFactory::getModel('apps'); //------ pre-1.8 ------// // Get coreapps $coreApps = $appsModel->getCoreApps(); for ($i = 0; $i < count($coreApps); $i++) { $appInfo = $appsModel->getAppInfo($coreApps[$i]->apps); // @rule: Try to get proper app id from #__community_users table first. $id = $appsModel->getUserApplicationId($coreApps[$i]->apps, $my->id); // @rule: If there aren't any records, we need to get it from #__plugins table. if (empty($id)) { $id = $appsModel->getPluginId($coreApps[$i]->apps, null, true); } $coreApps[$i]->id = $id; $coreApps[$i]->title = $appInfo->title; $coreApps[$i]->description = $appInfo->description; $coreApps[$i]->name = $coreApps[$i]->apps; //$coreApps[$i]->coreapp = $params->get( 'coreapp' ); //Get application favicon if (JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'community' . DS . $coreApps[$i]->apps . DS . 'favicon_64.png')) { $coreApps[$i]->appFavicon = rtrim(JURI::root(), '/') . '/plugins/community/' . $coreApps[$i]->apps . '/favicon_64.png'; } else { $coreApps[$i]->appFavicon = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png'; } } //------ pre-1.8 ------// // Get user apps $userApps = $appsModel->getUserApps($my->id); $appItems = array(); $appItems['sidebar-top-core'] = ''; $appItems['sidebar-bottom-core'] = ''; $appItems['sidebar-top'] = ''; $appItems['sidebar-bottom'] = ''; $appItems['content'] = ''; $appItems['content-core'] = ''; $appsList = array(); for ($i = 0; $i < count($userApps); $i++) { // TODO: getUserApps should return all this value already $id = $appsModel->getPluginId($userApps[$i]->apps, null, true); $appInfo = $appsModel->getAppInfo($userApps[$i]->apps); $params = new JParameter($appsModel->getPluginParams($id, null)); $isCoreApp = $params->get('coreapp'); $userApps[$i]->title = isset($appInfo->title) ? $appInfo->title : ''; $userApps[$i]->description = isset($appInfo->description) ? $appInfo->description : ''; $userApps[$i]->coreapp = $isCoreApp; // Pre 1.8x $userApps[$i]->isCoreApp = $isCoreApp; $userApps[$i]->name = $userApps[$i]->apps; //------ pre-1.8 ------// if (JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'community' . DS . $userApps[$i]->apps . DS . 'favicon_64.png')) { $userApps[$i]->appFavicon = rtrim(JURI::root(), '/') . '/plugins/community/' . $userApps[$i]->apps . '/favicon_64.png'; } else { $userApps[$i]->appFavicon = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png'; } //------ pre-1.8 ------// if (JFile::exists(JPATH_ROOT . DS . 'plugins' . DS . 'community' . DS . $userApps[$i]->apps . DS . 'favicon.png')) { $userApps[$i]->favicon['16'] = rtrim(JURI::root(), '/') . '/plugins/community/' . $userApps[$i]->apps . '/favicon.png'; } else { $userApps[$i]->favicon['16'] = rtrim(JURI::root(), '/') . '/components/com_community/assets/app_favicon.png'; } $position = !empty($userApps[$i]->position) ? $userApps[$i]->position : 'content' . ($isCoreApp ? '-core' : ''); $appsList[$position][] = $userApps[$i]; } foreach ($appsList as $position => $apps) { $tmpl = new CTemplate(); $tmpl->set('apps', $apps); $tmpl->set('itemType', 'edit'); $appItems[$position] .= $tmpl->fetch('application.item'); } // Get available apps for comparison $appsModel = CFactory::getModel('apps'); $apps = $appsModel->getAvailableApps(false); $appsname = array(); $availableApps = array(); if (!empty($apps)) { foreach ($apps as $data) { array_push($availableApps, $data->name); } } // Check if apps exist, if not delete it. $obsoleteApps = array(); $obsoleteApps = array_diff($appsname, $availableApps); if (!empty($obsoleteApps)) { foreach ($obsoleteApps as $key => $obsoleteApp) { $appRecords = $appsModel->checkObsoleteApp($obsoleteApp); if (empty($appRecords)) { if ($appRecords == NULL) { $appsModel->removeObsoleteApp($obsoleteApp); } unset($userApps[$key]); } } $userApps = array_values($userApps); } $document =& JFactory::getDocument(); $document->setTitle(JText::_('CC MY APPS')); $this->addPathway(JText::_('CC MY APPS')); $this->showSubMenu(); // pre-1.8 CFactory::load('libraries', 'window'); CWindow::load(); CAssets::attach('assets/jquery.tablednd_0_5.js', 'js'); // pre-1.8 CAssets::attach('assets/ui.core.js', 'js'); CAssets::attach('assets/ui.sortable.js', 'js'); CAssets::attach('assets/applayout.js', 'js'); $tmpl = new CTemplate(); $tmpl->set('coreApplications', $coreApps); // pre-1.8 $tmpl->set('applications', $userApps); // pre-1.8 $tmpl->set('appItems', $appItems); echo $tmpl->fetch('applications.edit'); }
<?php /** * @package ActivityComment * @copyright Copyright (C) 2009 - 2010 SocialCode. All rights reserved. * @license GNU/GPL * ActivityComment is free software. This version may have been modified pursuant to the * GNU General Public License, and as distributed it includes or is derivative * of works licensed under the GNU General Public License or other free or open * source software licenses. */ defined('_JEXEC') or die('Restricted access'); JPlugin::loadLanguage('plg_activitycomment', JPATH_ADMINISTRATOR); CAssets::attach('style.css', 'css', 'plugins/community/activitycomment/'); ?> <script type="text/javascript" src="<?php echo JURI::root(); ?> plugins/community/activitycomment/activitycomment.js"></script>
/** * Once a user changed their profile, request them to update their profile **/ public function updateProfile() { $profileType = JRequest::getVar('profileType', ''); $document = JFactory::getDocument(); $document->setTitle(JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE')); $my = CFactory::getUser(); $this->addPathway(JText::_('COM_COMMUNITY_PROFILE'), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_CHANGE_TYPE'), CRoute::_('index.php?option=com_community&view=multiprofile&task=changeprofile')); $this->addPathway(JText::_('COM_COMMUNITY_MULTIPROFILE_UPDATE')); $model = CFactory::getModel('profile'); $profileType = JRequest::getVar('profileType', 0); // Get all published custom field for profile $filter = array('published' => '1', 'registration' => '1'); // $fields =& $model->getAllFields( $filter , $profileType ); $result = $model->getEditableProfile($my->id, $profileType); $empty_html = array(); $post = JRequest::get('post'); // Bind result from previous post into the field object if (!empty($post)) { foreach ($fields as $group) { $field = $group->fields; for ($i = 0; $i < count($field); $i++) { $fieldid = $field[$i]->id; $fieldType = $field[$i]->type; if (!empty($post['field' . $fieldid])) { if (is_array($post['field' . $fieldid])) { if ($fieldType != 'date') { $values = $post['field' . $fieldid]; $value = ''; foreach ($values as $listValue) { $value .= $listValue . ','; } $field[$i]->value = $value; } else { $field[$i]->value = $post['field' . $fieldid]; } } else { $field[$i]->value = $post['field' . $fieldid]; } } } } } $config =& CFactory::getConfig(); $js = 'assets/validate-1.5' . ($config->getBool('usepackedjavascript') ? '.pack.js' : '.js'); CAssets::attach($js, 'js'); $profileType = JRequest::getVar('profileType', 0, 'GET'); CFactory::load('libraries', 'profile'); $tmpl = new CTemplate(); echo $tmpl->set('fields', $result['fields'])->set('profileType', $profileType)->fetch('multiprofile.update'); }
function addScript($file) { $template = new CTemplateHelper(); $asset = $template->getTemplateAsset($file, 'js'); CAssets::attach($asset->filename, 'js', $asset->path); }
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'); }
/** * Attach necessary scripts and stylesheets for the toolbar to operate correctly on 3rd party * environments. **/ private function attachHeaders() { $document =& JFactory::getDocument(); $config = CFactory::getConfig(); if ($document->getType() != 'html') { return; } $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'); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); $templateParams = CTemplate::getTemplateParams(); CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme')); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } // This need to be loaded so the popups will work correctly in notification window 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]-->'; $document->addCustomTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); }
/** * Displays single photo view * **/ function photo() { $mainframe =& JFactory::getApplication(); $document =& JFactory::getDocument(); // Load window library CFactory::load('libraries', 'window'); CWindow::load(); // Get the configuration object. $config = CFactory::getConfig(); $css = JURI::root() . 'components/com_community/assets/album.css'; $document->addStyleSheet($css); $css = JURI::root() . 'components/com_community/assets/photos.css'; $document->addStyleSheet($css); $js = 'assets/gallery'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $albumId = JRequest::getVar('albumid', '', 'GET'); if (empty($albumId)) { echo JText::_('CC NO PROPER ALBUM ID'); return; } CFactory::load('models', 'photos'); // Load the album table $album =& JTable::getInstance('Album', 'CTable'); $album->load($albumId); if ($album->type == PHOTOS_GROUP_TYPE) { $this->_groupPhoto(); } else { $this->_userPhoto(); } }
<?php /** * @category Module * @package JomSocial * @subpackage HelloMe * @copyright (C) 2008 by Slashes & Dots Sdn Bhd - All rights reserved! * @license GNU/GPL, see LICENSE.php */ defined('_JEXEC') or die('Restricted access'); // Include the syndicate functions only once require_once dirname(__FILE__) . DS . 'helper.php'; require_once JPATH_BASE . DS . 'components' . DS . 'com_community' . DS . 'libraries' . DS . 'core.php'; CFactory::load('libraries', 'userpoints'); CFactory::load('libraries', 'window'); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'facebook'); CWindow::load(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $js = 'assets/script-1.2'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); require JModuleHelper::getLayoutPath('mod_hellome');
function edit($event) { if (!$this->accessAllowed('registered')) { return; } $document = JFactory::getDocument(); $config = CFactory::getConfig(); $document->setTitle(JText::_('CC EDIT EVENTS TITLE')); $this->addPathway(JText::_('CC EVENTS'), CRoute::_('index.php?option=com_community&view=events')); $this->addPathway(JText::_('CC EDIT EVENTS TITLE'), ''); $file = 'assets/validate-1.5'; $file .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($file, 'js'); if (!$this->accessAllowed('registered')) { echo JText::_('CC ACCESS FORBIDDEN'); return; } $this->showSubmenu(); $this->_displayForm($event); return; }
public function attachHeaders() { $document = JFactory::getDocument(); $config = CFactory::getConfig(); $my = CFactory::getUser(); $userid = JRequest::getVar('userid', ''); $user = CFactory::getUser($userid); if ($document->getType() != 'html') { return; } $document = JFactory::getDocument(); $js = '<script type=\'text/javascript\'>'; $js .= '/*<![CDATA[*/'; $js .= 'var js_viewerId = ' . $my->id . '; '; $js .= 'var js_profileId = ' . $user->id . ';'; $js .= '/*]]>*/'; $js .= '</script>'; $document->addCustomTag($js); // This need to be loaded so the popups will work correctly in notification window CFactory::load('libraries', 'window'); CWindow::load(); CFactory::load('libraries', 'minitip'); CMinitip::load(); CFactory::load('libraries', 'template'); CTemplate::addStylesheet('style'); $templateParams = CTemplate::getTemplateParams(); CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme')); // Load rtl stylesheet if ($document->direction == 'rtl') { CTemplate::addStylesheet('style.rtl'); } $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]-->'; $document->addCustomTag($css); $css = 'assets/autocomplete.css'; CAssets::attach($css, 'css'); // Required, but added in default template //$css = 'assets/tipsy-0.1.7/src/stylesheets/tipsy.css'; //CAssets::attach($css, 'css'); // Load joms.ajax CTemplate::addScript('joms.ajax'); }
public function addScript($file) { $template = new CTemplateHelper(); $asset = $template->getTemplateAsset($file, 'js'); CAssets::attach($asset->filename, 'js', $asset->path); // Return this object return $this; }
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>MVC-generator</title> <?php echo CAssets::linkCss("/engine/protected/core/gmvc-core/template/css/style.css"); ?> <?php echo CAssets::linkGoogleJQuery(); ?> <?php echo CAssets::linkScriptJS("/engine/protected/core/gmvc-core/template/js/script.js"); ?> </head> <body>
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title><?php echo CApp::showTitle(); ?> </title> <?php echo CAssets::linkCss("css/style.css"); ?> </head> <body>
/** * Edits a user details * * @access public * @param array An associative array to display the editing of the fields */ function editDetails(&$data) { $mainframe =& JFactory::getApplication(); // access check CFactory::setActiveProfile(); if (!$this->accessAllowed('registered')) { return; } $my = CFactory::getUser(); $config = CFactory::getConfig(); $pathway =& $mainframe->getPathway(); $pathway->addItem(JText::_($my->getDisplayName()), CRoute::_('index.php?option=com_community&view=profile&userid=' . $my->id)); $pathway->addItem(JText::_('CC EDIT DETAILS'), ''); $document =& JFactory::getDocument(); $document->setTitle(JText::_('CC EDIT DETAILS')); $js = 'assets/validate-1.5'; $js .= $config->getBool('usepackedjavascript') ? '.pack.js' : '.js'; CAssets::attach($js, 'js'); $this->showSubmenu(); $connectModel = CFactory::getModel('Connect'); $associated = $connectModel->isAssociated($my->id); CFactory::load('helpers', 'owner'); CFactory::load('libraries', 'facebook'); $fbHtml = ''; if ($config->get('fbconnectkey') && $config->get('fbconnectsecret')) { CFactory::load('libraries', 'facebook'); $facebook = new CFacebook(); $fbHtml = $facebook->getLoginHTML(); } // If FIELD_GIVENNAME & FIELD_FAMILYNAME is in use CFactory::load('helpers', 'user'); $isUseFirstLastName = CUserHelper::isUseFirstLastName(); $jConfig =& JFactory::getConfig(); CFactory::load('libraries', 'apps'); $app =& CAppPlugins::getInstance(); $appFields = $app->triggerEvent('onFormDisplay', array('jsform-profile-editdetails')); $beforeFormDisplay = CFormElement::renderElements($appFields, 'before'); $afterFormDisplay = CFormElement::renderElements($appFields, 'after'); $tmpl = new CTemplate(); $tmpl->set('beforeFormDisplay', $beforeFormDisplay); $tmpl->set('afterFormDisplay', $afterFormDisplay); $tmpl->set('fbHtml', $fbHtml); $tmpl->set('jConfig', $jConfig); $tmpl->set('params', $data->params); $tmpl->set('user', $my); $tmpl->set('config', $config); $tmpl->set('associated', $associated); $tmpl->set('isAdmin', COwnerHelper::isCommunityAdmin()); $tmpl->set('offsetList', $data->offsetList); $tmpl->set('isUseFirstLastName', $isUseFirstLastName); echo $tmpl->fetch('profile.edit.details'); }
function cShowCarousel($id, $total, $jaxCall) { static $carouselCustomTag = null; if (!$carouselCustomTag) { CAssets::attach('templates/default/carousel.css', 'css'); CAssets::attach('assets/carousel-1.0.js', 'js'); $carouselCustomTag = true; } ob_start(); ?> <div class="carousel-container" id="<?php echo $id; ?> "> <a class="carousel-prev" href="javascript:void(0)" onclick="this.blur();cCarouselPrev('<?php echo $id; ?> ', '<?php echo $jaxCall; ?> ');joms.jQuery(this).trigger('onblur');">« Prev</a> <a class="carousel-next" href="javascript:void(0)" onclick="this.blur();cCarouselNext('<?php echo $id; ?> ', '<?php echo $jaxCall; ?> ');joms.jQuery(this).trigger('onblur');">Next »</a> <div class="carousel-content"> <div class="carousel-content-wrap" style="display: block;"> <div class="carousel-content-clip"> <ul class="carousel-list" style="width: 1600px; left: 0pt;margin:0px"> <?php for ($i = 0; $i < $total; $i++) { ?> <li class="carousel-item" id="<?php echo $id; ?> -item-<?php echo $i; ?> "><div class="ajax-wait"> </div></li> <?php } ?> </ul> </div> </div> </div> </div> <script type='text/javascript'> cCarouselInit('<?php echo $id; ?> ', '<?php echo $jaxCall; ?> '); </script> <?php $content = ob_get_contents(); ob_end_clean(); return $content; }
/** * Attach assets * @param type $path * @param type $type * @param type $assetPath */ public static function attach($path, $type, $assetPath = '') { $assets = CAssets::getInstance(); $assets->attach($path, $type, $assetPath); }