Difference between revisions of "JTableMenuTypes/check"
From Joomla! Documentation
< API15:JTableMenuTypes
(New page: ===Description===
boolean
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{D...) |
m (removing red link to edit, no existant pages) |
||
Line 4: | Line 4: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 71: | Line 71: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 86: | Line 86: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API15]] |
Revision as of 13:53, 12 May 2013
The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
boolean
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
check()
Returns[edit]
boolean
Defined in[edit]
libraries/joomla/database/table/menutypes.php
Importing[edit]
jimport( 'joomla.database.table.menutypes' );
Source Body[edit]
function check()
{
$this->menutype = str_replace('-', ' ', $this->menutype);
$lang =& JFactory::getLanguage();
$this->menutype = $lang->transliterate($this->menutype);
$this->menutype = preg_replace(array('/\s+/','/[^A-Za-z0-9\-\_]/'), array('-',''), $this->menutype);
$this->menutype = trim(strtolower($this->menutype));
if(empty($this->menutype)) {
$this->setError( "Cannot save: Empty menu type" );
return false;
}
// correct spurious data
if (trim( $this->title) == '') {
$this->title = $this->menutype;
}
$db =& JFactory::getDBO();
// check for unique menutype for new menu copy
$query = 'SELECT menutype' .
' FROM #__menu_types';
if ($this->id) {
$query .= ' WHERE id != '.(int) $this->id;
}
$db->setQuery( $query );
$menus = $db->loadResultArray();
foreach ($menus as $menutype)
{
if ($menutype == $this->menutype)
{
$this->setError( "Cannot save: Duplicate menu type '{$this->menutype}'" );
return false;
}
}
return true;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />