当前位置: 首页>>代码示例>>PHP>>正文


PHP survey_print_graph函数代码示例

本文整理汇总了PHP中survey_print_graph函数的典型用法代码示例。如果您正苦于以下问题:PHP survey_print_graph函数的具体用法?PHP survey_print_graph怎么用?PHP survey_print_graph使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了survey_print_graph函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: survey_user_complete

/**
 * @global stdObject
 * @global object
 * @uses SURVEY_CIQ
 * @param object $course
 * @param object $user
 * @param object $mod
 * @param object $survey
 */
function survey_user_complete($course, $user, $mod, $survey) {
    global $CFG, $DB, $OUTPUT;

    if (survey_already_done($survey->id, $user->id)) {
        if ($survey->template == SURVEY_CIQ) { // print out answers for critical incidents
            $table = new html_table();
            $table->align = array("left", "left");

            $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
            $questionorder = explode(",", $survey->questions);

            foreach ($questionorder as $key=>$val) {
                $question = $questions[$val];
                $questiontext = get_string($question->shorttext, "survey");

                if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) {
                    $answertext = "$answer->answer1";
                } else {
                    $answertext = "No answer";
                }
                $table->data[] = array("<b>$questiontext</b>", $answertext);
            }
            echo html_writer::table($table);

        } else {

            survey_print_graph("id=$mod->id&amp;sid=$user->id&amp;type=student.png");
        }

    } else {
        print_string("notdone", "survey");
    }
}
开发者ID:nitinnagaraja,项目名称:moodle,代码行数:42,代码来源:lib.php

示例2: notice

    if (!$cm->visible) {
        notice(get_string("activityiscurrentlyhidden"));
    }
}
if (!is_enrolled($context)) {
    echo $OUTPUT->notification(get_string("guestsnotallowed", "survey"));
}
if ($surveyalreadydone) {
    $numusers = survey_count_responses($survey->id, $currentgroup, $groupingid);
    if ($showscales) {
        // Ensure that graph.php will allow the user to see the graph.
        if (has_capability('mod/survey:readresponses', $context) || !$groupmode || groups_is_member($currentgroup)) {
            echo $OUTPUT->box(get_string("surveycompleted", "survey"));
            echo $OUTPUT->box(get_string("peoplecompleted", "survey", $numusers));
            echo '<div class="resultgraph">';
            survey_print_graph("id={$cm->id}&amp;sid={$USER->id}&amp;group={$currentgroup}&amp;type=student.png");
            echo '</div>';
        } else {
            echo $OUTPUT->box(get_string("surveycompletednograph", "survey"));
            echo $OUTPUT->box(get_string("peoplecompleted", "survey", $numusers));
        }
    } else {
        echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox', 'intro');
        echo $OUTPUT->spacer(array('height' => 30, 'width' => 1), true);
        // Should be done with CSS instead.
        $questions = survey_get_questions($survey);
        foreach ($questions as $question) {
            if ($question->type == 0 or $question->type == 1) {
                if ($answer = survey_get_user_answer($survey->id, $question->id, $USER->id)) {
                    $table = new html_table();
                    $table->head = array(get_string($question->text, "survey"));
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:view.php

示例3: foreach

         if ($question->type < 0) {
             // We have some virtual scales.  Just show them.
             $virtualscales = true;
             break;
         }
     }
     foreach ($questionorder as $key => $val) {
         $question = $questions[$val];
         if ($question->multi) {
             if ($virtualscales && $question->type > 0) {
                 // Don't show non-virtual scales if virtual
                 continue;
             }
             echo "<p class=\"centerpara\">";
             echo "<a title=\"{$strseemoredetail}\" href=\"report.php?action=questions&amp;id={$id}&amp;qid={$question->multi}\">";
             survey_print_graph("id={$id}&amp;qid={$question->id}&amp;sid={$student}&amp;type=studentmultiquestion.png");
             echo "</a></p><br />";
         }
     }
 }
 // Print non-scale questions
 foreach ($questionorder as $key => $val) {
     $question = $questions[$val];
     if ($question->type == 0 or $question->type == 1) {
         if ($answer = survey_get_user_answer($survey->id, $question->id, $user->id)) {
             $table = new html_table();
             $table->head = array(get_string($question->text, "survey"));
             $table->align = array("left");
             $table->data[] = array(s($answer->answer1));
             // no html here, just plain text
             echo html_writer::table($table);
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:report.php

示例4: add_to_log

        echo $OUTPUT->notification(get_string("guestsnotallowed", "survey"));
    }


//  Check the survey hasn't already been filled out.

    if (survey_already_done($survey->id, $USER->id)) {

        add_to_log($course->id, "survey", "view graph", "view.php?id=$cm->id", $survey->id, $cm->id);
        $numusers = survey_count_responses($survey->id, $currentgroup, $groupingid);

        if ($showscales) {
            echo $OUTPUT->heading(get_string("surveycompleted", "survey"));
            echo $OUTPUT->heading(get_string("peoplecompleted", "survey", $numusers));
            echo '<div class="resultgraph">';
            survey_print_graph("id=$cm->id&amp;sid=$USER->id&amp;group=$currentgroup&amp;type=student.png");
            echo '</div>';

        } else {

            echo $OUTPUT->box(format_module_intro('survey', $survey, $cm->id), 'generalbox', 'intro');
            echo $OUTPUT->spacer(array('height'=>30, 'width'=>1), true);  // should be done with CSS instead

            $questions = $DB->get_records_list("survey_questions", "id", explode(',', $survey->questions));
            $questionorder = explode(",", $survey->questions);
            foreach ($questionorder as $key => $val) {
                $question = $questions[$val];
                if ($question->type == 0 or $question->type == 1) {
                    if ($answer = survey_get_user_answer($survey->id, $question->id, $USER->id)) {
                        $table = new html_table();
                        $table->head = array(get_string($question->text, "survey"));
开发者ID:JP-Git,项目名称:moodle,代码行数:31,代码来源:view.php


注:本文中的survey_print_graph函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。