Actions

API16

JTableContent/store

From Joomla! Documentation

< API16:JTableContent
Revision as of 17:42, 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

Overriden JTable::store to set modified data and user id.

[Edit Descripton]

Description:JTableContent/store

Syntax

store($updateNulls=false)
Parameter Name Default Value Description
$updateNulls false True to update fields even if they are null.

Returns

boolean True on success.

Defined in

libraries/joomla/database/table/content.php

Importing

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

Source Body

public function store($updateNulls = false)
{
        $date   = JFactory::getDate();
        $user   = JFactory::getUser();
        if ($this->id) {
                // Existing item
                $this->modified         = $date->toMySQL();
                $this->modified_by      = $user->get('id');
        } else {
                // New article. An article created and created_by field can be set by the user,
                // so we don't touch either of these if they are set.
                if (!intval($this->created)) {
                        $this->created = $date->toMySQL();
                }
                if (empty($this->created_by)) {
                        $this->created_by = $user->get('id');
                }
        }
 
        return parent::store($updateNulls);
}

[Edit See Also] SeeAlso:JTableContent/store

Examples

<CodeExamplesForm />