Обычно вам нужно два метода в вашей модели, которые вы можете вызывать в любое время:
function checkin()
{
if ($this->_id)
{
$item= & $this->getTable();
if(! $item->checkin($this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
}
return false;
}
function checkout($uid = null)
{
if ($this->_id)
{
// Make sure we have a user id to checkout the article with
if (is_null($uid)) {
$user =& JFactory::getUser();
$uid = $user->get('id');
}
// Lets get to it and checkout the thing...
$item= & $this->getTable();
if(!$item->checkout($uid, $this->_id)) {
$this->setError($this->_db->getErrorMsg());
return false;
}
return true;
}
return false;
}
Чтобы пометить элемент как отмеченный, прежде всего необходимо иметь столбец с именем checked_out
со значением по умолчанию 0, а также checked_out_time
для хранения времени, когда элемент был извлечен.
Надеюсь, это поможет.