123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277 |
- <?php
- global $CFG, $USER, $PAGE, $OUTPUT, $DB;
- require_once("../../config.php");
- require_once($CFG->dirroot . '/mod/nasatlx/locallib.php');
- require_login();
- if (isguestuser()) {
- die();
- }
- $nasa_id = optional_param('nasa_id', 0, PARAM_INT);
- $action = optional_param('action', NULL, PARAM_TEXT);
- $url = new moodle_url('/admin/settings.php', array('section' => 'modsettingnasatlx'));
- $contextuser = context_user::instance($USER->id);
- $PAGE->set_url($url);
- $PAGE->set_context($contextuser);
- $PAGE->blocks->show_only_fake_blocks();
- $PAGE->set_pagelayout('popup');
- if ($action == 'export') {
-
- $title = get_string('export_all_nasatlx', 'nasatlx') . $OUTPUT->help_icon('export_all_nasatlx', 'nasatlx');
- $PAGE->set_title($title);
-
- print($OUTPUT->header());
- print($OUTPUT->heading($title));
- print " <style>\n " .
- " th.c { border: 1px solid #aaa; padding: 5px 10px; background-color: #6a9ada; } " .
- " th { border: 1px solid #aaa; padding: 5px 10px; background-color: #5a8aca; } " .
- " .td1l { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeeefe; text-align:left} " .
- " .td1r { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeeefe; text-align:right} " .
- " .td2l { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeefee; text-align:left} " .
- " .td2r { border: 1px solid #aaa; padding: 5px 10px; background-color: #eeefee; text-align:right}\n" .
- " </style>\n";
-
-
-
- $query1 = "SELECT n.*, c.id AS courseid, c.fullname FROM {nasatlx} n, {course} c WHERE c.id = n.course";
-
- $nasatlx_quest = $DB->get_records_sql($query1);
-
- if (!$nasatlx_quest)
- print get_string('list_all_nasatlx_empty', 'nasatlx') . "<br/>\n";
- else {
-
-
-
-
-
-
-
- print " <table class='nicetable'>\n";
- $count1 = 0;
- foreach ($nasatlx_quest as $item_nasa_quest) {
- $nasa_id = $item_nasa_quest->id;
- print " <tr class='td1l'><th class='c' title='course id'>". $item_nasa_quest->courseid . "</th><th class='c' title='course fullname' colspan='24'>" . $item_nasa_quest->fullname . "</th></tr>\n";
- print " <tr class='td2l'><th class='c' title='nasatlx id'>". $item_nasa_quest->id . "</th><th class='c' title='nasatlx name' colspan='24'>" . $item_nasa_quest->name . "</th></tr>\n";
-
-
- $query2 = "SELECT r.* FROM {nasatlx_resps} r, {course_modules} cm, {nasatlx} tlx WHERE " .
- "r.cmid=cm.id AND cm.instance=tlx.id AND tlx.id = " . $nasa_id;
- $nasatlx_answers = $DB->get_records_sql($query2);
- if (!$nasatlx_quest)
- print get_string('list_all_nasatlx_ans_empty', 'nasatlx') . "<br/r>\n";
- else {
-
-
- print " <tr>\n";
- print " <th>id</th><th>scale1</th><th>scale2</th><th>scale3</th><th>scale4</th><th>scale5</th><th>scale6</th>\n" .
- " <th>calc1</th><th>calc2</th><th>calc3</th><th>calc4</th><th>calc5</th><th>calc6</th>\n";
- print " <th>peso1</th><th>peso2</th><th>peso3</th><th>peso4</th><th>peso5</th><th>peso6</th>\n" .
- " <th>pares</th><th>cmid</th><th>course</th><th>user</th><th>created</th></tr>\n";
- $count2 = 0;
- foreach ($nasatlx_answers as $answer) {
- print " <tr>\n";
-
- foreach ($answer as $nvalue) {
- $count2++;
- if ($count1 % 2 == 0) {
- if ($count2 < 12) print "<td class='td1r'>" . $nvalue . "</td>";
- else print "<td class='td1l'>" . $nvalue . "</td>";
- }
- else {
- if ($count2 < 12) print "<td class='td2r'>" . $nvalue . "</td>";
- else print "<td class='td2l'>" . $nvalue . "</td>";
- }
- $count1++;
- }
- print " </tr>\n";
- }
-
- }
- }
- print " </table>\n";
- }
- print "<br/><b>Total respostas: $count1<b><br/>\n";
- print($OUTPUT->footer());
- die;
- }
|