示例#1
0
     $actions .= '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
     // if active
     if ($active) {
         $nbrActiveTests = $nbrActiveTests + 1;
         $actions .= '      <a href="' . $exercisePath . '?' . api_get_cidreq() . '&hpchoice=disable&page=' . $page . '&file=' . $path . '">' . Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL) . '</a>';
     } else {
         // else if not active
         $actions .= '    <a href="' . $exercisePath . '?' . api_get_cidreq() . '&hpchoice=enable&page=' . $page . '&file=' . $path . '">' . Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL) . '</a>';
     }
     $actions .= '<a href="' . $exercisePath . '?' . api_get_cidreq() . '&hpchoice=delete&file=' . $path . '" onclick="javascript:if(!confirm(\'' . addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset) . ' ' . $title . "?") . '\')) return false;">' . Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
     $item .= Display::tag('td', $actions);
     $tableRows[] = Display::tag('tr', $item);
 } else {
     // Student only
     if ($active == 1) {
         $attempt = ExerciseLib::getLatestHotPotatoResult($path, $userId, api_get_course_int_id(), api_get_session_id());
         $nbrActiveTests = $nbrActiveTests + 1;
         $item .= Display::tag('td', '<a href="showinframes.php?' . api_get_cidreq() . '&file=' . $path . '&cid=' . api_get_course_id() . '&uid=' . $userId . '" ' . (!$active ? 'class="invisible"' : '') . ' >' . $title . '</a>');
         if (!empty($attempt)) {
             $actions = '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '&filter_by_user='******'">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
             $attemptText = get_lang('LatestAttempt') . ' : ';
             $attemptText .= ExerciseLib::show_score($attempt['exe_result'], $attempt['exe_weighting']) . ' ';
             $attemptText .= $actions;
         } else {
             // No attempts.
             $attemptText = get_lang('NotAttempted') . ' ';
         }
         $item .= Display::tag('td', $attemptText);
         if ($isDrhOfCourse) {
             $actions = '<a href="hotpotatoes_exercise_report.php?' . api_get_cidreq() . '&path=' . $path . '">' . Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL) . '</a>';
             $item .= Display::tag('td', $actions, array('class' => 'td_actions'));