Example #1
1
function survey_print_multi($question)
{
    global $USER, $db, $qnum, $checklist;
    $stripreferthat = get_string("ipreferthat", "survey");
    $strifoundthat = get_string("ifoundthat", "survey");
    $strdefault = get_string('default');
    $strresponses = get_string('responses', 'survey');
    print_heading($question->text, null, 3, 'questiontext');
    echo "\n<table width=\"90%\" cellpadding=\"4\" cellspacing=\"1\" border=\"0\">";
    $options = explode(",", $question->options);
    $numoptions = count($options);
    $oneanswer = $question->type == 1 || $question->type == 2 ? true : false;
    if ($question->type == 2) {
        $P = "P";
    } else {
        $P = "";
    }
    echo "<tr class=\"smalltext\"><th scope=\"row\">{$strresponses}</th>";
    while (list($key, $val) = each($options)) {
        echo "<th scope=\"col\" class=\"hresponse\">{$val}</th>\n";
    }
    echo "<th>&nbsp;</th></tr>\n";
    if ($oneanswer) {
        echo "<tr><th scope=\"col\" colspan=\"6\">{$question->intro}</th></tr>\n";
    } else {
        echo "<tr><th scope=\"col\" colspan=\"7\">{$question->intro}</th></tr>\n";
    }
    $subquestions = get_records_list("survey_questions", "id", $question->multi);
    foreach ($subquestions as $q) {
        $qnum++;
        $rowclass = survey_question_rowclass($qnum);
        if ($q->text) {
            $q->text = get_string($q->text, "survey");
        }
        echo "<tr class=\"{$rowclass} rblock\">";
        if ($oneanswer) {
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            echo $q->text . "</th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "q{$P}" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"q{$P}{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"q{$P}{$q->id}\"");
            echo "<td class=\"whitecell\"><input type=\"radio\" name=\"q{$P}{$q->id}\" id=\"q{$P}" . $q->id . "_D\" value=\"0\" checked=\"checked\" />{$default}</td>";
            $checklist["q{$P}{$q->id}"] = $numoptions;
        } else {
            // yu : fix for MDL-7501, possibly need to use user flag as this is quite ugly.
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            $qnum++;
            echo "<span class=\"preferthat smalltext\">{$stripreferthat}</span> &nbsp; ";
            echo "<span class=\"option\">{$q->text}</span></th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "qP" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"qP{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"qP{$q->id}\"");
            echo "<td><input type=\"radio\" name=\"qP{$q->id}\" id=\"qP{$q->id}\" value=\"0\" checked=\"checked\" />{$default}</td>";
            echo "</tr>";
            echo "<tr class=\"{$rowclass} rblock\">";
            echo "<th scope=\"row\" class=\"optioncell\">";
            echo "<b class=\"qnumtopcell\">{$qnum}</b> &nbsp; ";
            echo "<span class=\"foundthat smalltext\">{$strifoundthat}</span> &nbsp; ";
            echo "<span class=\"option\">{$q->text}</span></th>\n";
            for ($i = 1; $i <= $numoptions; $i++) {
                $hiddentext = get_accesshide($options[$i - 1]);
                $id = "q" . $q->id . "_{$i}";
                echo "<td><label for=\"{$id}\"><input type=\"radio\" name=\"q{$q->id}\" id=\"{$id}\" value=\"{$i}\" />{$hiddentext}</label></td>";
            }
            $default = get_accesshide($strdefault, 'label', '', "for=\"q{$q->id}\"");
            echo "<td class=\"buttoncell\"><input type=\"radio\" name=\"q{$q->id}\" id=\"q{$q->id}\" value=\"0\" checked=\"checked\" />{$default}</td>";
            $checklist["qP{$q->id}"] = $numoptions;
            $checklist["q{$q->id}"] = $numoptions;
        }
        echo "</tr>\n";
    }
    echo "</table>";
}
function block_exabis_eportfolio_print_extern_item($item, $access)
{
    global $CFG;
    print_heading(format_string($item->name));
    $box_content = '';
    if ($item->type == 'link') {
        $link = clean_param($item->url, PARAM_URL);
        $link_js = str_replace('http://', '', $link);
        if ($link) {
            $box_content .= '<p><a href="#" onclick="window.open(\'http://' . addslashes_js($link_js) . '\',\'validate\',\'width=620,height=450,scrollbars=yes,status=yes,resizable=yes,menubar=yes,location=yes\');return true;">' . $link . '</a></p>';
        }
    } elseif ($item->type == 'file') {
        if ($item->attachment) {
            $type = mimeinfo("type", $item->attachment);
            $ffurl = "{$CFG->wwwroot}/blocks/exabis_eportfolio/portfoliofile.php?access=" . $access . "&itemid=" . $item->id;
            if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
                // Image attachments don't get printed as links
                $box_content .= "<img width=\"100%\" src=\"{$ffurl}\" alt=\"" . format_string($item->name) . "\" /><br/>";
            } else {
                $box_content .= "<p>" . link_to_popup_window("{$ffurl}", 'popup', "{$ffurl}", $height = 400, $width = 500, format_string($item->name), 'none', true) . "</p>";
            }
        }
    }
    $box_content .= format_text($item->intro, FORMAT_HTML);
    print_box($box_content);
}
Example #3
0
 function print_entry($course)
 {
     global $CFG, $USER;
     $strloginto = get_string("loginto", "", $course->shortname);
     $strcourses = get_string("courses");
     $teacher = get_teacher($course->id);
     if ((double) $course->cost < 0) {
         $cost = (double) $CFG->enrol_cost;
     } else {
         $cost = (double) $course->cost;
     }
     if (abs($cost) < 0.01) {
         // no cost, default to base class entry to course
         $manual = enrolment_factory::factory('manual');
         $manual->print_entry($course);
     } else {
         $navlinks = array();
         $navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course", 'type' => 'misc');
         $navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
         $navigation = build_navigation($navlinks);
         print_header($strloginto, $course->fullname, $navigation);
         print_course($course, "80%");
         if ($course->password) {
             // Presenting two options
             print_heading(get_string('costorkey', 'enrol_paypal'), 'center');
         }
         print_simple_box_start("center");
         if ($USER->username == 'guest') {
             // force login only for guest user, not real users with guest role
             if (empty($CFG->loginhttps)) {
                 $wwwroot = $CFG->wwwroot;
             } else {
                 // This actually is not so secure ;-), 'cause we're
                 // in unencrypted connection...
                 $wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
             }
             echo '<div align="center"><p>' . get_string('paymentrequired') . '</p>';
             echo '<p><b>' . get_string('cost') . ": {$CFG->enrol_currency} {$cost}" . '</b></p>';
             echo '<p><a href="' . $wwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
             echo '</div>';
         } else {
             //Sanitise some fields before building the PayPal form
             $coursefullname = $course->fullname;
             $courseshortname = $course->shortname;
             $userfullname = fullname($USER);
             $userfirstname = $USER->firstname;
             $userlastname = $USER->lastname;
             $useraddress = $USER->address;
             $usercity = $USER->city;
             include $CFG->dirroot . '/enrol/paypal/enrol.html';
         }
         print_simple_box_end();
         if ($course->password) {
             // Second option
             $password = '';
             include $CFG->dirroot . '/enrol/manual/enrol.html';
         }
         print_footer();
     }
 }
Example #4
0
function memorization_print_new_verse_box()
{
    global $CFG, $USER;
    print_box_start('add-verse-box generalbox box');
    print_heading(get_string('newverse', 'memorization'));
    $biblebooks = biblebooks_array();
    // create the book selector
    $biblebookoptions = '';
    foreach ($biblebooks as $booknumber => $bookofbible) {
        if ($booknumber == 0) {
            continue;
        }
        $biblebookoptions .= '<option value="' . $booknumber . '">' . $bookofbible . '</option>';
    }
    $startbookid = '<select name="startbookid">' . $biblebookoptions . '</select>';
    $endbookid = '<select name="endbookid">' . $biblebookoptions . '</select>';
    // create the chapter inputs
    $startchapter = '<input type="text" name="startchapter" size="5" />';
    $endchapter = '<input type="text" name="endchapter" size="5"/>';
    // create the verse inputs
    $startverse = '<input type="text" name="startverse" size="5"/>';
    $endverse = '<input type="text" name="endverse" size="5"/>';
    // create the version chooser
    $versions = get_records('memorization_version');
    if (!empty($versions)) {
        $versionselect = '<select name="versionid">';
        $lastversionid = get_field_sql("SELECT versionid FROM {$CFG->prefix}memorization_verse WHERE userid={$USER->id} ORDER BY id DESC");
        foreach ($versions as $versionid => $version) {
            $selected = $versionid == $lastversionid ? ' SELECTED="selected" ' : '';
            $versionselect .= '<option ' . $selected . ' value="' . $versionid . '">' . $version->value . '</option>';
        }
        $versionselect .= '</select>';
    }
    $currenturl = new moodle_url(qualified_me());
    echo '<form method="POST" action="addverse.php?' . $currenturl->get_query_string() . '">
          <input type="hidden" name="sesskey" value="' . sesskey() . '">
          <table>
            <tr>
              <td>' . get_string('fromverse', 'memorization') . '</td>
              <td>' . $startbookid . ' ' . $startchapter . ':' . $startverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('toverse', 'memorization') . '</td>
              <td>' . $endbookid . ' ' . $endchapter . ':' . $endverse . '</td>
            </tr>

            <tr>
              <td>' . get_string('version', 'memorization') . '</td>
              <td>' . $versionselect . '</td>
            </tr>
          </table>
          <input type="submit">
          </form>';
    print_box_end();
}
/**
 * Prints the page headers, breadcrumb trail, page heading, (optional) dropdown navigation menu and
 * (optional) navigation tabs for any gradebook page. All gradebook pages MUST use these functions
 * in favour of the usual print_header(), print_header_simple(), print_heading() etc.
 * !IMPORTANT! Use of tabs.php file in gradebook pages is forbidden unless tabs are switched off at
 * the site level for the gradebook ($CFG->grade_navmethod = GRADE_NAVMETHOD_DROPDOWN).
 *
 * @param int $courseid
 * @param string $active_type The type of the current page (report, settings, import, export, scales, outcomes, letters)
 * @param string $active_plugin The plugin of the current page (grader, fullview etc...)
 * @param string $heading The heading of the page. Tries to guess if none is given
 * @param boolean $return Whether to return (true) or echo (false) the HTML generated by this function
 * @param string $bodytags Additional attributes that will be added to the <body> tag
 * @param string $buttons Additional buttons to display on the page
 *
 * @return string HTML code or nothing if $return == false
 */
function print_grade_page_head_local($courseid, $active_type, $active_plugin = null, $heading = false, $return = false, $bodytags = '', $buttons = false, $extracss = array())
{
    global $CFG, $COURSE;
    $strgrades = get_string('grades');
    $plugin_info = grade_get_plugin_info($courseid, $active_type, $active_plugin);
    // Determine the string of the active plugin
    $stractive_plugin = $active_plugin ? $plugin_info['strings']['active_plugin_str'] : $heading;
    $stractive_type = $plugin_info['strings'][$active_type];
    $navlinks = array();
    $first_link = '';
    if ($active_type == 'settings' && $active_plugin != 'coursesettings') {
        $first_link = $plugin_info['report'][$active_plugin]['link'];
    } elseif ($active_type != 'report') {
        $first_link = $CFG->wwwroot . '/grade/index.php?id=' . $COURSE->id;
    }
    if ($active_type == 'preferences') {
        $CFG->stylesheets[] = $CFG->wwwroot . '/grade/report/styles.css';
    }
    foreach ($extracss as $css_url) {
        $CFG->stylesheets[] = $css_url;
    }
    $navlinks[] = array('name' => $strgrades, 'link' => $first_link, 'type' => 'misc');
    $active_type_link = '';
    if (!empty($plugin_info[$active_type]['link']) && $plugin_info[$active_type]['link'] != qualified_me()) {
        $active_type_link = $plugin_info[$active_type]['link'];
    }
    if (!empty($plugin_info[$active_type]['parent']['link'])) {
        $active_type_link = $plugin_info[$active_type]['parent']['link'];
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    if (empty($plugin_info[$active_type]['id'])) {
        $navlinks[] = array('name' => $stractive_type, 'link' => $active_type_link, 'type' => 'misc');
    }
    $navlinks[] = array('name' => $stractive_plugin, 'link' => null, 'type' => 'misc');
    $navigation = build_navigation($navlinks);
    $title = ': ' . $stractive_plugin;
    if (empty($plugin_info[$active_type]['id']) || !empty($plugin_info[$active_type]['parent'])) {
        $title = ': ' . $stractive_type . ': ' . $stractive_plugin;
    }
    $returnval = print_header_simple($strgrades . ': ' . $stractive_type, $title, $navigation, '', $bodytags, true, $buttons, navmenu($COURSE), false, '', $return);
    // Guess heading if not given explicitly
    if (!$heading) {
        $heading = $stractive_plugin;
    }
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_DROPDOWN) {
        $returnval .= print_grade_plugin_selector($plugin_info, $return);
    }
    $returnval .= print_heading($heading);
    if ($CFG->grade_navmethod == GRADE_NAVMETHOD_COMBO || $CFG->grade_navmethod == GRADE_NAVMETHOD_TABS) {
        $returnval .= grade_print_tabs($active_type, $active_plugin, $plugin_info, $return);
    }
    if ($return) {
        return $returnval;
    }
}
Example #6
0
function iplookup_display($ip, $user = 0)
{
    print_header();
    if ($user) {
        if ($user = get_record('user', 'id', $user)) {
            print_heading(fullname($user) . ", {$user->city}, {$user->country}", 'center', '4');
        }
    }
    echo 'Search results: <iframe src="http://www.hostip.info/api/get.html?ip=' . $ip . '" height="60" width="300"></iframe>';
    echo '<object data="http://www.hostip.info/map/frame.html?ip=' . $ip . '" ' . 'type="text/html" border="0" width="610" height="330"></object>';
    close_window_button();
    print_footer('none');
}
{
    global $course, $choose;
    echo '</td></tr></table>';
    print_footer($course);
}
function html_header($course, $wdir, $formfield = "")
{
    global $CFG, $ME, $choose;
    if (!($site = get_site())) {
        error("Invalid site!");
    }
    if ($course->id == $site->id) {
        $strfiles = get_string("sitefiles");
    } else {
        $strfiles = get_string("files");
    }
    if ($wdir == "/") {
        $fullnav = "{$strfiles}";
    } else {
        $dirs = explode("/", $wdir);
        $numdirs = count($dirs);
        $link = "";
        $navigation = "";
        for ($i = 1; $i < $numdirs - 1; $i++) {
            $navigation .= " -> ";
            $link .= "/" . urlencode($dirs[$i]);
            $navigation .= "<a href=\"" . $ME . "?id={$course->id}&amp;pod={$podcast}&amp;wdir={$wdir}&amp;choose={$choose}\">" . $dirs[$i] . "</a>";
        }
        $fullnav = "<a href=\"" . $ME . "?id={$course->id}&amp;pod={$podcast}&amp;wdir={$wdir}&amp;choose={$choose}\">{$strfiles}</a> {$navigation} -> " . $dirs[$numdirs - 1];
    }
    if ($choose) {
        print_header();
        $chooseparts = explode('.', $choose);
        ?>
            <script language="javascript" type="text/javascript">
            <!--
            function set_value(txt) {
                opener.document.forms['<?php 
        echo $chooseparts[0] . "']." . $chooseparts[1];
        ?>
.value = txt;
                window.close();
            }
            -->
            </script>
            <?php 
        echo '<div id="nav-bar">Podcast</div>';
        if ($course->id == $site->id) {
            print_heading(get_string("publicsitefileswarning"), "center", 2);
 public static function printHeader($title = '', $course_id = SITEID, $cache = false)
 {
     $navlinks = array();
     if ($course_id != SITEID) {
         $navlinks[] = array('name' => get_field('course', 'shortname', 'id', $course_id), 'link' => $GLOBALS['CFG']->wwwroot . '/course/view.php?id=' . $course_id, 'type' => 'title');
     }
     $navlinks[] = array('name' => $title, 'link' => '', 'type' => 'title');
     print_header_simple($title, '', build_navigation($navlinks), '', '', $cache);
     echo '<div style="float:right;">';
     /*		helpbutton('repository', sharing_cart_plugins::get_string('title', 'repository'),
     				'block_sharing_cart/plugins/repository', true, false, '', false);*/
     echo '</div>';
     echo '<div style="clear:both;"><!-- clear float --></div>';
     print_heading($title);
 }
function webquestscorm_print_header($name, $currenttab = '', $course = NULL, $cm = NULL, $cmid = 0)
{
    global $CFG;
    if ($cmid) {
        if (!isset($cm)) {
            if (!($cm = get_coursemodule_from_id('webquestscorm', $cmid))) {
                error('Course Module ID was incorrect');
            }
        }
        if (!isset($course)) {
            if (!($course = get_record('course', 'id', $this->cm->course))) {
                error('Course is misconfigured');
            }
        }
        if (!isset($name)) {
            if (!($webquestscorm = get_record('webquestscorm', 'id', $this->cm->instance))) {
                error('webquestscorm ID was incorrect');
            }
            $name = $webquestscorm->name;
        }
    } else {
        if (!isset($cm)) {
            error('Course Module ID was incorrect');
        }
        if (!isset($course)) {
            error('Course is misconfigured');
        }
        if (!isset($name)) {
            error('webquestscorm name was incorrect');
        }
    }
    $strwebquestscorms = get_string('modulenameplural', 'webquestscorm');
    $strwebquestscorm = get_string('modulename', 'webquestscorm');
    $strname = format_string($name);
    $button = update_module_button($cm->id, $course->id, $strwebquestscorm);
    $meta = '';
    if ($CFG->version < 2007101500) {
        print_header_simple(format_string($strname), "", "<a href=\"index.php?id={$course->id}\">{$strwebquestscorms}</a> -> " . format_string($name), "", "", true, update_module_button($cm->id, $course->id, $strwebquestscorm), navmenu($course, $cm));
    } else {
        $navigation = build_navigation('', $cm);
        print_header($course->shortname . ':' . $strname, $course->fullname, $navigation, '', $meta, true, $button, navmenu($course, $cm));
    }
    print_heading(format_string($name, true));
    require_once "tabs.php";
}
Example #10
0
        if (!$ineditperiod || $USER->id != $fromdb->userid and !has_capability('mod/glossary:manageentries', $context)) {
            if ($USER->id != $fromdb->userid) {
                print_error('errcannoteditothers', 'glossary');
            } elseif (!$ineditperiod) {
                print_error('erredittimeexpired', 'glossary');
            }
            die;
        }
        if ($aliases = get_records_menu("glossary_alias", "entryid", $e, '', 'id, alias')) {
            $toform->aliases = implode("\n", $aliases) . "\n";
        }
        $mform->set_data($toform);
    }
}
$stredit = empty($e) ? get_string('addentry', 'glossary') : get_string("edit");
$navigation = build_navigation($stredit, $cm);
print_header_simple(format_string($glossary->name), "", $navigation, "", "", true, "", navmenu($course, $cm));
print_heading(format_string($glossary->name));
/// Info box
///if ( $glossary->intro ) {
///    print_simple_box(format_text($glossary->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
///}
/// Tabbed browsing sections
///$tab = GLOSSARY_ADDENTRY_VIEW;
///include("tabs.php");
if (!$e) {
    require_capability('mod/glossary:write', $context);
}
$mform->display();
///glossary_print_tabbed_table_end();
print_footer($course);
Example #11
0
              <input type="hidden" name="id" value="' . $cm->id . '" />
              <input type="hidden" name="mode" value="save" />
              <input type="hidden" name="sesskey" value="' . sesskey() . '" />';
     echo get_string("entername", "lesson") . ": <input type=\"text\" name=\"name\" size=\"7\" maxlength=\"5\" />\n<p>\n";
     lesson_print_submit_link(get_string("submitname", "lesson"), 'nickname');
     echo "</p>\n</form>\n</div>\n";
     print_simple_box_end();
     break;
 default:
     $params = array("lessonid" => $lesson->id);
     if (!($grades = $DB->get_records_select("lesson_grades", "lessonid = :lessonid", $params, "completed"))) {
         $grades = array();
     }
     print_heading(get_string("topscorestitle", "lesson", $lesson->maxhighscores), 'center', 4);
     if (!($highscores = $DB->get_records_select("lesson_high_scores", "lessonid = :lessonid", $params))) {
         print_heading(get_string("nohighscores", "lesson"), 'center', 3);
     } else {
         foreach ($highscores as $highscore) {
             $grade = $grades[$highscore->gradeid]->grade;
             $topscores[$grade][] = $highscore->nickname;
         }
         krsort($topscores);
         $table = new stdClass();
         $table->align = array('center', 'left', 'right');
         $table->wrap = array();
         $table->width = "30%";
         $table->cellspacing = '10px';
         $table->size = array('*', '*', '*');
         $table->head = array(get_string("rank", "lesson"), get_string('name'), get_string("scores", "lesson"));
         $printed = 0;
         while (true) {
Example #12
0
 function display($quiz, $cm, $course)
 {
     /// This function just displays the report
     global $CFG, $SESSION, $db, $QTYPES;
     $strnoquiz = get_string('noquiz', 'quiz');
     $strnoattempts = get_string('noattempts', 'quiz');
     /// Only print headers if not asked to download data
     $download = optional_param('download', NULL);
     if (!$download) {
         $this->print_header_and_tabs($cm, $course, $quiz, $reportmode = "analysis");
     }
     /// Construct the table for this particular report
     if (!$quiz->questions) {
         print_heading($strnoattempts);
         return true;
     }
     /// Check to see if groups are being used in this quiz
     if ($groupmode = groupmode($course, $cm)) {
         // Groups are being used
         if (!$download) {
             $currentgroup = setup_and_print_groups($course, $groupmode, "report.php?id={$cm->id}&amp;mode=analysis");
         } else {
             $currentgroup = get_and_set_current_group($course, $groupmode);
         }
     } else {
         $currentgroup = get_and_set_current_group($course, $groupmode);
     }
     // set Table and Analysis stats options
     if (!isset($SESSION->quiz_analysis_table)) {
         $SESSION->quiz_analysis_table = array('attemptselection' => 0, 'lowmarklimit' => 0, 'pagesize' => 10);
     }
     foreach ($SESSION->quiz_analysis_table as $option => $value) {
         $urlparam = optional_param($option, NULL);
         if ($urlparam === NULL) {
             ${$option} = $value;
         } else {
             ${$option} = $SESSION->quiz_analysis_table[$option] = $urlparam;
         }
     }
     $scorelimit = $quiz->sumgrades * $lowmarklimit / 100;
     // ULPGC ecastro DEBUG this is here to allow for different SQL to select attempts
     switch ($attemptselection) {
         case QUIZ_ALLATTEMPTS:
             $limit = '';
             $group = '';
             break;
         case QUIZ_HIGHESTATTEMPT:
             $limit = ', max(qa.sumgrades) ';
             $group = ' GROUP BY qa.userid ';
             break;
         case QUIZ_FIRSTATTEMPT:
             $limit = ', min(qa.timemodified) ';
             $group = ' GROUP BY qa.userid ';
             break;
         case QUIZ_LASTATTEMPT:
             $limit = ', max(qa.timemodified) ';
             $group = ' GROUP BY qa.userid ';
             break;
     }
     if ($attemptselection != QUIZ_ALLATTEMPTS) {
         $sql = 'SELECT qa.userid ' . $limit . 'FROM ' . $CFG->prefix . 'user u LEFT JOIN ' . $CFG->prefix . 'quiz_attempts qa ON u.id = qa.userid ' . 'WHERE qa.quiz = ' . $quiz->id . ' AND qa.preview = 0 ' . $group;
         $usermax = get_records_sql_menu($sql);
     }
     $groupmembers = '';
     $groupwhere = '';
     //Add this to the SQL to show only group users
     if ($currentgroup) {
         $groupmembers = ', ' . groups_members_from_sql();
         $groupwhere = ' AND ' . groups_members_where_sql($currentgroup, 'u.id');
     }
     $sql = 'SELECT  qa.* FROM ' . $CFG->prefix . 'quiz_attempts qa, ' . $CFG->prefix . 'user u ' . $groupmembers . 'WHERE u.id = qa.userid AND qa.quiz = ' . $quiz->id . ' AND qa.preview = 0 AND ( qa.sumgrades >= ' . $scorelimit . ' ) ' . $groupwhere;
     // ^^^^^^ es posible seleccionar aqu TODOS los quizzes, como quiere Jussi,
     // pero habra que llevar la cuenta ed cada quiz para restaura las preguntas (quizquestions, states)
     /// Fetch the attempts
     $attempts = get_records_sql($sql);
     if (empty($attempts)) {
         print_heading(get_string('nothingtodisplay'));
         $this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
         return true;
     }
     /// Here we rewiew all attempts and record data to construct the table
     $questions = array();
     $statstable = array();
     $questionarray = array();
     foreach ($attempts as $attempt) {
         $questionarray[] = quiz_questions_in_quiz($attempt->layout);
     }
     $questionlist = quiz_questions_in_quiz(implode(",", $questionarray));
     $questionarray = array_unique(explode(",", $questionlist));
     $questionlist = implode(",", $questionarray);
     unset($questionarray);
     foreach ($attempts as $attempt) {
         switch ($attemptselection) {
             case QUIZ_ALLATTEMPTS:
                 $userscore = 0;
                 // can be anything, not used
                 break;
             case QUIZ_HIGHESTATTEMPT:
                 $userscore = $attempt->sumgrades;
                 break;
             case QUIZ_FIRSTATTEMPT:
                 $userscore = $attempt->timemodified;
                 break;
             case QUIZ_LASTATTEMPT:
                 $userscore = $attempt->timemodified;
                 break;
         }
         if ($attemptselection == QUIZ_ALLATTEMPTS || $userscore == $usermax[$attempt->userid]) {
             $sql = "SELECT q.*, i.grade AS maxgrade, i.id AS instance" . "  FROM {$CFG->prefix}question q," . "       {$CFG->prefix}quiz_question_instances i" . " WHERE i.quiz = '{$quiz->id}' AND q.id = i.question" . "   AND q.id IN ({$questionlist})";
             if (!($quizquestions = get_records_sql($sql))) {
                 error('No questions found');
             }
             // Load the question type specific information
             if (!get_question_options($quizquestions)) {
                 error('Could not load question options');
             }
             // Restore the question sessions to their most recent states
             // creating new sessions where required
             if (!($states = get_question_states($quizquestions, $quiz, $attempt))) {
                 error('Could not restore question sessions');
             }
             $numbers = explode(',', $questionlist);
             $statsrow = array();
             foreach ($numbers as $i) {
                 if (!isset($quizquestions[$i]) or !isset($states[$i])) {
                     continue;
                 }
                 $qtype = $quizquestions[$i]->qtype == 'random' ? $states[$i]->options->question->qtype : $quizquestions[$i]->qtype;
                 $q = get_question_responses($quizquestions[$i], $states[$i]);
                 if (empty($q)) {
                     continue;
                 }
                 $qid = $q->id;
                 if (!isset($questions[$qid])) {
                     $questions[$qid]['id'] = $qid;
                     $questions[$qid]['qname'] = $quizquestions[$i]->name;
                     foreach ($q->responses as $answer => $r) {
                         $r->count = 0;
                         $questions[$qid]['responses'][$answer] = $r->answer;
                         $questions[$qid]['rcounts'][$answer] = 0;
                         $questions[$qid]['credits'][$answer] = $r->credit;
                         $statsrow[$qid] = 0;
                     }
                 }
                 $responses = get_question_actual_response($quizquestions[$i], $states[$i]);
                 foreach ($responses as $resp) {
                     if ($resp) {
                         if ($key = array_search($resp, $questions[$qid]['responses'])) {
                             $questions[$qid]['rcounts'][$key]++;
                         } else {
                             $test = new stdClass();
                             $test->responses = $QTYPES[$quizquestions[$i]->qtype]->get_correct_responses($quizquestions[$i], $states[$i]);
                             if ($key = $QTYPES[$quizquestions[$i]->qtype]->check_response($quizquestions[$i], $states[$i], $test)) {
                                 $questions[$qid]['rcounts'][$key]++;
                             } else {
                                 $questions[$qid]['responses'][] = $resp;
                                 $questions[$qid]['rcounts'][] = 1;
                                 $questions[$qid]['credits'][] = 0;
                             }
                         }
                     }
                 }
                 $statsrow[$qid] = get_question_fraction_grade($quizquestions[$i], $states[$i]);
             }
             $attemptscores[$attempt->id] = $attempt->sumgrades;
             $statstable[$attempt->id] = $statsrow;
         }
     }
     // Statistics Data table built
     unset($attempts);
     unset($quizquestions);
     unset($states);
     // now calculate statistics and set the values in the $questions array
     $top = max($attemptscores);
     $bottom = min($attemptscores);
     $gap = ($top - $bottom) / 3;
     $top -= $gap;
     $bottom += $gap;
     foreach ($questions as $qid => $q) {
         $questions[$qid] = $this->report_question_stats($q, $attemptscores, $statstable, $top, $bottom);
     }
     unset($attemptscores);
     unset($statstable);
     /// Now check if asked download of data
     if ($download = optional_param('download', NULL)) {
         $filename = clean_filename("{$course->shortname} " . format_string($quiz->name, true));
         switch ($download) {
             case "Excel":
                 $this->Export_Excel($questions, $filename);
                 break;
             case "ODS":
                 $this->Export_ODS($questions, $filename);
                 break;
             case "CSV":
                 $this->Export_CSV($questions, $filename);
                 break;
         }
     }
     /// Construct the table for this particular report
     $tablecolumns = array('id', 'qname', 'responses', 'credits', 'rcounts', 'rpercent', 'facility', 'qsd', 'disc_index', 'disc_coeff');
     $tableheaders = array(get_string('qidtitle', 'quiz_analysis'), get_string('qtexttitle', 'quiz_analysis'), get_string('responsestitle', 'quiz_analysis'), get_string('rfractiontitle', 'quiz_analysis'), get_string('rcounttitle', 'quiz_analysis'), get_string('rpercenttitle', 'quiz_analysis'), get_string('facilitytitle', 'quiz_analysis'), get_string('stddevtitle', 'quiz_analysis'), get_string('dicsindextitle', 'quiz_analysis'), get_string('disccoefftitle', 'quiz_analysis'));
     $table = new flexible_table('mod-quiz-report-itemanalysis');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/quiz/report.php?q=' . $quiz->id . '&amp;mode=analysis');
     $table->sortable(true);
     $table->no_sorting('rpercent');
     $table->collapsible(true);
     $table->initialbars(false);
     $table->column_class('id', 'numcol');
     $table->column_class('credits', 'numcol');
     $table->column_class('rcounts', 'numcol');
     $table->column_class('rpercent', 'numcol');
     $table->column_class('facility', 'numcol');
     $table->column_class('qsd', 'numcol');
     $table->column_class('disc_index', 'numcol');
     $table->column_class('disc_coeff', 'numcol');
     $table->column_suppress('id');
     $table->column_suppress('qname');
     $table->column_suppress('facility');
     $table->column_suppress('qsd');
     $table->column_suppress('disc_index');
     $table->column_suppress('disc_coeff');
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'itemanalysis');
     $table->set_attribute('class', 'generaltable generalbox');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     $tablesort = $table->get_sql_sort();
     $sorts = explode(",", trim($tablesort));
     if ($tablesort and is_array($sorts)) {
         $sortindex = array();
         $sortorder = array();
         foreach ($sorts as $sort) {
             $data = explode(" ", trim($sort));
             $sortindex[] = trim($data[0]);
             $s = trim($data[1]);
             if ($s == "ASC") {
                 $sortorder[] = SORT_ASC;
             } else {
                 $sortorder[] = SORT_DESC;
             }
         }
         if (count($sortindex) > 0) {
             $sortindex[] = "id";
             $sortorder[] = SORT_ASC;
             foreach ($questions as $qid => $row) {
                 $index1[$qid] = $row[$sortindex[0]];
                 $index2[$qid] = $row[$sortindex[1]];
             }
             array_multisort($index1, $sortorder[0], $index2, $sortorder[1], $questions);
         }
     }
     $format_options = new stdClass();
     $format_options->para = false;
     $format_options->noclean = true;
     $format_options->newlines = false;
     // Now it is time to page the data, simply slice the keys in the array
     if (!isset($pagesize) || (int) $pagesize < 1) {
         $pagesize = 10;
     }
     $table->pagesize($pagesize, count($questions));
     $start = $table->get_page_start();
     $pagequestions = array_slice(array_keys($questions), $start, $pagesize);
     foreach ($pagequestions as $qnum) {
         $q = $questions[$qnum];
         $qid = $q['id'];
         $question = get_record('question', 'id', $qid);
         if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $course->id))) {
             $qnumber = " (" . link_to_popup_window('/question/question.php?id=' . $qid, '&amp;cmid=' . $cm->id . 'editquestion', $qid, 450, 550, get_string('edit'), 'none', true) . ") ";
         } else {
             $qnumber = $qid;
         }
         $qname = '<div class="qname">' . format_text($question->name . " :  ", $question->questiontextformat, $format_options, $quiz->course) . '</div>';
         $qicon = print_question_icon($question, true);
         $qreview = quiz_question_preview_button($quiz, $question);
         $qtext = format_text($question->questiontext, $question->questiontextformat, $format_options, $quiz->course);
         $qquestion = $qname . "\n" . $qtext . "\n";
         $responses = array();
         foreach ($q['responses'] as $aid => $resp) {
             $response = new stdClass();
             if ($q['credits'][$aid] <= 0) {
                 $qclass = 'uncorrect';
             } elseif ($q['credits'][$aid] == 1) {
                 $qclass = 'correct';
             } else {
                 $qclass = 'partialcorrect';
             }
             $response->credit = '<span class="' . $qclass . '">(' . format_float($q['credits'][$aid], 2) . ') </span>';
             $response->text = '<span class="' . $qclass . '">' . format_text($resp, FORMAT_MOODLE, $format_options, $quiz->course) . ' </span>';
             $count = $q['rcounts'][$aid] . '/' . $q['count'];
             $response->rcount = $count;
             $response->rpercent = '(' . format_float($q['rcounts'][$aid] / $q['count'] * 100, 0) . '%)';
             $responses[] = $response;
         }
         $facility = format_float($q['facility'] * 100, 0) . "%";
         $qsd = format_float($q['qsd'], 3);
         $di = format_float($q['disc_index'], 2);
         $dc = format_float($q['disc_coeff'], 2);
         $response = array_shift($responses);
         $table->add_data(array($qnumber . "\n<br />" . $qicon . "\n " . $qreview, $qquestion, $response->text, $response->credit, $response->rcount, $response->rpercent, $facility, $qsd, $di, $dc));
         foreach ($responses as $response) {
             $table->add_data(array('', '', $response->text, $response->credit, $response->rcount, $response->rpercent, '', '', '', ''));
         }
     }
     print_heading_with_help(get_string("analysistitle", "quiz_analysis"), "itemanalysis", "quiz");
     echo '<div id="tablecontainer">';
     $table->print_html();
     echo '</div>';
     $this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
     return true;
 }
Example #13
0
}
if (!($user = get_record("user", "id", $user))) {
    error("User ID is incorrect");
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$personalcontext = get_context_instance(CONTEXT_USER, $user->id);
require_login();
if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) and !has_capability('moodle/course:view', $coursecontext)) {
    // do not require parents to be enrolled in courses ;-)
    course_setup($course);
} else {
    require_login($course);
}
if ($user->deleted) {
    print_header();
    print_heading(get_string('userdeleted'));
    print_footer();
    die;
}
// prepare list of allowed modes
$myreports = ($course->showreports and $USER->id == $user->id);
$anyreport = has_capability('moodle/user:viewuseractivitiesreport', $personalcontext);
$modes = array();
if ($myreports or $anyreport or has_capability('coursereport/outline:view', $coursecontext)) {
    $modes[] = 'outline';
}
if ($myreports or $anyreport or has_capability('coursereport/outline:view', $coursecontext)) {
    $modes[] = 'complete';
}
if ($myreports or $anyreport or has_capability('coursereport/log:viewtoday', $coursecontext)) {
    $modes[] = 'todaylogs';
Example #14
0
    error("That's an invalid course id", "view.php?id={$id}&amp;rootdir={$rootdir}&groupid={$groupid}");
}
require_login($course->id);
// Ensures the user is able to view the fmanager
fm_check_access_rights($course->id);
$strtitle = get_string('zipfiles', 'block_file_manager');
$nav[] = array('name' => get_string('filemanager', 'block_file_manager'), 'link' => "view.php?id={$id}&groupid={$groupid}", 'type' => 'misc');
$nav[] = array('name' => $strtitle, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($nav);
print_header($strtitle, format_string($course->fullname), $navigation, '', '', false, "&nbsp;", "&nbsp;");
if ($action == 'zipsel') {
    $headingstr = get_string('zipfiles', 'block_file_manager');
} elseif ($action == 'unzip') {
    $headingstr = get_string('unzipfiles', 'block_file_manager');
}
print_heading($headingstr);
switch ($action) {
    case 'viewzip':
        if ($groupid == 0) {
            $list = fm_view_zipped(fm_get_user_link($zipid), $groupid);
        } else {
            $list = fm_view_zipped(fm_get_group_link($zipid, $groupid), $groupid);
        }
        print_simple_box_start('center', '375', '#C0C0C0');
        echo "<table name=\"viewziptable\" cellspacing=\"5\" align=\"center\" width=\"375\">";
        echo "<tr>";
        echo "<td align='center'><b><u>" . get_string('file', 'block_file_manager') . "</u></b></td>";
        echo "<td align='center'><b><u>" . get_string('compressedsize', 'block_file_manager') . "</u></b></td>";
        echo "<td align='center'><b><u>" . get_string('actualsize', 'block_file_manager') . "</u></b></td>";
        echo "</tr>";
        foreach ($list as $l) {
        $note->id = 0;
        $note->userid = $v;
        if (note_save($note)) {
            add_to_log($note->courseid, 'notes', 'add', 'index.php?course=' . $note->courseid . '&amp;user='******'#note-' . $note->id, 'add note');
        }
    }
    redirect("{$CFG->wwwroot}/user/index.php?id={$id}");
}
/// Print headers
$straddnote = get_string('groupaddnewnote', 'notes');
$navlinks = array();
$navlinks[] = array('name' => $straddnote, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header("{$course->shortname}: " . get_string('extendenrol'), $course->fullname, $navigation, "", "", true, "&nbsp;", navmenu($course));
// this will contain all available the based On select options, but we'll disable some on them on a per user basis
print_heading($straddnote);
echo '<form method="post" action="groupaddnote.php" >';
echo '<div style="width:100%;text-align:center;">';
echo '<input type="hidden" name="id" value="' . $course->id . '" />';
echo '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '" />';
$state_names = note_get_state_names();
// the first time list hack
if (empty($users)) {
    foreach ($_POST as $k => $v) {
        if (preg_match('/^user(\\d+)$/', $k, $m)) {
            $users[] = $m[1];
        }
    }
}
$strpublishstate = get_string('publishstate', 'notes');
$userlist = array();
Example #16
0
 /**
  *  Display all the submissions ready for grading
  */
 function display_submissions($message = '')
 {
     global $CFG, $db, $USER;
     require_once $CFG->libdir . '/gradelib.php';
     /* first we check to see if the form has just been submitted
      * to request user_preference updates
      */
     if (isset($_POST['updatepref'])) {
         $perpage = optional_param('perpage', 10, PARAM_INT);
         $perpage = $perpage <= 0 ? 10 : $perpage;
         set_user_preference('assignment_perpage', $perpage);
         set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
     }
     /* next we get perpage and quickgrade (allow quick grade) params
      * from database
      */
     $perpage = get_user_preferences('assignment_perpage', 10);
     $quickgrade = get_user_preferences('assignment_quickgrade', 0);
     $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id);
     if (!empty($CFG->enableoutcomes) and !empty($grading_info->outcomes)) {
         $uses_outcomes = true;
     } else {
         $uses_outcomes = false;
     }
     $teacherattempts = true;
     /// Temporary measure
     $page = optional_param('page', 0, PARAM_INT);
     $strsaveallfeedback = get_string('saveallfeedback', 'assignment');
     /// Some shortcuts to make the code read better
     $course = $this->course;
     $assignment = $this->assignment;
     $cm = $this->cm;
     $tabindex = 1;
     //tabindex for quick grading tabbing; Not working for dropdowns yet
     add_to_log($course->id, 'assignment', 'view submission', 'submissions.php?id=' . $this->assignment->id, $this->assignment->id, $this->cm->id);
     $navlinks = array();
     $navlinks[] = array('name' => $this->strassignments, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
     $navlinks[] = array('name' => format_string($this->assignment->name, true), 'link' => "view.php?a={$this->assignment->id}", 'type' => 'activityinstance');
     $navlinks[] = array('name' => $this->strsubmissions, 'link' => '', 'type' => 'title');
     $navigation = build_navigation($navlinks);
     print_header_simple(format_string($this->assignment->name, true), "", $navigation, '', '', true, update_module_button($cm->id, $course->id, $this->strassignment), navmenu($course, $cm));
     if (!empty($message)) {
         echo $message;
         // display messages here if any
     }
     $context = get_context_instance(CONTEXT_MODULE, $cm->id);
     /// find out current groups mode
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     groups_print_activity_menu($cm, 'submissions.php?id=' . $this->cm->id);
     /// Get all ppl that are allowed to submit assignments
     $users = get_users_by_capability($context, 'mod/assignment:submit', '', '', '', '', $currentgroup, '', false);
     $users = array_keys($users);
     if (!empty($CFG->enablegroupings) && !empty($cm->groupingid)) {
         $groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id');
         $users = array_intersect($users, array_keys($groupingusers));
     }
     $tablecolumns = array('picture', 'fullname', 'grade', 'submissioncomment', 'timemodified', 'timemarked', 'status', 'finalgrade');
     if ($uses_outcomes) {
         $tablecolumns[] = 'outcome';
         // no sorting based on outcomes column
     }
     $tableheaders = array('', get_string('fullname'), get_string('grade'), get_string('comment', 'assignment'), get_string('lastmodified') . ' (' . $course->student . ')', get_string('lastmodified') . ' (' . $course->teacher . ')', get_string('status'), get_string('finalgrade', 'grades'));
     if ($uses_outcomes) {
         $tableheaders[] = get_string('outcome', 'grades');
     }
     require_once $CFG->libdir . '/tablelib.php';
     $table = new flexible_table('mod-assignment-submissions');
     $table->define_columns($tablecolumns);
     $table->define_headers($tableheaders);
     $table->define_baseurl($CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;currentgroup=' . $currentgroup);
     $table->sortable(true, 'lastname');
     //sorted by lastname by default
     $table->collapsible(true);
     $table->initialbars(true);
     $table->column_suppress('picture');
     $table->column_suppress('fullname');
     $table->column_class('picture', 'picture');
     $table->column_class('fullname', 'fullname');
     $table->column_class('grade', 'grade');
     $table->column_class('submissioncomment', 'comment');
     $table->column_class('timemodified', 'timemodified');
     $table->column_class('timemarked', 'timemarked');
     $table->column_class('status', 'status');
     $table->column_class('finalgrade', 'finalgrade');
     if ($uses_outcomes) {
         $table->column_class('outcome', 'outcome');
     }
     $table->set_attribute('cellspacing', '0');
     $table->set_attribute('id', 'attempts');
     $table->set_attribute('class', 'submissions');
     $table->set_attribute('width', '90%');
     //$table->set_attribute('align', 'center');
     $table->no_sorting('finalgrade');
     $table->no_sorting('outcome');
     // Start working -- this is necessary as soon as the niceties are over
     $table->setup();
     /// Check to see if groups are being used in this assignment
     if (!$teacherattempts) {
         $teachers = get_course_teachers($course->id);
         if (!empty($teachers)) {
             $keys = array_keys($teachers);
         }
         foreach ($keys as $key) {
             unset($users[$key]);
         }
     }
     if (empty($users)) {
         print_heading(get_string('noattempts', 'assignment'));
         return true;
     }
     /// Construct the SQL
     if ($where = $table->get_sql_where()) {
         $where .= ' AND ';
     }
     if ($sort = $table->get_sql_sort()) {
         $sort = ' ORDER BY ' . $sort;
     }
     $select = 'SELECT u.id, u.firstname, u.lastname, u.picture,
                       s.id AS submissionid, s.grade, s.submissioncomment,
                       s.timemodified, s.timemarked,
                       COALESCE(SIGN(SIGN(s.timemarked) + SIGN(s.timemarked - s.timemodified)), 0) AS status ';
     $sql = 'FROM ' . $CFG->prefix . 'user u ' . 'LEFT JOIN ' . $CFG->prefix . 'assignment_submissions s ON u.id = s.userid
                                                               AND s.assignment = ' . $this->assignment->id . ' ' . 'WHERE ' . $where . 'u.id IN (' . implode(',', $users) . ') ';
     $table->pagesize($perpage, count($users));
     ///offset used to calculate index of student in that particular query, needed for the pop up to know who's next
     $offset = $page * $perpage;
     $strupdate = get_string('update');
     $strgrade = get_string('grade');
     $grademenu = make_grades_menu($this->assignment->grade);
     if (($ausers = get_records_sql($select . $sql . $sort, $table->get_page_start(), $table->get_page_size())) !== false) {
         $grading_info = grade_get_grades($this->course->id, 'mod', 'assignment', $this->assignment->id, array_keys($ausers));
         foreach ($ausers as $auser) {
             $final_grade = $grading_info->items[0]->grades[$auser->id];
             /// Calculate user status
             $auser->status = $auser->timemarked > 0 && $auser->timemarked >= $auser->timemodified;
             $picture = print_user_picture($auser->id, $course->id, $auser->picture, false, true);
             if (empty($auser->submissionid)) {
                 $auser->grade = -1;
                 //no submission yet
             }
             if (!empty($auser->submissionid)) {
                 ///Prints student answer and student modified date
                 ///attach file or print link to student answer, depending on the type of the assignment.
                 ///Refer to print_student_answer in inherited classes.
                 if ($auser->timemodified > 0) {
                     $studentmodified = '<div id="ts' . $auser->id . '">' . $this->print_student_answer($auser->id) . userdate($auser->timemodified) . '</div>';
                 } else {
                     $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 }
                 ///Print grade, dropdown or text
                 if ($auser->timemarked > 0) {
                     $teachermodified = '<div id="tt' . $auser->id . '">' . userdate($auser->timemarked) . '</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 } else {
                     $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                     if ($final_grade->locked or $final_grade->overridden) {
                         $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                     } else {
                         if ($quickgrade) {
                             $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                             $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                         } else {
                             $grade = '<div id="g' . $auser->id . '">' . $this->display_grade($auser->grade) . '</div>';
                         }
                     }
                 }
                 ///Print Comment
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($final_grade->str_feedback), 15) . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">' . shorten_text(strip_tags($auser->submissioncomment), 15) . '</div>';
                     }
                 }
             } else {
                 $studentmodified = '<div id="ts' . $auser->id . '">&nbsp;</div>';
                 $teachermodified = '<div id="tt' . $auser->id . '">&nbsp;</div>';
                 $status = '<div id="st' . $auser->id . '">&nbsp;</div>';
                 if ($final_grade->locked or $final_grade->overridden) {
                     $grade = '<div id="g' . $auser->id . '">' . $final_grade->str_grade . '</div>';
                 } else {
                     if ($quickgrade) {
                         // allow editing
                         $menu = choose_from_menu(make_grades_menu($this->assignment->grade), 'menu[' . $auser->id . ']', $auser->grade, get_string('nograde'), '', -1, true, false, $tabindex++);
                         $grade = '<div id="g' . $auser->id . '">' . $menu . '</div>';
                     } else {
                         $grade = '<div id="g' . $auser->id . '">-</div>';
                     }
                 }
                 if ($final_grade->locked or $final_grade->overridden) {
                     $comment = '<div id="com' . $auser->id . '">' . $final_grade->str_feedback . '</div>';
                 } else {
                     if ($quickgrade) {
                         $comment = '<div id="com' . $auser->id . '">' . '<textarea tabindex="' . $tabindex++ . '" name="submissioncomment[' . $auser->id . ']" id="submissioncomment' . $auser->id . '" rows="2" cols="20">' . $auser->submissioncomment . '</textarea></div>';
                     } else {
                         $comment = '<div id="com' . $auser->id . '">&nbsp;</div>';
                     }
                 }
             }
             if (empty($auser->status)) {
                 /// Confirm we have exclusively 0 or 1
                 $auser->status = 0;
             } else {
                 $auser->status = 1;
             }
             $buttontext = $auser->status == 1 ? $strupdate : $strgrade;
             ///No more buttons, we use popups ;-).
             $popup_url = '/mod/assignment/submissions.php?id=' . $this->cm->id . '&amp;userid=' . $auser->id . '&amp;mode=single' . '&amp;offset=' . $offset++;
             $button = link_to_popup_window($popup_url, 'grade' . $auser->id, $buttontext, 600, 780, $buttontext, 'none', true, 'button' . $auser->id);
             $status = '<div id="up' . $auser->id . '" class="s' . $auser->status . '">' . $button . '</div>';
             $finalgrade = '<span id="finalgrade_' . $auser->id . '">' . $final_grade->str_grade . '</span>';
             $outcomes = '';
             if ($uses_outcomes) {
                 foreach ($grading_info->outcomes as $n => $outcome) {
                     $outcomes .= '<div class="outcome"><label>' . $outcome->name . '</label>';
                     $options = make_grades_menu(-$outcome->scaleid);
                     if ($outcome->grades[$auser->id]->locked or !$quickgrade) {
                         $options[0] = get_string('nooutcome', 'grades');
                         $outcomes .= ': <span id="outcome_' . $n . '_' . $auser->id . '">' . $options[$outcome->grades[$auser->id]->grade] . '</span>';
                     } else {
                         $outcomes .= ' ';
                         $outcomes .= choose_from_menu($options, 'outcome_' . $n . '[' . $auser->id . ']', $outcome->grades[$auser->id]->grade, get_string('nooutcome', 'grades'), '', 0, true, false, 0, 'outcome_' . $n . '_' . $auser->id);
                     }
                     $outcomes .= '</div>';
                 }
             }
             $row = array($picture, fullname($auser), $grade, $comment, $studentmodified, $teachermodified, $status, $finalgrade);
             if ($uses_outcomes) {
                 $row[] = $outcomes;
             }
             $table->add_data($row);
         }
     }
     /// Print quickgrade form around the table
     if ($quickgrade) {
         echo '<form action="submissions.php" id="fastg" method="post">';
         echo '<div>';
         echo '<input type="hidden" name="id" value="' . $this->cm->id . '" />';
         echo '<input type="hidden" name="mode" value="fastgrade" />';
         echo '<input type="hidden" name="page" value="' . $page . '" />';
         echo '</div>';
         //echo '<div style="text-align:center"><input type="submit" name="fastg" value="'.get_string('saveallfeedback', 'assignment').'" /></div>';
     }
     $table->print_html();
     /// Print the whole table
     if ($quickgrade) {
         echo '<div style="text-align:center"><input type="submit" name="fastg" value="' . get_string('saveallfeedback', 'assignment') . '" /></div>';
         echo '</form>';
     }
     /// End of fast grading form
     /// Mini form for setting user preference
     echo '<br />';
     echo '<form id="options" action="submissions.php?id=' . $this->cm->id . '" method="post">';
     echo '<div>';
     echo '<input type="hidden" id="updatepref" name="updatepref" value="1" />';
     echo '<table id="optiontable" align="right">';
     echo '<tr align="right"><td>';
     echo '<label for="perpage">' . get_string('pagesize', 'assignment') . '</label>';
     echo ':</td>';
     echo '<td>';
     echo '<input type="text" id="perpage" name="perpage" size="1" value="' . $perpage . '" />';
     helpbutton('pagesize', get_string('pagesize', 'assignment'), 'assignment');
     echo '</td></tr>';
     echo '<tr align="right">';
     echo '<td>';
     print_string('quickgrade', 'assignment');
     echo ':</td>';
     echo '<td>';
     if ($quickgrade) {
         echo '<input type="checkbox" name="quickgrade" value="1" checked="checked" />';
     } else {
         echo '<input type="checkbox" name="quickgrade" value="1" />';
     }
     helpbutton('quickgrade', get_string('quickgrade', 'assignment'), 'assignment') . '</p></div>';
     echo '</td></tr>';
     echo '<tr>';
     echo '<td colspan="2" align="right">';
     echo '<input type="submit" value="' . get_string('savepreferences') . '" />';
     echo '</td></tr></table>';
     echo '</div>';
     echo '</form>';
     ///End of mini form
     print_footer($this->course);
 }
Example #17
0
 //get the values of completeds before done. Anonymous user can not get these values.
 if (!isset($SESSION->feedback->is_started) and !isset($savereturn) and $feedback->anonymous == FEEDBACK_ANONYMOUS_NO) {
     if (!($feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid))) {
         if ($feedbackcompleted = feedback_get_current_completed($feedback->id, false, $courseid)) {
             //copy the values to feedback_valuetmp create a completedtmp
             $feedbackcompletedtmp = feedback_set_tmp_values($feedbackcompleted);
         }
     }
 } else {
     $feedbackcompletedtmp = feedback_get_current_completed($feedback->id, true, $courseid);
 }
 /// Print the main part of the page
 ///////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////
 ///////////////////////////////////////////////////////////////////////////
 print_heading(format_text($feedback->name));
 if (isset($savereturn) && $savereturn == 'saved') {
     if ($feedback->page_after_submit) {
         // print_simple_box_start('center', '75%');
         print_box_start('generalbox boxaligncenter boxwidthwide');
         echo format_text(stripslashes_safe($feedback->page_after_submit));
         // print_simple_box_end();
         print_box_end();
     } else {
         echo '<p align="center"><b><font color="green">' . get_string('entries_saved', 'feedback') . '</font></b></p>';
         if (intval($feedback->publish_stats) == 1) {
             echo '<p align="center"><a href="analysis.php?id=' . $id . '&courseid=' . $courseid . '">';
             echo get_string('completed_feedbacks', 'feedback') . '</a>';
             echo '</p>';
         }
     }
if (!get_user_preferences('message_usehtmleditor', 0)) {
    $CFG->htmleditor = '';
}
$msgform = new user_message_form('user_bulk_message.php');
if ($msgform->is_cancelled()) {
    redirect($return);
} else {
    if ($formdata = $msgform->get_data()) {
        $options = new object();
        $options->para = false;
        $options->newlines = true;
        $options->smiley = false;
        $msg = format_text($formdata->messagebody, $formdata->format, $options);
        $in = implode(',', $SESSION->bulk_users);
        $userlist = $DB->get_records_select_menu('user', "id IN ({$in})", null, 'fullname', 'id,' . $DB->sql_fullname() . ' AS fullname');
        $usernames = implode(', ', $userlist);
        $optionsyes = array();
        $optionsyes['confirm'] = 1;
        $optionsyes['sesskey'] = sesskey();
        $optionsyes['msg'] = $msg;
        admin_externalpage_print_header();
        print_heading(get_string('confirmation', 'admin'));
        print_box($msg, 'boxwidthnarrow boxaligncenter generalbox', 'preview');
        notice_yesno(get_string('confirmmessage', 'bulkusers', $usernames), 'user_bulk_message.php', 'user_bulk.php', $optionsyes, NULL, 'post', 'get');
        admin_externalpage_print_footer();
        die;
    }
}
admin_externalpage_print_header();
$msgform->display();
admin_externalpage_print_footer();
/**
 * Print the standard header for pagemenu module
 *
 * @uses $CFG
 * @uses $USER tabs.php requires it
 * @param object $cm Course module record object
 * @param object $course Couse record object
 * @param object $pagemenu pagemenu module record object
 * @param string $currenttab File location and tab to be selected
 * @param string $focus Focus
 * @param boolean $showtabs Display tabs yes/no
 * @return void
 **/
function pagemenu_print_header($cm, $course, $pagemenu, $currenttab = 'view', $focus = '', $showtabs = true)
{
    global $CFG, $USER;
    $strpagemenus = get_string('modulenameplural', 'pagemenu');
    $strpagemenu = get_string('modulename', 'pagemenu');
    $strname = format_string($pagemenu->name);
    /// Log it!
    add_to_log($course->id, 'pagemenu', $currenttab, "{$currenttab}.php?id={$cm->id}", $strname, $cm->id);
    /// Print header, heading, tabs and messages
    print_header_simple($strname, $strname, build_navigation('', $cm), $focus, '', true, update_module_button($cm->id, $course->id, $strpagemenu), navmenu($course, $cm));
    print_heading($strname);
    if ($showtabs) {
        pagemenu_print_tabs($cm, $currenttab);
    }
    pagemenu_print_messages();
}
Example #20
0
        $firstscorm = current($scorms);
        if (!($course->format == 'scorm' && $firstscorm->id == $scorm->id)) {
            $navlinks[] = array('name' => $strscorms, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
        }
    }
}
$pagetitle = strip_tags($course->shortname . ': ' . format_string($scorm->name));
add_to_log($course->id, 'scorm', 'pre-view', 'view.php?id=' . $cm->id, "{$scorm->id}");
if (has_capability('mod/scorm:skipview', get_context_instance(CONTEXT_MODULE, $cm->id)) && scorm_simple_play($scorm, $USER)) {
    exit;
}
//
// Print the page header
//
$navlinks = array();
$navlinks[] = array('name' => format_string($scorm->name, true), 'link' => "view.php?id={$cm->id}", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header($pagetitle, $course->fullname, $navigation, '', '', true, update_module_button($cm->id, $course->id, $strscorm), navmenu($course, $cm));
if (has_capability('mod/scorm:viewreport', $context)) {
    $trackedusers = scorm_get_count_users($scorm->id, $cm->groupingid);
    if ($trackedusers > 0) {
        echo "<div class=\"reportlink\"><a {$CFG->frametarget} href=\"report.php?id={$cm->id}\"> " . get_string('viewalluserreports', 'scorm', $trackedusers) . '</a></div>';
    } else {
        echo '<div class="reportlink">' . get_string('noreports', 'scorm') . '</div>';
    }
}
// Print the main part of the page
print_heading(format_string($scorm->name));
print_box(format_text($scorm->summary), 'generalbox', 'intro');
scorm_view_display($USER, $scorm, 'view.php?id=' . $cm->id, $cm);
print_footer($course);
Example #21
0
        $default .= ' />';
    } else {
        $default = '';
    }
    $table->data[$name] = array($name, $enable, $default, '<a href="enrol_config.php?enrol=' . $module . '">' . $str->edit . '</a>');
}
asort($table->data);
print_table($table);
echo "<div style=\"text-align:center\"><input type=\"submit\" value=\"" . get_string("savechanges") . "\" /></div>\n";
echo "</div>";
echo "</form>";
echo '<hr />';
$yesnooptions = array(0 => get_string('no'), 1 => get_string('yes'));
echo '<form ' . $CFG->frametarget . ' id="adminsettings" method="post" action="enrol.php">';
echo '<div class="settingsform clearfix">';
print_heading(get_string('commonsettings', 'admin'));
echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />';
echo '<input type="hidden" name="savesettings" value="1" />';
echo '<fieldset>';
echo '<div class="form-item clearfix" id="admin-sendcoursewelcomemessage">';
echo '<div class="form-label"><label for = "menusendcoursewelcomemessage">' . get_string('sendcoursewelcomemessage', 'admin');
echo '<span class="form-shortname">sendcoursewelcomemessage</span>';
echo '</label></div>';
echo '<div class="form-setting"><div class="form-checkbox defaultsnext">';
choose_from_menu($yesnooptions, 'sendcoursewelcomemessage', $CFG->sendcoursewelcomemessage, '');
echo '</div><div class="form-defaultinfo">' . get_string('defaultsettinginfo', 'admin', get_string('yes')) . '</div></div>';
echo '<div class="form-description">' . get_string('configsendcoursewelcomemessage', 'admin') . '</div>';
echo '</div>';
echo '</fieldset>';
echo '<div class="form-buttons"><input class="form-submit" type="submit" value="' . get_string('savechanges', 'admin') . '" /></div>';
echo '</div>';
* Module Brainstorm V2
* Operator : scale
* @author Valery Fremaux
* @package Brainstorm
* @date 20/12/2007
*/
include_once $CFG->dirroot . "/mod/brainstorm/operators/{$page}/locallib.php";
include_once "{$CFG->dirroot}/mod/brainstorm/operators/operator.class.php";
$current_operator = new BrainstormOperator($brainstorm->id, $page);
$responses = brainstorm_get_responses($brainstorm->id, 0, $currentgroup, false);
$scalings = scale_get_scalings($brainstorm->id, null, 0, false, $current_operator->configdata);
print_heading(get_string('myscaling', 'brainstorm'));
scale_display($brainstorm, null, $currentgroup, $responses, $scalings);
print_heading(get_string('unscaled', 'brainstorm'));
scale_display_unscaled($brainstorm, null, $currentgroup, $responses, $scalings);
print_heading(get_string('otherscales', 'brainstorm'));
print_simple_box_start('center');
$otherscalings = scale_get_meanscalings($brainstorm->id, 0, $currentgroup, true, $current_operator->configdata);
if ($otherscalings) {
    $absscalebounds = scale_get_scalebounds($brainstorm->id, 0, $currentgroup, false, $current_operator->configdata);
}
?>
<table cellspacing="5" width="80%">
<?php 
if ($otherscalings && $absscalebounds->range != 0) {
    $i = 0;
    $absoffset = $absscalebounds->minvalue < 0 ? abs($absscalebounds->minvalue / $absscalebounds->range * $current_operator->configdata->barwidth) : 0;
    foreach ($otherscalings as $other) {
        switch ($current_operator->configdata->quantifiertype) {
            case 'integer':
                $relmid = $current_operator->configdata->barwidth * ($other->sumintvalue / $other->countintvalue / $absscalebounds->range);
}
echo '</div>';
echo '</div>';
echo '</div>';
if (!$mform->is_cancelled() && ($fromform = $mform->get_data())) {
    $mform->process_data($fromform);
}
if ($action == 'delete') {
    //Check to see if we are deleting a comment
    delete_records('ilpconcern_comments', 'id', $commentid);
}
if ($action == 'updatecomment') {
    print_heading(get_string('addcomment', 'ilpconcern'));
    $mform->display();
} else {
    print_heading(get_string('concerncomments', 'ilpconcern'));
    $comments = get_records('ilpconcern_comments', 'concernspost', $concernspost);
    $stryes = get_string('complete', 'ilpconcern');
    $strdelete = get_string('delete');
    $stredit = get_string('edit');
    $strenter = get_string('update');
    echo '<div class="ilpcenter">';
    if ($comments !== false) {
        foreach ($comments as $comment) {
            $commentuser = get_record('user', 'id', $comment->userid);
            echo '<div class="forumpost ilpcomment boxaligncenter">' . format_text($comment->comment, $comment->format) . '<div class="commands">' . fullname($commentuser) . ', ' . userdate($comment->created, get_string('strftimedate')) . '<br />' . ilpconcern_update_comment_menu($comment->id, $context) . '</div></div>';
        }
    }
    echo '</div>';
    if (has_capability('mod/ilpconcern:addcomment', $context) || $USER->id == $user->id && has_capability('mod/ilpconcern:addowncomment', $context)) {
        echo '<div class="addbox">';
Example #24
0
<?php

// $Id: confirmdelete.php,v 1.6 2007/10/09 21:43:30 iarenaza Exp $
/**
 * Action for confirming the deletion of a page
 *
 * @version $Id: confirmdelete.php,v 1.6 2007/10/09 21:43:30 iarenaza Exp $
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 * @package lesson
 **/
confirm_sesskey();
$pageid = required_param('pageid', PARAM_INT);
if (!($thispage = get_record("lesson_pages", "id", $pageid))) {
    error("Confirm delete: the page record not found");
}
print_heading(get_string("deletingpage", "lesson", format_string($thispage->title)));
// print the jumps to this page
if ($answers = get_records_select("lesson_answers", "lessonid = {$lesson->id} AND jumpto = {$pageid} + 1")) {
    print_heading(get_string("thefollowingpagesjumptothispage", "lesson"));
    echo "<p align=\"center\">\n";
    foreach ($answers as $answer) {
        if (!($title = get_field("lesson_pages", "title", "id", $answer->pageid))) {
            error("Confirm delete: page title not found");
        }
        echo $title . "<br />\n";
    }
}
notice_yesno(get_string("confirmdeletionofthispage", "lesson"), "lesson.php?action=delete&amp;id={$cm->id}&amp;pageid={$pageid}&amp;sesskey=" . $USER->sesskey, "view.php?id={$cm->id}");
Example #25
0
}
// hack to add a "export" option to the pagination results.
if (class_exists('module_import_export', false) && module_user::can_i('view', 'Export ' . $contact_type_permission . ' Contacts')) {
    if (isset($_REQUEST['import_export_go'])) {
        $users = query_to_array($users);
        foreach ($users as $user_id => $user) {
            $users[$user_id]['is_primary'] = $user['is_primary'] == $user['user_id'] ? _l('Yes') : _l('No');
        }
    }
    module_import_export::enable_pagination_hook(array('name' => $contact_type_permission . ' Contact Export', 'fields' => array($contact_type_permission . ' Contact ID' => 'user_id', 'First Name' => 'name', 'Last Name' => 'last_name', $contact_type_permission . ' ID' => $contact_module_name . '_id', $contact_type_permission . ' Name' => $contact_module_name . '_name', 'Primary Contact' => 'is_primary', 'Phone' => 'phone', 'Email' => 'email', 'Fax' => 'fax', 'Mobile' => 'mobile'), 'extra' => array('owner_table' => 'user', 'owner_id' => 'user_id'), 'group' => array(array('title' => 'Contact Group', 'owner_table' => 'user', 'owner_id' => 'user_id'))));
}
$heading = array('main' => true, 'type' => 'h2', 'title' => _l(($show_customer_details ? 'All ' : '') . $contact_type_permission . ' Contacts'), 'button' => array());
if (isset($search[$use_master_key]) && $search[$use_master_key] && module_user::can_i('create', 'Contacts', $contact_type_permission)) {
    $heading['button'][] = array('title' => 'Add New Contact', 'url' => module_user::link_generate('new', array('type' => 'contact', $use_master_key => isset($search[$use_master_key]) ? $search[$use_master_key] : false)), 'type' => 'add');
}
print_heading($heading);
?>



<form action="" method="<?php 
echo _DEFAULT_FORM_METHOD;
?>
">
    <?php 
if ($use_master_key && isset($search[$use_master_key])) {
    ?>

    <input type="hidden" name="<?php 
    echo $use_master_key;
    ?>
Example #26
0
    echo "<input type=\"hidden\" name=\"id\" value=\"{$certrequest->userid}\" />";
    echo "<input type=\"submit\" value=\"" . get_string("sendmessage", "message") . "\" onclick=\"return openpopup('/message/discussion.php?id={$certrequest->userid}', 'message_{$certrequest->userid}', 'menubar=0,location=0,scrollbars,status,resizable,width=400,height=500', 0);\" />";
    echo "</form>";
    echo "</div></div>";
    //print previous Certification requests
    $sql = "userid='{$certrequest->userid}' AND courseid='{$certrequest->courseid}' AND status='declined'";
    $prevrequests = get_records_select('tao_user_certification_status', $sql);
    if (!empty($prevrequests)) {
        print_heading(get_string('previousrequests', 'block_tao_certification_path'));
        $table = new stdclass();
        $table->head = array(get_string('time'), get_string('changedby', 'block_tao_certification_path'), get_string('status'), get_string('description'));
        foreach ($prevrequests as $prev) {
            if ($USER->id == $prev->changeuserid) {
                $changeuser = $USER;
            } else {
                $changeuser = get_record('user', 'id', $prev->changeuserid);
            }
            $table->data[] = array(userdate($prev->timechanged), fullname($changeuser), $prev->status, $prev->description);
        }
        print_table($table);
    }
    print_heading($strtitle);
    require_once 'approve_form.php';
    $userform = new approve_form();
    $userform->display();
}
print_footer(NULL, $course);
function print_row($left, $right)
{
    echo "\n<tr><td class=\"label c0\">{$left}</td><td class=\"info c1\">{$right}</td></tr>\n";
}
        /*display: inline-block;*/
    }
    span.newsletter-click-span:hover{
        filter:alpha(opacity=10);
        -moz-opacity:0.1;
        -khtml-opacity: 0.1;
        opacity: 0.1;
    }
</style>
    <?php 
    $style_tag = ob_get_clean();
    if (preg_match('#<head>#i', $content)) {
        $content = preg_replace('#<head>#i', '<head>' . $style_tag, $content);
    } else {
        echo $style_tag;
    }
    echo $content;
    exit;
}
print_heading(array('type' => 'h2', 'title' => 'Newsletter Link Clicks', 'button' => array('url' => module_newsletter::link_statistics($newsletter_id, $send_id), 'id' => 'refresh', 'title' => 'Back to Statistics')));
?>



<iframe src="<?php 
echo module_newsletter::link_statistics_link_clicks($newsletter_id, $send_id);
?>
&show=true" frameborder="0" style="width:100%; height:700px; border:0;" background="transparent"></iframe>


<tr><td>summary</td><td>Text</td></tr>
<tr><td>teacher</td><td>String(100)</td></tr>
<tr><td>teachers</td><td>String(100)</td></tr>
<tr><td>teacher[1,2,...]_account</td><td>Search String that returns only one User Account (as used in <a href="user.php" target="_blank">Administration &raquo; Edit user accounts</a> OR Integer Database User ID</td></tr>
<tr><td>teacher[1,2,...]_role</td><td>String(40)</td></tr>
<tr><td>template</td><td>String</td></tr>
<tr><td>theme</td><td>String(50)</td></tr>
<tr><td>timecreated</td><td>String Date Literal</td></tr>
<tr><td>timemodified</td><td>String Date Literal</td></tr>
<tr><td>topic0 [main heading], topic1 ... topic52 [topic/week headings]</td><td>Text</td></tr>
<tr><td>visible</td><td>0=FALSE,1=TRUE</td></tr>
</table></center>
<?php 
}
/// Print the form
print_heading('Upload Courses');
$maxuploadsize = get_max_upload_file_size();
echo '<center>';
echo '<form method="post" enctype="multipart/form-data" action="uploadcourse.php">' . $strchoose . ':<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxuploadsize . '">' . '<input type="hidden" name="sesskey" value="' . $USER->sesskey . '">' . '<input type="file" name="coursefile" size="30">' . '<input type="submit" value="Upload">' . '</form></br>';
echo '</center>';
print_footer($course);
function my_file_get_contents($filename, $use_include_path = 0)
{
    /// Returns the file as one big long string
    $data = "";
    $file = @fopen($filename, "rb", $use_include_path);
    if ($file) {
        while (!feof($file)) {
            $data .= fread($file, 1024);
        }
        fclose($file);
Example #29
0
    }
} else {
    if (!($course = get_record("course", "id", $id))) {
        error("That's an invalid course id");
    }
}
$site = get_site();
if ($CFG->forcelogin) {
    require_login();
}
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if ((!(course_parent_visible($course) && $CFG->allowvisiblecoursesinhiddencategories) || !$course->visible) && !has_capability('moodle/course:viewhiddencourses', $context)) {
    error(get_string('coursehidden'), $CFG->wwwroot . '/');
}
print_header(get_string("summaryof", "", $course->fullname));
print_heading(format_string($course->fullname) . '<br />(' . format_string($course->shortname) . ')');
if ($course->guest || $course->password) {
    print_box_start('generalbox icons');
    if ($course->guest) {
        $strallowguests = get_string('allowguests');
        echo "<div><img alt=\"\" class=\"icon guest\" src=\"{$CFG->pixpath}/i/guest.gif\" />&nbsp;{$strallowguests}</div>";
    }
    if ($course->password) {
        $strrequireskey = get_string('requireskey');
        echo "<div><img alt=\"\" class=\"icon key\" src=\"{$CFG->pixpath}/i/key.gif\" />&nbsp;{$strrequireskey}</div>";
    }
    print_box_end();
}
print_box_start('generalbox info');
echo filter_text(text_to_html($course->summary), $course->id);
if ($managerroles = get_config('', 'coursemanager')) {
Example #30
0
     }
     $fullmodulename = get_string("modulename", $module->name);
     $form->coursemodule = $cm->id;
     $form->section = $cm->section;
     $form->course = $cm->course;
     $form->instance = $cm->instance;
     $form->modulename = $module->name;
     $form->fullmodulename = $fullmodulename;
     $form->instancename = $instance->name;
     $form->sesskey = !empty($USER->id) ? $USER->sesskey : '';
     $strdeletecheck = get_string('deletecheck', '', $form->fullmodulename);
     $strdeletecheckfull = get_string('deletecheckfull', '', "{$form->fullmodulename} '{$form->instancename}'");
     $CFG->pagepath = 'mod/' . $module->name . '/delete';
     print_header_simple($strdeletecheck, '', $strdeletecheck);
     print_simple_box_start('center', '60%', '#FFAAAA', 20, 'noticebox');
     print_heading($strdeletecheckfull);
     include_once 'mod_delete.html';
     print_simple_box_end();
     print_footer($course);
     exit;
 } else {
     if (!empty($update) and confirm_sesskey()) {
         // value = course module
         if (!($cm = get_record("course_modules", "id", $update))) {
             error("This course module doesn't exist");
         }
         if (!($course = get_record("course", "id", $cm->course))) {
             error("This course doesn't exist");
         }
         require_login($course->id);
         // needed to setup proper $COURSE