//
// Author: Behdad Bakhshinategh!
// Description: This page is for the survey of instructors.
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$displaypage = function () {
    // CHECK And PREPARE DATA.
    global $CFG, $OUTPUT, $SESSION, $PAGE, $DB, $COURSE, $USER;
    $id = optional_param('id', 0, PARAM_INT);
    // List id.
    require_login(1, false);
    // Use course 1 because this has nothing to do with an actual course, just like course 1.
    $context = context_system::instance();
    $pagetitle = get_string('pluginname', 'local_gas');
    $pageheading = get_string('pluginname', 'local_gas');
    echo local_gas_page('/index.php?id=' . $id, $pagetitle, $pageheading, $context);
    echo $OUTPUT->header();
    // JS functions below is for changing the content of department input based on the faculty.
    $initjs = "\n             \$(document).ready(function() {\n                    \$('.parent').change(function(){\n                        var is = 2;\n                        if(\$(this).val() == 'Other'){\n                            is = 1;\n                        }\n                        else{\n                            is = 0;\n                        }\n                        var id = \$(this).parent().attr('id');\n                        toggleChild(id, is);\n                    });\n            });\n            function toggleChild(id, is) {\n                if (is == 1) {\n                    \$('tr').filter('.child' + id).show();\n                }\n                else if(is == 0){\n                    \$('tr').filter('.child' + id).hide();\n                }\n            }";
    echo html_writer::script($initjs);
    $act = optional_param("action", null, PARAM_TEXT);
    ?>
    <div style="margin-bottom: 0px;" class='block_course_overview  block'>
        <div class="header">
            <div class="title"><h2><i class='fa fa-question-circle'></i><?php 
    echo " " . get_string('survey', 'local_gas');
    if ($act == "page1") {
        echo " ( page 1 / 1 )";
    }
    ?>
 </h2>
Esempio n. 2
0
// Author: Behdad Bakhshinategh!
// Description: This page is for the general information and description users may need.
require_once dirname(__FILE__) . '/lib/functions.php';
require_once dirname(__FILE__) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$displaypage = function () {
    // CHECK And PREPARE DATA.
    global $OUTPUT, $USER;
    $id = optional_param('id', 0, PARAM_INT);
    // List id.
    require_login(1, false);
    // Use course 1 because this has nothing to do with an actual course, just like course 1.
    $context = context_system::instance();
    $pagetitle = get_string('pluginname', 'local_gas');
    $pageheading = get_string('pluginname', 'local_gas');
    echo local_gas_page('/consent.php?id=' . $id, $pagetitle, $pageheading, $context);
    echo $OUTPUT->header();
    $initjs = "";
    echo html_writer::script($initjs);
    $check = optional_param("agreed", null, PARAM_TEXT);
    $datasaved = false;
    if ($check == "yes") {
        $row['user_id'] = $USER->id;
        $row['email'] = null;
        if (optional_param("check", null, PARAM_TEXT) != null) {
            $row['email'] = optional_param("email", null, PARAM_EMAIL);
            if ($row['email'] == null || trim($row['email']) == '') {
                $row['email'] = $USER->email;
            }
        }
        $row['timestamp'] = time();