API16:JTable/isCheckedOut
From Joomla! Documentation
Description
TODO: This either needs to be static or not.
Template: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] Template:SeeAlso:JTable/isCheckedOut
Examples
<CodeExamplesForm />