API16:JModelForm/checkin
From Joomla! Documentation
Description
Method to checkin a row.
Syntax
checkin($pk=null)
| Parameter Name | Default Value | Description |
|---|---|---|
| $pk | null | $pk The numeric id of the primary key. |
Returns
boolean False on failure or error, true otherwise.
Defined in
libraries/joomla/application/component/modelform.php
Importing
jimport( 'joomla.application.component.modelform' );
Source Body
public function checkin($pk = null)
{
// Only attempt to check the row in if it exists.
if ($pk)
{
$user = JFactory::getUser();
// Get an instance of the row to checkin.
$table = $this->getTable();
if (!$table->load($pk)) {
$this->setError($table->getError());
return false;
}
// Check if this is the user having previously checked out the row.
if ($table->checked_out > 0 && $table->checked_out != $user->get('id'))
{
$this->setError(JText::_('JError_Checkin_user_mismatch'));
return false;
}
// Attempt to check the row in.
if (!$table->checkin($pk))
{
$this->setError($table->getError());
return false;
}
}
return true;
}
Examples
Code Examples