API16:JTable/isCheckedOut
From Joomla! Documentation
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
TODO: This either needs to be static or not.
Description:JTable/isCheckedOut
Syntax
isCheckedOut($with=0, $against=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $with | 0 | The userid to preform the match with, if an item is checked out by this user the function will return false. |
| $against | null | The userid to perform the match against when the function is used as a static function. |
Returns
boolean True if checked out.
Defined in
libraries/joomla/database/table.php
Importing
jimport( 'joomla.database.table' );
Source Body
public function isCheckedOut($with = 0, $against = null) { // Handle the non-static case. if (isset($this) && ($this instanceof JTable) && is_null($against)) { $against = $this->get('checked_out'); } // The item is not checked out or is checked out by the same user. if (!$against || ($against == $with)) { return false; } $db = JFactory::getDBO(); $db->setQuery( 'SELECT COUNT(userid)' . ' FROM `#__session`' . ' WHERE `userid` = '.(int) $against ); $checkedOut = (boolean) $db->loadResult(); // If a session exists for the user then it is checked out. return $checkedOut; }
[Edit See Also] SeeAlso:JTable/isCheckedOut
Examples
<CodeExamplesForm />
