Exemple #1
0
 /**
  * Creates the mPDF object
  * @param string  $pageFormat format A4 A4-L see  http://mpdf1.com/manual/index.php?tid=184&searchstring=format
  * @param string  $orientation orientation "P" = Portrait "L" = Landscape
  * @param array $params
  * @param Template $template
  */
 public function __construct($pageFormat = 'A4', $orientation = 'P', $params = array(), $template = null)
 {
     $this->template = $template;
     /* More info @ http://mpdf1.com/manual/index.php?tid=184&searchstring=mPDF
      * mPDF ([ string $mode [, mixed $format [, float $default_font_size [, string $default_font [, float $margin_left , float $margin_right , float $margin_top , float $margin_bottom , float $margin_header , float $margin_footer [, string $orientation ]]]]]])
      */
     if (!in_array($orientation, array('P', 'L'))) {
         $orientation = 'P';
     }
     //$this->pdf = $pdf = new mPDF('UTF-8', $pageFormat, '', '', 30, 20, 27, 25, 16, 13, $orientation);
     //left, right, top, bottom, margin_header, margin footer
     $params['left'] = isset($params['left']) ? $params['left'] : 15;
     $params['right'] = isset($params['right']) ? $params['right'] : 15;
     $params['top'] = isset($params['top']) ? $params['top'] : 20;
     $params['bottom'] = isset($params['bottom']) ? $params['bottom'] : 15;
     $this->params['filename'] = isset($params['filename']) ? $params['filename'] : api_get_local_time();
     $this->params['pdf_title'] = isset($params['pdf_title']) ? $params['pdf_title'] : get_lang('Untitled');
     $this->params['course_info'] = isset($params['course_info']) ? $params['course_info'] : api_get_course_info();
     $this->params['session_info'] = isset($params['session_info']) ? $params['session_info'] : api_get_session_info(api_get_session_id());
     $this->params['course_code'] = isset($params['course_code']) ? $params['course_code'] : api_get_course_id();
     $this->params['add_signatures'] = isset($params['add_signatures']) ? $params['add_signatures'] : false;
     $this->params['show_real_course_teachers'] = isset($params['show_real_course_teachers']) ? $params['show_real_course_teachers'] : false;
     $this->params['student_info'] = isset($params['student_info']) ? $params['student_info'] : false;
     $this->params['show_grade_generated_date'] = isset($params['show_grade_generated_date']) ? $params['show_grade_generated_date'] : false;
     $this->params['show_teacher_as_myself'] = isset($params['show_teacher_as_myself']) ? $params['show_teacher_as_myself'] : true;
     $this->params['pdf_date'] = isset($params['pdf_date']) ? $params['pdf_date'] : api_format_date(api_get_local_time(), DATE_TIME_FORMAT_LONG);
     $this->pdf = new mPDF('UTF-8', $pageFormat, '', '', $params['left'], $params['right'], $params['top'], $params['bottom'], 8, 8, $orientation);
 }
 /**
  * Export the given HTML to PDF, using a global template
  * @param string the HTML content
  * @uses export/table_pdf.tpl
  */
 function html_to_pdf_with_template($content)
 {
     Display::display_no_header();
     //Assignments
     Display::$global_template->assign('pdf_content', $content);
     $organization = api_get_setting('Institution');
     $img = api_get_path(SYS_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/header-logo.png';
     if (file_exists($img)) {
         $img = api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/header-logo.png';
         $organization = "<img src='{$img}'>";
     } else {
         if (!empty($organization)) {
             $organization = '<h2 align="left">' . $organization . '</h2>';
         }
     }
     Display::$global_template->assign('organization', $organization);
     //Showing only the current teacher/admin instead the all teacherlist name see BT#4080
     $user_info = api_get_user_info();
     $teacher_list = $user_info['complete_name'];
     $session_name = api_get_session_name(api_get_session_id());
     if (!empty($session_name)) {
         Display::$global_template->assign('pdf_session', $session_name);
     }
     Display::$global_template->assign('pdf_course', $this->params['course_code']);
     Display::$global_template->assign('pdf_date', api_format_date(api_get_utc_datetime(), DATE_TIME_FORMAT_LONG));
     Display::$global_template->assign('pdf_teachers', $teacher_list);
     Display::$global_template->assign('pdf_title', $this->params['pdf_title']);
     Display::$global_template->assign('add_signatures', $this->params['add_signatures']);
     //Getting template
     $tpl = Display::$global_template->get_template('export/table_pdf.tpl');
     $html = Display::$global_template->fetch($tpl);
     $html = api_utf8_encode($html);
     $css_file = api_get_path(TO_SYS, WEB_CSS_PATH) . '/print.css';
     $css = file_exists($css_file) ? @file_get_contents($css_file) : '';
     self::content_to_pdf($html, $css, $this->params['filename'], $this->params['course_code']);
 }
 public static function format_date($timestamp, $format = null)
 {
     return api_format_date($timestamp, $format);
 }
/* For license terms, see /license.txt */
/**
 * List page for Paypal Payout for the Buy Courses plugin
 * @package chamilo.plugin.buycourses
 */
/**
 * Initialization
 */
$cidReset = true;
require_once '../../../main/inc/global.inc.php';
$htmlHeadXtra[] = '<link rel="stylesheet" href="../resources/css/style.css" type="text/css">';
api_protect_admin_script(true);
$plugin = BuyCoursesPlugin::create();
$paypalEnable = $plugin->get('paypal_enable');
$commissionsEnable = $plugin->get('commissions_enable');
if ($paypalEnable !== "true" && $commissionsEnable !== "true") {
    api_not_allowed(true);
}
$payouts = $plugin->getPayouts();
$payoutList = [];
foreach ($payouts as $payout) {
    $payoutList[] = ['id' => $payout['id'], 'reference' => $payout['sale_reference'], 'date' => api_format_date($payout['date'], DATE_TIME_FORMAT_LONG_24H), 'currency' => $payout['iso_code'], 'price' => $payout['item_price'], 'commission' => $payout['commission'], 'paypal_account' => $payout['paypal_account']];
}
$templateName = $plugin->get_lang('PaypalPayoutCommissions');
$template = new Template($templateName);
$template->assign('payout_list', $payoutList);
$content = $template->fetch('buycourses/view/paypal_payout.tpl');
$template->assign('header', $templateName);
$template->assign('content', $content);
$template->display_one_col_template();
     $columns = array('name', 'date', 'course_per_session', 'student_per_session', 'details');
     $result = array();
     if (!empty($sessions)) {
         foreach ($sessions as $session) {
             if (api_drh_can_access_all_session_content()) {
                 $count_courses_in_session = count(SessionManager::get_course_list_by_session_id($session['id']));
             } else {
                 $count_courses_in_session = count(Tracking::get_courses_followed_by_coach($user_id, $session['id']));
             }
             $count_users_in_session = count(SessionManager::get_users_by_session($session['id'], 0));
             $session_date = array();
             if (!empty($session['access_start_date']) && $session['access_start_date'] != '0000-00-00') {
                 $session_date[] = get_lang('From') . ' ' . api_format_date($session['access_start_date'], DATE_FORMAT_SHORT);
             }
             if (!empty($session['access_end_date']) && $session['access_end_date'] != '0000-00-00') {
                 $session_date[] = get_lang('Until') . ' ' . api_format_date($session['access_end_date'], DATE_FORMAT_SHORT);
             }
             if (empty($session_date)) {
                 $session_date_string = '-';
             } else {
                 $session_date_string = implode(' ', $session_date);
             }
             $sessionUrl = api_get_path(WEB_CODE_PATH) . 'mySpace/course.php?session_id=' . $session['id'];
             $result[] = array('name' => $session['name'], 'date' => $session_date_string, 'course_per_session' => $count_courses_in_session, 'student_per_session' => $count_users_in_session, 'details' => Display::url(Display::return_icon('2rightarrow.png'), $sessionUrl));
         }
     }
     break;
 case 'get_sessions':
     $session_columns = SessionManager::getGridColumns($list_type);
     $columns = $session_columns['simple_column_name'];
     if ($list_type == 'simple') {
 /**
  * Get all attendance calendar data inside current attendance
  * @param int	$attendance_id
  * @param string $type
  * @param int $calendar_id
  * @param int $groupId
  * @param bool $showAll = false show group calendar items or not
  *
  * @return	array attendance calendar data
  */
 public function get_attendance_calendar($attendance_id, $type = 'all', $calendar_id = null, $groupId = null, $showAll = false)
 {
     $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
     $tbl_acrg = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR_REL_GROUP);
     $attendance_id = intval($attendance_id);
     $course_id = api_get_course_int_id();
     $groupCondition = null;
     if ($showAll) {
         $sql = "SELECT * FROM {$tbl_attendance_calendar}\n\t\t\t\t\tWHERE c_id = {$course_id} AND attendance_id = '{$attendance_id}'";
     } else {
         $sql = "SELECT * FROM {$tbl_attendance_calendar}\n\t\t\t\t\tWHERE\n\t\t\t\t\t\tc_id = {$course_id} AND\n\t\t\t\t\t\tattendance_id = '{$attendance_id}' AND\n\t\t\t\t\t\tid NOT IN (\n\t\t\t\t\t\t\tSELECT calendar_id FROM {$tbl_acrg}\n\t\t\t\t\t\t\tWHERE c_id = {$course_id} AND group_id != 0 AND group_id IS NOT NULL\n\t\t\t\t\t\t)\n\t\t\t\t\t";
     }
     if (!empty($groupId)) {
         $groupId = intval($groupId);
         $sql = "SELECT c.* FROM {$tbl_attendance_calendar} c\n\t\t\t\t\tINNER JOIN {$tbl_acrg} g\n\t\t\t\t\tON c.c_id = g.c_id AND c.id = g.calendar_id\n\t\t\t\t\tWHERE\n\t\t\t\t\t    c.c_id = {$course_id} AND\n\t\t\t\t\t    g.group_id = '{$groupId}' AND\n\t\t\t\t\t    c.attendance_id = '{$attendance_id}'\n                   ";
     }
     if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done', 'calendar_id'))) {
         $type = 'all';
     }
     switch ($type) {
         case 'calendar_id':
             $calendar_id = intval($calendar_id);
             if (!empty($calendar_id)) {
                 $sql .= " AND id = {$calendar_id}";
             }
             break;
         case 'today':
             //$sql .= ' AND DATE_FORMAT(date_time,"%d-%m-%Y") = DATE_FORMAT("'.api_get_utc_datetime().'", "%d-%m-%Y" )';
             break;
         case 'all_done':
             $sql .= " AND done_attendance = 1 ";
             break;
         case 'all_not_done':
             $sql .= " AND done_attendance = 0 ";
             break;
         case 'all':
         default:
             break;
     }
     $sql .= " ORDER BY date_time ";
     $rs = Database::query($sql);
     $data = array();
     if (Database::num_rows($rs) > 0) {
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
             $row['db_date_time'] = $row['date_time'];
             $row['date_time'] = api_get_local_time($row['date_time']);
             $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT);
             $row['time'] = api_format_date($row['date_time'], TIME_NO_SEC_FORMAT);
             $row['groups'] = $this->getGroupListByAttendanceCalendar($row['id'], $course_id);
             if ($type == 'today') {
                 if (date('d-m-Y', api_strtotime($row['date_time'], 'UTC')) == date('d-m-Y', time())) {
                     $data[] = $row;
                 }
             } else {
                 $data[] = $row;
             }
         }
     }
     return $data;
 }
 function get_data($from, $count, $column, $direction)
 {
     if (!$this->is_valid()) {
         return array();
     }
     $ceiling = $this->get_ceiling();
     $active_only = $this->get_active_only();
     $items = ZombieManager::listZombies($ceiling, $active_only, $count, $from, $column, $direction);
     $result = array();
     foreach ($items as $item) {
         $row = array();
         $row[] = $item['user_id'];
         $row[] = $item['code'];
         $row[] = $item['firstname'];
         $row[] = $item['lastname'];
         $row[] = $item['username'];
         $row[] = $item['email'];
         $row[] = $item['status'];
         $row[] = $item['auth_source'];
         $row[] = api_format_date($item['registration_date'], DATE_FORMAT_SHORT);
         $row[] = api_format_date($item['login_date'], DATE_FORMAT_SHORT);
         $row[] = $item['active'];
         $result[] = $row;
     }
     return $result;
 }
 /**
  *
  * @param int   student id
  * @param int   years
  * @param bool  show warning_message
  * @param bool  return_timestamp
  */
 public static function delete_inactive_student($student_id, $years = 2, $warning_message = false, $return_timestamp = false)
 {
     $tbl_track_login = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = 'SELECT login_date FROM ' . $tbl_track_login . '
             WHERE login_user_id = ' . intval($student_id) . '
             ORDER BY login_date DESC LIMIT 0,1';
     if (empty($years)) {
         $years = 1;
     }
     $inactive_time = $years * 31536000;
     //1 year
     $rs = Database::query($sql);
     if (Database::num_rows($rs) > 0) {
         if ($last_login_date = Database::result($rs, 0, 0)) {
             $last_login_date = api_get_local_time($last_login_date, null, date_default_timezone_get());
             if ($return_timestamp) {
                 return api_strtotime($last_login_date);
             } else {
                 if (!$warning_message) {
                     return api_format_date($last_login_date, DATE_FORMAT_SHORT);
                 } else {
                     $timestamp = api_strtotime($last_login_date);
                     $currentTimestamp = time();
                     //If the last connection is > than 7 days, the text is red
                     //345600 = 7 days in seconds 63072000= 2 ans
                     // if ($currentTimestamp - $timestamp > 184590 )
                     if ($currentTimestamp - $timestamp > $inactive_time && UserManager::delete_user($student_id)) {
                         Display::display_normal_message(get_lang('UserDeleted'));
                         echo '<p>', 'id', $student_id, ':', $last_login_date, '</p>';
                     }
                 }
             }
         }
     }
     return false;
 }
Exemple #9
0
            if ($view_dropbox_category_sent == $dropbox_file->category) {
                $dropbox_file_data[] = $dropbox_file->id;
                $link_open = '<a href="dropbox_download.php?' . api_get_cidreq() . '&id=' . $dropbox_file->id . '">';
                $dropbox_file_data[] = $link_open . build_document_icon_tag('file', $dropbox_file->title) . '</a>';
                $dropbox_file_data[] = '<a href="dropbox_download.php?' . api_get_cidreq() . '&id=' . $dropbox_file->id . '&amp;action=download">' . Display::return_icon('save.png', get_lang('Save'), array('style' => 'float:right;'), ICON_SIZE_SMALL) . '</a>' . $link_open . $dropbox_file->title . '</a><br />' . $dropbox_file->description;
                $file_size = $dropbox_file->filesize;
                $dropbox_file_data[] = Text::format_file_size($file_size);
                $receivers_celldata = null;
                foreach ($dropbox_file->recipients as $recipient) {
                    $receivers_celldata = display_user_link_work($recipient['user_id'], $recipient['name']) . ', ' . $receivers_celldata;
                }
                $receivers_celldata = trim(trim($receivers_celldata), ',');
                // Removing the trailing comma.
                $dropbox_file_data[] = $receivers_celldata;
                $last_upload_date = api_get_local_time($dropbox_file->last_upload_date);
                $dropbox_file_data[] = date_to_str_ago($last_upload_date) . '<br /><span class="dropbox_date">' . api_format_date($last_upload_date) . '</span>';
                //$dropbox_file_data[] = $dropbox_file->author;
                $receivers_celldata = '';
                $action_icons = check_number_feedback($dropbox_file->id, $number_feedback) . ' ' . get_lang('Feedback') . '
									<a href="' . api_get_self() . '?' . api_get_cidreq() . '&view_received_category=' . $viewReceivedCategory . '&amp;view_sent_category=' . $viewSentCategory . '&amp;view=' . $view . '&amp;action=viewfeedback&amp;id=' . $dropbox_file->id . '&' . $sort_params . '">' . Display::return_icon('discuss.png', get_lang('Comment'), '', ICON_SIZE_SMALL) . '</a>
									<a href="' . api_get_self() . '?' . api_get_cidreq() . '&view_received_category=' . $viewReceivedCategory . '&amp;view_sent_category=' . $viewSentCategory . '&amp;view=' . $view . '&amp;action=movesent&amp;move_id=' . $dropbox_file->id . '&' . $sort_params . '">' . Display::return_icon('move.png', get_lang('Move'), '', ICON_SIZE_SMALL) . '</a>
									<a href="' . api_get_self() . '?' . api_get_cidreq() . '&view_received_category=' . $viewReceivedCategory . '&amp;view_sent_category=' . $viewSentCategory . '&amp;view=' . $view . '&amp;action=deletesentfile&amp;id=' . $dropbox_file->id . '&' . $sort_params . '" onclick="javascript: return confirmation(\'' . $dropbox_file->title . '\');">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
                // This is a hack to have an additional row in a sortable table
                if ($action == 'viewfeedback' && isset($_GET['id']) && is_numeric($_GET['id']) && $dropbox_file->id == $_GET['id']) {
                    $action_icons .= "</td></tr>\n";
                    // ending the normal row of the sortable table
                    $action_icons .= "<tr><td colspan=\"2\">";
                    $action_icons .= "<a href=\"index.php?" . api_get_cidreq() . "&view_received_category=" . $viewReceivedCategory . "&view_sent_category=" . $viewSentCategory . "&view=" . $view . '&' . $sort_params . "\">" . get_lang('CloseFeedback') . "</a>";
                    $action_icons .= "</td><td colspan=\"7\">" . feedback($dropbox_file->feedback2) . "</td></tr>";
                }
                $dropbox_file_data[] = $action_icons;
 /**
  * Get the thematic advances to display on the current page (fill the sortable-table)
  * @param   int     offset of first user to recover
  * @param   int     Number of users to get
  * @param   int     Column to sort on
  * @param   string  Order (ASC,DESC)
  * @see SortableTable#get_table_data($from)
  */
 public static function get_thematic_advance_data($from, $number_of_items, $column, $direction)
 {
     $thematic_id = Session::read('thematic_id');
     $tbl_thematic_advance = Database::get_course_table(TABLE_THEMATIC_ADVANCE);
     $column = intval($column);
     $from = intval($from);
     $number_of_items = intval($number_of_items);
     if (!in_array($direction, array('ASC', 'DESC'))) {
         $direction = 'ASC';
     }
     $data = array();
     $course_id = api_get_course_int_id();
     if (api_is_allowed_to_edit(null, true)) {
         $sql = "SELECT id AS col0, start_date AS col1, duration AS col2, content AS col3\n                    FROM {$tbl_thematic_advance}\n    \t\t\t\tWHERE c_id = {$course_id} AND thematic_id = {$thematic_id}\n    \t\t\t\tORDER BY col{$column} {$direction}\n    \t\t\t\tLIMIT {$from},{$number_of_items} ";
         $list = api_get_item_property_by_tool('thematic_advance', api_get_course_id(), api_get_session_id());
         $elements = array();
         foreach ($list as $value) {
             $elements[] = $value['ref'];
         }
         $res = Database::query($sql);
         $i = 1;
         while ($thematic_advance = Database::fetch_row($res)) {
             if (in_array($thematic_advance[0], $elements)) {
                 $thematic_advance[1] = api_get_local_time($thematic_advance[1]);
                 $thematic_advance[1] = api_format_date($thematic_advance[1], DATE_TIME_FORMAT_LONG);
                 $actions = '';
                 $actions .= '<a href="index.php?' . api_get_cidreq() . '&action=thematic_advance_edit&thematic_id=' . $thematic_id . '&thematic_advance_id=' . $thematic_advance[0] . '">' . Display::return_icon('edit.png', get_lang('Edit'), '', 22) . '</a>';
                 $actions .= '<a onclick="javascript:if(!confirm(\'' . get_lang('AreYouSureToDelete') . '\')) return false;" href="index.php?' . api_get_cidreq() . '&action=thematic_advance_delete&thematic_id=' . $thematic_id . '&thematic_advance_id=' . $thematic_advance[0] . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', 22) . '</a></center>';
                 $data[] = array($i, $thematic_advance[1], $thematic_advance[2], $thematic_advance[3], $actions);
                 $i++;
             }
         }
     }
     return $data;
 }
 /**
  * Get all attendance calendar data inside current attendance
  * @param	int	attendance id
  * @return	array attendance calendar data
  */
 public function get_attendance_calendar($attendance_id, $type = 'all', $calendar_id = null)
 {
     global $dateFormatShort, $timeNoSecFormat;
     $tbl_attendance_calendar = Database::get_course_table(TABLE_ATTENDANCE_CALENDAR);
     $attendance_id = intval($attendance_id);
     $course_id = $this->get_course_int_id();
     $sql = "SELECT * FROM {$tbl_attendance_calendar} WHERE c_id = {$course_id} AND attendance_id = '{$attendance_id}' ";
     if (!in_array($type, array('today', 'all', 'all_done', 'all_not_done', 'calendar_id'))) {
         $type = 'all';
     }
     switch ($type) {
         case 'calendar_id':
             $calendar_id = intval($calendar_id);
             if (!empty($calendar_id)) {
                 $sql .= " AND id = {$calendar_id}";
             }
             break;
         case 'today':
             //$sql .= ' AND DATE_FORMAT(date_time,"%d-%m-%Y") = DATE_FORMAT("'.api_get_utc_datetime().'", "%d-%m-%Y" )';
             break;
         case 'all_done':
             $sql .= " AND done_attendance = 1 ";
             break;
         case 'all_not_done':
             $sql .= " AND done_attendance = 0 ";
             break;
         case 'all':
         default:
             break;
     }
     $sql .= " ORDER BY date_time ";
     $rs = Database::query($sql);
     $data = array();
     if (Database::num_rows($rs) > 0) {
         while ($row = Database::fetch_array($rs, 'ASSOC')) {
             $row['db_date_time'] = $row['date_time'];
             $row['date_time'] = api_get_local_time($row['date_time']);
             $row['date'] = api_format_date($row['date_time'], DATE_FORMAT_SHORT);
             $row['time'] = api_format_date($row['date_time'], TIME_NO_SEC_FORMAT);
             if ($type == 'today') {
                 if (date('d-m-Y', api_strtotime($row['date_time'], 'UTC')) == date('d-m-Y', time())) {
                     $data[] = $row;
                 }
             } else {
                 $data[] = $row;
             }
         }
     }
     return $data;
 }
 /**
  * Get the achieved certificates for a user in course sessions
  * @param int $userId The user id
  * @param type $includeNonPublicCertificates Whether include the non-plublic certificates
  * @return array
  */
 public static function getUserCertificatesInSessions($userId, $includeNonPublicCertificates = true)
 {
     $userId = intval($userId);
     $sessionList = [];
     $sessions = SessionManager::get_sessions_by_user($userId);
     foreach ($sessions as $session) {
         if (empty($session['courses'])) {
             continue;
         }
         $sessionCourses = SessionManager::get_course_list_by_session_id($session['session_id']);
         foreach ($sessionCourses as $course) {
             if (!$includeNonPublicCertificates) {
                 $allowPublicCertificates = api_get_course_setting('allow_public_certificates', $course['code']);
                 if (empty($allowPublicCertificates)) {
                     continue;
                 }
             }
             $courseGradebookCategory = Category::load(null, null, $course['code'], null, null, $session['session_id']);
             if (empty($courseGradebookCategory)) {
                 continue;
             }
             $courseGradebookId = $courseGradebookCategory[0]->get_id();
             $certificateInfo = GradebookUtils::get_certificate_by_user_id($courseGradebookId, $userId);
             if (empty($certificateInfo)) {
                 continue;
             }
             $sessionList[] = ['session' => $session['session_name'], 'course' => $course['title'], 'score' => $certificateInfo['score_certificate'], 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT), 'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"];
         }
     }
     return $sessionList;
 }
    /**
     * @param $from
     * @param $number_of_items
     * @param $column
     * @param $direction
     * @param null $user_id
     * @return array
     */
    public static function export_tickets_by_user_id(
        $from,
        $number_of_items,
        $column,
        $direction,
        $user_id = null
    ) {
        $from = intval($from);
        $number_of_items = intval($number_of_items);
        $table_support_category = Database::get_main_table(
            TABLE_TICKET_CATEGORY
        );
        $table_support_tickets = Database::get_main_table(TABLE_TICKET_TICKET);
        $table_support_priority = Database::get_main_table(
            TABLE_TICKET_PRIORITY
        );
        $table_support_status = Database::get_main_table(TABLE_TICKET_STATUS);
        $table_support_messages = Database::get_main_table(
            TABLE_TICKET_MESSAGE
        );
        $table_main_user = Database::get_main_table(TABLE_MAIN_USER);

        if (is_null($direction)) {
            $direction = "DESC";
        }
        if (is_null($user_id) || $user_id == 0) {
            $user_id = api_get_user_id();
        }

        $sql = "SELECT ticket.ticket_code, ticket.sys_insert_datetime ,
                ticket.sys_lastedit_datetime , cat.name as category ,
                CONCAT(user.lastname,' ', user.firstname) AS fullname ,
                status.name as status , ticket.total_messages as messages ,
                ticket.assigned_last_user as responsable
                FROM $table_support_tickets ticket,
                $table_support_category cat ,
                $table_support_priority priority,
                $table_support_status status ,
                $table_main_user user
                WHERE
                    cat.category_id = ticket.category_id
                    AND ticket.priority_id = priority.priority_id
                    AND ticket.status_id = status.status_id
                    AND user.user_id = ticket.request_user ";
        //Search simple
        if (isset($_GET['submit_simple'])) {
            if ($_GET['keyword'] != '') {
                $keyword = Database::escape_string(trim($_GET['keyword']));
                $sql .= " AND (ticket.ticket_code = '$keyword'
                          OR user.firstname LIKE '%$keyword%'
                          OR user.lastname LIKE '%$keyword%'
                          OR concat(user.firstname,' ',user.lastname) LIKE '%$keyword%'
                          OR concat(user.lastname,' ',user.firstname) LIKE '%$keyword%'
                          OR user.username LIKE '%$keyword%')  ";
            }
        }
        //Search advanced
        if (isset($_GET['submit_advanced'])) {
            $keyword_category = Database::escape_string(
                trim($_GET['keyword_category'])
            );
            $keyword_request_user = Database::escape_string(
                trim($_GET['keyword_request_user'])
            );
            $keyword_admin = Database::escape_string(
                trim($_GET['keyword_admin'])
            );
            $keyword_start_date_start = Database::escape_string(
                trim($_GET['keyword_start_date_start'])
            );
            $keyword_start_date_end = Database::escape_string(
                trim($_GET['keyword_start_date_end'])
            );
            $keyword_status = Database::escape_string(
                trim($_GET['keyword_status'])
            );
            $keyword_source = Database::escape_string(
                trim($_GET['keyword_source'])
            );
            $keyword_priority = Database::escape_string(
                trim($_GET['keyword_priority'])
            );
            $keyword_range = Database::escape_string(
                trim($_GET['keyword_dates'])
            );
            $keyword_unread = Database::escape_string(
                trim($_GET['keyword_unread'])
            );
            $keyword_course = Database::escape_string(
                trim($_GET['keyword_course'])
            );

            if ($keyword_category != '') {
                $sql .= " AND ticket.category_id = '$keyword_category'  ";
            }
            if ($keyword_request_user != '') {
                $sql .= " AND (ticket.request_user = '******'
                          OR user.firstname LIKE '%$keyword_request_user%'
                          OR user.official_code LIKE '%$keyword_request_user%'
                          OR user.lastname LIKE '%$keyword_request_user%'
                          OR concat(user.firstname,' ',user.lastname) LIKE '%$keyword_request_user%'
                          OR concat(user.lastname,' ',user.firstname) LIKE '%$keyword_request_user%'
                          OR user.username LIKE '%$keyword_request_user%') ";
            }
            if ($keyword_admin != '') {
                $sql .= " AND ticket.assigned_last_user = '******'  ";
            }
            if ($keyword_status != '') {
                $sql .= " AND ticket.status_id = '$keyword_status'  ";
            }
            if ($keyword_range == '' && $keyword_start_date_start != '') {
                $sql .= " AND DATE_FORMAT( ticket.start_date,'%d/%m/%Y') = '$keyword_start_date_start' ";
            }
            if ($keyword_range == '1' && $keyword_start_date_start != '' && $keyword_start_date_end != '') {
                $sql .= " AND DATE_FORMAT( ticket.start_date,'%d/%m/%Y') >= '$keyword_start_date_start'
                          AND DATE_FORMAT( ticket.start_date,'%d/%m/%Y') <= '$keyword_start_date_end'";
            }
            if ($keyword_priority != '') {
                $sql .= " AND ticket.priority_id = '$keyword_priority'  ";
            }
            if ($keyword_source != '') {
                $sql .= " AND ticket.source = '$keyword_source' ";
            }
            if ($keyword_priority != '') {
                $sql .= " AND ticket.priority_id = '$keyword_priority' ";
            }
            if ($keyword_course != '') {
                $course_table = Database :: get_main_table(TABLE_MAIN_COURSE);
                $sql .= " AND ticket.course_id IN ( ";
                $sql .= "SELECT id
                         FROM $course_table
                         WHERE (title LIKE '%$keyword_course%'
                         OR code LIKE '%$keyword_course%'
                         OR visual_code LIKE '%$keyword_course%' )) ";
            }
            if ($keyword_unread == 'yes') {
                $sql .= " AND ticket.ticket_id IN (
                          SELECT ticket.ticket_id
                          FROM  $table_support_tickets ticket,
                          $table_support_messages message,
                          $table_main_user user
                          WHERE ticket.ticket_id = message.ticket_id
                          AND message.status = 'NOL'
                          AND message.sys_insert_user_id = user.user_id
                          AND user.status != 1   AND ticket.status_id != 'REE'
                          GROUP BY ticket.ticket_id)";
            } else {
                if ($keyword_unread == 'no') {
                    $sql .= " AND ticket.ticket_id NOT IN (
                              SELECT ticket.ticket_id
                              FROM  $table_support_tickets ticket,
                              $table_support_messages message,
                              $table_main_user user
                              WHERE ticket.ticket_id = message.ticket_id
                              AND message.status = 'NOL'
                              AND message.sys_insert_user_id = user.user_id
                              AND user.status != 1
                              AND ticket.status_id != 'REE'
                             GROUP BY ticket.ticket_id)";
                }
            }
        }

        //$sql .= " ORDER BY col$column $direction";
        $sql .= " LIMIT $from,$number_of_items";

        $result = Database::query($sql);
        $tickets[0] = array(
            utf8_decode('Ticket#'),
            utf8_decode('Fecha'),
            utf8_decode('Fecha Edicion'),
            utf8_decode('Categoria'),
            utf8_decode('Usuario'),
            utf8_decode('Estado'),
            utf8_decode('Mensajes'),
            utf8_decode('Responsable'),
            utf8_decode('Programa')
        );

        while ($row = Database::fetch_assoc($result)) {
            if ($row['responsable'] != 0) {
                $row['responsable'] = api_get_user_info($row['responsable']);
                $row['responsable'] = $row['responsable']['firstname'] . ' ' . $row['responsable']['lastname'];
            }
            $row['sys_insert_datetime'] = api_format_date(
                    $row['sys_insert_datetime'], '%d/%m/%y - %I:%M:%S %p'
            );
            $row['sys_lastedit_datetime'] = api_format_date(
                    $row['sys_lastedit_datetime'], '%d/%m/%y - %I:%M:%S %p'
            );
            $row['category'] = utf8_decode($row['category']);
            $row['programa'] = utf8_decode($row['fullname']);
            $row['fullname'] = utf8_decode($row['fullname']);
            $row['responsable'] = utf8_decode($row['responsable']);
            $tickets[] = $row;
        }

        return $tickets;
    }
Exemple #14
0
    exit;
}
$userInfo = ['id' => $user->getId(), 'complete_name' => $user->getCompleteName()];
$skillInfo = ['id' => $skill->getId(), 'name' => $skill->getName(), 'short_code' => $skill->getShortCode(), 'description' => $skill->getDescription(), 'criteria' => $skill->getCriteria(), 'badge_image' => $skill->getWebIconPath(), 'courses' => []];
$badgeAssertions = [];
foreach ($userSkills as $userSkill) {
    $sessionId = 0;
    $course = $entityManager->find('ChamiloCoreBundle:Course', $userSkill->getCourseId());
    $courseName = $course ? $course->getTitle() : '';
    if ($userSkill->getSessionId()) {
        $session = $entityManager->find('ChamiloCoreBundle:Session', $userSkill->getSessionId());
        $sessionId = $session->getId();
        $courseName = "[{$session->getName()}] {$course->getTitle()}";
    }
    $userSkillDate = api_get_local_time($userSkill->getAcquiredSkillAt());
    $skillInfo['courses'][] = ['name' => $courseName, 'date_issued' => api_format_date($userSkillDate, DATE_TIME_FORMAT_LONG)];
    $assertionUrl = api_get_path(WEB_CODE_PATH) . "badge/assertion.php?";
    $assertionUrl .= http_build_query(array('user' => $user->getId(), 'skill' => $skill->getId(), 'course' => $userSkill->getCourseId(), 'session' => $userSkill->getSessionId()));
    $badgeAssertions[] = $assertionUrl;
}
$allowExport = api_get_user_id() == $user->getId();
if ($allowExport) {
    $backpack = 'https://backpack.openbadges.org/';
    $configBackpack = api_get_setting('gradebook.openbadges_backpack');
    if (strcmp($backpack, $configBackpack) !== 0) {
        $backpack = $configBackpack;
    }
    $htmlHeadXtra[] = '<script src="' . $backpack . 'issuer.js"></script>';
}
$objSkill = new Skill();
$skills = $objSkill->get($skillId);
        ?>
                </tbody>
            </table>
        </div>

        <?php 
        echo '<div class="divTableWithFloatingHeader attendance-calendar-table" style="margin:0px;padding:0px;float:left;width:55%;overflow:auto;overflow-y:hidden;">';
        echo '<table class="tableWithFloatingHeader data_table" width="100%">';
        echo '<thead>';
        $result = null;
        if (count($attendant_calendar) > 0) {
            foreach ($attendant_calendar as $calendar) {
                $date = $calendar['date'];
                $time = $calendar['time'];
                $datetime = $date . '<br />' . $time;
                $datetime = api_format_date($calendar['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
                $img_lock = Display::return_icon('lock.gif', get_lang('DateUnLock'), array('class' => 'img_lock', 'id' => 'datetime_column_' . $calendar['id']));
                if (!empty($calendar['done_attendance'])) {
                    $datetime = '<font color="blue">' . $datetime . '</font>';
                }
                $disabled_check = 'disabled = "true"';
                if ($next_attendance_calendar_id == $calendar['id']) {
                    $input_hidden = '<input type="hidden" id="hidden_input_' . $calendar['id'] . '" name="hidden_input[]" value="' . $calendar['id'] . '" />';
                    $disabled_check = '';
                    $img_lock = Display::return_icon('unlock.gif', get_lang('DateLock'), array('class' => 'img_unlock', 'id' => 'datetime_column_' . $calendar['id']));
                } else {
                    $input_hidden = '<input type="hidden" id="hidden_input_' . $calendar['id'] . '" name="hidden_input[]" value="" />';
                }
                $result .= '<th width="800px" style="text-align:center">';
                $result .= '<center><div style="width:40px;">' . $datetime . '<br />';
                if (api_is_allowed_to_edit(null, true)) {
Exemple #16
0
 $defaults['content'] = str_replace('<!--[', '<!-- [', $content);
 //if ($extension == 'htm' || $extension == 'html')
 // HotPotatoes tests are html files, but they should not be edited in order their functionality to be preserved.
 if (($extension == 'htm' || $extension == 'html') && stripos($dir, '/HotPotatoes_files') === false) {
     if (empty($readonly) && $readonly == 0) {
         $_SESSION['showedit'] = 1;
         $form->add_html_editor('content', '', false, false, $html_editor_config);
         //$renderer->setElementTemplate('<div class="row"><div class="label" id="frmModel" style="overflow: visible;"></div><div class="formw">{element}</div></div>', 'content');
         //$form->add_html_editor('content', '', false, true, $html_editor_config);
     }
 }
 if (!$group_document && !is_my_shared_folder(api_get_user_id(), $my_cur_dir_path, $current_session_id)) {
     //$metadata_link = '<a href="../metadata/index.php?eid='.urlencode('Document.'.$document_data['id']).'">'.get_lang('AddMetadata').'</a>';
     // Updated on field
     $last_edit_date = api_get_local_time($last_edit_date);
     $display_date = date_to_str_ago($last_edit_date) . ' <span class="dropbox_date">' . api_format_date($last_edit_date) . '</span>';
     //$form->addElement('label', get_lang('Metadata'), $metadata_link);
     $form->addElement('label', get_lang('UpdatedOn'), $display_date);
 }
 $form->addElement('textarea', 'comment', get_lang('Comment'));
 if ($owner_id == api_get_user_id() || api_is_platform_admin()) {
     $checked =& $form->addElement('checkbox', 'readonly', null, get_lang('ReadOnly'));
     if ($readonly == 1) {
         $checked->setChecked(true);
     }
 }
 if ($is_certificate_mode) {
     $form->addElement('style_submit_button', 'submit', get_lang('SaveCertificate'), array('class' => 'save'));
 } else {
     $form->addElement('style_submit_button', 'submit', get_lang('SaveDocument'), array('class' => 'save'));
 }
 /**
  * Show the monthcalender of the given month
  * @param	array	Agendaitems
  * @param	int	Month number
  * @param	int	Year number
  * @param	array	Array of strings containing long week day names (deprecated, you can send an empty array instead)
  * @param	string	The month name
  * @return	void	Direct output
  */
 public static function display_mymonthcalendar($user_id, $agendaitems, $month, $year, $weekdaynames = array(), $monthName, $show_content = true)
 {
     global $DaysShort, $course_path;
     //Handle leap year
     $numberofdays = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);
     if ($year % 400 == 0 or $year % 4 == 0 and $year % 100 != 0) {
         $numberofdays[2] = 29;
     }
     //Get the first day of the month
     $dayone = getdate(mktime(0, 0, 0, $month, 1, $year));
     //Start the week on monday
     $startdayofweek = $dayone['wday'] != 0 ? $dayone['wday'] - 1 : 6;
     $g_cc = isset($_GET['courseCode']) ? $_GET['courseCode'] : '';
     $prev_icon = Display::return_icon('action_prev.png', get_lang('Previous'));
     $next_icon = Display::return_icon('action_next.png', get_lang('Next'));
     $next_month = $month == 1 ? 12 : $month - 1;
     $prev_month = $month == 12 ? 1 : $month + 1;
     $next_year = $month == 1 ? $year - 1 : $year;
     $prev_year = $month == 12 ? $year + 1 : $year;
     if ($show_content) {
         $back_url = Display::url($prev_icon, api_get_self() . "?coursePath=" . urlencode($course_path) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . $next_month . "&year=" . $next_year);
         $next_url = Display::url($next_icon, api_get_self() . "?coursePath=" . urlencode($course_path) . "&courseCode=" . Security::remove_XSS($g_cc) . "&action=view&view=month&month=" . $prev_month . "&year=" . $prev_year);
     } else {
         $back_url = Display::url($prev_icon, '', array('onclick' => "load_calendar('" . $user_id . "','" . $next_month . "', '" . $next_year . "'); "));
         $next_url = Display::url($next_icon, '', array('onclick' => "load_calendar('" . $user_id . "','" . $prev_month . "', '" . $prev_year . "'); "));
     }
     echo '<table id="agenda_list"><tr>';
     echo '<th width="10%">' . $back_url . '</th>';
     echo '<th width="80%" colspan="5"><br /><h3>' . $monthName . " " . $year . '</h3></th>';
     echo '<th width="10%">' . $next_url . '</th>';
     echo '</tr>';
     echo '<tr>';
     for ($ii = 1; $ii < 8; $ii++) {
         echo '<td class="weekdays">' . $DaysShort[$ii % 7] . '</td>';
     }
     echo '</tr>';
     $curday = -1;
     $today = getdate();
     while ($curday <= $numberofdays[$month]) {
         echo "<tr>";
         for ($ii = 0; $ii < 7; $ii++) {
             if ($curday == -1 && $ii == $startdayofweek) {
                 $curday = 1;
             }
             if ($curday > 0 && $curday <= $numberofdays[$month]) {
                 $bgcolor = $class = 'class="days_week"';
                 $dayheader = Display::div($curday, array('class' => 'agenda_day'));
                 if ($curday == $today['mday'] && $year == $today['year'] && $month == $today['mon']) {
                     $class = "class=\"days_today\" style=\"width:10%;\"";
                 }
                 echo "<td " . $class . ">" . $dayheader;
                 if (!empty($agendaitems[$curday])) {
                     $items = $agendaitems[$curday];
                     $items = msort($items, 'start_date_tms');
                     foreach ($items as $value) {
                         $value['title'] = Security::remove_XSS($value['title']);
                         $start_time = api_format_date($value['start_date'], TIME_NO_SEC_FORMAT);
                         $end_time = '';
                         if (!empty($value['end_date']) && $value['end_date'] != '0000-00-00 00:00:00') {
                             $end_time = '-&nbsp;<i>' . api_format_date($value['end_date'], DATE_TIME_FORMAT_LONG) . '</i>';
                         }
                         $complete_time = '<i>' . api_format_date($value['start_date'], DATE_TIME_FORMAT_LONG) . '</i>&nbsp;' . $end_time;
                         $time = '<i>' . $start_time . '</i>';
                         switch ($value['calendar_type']) {
                             case 'personal':
                                 $bg_color = '#D0E7F4';
                                 $icon = Display::return_icon('user.png', get_lang('MyAgenda'), array(), ICON_SIZE_SMALL);
                                 break;
                             case 'global':
                                 $bg_color = '#FFBC89';
                                 $icon = Display::return_icon('view_remove.png', get_lang('GlobalEvent'), array(), ICON_SIZE_SMALL);
                                 break;
                             case 'course':
                                 $bg_color = '#CAFFAA';
                                 $icon_name = 'course.png';
                                 if (!empty($value['session_id'])) {
                                     $icon_name = 'session.png';
                                 }
                                 if ($show_content) {
                                     $icon = Display::url(Display::return_icon($icon_name, $value['course_name'] . ' ' . get_lang('Course'), array(), ICON_SIZE_SMALL), $value['url']);
                                 } else {
                                     $icon = Display::return_icon($icon_name, $value['course_name'] . ' ' . get_lang('Course'), array(), ICON_SIZE_SMALL);
                                 }
                                 break;
                             default:
                                 break;
                         }
                         $result = '<div class="rounded_div_agenda" style="background-color:' . $bg_color . ';">';
                         if ($show_content) {
                             //Setting a personal event to green
                             $icon = Display::div($icon, array('style' => 'float:right'));
                             $link = $value['calendar_type'] . '_' . $value['id'] . '_' . $value['course_id'] . '_' . $value['session_id'];
                             //Link to bubble
                             $url = Display::url(cut($value['title'], 40), '#', array('id' => $link, 'class' => 'opener'));
                             $result .= $time . ' ' . $icon . ' ' . Display::div($url);
                             //Hidden content
                             $content = Display::div($icon . Display::tag('h2', $value['course_name']) . '<hr />' . Display::tag('h3', $value['title']) . $complete_time . '<hr />' . Security::remove_XSS($value['content']));
                             //Main div
                             $result .= Display::div($content, array('id' => 'main_' . $link, 'class' => 'dialog', 'style' => 'display:none'));
                             $result .= '</div>';
                             echo $result;
                             //echo Display::div($content, array('id'=>'main_'.$value['calendar_type'].'_'.$value['id'], 'class' => 'dialog'));
                         } else {
                             echo $result .= $icon . '</div>';
                         }
                     }
                 }
                 echo "</td>";
                 $curday++;
             } else {
                 echo "<td></td>";
             }
         }
         echo "</tr>";
     }
     echo "</table>";
 }
 /**
  * Get the extra fields and their formatted values
  * @param int|string $itemId The item ID (It could be a session_id, course_id or user_id)
  * @return array The extra fields data
  */
 public function getDataAndFormattedValues($itemId)
 {
     $valuesData = array();
     $fields = $this->get_all();
     foreach ($fields as $field) {
         if ($field['visible'] != '1') {
             continue;
         }
         $fieldValue = new ExtraFieldValue($this->type);
         $valueData = $fieldValue->get_values_by_handler_and_field_id($itemId, $field['id'], true);
         if (!$valueData) {
             continue;
         }
         $displayedValue = get_lang('None');
         switch ($field['field_type']) {
             case ExtraField::FIELD_TYPE_CHECKBOX:
                 if ($valueData !== false && $valueData['value'] == '1') {
                     $displayedValue = get_lang('Yes');
                 } else {
                     $displayedValue = get_lang('No');
                 }
                 break;
             case ExtraField::FIELD_TYPE_DATE:
                 if ($valueData !== false && !empty($valueData['value'])) {
                     $displayedValue = api_format_date($valueData['value'], DATE_FORMAT_LONG_NO_DAY);
                 }
                 break;
             case ExtraField::FIELD_TYPE_FILE_IMAGE:
                 if ($valueData === false || empty($valueData['value'])) {
                     break;
                 }
                 if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
                     break;
                 }
                 $image = Display::img(api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], $field['display_text'], array('width' => '300'));
                 $displayedValue = Display::url($image, api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], array('target' => '_blank'));
                 break;
             case ExtraField::FIELD_TYPE_FILE:
                 if ($valueData === false || empty($valueData['value'])) {
                     break;
                 }
                 if (!file_exists(api_get_path(SYS_UPLOAD_PATH) . $valueData['value'])) {
                     break;
                 }
                 $displayedValue = Display::url(get_lang('Download'), api_get_path(WEB_UPLOAD_PATH) . $valueData['value'], array('title' => $field['display_text'], 'target' => '_blank'));
                 break;
             default:
                 $displayedValue = $valueData['value'];
                 break;
         }
         $valuesData[] = array('text' => $field['display_text'], 'value' => $displayedValue);
     }
     return $valuesData;
 }
Exemple #19
0
 /**
  * Display posts from a certain date
  *
  * @param Integer $blog_id
  * @param String $query_string
  */
 public static function display_day_results($blog_id, $query_string)
 {
     // Init
     $date_output = $query_string;
     $date = explode('-', $query_string);
     $query_string = ' DAYOFMONTH(date_creation) =' . intval($date[2]) . ' AND MONTH(date_creation) =' . intval($date[1]) . ' AND YEAR(date_creation) =' . intval($date[0]);
     // Put date in correct output format
     $date_output = api_format_date($date_output, DATE_FORMAT_LONG);
     // Display the posts
     echo '<span class="blogpost_title">' . get_lang('PostsOf') . ': ' . $date_output . '</span>';
     Blog::display_blog_posts($blog_id, $query_string);
 }
Exemple #20
0
    /**
     * Export the given HTML to PDF, using a global template
     * @param string $content the HTML content
     *
     * @uses export/table_pdf.tpl
     */
    public function html_to_pdf_with_template($content)
    {
        global $_configuration;
        Display :: display_no_header();

        // Assignments
        Display::$global_template->assign('pdf_content', $content);

        $organization = api_get_setting('Institution');
        $img = api_get_path(SYS_CODE_PATH).'css/'.api_get_visual_theme().'/images/header-logo.png';

        // Search for classic logo
        if (file_exists($img)) {
            $img = api_get_path(WEB_CODE_PATH).'css/'.api_get_visual_theme().'/images/header-logo.png';
            $organization = "<img src='$img'>";
        } else {
            // Just use the platform title.
            if (!empty($organization)) {
                $organization = '<h2 align="left">'.$organization.'</h2>';
            }
        }

        // Use custom logo image.
        if (isset($_configuration['pdf_logo_header']) &&
            $_configuration['pdf_logo_header']
        ) {
            $img = api_get_path(SYS_CODE_PATH).'css/'.api_get_visual_theme().'/images/pdf_logo_header.png';
            if (file_exists($img)) {
                $img = api_get_path(WEB_CODE_PATH) . 'css/' . api_get_visual_theme() . '/images/pdf_logo_header.png';
                $organization = "<img src='$img'>";
            }
        }

        Display::$global_template->assign('organization', $organization);

        //Showing only the current teacher/admin instead the all teacher list name see BT#4080

        if (isset($this->params['show_real_course_teachers']) &&
            $this->params['show_real_course_teachers']
        ) {
            if (isset($this->params['session_info']) &&
                !empty($this->params['session_info'])
            ) {
                $teacher_list = SessionManager::getCoachesByCourseSessionToString(
                    $this->params['session_info']['id'],
                    $this->params['course_code']

                );
            } else {
                $teacher_list = CourseManager::get_teacher_list_from_course_code_to_string(
                    $this->params['course_code']
                );
            }
        } else {
            $user_info = api_get_user_info();
            $teacher_list = $user_info['complete_name'];
        }

        Display::$global_template->assign('pdf_course', $this->params['course_code']);
        Display::$global_template->assign('pdf_course_info', $this->params['course_info']);
        Display::$global_template->assign('pdf_session_info', $this->params['session_info']);
        Display::$global_template->assign('pdf_date', api_format_date(api_get_local_time(), DATE_TIME_FORMAT_LONG));
        Display::$global_template->assign('pdf_teachers', $teacher_list);
        Display::$global_template->assign('pdf_title', $this->params['pdf_title']);
        Display::$global_template->assign('add_signatures', $this->params['add_signatures']);

        // Getting template
        $tpl = Display::$global_template->get_template('export/table_pdf.tpl');
        $html = Display::$global_template->fetch($tpl);
        $html = api_utf8_encode($html);

        $css_file = api_get_path(TO_SYS, WEB_CSS_PATH).'/print.css';
        $css = file_exists($css_file) ? @file_get_contents($css_file) : '';
        self::content_to_pdf($html, $css, $this->params['filename'], $this->params['course_code']);
    }
 /**
  * Get las connection date for a student
  * @param int $student_id
  * @param bool $warning_message Show a warning message (optional)
  * @param bool $return_timestamp True for returning results in timestamp (optional)
  * @return string|int|bool Date format long without day, false if there are no connections or
  * timestamp if parameter $return_timestamp is true
  */
 public static function get_last_connection_date($student_id, $warning_message = false, $return_timestamp = false)
 {
     $table = Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
     $sql = 'SELECT login_date
 	        FROM ' . $table . '
             WHERE login_user_id = ' . intval($student_id) . '
             ORDER BY login_date
             DESC LIMIT 0,1';
     $rs = Database::query($sql);
     if (Database::num_rows($rs) > 0) {
         if ($last_login_date = Database::result($rs, 0, 0)) {
             $last_login_date = api_get_local_time($last_login_date);
             if ($return_timestamp) {
                 return api_strtotime($last_login_date, 'UTC');
             } else {
                 if (!$warning_message) {
                     return api_format_date($last_login_date, DATE_FORMAT_SHORT);
                 } else {
                     $timestamp = api_strtotime($last_login_date, 'UTC');
                     $currentTimestamp = time();
                     //If the last connection is > than 7 days, the text is red
                     //345600 = 7 days in seconds
                     if ($currentTimestamp - $timestamp > 604800) {
                         return '<span style="color: #F00;">' . api_format_date($last_login_date, DATE_FORMAT_SHORT) . '</span>';
                     } else {
                         return api_format_date($last_login_date, DATE_FORMAT_SHORT);
                     }
                 }
             }
         }
     }
     return false;
 }
                    $result[] = $data['display'];
                }
                $data_table[] = $result;
            }
            export_pdf_with_html($head_table, $data_table, $header_pdf, $footer_pdf, $title_pdf);
        }
        // export results to xml or csv file
        foreach ($results as $result) {
            $userinfo = api_get_user_info($result->get_user_id());
            $data['username'] = $userinfo['username'];
            //$result->get_user_id();
            $data['official_code'] = $userinfo['official_code'];
            $data['lastname'] = $userinfo['lastname'];
            $data['firstname'] = $userinfo['firstname'];
            $data['score'] = $result->get_score();
            $data['date'] = api_format_date($result->get_date(), "%d/%m/%Y %R");
            $alldata[] = $data;
        }
        switch ($file_type) {
            case 'xml':
                Export::arrayToXml($alldata, $filename, 'Result', 'XMLResults');
                exit;
                break;
            case 'csv':
                Export::arrayToCsv($alldata, $filename);
                exit;
                break;
        }
    }
}
if (isset($_GET['resultdelete'])) {
 /**
  * It's used to print attendance sheet
  * @param string action
  * @param int    attendance id
  */
 public function attendance_sheet_export_to_pdf($action, $attendance_id, $student_id = 0, $course_id = '')
 {
     $attendance = new Attendance();
     $courseInfo = CourseManager::get_course_information($course_id);
     $attendance->set_course_id($courseInfo['code']);
     $data_array = array();
     $data_array['attendance_id'] = $attendance_id;
     $data_array['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
     $filter_type = 'today';
     if (!empty($_REQUEST['filter'])) {
         $filter_type = $_REQUEST['filter'];
     }
     $my_calendar_id = null;
     if (is_numeric($filter_type)) {
         $my_calendar_id = $filter_type;
         $filter_type = 'calendar_id';
     }
     $data_array['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id);
     if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
         $data_array['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
     } else {
         if (!empty($student_id)) {
             $user_id = intval($student_id);
         } else {
             $user_id = api_get_user_id();
         }
         $data_array['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
         $data_array['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
         $data_array['user_id'] = $user_id;
     }
     $data_array['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
     //Set headers pdf
     $courseCategory = CourseManager::get_course_category($courseInfo['category_code']);
     $teacherInfo = CourseManager::get_teacher_list_from_course_code($courseInfo['real_id']);
     $teacherName = null;
     foreach ($teacherInfo as $dados) {
         if ($teacherName != null) {
             $teacherName = $teacherName . " / ";
         }
         $teacherName .= $dados['firstname'] . " " . $dados['lastname'];
     }
     // Get data table - Marco - ordenacao fixa - just fullname
     $data_table = array();
     $head_table = array('#', get_lang('Name'));
     foreach ($data_array['attendant_calendar'] as $class_day) {
         //$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_SHORT).' <br />'.api_format_date($class_day['date_time'], TIME_NO_SEC_FORMAT);
         $head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
     }
     $data_table[] = $head_table;
     $dataClass = array();
     $max_dates_per_page = 10;
     $data_attendant_calendar = $data_array['attendant_calendar'];
     $data_users_presence = $data_array['users_presence'];
     $count = 1;
     if (!empty($data_array['users_in_course'])) {
         foreach ($data_array['users_in_course'] as $user) {
             $cols = 1;
             $result = array();
             $result['count'] = $count;
             $result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
             foreach ($data_array['attendant_calendar'] as $class_day) {
                 if ($class_day['done_attendance'] == 1) {
                     if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1) {
                         $result[$class_day['id']] = get_lang('UserAttendedSymbol');
                     } else {
                         $result[$class_day['id']] = get_lang('UserNotAttendedSymbol');
                     }
                 } else {
                     $result[$class_day['id']] = " ";
                 }
                 $cols++;
             }
             $count++;
             $data_table[] = $result;
         }
     }
     $max_cols_per_page = 12;
     //10 dates + 2 name and number
     $max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;
     //10
     $rows = count($data_table);
     if ($cols > $max_cols_per_page) {
         $number_tables = round(($cols - 2) / $max_dates_per_page);
         $headers = $data_table[0];
         $all = array();
         $tables = array();
         $changed = 1;
         for ($i = 0; $i <= $rows; $i++) {
             $row = $data_table[$i];
             $key = 1;
             $max_dates_per_page = 10;
             $item = $data_table[$i];
             $count_j = 0;
             if (!empty($item)) {
                 foreach ($item as $value) {
                     if ($count_j >= $max_dates_per_page) {
                         $key++;
                         $max_dates_per_page = $max_dates_per_page_original * $key;
                         //magic hack
                         $tables[$key][$i][] = $tables[1][$i][0];
                         $tables[$key][$i][] = $tables[1][$i][1];
                     }
                     $tables[$key][$i][] = $value;
                     $count_j++;
                 }
             }
         }
         $content = null;
         if (!empty($tables)) {
             foreach ($tables as $sub_table) {
                 $content .= Export::convert_array_to_html($sub_table) . '<br /><br />';
             }
         }
     } else {
         $content .= Export::convert_array_to_html($data_table, array('header_attributes' => array('align' => 'center')));
     }
     $params = array('filename' => get_lang('Attendance') . '-' . api_get_local_time(), 'pdf_title' => $courseInfo['title'], 'course_code' => $courseInfo['code'], 'add_signatures' => true, 'orientation' => 'landscape', 'pdf_teachers' => $teacherName, 'pdf_course_category' => $courseCategory['name'], 'format' => 'A4-L', 'orientation' => 'L');
     Export::export_html_to_pdf($content, $params);
     exit;
 }
         break;
 }
 $transferAccounts = $plugin->getTransferAccounts();
 $userInfo = api_get_user_info($sale['user_id']);
 $form = new FormValidator('success', 'POST', api_get_self(), null, null, FormValidator::LAYOUT_INLINE);
 if ($form->validate()) {
     $formValues = $form->getSubmitValues();
     if (isset($formValues['cancel'])) {
         $plugin->cancelSale($sale['id']);
         unset($_SESSION['bc_sale_id']);
         header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/index.php');
         exit;
     }
     $messageTemplate = new Template();
     $messageTemplate->assign('user', $userInfo);
     $messageTemplate->assign('sale', ['date' => api_format_date($sale['date'], DATE_FORMAT_LONG_NO_DAY), 'product' => $sale['product_name'], 'currency' => $currency['iso_code'], 'price' => $sale['price'], 'reference' => $sale['reference']]);
     $messageTemplate->assign('transfer_accounts', $transferAccounts);
     api_mail_html($userInfo['complete_name'], $userInfo['email'], $plugin->get_lang('bc_subject'), $messageTemplate->fetch('buycourses/view/message_transfer.tpl'));
     Display::addFlash(Display::return_message(sprintf($plugin->get_lang('PurchaseStatusX'), $plugin->get_lang('PendingReasonByTransfer')), 'success', false));
     unset($_SESSION['bc_sale_id']);
     header('Location: ' . api_get_path(WEB_PLUGIN_PATH) . 'buycourses/src/course_catalog.php');
     exit;
 }
 $form->addButton('confirm', $plugin->get_lang('ConfirmOrder'), 'check', 'success');
 $form->addButtonCancel($plugin->get_lang('CancelOrder'), 'cancel');
 $template = new Template();
 if ($buyingCourse) {
     $template->assign('course', $course);
 } elseif ($buyingSession) {
     $template->assign('session', $session);
 }
     $productInfo = $sale['product_type'] == 1 ? api_get_course_info_by_id($sale['product_id']) : api_get_session_info($sale['product_id']);
     $currency = $plugin->getSelectedCurrency();
     if ($sale['product_type'] == 1) {
         $productImage = $productInfo['course_image_large'];
     } else {
         $productImage = $productInfo['image'] ? $productInfo['image'] : Template::get_icon_path('session_default.png');
     }
     $userInfo = api_get_user_info($sale['user_id']);
     $html = '<h2>' . $sale['product_name'] . '</h2>';
     $html .= '<div class="row">';
     $html .= '<div class="col-sm-6 col-md-6">';
     $html .= '<ul>';
     $html .= '<li><b>' . $plugin->get_lang('OrderPrice') . ':</b> ' . $sale['price'] . '</li>';
     $html .= '<li><b>' . $plugin->get_lang('CurrencyType') . ':</b> ' . $currency['iso_code'] . '</li>';
     $html .= '<li><b>' . $plugin->get_lang('ProductType') . ':</b> ' . $productType . '</li>';
     $html .= '<li><b>' . $plugin->get_lang('OrderDate') . ':</b> ' . api_format_date($sale['date'], DATE_TIME_FORMAT_LONG_24H) . '</li>';
     $html .= '<li><b>' . $plugin->get_lang('Buyer') . ':</b> ' . $userInfo['complete_name'] . '</li>';
     $html .= '<li><b>' . $plugin->get_lang('PaymentMethods') . ':</b> ' . $paymentType . '</li>';
     $html .= '</ul>';
     $html .= '</div>';
     $html .= '<div class="col-sm-6 col-md-6">';
     $html .= '<img class="thumbnail" src="' . $productImage . '" >';
     $html .= '</div>';
     $html .= '</div>';
     echo $html;
     break;
 case 'stats':
     $stats = [];
     $stats['completed_count'] = 0;
     $stats['completed_total_amount'] = 0;
     $stats['pending_count'] = 0;
/**
 * Converts a date to the right timezone and localizes it in the format given as an argument
 * @param mixed The time to be converted
 * @param mixed Format to be used (TIME_NO_SEC_FORMAT, DATE_FORMAT_SHORT, DATE_FORMAT_LONG, DATE_TIME_FORMAT_LONG)
 * @param string Timezone to be converted from. If null, UTC will be assumed.
 * @return string Converted and localized date
 *
 * @author Guillaume Viguier <*****@*****.**>
 */
function api_convert_and_format_date($time = null, $format = null, $from_timezone = null)
{
    // First, convert the datetime to the right timezone
    $time = api_get_local_time($time, null, $from_timezone);
    // Second, localize the date
    return api_format_date($time, $format);
}
Exemple #27
0
 } else {
     echo $thematic_plan_div[$thematic['id']];
 }
 echo '</td>';
 // Display 3rd column - thematic advance data
 echo '<td style="vertical-align:top">';
 //if (api_is_allowed_to_edit(null, true) &&  api_get_session_id() == $thematic['session_id']) {
 if (api_is_allowed_to_edit(null, true)) {
     echo '<div style="text-align:right"><a href="index.php?' . api_get_cidreq() . '&action=thematic_advance_add&thematic_id=' . $thematic['id'] . '">' . Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM) . '</a></div>';
 }
 //if (api_is_allowed_to_edit(null, true) &&  api_get_session_id() == $thematic['session_id']) {
 if (!empty($thematic_advance_data[$thematic['id']])) {
     echo '<table width="100%">';
     foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) {
         $thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']);
         $thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG);
         echo '<tr>';
         echo '<td width="90%" class="thematic_advance_content" id="thematic_advance_content_id_' . $thematic_advance['id'] . '">';
         $edit_link = '';
         if (api_is_allowed_to_edit(null, true)) {
             $edit_link = Display::url(Display::return_icon('edit.png', get_lang('EditThematicAdvance'), [], ICON_SIZE_SMALL), 'index.php?' . api_get_cidreq() . '&' . http_build_query(['action' => 'thematic_advance_edit', 'thematic_id' => $thematic['id'], 'thematic_advance_id' => $thematic_advance['id'], 'display' => 'no_header']), ['class' => 'ajax', 'data-title' => get_lang('EditThematicAdvance')]);
             $edit_link .= '<a onclick="javascript:if(!confirm(\'' . get_lang('AreYouSureToDelete') . '\')) return false;" href="index.php?' . api_get_cidreq() . '&action=thematic_advance_delete&thematic_id=' . $thematic['id'] . '&thematic_advance_id=' . $thematic_advance['id'] . '">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a></center>';
             //Links
             $edit_link = Display::div(Display::div($edit_link, array('id' => 'thematic_advance_tools_' . $thematic_advance['id'], 'class' => 'thematic_advance_actions')), array('style' => 'height:20px;'));
         }
         $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null;
         echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_' . $thematic_advance['id']));
         echo $edit_link;
         echo '</td>';
         //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) {
         if (api_is_allowed_to_edit(null, true)) {
 /**
  * Set system parameters
  */
 private function set_system_parameters()
 {
     global $_configuration;
     $this->theme = api_get_visual_theme();
     //Setting app paths/URLs
     $_p = array('web' => api_get_path(WEB_PATH), 'web_relative' => api_get_path(REL_PATH), 'web_course' => api_get_path(WEB_COURSE_PATH), 'web_main' => api_get_path(WEB_CODE_PATH), 'web_css' => api_get_path(WEB_CSS_PATH), 'web_css_theme' => api_get_path(WEB_CSS_PATH) . 'themes/' . $this->theme . '/', 'web_ajax' => api_get_path(WEB_AJAX_PATH), 'web_img' => api_get_path(WEB_IMG_PATH), 'web_plugin' => api_get_path(WEB_PLUGIN_PATH), 'web_lib' => api_get_path(WEB_LIBRARY_PATH), 'web_upload' => api_get_path(WEB_UPLOAD_PATH), 'web_self' => api_get_self(), 'web_query_vars' => api_htmlentities($_SERVER['QUERY_STRING']), 'web_self_query_vars' => api_htmlentities($_SERVER['REQUEST_URI']), 'web_cid_query' => api_get_cidreq());
     $this->assign('_p', $_p);
     //Here we can add system parameters that can be use in any template
     $_s = array('software_name' => $_configuration['software_name'], 'system_version' => $_configuration['system_version'], 'site_name' => api_get_setting('platform.site_name'), 'institution' => api_get_setting('platform.institution'), 'date' => api_format_date('now', DATE_FORMAT_LONG), 'timezone' => _api_get_timezone(), 'gamification_mode' => api_get_setting('platform.gamification_mode'));
     $this->assign('_s', $_s);
 }
Exemple #29
0
/**
 * This function retrieves all the personal agenda items of the user and shows
 * these items in one list (ordered by date and grouped by month (the month_bar)
 */
function show_personal_agenda()
{
    global $MonthsLong, $charset;
    $tbl_personal_agenda = Database::get_main_table(TABLE_PERSONAL_AGENDA);
    // The SQL statement that retrieves all the personal agenda items of this user
    $sql = "SELECT * FROM " . $tbl_personal_agenda . " WHERE user='******' ORDER BY date DESC";
    $result = Database::query($sql);
    // variable initialisation
    $month_bar = "";
    // setting the default day, month and year
    if (!isset($_GET['day']) and !isset($_GET['month']) and !isset($_GET['year'])) {
        $today = getdate();
        $year = $today['year'];
        $month = $today['mon'];
        $day = $today['mday'];
    }
    $export_icon = 'export.png';
    $export_icon_low = 'export_low_fade.png';
    $export_icon_high = 'export_high_fade.png';
    // starting the table output
    echo '<table class="data_table">';
    $th = Display::tag('th', get_lang('Title'));
    $th .= Display::tag('th', get_lang('Content'));
    $th .= Display::tag('th', get_lang('StartTimeWindow'));
    $th .= Display::tag('th', get_lang('Modify'));
    echo Display::tag('tr', $th);
    if (Database::num_rows($result) > 0) {
        $counter = 0;
        while ($myrow = Database::fetch_array($result)) {
            /* 	display: the month bar		*/
            if ($month_bar != date("m", strtotime($myrow["date"])) . date("Y", strtotime($myrow["date"]))) {
                $month_bar = date("m", strtotime($myrow["date"])) . date("Y", strtotime($myrow["date"]));
                //echo "<tr><th class=\"title\" colspan=\"2\" class=\"month\" valign=\"top\">".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."</th></tr>";
            }
            // highlight: if a date in the small calendar is clicked we highlight the relevant items
            $db_date = (int) date("d", strtotime($myrow["date"])) . date("n", strtotime($myrow["date"])) . date("Y", strtotime($myrow["date"]));
            /*
            			if ($_GET["day"].$_GET["month"].$_GET["year"] <> $db_date) {
            				$style = "data";
            				$text_style = "text";
            			} else {
            				$style = "datanow";
            				$text_style = "text";
            			}*/
            $class = 'row_even';
            if ($counter % 2) {
                $class = 'row_odd';
            }
            echo '<tr class="' . $class . '">';
            echo '<td>';
            /*   display: the title  */
            echo $myrow['title'];
            echo "</td>";
            // display: the content
            $content = $myrow['text'];
            echo "<td>";
            echo $content;
            echo "</td>";
            //display: date and time
            echo '<td>';
            // adding an internal anchor
            /*echo "<a name=\"".$myrow["id"]."\"></a>";
            		echo date("d", strtotime($myrow["date"]))." ".$MonthsLong[date("n", strtotime($myrow["date"])) - 1]." ".date("Y", strtotime($myrow["date"]))."&nbsp;";*/
            $myrow["date"] = api_get_local_time($myrow["date"]);
            echo api_format_date($myrow["date"], DATE_TIME_FORMAT_LONG);
            echo "</td>";
            //echo '<td></td>'; //remove when enabling ical
            //echo '<td class="'.$style.'">';
            //echo '<a class="ical_export" href="ical_export.php?type=personal&id='.$myrow['id'].'&class=confidential" title="'.get_lang('ExportiCalConfidential').'">'.Display::return_icon($export_icon_high, get_lang('ExportiCalConfidential')).'</a>';
            //echo '<a class="ical_export" href="ical_export.php?type=personal&id='.$myrow['id'].'&class=private" title="'.get_lang('ExportiCalPrivate').'">'.Display::return_icon($export_icon_low, get_lang('ExportiCalPrivate')).'</a>';
            //echo '<a class="ical_export" href="ical_export.php?type=personal&id='.$myrow['id'].'&class=public" title="'.get_lang('ExportiCalPublic').'">'.Display::return_icon($export_icon, get_lang('ExportiCalPublic')).'</a>';
            //echo "</td>";
            //echo "</tr>";
            /* display: the edit / delete icons */
            echo "<td>";
            echo "<a href=\"myagenda.php?action=edit_personal_agenda_item&amp;id=" . $myrow['id'] . "\">" . Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . "</a> ";
            echo "<a href=\"" . api_get_self() . "?action=delete&amp;id=" . $myrow['id'] . "\" onclick=\"javascript:if(!confirm('" . addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)) . "')) return false;\">" . Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL) . "</a>";
            echo "</td></tr>";
            $counter++;
        }
    } else {
        echo '<tr><td colspan="2">' . get_lang('NoAgendaItems') . '</td></tr>';
    }
    echo "</table>";
}
         $tableRows = $objSkill->listAchievedByCourse($selectedCourse);
         break;
     case 'filterBySkill':
         $skill = $objSkill->get($selectedSkill);
         $reportTitle = sprintf(get_lang('StudentsWhoAchievedTheSkillX'), $skill['name']);
         $students = UserManager::getUsersFollowedByUser($userId, STUDENT, false, false, false, null, null, null, null, null, null, DRH);
         $coursesFilter = array();
         foreach ($courses as $course) {
             $coursesFilter[] = $course['id'];
         }
         $tableRows = $objSkill->listUsersWhoAchieved($selectedSkill, $coursesFilter);
         break;
 }
 foreach ($tableRows as &$row) {
     $row['completeName'] = api_get_person_name($row['firstname'], $row['lastname']);
     $row['achievedAt'] = api_format_date($row['acquired_skill_at'], DATE_FORMAT_NUMBER);
     $row['courseImage'] = Display::return_icon('course.png', null, null, ICON_SIZE_MEDIUM, null, true);
     $imageSysPath = sprintf("%s%s/course-pic.png", api_get_path(SYS_COURSE_PATH), $row['c_directory']);
     if (file_exists($imageSysPath)) {
         $thumbSysPath = sprintf("%s%s/course-pic32.png", api_get_path(SYS_COURSE_PATH), $row['c_directory']);
         $thumbWebPath = sprintf("%s%s/course-pic32.png", api_get_path(WEB_COURSE_PATH), $row['c_directory']);
         if (!file_exists($thumbSysPath)) {
             $courseImageThumb = new Image($imageSysPath);
             $courseImageThumb->resize(32);
             $courseImageThumb->send_image($thumbSysPath);
         }
         $row['courseImage'] = $thumbWebPath;
     }
 }
 $tplPath = 'skill/drh_report.html.twig';
 $tpl->addGlobal('action', $action);