當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MoodleQuickForm::display方法代碼示例

本文整理匯總了PHP中MoodleQuickForm::display方法的典型用法代碼示例。如果您正苦於以下問題:PHP MoodleQuickForm::display方法的具體用法?PHP MoodleQuickForm::display怎麽用?PHP MoodleQuickForm::display使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MoodleQuickForm的用法示例。


在下文中一共展示了MoodleQuickForm::display方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: display

 /**
  * Print html form.
  */
 function display()
 {
     //finalize the form definition if not yet done
     if (!$this->_definition_finalized) {
         $this->_definition_finalized = true;
         $this->definition_after_data();
     }
     $this->_form->display();
 }
開發者ID:nagyistoce,項目名稱:moodle-Teach-Pilot,代碼行數:12,代碼來源:formslib.php

示例2: array

    /**
     *  Display all the submissions ready for grading
     *
     * @global object
     * @global object
     * @global object
     * @global object
     * @param string $message
     * @return bool|void
     */
    function display_submissions($message='') {
        global $CFG, $DB, $USER, $DB, $OUTPUT, $PAGE;
        require_once($CFG->libdir.'/gradelib.php');

        /* first we check to see if the form has just been submitted
         * to request user_preference updates
         */

       $filters = array(self::FILTER_ALL             => get_string('all'),
                        self::FILTER_SUBMITTED       => get_string('submitted', 'assignment'),
                        self::FILTER_REQUIRE_GRADING => get_string('requiregrading', 'assignment'));

        $updatepref = optional_param('updatepref', 0, PARAM_INT);

        if (isset($_POST['updatepref'])){
            $perpage = optional_param('perpage', 10, PARAM_INT);
            $perpage = ($perpage <= 0) ? 10 : $perpage ;
            $filter = optional_param('filter', 0, PARAM_INT);
            set_user_preference('assignment_perpage', $perpage);
            set_user_preference('assignment_quickgrade', optional_param('quickgrade', 0, PARAM_BOOL));
            set_user_preference('assignment_filter', $filter);
        }

        /* 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);
        $filter = get_user_preferences('assignment_filter', 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;
        }

        $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->cm->id, $this->assignment->id, $this->cm->id);

        $PAGE->set_title(format_string($this->assignment->name,true));
        $PAGE->set_heading($this->course->fullname);
        echo $OUTPUT->header();

        echo '<div class="usersubmissions">';

        //hook to allow plagiarism plugins to update status/print links.
        plagiarism_update_status($this->course, $this->cm);

        /// Print quickgrade form around the table
        if ($quickgrade) {
            $formattrs = array();
            $formattrs['action'] = new moodle_url('/mod/assignment/submissions.php');
            $formattrs['id'] = 'fastg';
            $formattrs['method'] = 'post';

            echo html_writer::start_tag('form', $formattrs);
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'id',      'value'=> $this->cm->id));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'mode',    'value'=> 'fastgrade'));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'page',    'value'=> $page));
            echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'sesskey', 'value'=> sesskey()));
        }

        $course_context = get_context_instance(CONTEXT_COURSE, $course->id);
        if (has_capability('gradereport/grader:view', $course_context) && has_capability('moodle/grade:viewall', $course_context)) {
            echo '<div class="allcoursegrades"><a href="' . $CFG->wwwroot . '/grade/report/grader/index.php?id=' . $course->id . '">'
                . get_string('seeallcoursegrades', 'grades') . '</a></div>';
        }

        if (!empty($message)) {
            echo $message;   // display messages here if any
        }

        $context = get_context_instance(CONTEXT_MODULE, $cm->id);

    /// Check to see if groups are being used in this assignment

        /// find out current groups mode
        $groupmode = groups_get_activity_groupmode($cm);
        $currentgroup = groups_get_activity_group($cm, true);
        groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/assignment/submissions.php?id=' . $this->cm->id);
//.........這裏部分代碼省略.........
開發者ID:nuckey,項目名稱:moodle,代碼行數:101,代碼來源:lib.php

示例3: helper_search_form

 /**
  * Renders a search form
  *
  * @param string $search Search string
  * @return string HTML
  */
 protected function helper_search_form($search)
 {
     global $CFG;
     require_once $CFG->libdir . '/formslib.php';
     $mform = new MoodleQuickForm('searchform', 'POST', $this->page->url);
     $mform->addElement('hidden', 'sesskey', sesskey());
     $el[] = $mform->createElement('text', 'search', get_string('search'), array('size' => 20));
     $mform->setDefault('search', $search);
     $el[] = $mform->createElement('submit', 'submitsearch', get_string('search'));
     $el[] = $mform->createElement('submit', 'clearsearch', get_string('clear'));
     $mform->addGroup($el, 'searchgroup', get_string('searchname', 'badges'), ' ', false);
     ob_start();
     $mform->display();
     $out = ob_get_clean();
     return $out;
 }
開發者ID:Jtgadbois,項目名稱:Pedadida,代碼行數:22,代碼來源:renderer.php

示例4: ouwiki_render_user_grade

 /**
  * Render single users grading form
  *
  * @param object $course
  * @param object $cm
  * @param object $ouwiki
  * @param object $user
  */
 public function ouwiki_render_user_grade($course, $cm, $ouwiki, $user, $pagename, $groupid)
 {
     global $CFG;
     require_once $CFG->libdir . '/gradelib.php';
     $grading_info = grade_get_grades($course->id, 'mod', 'ouwiki', $ouwiki->id, $user->id);
     if ($grading_info) {
         if (!isset($grading_info->items[0]->grades[$user->id]->grade)) {
             $user->grade = -1;
         } else {
             $user->grade = abs($grading_info->items[0]->grades[$user->id]->grade);
         }
         $grademenu = make_grades_menu($ouwiki->grade);
         $grademenu[-1] = get_string('nograde');
         $formparams = array();
         $formparams['id'] = $cm->id;
         $formparams['user'] = $user->id;
         $formparams['page'] = $pagename;
         $formparams['group'] = $groupid;
         $formaction = new moodle_url('/mod/ouwiki/savegrades.php', $formparams);
         $mform = new MoodleQuickForm('savegrade', 'post', $formaction, '', array('class' => 'savegrade'));
         $mform->addElement('header', 'usergrade', get_string('usergrade', 'ouwiki'));
         $mform->addElement('select', 'grade', get_string('grade'), $grademenu);
         $mform->setDefault('grade', $user->grade);
         $mform->addElement('submit', 'savechanges', get_string('savechanges'));
         $mform->display();
     }
 }
開發者ID:ndunand,項目名稱:moodle-mod_ouwiki,代碼行數:35,代碼來源:renderer.php

示例5: quickgrade_mode_allowed

    }
}
// Mini form for setting user preference.
$formaction = new moodle_url('/mod/giportfolio/submissions.php', array('id' => $cm->id));
$mform = new MoodleQuickForm('optionspref', 'post', $formaction, '', array('class' => 'optionspref'));
$mform->addElement('hidden', 'updatepref');
$mform->setDefault('updatepref', 1);
$mform->addElement('header', 'qgprefs', get_string('optionalsettings', 'assignment'));
$mform->setDefault('filter', $filter);
$mform->addElement('text', 'perpage', get_string('pagesize', 'assignment'), array('size' => 1));
$mform->setDefault('perpage', $perpage);
$mform->addElement('checkbox', 'quickgrade', get_string('quickgrade', 'assignment'));
$mform->setDefault('quickgrade', $quickgrade);
$mform->addHelpButton('quickgrade', 'quickgrade', 'assignment');
$mform->addElement('submit', 'savepreferences', get_string('savepreferences'));
$mform->display();
echo $OUTPUT->footer();
/**
 * Checks if grading method allows quickgrade mode. At the moment it is hardcoded
 * that advanced grading methods do not allow quickgrade.
 *
 * Assignment type plugins are not allowed to override this method
 *
 * @param $cmid
 * @return boolean
 */
function quickgrade_mode_allowed($cmid)
{
    global $CFG;
    require_once "{$CFG->dirroot}/grade/grading/lib.php";
    $context = context_module::instance($cmid);
開發者ID:andrewhancox,項目名稱:moodle-mod_giportfolio,代碼行數:31,代碼來源:submissions.php

示例6: view_administration

 /**
  * Outputs the content of the administration tab and manages actions taken in this tab
  */
 public function view_administration()
 {
     global $SESSION, $OUTPUT, $PAGE, $DB, $USER, $CFG;
     $output = $PAGE->get_renderer('mod_grouptool');
     $id = $this->cm->id;
     $context = context_course::instance($this->course->id);
     // Get applicable roles!
     $rolenames = array();
     if ($roles = get_profile_roles($context)) {
         foreach ($roles as $role) {
             $rolenames[$role->id] = strip_tags(role_get_name($role, $context));
         }
     }
     $filter = optional_param('filter', null, PARAM_INT);
     if ($filter !== null) {
         set_user_preference('mod_grouptool_group_filter', $filter, $USER->id);
     } else {
         $filter = get_user_preferences('mod_grouptool_group_filter', self::FILTER_ACTIVE, $USER->id);
     }
     $inactivetabs = array();
     $filtertabs['active'] = new tabobject(self::FILTER_ACTIVE, $CFG->wwwroot . '/mod/grouptool/view.php?id=' . $id . '&amp;tab=group_admin&filter=' . self::FILTER_ACTIVE, get_string('active', 'grouptool'), '', false);
     $filtertabs['inactive'] = new tabobject(self::FILTER_INACTIVE, $CFG->wwwroot . '/mod/grouptool/view.php?id=' . $id . '&amp;tab=group_admin&filter=' . self::FILTER_INACTIVE, get_string('inactive'), '', false);
     $filtertabs['all'] = new tabobject(self::FILTER_ALL, $CFG->wwwroot . '/mod/grouptool/view.php?id=' . $id . '&amp;tab=group_admin&filter=' . self::FILTER_ALL, get_string('all'), '', false);
     echo html_writer::tag('div', $OUTPUT->tabtree($filtertabs, $filter, $inactivetabs), array('id' => 'filtertabs'));
     // Check if everything has been confirmed, so we can finally start working!
     if (optional_param('confirm', 0, PARAM_BOOL)) {
         if (isset($SESSION->grouptool->view_administration->createGroupings)) {
             require_capability('mod/grouptool:create_groupings', $this->context);
             $target = required_param('target', PARAM_INT);
             switch ($target) {
                 // ...grpg_target | grpg_groupingname | use_all (0 sel | 1 all).
                 case 0:
                     // Invalid - no action! TODO Add message!
                     $error = true;
                     $preview = '';
                     break;
                 case -2:
                     // One grouping per group!
                     list($error, $preview) = $this->create_group_groupings();
                     break;
                 case -1:
                     // One new grouping for all!
                     list($error, $preview) = $this->update_grouping($target, required_param('name', PARAM_ALPHANUMEXT));
                     break;
                 default:
                     list($error, $preview) = $this->update_grouping($target);
                     break;
             }
             $preview = html_writer::tag('div', $preview, array('class' => 'centered'));
             echo $OUTPUT->box($preview, 'generalbox');
         }
         unset($SESSION->grouptool->view_administration);
     }
     if ($rename = optional_param('rename', 0, PARAM_INT)) {
         // Show Rename Form!
         $gform = new \mod_grouptool\group_rename_form(null, array('id' => $this->cm->id, 'instance' => $this->cm->instance, 'rename' => $rename));
         if (!$gform->is_cancelled() && ($fromform = $gform->get_data())) {
             $group = new stdClass();
             $group->id = $fromform->rename;
             $group->name = $fromform->name;
             $group->courseid = $fromform->courseid;
             groups_update_group($group);
         } else {
             if (!$gform->is_cancelled()) {
                 $data = new stdClass();
                 $data->name = $DB->get_field('groups', 'name', array('id' => $rename));
                 $gform->set_data($data);
                 $gform->display();
                 echo $OUTPUT->footer();
                 die;
             }
         }
     }
     if ($resize = optional_param('resize', 0, PARAM_INT)) {
         // Show Rename Form!
         $gform = new \mod_grouptool\group_resize_form(null, array('id' => $this->cm->id, 'instance' => $this->cm->instance, 'resize' => $resize));
         if (!$gform->is_cancelled() && ($fromform = $gform->get_data())) {
             if (empty($fromform->size)) {
                 $DB->set_field('grouptool_agrps', 'grpsize', null, array('groupid' => $fromform->resize, 'grouptoolid' => $this->cm->id));
             } else {
                 $group = new stdClass();
                 $group->id = $DB->get_field('grouptool_agrps', 'id', array('groupid' => $fromform->resize, 'grouptoolid' => $this->cm->instance));
                 $group->grpsize = $fromform->size;
                 $DB->update_record('grouptool_agrps', $group);
             }
         } else {
             if (!$gform->is_cancelled()) {
                 $data = new stdClass();
                 $data->size = $DB->get_field('grouptool_agrps', 'grpsize', array('groupid' => $resize, 'grouptoolid' => $this->cm->instance));
                 $gform->set_data($data);
                 $gform->display();
                 echo $OUTPUT->footer();
                 die;
             }
         }
     }
     if ($delete = optional_param('delete', 0, PARAM_INT)) {
//.........這裏部分代碼省略.........
開發者ID:rimacher,項目名稱:moodle-mod_grouptool,代碼行數:101,代碼來源:locallib.php

示例7: display_allfilesform

 public function display_allfilesform()
 {
     global $CFG, $OUTPUT, $DB, $USER;
     $cm = $this->coursemodule;
     $context = $this->context;
     $course = $this->course;
     $updatepref = optional_param('updatepref', 0, PARAM_BOOL);
     if ($updatepref) {
         $perpage = optional_param('perpage', 10, PARAM_INT);
         $perpage = $perpage <= 0 ? 10 : $perpage;
         $filter = optional_param('filter', 0, PARAM_INT);
         set_user_preference('publication_perpage', $perpage);
     }
     /* next we get perpage and quickgrade (allow quick grade) params
      * from database
      */
     $perpage = get_user_preferences('publication_perpage', 10);
     $quickgrade = get_user_preferences('publication_quickgrade', 0);
     $filter = get_user_preferences('publicationfilter', 0);
     $page = optional_param('page', 0, PARAM_INT);
     $formattrs = array();
     $formattrs['action'] = new moodle_url('/mod/publication/view.php');
     $formattrs['id'] = 'fastg';
     $formattrs['method'] = 'post';
     $formattrs['class'] = 'mform';
     $html = '';
     $html .= html_writer::start_tag('form', $formattrs);
     $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $this->get_coursemodule()->id));
     $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'page', 'value' => $page));
     $html .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
     echo $html;
     echo html_writer::start_tag('div', array('id' => 'id_allfiles', 'class' => 'clearfix', 'aria-live' => 'polite'));
     $title = has_capability('mod/publication:approve', $context) ? get_string('allfiles', 'publication') : get_string('publicfiles', 'publication');
     echo html_writer::tag('div', $title, array('class' => 'legend'));
     echo html_writer::start_div('fcontainer clearfix');
     // Check to see if groups are being used in this assignment.
     // Find out current groups mode.
     $groupmode = groups_get_activity_groupmode($cm);
     $currentgroup = groups_get_activity_group($cm, true);
     echo groups_print_activity_menu($cm, $CFG->wwwroot . '/mod/publication/view.php?id=' . $cm->id, true);
     $html = '';
     // Get all ppl that are allowed to submit assignments.
     list($esql, $params) = get_enrolled_sql($context, 'mod/publication:view', $currentgroup);
     $showall = false;
     if (has_capability('mod/publication:approve', $context) || has_capability('mod/publication:grantextension', $context)) {
         $showall = true;
     }
     if ($showall) {
         $sql = 'SELECT u.id FROM {user} u ' . 'LEFT JOIN (' . $esql . ') eu ON eu.id=u.id ' . 'WHERE u.deleted = 0 AND eu.id=u.id ';
     } else {
         $sql = 'SELECT u.id FROM {user} u ' . 'LEFT JOIN (' . $esql . ') eu ON eu.id=u.id ' . 'LEFT JOIN {publication_file} files ON (u.id = files.userid) ' . 'WHERE u.deleted = 0 AND eu.id=u.id ' . 'AND files.publication = ' . $this->get_instance()->id . ' ';
         if ($this->get_instance()->mode == PUBLICATION_MODE_UPLOAD) {
             // Node upload.
             if ($this->get_instance()->obtainteacherapproval) {
                 // Need teacher approval.
                 $where = 'files.teacherapproval = 1';
             } else {
                 // No need for teacher approval.
                 // Teacher only hasnt rejected.
                 $where = '(files.teacherapproval = 1 OR files.teacherapproval IS NULL)';
             }
         } else {
             // Mode import.
             if (!$this->get_instance()->obtainstudentapproval) {
                 // No need to ask student and teacher has approved.
                 $where = 'files.teacherapproval = 1';
             } else {
                 // Student and teacher have approved.
                 $where = 'files.teacherapproval = 1 AND files.studentapproval = 1';
             }
         }
         $sql .= 'AND ' . $where . ' ';
         $sql .= 'GROUP BY u.id';
     }
     $users = $DB->get_records_sql($sql, $params);
     if (!empty($users)) {
         $users = array_keys($users);
     }
     // If groupmembersonly used, remove users who are not in any group.
     if ($users and !empty($CFG->enablegroupmembersonly) and $cm->groupmembersonly) {
         if ($groupingusers = groups_get_grouping_members($cm->groupingid, 'u.id', 'u.id')) {
             $users = array_intersect($users, array_keys($groupingusers));
         }
     }
     $selectallnone = html_writer::checkbox('selectallnone', false, false, '', array('id' => 'selectallnone', 'onClick' => 'toggle_userselection()'));
     $tablecolumns = array('selection', 'fullname');
     $tableheaders = array($selectallnone, get_string('fullnameuser'));
     $useridentity = $CFG->showuseridentity != '' ? explode(',', $CFG->showuseridentity) : array();
     foreach ($useridentity as $cur) {
         if (!(get_config('publication', 'hideidnumberfromstudents') && $cur == "idnumber" && !has_capability('mod/publication:approve', $context)) && !($cur != "idnumber" && !has_capability('mod/publication:approve', $context))) {
             $tablecolumns[] = $cur;
             $tableheaders[] = $cur == 'phone1' ? get_string('phone') : get_string($cur);
         }
     }
     $tableheaders[] = get_string('lastmodified');
     $tablecolumns[] = 'timemodified';
     if (has_capability('mod/publication:approve', $context)) {
         // Not necessary in upload mode without studentapproval.
         if ($this->get_instance()->mode == PUBLICATION_MODE_IMPORT && $this->get_instance()->obtainstudentapproval) {
             $tablecolumns[] = 'studentapproval';
//.........這裏部分代碼省略.........
開發者ID:Kathrin84,項目名稱:moodle-mod_publication,代碼行數:101,代碼來源:locallib.php

示例8: render_user_grade

 /**
  * Render single users grading form
  *
  * @param object $course current course object
  * @param object $cm current course module object
  * @param object $oublog current oublog object
  * @param object $user current user participation object
  * @param id $groupid optional group id, no group = 0
  */
 public function render_user_grade($course, $cm, $oublog, $user, $groupid)
 {
     global $CFG, $USER;
     if (is_null($user->gradeobj->grade)) {
         $user->gradeobj->grade = -1;
     }
     if ($user->gradeobj->grade != -1) {
         $user->grade = abs($user->gradeobj->grade);
     }
     $grademenu = make_grades_menu($oublog->grade);
     $grademenu[-1] = get_string('nograde');
     $formparams = array();
     $formparams['id'] = $cm->id;
     $formparams['user'] = $user->user->id;
     $formparams['group'] = $groupid;
     $formparams['sesskey'] = $USER->sesskey;
     $formaction = new moodle_url('/mod/oublog/savegrades.php', $formparams);
     $mform = new MoodleQuickForm('savegrade', 'post', $formaction, '', array('class' => 'savegrade'));
     $mform->addElement('header', 'usergrade', get_string('usergrade', 'oublog'));
     $mform->addElement('select', 'grade', get_string('grade'), $grademenu);
     $mform->setDefault('grade', $user->gradeobj->grade);
     $mform->addElement('submit', 'savechanges', get_string('savechanges'));
     $mform->display();
 }
開發者ID:nadavkav,項目名稱:moodle-mod_oublog,代碼行數:33,代碼來源:renderer.php

示例9: forumngfeature_userposts_display_user_grade

/**
 * Render single user's grading form.
 *
 * @param int $cmid course module id
 * @param mod_forumng $forumng Forum
 * @param object $user object
 * @param int $groupid id of group to which user belongs
 */
function forumngfeature_userposts_display_user_grade($cmid, mod_forumng $forumng, $user, $groupid)
{
    global $CFG;
    require_once $CFG->libdir . '/gradelib.php';
    $grades = grade_get_grades($forumng->get_course_id(), 'mod', 'forumng', $forumng->get_id(), $user->id);
    if ($grades) {
        if (!isset($grades->items[0]->grades[$user->id]->grade)) {
            $user->grade = -1;
        } else {
            $user->grade = abs($grades->items[0]->grades[$user->id]->grade);
        }
        $grademenu = make_grades_menu($forumng->get_grading_scale());
        $grademenu[-1] = get_string('nograde');
        $formparams = array();
        $formparams['id'] = $cmid;
        $formparams['user'] = $user->id;
        $formparams['group'] = $groupid;
        $formaction = new moodle_url('/mod/forumng/feature/userposts/savegrades.php', $formparams);
        $mform = new MoodleQuickForm('savegrade', 'post', $formaction, '', array('class' => 'savegrade'));
        $mform->addElement('header', 'usergrade', get_string('usergrade', 'forumngfeature_userposts'));
        $mform->addElement('select', 'grade', get_string('grade'), $grademenu);
        $mform->setDefault('grade', $user->grade);
        $mform->addElement('submit', 'savechanges', get_string('savechanges'));
        $mform->display();
    }
}
開發者ID:nadavkav,項目名稱:Moodle2-Hebrew-plugins,代碼行數:34,代碼來源:locallib.php

示例10: display

 /**
  * Print html form.
  */
 function display()
 {
     $this->_form->display();
 }
開發者ID:veritech,項目名稱:pare-project,代碼行數:7,代碼來源:formslib.php


注:本文中的MoodleQuickForm::display方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。