* code for task#948.

This commit is contained in:
chencongzhi520@gmail.com
2012-11-30 09:08:38 +00:00
parent 8610f6b0f1
commit 7f7ef475f7
+10 -6
View File
@@ -67,14 +67,15 @@ class actionModel extends model
}
/**
* Get unread actions.
* Get the unread actions.
*
* @param int $objectType
* @param int $actionID
* @access public
* @return void
*/
public function getUnreadActions()
public function getUnreadActions($actionID = 0)
{
if(!is_numeric($actionID)) $actionID = 0;
$objectList['task'] = TABLE_TASK;
$objectList['bug'] = TABLE_BUG;
$actions = array();
@@ -87,16 +88,19 @@ class actionModel extends model
->where('objectType')->eq($object)
->andWhere('objectID')->in($idList)
->andWhere('`read`')->eq(0)
->fetchAll();
->andWhere('id')->gt($actionID)
->fetchAll('id');
if(empty($tmpActions)) continue;
$tmpActions = $this->transformActions($tmpActions);
$tmpActions = $this->transformActions($tmpActions);
foreach($tmpActions as $action)
{
$actions[$action->objectType][] = array(
'actionID' => $action->id,
'objectType' => $action->objectType,
'objectID' => $action->objectID,
'action' => $action->actor . $action->actionLabel . $action->objectType . " #$action->objectID" . $action->objectName
'action' => $action->actor . ' ' . $action->actionLabel . ' ' . $action->objectType . " #$action->objectID" . $action->objectName
);
}
}