Esempio n. 1
0
    /// Searchform
    echo '<td align="center">';
    wiki_print_search_form($cm->id, $q, $userid, $groupid, false);
    echo '</td>';
    /// Internal Wikilinks
    /// TODO: DOES NOT WORK !!!!
    echo '<td align="center">';
    wiki_print_wikilinks_block($cm->id, $wiki->ewikiacceptbinary);
    echo '</td>';
    /// Administrative Links
    echo '<td align="center">';
    wiki_print_administration_actions($wiki, $cm->id, $userid, $groupid, $page, $wiki->htmlmode != 2, $course);
    echo '</td>';
    #        if($wiki->htmlmode!=2) {
    #          echo '<td align="center">';
    #          helpbutton('formattingrules', get_string('formattingrules', 'wiki'), 'wiki');
    #          echo get_string("formattingrules","wiki");
    #          echo '</td>';
    #        }
    echo '</tr></table>';
}
// The wiki Contents
print_simple_box_start('center', '100%', '', '20');
// Do the Action
# "setpageflags", "removepages", "strippages", "checklinks", "revertpages"
print_heading_with_help(get_string($action, "wiki"), $action, "wiki");
include $action . ".html";
print_simple_box_end();
/// Finish the page
print_footer($course);
exit;
Esempio n. 2
0
    $showroles = 1;
    $currenttab = 'override';
    include_once $CFG->dirroot . '/user/tabs.php';
} else {
    if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) {
        require_once $CFG->libdir . '/adminlib.php';
        admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid), $CFG->wwwroot . '/' . $CFG->admin . '/roles/override.php');
        admin_externalpage_print_header();
        $currenttab = 'override';
        include_once 'tabs.php';
    } else {
        $currenttab = 'override';
        include_once 'tabs.php';
    }
}
print_heading_with_help($title, 'overrides');
if ($roleid) {
    /// Show UI for overriding roles.
    if (!empty($capabilities)) {
        print_box(get_string('nocapabilitiesincontext', 'role'), 'generalbox boxaligncenter');
    } else {
        // Print the capabilities overrideable in this context
        print_box_start('generalbox boxwidthwide boxaligncenter');
        if ($showadvanced) {
            $showadvancedlabel = get_string('hideadvanced', 'form');
        } else {
            $showadvancedlabel = get_string('showadvanced', 'form');
        }
        ?>
<form id="overrideform" action="<?php 
        echo $baseurl . '&amp;roleid=' . $roleid;
Esempio n. 3
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;
 }
Esempio n. 4
0
 /**
  * This method should be overriden if you want to include a special heading or some other
  * html on a question editing page besides the question editing form.
  *
  * @param question_edit_form $mform a child of question_edit_form
  * @param object $question
  * @param string $wizardnow is '' for first page.
  */
 function display_question_editing_page(&$mform, $question, $wizardnow)
 {
     list($heading, $langmodule) = $this->get_heading(empty($question->id));
     print_heading_with_help($heading, $this->name(), $langmodule);
     $permissionstrs = array();
     if (!empty($question->id)) {
         if ($question->formoptions->canedit) {
             $permissionstrs[] = get_string('permissionedit', 'question');
         }
         if ($question->formoptions->canmove) {
             $permissionstrs[] = get_string('permissionmove', 'question');
         }
         if ($question->formoptions->cansaveasnew) {
             $permissionstrs[] = get_string('permissionsaveasnew', 'question');
         }
     }
     if (!$question->formoptions->movecontext && count($permissionstrs)) {
         print_heading(get_string('permissionto', 'question'), 'center', 3);
         $html = '<ul>';
         foreach ($permissionstrs as $permissionstr) {
             $html .= '<li>' . $permissionstr . '</li>';
         }
         $html .= '</ul>';
         print_box($html, 'boxwidthnarrow boxaligncenter generalbox');
     }
     $mform->display();
 }
Esempio n. 5
0
if (!($site = get_site())) {
    error("Could not find site-level course");
}
if (!($adminuser = get_admin())) {
    error("Could not find site admin");
}
$strfile = get_string('file');
$struser = get_string('user');
$strusersupdated = get_string('usersupdated');
$struploadpictures = get_string('uploadpictures', 'admin');
$userfields = array(0 => 'username', 1 => 'idnumber', 2 => 'id');
$userfield = optional_param('userfield', 0, PARAM_INT);
$overwritepicture = optional_param('overwritepicture', 0, PARAM_BOOL);
/// Print the header
admin_externalpage_print_header();
print_heading_with_help($struploadpictures, 'uploadpictures');
$mform = new admin_uploadpicture_form(null, $userfields);
if ($formdata = $mform->get_data()) {
    if (!array_key_exists($userfield, $userfields)) {
        notify(get_string('uploadpicture_baduserfield', 'admin'));
    } else {
        // Large files are likely to take their time and memory. Let PHP know
        // that we'll take longer, and that the process should be recycled soon
        // to free up memory.
        @set_time_limit(0);
        @raise_memory_limit("192M");
        if (function_exists('apache_child_terminate')) {
            @apache_child_terminate();
        }
        // Create a unique temporary directory, to process the zip file
        // contents.
    $cnt = 0;
    $table->data[] = array('<strong>' . $section->fullname . '</section>');
    $table->data[] = array(netpublish_print_move_here($cm->id, $articleid, $cnt, $section->id));
    if ($articles = netpublish_get_articles($section->id, $netpublish->id)) {
        foreach ($articles as $article) {
            if ($article->id == $articleid) {
                continue;
            }
            $cnt++;
            $table->data[] = array("&nbsp;&nbsp;&nbsp;&nbsp;" . stripslashes($article->title));
            $table->data[] = array(netpublish_print_move_here($cm->id, $articleid, $cnt, $section->id));
        }
    }
}
// all of the printing
print_heading_with_help(get_string('movingarticle', 'netpublish') . ": {$movingarticle->title}", 'movingarticle', 'netpublish');
print_tabs($tabs, $cm->id);
echo '<p>';
print_table($table);
echo '</p>';
print_footer($course);
//////////////////////////////// HELP FUNCTIONS ////////////////////////////////
function netpublish_array_search($needle, $haystack)
{
    $needle = intval($needle);
    foreach ($haystack as $key => $value) {
        if ($needle === intval($value)) {
            return (int) $key;
            exit;
        }
    }
Esempio n. 7
0
        $efile = "{$CFG->wwwroot}/file.php?file=/" . $qformat->question_get_export_dir() . "/{$exportfilename}" . $file_ext . "&forcedownload=1";
    }
    echo "<p><div class=\"boxaligncenter\"><a href=\"{$efile}\">{$txt->download}</a></div></p>";
    echo "<p><div class=\"boxaligncenter\"><font size=\"-1\">{$txt->downloadextra}</font></div></p>";
    print_continue("edit.php?courseid={$course->id}");
    print_footer($course);
    exit;
}
/// Display upload form
// get valid formats to generate dropdown list
$fileformatnames = get_import_export_formats('export');
// get filename
if (empty($exportfilename)) {
    $exportfilename = default_export_filename($course, $category);
}
print_heading_with_help($txt->exportquestions, 'export', 'quiz');
print_box_start('generalbox boxwidthnormal boxaligncenter');
?>

    <form enctype="multipart/form-data" method="post" action="export.php">
        <fieldset class="invisiblefieldset" style="display: block;">
            <input type="hidden" name="sesskey" value="<?php 
echo sesskey();
?>
" />
            <input type="hidden" name="courseid" value="<?php 
echo $course->id;
?>
" />

            <table cellpadding="5">
Esempio n. 8
0
 /**
  * Print a standard lesson heading.
  *
  * This will also print up to three
  * buttons in the breadcrumb, lesson heading
  * lesson tabs, lesson notifications and perhaps
  * a popup with a media file.
  *
  * @return void
  **/
 function print_header($title = '', $morenavlinks = array())
 {
     global $CFG;
     $this->init_full();
     /// Variable setup/check
     $context = get_context_instance(CONTEXT_MODULE, $this->modulerecord->id);
     $activityname = format_string($this->activityrecord->name);
     if ($this->lessonpageid === NULL) {
         error('Programmer error: must set the lesson page ID');
     }
     if (empty($title)) {
         $title = "{$this->courserecord->shortname}: {$activityname}";
     }
     /// Build the buttons
     if (has_capability('mod/lesson:edit', $context)) {
         $buttons = '<span class="edit_buttons">' . update_module_button($this->modulerecord->id, $this->courserecord->id, get_string('modulename', 'lesson'));
         if (!empty($this->lessonpageid) and $this->lessonpageid != LESSON_EOL) {
             $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/lesson.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="action" value="editpage" />' . '<input type="hidden" name="redirect" value="navigation" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="submit" value="' . get_string('editpagecontent', 'lesson') . '" />' . '</form>';
             if (!empty($CFG->showblocksonmodpages) and $this->user_allowed_editing()) {
                 if ($this->user_is_editing()) {
                     $onoff = 'off';
                 } else {
                     $onoff = 'on';
                 }
                 $buttons .= '<form ' . $CFG->frametarget . ' method="get" action="' . $CFG->wwwroot . '/mod/lesson/view.php">' . '<input type="hidden" name="id" value="' . $this->modulerecord->id . '" />' . '<input type="hidden" name="pageid" value="' . $this->lessonpageid . '" />' . '<input type="hidden" name="edit" value="' . $onoff . '" />' . '<input type="submit" value="' . get_string("blocksedit{$onoff}") . '" />
                             </form>';
             }
         }
         $buttons .= '</span>';
     } else {
         $buttons = '&nbsp;';
     }
     /// Build the meta
     /// Currently broken because the $meta is printed before the JavaScript is printed
     // if (!optional_param('pageid', 0, PARAM_INT) and !empty($this->activityrecord->mediafile)) {
     //     // open our pop-up
     //     $url = '/mod/lesson/mediafile.php?id='.$this->modulerecord->id;
     //     $name = 'lessonmediafile';
     //     $options = 'menubar=0,location=0,left=5,top=5,scrollbars,resizable,width='. $this->activityrecord->mediawidth .',height='. $this->activityrecord->mediaheight;
     //     $meta = "\n<script type=\"text/javascript\">";
     //     $meta .= "\n<!--\n";
     //     $meta .= "     openpopup('$url', '$name', '$options', 0);";
     //     $meta .= "\n// -->\n";
     //     $meta .= '</script>';
     // } else {
     $meta = '';
     // }
     $navigation = build_navigation($morenavlinks, $this->modulerecord);
     print_header($title, $this->courserecord->fullname, $navigation, '', $meta, true, $buttons, user_login_string($this->courserecord) . '<hr style="width:95%">' . navmenu($this->courserecord, $this->modulerecord));
     if (has_capability('mod/lesson:manage', $context)) {
         print_heading_with_help($activityname, 'overview', 'lesson');
         // Rename our objects for the sake of the tab code
         list($cm, $course, $lesson, $currenttab) = array(&$this->modulerecord, &$this->courserecord, &$this->activityrecord, 'view');
         include $CFG->dirroot . '/mod/lesson/tabs.php';
     } else {
         print_heading($activityname);
     }
     lesson_print_messages();
 }
Esempio n. 9
0
// echo '<div class="mdl-align"><table width="80%" cellpadding="10"><tr><td>';
echo '<div><table width="80%" cellpadding="10"><tr><td>';
if ($check_anonymously) {
    $itemnr = 0;
    //print the items in an analysed form
    foreach ($items as $item) {
        if ($item->hasvalue == 0) {
            continue;
        }
        echo '<table width="100%" class="generalbox">';
        //get the class of item-typ
        $itemclass = 'feedback_item_' . $item->typ;
        //get the instance of the item-class
        $itemobj = new $itemclass();
        $itemnr++;
        if ($feedback->autonumbering) {
            $printnr = $itemnr . '.';
        } else {
            $printnr = '';
        }
        $itemobj->print_analysed($item, $printnr, $mygroupid);
        // $itemnr = $itemobj->print_analysed($item, $itemnr, $mygroupid);
        echo '</table>';
    }
} else {
    print_heading_with_help(get_string('insufficient_responses_for_this_group', 'feedback'), 'insufficient_responses', 'feedback');
}
echo '</td></tr></table></div>';
// print_simple_box_end();
print_box_end();
print_footer($course);
Esempio n. 10
0
 /**
  * Outputs a list to allow editing/rearranging of existing categories
  *
  * $this->initialize() must have already been called
  *
  */
 function output_edit_lists()
 {
     print_heading_with_help(get_string('editcategories', 'quiz'), 'categories', 'question');
     foreach ($this->editlists as $context => $list) {
         $listhtml = $list->to_html(0, array('str' => $this->str));
         if ($listhtml) {
             print_box_start('boxwidthwide boxaligncenter generalbox questioncategories contextlevel' . $list->context->contextlevel);
             print_heading(get_string('questioncatsfor', 'question', print_context_name(get_context_instance_by_id($context))), '', 3);
             echo $listhtml;
             print_box_end();
         }
     }
     echo $list->display_page_numbers();
 }
$strwebquests = get_string("modulenameplural", "webquest");
print_header_simple(format_string($webquest->name), "", "<a href=\"index.php?id={$course->id}\">{$strwebquests}</a> ->\n                  <a href=\"view.php?id={$cm->id}\">" . format_string($webquest->name, true) . "</a> -> {$strtasks}", "", "", true);
add_to_log($course->id, "webquest", "update tasks", "view.php?id={$cm->id}", "{$webquest->id}");
$straction = $action ? '-> ' . get_string($action, 'webquest') : '';
//*********************************************edit tasks**********************/////
if ($action == 'edittasks') {
    if (!isteacher($course->id)) {
        error("Only teachers can look at this page");
        /// is trying to get access but not allowed jejejeje
    }
    $count = count_records("webquest_grades", "webquestid", $webquest->id);
    if ($count) {
        notify(get_string("warningtask", "webquest"));
    }
    ///// setup a form to edit tasks
    print_heading_with_help(get_string("edittasks", "webquest"), "tasks", "webquest");
    ?>
        <form name="form" method="post" action="tasks.php">
        <input type="hidden" name="id" value="<?php 
    echo $cm->id;
    ?>
" />
        <input type="hidden" name="action" value="inserttasks" />
        <center><table cellpadding="5" border="1">
        <?php 
    // get existing tasks, if none set up appropriate default ones
    if ($tasksraw = get_records("webquest_tasks", "webquestid", $webquest->id, "taskno ASC")) {
        foreach ($tasksraw as $task) {
            $tasks[] = $task;
            // to renumber index 0,1,2...
        }
                    $thismod = get_record($modnames[$i]->name, "id", $mod->instance);
                    $checkmod = get_record("block_openshare_modules", "moduleid", $mod->id);
                    $menu .= '<tr class="modinstance">' . "\n\t\t" . '<td class="ffield">';
                    //make the license select menu
                    $menu .= make_license_select('license_' . $mod->id, $modid . '~license_' . $mod->id, $mod->id, $checkmod, $licenses);
                    $menu .= '</td>' . "\n\t\t" . '<td class="ffield">';
                    //make the radio buttons
                    $menu .= make_status_inputs('closed', 'status_' . $mod->id, $modid . '~closed_' . $mod->id, '1', '1,\'license_' . $mod->id . '\'', $checkmod);
                    $menu .= make_status_inputs('open', 'status_' . $mod->id, $modid . '~open_' . $mod->id, '2', '3,\'license_' . $mod->id . '\'', $checkmod);
                    $menu .= '</td>' . "\n\t\t" . '<td>' . $thismod->name . '</td>' . "\n\t</tr>\n";
                }
                reset($checkmod);
            }
        }
        //Print form
        print_heading_with_help(get_string('openmodsset', 'block_openshare'), 'openshare', 'block_openshare');
        print_simple_box_start("center");
        print "<h2>" . $course->fullname . " (" . $course->shortname . ")</h2>";
        ?>
	<script type="text/javascript" src="set_open_mods.js"></script>

	<style type="text/css">
		#openshare { border: 2px solid gray; }
		#openshare td, #openshare th { border: 1px solid gray; border-collapse: collapse; text-align: left; padding: 4px 6px; }
		#openshare th {text-transform: capitalize; font-weight: normal; }
		tr.allmods { border: 2px solid; }
		.allmods th { font-size: 130%; text-align: center; vertical-align: top; }
		.modtype { border: 2px solid gray; text-transform: capitalize; }
		.modtype th { font-size: 120%;}
		#openshare tr.modtype th.ffield { padding-left: 1em;  background: url("<?php 
        echo $CFG->wwwroot;
Esempio n. 13
0
        }
        $options['action'] = 'duplicate';
        print_single_button('manage.php', $options, get_string('duplicaterole', 'role'));
        print_single_button('manage.php', null, get_string('listallroles', 'role'));
        echo '</div>';
    }
    echo '</div>';
    $lang = str_replace('_utf8', '', current_language());
    print_simple_box_start('center');
    include_once 'manage.html';
    print_simple_box_end();
    if ($usehtmleditor) {
        use_html_editor('description');
    }
} else {
    print_heading_with_help(get_string('roles', 'role'), 'roles');
    $table = new object();
    $table->tablealign = 'center';
    $table->align = array('right', 'left', 'left', 'left');
    $table->wrap = array('nowrap', '', 'nowrap', 'nowrap');
    $table->cellpadding = 5;
    $table->cellspacing = 0;
    $table->width = '90%';
    $table->data = array();
    $table->head = array(get_string('name'), get_string('description'), get_string('shortname'), get_string('edit'));
    /*************************
     * List all current roles *
     **************************/
    foreach ($roles as $role) {
        $stredit = get_string('edit');
        $strdelete = get_string('delete');
            $objects = game_bookquiz_create_objects($pageobjects, $bookid);
            // function to preps the data to be sent to DB
            if (!game_bookquiz_save_objects($objects)) {
                // sends it to DB
                error("could not save");
            }
        } else {
            error('could not get data');
        }
        print_continue("{$CFG->wwwroot}/mod/game/view.php?id={$cm->id}");
        print_footer($course);
        exit;
    }
}
/// Print upload form
print_heading_with_help(get_string("bookquiz_import_odt", "game"), "importodt", "game");
print_simple_box_start("center");
?>
    <form id="theform" enctype="multipart/form-data" method="post">
    <input type="hidden" name="id" value="<?php 
echo $cm->id;
?>
" />
    <table cellpadding="5">

    <tr><td align="right"><b>
    <?php 
print_string("upload");
?>
 :</td><td>
    <input name="newfile" type="file" size="50" />
Esempio n. 15
0
    exercise_print_assessment_form($exercise, $assessment, true, $_SERVER["HTTP_REFERER"]);
} elseif ($action == 'displaygradingform') {
    print_heading_with_help(get_string("specimenassessmentform", "exercise"), "specimen", "exercise");
    exercise_print_assessment_form($exercise);
    // called with no assessment
    print_continue("view.php?id={$cm->id}");
} elseif ($action == 'editelements') {
    if (!has_capability('mod/exercise:assess', $context)) {
        error("Only teachers can look at this page");
    }
    $count = count_records("exercise_grades", "exerciseid", $exercise->id);
    if ($exercise->phase > 1 and $count) {
        notify(get_string("warningonamendingelements", "exercise"));
    }
    // set up heading, form and table
    print_heading_with_help(get_string("editingassessmentelements", "exercise"), "elements", "exercise");
    ?>
        <form id="form" method="post" action="assessments.php">
        <input type="hidden" name="id" value="<?php 
    echo $cm->id;
    ?>
" />
        <input type="hidden" name="action" value="insertelements" />
        <center><table cellpadding="5" border="1">
        <?php 
    // get existing elements, if none set up appropriate default ones
    if ($elementsraw = get_records("exercise_elements", "exerciseid", $exercise->id, "elementno ASC")) {
        foreach ($elementsraw as $element) {
            $elements[] = $element;
            // to renumber index 0,1,2...
        }
Esempio n. 16
0
            // function to preps the data to be sent to DB
            if (!$mod_save_objects($objects, $mod->id, $pageid)) {
                // sends it to DB
                error("could not save");
            }
        } else {
            error('could not get data');
        }
        echo "<hr>";
        print_continue("{$CFG->wwwroot}/mod/{$modname}/view.php?id={$cm->id}");
        print_footer($course);
        exit;
    }
}
/// Print upload form
print_heading_with_help($strimportppt, "importppt", "lesson");
print_simple_box_start("center");
echo "<form id=\"theform\" enctype=\"multipart/form-data\" method=\"post\">";
echo "<input type=\"hidden\" name=\"id\" value=\"{$cm->id}\" />\n";
echo "<input type=\"hidden\" name=\"pageid\" value=\"{$pageid}\" />\n";
echo "<table cellpadding=\"5\">";
echo "<tr><td align=\"right\">";
print_string("upload");
echo ":</td><td>";
echo "<input name=\"newfile\" type=\"file\" size=\"50\" />";
echo "</td></tr><tr><td>&nbsp;</td><td>";
echo "<input type=\"submit\" name=\"save\" value=\"" . get_string("uploadthisfile") . "\" />";
echo "</td></tr>";
echo "</table>";
echo "</form>";
print_simple_box_end();
Esempio n. 17
0
        admin_externalpage_setup('checkpermissions', '', array('contextid' => $contextid));
        admin_externalpage_print_header();
    } else {
        if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) {
            admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid), $CFG->wwwroot . '/' . $CFG->admin . '/roles/check.php');
            admin_externalpage_print_header();
            $currenttab = 'check';
            include_once 'tabs.php';
        } else {
            $currenttab = 'check';
            include_once 'tabs.php';
        }
    }
}
/// Print heading.
print_heading_with_help($title, 'checkpermissions');
/// If a user has been chosen, show all the permissions for this user.
$reportuser = $userselector->get_selected_user();
if (!is_null($reportuser)) {
    print_box_start('generalbox boxaligncenter boxwidthwide');
    print_heading(get_string('permissionsforuser', 'role', fullname($reportuser)), '', 3);
    $table = new explain_capability_table($context, $reportuser, $contextname);
    $table->display();
    print_box_end();
    $selectheading = get_string('selectanotheruser', 'role');
} else {
    $selectheading = get_string('selectauser', 'role');
}
/// Show UI for choosing a user to report on.
print_box_start('generalbox boxwidthnormal boxaligncenter', 'chooseuser');
echo '<form method="get" action="' . $CFG->wwwroot . '/' . $CFG->admin . '/roles/check.php" >';
Esempio n. 18
0
 function importprocess($filename)
 {
     global $CFG, $USER, $strimportquestions, $form, $question_category, $category, $COURSE, $hostname, $mdapath, $mdbpath;
     if (PHP_OS == "Linux" and isset($hostname)) {
         $hostname = trim($hostname);
         // test the ODBC socket server connection
         // if failure, unset hostname and set hostname_access_error
         $question_categories = $this->getquestioncategories($mdbpath, $mdapath, $hostname);
         if (!$question_categories) {
             $hostname_access_error = $hostname . " ";
             unset($hostname);
         } else {
             $hostname_access_error = 0;
         }
     }
     if (PHP_OS == "Linux" and !isset($hostname)) {
         // copy the file to a semi-permanent location
         if (!($basedir = make_upload_directory("{$COURSE->id}"))) {
             error("The site administrator needs to fix the file permissions for the data directory");
         }
         if (!isset($hostname_access_error)) {
             $bname = basename($filename);
             $cleanfilename = clean_filename($bname);
             if ($cleanfilename) {
                 $newfile = "{$basedir}/{$cleanfilename}";
                 if (move_uploaded_file($filename, $newfile)) {
                     chmod($newfile, 0666);
                     clam_log_upload($newfile, $COURSE);
                 } else {
                     notify(get_string("uploadproblem", "", $filename));
                 }
             }
             $filename = $newfile;
         }
         print_heading_with_help($strimportquestions, "import", "quiz");
         print_simple_box_start("center");
         if ($hostname_access_error) {
             notify("couldn't connect to ODBC Socket Server on " . $hostname_access_error);
         }
         echo "<form method=\"post\" action=\"import.php\">";
         echo '<fieldset class="invisiblefieldset">';
         echo "<table cellpadding=\"5\">";
         echo "<tr><td align=\"right\">";
         echo "What is the hostname or IP address of the ODBC Socket Server:</td><td>";
         echo " <input name=\"hostname\" type=\"text\" size=\"50\" value=\"" . stripslashes($hostname_access_error) . "\" />";
         echo " <input name=\"filename\" type=\"hidden\" value=\"" . $filename . "\" />";
         echo " <input name=\"category\" type=\"hidden\" value=\"" . $category->id . "\" />";
         echo " <input name=\"format\" type=\"hidden\" value=\"" . $form->format . "\" />";
         echo "</td><td>&nbsp;</td></tr>";
         echo "<tr><td align=\"right\">";
         echo "What is the location of the database (.mdb file) on the Socket Server:</td><td>";
         echo " <input name=\"mdbpath\" type=\"text\" size=\"50\" value=\"" . stripslashes($mdbpath) . "\" />";
         echo "</td><td>&nbsp;</td></tr>";
         echo "<tr><td align=\"right\">";
         echo "What is the location of the system database (System.mda file) on the Socket Server:</td><td>";
         echo " <input name=\"mdapath\" type=\"text\" size=\"50\" value=\"" . stripslashes($mdapath) . "\" />";
         echo "</td><td>&nbsp;</td></tr>";
         echo "<tr><td>&nbsp;</td><td>";
         echo " <input type=\"submit\" name=\"save\" value=\"Connect to Server\" />";
         echo "</td></tr>";
         echo "</table>";
         echo '</fieldset>';
         echo "</form>";
         print_simple_box_end();
         print_footer($COURSE);
         exit;
     }
     // we get here if running windows or after connect to ODBC socket server on linux
     //
     // this generates the page to choose categories of questions to import
     //
     if (!isset($question_category)) {
         if (PHP_OS == "WINNT") {
             // copy the file to a semi-permanent location
             if (!($basedir = make_upload_directory("{$COURSE->id}"))) {
                 error("The site administrator needs to fix the file permissions for the data directory");
             }
             $bname = basename($filename);
             $cleanfilename = clean_filename($bname);
             if ($cleanfilename) {
                 $newfile = "{$basedir}/{$cleanfilename}";
                 if (move_uploaded_file($filename, $newfile)) {
                     chmod($newfile, 0666);
                     clam_log_upload($newfile, $COURSE);
                 } else {
                     notify(get_string("uploadproblem", "", $filename));
                 }
             }
             $filename = $newfile;
         }
         // end of file copy
         // don't have to do this on linux, since it's alreay been done in the test above
         if (PHP_OS == "WINNT") {
             $question_categories = $this->getquestioncategories($filename);
         }
         // print the intermediary form
         if (!($categories = question_category_options($COURSE->id, true))) {
             error("No categories!");
         }
         print_heading_with_help($strimportquestions, "import", "quiz");
         print_simple_box_start("center");
         echo "<form method=\"post\" action=\"import.php\">";
         echo '<fieldset class="invisiblefieldset">';
         echo "<table cellpadding=\"5\">";
         echo "<tr><td align=\"right\">";
         echo "Choose a category of questions to import:</td><td>";
         asort($question_categories);
         choose_from_menu($question_categories, "question_category", "All Categories", "All Categories", "", "allcategories");
         echo " <input name=\"filename\" type=\"hidden\" value=\"" . $filename . "\" />";
         echo " <input name=\"category\" type=\"hidden\" value=\"" . $category->id . "\" />";
         echo " <input name=\"format\" type=\"hidden\" value=\"" . $form->format . "\" />";
         if (PHP_OS == "Linux") {
             echo " <input name=\"hostname\" type=\"hidden\" value=\"" . stripslashes(trim($hostname)) . "\" />";
             echo " <input name=\"mdbpath\" type=\"hidden\" value=\"" . stripslashes($mdbpath) . "\" />";
             echo " <input name=\"mdapath\" type=\"hidden\" value=\"" . stripslashes($mdapath) . "\" />";
         }
         echo "</td><td>&nbsp;</td>";
         echo "</tr><tr><td>&nbsp;</td><td>";
         echo " <input type=\"submit\" name=\"save\" value=\"Import Questions\" />";
         echo "</td></tr>";
         echo "</table>";
         echo '</fieldset>';
         echo "</form>";
         print_simple_box_end();
         print_footer($COURSE);
         exit;
     }
     //
     // this is the main import section
     //
     notify("Importing questions");
     if (PHP_OS == "Linux") {
         $hostname = trim($hostname);
         $records = $this->getquestions($mdbpath, $question_category, $mdapath, $hostname);
     } else {
         $records = $this->getquestions($filename, $question_category);
     }
     foreach ($records as $qrec) {
         $question = $this->defaultquestion();
         if ($qrec[9] != "") {
             $question->image = $qrec[9];
         }
         //  0   Selected
         //  1   PracticeTestOK?
         //  2   QuestionText
         //  3   QuestionType
         //  4   Option1Text
         //  5   Option2Text
         //  6   Option3Text
         //  7   Option4Text
         //  8   CorrectAnswer
         //  9   Graphic
         //  10  Module
         //  11  ChapterNumber
         //  12  PageNumber
         $ref = "Answer can be found in chapter " . $qrec[11] . ", page " . $qrec[12] . ".";
         switch ($qrec[3]) {
             case 1:
                 $question->qtype = MULTICHOICE;
                 // MULTICHOICE, SHORTANSWER, TRUEFALSE
                 //          echo "<pre>";echo htmlspecialchars($qrec[2]); echo "</pre>";
                 $question->questiontext = addslashes(trim($qrec[2]));
                 //          echo "<pre>";echo $question->questiontext; echo "</pre>";
                 $question->name = preg_replace("/<br />/", "", $question->questiontext);
                 $question->single = 1;
                 // Only one answer is allowed -- used for multiple choicers
                 $fractionset = 0;
                 for ($i = 4; $i <= 7; $i++) {
                     if ($qrec[$i] != "") {
                         $question->answer[$i - 3] = addslashes($qrec[$i]);
                         if ($qrec[8] == $i - 3) {
                             // if this is the index of CorrectAnswer
                             $question->fraction[$i - 3] = 1;
                             $fractionset = 1;
                         } else {
                             $question->fraction[$i - 3] = 0;
                         }
                         $question->feedback[$i - 3] = ($qrec[8] == $i - 3 ? "Correct. " : "Incorrect. ") . $ref;
                     }
                 }
                 if ($fractionset == 0) {
                     $question->fraction[1] = 1;
                 }
                 break;
             case 2:
                 // TRUE FALSE
                 $question->qtype = TRUEFALSE;
                 $question->questiontext = addslashes(trim($qrec[2]));
                 $question->name = preg_replace("/<br />/", "", $question->questiontext);
                 // for TF, $question->answer should be 1 for true, 0 for false
                 if ($qrec[8] == "T") {
                     $question->answer = 1;
                 } else {
                     $question->answer = 0;
                 }
                 // for TF, use $question->feedbacktrue and feedbackfalse
                 $question->feedbacktrue = ($qrec[8] == "T" ? "Correct. " : "Incorrect. ") . $ref;
                 $question->feedbackfalse = ($qrec[8] == "F" ? "Correct. " : "Incorrect. ") . $ref;
                 break;
             case 3:
                 $question->qtype = SHORTANSWER;
                 $question->questiontext = addslashes(trim($qrec[2]));
                 //          echo "<pre>";echo $question->questiontext; echo "</pre>";
                 $question->name = preg_replace("/<br />/", "", $question->questiontext);
                 $question->usecase = 0;
                 // Ignore case -- for SHORT ANSWER questions
                 $answers = explode("~", $qrec[8]);
                 $question->answer[0] = " ";
                 $question->fraction[0] = 1;
                 for ($i = 0; $i < count($answers); $i++) {
                     $question->answer[$i] = addslashes(trim($answers[$i]));
                     $question->feedback[$i] = $ref;
                     $question->fraction[$i] = 1;
                     // 1 for 100%, 0 for none or somewhere in between
                 }
                 break;
             case 4:
                 $question = 0;
                 notify("Cannot use essay questions - skipping question " . $qrec[2] . " " . $ref);
                 break;
             default:
                 $question = 0;
                 notify("Misformatted Record.  Question Skipped.");
                 break;
         }
         if ($question) {
             $questions[] = $question;
         }
     }
     $count = 0;
     // process all the questions
     if (PHP_OS == "WINNT") {
         $filename = str_replace("\\\\", "\\", $filename);
         $filename = str_replace("/", "\\", $filename);
     }
     foreach ($questions as $question) {
         // Process and store each question
         $count++;
         echo "<hr /><p><b>{$count}</b>. " . stripslashes($question->questiontext) . "</p>";
         $question->category = $this->category->id;
         $question->stamp = make_unique_id_code();
         // Set the unique code (not to be changed)
         $question->createdby = $USER->id;
         $question->timecreated = time();
         if (!($question->id = insert_record("question", $question))) {
             error("Could not insert new question!");
         }
         $this->questionids[] = $question->id;
         // Now to save all the answers and type-specific options
         $result = save_question_options($question);
         if (!empty($result->error)) {
             notify($result->error);
             $this->deletedatabase($filename);
             return false;
         }
         if (!empty($result->notice)) {
             notify($result->notice);
             $this->deletedatabase($filename);
             return true;
         }
         // Give the question a unique version stamp determined by question_hash()
         set_field('question', 'version', question_hash($question), 'id', $question->id);
     }
     $this->deletedatabase($filename);
     return true;
 }
Esempio n. 19
0
                                echo $strindent . get_string('addedtogroup', '', $addgroup) . '<br />';
                            } else {
                                notify(get_string('erroronline', 'error', $linenum) . ': ' . get_string('addedtogroupnot', '', $addgroup));
                            }
                        } else {
                            notify(get_string('erroronline', 'error', $linenum) . ': ' . get_string('addedtogroupnotenrolled', '', $addgroup));
                        }
                    } else {
                        notify(get_string('erroronline', 'error', $linenum) . ': ' . get_string('groupunknown', 'error', $addgroup));
                    }
                }
            }
        }
        echo '</p>';
        notify(get_string('userscreated', 'admin') . ': ' . $usersnew);
        notify(get_string('usersupdated', 'admin') . ': ' . $usersupdated);
        notify(get_string('usersdeleted', 'admin') . ': ' . $usersdeleted);
        notify(get_string('deleteerrors', 'admin') . ': ' . $deleteerrors);
        if ($allowrenames) {
            notify(get_string('usersrenamed', 'admin') . ': ' . $renames);
            notify(get_string('renameerrors', 'admin') . ': ' . $renameerrors);
        }
        notify(get_string('errors', 'admin') . ': ' . $userserrors);
    }
    fclose($fp);
    echo '<hr />';
}
/// Print the form
print_heading_with_help(get_string('uploadusers'), 'uploadusers2');
$mform->display();
admin_externalpage_print_footer();
    if (empty($form->name)) {
        $form->name = "";
    }
    if (empty($form->description)) {
        $form->description = "";
    }
    if (empty($form->path)) {
        $form->path = "http://";
    }
    $string = get_string('cancel');
    $strsearch = get_string("searchweb", "webquest");
    $strchooseafile = get_string("chooseafile", "webquest");
    if (!$resid) {
        print_heading_with_help(get_string("insertresources", "webquest"), "insertresources", "webquest");
    } else {
        print_heading_with_help(get_string("editresource", "webquest"), "editresource", "webquest");
    }
    ?>
        <form name="form" method="post" action="resources.php">
        <input type="hidden" name="id" value="<?php 
    echo $cm->id;
    ?>
" />
        <input type="hidden" name="action" value="insertres" />
    <input type="hidden" name="resid" value="<?php 
    echo $resid;
    ?>
" />
        <center><table cellpadding="5" border="1">
        <?php 
    if (right_to_left()) {
Esempio n. 21
0
 function display_question_editing_page(&$mform, $question, $wizardnow)
 {
     $heading = $this->get_heading(empty($question->id));
     print_heading_with_help($heading, $this->name(), $this->plugin_name());
     $mform->display();
 }
Esempio n. 22
0
        // load data into class
        $qformat->setCategory($category);
        $qformat->setContexts($contexts->having_one_edit_tab_cap('import'));
        $qformat->setCourse($COURSE);
        $qformat->setFilename($importfile);
        $qformat->setMatchgrades($form->matchgrades);
        $qformat->setCatfromfile(!empty($form->catfromfile));
        $qformat->setContextfromfile(!empty($form->contextfromfile));
        $qformat->setStoponerror($form->stoponerror);
        // Do anything before that we need to
        if (!$qformat->importpreprocess()) {
            error($txt->importerror, $thispageurl->out());
        }
        // Process the uploaded file
        if (!$qformat->importprocess()) {
            error($txt->importerror, $thispageurl->out());
        }
        // In case anything needs to be done after
        if (!$qformat->importpostprocess()) {
            error($txt->importerror, $thispageurl->out());
        }
        echo "<hr />";
        print_continue("edit.php?" . $thispageurl->get_query_string(array('category' => "{$qformat->category->id},{$qformat->category->contextid}")));
        print_footer($COURSE);
        exit;
    }
}
print_heading_with_help($txt->importquestions, "import", "quiz");
/// Print upload form
$import_form->display();
print_footer($COURSE);
Esempio n. 23
0
    if (!($apageid = $DB->get_field("lesson_pages", "id", array("lessonid" => $lesson->id, "prevpageid" => 0)))) {
        print_error('cannotfindfirstpage', 'lesson');
    }
    while (true) {
        if ($apageid) {
            $title = $DB->get_field("lesson_pages", "title", array("id" => $apageid));
            $jump[$apageid] = $title;
            $apageid = $DB->get_field("lesson_pages", "nextpageid", array("id" => $apageid));
        } else {
            // last page reached
            break;
        }
    }
}
// give teacher a blank proforma
print_heading_with_help(get_string("addabranchtable", "lesson"), "overview", "lesson");
?>
    <form id="form" method="post" action="lesson.php" class="addform">
    <fieldset class="invisiblefieldset fieldsetfix">
    <input type="hidden" name="id" value="<?php 
echo $cm->id;
?>
" />
    <input type="hidden" name="action" value="insertpage" />
    <input type="hidden" name="pageid" value="<?php 
echo $pageid;
?>
" />
    <input type="hidden" name="qtype" value="<?php 
echo LESSON_BRANCHTABLE;
?>
// $form->section      = $module->section;     // The section ID
$form->course = $course->id;
$form->module = $module->id;
$form->modulename = $module->name;
//$form->instance     = $module->instance;
$form->mode = "update";
$form->sesskey = !empty($USER->id) ? $USER->sesskey : '';
$navlinks = array();
$navlinks[] = array('name' => "Sclipo Live Web Classes", 'link' => "{$CFG->wwwroot}/mod/{$module->name}/index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => "Create & Schedule Web Classes", 'link' => '', 'type' => 'action');
$navigation = build_navigation($navlinks);
print_header_simple("Sclipo", '', $navigation, "", "", false);
$modform = $CFG->dirroot . "/mod/sclipowebclass/mod.html";
if (empty($delete)) {
    $nextpage = $CFG->wwwroot . "/mod/sclipowebclass/" . $redirectpage;
}
if (file_exists($modform)) {
    $icon = '<img class="icon" src="' . $CFG->modpixpath . '/sclipowebclass/icon.gif" alt="' . get_string('modulename', "sclipowebclass") . '"/>';
    print_heading_with_help("Create & Schedule Your Sclipo Web Classes", "mods", "sclipowebclass", $icon);
    print_simple_box_start('center', '', '', 5, 'generalbox', "sclipowebclass");
    if ($good_login == 1) {
        redirect($nextpage, "Redirecting, please wait ...", 0);
    } else {
        $wrong_login = 1;
        include_once $modform;
    }
    print_simple_box_end();
} else {
    notice("This module cannot be added to this course yet! (No file found at: {$modform})", "{$CFG->wwwroot}/course/view.php?id={$course->id}");
}
print_footer($course);
Esempio n. 25
0
    $showroles = 1;
    $currenttab = 'override';
    include_once $CFG->dirroot . '/user/tabs.php';
} else {
    if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) {
        require_once $CFG->libdir . '/adminlib.php';
        admin_externalpage_setup('frontpageroles', '', array('contextid' => $contextid, 'roleid' => $roleid), $CFG->wwwroot . '/' . $CFG->admin . '/roles/override.php');
        admin_externalpage_print_header();
        $currenttab = 'override';
        include_once 'tabs.php';
    } else {
        $currenttab = 'override';
        include_once 'tabs.php';
    }
}
print_heading_with_help(get_string('overridepermissionsin', 'role', print_context_name($context)), 'overrides');
if ($roleid) {
    /// prints a form to swap roles
    echo '<div class="selector">';
    $overridableroles = array('0' => get_string('listallroles', 'role') . '...') + $overridableroles;
    popup_form("{$CFG->wwwroot}/{$CFG->admin}/roles/override.php?userid={$userid}&amp;courseid={$courseid}&amp;contextid={$contextid}&amp;roleid=", $overridableroles, 'switchrole', $roleid, '', '', '', false, 'self', $strroletooverride);
    echo '</div>';
    $parentcontexts = get_parent_contexts($context);
    if (!empty($parentcontexts)) {
        $parentcontext = array_shift($parentcontexts);
        $parentcontext = get_context_instance_by_id($parentcontext);
    } else {
        $parentcontext = $context;
        // site level in override??
    }
    $r_caps = role_context_capabilities($roleid, $parentcontext);
Esempio n. 26
0
 /**
  * This method should be overriden if you want to include a special heading or some other
  * html on a question editing page besides the question editing form.
  *
  * @param question_edit_form $mform a child of question_edit_form
  * @param object $question
  * @param string $wizardnow is '' for first page.
  */
 function display_question_editing_page(&$mform, $question, $wizardnow)
 {
     switch ($wizardnow) {
         case '':
             //on first page default display is fine
             parent::display_question_editing_page($mform, $question, $wizardnow);
             return;
             break;
         case 'datasetdefinitions':
             print_heading_with_help(get_string("choosedatasetproperties", "quiz"), "questiondatasets", "quiz");
             break;
         case 'datasetitems':
             print_heading_with_help(get_string("editdatasets", "quiz"), 'questiondatasets', "quiz");
             break;
     }
     $mform->display();
 }
Esempio n. 27
0
} else {
    $focuscursor = "form.name";
}
print_header_simple($streditinga, '', "<a href=\"{$CFG->wwwroot}/mod/{$module->name}/index.php?id={$course->id}\">{$strmodulenameplural}</a> ->\n     {$strnav} {$streditinga}", $focuscursor, "", false);
if (!empty($cm->id)) {
    $context = get_context_instance(CONTEXT_MODULE, $cm->id);
    $currenttab = 'update';
    include_once $CFG->dirroot . '/' . $CFG->admin . '/roles/tabs.php';
}
unset($SESSION->modform);
// Clear any old ones that may be hanging around.
$modform = "../mod/{$module->name}/mod.html";
if (file_exists($modform)) {
    if ($usehtmleditor = can_use_html_editor()) {
        $defaultformat = FORMAT_HTML;
        $editorfields = '';
    } else {
        $defaultformat = FORMAT_MOODLE;
    }
    $icon = '<img class="icon" src="' . $CFG->modpixpath . '/' . $module->name . '/icon.gif" alt="' . get_string('modulename', $module->name) . '"/>';
    print_heading_with_help($pageheading, "mods", $module->name, $icon);
    print_simple_box_start('center', '', '', 5, 'generalbox', $module->name);
    include_once $modform;
    print_simple_box_end();
    if ($usehtmleditor and empty($nohtmleditorneeded)) {
        use_html_editor($editorfields);
    }
} else {
    notice("This module cannot be added to this course yet! (No file found at: {$modform})", "{$CFG->wwwroot}/course/view.php?id={$course->id}");
}
print_footer($course);
Esempio n. 28
0
        echo get_string('usersweakpassword', 'admin') . ': ' . $forcechangepassword . '<br />';
        echo get_string('errors', 'admin') . ': ' . $userserrors . '</p>';
        echo $OUTPUT->box_end();
        if ($bulk) {
            echo $OUTPUT->continue_button($bulknurl);
        } else {
            echo $OUTPUT->continue_button($returnurl);
        }
        echo $OUTPUT->footer();
        die;
    }
}
// Print the header
admin_externalpage_print_header();
/// Print the form
print_heading_with_help(get_string('uploaduserspreview', 'admin'), 'uploadusers2');
$ci = 0;
$ri = 0;
echo '<table id="uupreview" class="generaltable boxaligncenter" summary="' . get_string('uploaduserspreview', 'admin') . '">';
echo '<tr class="heading r' . $ri++ . '">';
foreach ($columns as $col) {
    echo '<th class="header c' . $ci++ . '" scope="col">' . s($col) . '</th>';
}
echo '</tr>';
$cir->init();
while ($fields = $cir->next()) {
    if ($ri > $previewrows) {
        echo '<tr class="r' . $ri++ . '">';
        foreach ($fields as $field) {
            echo '<td class="cell c' . $ci++ . '">...</td>';
        }
Esempio n. 29
0
                }
            }
            $rolename = get_field('role', 'name', 'id', $roleid);
            add_to_log($course->id, 'role', 'unassign', 'admin/roles/assign.php?contextid=' . $context->id . '&roleid=' . $roleid, $rolename, '', $USER->id);
        } else {
            if ($showall) {
                $searchtext = '';
                $previoussearch = 0;
            }
        }
    }
}
if ($context->contextlevel == CONTEXT_COURSE and $context->instanceid == SITEID) {
    print_heading_with_help(get_string('frontpageroles', 'admin'), 'assignroles');
} else {
    print_heading_with_help(get_string('assignrolesin', 'role', print_context_name($context)), 'assignroles');
}
if ($context->contextlevel == CONTEXT_SYSTEM) {
    print_box(get_string('globalroleswarning', 'role'));
}
if ($roleid) {
    /// prints a form to swap roles
    /// Get all existing participants in this context.
    // Why is this not done with get_users???
    if (!($contextusers = get_role_users($roleid, $context, false, 'u.id, u.firstname, u.lastname, u.email, ra.hidden'))) {
        $contextusers = array();
    }
    $select = "username <> 'guest' AND deleted = 0 AND confirmed = 1";
    $usercount = count_records_select('user', $select) - count($contextusers);
    $searchtext = trim($searchtext);
    if ($searchtext !== '') {
Esempio n. 30
0
// $Id: uploadcsv.php,v 1.12.2.2 2008/02/07 16:27:53 ethem Exp $
/// Load libraries
require_once '../../config.php';
require_once $CFG->libdir . '/uploadlib.php';
require_once $CFG->dirroot . '/enrol/authorize/const.php';
require_once $CFG->dirroot . '/enrol/authorize/localfuncs.php';
/// Require capabilites
require_login();
require_capability('enrol/authorize:uploadcsv', get_context_instance(CONTEXT_USER, $USER->id));
/// Print header
$struploadcsv = get_string('uploadcsv', 'enrol_authorize');
$navlinks = array();
$navlinks[] = array('name' => $struploadcsv, 'link' => "uploadcsv.php", 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header_simple($struploadcsv, "", $navigation);
print_heading_with_help($struploadcsv, 'uploadcsv', 'enrol/authorize');
/// Handle CSV file
if (($form = data_submitted()) && confirm_sesskey()) {
    $um = new upload_manager('csvfile', false, false, null, false, 0);
    if ($um->preprocess_files()) {
        $filename = $um->files['csvfile']['tmp_name'];
        // Fix mac/dos newlines
        $text = file_get_contents($filename);
        $text = preg_replace('!\\r\\n?!', "\n", $text);
        $fp = fopen($filename, "w");
        fwrite($fp, $text);
        fclose($fp);
        authorize_process_csv($filename);
    }
}
/// Print submit form