Actions

API16

JTableMenuType/check

From Joomla! Documentation

< API16:JTableMenuType
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

boolean


[Edit Descripton]

Description:JTableMenuType/check

Syntax

check()


Returns

boolean

Defined in

libraries/joomla/database/table/menutype.php

Importing

jimport( 'joomla.database.table.menutype' );

Source Body

function check()
{
        $this->menutype = JApplication::stringURLSafe($this->menutype);
        if (empty($this->menutype)) {
                $this->setError(JText::_('Menu_Error_Menutype_empty'));
                return false;
        }
 
        // Sanitise data.
        if (trim($this->title) == '') {
                $this->title = $this->menutype;
        }
 
        $db     = &$this->getDbo();
 
        // Check for unique menutype.
        $db->setQuery(
                'SELECT COUNT(id)' .
                ' FROM #__menu_types' .
                ' WHERE menutype = '.$db->quote($this->menutype).
                '  AND id <> '.(int) $this->id
        );
 
        if ($db->loadResult())
        {
                $this->setError(JText::sprintf('Menu_Error_Menutype_exists', $this->menutype));
                return false;
        }
 
        return true;
}

[Edit See Also] SeeAlso:JTableMenuType/check

Examples

<CodeExamplesForm />