1
我在Joomla中創建組件! 1.7,我想利用該框架的檢出/登記功能。目前定製組件入住/退房最佳實踐
- 當用戶請求該記錄的編輯任務時,如何將組件記錄標記爲「簽出」?
- 當用戶試圖存儲他或她的編輯時,如何將記錄標記爲「簽入」?
- 如何在編輯時測試組件記錄的簽入/簽出狀態?
謝謝!
我在Joomla中創建組件! 1.7,我想利用該框架的檢出/登記功能。目前定製組件入住/退房最佳實踐
謝謝!
Basicly你需要在你的模型,這兩種方法哪,只要你願意,你可以撥打:
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
來存儲時間,當項目被檢出。 希望它有幫助。
謝謝,di3sel。這正是我要找的。 – asciimo