コード例 #1
0
ファイル: lib_test.php プロジェクト: danielvdml/moodleyarcho
 public function test_mod_jclic_delete_instance()
 {
     global $DB;
     $this->resetAfterTest(true);
     // Add additional default data (some real attempts and stuff).
     $this->setUser($this->editingteachers[0]);
     $jclic = $this->create_instance();
     // Simulate adding a grade.
     $this->setUser($this->teachers[0]);
     $generator = $this->getDataGenerator()->get_plugin_generator('mod_jclic');
     $generator->grade_jclic($jclic, $this->students[0]->id, array('rawgrade' => 1));
     // Now try and delete.
     $this->assertTrue(jclic_delete_instance($jclic->id));
     $this->assertFalse($DB->record_exists('jclic', array('id' => $jclic->id)));
 }
コード例 #2
0
                $starttime = '-';
            }
            if (!$showall || sizeof($sessions) <= 0) {
                $table_align = $general_align;
                $student_info = print_user_picture($student, $course->id, NULL, 0, true) . $student->firstname . ' ' . $student->lastname;
                jclic_print_row(array($student_info, !$showall ? $starttime : (sizeof($sessions) <= 0 ? '-' : '<b>' . $strtotals . '</b>'), '<b>' . $sessions_summary->done . '</b>', '<b>' . $sessions_summary->solved . '</b>', '<b>' . $sessions_summary->totaltime . '</b>', '<b>' . $sessions_summary->score . ' %</b>', '<b>' . $sessions_summary->attempts . ($jclic->maxattempts > 0 ? '/' . $jclic->maxattempts : '') . '</b>'), $table_align);
            } else {
                $table_align = array('center', 'center', 'center', 'center', 'center', 'center');
                jclic_print_row(array(!$showall ? $starttime : (sizeof($sessions) <= 0 ? '-' : '<b>' . $strtotals . '</b>'), '<b>' . $sessions_summary->done . '</b>', '<b>' . $sessions_summary->solved . '</b>', '<b>' . $sessions_summary->totaltime . '</b>', '<b>' . $sessions_summary->score . ' %</b>', '<b>' . $sessions_summary->attempts . ($jclic->maxattempts > 0 ? '/' . $jclic->maxattempts : '') . '</b>'), $table_align);
            }
        }
    }
    echo '</tbody></table><br>';
    $delid = optional_param('delete', PARAM_INT);
    if (isset($delid)) {
        jclic_delete_instance($delid);
    }
} else {
    $protocol = !empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443 ? "https" : "http";
    echo "<script language=\"JavaScript\" src=\"{$CFG->jclic_jclicpluginjs}\" type=\"text/javascript\"></script>";
    echo '<br><A href="#" onclick="window.open(\'action/student_results.php?id=' . $id . '\',\'JClic\',\'navigation=0,toolbar=0,resizable=1,scrollbars=1,width=700,height=400\');" >' . $strshow_results . '</A>';
    $sessions = jclic_get_sessions($jclic->id, $USER->id);
    $attempts = sizeof($sessions);
    if ($jclic->maxattempts < 0 || $attempts < $jclic->maxattempts) {
        //$jclic_url = (substr($jclic->url, 0, 4)=='http')?$jclic->url:'http://'.jclic_get_server().jclic_get_path().'/file.php/'.$course->id.'/'.$jclic->url;
        echo '<div style="text-align:center;padding-top:10px;">';
        echo '<script language="JavaScript">';
        //echo "setJarBase('./dist');";
        echo "setReporter('TCPReporter','path=" . jclic_get_server() . ";service=" . jclic_get_path() . "/mod/jclic/action/beans.php;user={$USER->id};key={$jclic->id};lap={$CFG->jclic_lap};protocol={$protocol}');";
        echo "setSkin('{$jclic->skin}');";
        echo "setLanguage('{$jclic->lang}');";