Page tree
Skip to end of metadata
Go to start of metadata

Since phpFox version 4.6.0, in Browse Users page (Admincp), admin can view item statistic information of users. So, we prepared this document for instructions to integrate your app with this feature.

  • Add a callback function name getUserStatsForAdmin
  • Example
/**
 * @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

  • No labels