API16

JTableMenuType/check

From Joomla! Documentation

< API16:JTableMenuType
Revision as of 17:42, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== boolean <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> {{De...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

The "API16" 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


[Edit Descripton]

Template:Description:JTableMenuType/check

Syntax[edit]

check()


Returns[edit]

boolean

Defined in[edit]

libraries/joomla/database/table/menutype.php

Importing[edit]

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

Source Body[edit]

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] Template:SeeAlso:JTableMenuType/check

Examples[edit]

<CodeExamplesForm />