本文整理汇总了PHP中JMenu类的典型用法代码示例。如果您正苦于以下问题:PHP JMenu类的具体用法?PHP JMenu怎么用?PHP JMenu使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JMenu类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:templaza,项目名称:tz_portfolio_plus,代码行数:31,代码来源:template_styles.php
示例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);
}
开发者ID:vCodeTech,项目名称:ivivu,代码行数:33,代码来源:view.html.php
示例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;
}
开发者ID:lautarodragan,项目名称:ideary,代码行数:11,代码来源:utility.php
示例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();
}
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:51,代码来源:rankingalltime.php
示例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;
}
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:18,代码来源:poweradmin.php
示例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");
}
开发者ID:vCodeTech,项目名称:ivivu,代码行数:49,代码来源:view.html.php
示例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);
}
开发者ID:davetheapple,项目名称:oakencraft,代码行数:25,代码来源:j2storemenuitem.php
示例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;
}
开发者ID:planetangel,项目名称:Planet-Angel-Website,代码行数:40,代码来源:config.php
示例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();
}
开发者ID:santas156,项目名称:joomleague-2-komplettpaket,代码行数:23,代码来源:jlallprojectrounds.php
示例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;
}
}
开发者ID:ForAEdesWeb,项目名称:AEW2,代码行数:23,代码来源:com_fwgallery.plugin.php
示例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;
}
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:22,代码来源:cms.php
示例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;
}
开发者ID:kleinhelmi,项目名称:tus03_j3_2015_01,代码行数:26,代码来源:config.php
示例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;
开发者ID:butterflydevelopment,项目名称:butterfly-test,代码行数:31,代码来源:mod_articles_news_adv.php
示例14: createMenu
public function createMenu($menu, $submenu)
{
jimport('joomla.utilities.string');
jimport('joomla.application.component.helper');
$component_id = JComponentHelper::getComponent('com_judirectory')->id;
$db = JFactory::getDbo();
$query = "UPDATE #__menu SET component_id=" . $db->quote($component_id) . " WHERE type = 'component' AND link LIKE '%option=com_judirectory%'";
$db->setQuery($query);
$db->execute();
if ($db->getErrorNum()) {
throw new Exception($db->getErrorMsg(), $db->getErrorNum());
}
$table = JTable::getInstance('MenuType');
$data = array('menutype' => 'judirectorymenu', 'title' => 'JU Directory', 'description' => '');
if (!$table->bind($data) || !$table->check()) {
return true;
}
if (!$table->store()) {
throw new Exception($table->getError());
}
$table = JTable::getInstance('menu');
$table->load(array('menutype' => 'judirectorymenu', 'link' => $menu['link']));
$paramdata = array('menu-anchor_title' => '', 'menu-anchor_css' => '', 'menu_image' => '', 'menu_text' => 1, 'page_title' => '', 'show_page_heading' => 0, 'page_heading' => '', 'pageclass_sfx' => '', 'menu-meta_description' => '', 'menu-meta_keywords' => '', 'robots' => '', 'secure' => 0);
$gparams = new JRegistry($paramdata);
$params = clone $gparams;
$params->loadArray($menu['params']);
$data = array('menutype' => 'judirectorymenu', 'title' => $menu['name'], 'alias' => $menu['alias'], 'link' => $menu['link'], 'type' => 'component', 'published' => 1, 'parent_id' => 1, 'component_id' => $component_id, 'access' => $menu['access'], 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
$table->setLocation(1, 'last-child');
if (!$table->bind($data) || !$table->check() || !$table->store()) {
$table->alias = 'joomultra-directory';
if (!$table->check() || !$table->store()) {
throw new Exception($table->getError());
}
}
$parent = $table;
foreach ($submenu as $menuitem) {
$params = clone $gparams;
$params->loadArray($menuitem['params']);
$table = JTable::getInstance('menu');
$table->load(array('menutype' => 'judirectorymenu', 'link' => $menuitem['link']));
$data = array('menutype' => 'judirectorymenu', 'title' => $menuitem['name'], 'alias' => $menuitem['alias'], 'link' => $menuitem['link'], 'type' => 'component', 'published' => 1, 'parent_id' => $parent->id, 'component_id' => $component_id, 'access' => $menuitem['access'], 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
$table->setLocation($parent->id, 'last-child');
if (!$table->bind($data) || !$table->check() || !$table->store()) {
throw new Exception($table->getError());
}
}
$defaultmenu = JMenu::getInstance('site')->getDefault();
if (!$defaultmenu) {
return true;
}
$table = JTable::getInstance('menu');
$table->load(array('menutype' => $defaultmenu->menutype, 'type' => 'alias', 'title' => 'JU Directory'));
if (!$table->id) {
$data = array('menutype' => $defaultmenu->menutype, 'title' => 'JU Directory', 'alias' => 'judirectory-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'type' => 'alias', 'published' => 0, 'parent_id' => 1, 'component_id' => 0, 'access' => 1, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}', 'home' => 0, 'language' => '*', 'client_id' => 0);
$table->setLocation(1, 'last-child');
} else {
$data = array('alias' => 'judirectory-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}');
}
if (!$table->bind($data) || !$table->check() || !$table->store()) {
throw new Exception($table->getError());
}
return true;
}
开发者ID:ranrolls,项目名称:ras-full-portal,代码行数:63,代码来源:installer.php
示例15: saveDataToTableMenu
/**
* Saves data to the core menu table
*
* @param string $title
* @param string $description
* @param string $keywords
*/
private function saveDataToTableMenu($title, $description, $keywords)
{
$menu = JMenu::getInstance('site')->getActive();
// Check whether menu entry for the specific item exists - e.g. do not overwrite data of blog entry
foreach ($menu->query as $key => $value) {
if ($value != $this->request->get($key, 'cmd')) {
return;
}
}
$menu_params_array = JMenu::getInstance('site')->getParams($menu->id)->toArray();
$save_data_table_menu = $this->params->get('save_data_table_menu');
$title_array = array(1, 4, 5, 7);
$description_array = array(2, 4, 6, 7);
$keywords_array = array(3, 5, 6, 7);
if (in_array($save_data_table_menu, $title_array)) {
$menu_params_array['page_title'] = $title;
}
if (in_array($save_data_table_menu, $description_array)) {
$menu_params_array['menu-meta_description'] = $description;
}
if (in_array($save_data_table_menu, $keywords_array)) {
$menu_params_array['menu-meta_keywords'] = $keywords;
}
$menu_params = json_encode($menu_params_array);
$query = "UPDATE " . $this->db->quoteName('#__menu') . " SET " . $this->db->quoteName('params') . " = " . $this->db->quote($menu_params) . " WHERE " . $this->db->quoteName('id') . " = " . $this->db->quote((int) $this->request->get('Itemid'));
$this->db->setQuery($query);
$this->db->execute();
}
开发者ID:theBeatle,项目名称:Joomla_CMS_project,代码行数:35,代码来源:easyfrontendseo.php
示例16: 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|null
*
* @since 3.2
*/
public function getMenu($name = null, $options = array())
{
if (!isset($name)) {
$name = $this->getName();
}
// Inject this application object into the JMenu tree if one isn't already specified
if (!isset($options['app'])) {
$options['app'] = $this;
}
try {
$menu = JMenu::getInstance($name, $options);
} catch (Exception $e) {
return null;
}
return $menu;
}
开发者ID:rhellyer,项目名称:joomla-cms,代码行数:26,代码来源:cms.php
示例17: createMenuJ25
function createMenuJ25($menu, $submenu)
{
jimport('joomla.utilities.string');
jimport('joomla.application.component.helper');
$config = KunenaFactory::getConfig();
$component_id = JComponentHelper::getComponent('com_kunena')->id;
// First fix all broken menu items
$query = "UPDATE #__menu SET component_id={$this->db->quote($component_id)} WHERE type = 'component' AND link LIKE '%option=com_kunena%'";
$this->db->setQuery($query);
$this->db->query();
if ($this->db->getErrorNum()) {
throw new KunenaInstallerException($this->db->getErrorMsg(), $this->db->getErrorNum());
}
$table = JTable::getInstance('menutype');
$data = array('menutype' => 'kunenamenu', 'title' => JText::_('COM_KUNENA_MENU_TITLE'), 'description' => JText::_('COM_KUNENA_MENU_TITLE_DESC'));
if (!$table->bind($data) || !$table->check()) {
// Menu already exists, do nothing
return true;
}
if (!$table->store()) {
throw new KunenaInstallerException($table->getError());
}
$table = JTable::getInstance('menu');
$table->load(array('menutype' => 'kunenamenu', 'link' => $menu['link']));
$paramdata = array('menu-anchor_title' => '', 'menu-anchor_css' => '', 'menu_image' => '', 'menu_text' => 1, 'page_title' => '', 'show_page_heading' => 0, 'page_heading' => '', 'pageclass_sfx' => '', 'menu-meta_description' => '', 'menu-meta_keywords' => '', 'robots' => '', 'secure' => 0);
$gparams = new JRegistry($paramdata);
$params = clone $gparams;
$params->loadArray($menu['params']);
$data = array('menutype' => 'kunenamenu', 'title' => $menu['name'], 'alias' => $menu['alias'], 'link' => $menu['link'], 'type' => 'component', 'published' => 1, 'parent_id' => 1, 'component_id' => $component_id, 'access' => $menu['access'] + 1, 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
if (!$table->setLocation(1, 'last-child') || !$table->bind($data) || !$table->check() || !$table->store()) {
$table->alias = 'kunena';
if (!$table->check() || !$table->store()) {
throw new KunenaInstallerException($table->getError());
}
}
$parent = $table;
$defaultmenu = 0;
foreach ($submenu as $menuitem) {
$params = clone $gparams;
$params->loadArray($menuitem['params']);
$table = JTable::getInstance('menu');
$table->load(array('menutype' => 'kunenamenu', 'link' => $menuitem['link']));
$data = array('menutype' => 'kunenamenu', 'title' => $menuitem['name'], 'alias' => $menuitem['alias'], 'link' => $menuitem['link'], 'type' => 'component', 'published' => 1, 'parent_id' => $parent->id, 'component_id' => $component_id, 'access' => $menuitem['access'] + 1, 'params' => (string) $params, 'home' => 0, 'language' => '*', 'client_id' => 0);
if (!$table->setLocation($parent->id, 'last-child') || !$table->bind($data) || !$table->check() || !$table->store()) {
throw new KunenaInstallerException($table->getError());
}
if (!$defaultmenu || isset($menuitem['default']) && $config->defaultpage == $menuitem['default']) {
$defaultmenu = $table->id;
}
}
// Update forum menuitem to point into default page
$parent->link .= "&defaultmenu={$defaultmenu}";
if (!$parent->check() || !$parent->store()) {
throw new KunenaInstallerException($table->getError());
}
// Finally create alias
$defaultmenu = JMenu::getInstance('site')->getDefault();
if (!$defaultmenu) {
return true;
}
$table = JTable::getInstance('menu');
$table->load(array('menutype' => $defaultmenu->menutype, 'type' => 'alias', 'title' => JText::_('COM_KUNENA_MENU_ITEM_FORUM')));
if (!$table->id) {
$data = array('menutype' => $defaultmenu->menutype, 'title' => JText::_('COM_KUNENA_MENU_ITEM_FORUM'), 'alias' => 'kunena-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'type' => 'alias', 'published' => 0, 'parent_id' => 1, 'component_id' => 0, 'access' => 1, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}', 'home' => 0, 'language' => '*', 'client_id' => 0);
if (!$table->setLocation(1, 'last-child')) {
throw new KunenaInstallerException($table->getError());
}
} else {
$data = array('alias' => 'kunena-' . JFactory::getDate()->format('Y-m-d'), 'link' => 'index.php?Itemid=' . $parent->id, 'params' => '{"aliasoptions":"' . (int) $parent->id . '","menu-anchor_title":"","menu-anchor_css":"","menu_image":""}');
}
if (!$table->bind($data) || !$table->check() || !$table->store()) {
throw new KunenaInstallerException($table->getError());
}
}
开发者ID:laiello,项目名称:senluonirvana,代码行数:74,代码来源:model.php
示例18: buildFromViewAndId
/**
* buildFromViewAndId
*
* @param string $component
* @param string $view
* @param array $queries
* @param boolean $replace
* @param \JMenu $menu
*/
public static function buildFromViewAndId($component, $view, &$queries, &$replace, \JMenu $menu)
{
// Get all com_flower menus
$menuItems = $menu->getItems('component', $component);
// Find matched menu item.
foreach ($menuItems as $menuItem) {
if (isset($menuItem->query['view']) && $menuItem->query['view'] == $view && isset($menuItem->query['id']) && $menuItem->query['id'] == $queries['id']) {
// Replace core route rule.
$replace = true;
// Only return menu Itemid then Joomla will convert to menu alias
$queries = array('Itemid' => $menuItem->id);
}
}
// No menu matched, follows default rule.
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:24,代码来源:RadRoutingHelper.php
示例19: getMenu
/**
* Returns the application JPathway object.
*
* @param string $name The name of the application/client.
* @param array $options An optional associative array of configuration settings.
*
* @return JMenu JMenu object.
*
* @since 11.1
*/
public function getMenu($name = null, $options = array())
{
if (!isset($name)) {
$name = $this->_name;
}
jimport('joomla.application.menu');
$menu = JMenu::getInstance($name, $options);
if ($menu instanceof Exception) {
return null;
}
return $menu;
}
开发者ID:brojask,项目名称:colegio-abogados-joomla,代码行数:22,代码来源:application.php
示例20: display
/**
* Control panel display
*
* @access public
* @param string $tpl
* @return void
*/
public function display($tpl = null)
{
$doc = $this->document;
$componentParams = $this->getModel()->getState('cparams');
$base = JUri::root();
$this->loadJQuery($doc);
$this->loadBootstrap($doc);
$doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/cpanel.css');
$doc->addStylesheet(JURI::root(true) . '/administrator/components/com_jmap/css/jquery.fancybox.css');
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/chart.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/cpanel.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/analyzer.js');
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/metainfo.js');
if ($componentParams->get('seostats_enabled', 1)) {
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/seostats.js');
}
if ($componentParams->get('enable_precaching', 0)) {
$doc->addScript(JURI::root(true) . '/administrator/components/com_jmap/js/xmlprecaching.js');
}
$doc->addCustomTag('<script type="text/javascript" src="' . JURI::root(true) . '/administrator/components/com_jmap/js/jquery.fancybox.pack.js' . '"></script>');
// Inject js translations
$translations = array('COM_JMAP_ROBOTSPROGRESSTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLE', 'COM_JMAP_ROBOTSPROGRESSSUBTITLESUCCESS', 'COM_JMAP_ROBOTSPROGRESSSUBTITLEERROR', 'COM_JMAP_PRECACHING_TITLE', 'COM_JMAP_START_PRECACHING_PROCESS', 'COM_JMAP_PRECACHING_NO_DATASOURCES_FOUND', 'COM_JMAP_PRECACHING_PROCESS_RUNNING', 'COM_JMAP_PRECACHING_PROCESS_COMPLETED', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE', 'COM_JMAP_PRECACHING_REPORT_DATASOURCE_TYPE', 'COM_JMAP_PRECACHING_REPORT_LINKS', 'COM_JMAP_PRECACHING_DATA_SOURCE_COMPLETED', 'COM_JMAP_PRECACHING_DATASOURCES_RETRIEVED', 'COM_JMAP_PRECACHING_PROCESS_FINALIZING', 'COM_JMAP_PRECACHING_INTERRUPT', 'COM_JMAP_PRECACHING_CACHED', 'COM_JMAP_PRECACHING_NOT_CACHED', 'COM_JMAP_PRECACHING_CLEARING', 'COM_JMAP_PRECACHING_CLEAR_CACHE', 'COM_JMAP_PUBLISHED_DATA_SOURCE_CHART', 'COM_JMAP_TOTAL_DATA_SOURCE_CHART', 'COM_JMAP_DATASETS_CHART', 'COM_JMAP_MENU_DATA_SOURCE_CHART', 'COM_JMAP_USER_DATA_SOURCE_CHART', 'COM_JMAP_ANALYZER_TITLE', 'COM_JMAP_ANALYZER_PROCESS_RUNNING', 'COM_JMAP_ANALYZER_STARTED_SITEMAP_GENERATION', 'COM_JMAP_ANALYZER_ERROR_STORING_FILE', 'COM_JMAP_ANALYZER_GENERATION_COMPLETE', 'COM_JMAP_METAINFO_TITLE', 'COM_JMAP_METAINFO_PROCESS_RUNNING', 'COM_JMAP_METAINFO_STARTED_SITEMAP_GENERATION', 'COM_JMAP_METAINFO_ERROR_STORING_FILE', 'COM_JMAP_METAINFO_GENERATION_COMPLETE', 'COM_JMAP_SEOSTATS_LOADING', 'COM_JMAP_ALEXA_GRAPH', 'COM_JMAP_NULL_RESPONSEDATA', 'COM_JMAP_ERROR_HTTP');
$this->injectJsTranslations($translations, $doc);
// Check for custom link domain
$customDomain = trim($componentParams->get('custom_sitemap_domain', ''));
$livesite = $customDomain ? rtrim($customDomain, '/') : substr_replace(JURI::root(), "", -1, 1);
$user = JFactory::getUser();
$lists = $this->get('Lists');
$infoData = $this->get('Data');
$doc->addScriptDeclaration('var jmapChartData = ' . json_encode($infoData));
$doc->addScriptDeclaration("var jmap_baseURI='{$base}';");
$doc->addScriptDeclaration("var jmap_linksRandom=" . $componentParams->get('sitemap_links_random', 0) . ";");
$doc->addScriptDeclaration("var jmap_forceFormat=" . $componentParams->get('sitemap_links_forceformat', 0) . ";");
// Assign SEF mode
$this->siteRouter = JRouterSite::getInstance('site', array('mode' => JROUTER_MODE_SEF));
$this->showSefLinks = $componentParams->get('sitemap_links_sef', false);
$this->joomlaSefLinks = JFactory::getConfig()->get('sef', true);
$this->siteItemid = null;
if ($this->showSefLinks && $this->joomlaSefLinks) {
$siteItemid = trim($componentParams->get('site_itemid', null));
if ($siteItemid && is_numeric($siteItemid)) {
$menuItem = JMenu::getInstance('site')->getItem((int) $siteItemid);
if (isset($menuItem->alias)) {
$menuAlias = $menuItem->alias;
$doc->addScriptDeclaration("var jmap_sef_alias_links='{$menuAlias}';");
$this->siteItemid = '&Itemid=' . (int) $siteItemid;
}
}
}
// Buffer delle icons
ob_start();
$this->getIcon('index.php?option=com_jmap&task=sources.display', 'icon-48-data.png', JText::_('COM_JMAP_SITEMAP_SOURCES'), '', 'title="' . JText::_('COM_JMAP_SITEMAP_SOURCES') . '"');
$this->getIcon('index.php?option=com_jmap&task=wizard.display', 'icon-48-wizard.png', JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE'), '', 'title="' . JText::_('COM_JMAP_NEW_WIZARD_DATASOURCE') . '"');
$this->getIcon($livesite . '/index.php?option=com_jmap&view=sitemap', 'icon-48-html_sitemap.png', JText::_('COM_JMAP_SHOW_HTML_MAP'), 'target="_blank"', 'title="' . JText::_('COM_JMAP_SHOW_HTML_MAP') . '"', 'data-role="torefresh"');
$this->getIcon('#xmlsitemap', 'icon-48-xml_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP') . '"', 'class="fancybox"');
$this->getIcon('#xmlsitemap_xslt', 'icon-48-xsl_sitemap.png', JText::_('COM_JMAP_SHOW_XML_MAP_XSLT'), '', 'title="' . JText::_('COM_JMAP_SHOW_XML_MAP_XSLT') . '"', 'class="fancybox"');
$this->getIcon('#xmlsitemap_export', 'icon-48-xml_export.png', JText::_('COM_JMAP_EXPORT_XML_SITEMAP'), '', 'title="' . JText::_('COM_JMAP_EXPORT_XML_SITEMAP') . '"', 'class="fancybox"');
$this->getIcon(substr_replace(JURI::root(), "", -1, 1) . '/index.php?option=com_jmap&task=sitemap.exportxml&format=xml', 'icon-48-analyze.png', JText::_('COM_JMAP_ANALYZE_MAP'), '', 'title="' . JTe
|
请发表评论