|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00003 // This file is part of Moodle - http://moodle.org/ 00004 // 00005 // Moodle is free software: you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation, either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // Moodle is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00017 00028 global $SURVEY_GHEIGHT; 00029 $SURVEY_GHEIGHT = 500; 00034 global $SURVEY_GWIDTH; 00035 $SURVEY_GWIDTH = 900; 00040 global $SURVEY_QTYPE; 00041 $SURVEY_QTYPE = array ( 00042 "-3" => "Virtual Actual and Preferred", 00043 "-2" => "Virtual Preferred", 00044 "-1" => "Virtual Actual", 00045 "0" => "Text", 00046 "1" => "Actual", 00047 "2" => "Preferred", 00048 "3" => "Actual and Preferred", 00049 ); 00050 00051 00052 define("SURVEY_COLLES_ACTUAL", "1"); 00053 define("SURVEY_COLLES_PREFERRED", "2"); 00054 define("SURVEY_COLLES_PREFERRED_ACTUAL", "3"); 00055 define("SURVEY_ATTLS", "4"); 00056 define("SURVEY_CIQ", "5"); 00057 00058 00059 // STANDARD FUNCTIONS //////////////////////////////////////////////////////// 00070 function survey_add_instance($survey) { 00071 global $DB; 00072 00073 if (!$template = $DB->get_record("survey", array("id"=>$survey->template))) { 00074 return 0; 00075 } 00076 00077 $survey->questions = $template->questions; 00078 $survey->timecreated = time(); 00079 $survey->timemodified = $survey->timecreated; 00080 00081 return $DB->insert_record("survey", $survey); 00082 00083 } 00084 00094 function survey_update_instance($survey) { 00095 global $DB; 00096 00097 if (!$template = $DB->get_record("survey", array("id"=>$survey->template))) { 00098 return 0; 00099 } 00100 00101 $survey->id = $survey->instance; 00102 $survey->questions = $template->questions; 00103 $survey->timemodified = time(); 00104 00105 return $DB->update_record("survey", $survey); 00106 } 00107 00117 function survey_delete_instance($id) { 00118 global $DB; 00119 00120 if (! $survey = $DB->get_record("survey", array("id"=>$id))) { 00121 return false; 00122 } 00123 00124 $result = true; 00125 00126 if (! $DB->delete_records("survey_analysis", array("survey"=>$survey->id))) { 00127 $result = false; 00128 } 00129 00130 if (! $DB->delete_records("survey_answers", array("survey"=>$survey->id))) { 00131 $result = false; 00132 } 00133 00134 if (! $DB->delete_records("survey", array("id"=>$survey->id))) { 00135 $result = false; 00136 } 00137 00138 return $result; 00139 } 00140 00149 function survey_user_outline($course, $user, $mod, $survey) { 00150 global $DB; 00151 00152 if ($answers = $DB->get_records("survey_answers", array('survey'=>$survey->id, 'userid'=>$user->id))) { 00153 $lastanswer = array_pop($answers); 00154 00155 $result = new stdClass(); 00156 $result->info = get_string("done", "survey"); 00157 $result->time = $lastanswer->time; 00158 return $result; 00159 } 00160 return NULL; 00161 } 00162 00172 function survey_user_complete($course, $user, $mod, $survey) { 00173 global $CFG, $DB, $OUTPUT; 00174 00175 if (survey_already_done($survey->id, $user->id)) { 00176 if ($survey->template == SURVEY_CIQ) { // print out answers for critical incidents 00177 $table = new html_table(); 00178 $table->align = array("left", "left"); 00179 00180 $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions)); 00181 $questionorder = explode(",", $survey->questions); 00182 00183 foreach ($questionorder as $key=>$val) { 00184 $question = $questions[$val]; 00185 $questiontext = get_string($question->shorttext, "survey"); 00186 00187 if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) { 00188 $answertext = "$answer->answer1"; 00189 } else { 00190 $answertext = "No answer"; 00191 } 00192 $table->data[] = array("<b>$questiontext</b>", $answertext); 00193 } 00194 echo html_writer::table($table); 00195 00196 } else { 00197 00198 survey_print_graph("id=$mod->id&sid=$user->id&type=student.png"); 00199 } 00200 00201 } else { 00202 print_string("notdone", "survey"); 00203 } 00204 } 00205 00214 function survey_print_recent_activity($course, $viewfullnames, $timestart) { 00215 global $CFG, $DB, $OUTPUT; 00216 00217 $modinfo = get_fast_modinfo($course); 00218 $ids = array(); 00219 foreach ($modinfo->cms as $cm) { 00220 if ($cm->modname != 'survey') { 00221 continue; 00222 } 00223 if (!$cm->uservisible) { 00224 continue; 00225 } 00226 $ids[$cm->instance] = $cm->instance; 00227 } 00228 00229 if (!$ids) { 00230 return false; 00231 } 00232 00233 $slist = implode(',', $ids); // there should not be hundreds of glossaries in one course, right? 00234 00235 $rs = $DB->get_recordset_sql("SELECT sa.userid, sa.survey, MAX(sa.time) AS time, 00236 u.firstname, u.lastname, u.email, u.picture 00237 FROM {survey_answers} sa 00238 JOIN {user} u ON u.id = sa.userid 00239 WHERE sa.survey IN ($slist) AND sa.time > ? 00240 GROUP BY sa.userid, sa.survey, u.firstname, u.lastname, u.email, u.picture 00241 ORDER BY time ASC", array($timestart)); 00242 if (!$rs->valid()) { 00243 $rs->close(); // Not going to iterate (but exit), close rs 00244 return false; 00245 } 00246 00247 $surveys = array(); 00248 00249 foreach ($rs as $survey) { 00250 $cm = $modinfo->instances['survey'][$survey->survey]; 00251 $survey->name = $cm->name; 00252 $survey->cmid = $cm->id; 00253 $surveys[] = $survey; 00254 } 00255 $rs->close(); 00256 00257 if (!$surveys) { 00258 return false; 00259 } 00260 00261 echo $OUTPUT->heading(get_string('newsurveyresponses', 'survey').':'); 00262 foreach ($surveys as $survey) { 00263 $url = $CFG->wwwroot.'/mod/survey/view.php?id='.$survey->cmid; 00264 print_recent_activity_note($survey->time, $survey, $survey->name, $url, false, $viewfullnames); 00265 } 00266 00267 return true; 00268 } 00269 00279 function survey_get_participants($surveyid) { 00280 global $DB; 00281 00282 //Get students from survey_analysis 00283 $st_analysis = $DB->get_records_sql("SELECT DISTINCT u.id, u.id 00284 FROM {user} u, {survey_analysis} a 00285 WHERE a.survey = ? AND 00286 u.id = a.userid", array($surveyid)); 00287 //Get students from survey_answers 00288 $st_answers = $DB->get_records_sql("SELECT DISTINCT u.id, u.id 00289 FROM {user} u, {survey_answers} a 00290 WHERE a.survey = ? AND 00291 u.id = a.userid", array($surveyid)); 00292 00293 //Add st_answers to st_analysis 00294 if ($st_answers) { 00295 foreach ($st_answers as $st_answer) { 00296 $st_analysis[$st_answer->id] = $st_answer; 00297 } 00298 } 00299 //Return st_analysis array (it contains an array of unique users) 00300 return ($st_analysis); 00301 } 00302 00303 // SQL FUNCTIONS //////////////////////////////////////////////////////// 00304 00310 function survey_log_info($log) { 00311 global $DB; 00312 return $DB->get_record_sql("SELECT s.name, u.firstname, u.lastname, u.picture 00313 FROM {survey} s, {user} u 00314 WHERE s.id = ? AND u.id = ?", array($log->info, $log->userid)); 00315 } 00316 00324 function survey_get_responses($surveyid, $groupid, $groupingid) { 00325 global $DB; 00326 00327 $params = array('surveyid'=>$surveyid, 'groupid'=>$groupid, 'groupingid'=>$groupingid); 00328 00329 if ($groupid) { 00330 $groupsjoin = "JOIN {groups_members} gm ON u.id = gm.userid AND gm.groupid = :groupid "; 00331 00332 } else if ($groupingid) { 00333 $groupsjoin = "JOIN {groups_members} gm ON u.id = gm.userid 00334 JOIN {groupings_groups} gg ON gm.groupid = gg.groupid AND gg.groupingid = :groupingid "; 00335 } else { 00336 $groupsjoin = ""; 00337 } 00338 00339 $userfields = user_picture::fields('u'); 00340 return $DB->get_records_sql("SELECT $userfields, MAX(a.time) as time 00341 FROM {survey_answers} a 00342 JOIN {user} u ON a.userid = u.id 00343 $groupsjoin 00344 WHERE a.survey = :surveyid 00345 GROUP BY $userfields 00346 ORDER BY time ASC", $params); 00347 } 00348 00355 function survey_get_analysis($survey, $user) { 00356 global $DB; 00357 00358 return $DB->get_record_sql("SELECT notes 00359 FROM {survey_analysis} 00360 WHERE survey=? AND userid=?", array($survey, $user)); 00361 } 00362 00369 function survey_update_analysis($survey, $user, $notes) { 00370 global $DB; 00371 00372 return $DB->execute("UPDATE {survey_analysis} 00373 SET notes=? 00374 WHERE survey=? 00375 AND userid=?", array($notes, $survey, $user)); 00376 } 00377 00385 function survey_get_user_answers($surveyid, $questionid, $groupid, $sort="sa.answer1,sa.answer2 ASC") { 00386 global $DB; 00387 00388 $params = array('surveyid'=>$surveyid, 'questionid'=>$questionid); 00389 00390 if ($groupid) { 00391 $groupfrom = ', {groups_members} gm'; 00392 $groupsql = 'AND gm.groupid = :groupid AND u.id = gm.userid'; 00393 $params['groupid'] = $groupid; 00394 } else { 00395 $groupfrom = ''; 00396 $groupsql = ''; 00397 } 00398 00399 $userfields = user_picture::fields('u'); 00400 return $DB->get_records_sql("SELECT sa.*, $userfields 00401 FROM {survey_answers} sa, {user} u $groupfrom 00402 WHERE sa.survey = :surveyid 00403 AND sa.question = :questionid 00404 AND u.id = sa.userid $groupsql 00405 ORDER BY $sort", $params); 00406 } 00407 00415 function survey_get_user_answer($surveyid, $questionid, $userid) { 00416 global $DB; 00417 00418 return $DB->get_record_sql("SELECT sa.* 00419 FROM {survey_answers} sa 00420 WHERE sa.survey = ? 00421 AND sa.question = ? 00422 AND sa.userid = ?", array($surveyid, $questionid, $userid)); 00423 } 00424 00425 // MODULE FUNCTIONS //////////////////////////////////////////////////////// 00433 function survey_add_analysis($survey, $user, $notes) { 00434 global $DB; 00435 00436 $record = new stdClass(); 00437 $record->survey = $survey; 00438 $record->userid = $user; 00439 $record->notes = $notes; 00440 00441 return $DB->insert_record("survey_analysis", $record, false); 00442 } 00449 function survey_already_done($survey, $user) { 00450 global $DB; 00451 00452 return $DB->record_exists("survey_answers", array("survey"=>$survey, "userid"=>$user)); 00453 } 00460 function survey_count_responses($surveyid, $groupid, $groupingid) { 00461 if ($responses = survey_get_responses($surveyid, $groupid, $groupingid)) { 00462 return count($responses); 00463 } else { 00464 return 0; 00465 } 00466 } 00467 00473 function survey_print_all_responses($cmid, $results, $courseid) { 00474 global $OUTPUT; 00475 $table = new html_table(); 00476 $table->head = array ("", get_string("name"), get_string("time")); 00477 $table->align = array ("", "left", "left"); 00478 $table->size = array (35, "", "" ); 00479 00480 foreach ($results as $a) { 00481 $table->data[] = array($OUTPUT->user_picture($a, array('courseid'=>$courseid)), 00482 html_writer::link("report.php?action=student&student=$a->id&id=$cmid", fullname($a)), 00483 userdate($a->time)); 00484 } 00485 00486 echo html_writer::table($table); 00487 } 00488 00494 function survey_get_template_name($templateid) { 00495 global $DB; 00496 00497 if ($templateid) { 00498 if ($ss = $DB->get_record("surveys", array("id"=>$templateid))) { 00499 return $ss->name; 00500 } 00501 } else { 00502 return ""; 00503 } 00504 } 00505 00506 00512 function survey_shorten_name ($name, $numwords) { 00513 $words = explode(" ", $name); 00514 $output = ''; 00515 for ($i=0; $i < $numwords; $i++) { 00516 $output .= $words[$i]." "; 00517 } 00518 return $output; 00519 } 00520 00531 function survey_print_multi($question) { 00532 global $USER, $DB, $qnum, $checklist, $DB, $OUTPUT; //TODO: this is sloppy globals abuse 00533 00534 $stripreferthat = get_string("ipreferthat", "survey"); 00535 $strifoundthat = get_string("ifoundthat", "survey"); 00536 $strdefault = get_string('notyetanswered', 'survey'); 00537 $strresponses = get_string('responses', 'survey'); 00538 00539 echo $OUTPUT->heading($question->text, 3, 'questiontext'); 00540 echo "\n<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\" class=\"surveytable\">"; 00541 00542 $options = explode( ",", $question->options); 00543 $numoptions = count($options); 00544 00545 $oneanswer = ($question->type == 1 || $question->type == 2) ? true : false; 00546 00547 echo "<tr class=\"smalltext\"><th scope=\"row\">$strresponses</th>"; 00548 echo "<th scope=\"col\" class=\"hresponse\">". get_string('notyetanswered', 'survey'). "</th>"; 00549 while (list ($key, $val) = each ($options)) { 00550 echo "<th scope=\"col\" class=\"hresponse\">$val</th>\n"; 00551 } 00552 echo "</tr>\n"; 00553 00554 if ($oneanswer) { 00555 echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n"; 00556 } else { 00557 echo "<tr><th scope=\"col\" colspan=\"7\">$question->intro</th></tr>\n"; 00558 } 00559 00560 $subquestions = $DB->get_records_list("survey_questions", "id", explode(',', $question->multi)); 00561 00562 foreach ($subquestions as $q) { 00563 $qnum++; 00564 $rowclass = survey_question_rowclass($qnum); 00565 if ($q->text) { 00566 $q->text = get_string($q->text, "survey"); 00567 } 00568 00569 $oneanswer = ($q->type == 1 || $q->type == 2) ? true : false; 00570 if ($q->type == 2) { 00571 $P = "P"; 00572 } else { 00573 $P = ""; 00574 } 00575 00576 echo "<tr class=\"$rowclass rblock\">"; 00577 if ($oneanswer) { 00578 echo "<th scope=\"row\" class=\"optioncell\">"; 00579 echo "<b class=\"qnumtopcell\">$qnum</b> "; 00580 echo $q->text ."</th>\n"; 00581 00582 $default = get_accesshide($strdefault); 00583 echo "<td class=\"whitecell\"><label for=\"q$P$q->id\"><input type=\"radio\" name=\"q$P$q->id\" id=\"q$P" . $q->id . "_D\" value=\"0\" checked=\"checked\" />$default</label></td>"; 00584 00585 for ($i=1;$i<=$numoptions;$i++) { 00586 $hiddentext = get_accesshide($options[$i-1]); 00587 $id = "q$P" . $q->id . "_$i"; 00588 echo "<td><label for=\"$id\"><input type=\"radio\" name=\"q$P$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>"; 00589 } 00590 $checklist["q$P$q->id"] = 0; 00591 00592 } else { 00593 // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly. 00594 echo "<th scope=\"row\" class=\"optioncell\">"; 00595 echo "<b class=\"qnumtopcell\">$qnum</b> "; 00596 $qnum++; 00597 echo "<span class=\"preferthat smalltext\">$stripreferthat</span> "; 00598 echo "<span class=\"option\">$q->text</span></th>\n"; 00599 00600 $default = get_accesshide($strdefault); 00601 echo '<td class="whitecell"><label for="qP'. $P.$q->id .'"><input type="radio" name="qP'.$P.$q->id. '" id="qP'. $q->id .'" value="0" checked="checked" />'.$default.'</label></td>'; 00602 00603 00604 for ($i=1;$i<=$numoptions;$i++) { 00605 $hiddentext = get_accesshide($options[$i-1]); 00606 $id = "qP" . $q->id . "_$i"; 00607 echo "<td><label for=\"$id\"><input type=\"radio\" name=\"qP$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>"; 00608 } 00609 echo "</tr>"; 00610 00611 echo "<tr class=\"$rowclass rblock\">"; 00612 echo "<th scope=\"row\" class=\"optioncell\">"; 00613 echo "<b class=\"qnumtopcell\">$qnum</b> "; 00614 echo "<span class=\"foundthat smalltext\">$strifoundthat</span> "; 00615 echo "<span class=\"option\">$q->text</span></th>\n"; 00616 00617 $default = get_accesshide($strdefault); 00618 echo '<td class="whitecell"><label for="q'. $q->id .'"><input type="radio" name="q'.$q->id. '" id="q'. $q->id .'" value="0" checked="checked" />'.$default.'</label></td>'; 00619 00620 for ($i=1;$i<=$numoptions;$i++) { 00621 $hiddentext = get_accesshide($options[$i-1]); 00622 $id = "q" . $q->id . "_$i"; 00623 echo "<td><label for=\"$id\"><input type=\"radio\" name=\"q$q->id\" id=\"$id\" value=\"$i\" />$hiddentext</label></td>"; 00624 } 00625 00626 $checklist["qP$q->id"] = 0; 00627 $checklist["q$q->id"] = 0; 00628 } 00629 echo "</tr>\n"; 00630 } 00631 echo "</table>"; 00632 } 00633 00634 00640 function survey_print_single($question) { 00641 global $DB, $qnum, $OUTPUT; 00642 00643 $rowclass = survey_question_rowclass(0); 00644 00645 $qnum++; 00646 00647 echo "<br />\n"; 00648 echo "<table width=\"90%\" cellpadding=\"4\" cellspacing=\"0\">\n"; 00649 echo "<tr class=\"$rowclass\">"; 00650 echo "<th scope=\"row\" class=\"optioncell\"><label for=\"q$question->id\"><b class=\"qnumtopcell\">$qnum</b> "; 00651 echo "<span class=\"questioncell\">$question->text</span></label></th>\n"; 00652 echo "<td class=\"questioncell smalltext\">\n"; 00653 00654 00655 if ($question->type == 0) { // Plain text field 00656 echo "<textarea rows=\"3\" cols=\"30\" name=\"q$question->id\" id=\"q$question->id\">$question->options</textarea>"; 00657 00658 } else if ($question->type > 0) { // Choose one of a number 00659 $strchoose = get_string("choose"); 00660 echo "<select name=\"q$question->id\" id=\"q$question->id\">"; 00661 echo "<option value=\"0\" selected=\"selected\">$strchoose...</option>"; 00662 $options = explode( ",", $question->options); 00663 foreach ($options as $key => $val) { 00664 $key++; 00665 echo "<option value=\"$key\">$val</option>"; 00666 } 00667 echo "</select>"; 00668 00669 } else if ($question->type < 0) { // Choose several of a number 00670 $options = explode( ",", $question->options); 00671 echo $OUTPUT->notification("This question type not supported yet"); 00672 } 00673 00674 echo "</td></tr></table>"; 00675 00676 } 00677 00683 function survey_question_rowclass($qnum) { 00684 00685 if ($qnum) { 00686 return $qnum % 2 ? 'r0' : 'r1'; 00687 } else { 00688 return 'r0'; 00689 } 00690 } 00691 00698 function survey_print_graph($url) { 00699 global $CFG, $SURVEY_GHEIGHT, $SURVEY_GWIDTH; 00700 00701 if (empty($CFG->gdversion)) { 00702 echo "(".get_string("gdneed").")"; 00703 00704 } else { 00705 echo "<img class='resultgraph' height=\"$SURVEY_GHEIGHT\" width=\"$SURVEY_GWIDTH\"". 00706 " src=\"$CFG->wwwroot/mod/survey/graph.php?$url\" alt=\"".get_string("surveygraph", "survey")."\" />"; 00707 } 00708 } 00709 00713 function survey_get_view_actions() { 00714 return array('download','view all','view form','view graph','view report'); 00715 } 00716 00720 function survey_get_post_actions() { 00721 return array('submit'); 00722 } 00723 00724 00731 function survey_reset_course_form_definition(&$mform) { 00732 $mform->addElement('header', 'surveyheader', get_string('modulenameplural', 'survey')); 00733 $mform->addElement('checkbox', 'reset_survey_answers', get_string('deleteallanswers','survey')); 00734 $mform->addElement('checkbox', 'reset_survey_analysis', get_string('deleteanalysis','survey')); 00735 $mform->disabledIf('reset_survey_analysis', 'reset_survey_answers', 'checked'); 00736 } 00737 00742 function survey_reset_course_form_defaults($course) { 00743 return array('reset_survey_answers'=>1, 'reset_survey_analysis'=>1); 00744 } 00745 00754 function survey_reset_userdata($data) { 00755 global $DB; 00756 00757 $componentstr = get_string('modulenameplural', 'survey'); 00758 $status = array(); 00759 00760 $surveyssql = "SELECT ch.id 00761 FROM {survey} ch 00762 WHERE ch.course=?"; 00763 $params = array($data->courseid); 00764 00765 if (!empty($data->reset_survey_answers)) { 00766 $DB->delete_records_select('survey_answers', "survey IN ($surveyssql)", $params); 00767 $DB->delete_records_select('survey_analysis', "survey IN ($surveyssql)", $params); 00768 $status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallanswers', 'survey'), 'error'=>false); 00769 } 00770 00771 if (!empty($data->reset_survey_analysis)) { 00772 $DB->delete_records_select('survey_analysis', "survey IN ($surveyssql)", $params); 00773 $status[] = array('component'=>$componentstr, 'item'=>get_string('deleteallanswers', 'survey'), 'error'=>false); 00774 } 00775 00776 // no date shifting 00777 return $status; 00778 } 00779 00785 function survey_get_extra_capabilities() { 00786 return array('moodle/site:accessallgroups'); 00787 } 00788 00800 function survey_supports($feature) { 00801 switch($feature) { 00802 case FEATURE_GROUPS: return true; 00803 case FEATURE_GROUPINGS: return true; 00804 case FEATURE_GROUPMEMBERSONLY: return true; 00805 case FEATURE_MOD_INTRO: return true; 00806 case FEATURE_COMPLETION_TRACKS_VIEWS: return true; 00807 case FEATURE_GRADE_HAS_GRADE: return false; 00808 case FEATURE_GRADE_OUTCOMES: return false; 00809 case FEATURE_BACKUP_MOODLE2: return true; 00810 case FEATURE_SHOW_DESCRIPTION: return true; 00811 00812 default: return null; 00813 } 00814 } 00815 00827 function survey_extend_navigation($navigation, $course, $module, $cm) { 00833 $navigation->nodetype = navigation_node::NODETYPE_LEAF; 00834 } 00835 00845 function survey_extend_settings_navigation($settings, $surveynode) { 00846 global $PAGE; 00847 00848 if (has_capability('mod/survey:readresponses', $PAGE->cm->context)) { 00849 $responsesnode = $surveynode->add(get_string("responsereports", "survey")); 00850 00851 $url = new moodle_url('/mod/survey/report.php', array('id' => $PAGE->cm->id, 'action'=>'summary')); 00852 $responsesnode->add(get_string("summary", "survey"), $url); 00853 00854 $url = new moodle_url('/mod/survey/report.php', array('id' => $PAGE->cm->id, 'action'=>'scales')); 00855 $responsesnode->add(get_string("scales", "survey"), $url); 00856 00857 $url = new moodle_url('/mod/survey/report.php', array('id' => $PAGE->cm->id, 'action'=>'questions')); 00858 $responsesnode->add(get_string("question", "survey"), $url); 00859 00860 $url = new moodle_url('/mod/survey/report.php', array('id' => $PAGE->cm->id, 'action'=>'students')); 00861 $responsesnode->add(get_string('participants'), $url); 00862 00863 if (has_capability('mod/survey:download', $PAGE->cm->context)) { 00864 $url = new moodle_url('/mod/survey/report.php', array('id' => $PAGE->cm->id, 'action'=>'download')); 00865 $surveynode->add(get_string('downloadresults', 'survey'), $url); 00866 } 00867 } 00868 } 00869 00876 function survey_page_type_list($pagetype, $parentcontext, $currentcontext) { 00877 $module_pagetype = array('mod-survey-*'=>get_string('page-mod-survey-x', 'survey')); 00878 return $module_pagetype; 00879 }