/**
  * 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 get_teachers_information_graph()
 {
     $teachers = $this->teachers;
     $graph = '';
     $user_ids = array_keys($teachers);
     $a_last_week = get_last_week();
     if (is_array($user_ids) && count($user_ids) > 0) {
         $dataSet = new pData();
         foreach ($user_ids as $user_id) {
             $teacher_info = api_get_user_info($user_id);
             $username = $teacher_info['username'];
             $time_by_days = array();
             foreach ($a_last_week as $day) {
                 // day is received as y-m-d 12:00:00
                 $start_date = api_get_utc_datetime($day);
                 $end_date = api_get_utc_datetime($day + (3600 * 24 - 1));
                 $time_on_platform_by_day = Tracking::get_time_spent_on_the_platform($user_id, 'custom', $start_date, $end_date);
                 $hours = floor($time_on_platform_by_day / 3600);
                 $min = floor(($time_on_platform_by_day - $hours * 3600) / 60);
                 $time_by_days[] = $min;
             }
             $dataSet->addPoints($time_by_days, $username);
         }
         $last_week = date('Y-m-d', $a_last_week[0]) . ' ' . get_lang('To') . ' ' . date('Y-m-d', $a_last_week[6]);
         $days_on_week = array();
         foreach ($a_last_week as $weekday) {
             $days_on_week[] = date('d/m', $weekday);
         }
         $dataSet->addPoints($days_on_week, 'Days');
         $dataSet->setAbscissaName($last_week);
         $dataSet->setAxisName(0, get_lang('Minutes'));
         $dataSet->setAbscissa('Days');
         $dataSet->loadPalette(api_get_path(SYS_CODE_PATH) . 'palettes/pchart/default.color', true);
         // Cache definition
         $cachePath = api_get_path(SYS_ARCHIVE_PATH);
         $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
         $chartHash = $myCache->getHash($dataSet);
         if ($myCache->isInCache($chartHash)) {
             $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
             $myCache->saveFromCache($chartHash, $imgPath);
             $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
         } else {
             /* Create the pChart object */
             $widthSize = 440;
             $heightSize = 350;
             $angle = 50;
             $myPicture = new pImage($widthSize, $heightSize, $dataSet);
             /* Turn of Antialiasing */
             $myPicture->Antialias = false;
             /* Add a border to the picture */
             $myPicture->drawRectangle(0, 0, $widthSize - 1, $heightSize - 1, array('R' => 0, 'G' => 0, 'B' => 0));
             /* Set the default font */
             $myPicture->setFontProperties(array('FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf', 'FontSize' => 10));
             /* Do NOT Write the chart title */
             /* Define the chart area */
             $myPicture->setGraphArea(40, 40, $widthSize - 20, $heightSize - 80);
             /* Draw the scale */
             $scaleSettings = array('GridR' => 200, 'GridG' => 200, 'GridB' => 200, 'DrawSubTicks' => true, 'CycleBackground' => true, 'Mode' => SCALE_MODE_ADDALL_START0, 'LabelRotation' => $angle);
             $myPicture->drawScale($scaleSettings);
             /* Turn on shadow computing */
             $myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
             /* Draw the chart */
             $myPicture->setShadow(true, array('X' => 1, 'Y' => 1, 'R' => 0, 'G' => 0, 'B' => 0, 'Alpha' => 10));
             $settings = array('DisplayValues' => true, 'DisplayR' => 0, 'DisplayG' => 0, 'DisplayB' => 0);
             $myPicture->drawFilledSplineChart($settings);
             $myPicture->drawLegend(40, 20, array('Mode' => LEGEND_HORIZONTAL));
             /* Write and save into cache */
             $myCache->writeToCache($chartHash, $myPicture);
             $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
             $myCache->saveFromCache($chartHash, $imgPath);
             $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
         }
         $graph = '<img src="' . $imgPath . '" >';
     } else {
         $graph = '<p>' . api_convert_encoding(get_lang('GraphicNotAvailable'), 'UTF-8') . '</p>';
     }
     return $graph;
 }