Actions

API15

JTableSection/check

From Joomla! Documentation

< API15:JTableSection
Revision as of 17:17, 22 March 2010 by Doxiki (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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

Overloaded check function

[Edit Descripton]

Description:JTableSection/check

Syntax

check()


Returns

boolean

Defined in

libraries/joomla/database/table/section.php

Importing

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

Source Body

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

Examples

<CodeExamplesForm />