API15

JTableSection/check

From Joomla! Documentation

< API15:JTableSection
Revision as of 17:17, 22 March 2010 by Doxiki (talk | contribs) (New page: ===Description=== Overloaded check function <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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]

Overloaded check function

[Edit Descripton]

Template:Description:JTableSection/check

Syntax[edit]

check()


Returns[edit]

boolean

Defined in[edit]

libraries/joomla/database/table/section.php

Importing[edit]

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

Source Body[edit]

function check()
{
        // check for valid name
        if (trim( $this->title ) == '') {
                $this->setError( JText::_( 'SECTION MUST HAVE A TITLE') );
                return false;
        }

        // check for existing name
        /*$query = "SELECT id"
        . ' FROM #__sections "
        . ' WHERE title = '. $this->_db->Quote($this->title)
        . ' AND scope = ' . $this->_db->Quote($this->scope)
        ;
        $this->_db->setQuery( $query );

        $xid = intval( $this->_db->loadResult() );
        if ($xid && $xid != intval( $this->id )) {
                $this->_error = JText::sprintf( 'WARNNAMETRYAGAIN', JText::_( 'Section') );
                return false;
        }*/

        if(empty($this->alias)) {
                $this->alias = $this->title;
        }
        $this->alias = JFilterOutput::stringURLSafe($this->alias);
        if(trim(str_replace('-','',$this->alias)) == '') {
                $datenow =& JFactory::getDate();
                $this->alias = $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
        }

        return true;
}

[Edit See Also] Template:SeeAlso:JTableSection/check

Examples[edit]

<CodeExamplesForm />