*/ use CpChart\Chart\Cache as pCache; use CpChart\Chart\Data as pData; use CpChart\Chart\Image as pImage; /** * This class is used like controller for student graph block plugin, * the class name must be registered inside path.info file (e.g: controller = "BlockStudentGraph"), so dashboard controller will be instantiate it * @package chamilo.dashboard */ class BlockStudentGraph extends Block { private $user_id; private $students; private $path; private $permission = array(DRH); /** * Constructor */ public function __construct ($user_id) { $this->user_id = $user_id; $this->path = 'block_student_graph'; if ($this->is_block_visible_for_user($user_id)) { /*if (api_is_platform_admin()) { $this->students = UserManager::get_user_list(array('status' => STUDENT)); } else if (api_is_drh()) {*/ $this->students = UserManager::get_users_followed_by_drh($user_id, STUDENT); //} } } /** * 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 students * and its position for showing it inside dashboard interface * it's important to use the name 'get_block' for being used from dashboard controller * @return array column and content html */ public function get_block() { global $charset; $column = 1; $data = array(); $students_attendance_graph = $this->get_students_attendance_graph(); $html = '
'.api_convert_encoding(get_lang('GraphicNotAvailable'),'UTF-8').'
'; } return $graph; } /** * Get number of students * @return int */ function get_number_of_students() { return count($this->students); } }