dirroot . '/mod/nasatlx/locallib.php'); //DDD require_once($CFG->dirroot . '/mod/nasatlx/settings_form.php'); require_login(); if (isguestuser()) { die(); } //Parameters GET e POST (parâmetros GET e POST) $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')); //$from = optional_param('from', NULL, PARAM_TEXT); //$status = optional_param('status', 0, PARAM_INT); $contextuser = context_user::instance($USER->id); $PAGE->set_url($url); $PAGE->set_context($contextuser); $PAGE->blocks->show_only_fake_blocks(); // $PAGE->set_pagelayout('popup'); //D echo "settings_nasatlx_line.php: 5 action=$action
\n"; if ($action == 'export') { // echo "Export not yet implemented
\n"; $title = get_string('export_all_nasatlx', 'nasatlx') . $OUTPUT->help_icon('export_all_nasatlx', 'nasatlx'); $PAGE->set_title($title); // print($OUTPUT->notification(get_string('error_upload_ilm', 'nasatlx'), 'notifyproblem')); print($OUTPUT->header()); print($OUTPUT->heading($title)); print " \n"; // Tables: 'nasatlx' (id, course, name, intro, timecreated, timemodified), 'course' (id, fullname) // SELECT m_nasatlx_resps.id, m_nasatlx_resps.cmid, m_nasatlx_resps.course, m_nasatlx_resps.user FROM m_course_modules, m_nasatlx, m_nasatlx_resps // WHERE m_nasatlx_resps.cmid=m_course_modules.id AND m_course_modules.instance=m_nasatlx.id AND m_nasatlx.id = 1; $query1 = "SELECT n.*, c.id AS courseid, c.fullname FROM {nasatlx} n, {course} c WHERE c.id = n.course"; //D echo "$query1
"; $nasatlx_quest = $DB->get_records_sql($query1); // *_nasatlx = id, course, name, intro, timecreated, timemodified // foreach ($nasatlx_quest as $nasa_item) echo " * " . $nasa_item->id . ", " . $nasa_item->course . ", " . $nasa_item->name . ", " . $nasa_item->intro . "
"; if (!$nasatlx_quest) print get_string('list_all_nasatlx_empty', 'nasatlx') . "
\n"; else { // There are NASA questionnaires // $nasatlx_quest = Array ( [1] => stdClass Object ( [id] => 1 [course] => 2 [name] => Title questionnaire NASA-TLX/LInE [intro] => Text... [introformat] => 1 [timecreated] => 1551989761 [timemodified] => 0 [courseid] => 2 [fullname] => Curso teste ) ) //_ foreach ($nasatlx_quest as $item_nasa_quest) { // usually array[1] //_ print " \n"; //_ print " \n"; //_ print " \n"; //_ } //_ print "
". $item_nasa_quest->courseid . "" . $item_nasa_quest->fullname . "
". $item_nasa_quest->id . "" . $item_nasa_quest->name . "
\n
\n"; print " \n"; $count1 = 0; foreach ($nasatlx_quest as $item_nasa_quest) { // select all answer to the questionnaire $item_nasa_quest $nasa_id = $item_nasa_quest->id; print " \n"; print " \n"; // See tables: nasatlx_resps, nasatlx, course_modules, course // $query_str = "SELECT s.id, s.name, s.dependency FROM {iassign_statement} s WHERE s.iassignid = :iassignid ORDER BY s.position ASC"; $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') . "
\n"; else { // *_nasatlx : id scale1 scale2 scale3 scale4 scale5 calc1 calc2 calc3 calc4 calc5 peso1 peso2 peso3 peso4 peso5 cmid course user created // print " \n"; print " \n"; print " \n" . " \n"; print " \n" . " \n"; $count2 = 0; foreach ($nasatlx_answers as $answer) { // fields : id scale1 scale2 scale3 scale4 scale5 calc1 calc2 calc3 calc4 calc5 peso1 peso2 peso3 peso4 peso5 cmid course user created print " \n"; //D if ($count1==0) { echo "answer: "; print_r($answer); echo "
"; } foreach ($answer as $nvalue) { // turn the object in array (or use 'foreach ($answer as $nkey=>$nvalue)') $count2++; if ($count1 % 2 == 0) { if ($count2 < 12) print ""; else print ""; } else { if ($count2 < 12) print ""; else print ""; } $count1++; } // foreach ($answer as $nvalue) print " \n"; } // foreach ($nasatlx_answers as $answer) // $nasatlx_answers = $DB->get_records_sql($query2); } } // foreach ($nasatlx_quest as $item_nasa_quest) print "
". $item_nasa_quest->courseid . "" . $item_nasa_quest->fullname . "
". $item_nasa_quest->id . "" . $item_nasa_quest->name . "
". $item_nasa_quest->id . "" . $item_nasa_quest->name . "
idscale1scale2scale3scale4scale5scale6calc1calc2calc3calc4calc5calc6peso1peso2peso3peso4peso5peso6parescmidcourseusercreated
" . $nvalue . "" . $nvalue . "" . $nvalue . "" . $nvalue . "
\n"; } // else if (!$nasatlx_quest) print "
Total respostas: $count1
\n"; print($OUTPUT->footer()); die; } // if ($action == 'export') /* else if ($action == 'edit') { // Edit data of an NASA-TLX/LInE => processed in 'settings_form.php' print "Edit not yet implemented
\n"; //_ $title = get_string('edit_nasa_item', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx'); //_ $PAGE->set_title($title); //_ $param = ilm_settings::add_edit_copy_nasa_item($nasa_id, $action); //_ $description = $param->description_lang; // used to present the NASA-TLX/LInE description in 'settings_form.php' - {"en":"...","pt":"..."} //_ $mform = new mod_ilm_form($param); // in 'settings_form.php': class mod_ilm_form //_ $mform->set_data($param); //_ if ($mform->is_cancelled()) { //_ close_window(); //_ die; //_ } //_ else if ($formdata = $mform->get_submitted_data()) { //_ ilm_settings::edit_nasa_item($formdata, $formdata->file); //_ close_window(0, true); //_ die; //_ } //_ print($OUTPUT->header()); //_ print($OUTPUT->heading($title)); //_ $mform->display(); //_ print($OUTPUT->footer()); //_ die; } else if ($action == 'copy') { print "Copy not yet implemented
\n"; //_ $title = get_string('copy_nasa_item', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx'); //_ $PAGE->set_title($title); //_ $param = ilm_settings::add_edit_copy_nasa_item($nasa_id, $action); //_ $mform = new mod_ilm_form(); //_ $mform->set_data($param); //_ if ($mform->is_cancelled()) { //_ close_window(); //_ die; //_ } //_ else if ($formdata = $mform->get_data()) { //_ ilm_settings::copy_new_version_ilm($formdata); //_ close_window(0, true); //_ die; //_ } //_ print($OUTPUT->header()); //_ print($OUTPUT->heading($title)); //_ $mform->display(); //_ print($OUTPUT->footer()); //_ die; } else if ($action == 'confirm_remove_nasa_item') { print "Remove not yet implemented
\n"; //_ $title = get_string('remove_nasa_item', 'nasatlx'); //_ $PAGE->set_title($title); //_ $PAGE->set_pagelayout('base'); //_ $remove_nasa_item = ilm_settings::confirm_remove_nasa_item($nasa_id, $ilm_parent); //_ print($OUTPUT->header()); //_ print($OUTPUT->heading($title)); //_ print($remove_nasa_item); //_ print($OUTPUT->footer()); //_ die; //_ } else if ($action == 'remove') { print "Remove not yet implemented
\n"; //_ $title = get_string('remove_nasa_item', 'nasatlx'); //_ $PAGE->set_title($title); //_ $PAGE->set_pagelayout('redirect'); //_ $parent = ilm_settings::remove_nasa_item($nasa_id); //_ if ($parent == null) { //_ $title = get_string('remove_nasa_item', 'nasatlx'); //_ $PAGE->set_title($title); //_ $PAGE->set_pagelayout('base'); //_ $remove_nasa_item = ilm_settings::confirm_remove_nasa_item($nasa_id, $ilm_parent); //_ print($OUTPUT->header()); //_ print($OUTPUT->heading($title)); //_ print($OUTPUT->notification(get_string('error_folder_permission_denied', 'nasatlx'), 'notifyproblem')); //_ print($remove_nasa_item); //_ print($OUTPUT->footer()); //_ die; //_ } //_ if ($parent == 0) //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'view'))); //_ else //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm_parent))); //_ } else if ($action == 'default') { //_ $title = get_string('default_ilm', 'nasatlx'); //_ $PAGE->set_title($title); //_ $PAGE->set_pagelayout('redirect'); //_ ilm_settings::default_ilm($nasa_id); //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm_parent))); } else if ($action == 'list') { //_ $title = get_string('list_ilm', 'nasatlx'); //_ $PAGE->set_title($title); //_ $list_ilm = ilm_settings::list_ilm(); //_ print($OUTPUT->header()); //_ print($OUTPUT->heading($title . $OUTPUT->help_icon('list_ilm', 'nasatlx'))); //_ print($list_ilm); //_ print($OUTPUT->footer()); //_ die; } else if ($action == 'upgrade') { //_ $title = get_string('upgrade_ilm_title', 'nasatlx'); //_ $PAGE->set_title($title); //_ $PAGE->set_pagelayout('redirect'); //_ $ilm = ilm_settings::upgrade_ilm($nasa_id); //_ if ($ilm == 0) //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'view'))); //_ else //_ redirect(new moodle_url('/admin/settings.php?', array('section' => 'modsettingnasatlx', 'action' => 'config', 'nasa_id' => $ilm))); } else if ($action == 'view') { $nasatlx_ilm = $DB->get_record('nasatlx_ilm', array('id' => $nasa_id)); $title = get_string('view_ilm', 'nasatlx') . $OUTPUT->help_icon('add_ilm_nasatlx', 'nasatlx'); $PAGE->set_title($title . ': ' . $nasatlx_ilm->name . ' ' . $nasatlx_ilm->version); $view_ilm = ilm_settings::view_ilm($nasa_id, $from); print($OUTPUT->header()); print($OUTPUT->heading($title . ': ' . $nasatlx_ilm->name . ' ' . $nasatlx_ilm->version)); print($view_ilm); print($OUTPUT->footer()); die; } */