本文整理汇总了PHP中CTemplate::getTemplateParams方法的典型用法代码示例。如果您正苦于以下问题:PHP CTemplate::getTemplateParams方法的具体用法?PHP CTemplate::getTemplateParams怎么用?PHP CTemplate::getTemplateParams使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CTemplate
的用法示例。
在下文中一共展示了CTemplate::getTemplateParams方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: attachHeaders
/**
* 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');
}
示例2: modUserDiscussion
/**
* @since 2.4
*/
public function modUserDiscussion($userid)
{
$user = CFactory::getUser($userid);
$groupsModel = CFactory::getModel('groups');
$discussionModel = CFactory::getModel('discussions');
$groupIds = $user->_groups;
// getting group's latest discussion activities.
$templateParams = CTemplate::getTemplateParams();
$discussions = $groupsModel->getGroupLatestDiscussion('', $groupIds, $templateParams->get('sidebarTotalDiscussions'));
return $this->_getSidebarDiscussions($discussions);
}
示例3: attachHeaders
public function attachHeaders()
{
$document = JFactory::getDocument();
$config = CFactory::getConfig();
$mainframe = JFactory::getApplication();
$jinput = $mainframe->input;
$view = $jinput->request->get('view', '');
$my = CFactory::getUser();
$userid = $jinput->get('userid', '', 'INT');
$user = CFactory::getUser($userid);
if ($document->getType() != 'html') {
return;
}
// Mobile devices flag.
$isMobile = preg_match('/android|webos|iphone|ipad|ipod|blackberry|iemobile|opera mini/i', $_SERVER['HTTP_USER_AGENT']);
$isIOS = preg_match('/iphone|ipad|ipod/i', $_SERVER['HTTP_USER_AGENT']);
// Disable zooming on mobile devices.
if ($isMobile) {
$document->setMetaData('viewport', 'width=device-width, initial-scale=1, user-scalable=no');
}
// Output view.
$document->addScriptDeclaration("joms_page = '" . $view . "';");
// IDs.
$document->addScriptDeclaration('joms_my_id = ' . $my->id . ';');
$document->addScriptDeclaration('joms_user_id = ' . $user->id . ';');
// Group's ID.
if ($view === 'groups') {
$groupid = $jinput->get('groupid', '', 'INT');
$group = JTable::getInstance('Group', 'CTable');
$group->load($groupid);
$document->addScriptDeclaration("joms_group_id = +'" . $group->id . "';");
}
// Event's ID.
if ($view === 'events') {
$eventid = $jinput->get('eventid', '', 'INT');
$event = JTable::getInstance('Event', 'CTable');
$event->load($eventid);
$document->addScriptDeclaration("joms_event_id = +'" . $event->id . "';");
}
// Two-factor authentication.
$document->addScriptDeclaration('joms_use_tfa = ' . (CSystemHelper::tfaEnabled() ? 'true' : 'false') . ';');
// Flag to check if we should use native video player.
if ($config->get('video_native') == 1) {
$document->addScriptDeclaration('joms_videoplayer_native = 1;');
}
CTemplate::addStylesheet('style');
$templateParams = CTemplate::getTemplateParams();
CTemplate::addStylesheet('style.' . $templateParams->get('colorTheme', 'green'));
// Load rtl stylesheet
if ($document->direction == 'rtl') {
CTemplate::addStylesheet('style.rtl');
}
// Datepicker style.
$css = 'assets/pickadate/themes/' . ($isMobile ? 'default' : 'classic') . '.combined.css';
CFactory::attach($css, 'css');
// Fluid video on small screen.
$css = '<style type="text/css">video { width: 100% !important; height: auto !important; }</style>';
$document->addCustomTag($css);
//$document->addScript("http://192.168.1.19:8080/target/target-script-min.js#anonymous");
}
示例4: attachHeaders
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');
}
示例5: mygroups
/**
* Method to display groups that belongs to a user.
*
* @access public
*/
function mygroups()
{
$mainframe =& JFactory::getApplication();
$document =& JFactory::getDocument();
$userid = JRequest::getVar('userid', '');
$user = CFactory::getUser($userid);
$my = CFactory::getUser();
$title = $my->id == $user->id ? JText::_('CC MY GROUPS TITLE') : JText::sprintf('CC USERS GROUPS TITLE', $user->getDisplayName());
$document->setTitle($title);
// Add the miniheader if necessary
if ($my->id != $user->id) {
$this->attachMiniHeaderUser($user->id);
}
// Load required filterbar library that will be used to display the filtering and sorting.
CFactory::load('libraries', 'filterbar');
$this->addPathway(JText::_('CC GROUPS'), CRoute::_('index.php?option=com_community&view=groups'));
$this->addPathway(JText::_('CC MY GROUPS TITLE'), '');
$this->showSubmenu();
$uri = JURI::base();
//@todo: make mygroups page to contain several admin tools for owner?
$groupsModel = CFactory::getModel('groups');
$avatarModel = CFactory::getModel('avatar');
$wallsModel = CFactory::getModel('wall');
$activityModel = CFactory::getModel('activities');
$discussionModel = CFactory::getModel('discussions');
$sorted = JRequest::getVar('sort', 'latest', 'GET');
// @todo: proper check with CError::assertion
// Make sure the sort value is not other than the array keys
$groups = $groupsModel->getGroups($my->id, $sorted);
$pagination = $groupsModel->getPagination(count($groups));
require_once JPATH_COMPONENT . DS . 'libraries' . DS . 'activities.php';
$act = new CActivityStream();
// Attach additional properties that the group might have
$groupIds = '';
if ($groups) {
foreach ($groups as $group) {
$groupIds = empty($groupIds) ? $group->id : $groupIds . ',' . $group->id;
}
}
// Get the template for the group lists
$groupsHTML = $this->_getGroupsHTML($groups, $pagination);
// getting group's latest discussion activities.
$templateParams = CTemplate::getTemplateParams();
$discussions = $groupsModel->getGroupLatestDiscussion('', $groupIds, $templateParams->get('sidebarTotalDiscussions'));
$feedLink = CRoute::_('index.php?option=com_community&view=groups&task=mygroups&userid=' . $userid . '&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO LATEST MY GROUPS FEED') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($feed);
$feedLink = CRoute::_('index.php?option=com_community&view=groups&task=viewmylatestdiscussions&groupids=' . $groupIds . '&userid=' . $userid . '&format=feed');
$feed = '<link rel="alternate" type="application/rss+xml" title="' . JText::_('CC SUBSCRIBE TO LATEST MY GROUP DISCUSSIONS FEED') . '" href="' . $feedLink . '"/>';
$mainframe->addCustomHeadTag($feed);
$sortItems = array('latest' => JText::_('CC GROUP SORT LATEST'), 'alphabetical' => JText::_('CC SORT ALPHABETICAL'), 'mostdiscussed' => JText::_('CC GROUP SORT MOST DISCUSSED'), 'mostwall' => JText::_('CC GROUP SORT MOST WALL POST'), 'mostmembers' => JText::_('CC GROUP SORT MOST MEMBERS'), 'mostactive' => JText::_('CC GROUP SORT MOST ACTIVE'));
$tmpl = new CTemplate();
$tmpl->set('groupsHTML', $groupsHTML);
$tmpl->set('pagination', $pagination);
$tmpl->set('my', $my);
$tmpl->set('sortings', CFilterBar::getHTML(CRoute::getURI(), $sortItems, 'latest'));
$tmpl->set('discussionsHTML', $this->_getSidebarDiscussions($discussions));
echo $tmpl->fetch('groups.mygroups');
}