本文整理汇总了PHP中JMenu类的典型用法代码示例。如果您正苦于以下问题:PHP JMenu类的具体用法?PHP JMenu怎么用?PHP JMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JMenu类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getItems
public function getItems()
{
if ($items = parent::getItems()) {
$component = JComponentHelper::getComponent('com_tz_portfolio_plus');
$menus = JMenu::getInstance('site');
$menu_assigned = array();
if ($menu_items = $menus->getItems(array('component_id'), $component->id)) {
if (count($menu_items)) {
foreach ($menu_items as $m) {
if (isset($m->params)) {
$params = $m->params;
if ($tpl_style_id = $params->get('tz_template_style_id')) {
if (!isset($menu_assigned[$tpl_style_id])) {
$menu_assigned[$tpl_style_id] = 0;
}
$menu_assigned[$tpl_style_id]++;
}
}
}
}
}
foreach ($items as $i => &$item) {
$item->menu_assigned = 0;
if (isset($menu_assigned[$item->id])) {
$item->menu_assigned = $menu_assigned[$item->id];
}
}
return $items;
}
return false;
}
示例2: display
function display($tpl = null)
{
global $option, $mainframe;
$model =& $this->getModel();
$menu =& JMenu::getInstance('site');
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
//get controller
$controller = new VnffhotelController();
$cityid = $params->get('cityid', '1');
$cityid = JRequest::getVar('cityid', $cityid);
//if($cityid==1)
$hotels = $model->getHotelsByCity($cityid);
$pagination = $model->getPagination();
for ($i = 0; $i < count($hotels); $i++) {
$hotels[$i]->images = $model->getHotelImages($hotels[$i]->hotel_ID, 'm');
if (count($hotels[$i]->images) == 0) {
$image->image_Name = "noimage.png";
$hotels[$i]->images[0] = $image;
}
$hotels[$i]->shortDes = $controller->cutDes($hotels[$i]->Overview, 30);
$hotels[$i]->linkToHotel = $controller->linkToHotel($hotels[$i]->hotel_ID);
}
//get controller
$mainframe->setPageTitle(JTEXT::_("HOTELS IN") . " " . $hotels[0]->city_Name);
//echo $hotels[0]->images[0]->image_Name;
//echo $hotels[0]->city_ID."hehehejhe";
$this->assignRef('hotels', $hotels);
$this->assignRef('pagination', $pagination);
$this->assignRef('controller', $controller);
//echo $this->cutDes("thang nay khung qua di thoi");
parent::display($tpl);
}
示例3: jimport
function &getMenu()
{
jimport('joomla.application.menu');
$options = array();
$menu =& JMenu::getInstance('site', $options);
if (JError::isError($menu)) {
$null = null;
return $null;
}
return $menu;
}
示例4: __construct
function __construct()
{
$this->alltimepoints = JRequest::getVar("points", 0);
$menu =& JMenu::getInstance('site');
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
//$menu = &JSite::getMenu();
$show_debug_info = JComponentHelper::getParams('com_joomleague')->get('show_debug_info', 0);
if ($show_debug_info) {
$this->debug_info = true;
} else {
$this->debug_info = false;
}
if ($item->id) {
// diddipoeler
// menueeintrag vorhanden
$registry = new JRegistry();
$registry->loadArray($params);
//$newparams = $registry->toString('ini');
$newparams = $registry->toArray();
//echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";
foreach ($newparams['data'] as $key => $value) {
$this->_params[$key] = $value;
}
} else {
$strXmlFile = JLG_PATH_SITE . DS . 'settings' . DS . 'default' . DS . 'rankingalltime.xml';
// get the JForm object
$form =& JForm::getInstance('jlattform', $strXmlFile);
//echo "<b>menue form</b><pre>" . print_r($form, true) . "</pre>";
foreach ($form->getFieldset($fieldset->name) as $field) {
// echo ' -> '. $field->name.'<br>';
// echo ' -> '. $field->type.'<br>';
// echo ' -> '. $field->input.'<br>';
$this->_params[$field->name] = $field->value;
}
/*
$registry = new JRegistry();
$registry->loadArray($strXmlFile);
//$newparams = $registry->toString('ini');
$newparams = $registry->toArray();
//echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";
foreach ($newparams['data'] as $key => $value ) {
$this->_params[$key] = $value;
}
*/
}
parent::__construct();
}
示例5: getParams
/**
*
*
*/
public function getParams($pks)
{
$app = JFactory::getApplication('site');
$siteMenu = JMenu::getInstance('site');
$menuParams = $siteMenu->getItem($pks['Itemid']);
if (isset($menuParams->params)) {
$params = $menuParams->params;
} else {
$params = $this->getState()->get('params');
}
$JSNConfig = JSNFactory::getConfig();
$JSNConfig->megreGlobalParams($pks['option'], $params);
return $params;
}
示例6: step1
function step1()
{
global $option, $mainframe;
$mainframe->setPageTitle(JTEXT::_("STEP 1"));
$model =& $this->getModel();
$hid = JRequest::getVar('hid', '');
if ($hid == '') {
echo '<div class="invalid_hotel">' . JTEXT::_("INVALID HOTEL...!") . '</div>';
return;
}
$menu =& JMenu::getInstance('site');
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
//get controller
$controller = new VnffhotelController();
$today = getdate();
$next2day = getdate(($today["0"] / (60 * 60 * 24) + 2) * (60 * 60 * 24));
$checkin_date = JRequest::getVar('checkin_date', $today["mday"] . '/' . $today["mon"] . '/' . $today["year"]);
$checkout_date = JRequest::getVar('checkout_date', $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"]);
$room_id = JRequest::getVar('room_id', '');
$checkin_date_r = explode('/', $checkin_date);
$checkout_date_r = explode('/', $checkout_date);
//$checkin_date = getdate(mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2]));
$days_count = round((-mktime(0, 0, 0, $checkin_date_r[1], $checkin_date_r[0], $checkin_date_r[2]) + mktime(0, 0, 0, $checkout_date_r[1], $checkout_date_r[0], $checkout_date_r[2])) / (60 * 60 * 24), 0);
if ($days_count < 1) {
$checkin_date = $today["mday"] . '/' . $today["mon"] . '/' . $today["year"];
$checkout_date = $next2day["mday"] . '/' . $next2day["mon"] . '/' . $next2day["year"];
$days_count = 2;
}
//get controller
//$controller = new VnffhotelController();
//get rooms types of a hotel
$roomTypes = $model->getRoomTypes($hid);
if (count($roomTypes) == 0) {
echo '<div class="notroom_hotel">' . JTEXT::_("HOTEL NOT YET FOR BOOKING") . '</div>';
return;
}
$hotel = $model->getHotel($hid);
//echo $roomTypes[0]->room_Name;
//$cityid = $params->get('cityid', '32');
$this->assignRef('controller', $controller);
$this->assignRef('checkin_date', $checkin_date);
$this->assignRef('checkout_date', $checkout_date);
$this->assignRef('room_id', $room_id);
$this->assignRef('roomTypes', $roomTypes);
$this->assignRef('hotel', $hotel);
$this->assignRef('days_count', $days_count);
parent::display("step1");
}
示例7: getInput
/**
* Method to get the field input markup.
*
* @return string The field input markup.
* @since 1.6
*/
protected function getInput()
{
$app = JFactory::getApplication();
$options = array();
$module_id = $app->input->getInt('id');
$menus = JMenu::getInstance('site');
$menu_id = null;
$menuItems = array();
foreach ($menus->getMenu() as $item) {
if ($item->type == 'component') {
if (isset($item->query['option']) && $item->query['option'] == 'com_j2store') {
if (isset($item->query['catid'])) {
$options[$item->id] = $item->title;
}
}
}
}
return JHTML::_('select.genericlist', $options, $this->name, array('class' => "input"), 'value', 'text', $this->value);
}
示例8: __construct
function __construct()
{
$comp_config =& JComponentHelper::getParams('com_imagebrowser');
$config['root_folder'] = $comp_config->get('root_folder', 'images/stories/imagebrowser');
$config['order_by'] = $comp_config->get('order_by', 'date_modified');
$config['order_direction'] = $comp_config->get('order_direction', 'DESC');
$config['show_comp_description'] = $comp_config->get('show_comp_description', 1);
$config['comp_description'] = $comp_config->get('comp_description', '');
$config['language'] = $comp_config->get('language', '');
$config['max_width'] = $comp_config->get('max_width', 800);
$config['max_height'] = $comp_config->get('max_height', 600);
$config['thumb_width'] = $comp_config->get('thumb_width', 120);
$config['thumb_height'] = $comp_config->get('thumb_height', 90);
$config['imgcomp'] = $comp_config->get('imgcomp', 0);
$config['max_upload_size'] = $comp_config->get('max_upload_size', 2);
// The mode is read from menu item (for frontend only)
$menu =& JMenu::getInstance('site');
$item = $menu->getActive();
if (is_object($item)) {
$params =& $menu->getParams($item->id);
$config['mode'] = $params->get('mode', false);
$config['page_title'] = $params->get('page_title', '');
$config['show_page_title'] = $params->get('show_page_title', 0);
$config['pageclass_sfx'] = $params->get('pageclass_sfx', '');
// Override global component settings with menu item settings
$config['root_folder'] = $params->get('root_folder', $config['root_folder']);
$config['order_by'] = $params->get('order_by', $config['order_by']);
$config['order_direction'] = $params->get('order_direction', $config['order_direction']);
$config['show_comp_description'] = $params->get('show_comp_description', $config['show_comp_description']);
$config['comp_description'] = $params->get('comp_description', $config['comp_description']);
$config['language'] = $params->get('language', $config['language']);
$config['max_width'] = $params->get('max_width', $config['max_width']);
$config['max_height'] = $params->get('max_height', $config['max_height']);
$config['thumb_width'] = $params->get('thumb_width', $config['thumb_width']);
$config['thumb_height'] = $params->get('thumb_height', $config['thumb_height']);
$config['imgcomp'] = $params->get('imgcomp', $config['imgcomp']);
$config['max_upload_size'] = $params->get('max_upload_size', $config['max_upload_size']);
}
$this->config = $config;
}
示例9: __construct
function __construct()
{
$this->projectid = JRequest::getInt("p", 0);
$menu =& JMenu::getInstance('site');
$item = $menu->getActive();
$params =& $menu->getParams($item->id);
$registry = new JRegistry();
$registry->loadArray($params);
//$newparams = $registry->toString('ini');
$newparams = $registry->toArray();
//echo "<b>menue newparams</b><pre>" . print_r($newparams, true) . "</pre>";
foreach ($newparams['data'] as $key => $value) {
$this->_params[$key] = $value;
}
// $this->round = JRequest::getInt( "r", $this->current_round);
// $this->part = JRequest::getInt( "part", 0);
// $this->from = JRequest::getInt( 'from', $this->round );
// $this->to = JRequest::getInt( 'to', $this->round);
// $this->type = JRequest::getInt( 'type', 0 );
// $this->last = JRequest::getInt( 'last', 0 );
// $this->selDivision = JRequest::getInt( 'division', 0 );
parent::__construct();
}
示例10: _getItemid
protected static function _getItemid($view = 'galleries', $id = 0, $default = 0)
{
$item = null;
$menu = JMenu::getInstance('site');
if ($id && ($items = $menu->getItems('link', 'index.php?option=com_fwgallery&view=' . $view))) {
foreach ($items as $menuItem) {
if (is_string($menuItem->params) && preg_match('/id\\=' . $id . '\\s/ms', $menuItem->params) || is_object($menuItem->params) && $id == $menuItem->params->get('id')) {
$item = $menuItem;
break;
}
}
}
if ($item === null) {
$item = $menu->getItems('link', 'index.php?option=com_fwgallery&view=galleries', true);
}
if ($item) {
return $item->id;
} elseif ($default) {
return $default;
} elseif ($item = $menu->getActive()) {
return $item->id;
}
}
示例11: getMenu
/**
* Returns the application JMenu object.
*
* @param string $name The name of the application/client.
* @param array $options An optional associative array of configuration settings.
*
* @return JMenu
*
* @since 3.2
*/
public function getMenu($name = null, $options = array())
{
if (!isset($name)) {
$name = $this->getName();
}
try {
$menu = JMenu::getInstance($name, $options);
} catch (Exception $e) {
return null;
}
return $menu;
}
示例12: getMenuParams
/**
*
* Get params of menu item
*
* @param Number $id
*/
public static function getMenuParams($id)
{
$menuSite = JMenu::getInstance('site');
$Item = $menuSite->getItem($id);
if (isset($Item->params)) {
if ($Item->params instanceof JRegistry) {
return $Item->params;
}
}
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select("params");
$query->from("#__menu");
$query->where("id = " . $db->quote($id));
$db->setQuery($query);
$paramsString = $db->loadResult();
$jParams = new JRegistry();
$jParams->loadObject(json_decode($paramsString));
return $jParams;
}
示例13: defined
<?php
/**
* Articles Newsflash Advanced
*
* @author TemplateMonster http://www.templatemonster.com
* @copyright Copyright (C) 2012 - 2013 Jetimpex, Inc.
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2
* Parts of this software are based on Articles Newsflash standard module
*
*/
defined('_JEXEC') or die;
// Include the syndicate functions only once
require_once __DIR__ . '/helper.php';
$menu = JMenu::getInstance('site');
$app = JFactory::getApplication();
$document =& JFactory::getDocument();
$list = modArticlesNewsHelper::getList($params);
$moduleclass_sfx = htmlspecialchars($params->get('moduleclass_sfx'));
$columns = (int) $params->get('columns');
$bootstrap_layout = $params->get('bootstrap_layout');
switch ($bootstrap_layout) {
case 0:
$row_class = 'row';
break;
case 1:
$row_class = 'row-fluid';
break;
default:
$row_class = 'row';
break;
示例14: createURI
/**
* Create a uri based on a full or partial url string
*
* @param string $url The URI
*
* @return JUri
*
* @since 3.2
*/
protected function createURI($url)
{
// Create the URI
$uri = parent::createURI($url);
// Get the itemid form the URI
$itemid = $uri->getVar('Itemid');
if (is_null($itemid)) {
if ($option = $uri->getVar('option')) {
$item = $this->menu->getItem($this->getVar('Itemid'));
if (isset($item) && $item->component == $option) {
$uri->setVar('Itemid', $item->id);
}
} else {
if ($option = $this->getVar('option')) {
$uri->setVar('option', $option);
}
if ($itemid = $this->getVar('Itemid')) {
$uri->setVar('Itemid', $itemid);
}
}
} else {
if (!$uri->getVar('option')) {
if ($item = $this->menu->getItem($itemid)) {
$uri->setVar('option', $item->component);
}
}
}
return $uri;
}
示例15: authorize
function authorize($id)
{
if (J1_6) {
return $this->authorise($id);
} else {
$user =& JFactory::getUser();
return parent::authorize($id, $user->get('aid'));
}
}