JTable/checkout: Difference between revisions
From Joomla! Documentation
New page: ===Description===
Checks out a row
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
{{... |
m preparing for archive only |
||
| (One intermediate revision by the same user not shown) | |||
| Line 3: | Line 3: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Syntax=== | ===Syntax=== | ||
| Line 63: | Line 63: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
<nowiki>[< | <nowiki>[<! removed edit link to red link >]</nowiki> | ||
</span> | </span> | ||
<! removed transcluded page call, red link never existed > | |||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=checkout | category=checkout | ||
category=JTable | category=JTable | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
[[Category:Archived pages API15]] | |||
Latest revision as of 01:10, 25 March 2017
Description
Checks out a row
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
checkout($who, $oid=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $who | The id of the user | |
| $oid | null | The primary key value for the row |
Returns
boolean True if successful, or if checkout is not supported
Defined in
libraries/joomla/database/table.php
Importing
jimport( 'joomla.database.table' );
Source Body
function checkout( $who, $oid = null )
{
if (!in_array( 'checked_out', array_keys($this->getProperties()) )) {
return true;
}
$k = $this->_tbl_key;
if ($oid !== null) {
$this->$k = $oid;
}
$date =& JFactory::getDate();
$time = $date->toMysql();
$query = 'UPDATE '.$this->_db->nameQuote( $this->_tbl ) .
' SET checked_out = '.(int)$who.', checked_out_time = '.$this->_db->Quote($time) .
' WHERE '.$this->_tbl_key.' = '. $this->_db->Quote($this->$k);
$this->_db->setQuery( $query );
$this->checked_out = $who;
$this->checked_out_time = $time;
return $this->_db->query();
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples