...
- Add a callback function name
getUserStatsForAdmin
- Example
Code Block | ||||
---|---|---|---|---|
| ||||
|
...
/**
|
...
* @param $iUserId user id of selected user
|
...
* @return array|bool
|
...
*/
|
...
public function getUserStatsForAdmin($iUserId)
|
...
{
|
...
if (!$iUserId) { |
...
return false; |
...
} |
...
$iIncomplete = db()->select('COUNT(*)') |
...
->from(':todolist_task') |
...
->where([ |
...
'user_id' => (int)$iUserId, |
...
'task_status' => 0 |
...
]) |
...
->execute('getField'); |
...
$iComplete = db()->select('COUNT(*)') |
...
->from(':todolist_task') |
...
->where([ |
...
'user_id' => (int)$iUserId, |
...
'task_status' => 1 |
...
]) |
...
->execute('getField'); |
...
return [ |
...
'merge_result' => true, |
...
'result' => [ |
...
[ |
...
//Name of the item |
...
'total_name' => _p('incomplete_tasks'), |
...
//Total count |
...
'total_value' => $iIncomplete, |
...
'type' => 'item' |
...
], |
...
[ |
...
'total_name' => _p('complete_tasks'), |
...
'total_value' => $iComplete, |
...
'type' => 'item' |
...
] |
...
] |
...
]; |
...
}
|
...
- Result