1.5 Template Project

The Joomla! Documentation Working Group is running a project to develop detailed reference and tutorial material on Joomla! 1.5 templates.  There is a project page on the documentation wiki where you can see the work in progress and help us by contributing your knowledge.

Who's Online

We have 4 guests online

Help Site License

The Joomla! Help Site content is copyright © 2005 - 2008 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution NonCommercial ShareAlike 2.5. Some parts of this website may be subject to other licenses.
Home arrow Developer Manual arrow 11. API Reference arrow [WORKING] mosDBTable->checkin

[WORKING] mosDBTable->checkin PDF Print E-mail

Last reviewed: Not reviewed


Generic check-in function.  This method may be overloaded/supplemented by the child class as required.

Clears the checked_out flag and resets the checked_out_time field to the null date/time. The database table must contain a checked_out field otherwise this function will return false. If the check-in cannot be performed then this method returns false and an error message can be obtained by calling the mosDBTable->getError function.

Before calling this method you should first determine whether the record has been checked out by another user. From Joomla 1.0 onwards this can be done using the mosDBTable->isCheckedOut method.

This method is called automatically by the mosDBTable->save method.

See also the mosDBTable->checkout method.


boolean checkin ( [ int $id ] )

The primary key index for the current record. If null then the most recently used value for the primary key will be used.  This parameter is optional and if omitted will default to null.


Example: In this example the mosCategory record with record id 1 (as checked out by the example shown for mosDBTable->checkout) is checked in.

global $database, $my;
// Declare an instance of the mosCategory class.
$cat = new mosCategory( $database );
// Load record with primary key id 1.
$uid = 1;
if (!$cat->load( $uid )) {
  echo "Cannot load category record $uid: " . $database->stderr();
// Show some fields from this record.
echo "<br />";
echo "Title: $cat->title<br />";
echo "Description: $cat->description<br />";
echo "Checked out: $cat->checked_out<br />";
echo "Checked out time: $cat->checked_out_time<br />";
// Check the record back in again.
echo "<br />";
if (!$my->id) {
  echo "You must be logged in to check in an item.<br />";
} else {
  echo "Checking in category record $uid<br />";
  if (!$cat->checkin( $uid )) {
    echo "Cannot checkin record $uid: " . $cat->getError();
  } else {
    echo "<br />";
    $cat->load( $uid );
    echo "Checked out: $cat->checked_out<br />";
    echo "Checked out time: $cat->checked_out_time<br />";

Which would output something like this:

Title: Latest
Description: The latest news from the Joomla! Team
Checked out: 62
Checked out time: 2005-10-28 16:47:56

Checking in category record 1

Checked out: 0
Checked out time: 0000-00-00 00:00:00

Please report any errors on this page to the Developer Documentation Forum.


Last Updated ( Monday, 25 December 2006 )
< Prev   Next >