Source for file menu.php
Documentation is available at menu.php
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @param JDatabaseDriver $db Database driver object.
parent::__construct('#__menu', 'id', $db);
// Set the default access level.
* Overloaded bind function
* @param array $array Named array
* @param mixed $ignore An optional array or space separated list of properties to ignore while binding.
* @return mixed Null if operation was satisfactory, otherwise returns an error
public function bind($array, $ignore =
'')
// Verify that the default home menu is not unset
if ($this->home ==
'1' &&
$this->language ==
'*' &&
($array['home'] ==
'0'))
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT_DEFAULT'));
// Verify that the default home menu set to "all" languages" is not unset
if ($this->home ==
'1' &&
$this->language ==
'*' &&
($array['language'] !=
'*'))
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_CANNOT_UNSET_DEFAULT'));
// Verify that the default home menu is not unpublished
if ($this->home ==
'1' &&
$this->language ==
'*' &&
$array['published'] !=
'1')
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNPUBLISH_DEFAULT_HOME'));
if (isset
($array['params']) &&
is_array($array['params']))
$registry->loadArray($array['params']);
$array['params'] = (string)
$registry;
return parent::bind($array, $ignore);
* Overloaded check function
* @return boolean True on success
// Set correct component id to ensure proper 404 messages with separator items
if ($this->type ==
"separator")
// If the alias field is empty, set it to the title.
if ((empty($this->alias)) &&
($this->type !=
'alias' &&
$this->type !=
'url'))
$this->alias =
$this->title;
// Make the alias URL safe.
// Cast the home property to an int for checking.
$this->home = (int)
$this->home;
// Verify that a first level menu item alias is not 'component'.
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_ROOT_ALIAS_COMPONENT'));
// Verify that a first level menu item alias is not the name of a folder.
jimport('joomla.filesystem.folder');
// Verify that the home item a component.
if ($this->home &&
$this->type !=
'component')
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_COMPONENT'));
* Overloaded store function
* @param boolean $updateNulls True to update fields even if they are null.
* @return mixed False on failure, positive integer on success.
public function store($updateNulls =
false)
// Verify that the alias is unique
if ($table->load(array('alias' =>
$this->alias, 'parent_id' =>
$this->parent_id, 'client_id' => (int)
$this->client_id, 'language' =>
$this->language))
&&
($table->id !=
$this->id ||
$this->id ==
0))
if ($this->menutype ==
$table->menutype)
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_UNIQUE_ALIAS_ROOT'));
// Verify that the home page for this language is unique
if ($table->load(array('home' =>
'1', 'language' =>
$this->language)))
if ($table->checked_out &&
$table->checked_out !=
$this->checked_out)
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_DEFAULT_CHECKIN_USER_MISMATCH'));
$table->checked_out_time =
$db->getNullDate();
// Verify that the home page for this menu is unique.
if ($table->load(array('home' =>
'1', 'menutype' =>
$this->menutype)) &&
($table->id !=
$this->id ||
$this->id ==
0))
$this->setError(JText::_('JLIB_DATABASE_ERROR_MENU_HOME_NOT_UNIQUE_IN_MENU'));
if (!parent::store($updateNulls))
// Get the new path in case the node was moved
foreach ($pathNodes as $node)
// Don't include root in path
if ($node->alias !=
'root')
$segments[] =
$node->alias;
// Use new path for partial rebuild of table
// Rebuild will return positive integer on success, false on failure
Documentation generated on Tue, 19 Nov 2013 15:07:51 +0100 by phpDocumentor 1.4.3