user_id = $user_id; $this->path = 'block_teacher'; if ($this->is_block_visible_for_user($user_id)) { $this->teachers = UserManager::get_users_followed_by_drh($user_id, COURSEMANAGER); } } /** * This method check if a user is allowed to see the block inside dashboard interface. * * @param int User id * * @return bool Is block visible for user */ public function is_block_visible_for_user($user_id) { $user_info = api_get_user_info($user_id); $user_status = $user_info['status']; $is_block_visible_for_user = false; if (UserManager::is_admin($user_id) || in_array($user_status, $this->permission)) { $is_block_visible_for_user = true; } return $is_block_visible_for_user; } /** * This method return content html containing information about * teachers and its position for showing it inside dashboard interface * it's important to use the name 'get_block' for beeing used from * dashboard controller. * * @return array column and content html */ public function get_block() { $column = 1; $data = []; $html = $this->getBlockCard( get_lang('Teachers report'), $this->getContent() ); $data['column'] = $column; $data['content_html'] = $html; return $data; } /** * This method return a content html, it's used inside get_block method * for showing it inside dashboard interface. * * @return string content html */ public function getContent() { $teachers = $this->teachers; $teachers_table = null; if (count($teachers) > 0) { $teachers_table .= '
'.get_lang('User').' | '.get_lang('Time spent in portal').' | '.get_lang('Latest login').' |
---|---|---|
'.api_get_person_name($firstname, $lastname).' ('.$username.') | '.$time_on_platform.' | '.$last_connection.' |
'.get_lang('User').' | '.get_lang('Time spent last week').' '.$last_week.' |
---|---|
'.api_get_person_name($firstname, $lastname).' ('.$username.') | '.$time_on_platform.' |