/**
  * Get document information
  */
 private function get_information($course_id, $doc_id)
 {
     $course_information = api_get_course_info($course_id);
     $course_id = $course_information['real_id'];
     $course_path = $course_information['path'];
     if (!empty($course_information)) {
         $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
         $doc_table = Database::get_course_table(TABLE_DOCUMENT);
         $doc_id = intval($doc_id);
         $sql = "SELECT * FROM       {$doc_table}\n                    WHERE      {$doc_table}.id = {$doc_id} AND c_id = {$course_id}\n                    LIMIT 1";
         $dk_result = Database::query($sql);
         $sql = "SELECT insert_user_id FROM       {$item_property_table}\n                    WHERE   ref = {$doc_id} AND tool = '" . TOOL_DOCUMENT . "' AND c_id = {$course_id}\n                    LIMIT 1";
         $name = '';
         if ($row = Database::fetch_array($dk_result)) {
             $name = $row['title'];
             $url = api_get_path(WEB_COURSE_PATH) . '%s/document%s';
             $url = sprintf($url, $course_path, $row['path']);
             // Get the image path
             $icon = choose_image(basename($row['path']));
             $thumbnail = Display::returnIconPath($icon);
             $image = $thumbnail;
             //FIXME: use big images
             // get author
             $author = '';
             $item_result = Database::query($sql);
             if ($row = Database::fetch_array($item_result)) {
                 $user_data = api_get_user_info($row['insert_user_id']);
                 $author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
             }
         }
         return array($thumbnail, $image, $name, $author, $url);
         // FIXME: is it posible to get an author here?
     } else {
         return array();
     }
 }
Exemplo n.º 2
0
    /**
     * This function creates the form elements for the multiple response questions
     *
     * @author Patrick Cool <*****@*****.**>, Ghent University
     * @version January 2007
     */
    public function createForm($survey_data, $form_content)
    {
        parent::createForm($survey_data, $form_content);
        $this->html .= '	<tr>';
        $this->html .= '		<td colspan="2"><strong>' . get_lang('DisplayAnswersHorVert') . '</strong></td>';
        $this->html .= '	</tr>';
        // Horizontal or vertical
        $this->html .= '	<tr>';
        $this->html .= '		<td align="right" valign="top">&nbsp;</td>';
        $this->html .= '		<td>';
        $this->html .= '		  <input name="horizontalvertical" type="radio" value="horizontal" ';
        if (empty($form_content['horizontalvertical']) || $form_content['horizontalvertical'] == 'horizontal') {
            $this->html .= 'checked="checked"';
        }
        $this->html .= '/>' . get_lang('Horizontal') . '</label><br />';
        $this->html .= '		  <input name="horizontalvertical" type="radio" value="vertical" ';
        if (isset($form_content['horizontalvertical']) && $form_content['horizontalvertical'] == 'vertical') {
            $this->html .= 'checked="checked"';
        }
        $this->html .= ' />' . get_lang('Vertical') . '</label>';
        $this->html .= '		</td>';
        $this->html .= '		<td>&nbsp;</td>';
        $this->html .= '	</tr>';
        $this->html .= '		<tr>
								<td colspan="">&nbsp;</td>
							</tr>';
        // The options
        $this->html .= '	<tr>';
        $this->html .= '		<td colspan="3"><strong>' . get_lang('AnswerOptions') . '</strong></td>';
        $this->html .= '	</tr>';
        $total_number_of_answers = count($form_content['answers']);
        $question_values = array();
        // Values of question options
        if (is_array($form_content['values'])) {
            // Check if data is correct
            foreach ($form_content['values'] as $key => &$value) {
                $question_values[] = '<input size="3" type="text" id="values[' . $key . ']" name="values[' . $key . ']" value="' . $value . '" />';
            }
        }
        $count = 0;
        if (is_array($form_content['answers'])) {
            foreach ($form_content['answers'] as $key => &$value) {
                $this->html .= '<tr>';
                $this->html .= '<td align="right"><label for="answers[' . $key . ']">' . ($key + 1) . '</label></td>';
                $this->html .= '<td width="550">' . api_return_html_area('answers[' . $key . ']', api_html_entity_decode(stripslashes($form_content['answers'][$key])), '', '', null, array('ToolbarSet' => 'Survey', 'Width' => '100%', 'Height' => '120')) . '</td>';
                $this->html .= '<td>';
                if ($total_number_of_answers > 2) {
                    $this->html .= $question_values[$count];
                }
                if ($key < $total_number_of_answers - 1) {
                    $this->html .= '<input type="image" style="width:22px"   src="' . Display::returnIconPath('down.png') . '"  value="move_down[' . $key . ']" name="move_down[' . $key . ']"/>';
                }
                if ($key > 0) {
                    $this->html .= '<input type="image" style="width:22px"   src="' . Display::returnIconPath('up.png') . '"  value="move_up[' . $key . ']" name="move_up[' . $key . ']"/>';
                }
                if ($total_number_of_answers > 2) {
                    $this->html .= '<input type="image" style="width:22px"   src="' . Display::returnIconPath('delete.png') . '"  value="delete_answer[' . $key . ']" name="delete_answer[' . $key . ']"/>';
                }
                $this->html .= '</td>';
                $this->html .= '</tr>';
                $count++;
            }
        }
        // The buttons for adding or removing
        //$this->html .= parent :: add_remove_buttons($form_content);
    }
Exemplo n.º 3
0
                            var hasJs = $(this).attr('href').indexOf('javascript');
                            if (hasJs >= 0) {
                                return true;
                            }
                        }

                        if ($(this).attr('class')) {
                            var hasAccordion = $(this).attr('class').indexOf('accordion-toggle');
                            if (hasAccordion >= 0) {
                                return true;
                            }
                        }

                        var src = $(this).attr('href');
                        src = url+'&type=link&src='+src;
                        src = src.replace('https', 'http');
                        $(this).attr('href', src);
                        var myAnchor = $('<a><img src="<?php 
echo Display::returnIconPath('link-external.png');
?>
"/></a>').attr("href", src).attr('target', '_blank').attr('class', 'generated');
                        $(this).after(myAnchor);
                        $(this).after('-');
                    }
                });
            });
        }

    }
}
Exemplo n.º 4
0
/**
 * Reformat the course array (output by api_get_course_info()) in order, mostly,
 * to switch from 'code' to 'id' in the array. This is a legacy feature and is
 * now possibly causing massive confusion as a new "id" field has been added to
 * the course table in 1.9.0.
 * @param $course_data
 * @return array
 * @todo eradicate the false "id"=code field of the $_course array and use the int id
 */
function api_format_course_array($course_data)
{
    if (empty($course_data)) {
        return array();
    }
    $_course = array();
    $_course['id'] = $course_data['code'];
    $_course['real_id'] = $course_data['id'];
    // Added
    $_course['code'] = $course_data['code'];
    $_course['name'] = $course_data['title'];
    $_course['title'] = $course_data['title'];
    $_course['official_code'] = $course_data['visual_code'];
    $_course['visual_code'] = $course_data['visual_code'];
    $_course['sysCode'] = $course_data['code'];
    $_course['path'] = $course_data['directory'];
    // Use as key in path.
    $_course['directory'] = $course_data['directory'];
    $_course['creation_date'] = $course_data['creation_date'];
    $_course['titular'] = $course_data['tutor_name'];
    $_course['language'] = $course_data['course_language'];
    $_course['extLink']['url'] = $course_data['department_url'];
    $_course['extLink']['name'] = $course_data['department_name'];
    $_course['categoryCode'] = $course_data['faCode'];
    $_course['categoryName'] = $course_data['faName'];
    $_course['visibility'] = $course_data['visibility'];
    $_course['subscribe_allowed'] = $course_data['subscribe'];
    $_course['subscribe'] = $course_data['subscribe'];
    $_course['unsubscribe'] = $course_data['unsubscribe'];
    $_course['course_language'] = $course_data['course_language'];
    $_course['activate_legal'] = isset($course_data['activate_legal']) ? $course_data['activate_legal'] : false;
    $_course['legal'] = $course_data['legal'];
    $_course['show_score'] = $course_data['show_score'];
    //used in the work tool
    $_course['department_name'] = $course_data['department_name'];
    $_course['department_url'] = $course_data['department_url'];
    // Course password
    $_course['registration_code'] = !empty($course_data['registration_code']) ? sha1($course_data['registration_code']) : null;
    $_course['disk_quota'] = $course_data['disk_quota'];
    $_course['course_public_url'] = api_get_path(WEB_COURSE_PATH) . $course_data['directory'] . '/index.php';
    if (array_key_exists('add_teachers_to_sessions_courses', $course_data)) {
        $_course['add_teachers_to_sessions_courses'] = $course_data['add_teachers_to_sessions_courses'];
    }
    if (file_exists(api_get_path(SYS_COURSE_PATH) . $course_data['directory'] . '/course-pic85x85.png')) {
        $url_image = api_get_path(WEB_COURSE_PATH) . $course_data['directory'] . '/course-pic85x85.png';
    } else {
        $url_image = Display::return_icon('course.png', null, null, ICON_SIZE_BIG, null, true);
    }
    $_course['course_image'] = $url_image;
    if (file_exists(api_get_path(SYS_COURSE_PATH) . $course_data['directory'] . '/course-pic.png')) {
        $url_image = api_get_path(WEB_COURSE_PATH) . $course_data['directory'] . '/course-pic.png';
    } else {
        $url_image = Display::returnIconPath('session_default.png');
    }
    $_course['course_image_large'] = $url_image;
    $_course['extra_fields'] = isset($course_data['extra_fields']) ? $course_data['extra_fields'] : array();
    $_course['settings'] = isset($course_data['settings']) ? $course_data['settings'] : array();
    $_course['teacher_list'] = isset($course_data['teacher_list']) ? $course_data['teacher_list'] : array();
    $_course['teacher_list_formatted'] = isset($course_data['teacher_list_formatted']) ? $course_data['teacher_list_formatted'] : array();
    return $_course;
}
    /**
     * @param $form_name
     * @param null $action
     */
    public function __construct($form_name, $action = null)
    {
        parent::__construct($form_name, 'post', $action);
        $displayscore = ScoreDisplay::instance();
        $customdisplays = $displayscore->get_custom_score_display_settings();
        $nr_items = count($customdisplays) != '0' ? count($customdisplays) : '1';
        $this->setDefaults(array('scorecolpercent' => $displayscore->get_color_split_value()));
        $this->addElement('hidden', 'maxvalue', '100');
        $this->addElement('hidden', 'minvalue', '0');
        $counter = 1;
        //setting the default values
        if (is_array($customdisplays)) {
            foreach ($customdisplays as $customdisplay) {
                $this->setDefaults(array('endscore[' . $counter . ']' => $customdisplay['score'], 'displaytext[' . $counter . ']' => $customdisplay['display']));
                $counter++;
            }
        }
        $scorecol = array();
        //settings for the colored score
        $this->addElement('header', get_lang('ScoreEdit'));
        if ($displayscore->is_coloring_enabled()) {
            $this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
            $this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array('size' => 5, 'maxlength' => 5, 'input-size' => 2));
            if (api_get_setting('gradebook.teachers_can_change_score_settings') != 'true') {
                $this->freeze('scorecolpercent');
            }
            $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
            $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
            $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
        }
        //Settings for the scoring system
        if ($displayscore->is_custom()) {
            $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
            $this->addElement('static', null, null, get_lang('ScoreInfo'));
            $this->setDefaults(array('beginscore' => '0'));
            $this->addElement('text', 'beginscore', array(get_lang('Between'), null, '%'), array('size' => 5, 'maxlength' => 5, 'disabled' => 'disabled', 'input-size' => 2));
            for ($counter = 1; $counter <= 20; $counter++) {
                $renderer =& $this->defaultRenderer();
                $elementTemplateTwoLabel = '<div id=' . $counter . ' style="display: ' . ($counter <= $nr_items ? 'inline' : 'none') . ';">

				<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->

                <label class="control-label">{label}</label>
				<div class="form-group">
				<label class="col-sm-2 control-label">
                </label>

				<div class="col-sm-1">
				<!-- BEGIN error --><span class="form_error">{error}</span><br />
				<!-- END error -->&nbsp<b>' . get_lang('And') . '</b>
				</div>

				<div class="col-sm-2">
				{element}
				</div>

				<div class="col-sm-1">
				=
				</div>


				';
                $elementTemplateTwoLabel2 = '
				<div class="col-sm-2">
					<!-- BEGIN error --><span class="form_error">{error}</span>
					<!-- END error -->
					{element}
				</div>
				<div class="col-sm-1">
                    <a href="javascript:plusItem(' . ($counter + 1) . ')">
                    <img style="display: ' . ($counter >= $nr_items ? 'inline' : 'none') . ';" id="plus-' . ($counter + 1) . '" src="' . Display::returnIconPath('add.png') . '" alt="' . get_lang('Add') . '" title="' . get_lang('Add') . '"></a>
        			<a href="javascript:minItem(' . $counter . ')">
        			<img style="display: ' . ($counter >= $nr_items && $counter != 1 ? 'inline' : 'none') . ';" id="min-' . $counter . '" src="' . Display::returnIconPath('delete.png') . '" alt="' . get_lang('Delete') . '" title="' . get_lang('Delete') . '"></a>
				</div>
				</div>
				</div>';
                $scorebetw = array();
                $this->addElement('text', 'endscore[' . $counter . ']', null, array('size' => 5, 'maxlength' => 5, 'id' => 'txta-' . $counter, 'input-size' => 2));
                $this->addElement('text', 'displaytext[' . $counter . ']', null, array('size' => 40, 'maxlength' => 40, 'id' => 'txtb-' . $counter));
                $renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
                $renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
                $this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
                $this->addRule(array('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
                $this->addRule(array('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
            }
        }
        if ($displayscore->is_custom()) {
            $this->addButtonSave(get_lang('Ok'));
        }
    }
Exemplo n.º 6
0
  *
  *     visibility 1 -> 0 - $hide / $restore
  */
 /*
  * Diplay message to confirm that a tools must be hide from aivailable tools
  * (visibility 0,1->2)
  */
 if ($remove) {
     $sql = "SELECT * FROM {$TBL_ACCUEIL} WHERE c_id = {$course_id} AND id={$id}";
     $result = Database::query($sql);
     $tool = Database::fetch_array($result);
     $tool_name = @htmlspecialchars($tool['name'] != '' ? $tool['name'] : $tool['link'], ENT_QUOTES, api_get_system_encoding());
     if ($tool['img'] != 'external.gif') {
         $tool['link'] = api_get_path(WEB_CODE_PATH) . $tool['link'];
     }
     $tool['image'] = Display::returnIconPath($tool['image']);
     echo "<br /><br /><br />\n";
     echo "<table class=\"message\" width=\"70%\" align=\"center\">\n", "<tr><td width=\"7%\" align=\"center\">\n", "<a href=\"" . $tool['link'] . "\">" . Display::return_icon($tool['image'], get_lang('Delete')), "</a></td>\n", "<td width=\"28%\" height=\"45\"><small>\n", "<a href=\"" . $tool['link'] . "\">" . $tool_name . "</a></small></td>\n";
     echo "<td align=\"center\">\n", "<font color=\"#ff0000\">", "&nbsp;&nbsp;&nbsp;", "<strong>", get_lang('DelLk'), "</strong>", "<br />&nbsp;&nbsp;&nbsp;\n", "<a href=\"" . api_get_self() . "\">", get_lang('No'), "</a>\n", "&nbsp;|&nbsp;\n", "<a href=\"" . api_get_self() . "?destroy=yes&amp;id={$id}\">", get_lang('Yes'), "</a>\n", "</font></td></tr>\n", "</table>\n";
     echo "<br /><br /><br />\n";
 } elseif ($destroy) {
     Database::query("UPDATE {$TBL_ACCUEIL} SET visibility='2' WHERE c_id = {$course_id} AND id = {$id}");
 } elseif ($hide) {
     // visibility 1 -> 0
     Database::query("UPDATE {$TBL_ACCUEIL} SET visibility=0 WHERE c_id = {$course_id} AND id={$id}");
     $show_message .= Display::return_message(get_lang('ToolIsNowHidden'), 'confirmation');
 } elseif ($restore) {
     // visibility 0,2 -> 1
     Database::query("UPDATE {$TBL_ACCUEIL} SET visibility=1  WHERE c_id = {$course_id} AND id={$id}");
     $show_message .= Display::return_message(get_lang('ToolIsNowVisible'), 'confirmation');
 } elseif (isset($update) && $update) {
Exemplo n.º 7
0
 /**
  * @param int $user_id
  * @param array $courseInfo
  * @param int $session_id
  * @param string $origin
  * @param bool $export_csv
  * @param int $lp_id
  * @param int $lp_item_id
  * @param int $extendId
  * @param int $extendAttemptId
  * @param string $extendedAttempt
  * @param string $extendedAll
  * @param string $type classic or simple
  * @param boolean $allowExtend Optional. Allow or not extend te results
  * @return null|string
  */
 public static function getLpStats($user_id, $courseInfo, $session_id, $origin, $export_csv, $lp_id, $lp_item_id = null, $extendId = null, $extendAttemptId = null, $extendedAttempt = null, $extendedAll = null, $type = 'classic', $allowExtend = true)
 {
     if (empty($courseInfo) || empty($lp_id)) {
         return null;
     }
     $lp_id = intval($lp_id);
     $lp_item_id = intval($lp_item_id);
     $user_id = intval($user_id);
     $session_id = intval($session_id);
     $origin = Security::remove_XSS($origin);
     $list = learnpath::get_flat_ordered_items_list($lp_id, 0, $courseInfo['real_id']);
     $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
     $course_id = $courseInfo['real_id'];
     $courseCode = $courseInfo['code'];
     $session_condition = api_get_session_condition($session_id);
     // Extend all button
     $output = null;
     $extend_all = 0;
     if ($origin == 'tracking') {
         $url_suffix = '&session_id=' . $session_id . '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . $lp_id . '&origin=' . $origin;
     } else {
         $url_suffix = '&lp_id=' . $lp_id;
     }
     if (!empty($extendedAll)) {
         $extend_all_link = Display::url(Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), api_get_self() . '?action=stats' . $url_suffix);
         $extend_all = 1;
     } else {
         $extend_all_link = Display::url(Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttempts')), api_get_self() . '?action=stats&extend_all=1' . $url_suffix);
     }
     if ($origin != 'tracking') {
         $output .= '<div class="section-status">';
         $output .= Display::page_header(get_lang('ScormMystatus'));
         $output .= '</div>';
     }
     $actionColumn = null;
     if ($type == 'classic') {
         $actionColumn = ' <th>' . get_lang('Actions') . '</th>';
     }
     $output .= '<div class="table-responsive">';
     $output .= '<table class="table tracking">
         <thead>
         <tr class="table-header">
             <th width="16">' . ($allowExtend == true ? $extend_all_link : '&nbsp;') . '</th>
             <th colspan="4">
                 ' . get_lang('ScormLessonTitle') . '
             </th>
             <th colspan="2">
                 ' . get_lang('ScormStatus') . '
             </th>
             <th colspan="2">
                 ' . get_lang('ScormScore') . '
             </th>
             <th colspan="2">
                 ' . get_lang('ScormTime') . '
             </th>
             ' . $actionColumn . '
             </tr>
         </thead>
         <tbody>
     ';
     // Going through the items using the $items[] array instead of the database order ensures
     // we get them in the same order as in the imsmanifest file, which is rather random when using
     // the database table.
     $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
     $TBL_LP_ITEM_VIEW = Database::get_course_table(TABLE_LP_ITEM_VIEW);
     $TBL_LP_VIEW = Database::get_course_table(TABLE_LP_VIEW);
     $tbl_quiz_questions = Database::get_course_table(TABLE_QUIZ_QUESTION);
     $TBL_QUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
     $tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
     $tbl_stats_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
     $sql = "SELECT max(view_count)\n                FROM {$TBL_LP_VIEW}\n                WHERE\n                    c_id = {$course_id} AND\n                    lp_id = {$lp_id} AND\n                    user_id = {$user_id}\n                    {$session_condition}";
     $res = Database::query($sql);
     $view = '';
     if (Database::num_rows($res) > 0) {
         $myrow = Database::fetch_array($res);
         $view = $myrow[0];
     }
     $counter = 0;
     $total_time = 0;
     $h = get_lang('h');
     if (!empty($export_csv)) {
         $csv_content[] = array(get_lang('ScormLessonTitle'), get_lang('ScormStatus'), get_lang('ScormScore'), get_lang('ScormTime'));
     }
     $result_disabled_ext_all = true;
     $chapterTypes = learnpath::getChapterTypes();
     // Show lp items
     if (is_array($list) && count($list) > 0) {
         foreach ($list as $my_item_id) {
             $extend_this = 0;
             $order = 'DESC';
             if (!empty($extendId) && $extendId == $my_item_id || $extend_all) {
                 $extend_this = 1;
                 $order = 'ASC';
             }
             // Prepare statement to go through each attempt.
             $viewCondition = null;
             if (!empty($view)) {
                 $viewCondition = " AND v.view_count = {$view}  ";
             }
             $sql = "SELECT\n                    iv.status as mystatus,\n                    v.view_count as mycount,\n                    iv.score as myscore,\n                    iv.total_time as mytime,\n                    i.id as myid,\n                    i.lp_id as mylpid,\n                    iv.lp_view_id as mylpviewid,\n                    i.title as mytitle,\n                    i.max_score as mymaxscore,\n                    iv.max_score as myviewmaxscore,\n                    i.item_type as item_type,\n                    iv.view_count as iv_view_count,\n                    iv.id as iv_id,\n                    path\n                FROM {$TBL_LP_ITEM} as i\n                INNER JOIN {$TBL_LP_ITEM_VIEW} as iv\n                ON (i.id = iv.lp_item_id AND i.c_id = iv.c_id)\n                INNER JOIN {$TBL_LP_VIEW} as v\n                ON (iv.lp_view_id = v.id AND v.c_id = iv.c_id)\n                WHERE\n                    v.c_id = {$course_id} AND\n                    i.id = {$my_item_id} AND\n                    i.lp_id = {$lp_id}  AND\n                    v.user_id = {$user_id} AND\n                    v.session_id = {$session_id}\n                    {$viewCondition}\n                ORDER BY iv.view_count {$order} ";
             $result = Database::query($sql);
             $num = Database::num_rows($result);
             $time_for_total = 'NaN';
             // Extend all
             if (($extend_this || $extend_all) && $num > 0) {
                 $row = Database::fetch_array($result);
                 $result_disabled_ext_all = false;
                 if ($row['item_type'] == 'quiz') {
                     // Check results_disabled in quiz table.
                     $my_path = Database::escape_string($row['path']);
                     $sql = "SELECT results_disabled\n                                FROM {$TBL_QUIZ}\n                                WHERE\n                                    c_id = {$course_id} AND\n                                    id ='" . $my_path . "'";
                     $res_result_disabled = Database::query($sql);
                     $row_result_disabled = Database::fetch_row($res_result_disabled);
                     if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) {
                         $result_disabled_ext_all = true;
                     }
                 }
                 // If there are several attempts, and the link to extend has been clicked, show each attempt...
                 if ($counter % 2 == 0) {
                     $oddclass = 'row_odd';
                 } else {
                     $oddclass = 'row_even';
                 }
                 $extend_link = '';
                 if (!empty($inter_num)) {
                     $extend_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&fold_id=' . $my_item_id . $url_suffix);
                 }
                 $title = $row['mytitle'];
                 if (empty($title)) {
                     $title = learnpath::rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
                 }
                 if (in_array($row['item_type'], $chapterTypes)) {
                     $title = "<h4> {$title} </h4>";
                 }
                 $lesson_status = $row['mystatus'];
                 $title = Security::remove_XSS($title);
                 $counter++;
                 $action = null;
                 if ($type == 'classic') {
                     $action = '<td></td>';
                 }
                 if (in_array($row['item_type'], $chapterTypes)) {
                     $output .= '<tr class="' . $oddclass . '">
                             <td>' . $extend_link . '</td>
                             <td colspan="4">
                                ' . $title . '
                             </td>
                             <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
                             <td colspan="2"></td>
                             <td colspan="2"></td>
                             ' . $action . '
                         </tr>';
                     continue;
                 } else {
                     $output .= '<tr class="' . $oddclass . '">
                             <td>' . $extend_link . '</td>
                             <td colspan="4">
                                ' . $title . '
                             </td>
                             <td colspan="2"></td>
                             <td colspan="2"></td>
                             <td colspan="2"></td>
                             ' . $action . '
                         </tr>';
                 }
                 $attemptCount = 1;
                 do {
                     // Check if there are interactions below.
                     $extend_attempt_link = '';
                     $extend_this_attempt = 0;
                     if ((learnpath::get_interactions_count_from_db($row['iv_id'], $course_id) > 0 || learnpath::get_objectives_count_from_db($row['iv_id'], $course_id) > 0) && !$extend_all) {
                         if ($extendAttemptId == $row['iv_id']) {
                             // The extend button for this attempt has been clicked.
                             $extend_this_attempt = 1;
                             $extend_attempt_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix);
                         } else {
                             // Same case if fold_attempt_id is set, so not implemented explicitly.
                             // The extend button for this attempt has not been clicked.
                             $extend_attempt_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix);
                         }
                     }
                     if ($counter % 2 == 0) {
                         $oddclass = 'row_odd';
                     } else {
                         $oddclass = 'row_even';
                     }
                     $lesson_status = $row['mystatus'];
                     $score = $row['myscore'];
                     $time_for_total = $row['mytime'];
                     $time = learnpathItem::getScormTimeFromParameter('js', $row['mytime']);
                     if ($score == 0) {
                         $maxscore = $row['mymaxscore'];
                     } else {
                         if ($row['item_type'] == 'sco') {
                             if (!empty($row['myviewmaxscore']) && $row['myviewmaxscore'] > 0) {
                                 $maxscore = $row['myviewmaxscore'];
                             } elseif ($row['myviewmaxscore'] === '') {
                                 $maxscore = 0;
                             } else {
                                 $maxscore = $row['mymaxscore'];
                             }
                         } else {
                             $maxscore = $row['mymaxscore'];
                         }
                     }
                     // Remove "NaN" if any (@todo: locate the source of these NaN)
                     $time = str_replace('NaN', '00' . $h . '00\'00"', $time);
                     if ($row['item_type'] != 'dokeos_chapter') {
                         if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                             $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
                         } else {
                             switch ($row['item_type']) {
                                 case 'sco':
                                     if ($maxscore == 0) {
                                         $view_score = $score;
                                     } else {
                                         $view_score = ExerciseLib::show_score($score, $maxscore, false);
                                     }
                                     break;
                                 case 'document':
                                     $view_score = $score == 0 ? '/' : ExerciseLib::show_score($score, $maxscore, false);
                                     break;
                                 default:
                                     $view_score = ExerciseLib::show_score($score, $maxscore, false);
                                     break;
                             }
                         }
                         $action = null;
                         if ($type == 'classic') {
                             $action = '<td></td>';
                         }
                         $output .= '<tr class="' . $oddclass . '">
                                 <td></td>
                                 <td>' . $extend_attempt_link . '</td>
                                 <td colspan="3">' . get_lang('Attempt') . ' ' . $attemptCount . '</td>
                                 <td colspan="2">' . learnpathItem::humanize_status($lesson_status, true, $type) . '</td>
                                 <td colspan="2">' . $view_score . '</td>
                                 <td colspan="2">' . $time . '</td>
                                 ' . $action . '
                             </tr>';
                         $attemptCount++;
                         if (!empty($export_csv)) {
                             $temp = array();
                             $temp[] = $title = Security::remove_XSS($title);
                             $temp[] = Security::remove_XSS(learnpathItem::humanize_status($lesson_status, false, $type));
                             if ($row['item_type'] == 'quiz') {
                                 if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                     $temp[] = '/';
                                 } else {
                                     $temp[] = $score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1));
                                 }
                             } else {
                                 $temp[] = $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1));
                             }
                             $temp[] = $time;
                             $csv_content[] = $temp;
                         }
                     }
                     $counter++;
                     $action = null;
                     if ($type == 'classic') {
                         $action = '<td></td>';
                     }
                     if ($extend_this_attempt || $extend_all) {
                         $list1 = learnpath::get_iv_interactions_array($row['iv_id']);
                         foreach ($list1 as $id => $interaction) {
                             if ($counter % 2 == 0) {
                                 $oddclass = 'row_odd';
                             } else {
                                 $oddclass = 'row_even';
                             }
                             $student_response = urldecode($interaction['student_response']);
                             $content_student_response = explode('__|', $student_response);
                             if (count($content_student_response) > 0) {
                                 if (count($content_student_response) >= 3) {
                                     // Pop the element off the end of array.
                                     array_pop($content_student_response);
                                 }
                                 $student_response = implode(',', $content_student_response);
                             }
                             $output .= '<tr class="' . $oddclass . '">
                                     <td></td>
                                     <td></td>
                                     <td></td>
                                     <td>' . $interaction['order_id'] . '</td>
                                     <td>' . $interaction['id'] . '</td>
                                     <td colspan="2">' . $interaction['type'] . '</td>
                                     <td>' . $student_response . '</td>
                                     <td>' . $interaction['result'] . '</td>
                                     <td>' . $interaction['latency'] . '</td>
                                     <td>' . $interaction['time'] . '</td>
                                     ' . $action . '
                                 </tr>';
                             $counter++;
                         }
                         $list2 = learnpath::get_iv_objectives_array($row['iv_id']);
                         foreach ($list2 as $id => $interaction) {
                             if ($counter % 2 == 0) {
                                 $oddclass = 'row_odd';
                             } else {
                                 $oddclass = 'row_even';
                             }
                             $output .= '<tr class="' . $oddclass . '">
                                     <td></td>
                                     <td></td>
                                     <td></td>
                                     <td>' . $interaction['order_id'] . '</td>
                                     <td colspan="2">' . $interaction['objective_id'] . '</td>
                                     <td colspan="2">' . $interaction['status'] . '</td>
                                     <td>' . $interaction['score_raw'] . '</td>
                                     <td>' . $interaction['score_max'] . '</td>
                                     <td>' . $interaction['score_min'] . '</td>
                                     ' . $action . '
                                  </tr>';
                             $counter++;
                         }
                     }
                 } while ($row = Database::fetch_array($result));
             } elseif ($num > 0) {
                 // Not extended.
                 $row = Database::fetch_array($result, 'ASSOC');
                 $my_id = $row['myid'];
                 $my_lp_id = $row['mylpid'];
                 $my_lp_view_id = $row['mylpviewid'];
                 $my_path = $row['path'];
                 $result_disabled_ext_all = false;
                 if ($row['item_type'] == 'quiz') {
                     // Check results_disabled in quiz table.
                     $my_path = Database::escape_string($my_path);
                     $sql = "SELECT results_disabled\n                                FROM {$TBL_QUIZ}\n                                WHERE c_id = {$course_id} AND id ='" . $my_path . "'";
                     $res_result_disabled = Database::query($sql);
                     $row_result_disabled = Database::fetch_row($res_result_disabled);
                     if (Database::num_rows($res_result_disabled) > 0 && (int) $row_result_disabled[0] === 1) {
                         $result_disabled_ext_all = true;
                     }
                 }
                 // Check if there are interactions below
                 $extend_this_attempt = 0;
                 $inter_num = learnpath::get_interactions_count_from_db($row['iv_id'], $course_id);
                 $objec_num = learnpath::get_objectives_count_from_db($row['iv_id'], $course_id);
                 $extend_attempt_link = '';
                 if ($inter_num > 0 || $objec_num > 0) {
                     if (!empty($extendAttemptId) && $extendAttemptId == $row['iv_id']) {
                         // The extend button for this attempt has been clicked.
                         $extend_this_attempt = 1;
                         $extend_attempt_link = Display::url(Display::return_icon('visible.gif', get_lang('HideAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&fold_attempt_id=' . $row['iv_id'] . $url_suffix);
                     } else {
                         // Same case if fold_attempt_id is set, so not implemented explicitly.
                         // The extend button for this attempt has not been clicked.
                         $extend_attempt_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix);
                     }
                 }
                 if ($counter % 2 == 0) {
                     $oddclass = 'row_odd';
                 } else {
                     $oddclass = 'row_even';
                 }
                 $extend_link = '';
                 if ($inter_num > 1) {
                     $extend_link = Display::url(Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')), api_get_self() . '?action=stats&extend_id=' . $my_item_id . '&extend_attempt_id=' . $row['iv_id'] . $url_suffix);
                 }
                 $lesson_status = $row['mystatus'];
                 $score = $row['myscore'];
                 $subtotal_time = $row['mytime'];
                 while ($tmp_row = Database::fetch_array($result)) {
                     $subtotal_time += $tmp_row['mytime'];
                 }
                 $title = $row['mytitle'];
                 // Selecting the exe_id from stats attempts tables in order to look the max score value.
                 $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
                          WHERE
                             exe_exo_id="' . $row['path'] . '" AND
                             exe_user_id="' . $user_id . '" AND
                             orig_lp_id = "' . $lp_id . '" AND
                             orig_lp_item_id = "' . $row['myid'] . '" AND
                             c_id = ' . $course_id . ' AND
                             status <> "incomplete" AND
                             session_id = ' . $session_id . '
                          ORDER BY exe_date DESC
                          LIMIT 1';
                 $resultLastAttempt = Database::query($sql);
                 $num = Database::num_rows($resultLastAttempt);
                 $id_last_attempt = null;
                 if ($num > 0) {
                     while ($rowLA = Database::fetch_array($resultLastAttempt)) {
                         $id_last_attempt = $rowLA['exe_id'];
                     }
                 }
                 if ($score == 0) {
                     $maxscore = $row['mymaxscore'];
                 } else {
                     if ($row['item_type'] == 'sco') {
                         if (!empty($row['myviewmaxscore']) and $row['myviewmaxscore'] > 0) {
                             $maxscore = $row['myviewmaxscore'];
                         } elseif ($row['myviewmaxscore'] === '') {
                             $maxscore = 0;
                         } else {
                             $maxscore = $row['mymaxscore'];
                         }
                     } else {
                         if ($row['item_type'] == 'quiz') {
                             // Get score and total time from last attempt of a exercise en lp.
                             $sql = "SELECT score\n                                        FROM {$TBL_LP_ITEM_VIEW}\n                                        WHERE\n                                            c_id = {$course_id} AND\n                                            lp_item_id = '" . (int) $my_id . "' AND\n                                            lp_view_id = '" . (int) $my_lp_view_id . "'\n                                        ORDER BY view_count DESC limit 1";
                             $res_score = Database::query($sql);
                             $row_score = Database::fetch_array($res_score);
                             $sql = "SELECT SUM(total_time) as total_time\n                                        FROM {$TBL_LP_ITEM_VIEW}\n                                        WHERE\n                                            c_id = {$course_id} AND\n                                            lp_item_id = '" . (int) $my_id . "' AND\n                                            lp_view_id = '" . (int) $my_lp_view_id . "'";
                             $res_time = Database::query($sql);
                             $row_time = Database::fetch_array($res_time);
                             if (Database::num_rows($res_score) > 0 && Database::num_rows($res_time) > 0) {
                                 $score = (double) $row_score['score'];
                                 $subtotal_time = (int) $row_time['total_time'];
                             } else {
                                 $score = 0;
                                 $subtotal_time = 0;
                             }
                             // Selecting the max score from an attempt.
                             $sql = "SELECT SUM(t.ponderation) as maxscore\n                                        FROM (\n                                            SELECT DISTINCT\n                                                question_id, marks, ponderation\n                                            FROM {$tbl_stats_attempts} as at\n                                            INNER JOIN  {$tbl_quiz_questions} as q\n                                            ON (q.id = at.question_id AND q.c_id = {$course_id})\n                                            WHERE exe_id ='{$id_last_attempt}'\n                                        ) as t";
                             $result = Database::query($sql);
                             $row_max_score = Database::fetch_array($result);
                             $maxscore = $row_max_score['maxscore'];
                         } else {
                             $maxscore = $row['mymaxscore'];
                         }
                     }
                 }
                 $time_for_total = $subtotal_time;
                 $time = learnpathItem::getScormTimeFromParameter('js', $subtotal_time);
                 if (empty($title)) {
                     $title = learnpath::rl_get_resource_name($courseInfo['code'], $lp_id, $row['myid']);
                 }
                 $action = null;
                 if ($type == 'classic') {
                     $action = '<td></td>';
                 }
                 if (in_array($row['item_type'], $chapterTypes)) {
                     $title = Security::remove_XSS($title);
                     $output .= '<tr class="' . $oddclass . '">
                             <td>' . $extend_link . '</td>
                             <td colspan="4">
                             <h4>' . $title . '</h4>
                             </td>
                             <td colspan="2">' . learnpathitem::humanize_status($lesson_status) . '</td>
                             <td colspan="2"></td>
                             <td colspan="2"></td>
                             ' . $action . '
                         </tr>';
                 } else {
                     $correct_test_link = '-';
                     if ($row['item_type'] == 'quiz') {
                         $my_url_suffix = '&course=' . $courseCode . '&student_id=' . $user_id . '&lp_id=' . intval($row['mylpid']) . '&origin=' . $origin;
                         $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
                                  WHERE
                                     exe_exo_id="' . $row['path'] . '" AND
                                     exe_user_id="' . $user_id . '" AND
                                     orig_lp_id = "' . $lp_id . '" AND
                                     orig_lp_item_id = "' . $row['myid'] . '" AND
                                     c_id = ' . $course_id . ' AND
                                     status <> "incomplete" AND
                                     session_id = ' . $session_id . '
                                  ORDER BY exe_date DESC ';
                         $resultLastAttempt = Database::query($sql);
                         $num = Database::num_rows($resultLastAttempt);
                         if ($num > 0) {
                             if ($extendedAttempt == 1 && $lp_id == $my_lp_id && $lp_item_id == $my_id) {
                                 $correct_test_link = Display::url(Display::return_icon('view_less_stats.gif', get_lang('HideAllAttempts')), api_get_self() . '?action=stats' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id);
                             } else {
                                 $correct_test_link = Display::url(Display::return_icon('view_more_stats.gif', get_lang('ShowAllAttemptsByExercise')), api_get_self() . '?action=stats&extend_attempt=1' . $my_url_suffix . '&session_id=' . $session_id . '&lp_item_id=' . $my_id);
                             }
                         }
                     }
                     $title = Security::remove_XSS($title);
                     $action = null;
                     if ($type == 'classic') {
                         $action = '<td>' . $correct_test_link . '</td>';
                     }
                     if ($lp_id == $my_lp_id && false) {
                         $output .= '<tr class =' . $oddclass . '>
                                 <td>' . $extend_link . '</td>
                                 <td colspan="4">' . $title . '</td>
                                 <td colspan="2">&nbsp;</td>
                                 <td colspan="2">&nbsp;</td>
                                 <td colspan="2">&nbsp;</td>
                                 ' . $action . '
                             </tr>';
                         $output .= '</tr>';
                     } else {
                         if ($lp_id == $my_lp_id && $lp_item_id == $my_id) {
                             $output .= "<tr class='{$oddclass}'>";
                         } else {
                             $output .= "<tr class='{$oddclass}'>";
                         }
                         $scoreItem = null;
                         if ($row['item_type'] == 'quiz') {
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                 $scoreItem .= Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
                             } else {
                                 $scoreItem .= ExerciseLib::show_score($score, $maxscore, false);
                             }
                         } else {
                             $scoreItem .= $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . $maxscore);
                         }
                         $output .= '
                             <td>' . $extend_link . '</td>
                             <td colspan="4">' . $title . '</td>
                             <td colspan="2">' . learnpathitem::humanize_status($lesson_status) . '</td>
                             <td colspan="2">' . $scoreItem . '</td>
                             <td colspan="2">' . $time . '</td>
                             ' . $action . '
                          ';
                         $output .= '</tr>';
                     }
                     if (!empty($export_csv)) {
                         $temp = array();
                         $temp[] = api_html_entity_decode($title, ENT_QUOTES);
                         $temp[] = api_html_entity_decode($lesson_status, ENT_QUOTES);
                         if ($row['item_type'] == 'quiz') {
                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                 $temp[] = '/';
                             } else {
                                 $temp[] = $score == 0 ? '0/' . $maxscore : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1));
                             }
                         } else {
                             $temp[] = $score == 0 ? '/' : ($maxscore == 0 ? $score : $score . '/' . float_format($maxscore, 1));
                         }
                         $temp[] = $time;
                         $csv_content[] = $temp;
                     }
                 }
                 $counter++;
                 $action = null;
                 if ($type == 'classic') {
                     $action = '<td></td>';
                 }
                 if ($extend_this_attempt || $extend_all) {
                     $list1 = learnpath::get_iv_interactions_array($row['iv_id']);
                     foreach ($list1 as $id => $interaction) {
                         if ($counter % 2 == 0) {
                             $oddclass = 'row_odd';
                         } else {
                             $oddclass = 'row_even';
                         }
                         $output .= '<tr class="' . $oddclass . '">
                                 <td></td>
                                 <td></td>
                                 <td></td>
                                 <td>' . $interaction['order_id'] . '</td>
                                 <td>' . $interaction['id'] . '</td>
                                 <td colspan="2">' . $interaction['type'] . '</td>
                                 <td>' . urldecode($interaction['student_response']) . '</td>
                                 <td>' . $interaction['result'] . '</td>
                                 <td>' . $interaction['latency'] . '</td>
                                 <td>' . $interaction['time'] . '</td>
                                 ' . $action . '
                            </tr>';
                         $counter++;
                     }
                     $list2 = learnpath::get_iv_objectives_array($row['iv_id']);
                     foreach ($list2 as $id => $interaction) {
                         if ($counter % 2 == 0) {
                             $oddclass = 'row_odd';
                         } else {
                             $oddclass = 'row_even';
                         }
                         $output .= '<tr class="' . $oddclass . '">
                                 <td></td>
                                 <td></td>
                                 <td></td>
                                 <td>' . $interaction['order_id'] . '</td>
                                 <td colspan="2">' . $interaction['objective_id'] . '</td>
                                 <td colspan="2">' . $interaction['status'] . '</td>
                                 <td>' . $interaction['score_raw'] . '</td>
                                 <td>' . $interaction['score_max'] . '</td>
                                 <td>' . $interaction['score_min'] . '</td>
                                 ' . $action . '
                            </tr>';
                         $counter++;
                     }
                 }
                 // Attempts listing by exercise.
                 if ($lp_id == $my_lp_id && $lp_item_id == $my_id && $extendedAttempt) {
                     // Get attempts of a exercise.
                     if (!empty($lp_id) && !empty($lp_item_id) && $row['item_type'] === 'quiz') {
                         $sql = "SELECT path FROM {$TBL_LP_ITEM}\n                                    WHERE\n                                        c_id = {$course_id} AND\n                                        id = '{$lp_item_id}' AND\n                                        lp_id = '{$lp_id}'";
                         $res_path = Database::query($sql);
                         $row_path = Database::fetch_array($res_path);
                         if (Database::num_rows($res_path) > 0) {
                             $sql = 'SELECT * FROM ' . $tbl_stats_exercices . '
                                     WHERE
                                         exe_exo_id="' . (int) $row_path['path'] . '" AND
                                         status <> "incomplete" AND
                                         exe_user_id="' . $user_id . '" AND
                                         orig_lp_id = "' . (int) $lp_id . '" AND
                                         orig_lp_item_id = "' . (int) $lp_item_id . '" AND
                                         c_id = ' . $course_id . '  AND
                                         session_id = ' . $session_id . '
                                     ORDER BY exe_date';
                             $res_attempts = Database::query($sql);
                             $num_attempts = Database::num_rows($res_attempts);
                             if ($num_attempts > 0) {
                                 $n = 1;
                                 while ($row_attempts = Database::fetch_array($res_attempts)) {
                                     $my_score = $row_attempts['exe_result'];
                                     $my_maxscore = $row_attempts['exe_weighting'];
                                     $my_exe_id = $row_attempts['exe_id'];
                                     $my_orig_lp = $row_attempts['orig_lp_id'];
                                     $my_orig_lp_item = $row_attempts['orig_lp_item_id'];
                                     $my_exo_exe_id = $row_attempts['exe_exo_id'];
                                     $mktime_start_date = api_strtotime($row_attempts['start_date'], 'UTC');
                                     $mktime_exe_date = api_strtotime($row_attempts['exe_date'], 'UTC');
                                     if ($mktime_start_date && $mktime_exe_date) {
                                         $mytime = (int) $mktime_exe_date - (int) $mktime_start_date;
                                         $time_attemp = learnpathItem::getScormTimeFromParameter('js', $mytime);
                                         $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
                                     } else {
                                         $time_attemp = ' - ';
                                     }
                                     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                         $view_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
                                     } else {
                                         // Show only float when need it
                                         if ($my_score == 0) {
                                             $view_score = ExerciseLib::show_score(0, $my_maxscore, false);
                                         } else {
                                             if ($my_maxscore == 0) {
                                                 $view_score = $my_score;
                                             } else {
                                                 $view_score = ExerciseLib::show_score($my_score, $my_maxscore, false);
                                             }
                                         }
                                     }
                                     $my_lesson_status = $row_attempts['status'];
                                     if ($my_lesson_status == '') {
                                         $my_lesson_status = learnpathitem::humanize_status('completed');
                                     } elseif ($my_lesson_status == 'incomplete') {
                                         $my_lesson_status = learnpathitem::humanize_status('incomplete');
                                     }
                                     $output .= '<tr class="' . $oddclass . '" >
                                     <td></td>
                                     <td>' . $extend_attempt_link . '</td>
                                     <td colspan="3">' . get_lang('Attempt') . ' ' . $n . '</td>
                                     <td colspan="2">' . $my_lesson_status . '</td>
                                     <td colspan="2">' . $view_score . '</td>
                                     <td colspan="2">' . $time_attemp . '</td>';
                                     if ($action == 'classic') {
                                         if ($origin != 'tracking') {
                                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                                 $output .= '<td>
                                                         <img src="' . Display::returnIconPath('quiz_na.gif') . '" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
                                                         </td>';
                                             } else {
                                                 $output .= '<td>
                                                         <a href="../exercice/exercise_show.php?origin=' . $origin . '&id=' . $my_exe_id . '&cidReq=' . $courseCode . '" target="_parent">
                                                         <img src="' . Display::returnIconPath('quiz.gif') . '" alt="' . get_lang('ShowAttempt') . '" title="' . get_lang('ShowAttempt') . '">
                                                         </a></td>';
                                             }
                                         } else {
                                             if (!$is_allowed_to_edit && $result_disabled_ext_all) {
                                                 $output .= '<td>
                                                             <img src="' . Display::returnIconPath('quiz_na.gif') . '" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></td>';
                                             } else {
                                                 $output .= '<td>
                                                                 <a href="../exercice/exercise_show.php?cidReq=' . $courseCode . '&origin=correct_exercise_in_lp&id=' . $my_exe_id . '" target="_parent">
                                                                 <img src="' . Display::returnIconPath('quiz.gif') . '" alt="' . get_lang('ShowAndQualifyAttempt') . '" title="' . get_lang('ShowAndQualifyAttempt') . '"></a></td>';
                                             }
                                         }
                                     }
                                     $output .= '</tr>';
                                     $n++;
                                 }
                             }
                             $output .= '<tr><td colspan="12">&nbsp;</td></tr>';
                         }
                     }
                 }
             }
             $total_time += $time_for_total;
             // QUIZZ IN LP
             $a_my_id = array();
             if (!empty($my_lp_id)) {
                 $a_my_id[] = $my_lp_id;
             }
         }
     }
     // NOT Extend all "left green cross"
     if (!empty($a_my_id)) {
         if ($extendedAttempt) {
             // "Right green cross" extended
             $total_score = self::get_avg_student_score($user_id, $course_id, $a_my_id, $session_id, false, false);
         } else {
             // "Left green cross" extended
             $total_score = self::get_avg_student_score($user_id, $course_id, $a_my_id, $session_id, false, true);
         }
     } else {
         // Extend all "left green cross"
         $total_score = self::get_avg_student_score($user_id, $course_id, array($lp_id), $session_id, false, false);
     }
     $total_time = learnpathItem::getScormTimeFromParameter('js', $total_time);
     $total_time = str_replace('NaN', '00' . $h . '00\'00"', $total_time);
     if (!$is_allowed_to_edit && $result_disabled_ext_all) {
         $final_score = Display::return_icon('invisible.gif', get_lang('ResultsHiddenByExerciseSetting'));
     } else {
         if (is_numeric($total_score)) {
             $final_score = $total_score . '%';
         } else {
             $final_score = $total_score;
         }
     }
     $progress = learnpath::getProgress($lp_id, $user_id, $course_id, $session_id);
     if ($counter % 2 == 0) {
         $oddclass = 'row_odd';
     } else {
         $oddclass = 'row_even';
     }
     $action = null;
     if ($type == 'classic') {
         $action = '<td></td>';
     }
     $output .= '<tr class="' . $oddclass . '">
             <td></td>
             <td colspan="4">
                 <i>' . get_lang('AccomplishedStepsTotal') . '</i>
             </td>
             <td colspan="2">' . $progress . '%</td>
             <td colspan="2">
                 ' . $final_score . '
             </td>
             <td colspan="2">' . $total_time . '</div>
             ' . $action . '
        </tr>';
     $output .= '
                 </tbody>
             </table>
         </div>
     ';
     if (!empty($export_csv)) {
         $temp = array('', '', '', '');
         $csv_content[] = $temp;
         $temp = array(get_lang('AccomplishedStepsTotal'), '', $final_score, $total_time);
         $csv_content[] = $temp;
         ob_end_clean();
         Export::arrayToCsv($csv_content, 'reporting_learning_path_details');
         exit;
     }
     return $output;
 }
Exemplo n.º 8
0
	// Multiple filepaths for image form
	var filepaths = document.getElementById("filepaths");
	if (document.getElementById("filepath_"+counter_image)) {
		counter_image = counter_image + 1;
	}  else {
		counter_image = counter_image;
	}
	var elem1 = document.createElement("div");
	elem1.setAttribute("id","filepath_"+counter_image);
	filepaths.appendChild(elem1);
	id_elem1 = "filepath_"+counter_image;
	id_elem1 = "\'"+id_elem1+"\'";
	document.getElementById("filepath_"+counter_image).innerHTML = "\\n\\
        <input type=\\"file\\" name=\\"attach_"+counter_image+"\\"  size=\\"20\\" />\\n\\
        <a href=\\"javascript:remove_image_form("+id_elem1+")\\">\\n\\
            <img src=\\"' . Display::returnIconPath('delete.gif') . '\\">\\n\\
        </a>\\n\\
    ";

	if (filepaths.childNodes.length == 3) {
		var link_attach = document.getElementById("link-more-attach");
		if (link_attach) {
			link_attach.innerHTML="";
		}
	}
}

function validate_text_empty (str,msg) {
	var str = str.replace(/^\\s*|\\s*$/g,"");
	if (str.length == 0) {
		alert(msg);
Exemplo n.º 9
0
    /**
     * Get tickets by userId
     * @param $from
     * @param $number_of_items
     * @param $column
     * @param $direction
     * @param null $user_id
     * @return array
     */
    public static function get_tickets_by_user_id($from, $number_of_items, $column, $direction, $user_id = null)
    {
        global $plugin;
        $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);
        $table_main_admin = Database::get_main_table(TABLE_MAIN_ADMIN);
        if (is_null($direction)) {
            $direction = "DESC";
        }
        if (is_null($user_id) || $user_id == 0) {
            $user_id = api_get_user_id();
        }
        $isAdmin = UserManager::is_admin($user_id);
        $sql = "SELECT ticket.*,\n                ticket.ticket_id AS col0,\n                ticket.start_date AS col1,\n                ticket.sys_lastedit_datetime AS col2,\n                cat.name AS col3,\n                user.username AS col4,\n                priority.priority AS col5,\n                priority.priority  AS col6,\n                status.name AS col7,\n                ticket.total_messages AS col8,\n                msg.message AS col9,\n                ticket.request_user AS user_id,\n                ticket.assigned_last_user AS responsible\n            FROM {$table_support_tickets} ticket,\n                {$table_support_category} cat,\n                {$table_support_priority} priority,\n                {$table_support_status} status,\n                {$table_main_user} user,\n                {$table_support_messages} msg\n            WHERE\n                cat.category_id = ticket.category_id\n                AND ticket.priority_id = priority.priority_id\n                AND ticket.status_id = status.status_id\n                AND user.user_id = ticket.request_user\n                AND ticket.ticket_id= msg.ticket_id\n                AND message_id=1 ";
        if (!$isAdmin) {
            $sql .= " AND request_user = '******' ";
        }
        $keyword_unread = '';
        if (isset($_GET['keyword_unread'])) {
            $keyword_unread = Database::escape_string(trim($_GET['keyword_unread']));
        }
        //Search simple
        if (isset($_GET['submit_simple'])) {
            if ($_GET['keyword'] != '') {
                $keyword = Database::escape_string(trim($_GET['keyword']));
                $sql .= " AND (ticket.ticket_code = '{$keyword}'\n                            OR ticket.ticket_id = '{$keyword}'\n                            OR user.firstname LIKE '%{$keyword}%'\n                            OR user.lastname LIKE '%{$keyword}%'\n                            OR concat(user.firstname,' ',user.lastname) LIKE '%{$keyword}%'\n                            OR concat(user.lastname,' ',user.firstname) LIKE '%{$keyword}%'\n                            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_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 = '******'\n                          OR user.firstname LIKE '%{$keyword_request_user}%'\n                          OR user.official_code LIKE '%{$keyword_request_user}%'\n                          OR user.lastname LIKE '%{$keyword_request_user}%'\n                          OR concat(user.firstname,' ',user.lastname) LIKE '%{$keyword_request_user}%'\n                          OR concat(user.lastname,' ',user.firstname) LIKE '%{$keyword_request_user}%'\n                          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}'\n                          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}\n                         WHERE (title LIKE '%{$keyword_course}%'\n                        OR code LIKE '%{$keyword_course}%'\n                        OR visual_code LIKE '%{$keyword_course}%'\n                    )\n                )";
            }
        }
        if ($keyword_unread == 'yes') {
            $sql .= " AND ticket.ticket_id IN (SELECT ticket.ticket_id\n                FROM {$table_support_tickets} ticket,\n                    {$table_support_messages} message,\n                    {$table_main_user} user\n                WHERE ticket.ticket_id = message.ticket_id\n                    AND message.status = 'NOL'\n                    AND message.sys_insert_user_id = user.user_id\n                    AND user.user_id NOT IN (SELECT user_id FROM {$table_main_admin})\n                    AND ticket.status_id != 'REE'\n                GROUP BY ticket.ticket_id)";
        } else {
            if ($keyword_unread == 'no') {
                $sql .= " AND ticket.ticket_id NOT IN (SELECT ticket.ticket_id\n                    FROM {$table_support_tickets} ticket,\n                        {$table_support_messages} message,\n                        {$table_main_user} user\n                    WHERE ticket.ticket_id = message.ticket_id\n                        AND message.status = 'NOL'\n                        AND message.sys_insert_user_id = user.user_id\n                        AND user.user_id NOT IN (\n                            SELECT user_id FROM {$table_main_admin}\n                            )\n                        AND ticket.status_id != 'REE'\n                    GROUP BY ticket.ticket_id)";
            }
        }
        $sql .= " ORDER BY col{$column} {$direction}";
        $sql .= " LIMIT {$from}, {$number_of_items}";
        $result = Database::query($sql);
        $tickets = array();
        $webPath = api_get_path(WEB_PATH);
        $webCodePath = api_get_path(WEB_CODE_PATH);
        while ($row = Database::fetch_assoc($result)) {
            $sql_unread = "SELECT\n                              COUNT(DISTINCT message.message_id) AS unread\n                           FROM {$table_support_tickets}  ticket,\n                                {$table_support_messages} message,\n                                {$table_main_user} user\n                           WHERE ticket.ticket_id = message.ticket_id\n                           AND ticket.ticket_id = '{$row['col0']}'\n                           AND message.status = 'NOL'\n                           AND message.sys_insert_user_id = user.user_id ";
            if ($isAdmin) {
                $sql_unread .= " AND user.user_id\n                                 NOT IN (SELECT user_id FROM {$table_main_admin})\n                                 AND ticket.status_id != 'REE' ";
            } else {
                $sql_unread .= " AND user.user_id\n                                 IN (SELECT user_id FROM {$table_main_admin}) ";
            }
            $result_unread = Database::query($sql_unread);
            $unread = Database::fetch_object($result_unread)->unread;
            $userInfo = api_get_user_info($row['user_id']);
            $hrefUser = $webPath . 'main/admin/user_information.php?user_id=' . $row['user_id'];
            $name = "<a href='{$hrefUser}'> {$userInfo['username']} </a>";
            $actions = "";
            if ($row['responsible'] != 0) {
                $row['responsible'] = api_get_user_info($row['responsible']);
                if (!empty($row['responsible'])) {
                    $hrefResp = $webPath . 'main/admin/user_information.php?user_id=' . $row['responsible']['user_id'];
                    $row['responsible'] = "<a href='{$hrefResp}'> {$row['responsible']['username']} </a>";
                } else {
                    $row['responsible'] = get_lang('UnknownUser');
                }
            } else {
                if ($row['status_id'] != 'REE') {
                    $row['responsible'] = '<span style="color:#ff0000;">' . $plugin->get_lang('ToBeAssigned') . '</span>';
                } else {
                    $row['responsible'] = '<span style="color:#00ff00;">' . get_lang('MessageResent') . '</span>';
                }
            }
            switch ($row['source']) {
                case 'PRE':
                    $img_source = 'icons/32/user.png';
                    break;
                case 'MAI':
                    $img_source = 'icons/32/mail.png';
                    break;
                case 'TEL':
                    $img_source = 'icons/32/event.png';
                    break;
                default:
                    $img_source = 'icons/32/course_home.png';
                    break;
            }
            $row['col1'] = api_get_local_time($row['col1']);
            $row['col2'] = api_get_local_time($row['col2']);
            if ($isAdmin) {
                $actions .= '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . Display::return_icon('synthese_view.gif', get_lang('Info')) . '</a>&nbsp;&nbsp;';
                if ($row['priority_id'] == 'HGH' && $row['status_id'] != 'CLS') {
                    $actions .= '<img src="' . $webCodePath . 'img/exclamation.png" border="0" />';
                }
                $row['col0'] = Display::return_icon($img_source, get_lang('Info')) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['ticket_code'] . '</a>';
                if ($row['col7'] == 'PENDIENTE') {
                    $row['col7'] = '<span style="color: #f00; font-weight:bold;">' . $row['col7'] . '</span>';
                }
                $ticket = array($row['col0'], api_format_date($row['col1'], '%d/%m/%y - %I:%M:%S %p'), api_format_date($row['col2'], '%d/%m/%y - %I:%M:%S %p'), $row['col3'], $name, $row['responsible'], $row['col7'], $row['col8'], $actions, $row['col9']);
            } else {
                $actions = "";
                $actions .= '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . Display::return_icon('synthese_view.gif', get_lang('Info')) . '</a>&nbsp;&nbsp;';
                $row['col0'] = Display::return_icon($img_source, get_lang('Info')) . '<a href="ticket_details.php?ticket_id=' . $row['col0'] . '">' . $row['ticket_code'] . '</a>';
                $now = api_strtotime(api_get_utc_datetime());
                $last_edit_date = api_strtotime($row['sys_lastedit_datetime']);
                $dif = $now - $last_edit_date;
                if ($dif > 172800 && $row['priority_id'] == 'NRM' && $row['status_id'] != 'CLS') {
                    $actions .= '<a href="myticket.php?ticket_id=' . $row['ticket_id'] . '&amp;action=alert">
                                 <img src="' . Display::returnIconPath('exclamation.png') . '" border="0" /></a>';
                }
                if ($row['priority_id'] == 'HGH') {
                    $actions .= '<img src="' . Display::returnIconPath('admin_star.png') . '" border="0" />';
                }
                $ticket = array($row['col0'], api_format_date($row['col1'], '%d/%m/%y - %I:%M:%S %p'), api_format_date($row['col2'], '%d/%m/%y - %I:%M:%S %p'), $row['col3'], $row['col7'], $actions);
            }
            if ($unread > 0) {
                $ticket['0'] = $ticket['0'] . '&nbsp;&nbsp;(' . $unread . ')<a href="ticket_details.php?ticket_id=' . $row['ticket_id'] . '">
                                <img src="' . Display::returnIconPath('message_new.png') . '" border="0" title="' . $unread . ' ' . get_lang('Messages') . '"/>
                                </a>';
            }
            if ($isAdmin) {
                $ticket['0'] .= '&nbsp;&nbsp;<a  href="javascript:void(0)" onclick="load_history_ticket(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')">
					<img onclick="load_course_list(\'div_' . $row['ticket_id'] . '\',' . $row['ticket_id'] . ')" onmouseover="clear_course_list (\'div_' . $row['ticket_id'] . '\')" src="' . Display::returnIconPath('history.gif') . '" title="' . get_lang('Historial') . '" alt="' . get_lang('Historial') . '"/>
					<div class="blackboard_hide" id="div_' . $row['ticket_id'] . '">&nbsp;&nbsp;</div>
					</a>&nbsp;&nbsp;';
            }
            $tickets[] = $ticket;
        }
        return $tickets;
    }
    /**
     * Displays the subscribe icon if subscribing is allowed and
     * if the user is not yet subscribed to this course
     *
     * @global type $stok
     * @param array $current_course
     * @param array $user_courses
     * @return bool
     */
    function display_subscribe_icon($current_course, $user_courses)
    {
        global $stok;
        //Already subscribed
        $code = $current_course['code'];
        if (isset($user_courses[$code])) {
            echo self::get_lang('AlreadySubscribed');
            return false;
        }
        //Not authorized to subscribe
        if ($current_course['subscribe'] != SUBSCRIBE_ALLOWED) {
            echo self::get_lang('SubscribingNotAllowed');
            return false;
        }
        //Subscribe form
        $self = $_SERVER['PHP_SELF'];
        echo <<<EOT
                <form action="{$self}?action=subscribe" method="post">
                    <input type="hidden" name="sec_token" value="{$stok}" />
                    <input type="hidden" name="subscribe" value="{$code}" />
EOT;
        $search_term = $this->post('search_term');
        if ($search_term) {
            $search_term = Security::remove_XSS($search_term);
            echo <<<EOT
                    <input type="hidden" name="search_course" value="1" />
                    <input type="hidden" name="search_term" value="{$search_term}" />
EOT;
        }
        echo '<input type="image" name="unsub" src="' . Display::returnIconPath('enroll.gif') . '" alt="' . get_lang('Subscribe') . '" />
                ' . get_lang('Subscribe') . '
                </form>
        ';
        return true;
    }
    /**
     * Display the form session export
     * @param array $hidden_fiels Hidden fields to add to the form.
     * @param boolean the document array will be serialize. This is used in the course_copy.php file
     */
    public static function display_form_session_export($list_course, $hidden_fields = null, $avoid_serialize = false)
    {
        ?>
		<script>
			function exp(item) {
				el = document.getElementById('div_'+item);
				if (el.style.display=='none'){
					el.style.display='';
					document.getElementById('img_'+item).src='<?php 
        echo Display::returnIconPath('1.gif');
        ?>
';
				}
				else{
					el.style.display='none';
					document.getElementById('img_'+item).src='<?php 
        echo Display::returnIconPath('0.gif');
        ?>
';
				}
			}
			function setCheckbox(type,value) {
 				d = document.course_select_form;
 				for (i = 0; i < d.elements.length; i++) {
   					if (d.elements[i].type == "checkbox") {
						var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
 						if( name.indexOf(type) > 0 || type == 'all' ){
						     d.elements[i].checked = value;
						}
   					}
 				}
			}
			function checkLearnPath(message){
				d = document.course_select_form;
 				for (i = 0; i < d.elements.length; i++) {
 					if (d.elements[i].type == "checkbox") {
						var name = d.elements[i].attributes.getNamedItem('name').nodeValue;
 						if( name.indexOf('learnpath') > 0){
 							if(d.elements[i].checked){
	 							setCheckbox('document',true);
	 							alert(message);
	 							break;
 							}
 						}
 					}
 				}
			}
		</script>
		<?php 
        //get destination course title
        if (!empty($hidden_fields['destination_course'])) {
            if (!empty($hidden_fields['destination_session'])) {
                $sessionTitle = ' (' . api_get_session_name($hidden_fields['destination_session']) . ')';
            } else {
                $sessionTitle = null;
            }
            $course_infos = CourseManager::get_course_information($hidden_fields['destination_course']);
            echo '<h3>';
            echo get_lang('DestinationCourse') . ' : ' . $course_infos['title'] . $sessionTitle;
            echo '</h3>';
        }
        echo '<script type="text/javascript">var myUpload = new upload(1000);</script>';
        $icon = Display::returnIconPath('progress_bar.gif');
        echo '<form method="post" id="upload_form" name="course_select_form" onsubmit="myUpload.start(\'dynamic_div\',\'' . $icon . '\',\'' . get_lang('PleaseStandBy') . '\',\'upload_form\')">';
        echo '<input type="hidden" name="action" value="course_select_form"/>';
        foreach ($list_course as $course) {
            foreach ($course->resources as $type => $resources) {
                if (count($resources) > 0) {
                    echo '<img id="img_' . $course->code . '" src="' . Display::returnIconPath('1.gif') . '" onclick="javascript:exp(' . "'{$course->code}'" . ');" />';
                    echo '<b  onclick="javascript:exp(' . "'{$course->code}'" . ');" > ' . $course->code . '</b><br />';
                    echo '<div id="div_' . $course->code . '">';
                    echo '<blockquote>';
                    echo '<div class="btn-group">';
                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('" . $course->code . "',true);\" >" . get_lang('All') . "</a>";
                    echo "<a class=\"btn\" href=\"#\" onclick=\"javascript:setCheckbox('" . $course->code . "',false);\" >" . get_lang('None') . "</a>";
                    echo '</div><br />';
                    foreach ($resources as $id => $resource) {
                        echo '<label class="checkbox" for="resource[' . $course->code . '][' . $id . ']">';
                        echo '<input type="checkbox" name="resource[' . $course->code . '][' . $id . ']" id="resource[' . $course->code . '][' . $id . ']"/>';
                        $resource->show();
                        echo '</label>';
                    }
                    echo '</blockquote>';
                    echo '</div>';
                    echo '<script type="text/javascript">exp(' . "'{$course->code}'" . ')</script>';
                }
            }
        }
        if ($avoid_serialize) {
            //Documents are avoided due the huge amount of memory that the serialize php function "eats" (when there are directories with hundred/thousand of files)
            // this is a known issue of serialize
            $course->resources['document'] = null;
        }
        echo '<input type="hidden" name="course" value="' . base64_encode(Course::serialize($course)) . '"/>';
        if (is_array($hidden_fields)) {
            foreach ($hidden_fields as $key => $value) {
                echo "\n";
                echo '<input type="hidden" name="' . $key . '" value="' . $value . '"/>';
            }
        }
        echo '<br /><button class="save" type="submit" onclick="checkLearnPath(\'' . addslashes(get_lang('DocumentsWillBeAddedToo')) . '\')">' . get_lang('Ok') . '</button>';
        CourseSelectForm::display_hidden_quiz_questions($course);
        CourseSelectForm::display_hidden_scorm_directories($course);
        echo '</form>';
        echo '<div id="dynamic_div" style="display:block;margin-left:40%;margin-top:10px;height:50px;"></div>';
    }
Exemplo n.º 12
0
 /**
  * Get sessions followed by human resources manager
  * @param int $userId
  * @param int $start
  * @param int $limit
  * @param bool $getCount
  * @param bool $getOnlySessionId
  * @param bool $getSql
  * @param string $orderCondition
  * @param string $keyword
  * @param string $description
  * @return array sessions
  */
 public static function getSessionsFollowedByUser($userId, $status = null, $start = null, $limit = null, $getCount = false, $getOnlySessionId = false, $getSql = false, $orderCondition = null, $keyword = '', $description = '')
 {
     // Database Table Definitions
     $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
     $tbl_session_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
     $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
     $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
     $userId = intval($userId);
     $select = " SELECT DISTINCT * ";
     if ($getCount) {
         $select = " SELECT count(DISTINCT(s.id)) as count ";
     }
     if ($getOnlySessionId) {
         $select = " SELECT DISTINCT(s.id) ";
     }
     $limitCondition = null;
     if (!empty($start) && !empty($limit)) {
         $limitCondition = " LIMIT " . intval($start) . ", " . intval($limit);
     }
     if (empty($orderCondition)) {
         $orderCondition = " ORDER BY s.name ";
     }
     $whereConditions = null;
     $sessionCourseConditions = null;
     $sessionConditions = null;
     $sessionQuery = null;
     $courseSessionQuery = null;
     switch ($status) {
         case DRH:
             $sessionQuery = "SELECT sru.session_id\n                                 FROM\n                                 {$tbl_session_rel_user} sru\n                                 WHERE\n                                    sru.relation_type = '" . SESSION_RELATION_TYPE_RRHH . "' AND\n                                    sru.user_id = {$userId}";
             break;
         case COURSEMANAGER:
             $courseSessionQuery = "\n                    SELECT scu.session_id as id\n                    FROM {$tbl_session_rel_course_rel_user} scu\n                    WHERE (scu.status = 2 AND scu.user_id = {$userId})";
             $whereConditions = " OR (s.id_coach = {$userId}) ";
             break;
         default:
             $sessionQuery = "SELECT sru.session_id\n                                 FROM\n                                 {$tbl_session_rel_user} sru\n                                 WHERE\n                                    sru.user_id = {$userId}";
             break;
     }
     $keywordCondition = '';
     if (!empty($keyword)) {
         $keyword = Database::escape_string($keyword);
         $keywordCondition = " AND (s.name LIKE '%{$keyword}%' ) ";
         if (!empty($description)) {
             $description = Database::escape_string($description);
             $keywordCondition = " AND (s.name LIKE '%{$keyword}%' OR s.description LIKE '%{$description}%' ) ";
         }
     }
     $whereConditions .= $keywordCondition;
     $subQuery = $sessionQuery . $courseSessionQuery;
     $sql = " {$select} FROM {$tbl_session} s\n                INNER JOIN {$tbl_session_rel_access_url} a ON (s.id = a.session_id)\n                WHERE\n                    access_url_id = " . api_get_current_access_url_id() . " AND\n                    s.id IN (\n                        {$subQuery}\n                    )\n                    {$whereConditions}\n                    {$orderCondition}\n                    {$limitCondition}";
     if ($getSql) {
         return $sql;
     }
     $result = Database::query($sql);
     if ($getCount) {
         $row = Database::fetch_array($result);
         return $row['count'];
     }
     $sessions = array();
     if (Database::num_rows($result) > 0) {
         $sysUploadPath = api_get_path(SYS_UPLOAD_PATH) . 'sessions/';
         $webUploadPath = api_get_path(WEB_UPLOAD_PATH) . 'sessions/';
         $imgPath = Display::returnIconPath('session_default_small.png');
         $tableExtraFields = Database::get_main_table(TABLE_EXTRA_FIELD);
         $sql = "SELECT id FROM " . $tableExtraFields . "\n                    WHERE extra_field_type = 3 AND variable='image'";
         $resultField = Database::query($sql);
         $imageFieldId = Database::fetch_assoc($resultField);
         while ($row = Database::fetch_array($result)) {
             $row['image'] = null;
             $sessionImage = $sysUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
             if (is_file($sessionImage)) {
                 $sessionImage = $webUploadPath . $imageFieldId['id'] . '_' . $row['id'] . '.png';
                 $row['image'] = $sessionImage;
             } else {
                 $row['image'] = $imgPath;
             }
             $sessions[$row['id']] = $row;
         }
     }
     return $sessions;
 }
Exemplo n.º 13
0
    /**
     * Uses new functions (php 5.2) for displaying real upload progress.
     * @param string $upload_id							The value of the field UPLOAD_IDENTIFIER, the second parameter (XXX) of the $form->addElement('file', XXX) sentence
     * @param string $element_after						The first element of the form (to place at first UPLOAD_IDENTIFIER)
     * @param int $delay (optional)						The frequency of the xajax call
     * @param bool $wait_after_upload (optional)
     */
    public function add_real_progress_bar($upload_id, $element_after, $delay = 2, $wait_after_upload = false)
    {
        if (!function_exists('uploadprogress_get_info')) {
            $this->add_progress_bar($delay);
            return;
        }
        $xajax_upload = new xajax(api_get_path(WEB_LIBRARY_PATH) . 'upload.xajax.php');
        $xajax_upload->registerFunction('updateProgress');
        // IMPORTANT : must be the first element of the form
        $el = $this->insertElementBefore(FormValidator::createElement('html', '<input type="hidden" name="UPLOAD_IDENTIFIER" value="' . $upload_id . '" />'), $element_after);
        $this->addElement('html', '<br />');
        // Add div-element where the progress bar is to be displayed
        $this->addElement('html', '
                		<div id="dynamic_div_container" style="display:none">
                			<div id="dynamic_div_label">' . get_lang('UploadFile') . '</div>
                <div id="dynamic_div_frame" style="width:214px; height:12px; border:1px solid grey; background-image:url(' . Display::returnIconPath('real_upload_frame.gif') . ');">
                    <div id="dynamic_div_filled" style="width:0%;height:100%;background-image:url(' . Display::returnIconPath('real_upload_step.gif') . ');background-repeat:repeat-x;background-position:center;"></div>
                			</div>
            </div>');
        if ($wait_after_upload) {
            $this->addElement('html', '
			<div id="dynamic_div_waiter_container" style="display:none">
				<div id="dynamic_div_waiter_label">
					' . get_lang('SlideshowConversion') . '
				</div>
				<div id="dynamic_div_waiter_frame">
					' . Display::return_icon('real_upload_frame.gif') . '
				</div>
			</div>
		');
        }
        // Get the xajax code
        $this->addElement('html', $xajax_upload->getJavascript(api_get_path(WEB_LIBRARY_PATH) . 'xajax'));
        // Get the upload code
        $this->addElement('html', '<script type="text/javascript">var myUpload = new upload(' . abs(intval($delay)) * 1000 . ');</script>');
        if (!$wait_after_upload) {
            $wait_after_upload = 0;
        }
        // Add the upload event
        $this->updateAttributes("onsubmit=\"javascript: myUpload.startRealUpload('dynamic_div','" . $upload_id . "','" . $this->getAttribute('id') . "'," . $wait_after_upload . ")\"");
    }
Exemplo n.º 14
0
}

function add_image_form() {
	// Multiple filepaths for image form
	var filepaths = document.getElementById("filepaths");
	if (document.getElementById("filepath_"+counter_image)) {
		counter_image = counter_image + 1;
	}  else {
		counter_image = counter_image;
	}
	var elem1 = document.createElement("div");
	elem1.setAttribute("id","filepath_"+counter_image);
	filepaths.appendChild(elem1);
	id_elem1 = "filepath_"+counter_image;
	id_elem1 = "\'"+id_elem1+"\'";
	document.getElementById("filepath_"+counter_image).innerHTML = "<input type=\\"file\\" name=\\"attach_"+counter_image+"\\"  size=\\"20\\" />&nbsp;<a href=\\"javascript:remove_image_form("+id_elem1+")\\"><img src=\\"' . Display::returnIconPath('delete.gif') . '\\"></a>";

	if (filepaths.childNodes.length == 3) {
		var link_attach = document.getElementById("link-more-attach");
		if (link_attach) {
			link_attach.innerHTML="";
		}
	}
}

function show_icon_edit(element_html) {
    ident="#edit_image";
    $(ident).show();
}

function hide_icon_edit(element_html)  {
Exemplo n.º 15
0
        $fixed_queries = array($course_filter);
    }
}
if ($query) {
    list($count, $results) = chamilo_query_query(api_convert_encoding($query, 'UTF-8', $charset), 0, 1000, $fixed_queries);
} else {
    $count = 0;
    $results = [];
}
// Prepare blocks to show.
$blocks = array();
if ($count > 0) {
    foreach ($results as $result) {
        // Fill the result array.
        if (empty($result['thumbnail'])) {
            $result['thumbnail'] = Display::returnIconPath('no_document_thumb.jpg');
        }
        if (!empty($result['url'])) {
            $a_prefix = '<a href="' . $result['url'] . '">';
            $a_sufix = '</a>';
        } else {
            $a_prefix = '';
            $a_sufix = '';
        }
        if ($mode == 'gallery') {
            $title = $a_prefix . str_replace('_', ' ', $result['title']) . $a_sufix;
            $blocks[] = array(1 => $a_prefix . '<img src="' . $result['thumbnail'] . '" />' . $a_sufix . '<br />' . $title . '<br />' . $result['author']);
        } else {
            $title = '<div style="text-align:left;">' . $a_prefix . $result['title'] . $a_sufix . (!empty($result['author']) ? ' ' . $result['author'] : '') . '<div>';
            $blocks[] = array(1 => $title);
        }
Exemplo n.º 16
0
if (!$is_allowed_to_edit) {
    api_not_allowed(true);
}
$interbreadcrumb[] = array("url" => "../newscorm/lp_controller.php?action=list", "name" => get_lang("Doc"));
$nameTools = get_lang("WoogieConversionPowerPoint");
Display::display_header($nameTools);
echo '<span style="color: #5577af; font-size: 16px; font-family: Arial; margin-left: 10px;">' . get_lang("WelcomeWoogieSubtitle") . '</span><br>';
$message = get_lang("WelcomeWoogieConverter");
echo '<br />';
$s_style = "border-width: 1px;\n         border-style: solid;\n         margin-left: 0;\n         margin-top: 10px;\n         margin-bottom: 0px;\n         min-height: 30px;\n         padding: 5px;\n         position: relative;\n         width: 500px;\n         background-color: #E5EDF9;\n         border-color: #4171B5;\n         color: #000;";
$s_style_error = "border-width: 1px;\n         border-style: solid;\n         margin-left: 0;\n         margin-top: 10px;\n         margin-bottom: 10px;\n         min-height: 30px;\n         padding: 5px;\n         position: relative;\n         width: 500px;\n         background-color: #FFD1D1;\n         border-color: #FF0000;\n         color: #000;";
echo '<div style="' . $s_style . '"><div style="float:left; margin-right:10px;">
<img src="' . Display::returnIconPath('message_normal.gif') . '" alt="' . $alt_text . '" ' . $attribute_list . '  /></div><div style="margin-left: 43px">' . $message . '</div></div>';
if (!empty($errorMessage)) {
    echo '<div style="' . $s_style_error . '"><div style="float:left; margin-right:10px;">
    <img src="' . Display::returnIconPath('message_error.gif') . '" alt="' . $alt_text . '" ' . $attribute_list . '  /></div><div style="margin-left: 43px">' . $errorMessage . '</div></div>';
}
$form = new FormValidator('update_course', 'POST', '', '', 'style="margin: 0;"');
// build the form
$form->addElement('html', '<br>');
$div_upload_limit = '&nbsp;&nbsp;' . get_lang('UploadMaxSize') . ' : ' . ini_get('post_max_size');
$renderer = $form->defaultRenderer();
// set template for user_file element
$user_file_template = <<<EOT
<div class="row" style="margin-top:10px;width:100%">
        <!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->{label}{element}{$div_upload_limit}
        <!-- BEGIN error --><br /><span class="form_error">{error}</span><!-- END error -->
</div>
EOT;
$renderer->setElementTemplate($user_file_template, 'user_file');
// set template for other elements
Exemplo n.º 17
0
				}
				else {
					width = Math.ceil(width);
					height = Math.ceil(height);
				}

				document.getElementById('image').style.height = height +"px";
				document.getElementById('image').style.width = width +"px";
				document.getElementById('td_image').style.background='none';
				document.getElementById('image').style.visibility='visible';
			};

			 if (initial_height>height || initial_width>width) {
				document.getElementById('image').style.visibility='hidden';
				document.getElementById('td_image').style.background='url(<?php 
            echo Display::returnIconPath('loadingAnimation.gif');
            ?>
) center no-repeat';
				document.getElementById('image').onload = resizeImage;
			    window.onresize = resizeImage;
			}

		</script>
    <?php 
        } else {
            echo "<img class=\"img-responsive\" src='download.php?doc_url={$path}/" . $image_files_only[$slide] . "' alt='" . $image_files_only[$slide] . "' border='0'" . $height_width_tags . ">";
        }
        echo '</a>';
        echo '<div class="caption text-center">';
        echo Display::tag('h3', $row['title']);
        echo '<p>' . $row['comment'] . '</p>';
Exemplo n.º 18
0
 /**
  * Gets the html content to show in the 3 column view
  */
 public static function show_tool_3column($cat, $userId = null)
 {
     $_user = api_get_user_info($userId);
     $TBL_ACCUEIL = Database::get_course_table(TABLE_TOOL_LIST);
     $TABLE_TOOLS = Database::get_main_table(TABLE_MAIN_COURSE_MODULE);
     $numcols = 3;
     $table = new HTML_Table('width="100%"');
     $all_tools = array();
     $course_id = api_get_course_int_id();
     $studentView = Session::read('studentview');
     switch ($cat) {
         case 'Basic':
             $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND  a.link=t.link AND t.position="basic" ';
             if ((api_is_coach() || api_is_course_tutor()) && $studentView != 'studentview') {
                 $condition_display_tools = ' WHERE a.c_id = ' . $course_id . ' AND a.link=t.link AND (t.position="basic" OR a.name = "' . TOOL_TRACKING . '") ';
             }
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        {$condition_display_tools} ORDER BY t.row, t.column";
             break;
         case 'External':
             if (api_is_allowed_to_edit()) {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND ((a.link=t.link AND t.position='external')\n                            OR (a.visibility <= 1 AND (a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image))\n                            ORDER BY a.id";
             } else {
                 $sql = "SELECT a.*, t.image img FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                            WHERE a.c_id = {$course_id} AND (a.visibility = 1 AND ((a.link=t.link AND t.position='external')\n                            OR ((a.image = 'external.gif' OR a.image = 'scormbuilder.gif' OR t.image = 'blog.gif') AND a.image=t.image)))\n                            ORDER BY a.id";
             }
             break;
         case 'courseAdmin':
             $sql = "SELECT a.*, t.image img, t.row, t.column  FROM {$TBL_ACCUEIL} a, {$TABLE_TOOLS} t\n                        WHERE a.c_id = {$course_id} AND admin=1 AND a.link=t.link ORDER BY t.row, t.column";
             break;
         case 'platformAdmin':
             $sql = "SELECT *, image img FROM {$TBL_ACCUEIL} WHERE c_id = {$course_id} AND visibility = 2 ORDER BY id";
     }
     $result = Database::query($sql);
     // Grabbing all the tools from $course_tool_table
     while ($tool = Database::fetch_array($result)) {
         $all_tools[] = $tool;
     }
     $course_id = api_get_course_int_id();
     // Grabbing all the links that have the property on_homepage set to 1
     if ($cat == 'External') {
         $tbl_link = Database::get_course_table(TABLE_LINK);
         $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY);
         if (api_is_allowed_to_edit(null, true)) {
             $sql_links = "SELECT tl.*, tip.visibility\n\t\t\t\t\t\t\t\tFROM {$tbl_link} tl\n                                LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                WHERE \ttl.c_id = {$course_id} AND\n                                \t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\ttip.visibility != 2";
         } else {
             $sql_links = "SELECT tl.*, tip.visibility\n                                    FROM {$tbl_link} tl\n                                    LEFT JOIN {$tbl_item_property} tip ON tip.tool='link' AND tip.ref=tl.id\n                                    WHERE \ttl.c_id = {$course_id} AND\n                                \t\t\ttip.c_id = {$course_id} AND\n                \t\t\t\t\t\t\ttl.on_homepage='1' AND\n                \t\t\t\t\t\t\ttip.visibility = 1";
         }
         $result_links = Database::query($sql_links);
         while ($links_row = Database::fetch_array($result_links)) {
             $properties = array();
             $properties['name'] = $links_row['title'];
             $properties['link'] = $links_row['url'];
             $properties['visibility'] = $links_row['visibility'];
             $properties['img'] = 'external.gif';
             $properties['adminlink'] = api_get_path(WEB_CODE_PATH) . 'link/link.php?action=editlink&amp;id=' . $links_row['id'];
             $all_tools[] = $properties;
         }
     }
     $cell_number = 0;
     // Draw line between basic and external, only if there are entries in External
     if ($cat == 'External' && count($all_tools)) {
         $table->setCellContents(0, 0, '<hr noshade="noshade" size="1"/>');
         $table->updateCellAttributes(0, 0, 'colspan="3"');
         $cell_number += $numcols;
     }
     foreach ($all_tools as &$tool) {
         if ($tool['image'] == 'scormbuilder.gif') {
             // check if the published learnpath is visible for student
             $published_lp_id = self::get_published_lp_id_from_link($tool['link']);
             if (!api_is_allowed_to_edit(null, true) && !learnpath::is_lp_visible_for_student($published_lp_id, api_get_user_id(), api_get_course_id(), api_get_session_id())) {
                 continue;
             }
         }
         if (api_get_session_id() != 0 && in_array($tool['name'], array('course_maintenance', 'course_setting'))) {
             continue;
         }
         $cell_content = '';
         // The name of the tool
         $tool_name = self::translate_tool_name($tool);
         $link_annex = '';
         // The url of the tool
         if ($tool['img'] != 'external.gif') {
             $tool['link'] = api_get_path(WEB_CODE_PATH) . $tool['link'];
             $qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&amp;';
             $link_annex = $qm_or_amp . api_get_cidreq();
         } else {
             // If an external link ends with 'login='******'link'], '?login='******'link'], '&amp;login='******'username'];
             }
         }
         // Setting the actual image url
         $tool['img'] = Display::returnIconPath($tool['img']);
         $courseCode = api_get_course_id();
         // VISIBLE
         if ($tool['visibility'] || (api_is_coach() || api_is_course_tutor()) && $tool['name'] == TOOL_TRACKING || $cat == 'courseAdmin' || $cat == 'platformAdmin') {
             if (strpos($tool['name'], 'visio_') !== false) {
                 $cell_content .= '<a  href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_visio' . $courseCode . '\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
             } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
                 $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_chat' . $courseCode . '\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
             } else {
                 $cell_content .= '<a href="' . $tool['link'] . $link_annex . '" target="' . $tool['target'] . '"><img src="' . $tool['img'] . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
             }
         } else {
             // INVISIBLE
             if (api_is_allowed_to_edit(null, true)) {
                 if (strpos($tool['name'], 'visio_') !== false) {
                     $cell_content .= '<a  href="javascript: void(0);" onclick="window.open(\'' . $tool['link'] . $link_annex . '\',\'window_visio' . $courseCode . '\',config=\'height=\'+730+\', width=\'+1020+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '"><img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                 } elseif (strpos($tool['name'], 'chat') !== false && api_get_course_setting('allow_open_chat_window')) {
                     $cell_content .= '<a href="javascript: void(0);" onclick="javascript: window.open(\'' . $tool['link'] . $link_annex . '\',\'window_chat' . $courseCode . '\',config=\'height=\'+600+\', width=\'+825+\', left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no\')" target="' . $tool['target'] . '" class="invisible"><img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 } else {
                     $cell_content .= '<a href="' . $tool['link'] . $link_annex . '" target="' . $tool['target'] . '" class="invisible">
                                         <img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">' . $tool_name . '</a>';
                     // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 }
             } else {
                 $cell_content .= '<img src="' . str_replace(".gif", "_na.gif", $tool['img']) . '" title="' . $tool_name . '" alt="' . $tool_name . '" align="absmiddle" border="0">';
                 // don't replace img with display::return_icon because $tool['img'] = api_get_path(WEB_IMG_PATH).$tool['img']
                 $cell_content .= '<span class="invisible">' . $tool_name . '</span>';
             }
         }
         $lnk = array();
         if (api_is_allowed_to_edit(null, true) && $cat != "courseAdmin" && !strpos($tool['link'], 'learnpath_handler.php?learnpath_id') && !api_is_coach()) {
             if ($tool['visibility']) {
                 $link['name'] = Display::return_icon('remove.gif', get_lang('Deactivate'), array('style' => 'vertical-align: middle;'));
                 $link['cmd'] = "hide=yes";
                 $lnk[] = $link;
             } else {
                 $link['name'] = Display::return_icon('add.gif', get_lang('Activate'), array('style' => 'vertical-align: middle;'));
                 $link['cmd'] = "restore=yes";
                 $lnk[] = $link;
             }
             if (is_array($lnk)) {
                 foreach ($lnk as &$this_lnk) {
                     if ($tool['adminlink']) {
                         $cell_content .= '<a href="' . $properties['adminlink'] . '">' . Display::return_icon('edit.gif', get_lang('Edit')) . '</a>';
                     } else {
                         $cell_content .= '<a href="' . api_get_self() . '?id=' . $tool['id'] . '&amp;' . $this_lnk['cmd'] . '">' . $this_lnk['name'] . '</a>';
                     }
                 }
             }
         }
         $table->setCellContents($cell_number / $numcols, $cell_number % $numcols, $cell_content);
         $table->updateCellAttributes($cell_number / $numcols, $cell_number % $numcols, 'width="32%" height="42"');
         $cell_number++;
     }
     return $table->toHtml();
 }
Exemplo n.º 19
0
 /**
  * Get document information
  */
 private function get_information($course_id, $link_id)
 {
     $course_information = api_get_course_info($course_id);
     $course_id = $course_information['real_id'];
     $course_id_alpha = $course_information['id'];
     if (!empty($course_information)) {
         $item_property_table = Database::get_course_table(TABLE_ITEM_PROPERTY);
         $link_id = intval($link_id);
         $sql = "SELECT insert_user_id FROM {$item_property_table}\n              \t\tWHERE ref = {$link_id} AND tool = '" . TOOL_LINK . "' AND c_id = {$course_id}\n              \t\tLIMIT 1";
         $name = get_lang('Links');
         $url = api_get_path(WEB_PATH) . 'main/link/link.php?cidReq=%s';
         $url = sprintf($url, $course_id_alpha);
         // Get the image path
         $thumbnail = Display::returnIconPath('link.png');
         $image = $thumbnail;
         //FIXME: use big images
         // get author
         $author = '';
         $item_result = Database::query($sql);
         if ($row = Database::fetch_array($item_result)) {
             $user_data = api_get_user_info($row['insert_user_id']);
             $author = api_get_person_name($user_data['firstName'], $user_data['lastName']);
         }
         return array($thumbnail, $image, $name, $author, $url);
     } else {
         return array();
     }
 }
Exemplo n.º 20
0
 /**
  * Gets the current group image
  * @param string group id
  * @param string picture group name
  * @param string height
  * @param string picture size it can be small_,  medium_  or  big_
  * @param string style css
  * @return array with the file and the style of an image i.e $array['file'] $array['style']
  */
 public function get_picture_group($id, $picture_file, $height, $size_picture = GROUP_IMAGE_SIZE_MEDIUM, $style = '')
 {
     $picture = array();
     $picture['style'] = $style;
     if ($picture_file == 'unknown.jpg') {
         $picture['file'] = Display::returnIconPath($picture_file);
         return $picture;
     }
     switch ($size_picture) {
         case GROUP_IMAGE_SIZE_ORIGINAL:
             $size_picture = '';
             break;
         case GROUP_IMAGE_SIZE_BIG:
             $size_picture = 'big_';
             break;
         case GROUP_IMAGE_SIZE_MEDIUM:
             $size_picture = 'medium_';
             break;
         case GROUP_IMAGE_SIZE_SMALL:
             $size_picture = 'small_';
             break;
         default:
             $size_picture = 'medium_';
     }
     $image_array_sys = $this->get_group_picture_path_by_id($id, 'system', false, true);
     $image_array = $this->get_group_picture_path_by_id($id, 'web', false, true);
     $file = $image_array_sys['dir'] . $size_picture . $picture_file;
     if (file_exists($file)) {
         $picture['file'] = $image_array['dir'] . $size_picture . $picture_file;
         $picture['style'] = '';
         if ($height > 0) {
             $dimension = api_getimagesize($picture['file']);
             $margin = ($height - $dimension['width']) / 2;
             //@ todo the padding-top should not be here
             $picture['style'] = ' style="padding-top:' . $margin . 'px; width:' . $dimension['width'] . 'px; height:' . $dimension['height'] . ';" ';
         }
     } else {
         $file = $image_array_sys['dir'] . $picture_file;
         if (file_exists($file) && !is_dir($file)) {
             $picture['file'] = $image_array['dir'] . $picture_file;
         } else {
             $picture['file'] = Display::returnIconPath('unknown_group.png');
         }
     }
     return $picture;
 }
Exemplo n.º 21
0
 /**
  * Creates a list with all the forums in it
  * @return string
  */
 public function get_forums()
 {
     require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
     require_once api_get_path(SYS_CODE_PATH) . 'forum/forumconfig.inc.php';
     $a_forums = get_forums();
     $return = '<ul class="lp_resource">';
     //First add link
     $return .= '<li class="lp_resource_element">';
     $return .= Display::return_icon('forum_new_small.gif', '', array(), ICON_SIZE_TINY);
     $return .= Display::url(get_lang('CreateANewForum'), api_get_path(REL_CODE_PATH) . 'forum/index.php?' . api_get_cidreq() . '&' . http_build_query(['action' => 'add', 'content' => 'forum', 'lp_id' => $this->lp_id]), ['title' => get_lang('CreateANewForum')]);
     $return .= '</li>';
     $return .= '<script>
                 function toggle_forum(forum_id){
                     if(document.getElementById("forum_"+forum_id+"_content").style.display == "none"){
                         document.getElementById("forum_"+forum_id+"_content").style.display = "block";
                         document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('remove.gif') . '";
                     } else {
                         document.getElementById("forum_"+forum_id+"_content").style.display = "none";
                         document.getElementById("forum_"+forum_id+"_opener").src = "' . Display::returnIconPath('add.gif') . '";
                     }
                 }
             </script>';
     foreach ($a_forums as $forum) {
         if (!empty($forum['forum_id'])) {
             $link = Display::url(Display::return_icon('preview_view.png', get_lang('Preview')), api_get_path(WEB_CODE_PATH) . 'forum/viewforum.php?' . api_get_cidreq() . '&forum=' . $forum['forum_id'], ['target' => '_blank']);
             $return .= '<li class="lp_resource_element" data_id="' . $forum['forum_id'] . '" data_type="' . TOOL_FORUM . '" title="' . $forum['forum_title'] . '" >';
             $return .= '<a class="moved" href="#">';
             $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
             $return .= ' </a>';
             $return .= Display::return_icon('lp_forum.png', '', array(), ICON_SIZE_TINY);
             $return .= '<a style="cursor:hand" onclick="javascript: toggle_forum(' . $forum['forum_id'] . ')" style="vertical-align:middle">
                             <img src="' . Display::returnIconPath('add.gif') . '" id="forum_' . $forum['forum_id'] . '_opener" align="absbottom" />
                         </a>
                         <a href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_FORUM . '&forum_id=' . $forum['forum_id'] . '&lp_id=' . $this->lp_id . '" style="vertical-align:middle">' . Security::remove_XSS($forum['forum_title']) . '</a>';
             $return .= '</li>';
             $return .= '<div style="display:none" id="forum_' . $forum['forum_id'] . '_content">';
             $a_threads = get_threads($forum['forum_id']);
             if (is_array($a_threads)) {
                 foreach ($a_threads as $thread) {
                     $link = Display::url(Display::return_icon('preview_view.png', get_lang('Preview')), api_get_path(WEB_CODE_PATH) . 'forum/viewthread.php?' . api_get_cidreq() . '&forum=' . $forum['forum_id'] . '&thread=' . $thread['thread_id'], ['target' => '_blank']);
                     $return .= '<li class="lp_resource_element" data_id="' . $thread['thread_id'] . '" data_type="' . TOOL_THREAD . '" title="' . $thread['thread_title'] . '" >';
                     $return .= '&nbsp;<a class="moved" href="#">';
                     $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
                     $return .= ' </a>';
                     $return .= Display::return_icon('forumthread.png', get_lang('Thread'), array(), ICON_SIZE_TINY);
                     $return .= '<a class="moved" href="' . api_get_self() . '?' . api_get_cidreq() . '&action=add_item&type=' . TOOL_THREAD . '&thread_id=' . $thread['thread_id'] . '&lp_id=' . $this->lp_id . '">' . Security::remove_XSS($thread['thread_title']) . ' ' . $link . '</a>';
                     $return .= '</li>';
                 }
             }
             $return .= '</div>';
         }
     }
     $return .= '</ul>';
     return $return;
 }
Exemplo n.º 22
0
			beforeSend: function(objeto) {
				$(ident).attr("src","' . Display::returnIconPath('loading1.gif') . '"); }, //candy eye stuff
			type: "GET",
			url: "' . api_get_path(WEB_AJAX_PATH) . 'user_manager.ajax.php?a=active_user",
			data: "user_id="+user_id[1]+"&status="+status,
			success: function(data) {
				if (data == 1) {
					$(ident).attr("src", "' . Display::returnIconPath('accept.png') . '");
					$(ident).attr("title","' . get_lang('Lock') . '");
				}
                if (data == 0) {
					$(ident).attr("src","' . Display::returnIconPath('error.png') . '");
					$(ident).attr("title","' . get_lang('Unlock') . '");
				}
                if (data == -1) {
                    $(ident).attr("src", "' . Display::returnIconPath('warning.png') . '");
					$(ident).attr("title","' . get_lang('ActionNotAllowed') . '");
                }
			}
		});
	}
}

function clear_course_list(div_course) {
	$("div#"+div_course).html("&nbsp;");
	$("div#"+div_course).hide("");
}
function clear_session_list(div_session) {
	$("div#"+div_session).html("&nbsp;");
	$("div#"+div_session).hide("");
}
Exemplo n.º 23
0
            $(".row_odd  td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#dcdcdc", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" });
            $(".row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#eee", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" });

            $(".checkboxes_col_"+calendar_id).mouseover(function() {
                //$(".checkbox_head_"+calendar_id).removeAttr("opacity");
                //$("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"red", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
                //$("row_odd  td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF",       "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
            });

            $(".checkboxes_col_"+calendar_id).mouseout(function() {
                //    $("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#F9F9F9", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
                //    $("row_odd  td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF",       "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
            });

            $(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",false);
            $(this).attr("src","' . Display::returnIconPath('lock-open.png') . '");
            $(this).attr("title","' . get_lang('DateLock') . '");
            $(this).attr("alt","' . get_lang('DateLock') . '");
            $(this).attr("class","img_unlock");
            $("#hidden_input_"+calendar_id).attr("disabled",false);
            $("#hidden_input_"+calendar_id).attr("value",calendar_id);
            return false;
        }
    });

    $("table th input:checkbox").click(function() {
        var col_id = this.id;
        var col_split = col_id.split("_");
        var calendar_id = col_split[2];

        if (this.checked) {
Exemplo n.º 24
0
}

function show_icon_delete(element_html) {
	elem_id=$(element_html).attr("id");
	id_elem=elem_id.split("_");
	ident="#img_"+id_elem[1];
	$(ident).attr("src","' . Display::returnIconPath('delete.png') . '");
	$(ident).attr("alt","' . get_lang('Delete', '') . '");
	$(ident).attr("title","' . get_lang('Delete', '') . '");
}

function hide_icon_delete(element_html)  {
	elem_id=$(element_html).attr("id");
	id_elem=elem_id.split("_");
	ident="#img_"+id_elem[1];
	$(ident).attr("src","' . Display::returnIconPath('blank.gif') . '");
	$(ident).attr("alt","");
	$(ident).attr("title","");
}

function clear_form () {
	$("input[@type=radio]").attr("checked", false);
	$("div#div_qualify_image").html("");
	$("div#div_info_user").html("");
}

</script>';
$interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Friends'));
//Block Social Menu
$social_menu_block = SocialManager::show_social_menu('friends');
Exemplo n.º 25
0
 * database, regardless of wether they are visible/invisible, have
 * comments or not.
 *
 * @package chamilo.document
 * @todo improve script structure (FormValidator is used to display form, but
 * not for validation at the moment)
 */
//require_once '../inc/global.inc.php';
// Template's javascript
$htmlHeadXtra[] = '
<script>
var hide_bar = function() {
    $("#template_col").hide();
    $("#doc_form").removeClass("col-md-9");
    $("#doc_form").addClass("col-md-11");
    $("#hide_bar_template").css({"background-image" : \'url("' . Display::returnIconPath('hide.png') . '")\'})
}

$(document).ready(function() {
    $(".scrollbar-light").scrollbar();

    if ($(window).width() <= 785 ) {
        hide_bar();
    }

    $("#hide_bar_template").click(function() {
        $("#template_col").toggleClass("hide");
        $("#hide_bar_template").toggleClass("hide_bar_template_not_hide");
    });

    CKEDITOR.on("instanceReady", function (e) {
Exemplo n.º 26
0
 /**
  * Build a list of extra file already uploaded in $user_folder/{$extra_field}/
  * @param $user_id
  * @param $extra_field
  * @param bool $force
  * @param bool $showdelete
  * @return bool|string
  */
 public static function build_user_extra_file_list($user_id, $extra_field, $force = false, $showdelete = false)
 {
     if (!$force && !empty($_POST['remove_' . $extra_field])) {
         return true;
         // postpone reading from the filesystem
     }
     $extra_files = self::get_user_extra_files($user_id, $extra_field);
     if (empty($extra_files)) {
         return false;
     }
     $path_info = self::get_user_picture_path_by_id($user_id, 'web');
     $path = $path_info['dir'];
     $del_image = Display::returnIconPath('delete.png');
     $del_text = get_lang('Delete');
     $extra_file_list = '';
     if (count($extra_files) > 0) {
         $extra_file_list = '<div class="files-production"><ul id="productions">';
         foreach ($extra_files as $file) {
             $filename = substr($file, strlen($extra_field) + 1);
             $extra_file_list .= '<li>' . Display::return_icon('archive.png') . '<a href="' . $path . $extra_field . '/' . urlencode($filename) . '" target="_blank">' . htmlentities($filename) . '</a> ';
             if ($showdelete) {
                 $extra_file_list .= '<input style="width:16px;" type="image" name="remove_extra_' . $extra_field . '[' . urlencode($file) . ']" src="' . $del_image . '" alt="' . $del_text . '" title="' . $del_text . ' ' . htmlentities($filename) . '" onclick="javascript: return confirmation(\'' . htmlentities($filename) . '\');" /></li>';
             }
         }
         $extra_file_list .= '</ul></div>';
     }
     return $extra_file_list;
 }
Exemplo n.º 27
0
 /**
  * @param int $folderId
  * @param array $resource
  * @param int $lp_id
  * @return null|string
  */
 private static function parseFolder($folderId, $resource, $lp_id)
 {
     $title = isset($resource['title']) ? $resource['title'] : null;
     $path = isset($resource['path']) ? $resource['path'] : null;
     if (empty($path)) {
         $num = 0;
     } else {
         $num = substr_count($path, '/');
     }
     // It's a folder.
     //hide some folders
     if (in_array($path, array('shared_folder', 'chat_files', 'HotPotatoes_files', 'css', 'certificates'))) {
         return null;
     } elseif (preg_match('/_groupdocs/', $path)) {
         return null;
     } elseif (preg_match('/sf_user_/', $path)) {
         return null;
     } elseif (preg_match('/shared_folder_session_/', $path)) {
         return null;
     }
     //trad some titles
     /*
             if ($key == 'images') {
                 $key = get_lang('Images');
             } elseif ($key == 'gallery') {
                 $key = get_lang('Gallery');
             } elseif ($key == 'flash') {
                 $key = get_lang('Flash');
             } elseif ($key == 'audio') {
                 $key = get_lang('Audio');
             } elseif ($key == 'video') {
                 $key = get_lang('Video');
             }*/
     $onclick = '';
     // if in LP, hidden folder are displayed in grey
     $folder_class_hidden = "";
     if ($lp_id) {
         if (isset($resource['visible']) && $resource['visible'] == 0) {
             $folder_class_hidden = "doc_folder_hidden";
             // in base.css
         }
         $onclick = 'onclick="javascript: testResources(\'res_' . $resource['id'] . '\',\'img_' . $resource['id'] . '\')"';
     }
     $return = null;
     if (empty($path)) {
         $return = '<ul class="lp_resource">';
     }
     $return .= '<li class="doc_folder ' . $folder_class_hidden . '" id="doc_id_' . $resource['id'] . '"  style="margin-left:' . $num * 18 . 'px; ">';
     $image = Display::returnIconPath('nolines_plus.gif');
     if (empty($path)) {
         $image = Display::returnIconPath('nolines_minus.gif');
     }
     $return .= '<img style="cursor: pointer;" src="' . $image . '" align="absmiddle" id="img_' . $resource['id'] . '" ' . $onclick . '>';
     $return .= Display::return_icon('lp_folder.gif') . '&nbsp;';
     $return .= '<span ' . $onclick . ' style="cursor: pointer;" >' . $title . '</span>';
     $return .= '</li>';
     if (empty($path)) {
         if ($folderId == false) {
             $return .= '<div id="res_' . $resource['id'] . '" >';
         } else {
             $return .= '<div id="res_' . $resource['id'] . '" style="display: none;" >';
         }
     }
     return $return;
 }
Exemplo n.º 28
0
    $interbreadcrumb[] = array('url' => '#', 'name' => $document_data['title']);
} else {
    foreach ($document_data['parents'] as $document_sub_data) {
        $interbreadcrumb[] = array('url' => $document_sub_data['document_url'], 'name' => $document_sub_data['title']);
    }
}
Display::display_header($nameTools, 'Doc');
echo '<div class="actions">';
echo '<a href="document.php?id=' . $document_id . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('DocumentsOverview'), '', ICON_SIZE_MEDIUM) . '</a>';
echo '</div>';
// pixlr
// max size 1 Mb ??
$title = urlencode(utf8_encode(get_lang('NewImage')));
//TODO:check
//
$image = Display::returnIconPath('canvas1024x768.png');
//
$pixlr_code_translation_table = array('' => 'en', 'pt' => 'pt-Pt', 'sr' => 'sr_latn');
$langpixlr = api_get_language_isocode();
$langpixlr = isset($pixlr_code_translation_table[$langpixlr]) ? $pixlredit_code_translation_table[$langpixlr] : $langpixlr;
$loc = $langpixlr;
// deprecated ?? TODO:check pixlr read user browser
$exit_path = api_get_path(WEB_CODE_PATH) . 'document/exit_pixlr.php';
Session::write('exit_pixlr', $document_data['path']);
$referrer = "Chamilo";
$target_path = api_get_path(WEB_CODE_PATH) . 'document/save_pixlr.php';
$target = $target_path;
$locktarget = "true";
$locktitle = "false";
if ($_SERVER['HTTP_HOST'] == "localhost") {
    $path_and_file = api_get_path(SYS_PATH) . '/crossdomain.xml';
Exemplo n.º 29
0
 /**
  * @author Sebastien Piraux <*****@*****.**>
  * @param period_array : an array provided by hoursTab($sql) or daysTab($sql)
  * @param periodTitle : title of the first column, type of period
  * @param linkOnPeriod :
  * @desc        Display a 4 column array
  * Columns are : hour of day, graph, number of hits and %
  * First line are titles
  * next are informations
  * Last is total number of hits
  */
 public static function makeHitsTable($period_array, $periodTitle, $linkOnPeriod = '???')
 {
     echo "<table width='100%' cellpadding='0' cellspacing='1' border='0' align=center class='minitext'>";
     // titles
     echo "<tr bgcolor='#E6E6E6' align='center'>\n                <td width='15%' >\n                    <b>{$periodTitle}</b>\n                </td>\n                <td width='60%'>\n                    &nbsp;\n                </td>\n                <td width='10%'>\n                    <b>" . get_lang('Hits') . "</b>\n                </td>\n                <td width='15%'>\n                    <b>%</b>\n                </td>\n            </tr>\n        ";
     $factor = 4;
     $maxSize = $factor * 100;
     //pixels
     while (list($periodPiece, $cpt) = each($period_array)) {
         if ($periodPiece != 'total') {
             $pourcent = round(100 * $cpt / $period_array['total']);
             $barwidth = $factor * $pourcent;
             echo "<tr>\n                    <td align='center' width='15%'>";
             echo $periodPiece;
             echo "</td>\n                    <td width='60%' style='padding-top: 3px;' align='center'>" . "<img src='" . Display::returnIconPath('bar_1.gif') . "' width='1' height='12' alt='{$periodPiece} : {$cpt} hits &ndash; {$pourcent} %' />";
             if ($pourcent != 0) {
                 echo "<img src='" . Display::returnIconPath('bar_1u.gif') . "' width='{$barwidth}' height='12' alt='{$periodPiece} : {$cpt} hits &ndash; {$pourcent} %' />";
             }
             // display 100% bar
             if ($pourcent != 100 && $pourcent != 0) {
                 echo "<img src='" . Display::returnIconPath('bar_1m.gif') . "' width='1' height='12' alt='{$periodPiece} : {$cpt} hits &ndash; {$pourcent} %' />";
             }
             if ($pourcent != 100) {
                 echo "<img src='" . Display::returnIconPath('bar_1r.gif') . "' width='" . ($maxSize - $barwidth) . "' height='12' alt='{$periodPiece} : {$cpt} hits &ndash; {$pourcent} %' />";
             }
             echo "<img src='" . Display::returnIconPath('bar_1.gif') . "' width='1' height='12' alt='{$periodPiece} : {$cpt} hits &ndash; {$pourcent} %' />\n                    </td>\n                    <td align='center' width='10%'>\n                        {$cpt}\n                    </td>\n                    <td align='center' width='15%'>\n                        {$pourcent} %\n                    </td>\n                    </tr>\n                ";
         }
     }
     echo "<tr bgcolor='#E6E6E6'>\n                <td width='15%' align='center'>\n                    " . get_lang('Total') . "\n                </td>\n                <td align='right' width='60%'>\n                    &nbsp;\n                </td>\n                <td align='center' width='10%'>\n                    " . $period_array['total'] . "\n                </td>\n                <td width='15%'>\n                    &nbsp;\n                </td>\n            </tr>\n        ";
     echo "</table>";
 }
Exemplo n.º 30
0
/**
 * Display the course catalog image of a course
 * @param $course
 * @param $icon_title
 */
function return_thumbnail($course, $icon_title)
{
    $html = '';
    $title = cut($course['title'], 70);
    // course path
    $course_path = api_get_path(SYS_COURSE_PATH) . $course['directory'];
    if (file_exists($course_path . '/course-pic.png')) {
        $course_medium_image = api_get_path(WEB_COURSE_PATH) . $course['directory'] . '/course-pic.png';
        // redimensioned image 85x85
    } else {
        // without picture
        $course_medium_image = Display::returnIconPath('session_default.png');
    }
    // course image
    $html .= '<div class="items-course-image">';
    if (api_get_setting('course.show_courses_descriptions_in_catalog') == 'true') {
        $html .= '<a class="ajax" href="' . api_get_path(WEB_CODE_PATH) . 'inc/ajax/course_home.ajax.php?a=show_course_information&code=' . $course['code'] . '" title="' . $icon_title . '" rel="gb_page_center[778]">';
        $html .= '<img class="img-responsive" src="' . $course_medium_image . '" alt="' . api_htmlentities($title) . '" />';
        $html .= '</a>';
    } else {
        $html .= '<img class="img-responsive" src="' . $course_medium_image . '" alt="' . api_htmlentities($title) . '"/>';
    }
    $html .= '</div>';
    return $html;
}