• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP workshop类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: definition_inner

 /**
  * Define the elements to be displayed at the form
  *
  * Called by the parent::definition()
  *
  * @return void
  */
 protected function definition_inner(&$mform)
 {
     $norepeats = $this->_customdata['norepeats'];
     // number of dimensions to display
     $descriptionopts = $this->_customdata['descriptionopts'];
     // wysiwyg fields options
     $current = $this->_customdata['current'];
     // current data to be set
     $mform->addElement('hidden', 'norepeats', $norepeats);
     $mform->setType('norepeats', PARAM_INT);
     // value not to be overridden by submitted value
     $mform->setConstants(array('norepeats' => $norepeats));
     for ($i = 0; $i < $norepeats; $i++) {
         $mform->addElement('header', 'dimension' . $i, get_string('dimensionnumber', 'workshopform_accumulative', $i + 1));
         $mform->addElement('hidden', 'dimensionid__idx_' . $i);
         $mform->setType('dimensionid__idx_' . $i, PARAM_INT);
         $mform->addElement('editor', 'description__idx_' . $i . '_editor', get_string('dimensiondescription', 'workshopform_accumulative'), '', $descriptionopts);
         // todo replace modgrade with an advanced element (usability issue discussed with Olli)
         $mform->addElement('modgrade', 'grade__idx_' . $i, get_string('dimensionmaxgrade', 'workshopform_accumulative'), null, true);
         $mform->setDefault('grade__idx_' . $i, 10);
         $mform->addElement('select', 'weight__idx_' . $i, get_string('dimensionweight', 'workshopform_accumulative'), workshop::available_dimension_weights_list());
         $mform->setDefault('weight__idx_' . $i, 1);
     }
     $mform->registerNoSubmitButton('noadddims');
     $mform->addElement('submit', 'noadddims', get_string('addmoredimensions', 'workshopform_accumulative', workshop_accumulative_strategy::ADDDIMS));
     $mform->closeHeaderBefore('noadddims');
     $this->set_data($current);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:35,代码来源:edit_form.php


示例2: definition

 function definition()
 {
     $mform = $this->_form;
     $current = $this->_customdata['current'];
     $workshop = $this->_customdata['workshop'];
     $editoropts = $this->_customdata['editoropts'];
     $options = $this->_customdata['options'];
     $mform->addElement('header', 'assessmentsettings', get_string('assessmentsettings', 'workshop'));
     if (!empty($options['editableweight'])) {
         $mform->addElement('select', 'weight', get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list());
         $mform->setDefault('weight', 1);
     }
     $mform->addElement('static', 'gradinggrade', get_string('gradinggradecalculated', 'workshop'));
     if (!empty($options['overridablegradinggrade'])) {
         $grades = array('' => get_string('notoverridden', 'workshop'));
         for ($i = (int) $workshop->gradinggrade; $i >= 0; $i--) {
             $grades[$i] = $i;
         }
         $mform->addElement('select', 'gradinggradeover', get_string('gradinggradeover', 'workshop'), $grades);
         $mform->addElement('editor', 'feedbackreviewer_editor', get_string('feedbackreviewer', 'workshop'), null, $editoropts);
         $mform->setType('feedbackreviewer_editor', PARAM_RAW);
     }
     $mform->addElement('hidden', 'asid');
     $mform->setType('asid', PARAM_INT);
     $mform->addElement('submit', 'save', get_string('saveandclose', 'workshop'));
     $this->set_data($current);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:27,代码来源:feedbackreviewer_form.php


示例3: definition

    /**
     * Add the fields that are common for all grading strategies.
     *
     * If the strategy does not support all these fields, then you can override
     * this method and remove the ones you don't want with
     * $mform->removeElement().
     * Strategy subclassess should define their own fields in definition_inner()
     *
     * @return void
     */
    public function definition() {
        global $CFG;

        $mform          = $this->_form;
        $this->mode     = $this->_customdata['mode'];       // influences the save buttons
        $this->strategy = $this->_customdata['strategy'];   // instance of the strategy api class
        $this->workshop = $this->_customdata['workshop'];   // instance of the workshop api class
        $this->options  = $this->_customdata['options'];    // array with addiotional options

        // add the strategy-specific fields
        $this->definition_inner($mform);

        // add the data common for all subplugins
        $mform->addElement('hidden', 'strategy', $this->workshop->strategy);
        $mform->setType('strategy', PARAM_PLUGIN);

        if (!empty($this->options['editableweight']) and !$mform->isFrozen()) {
            $mform->addElement('header', 'assessmentsettings', get_string('assessmentweight', 'workshop'));
            $mform->addElement('select', 'weight',
                    get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list());
            $mform->setDefault('weight', 1);
        }

        $buttonarray = array();
        if ($this->mode == 'preview') {
            $buttonarray[] = $mform->createElement('cancel', 'backtoeditform', get_string('backtoeditform', 'workshop'));
        }
        if ($this->mode == 'assessment') {
            $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'workshop'));
            $buttonarray[] = $mform->createElement('submit', 'saveandclose', get_string('saveandclose', 'workshop'));
            $buttonarray[] = $mform->createElement('cancel');
        }
        $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
        $mform->closeHeaderBefore('buttonar');
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:45,代码来源:assessment_form.php


示例4: validation

 function validation($data, $files)
 {
     global $CFG, $USER, $DB;
     $errors = parent::validation($data, $files);
     if (empty($data['id']) and empty($data['example'])) {
         // make sure there is no submission saved meanwhile from another browser window
         $sql = "SELECT COUNT(s.id)\n                      FROM {workshop_submissions} s\n                      JOIN {workshop} w ON (s.workshopid = w.id)\n                      JOIN {course_modules} cm ON (w.id = cm.instance)\n                      JOIN {modules} m ON (m.name = 'workshop' AND m.id = cm.module)\n                     WHERE cm.id = ? AND s.authorid = ? AND s.example = 0";
         if ($DB->count_records_sql($sql, array($data['cmid'], $USER->id))) {
             $errors['title'] = get_string('err_multiplesubmissions', 'mod_workshop');
         }
     }
     if (isset($data['attachment_filemanager']) and isset($this->_customdata['workshop']->submissionfiletypes)) {
         $whitelist = workshop::normalize_file_extensions($this->_customdata['workshop']->submissionfiletypes);
         if ($whitelist) {
             $draftfiles = file_get_drafarea_files($data['attachment_filemanager']);
             if ($draftfiles) {
                 $wrongfiles = array();
                 foreach ($draftfiles->list as $file) {
                     if (!workshop::is_allowed_file_type($file->filename, $whitelist)) {
                         $wrongfiles[] = $file->filename;
                     }
                 }
                 if ($wrongfiles) {
                     $a = array('whitelist' => workshop::clean_file_extensions($whitelist), 'wrongfiles' => implode(', ', $wrongfiles));
                     $errors['attachment_filemanager'] = get_string('err_wrongfileextension', 'mod_workshop', $a);
                 }
             }
         }
     }
     return $errors;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:submission_form.php


示例5: definition

 /**
  * Add the fields that are common for all grading strategies.
  *
  * If the strategy does not support all these fields, then you can override
  * this method and remove the ones you don't want with
  * $mform->removeElement().
  * Strategy subclassess should define their own fields in definition_inner()
  *
  * @return void
  */
 public function definition()
 {
     global $CFG;
     $mform = $this->_form;
     $this->mode = $this->_customdata['mode'];
     // influences the save buttons
     $this->strategy = $this->_customdata['strategy'];
     // instance of the strategy api class
     $this->workshop = $this->_customdata['workshop'];
     // instance of the workshop api class
     $this->options = $this->_customdata['options'];
     // array with addiotional options
     // Disable shortforms
     $mform->setDisableShortforms();
     // add the strategy-specific fields
     $this->definition_inner($mform);
     // add the data common for all subplugins
     $mform->addElement('hidden', 'strategy', $this->workshop->strategy);
     $mform->setType('strategy', PARAM_PLUGIN);
     if ($this->workshop->overallfeedbackmode and $this->is_editable()) {
         $mform->addElement('header', 'overallfeedbacksection', get_string('overallfeedback', 'mod_workshop'));
         $mform->addElement('editor', 'feedbackauthor_editor', get_string('feedbackauthor', 'mod_workshop'), null, $this->workshop->overall_feedback_content_options());
         if ($this->workshop->overallfeedbackmode == 2) {
             $mform->addRule('feedbackauthor_editor', null, 'required', null, 'client');
         }
         if ($this->workshop->overallfeedbackfiles) {
             $mform->addElement('filemanager', 'feedbackauthorattachment_filemanager', get_string('feedbackauthorattachment', 'mod_workshop'), null, $this->workshop->overall_feedback_attachment_options());
         }
     }
     if (!empty($this->options['editableweight']) and $this->is_editable()) {
         $mform->addElement('header', 'assessmentsettings', get_string('assessmentweight', 'workshop'));
         $mform->addElement('select', 'weight', get_string('assessmentweight', 'workshop'), workshop::available_assessment_weights_list());
         $mform->setDefault('weight', 1);
     }
     $buttonarray = array();
     if ($this->mode == 'preview') {
         $buttonarray[] = $mform->createElement('cancel', 'backtoeditform', get_string('backtoeditform', 'workshop'));
     }
     if ($this->mode == 'assessment') {
         if (!empty($this->options['pending'])) {
             $buttonarray[] = $mform->createElement('submit', 'saveandshownext', get_string('saveandshownext', 'workshop'));
         }
         $buttonarray[] = $mform->createElement('submit', 'saveandclose', get_string('saveandclose', 'workshop'));
         $buttonarray[] = $mform->createElement('submit', 'saveandcontinue', get_string('saveandcontinue', 'workshop'));
         $buttonarray[] = $mform->createElement('cancel');
     }
     $mform->addGroup($buttonarray, 'buttonar', '', array(' '), false);
     $mform->closeHeaderBefore('buttonar');
 }
开发者ID:alanaipe2015,项目名称:moodle,代码行数:59,代码来源:assessment_form.php


示例6: workshop_viewed

 /**
  * Triggered when the '\mod_workshop\event\course_module_viewed' event is triggered.
  *
  * This does the same job as {@link workshopallocation_scheduled_cron()} but for the
  * single workshop. The idea is that we do not need to wait for cron to execute.
  * Displaying the workshop main view.php can trigger the scheduled allocation, too.
  *
  * @param \mod_workshop\event\course_module_viewed $event
  * @return bool
  */
 public static function workshop_viewed($event)
 {
     global $DB, $CFG;
     require_once $CFG->dirroot . '/mod/workshop/locallib.php';
     $workshop = $event->get_record_snapshot('workshop', $event->objectid);
     $course = $event->get_record_snapshot('course', $event->courseid);
     $cm = $event->get_record_snapshot('course_modules', $event->contextinstanceid);
     $workshop = new \workshop($workshop, $cm, $course);
     $now = time();
     // Non-expensive check to see if the scheduled allocation can even happen.
     if ($workshop->phase == \workshop::PHASE_SUBMISSION and $workshop->submissionend > 0 and $workshop->submissionend < $now) {
         // Make sure the scheduled allocation has been configured for this workshop, that it has not
         // been executed yet and that the passed workshop record is still valid.
         $sql = "SELECT a.id\n                      FROM {workshopallocation_scheduled} a\n                      JOIN {workshop} w ON a.workshopid = w.id\n                     WHERE w.id = :workshopid\n                           AND a.enabled = 1\n                           AND w.phase = :phase\n                           AND w.submissionend > 0\n                           AND w.submissionend < :now\n                           AND (a.timeallocated IS NULL OR a.timeallocated < w.submissionend)";
         $params = array('workshopid' => $workshop->id, 'phase' => \workshop::PHASE_SUBMISSION, 'now' => $now);
         if ($DB->record_exists_sql($sql, $params)) {
             // Allocate submissions for assessments.
             $allocator = $workshop->allocator_instance('scheduled');
             $result = $allocator->execute();
             // Todo inform the teachers about the results.
         }
     }
     return true;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:observer.php


示例7: get_examples

 /**
  * Returns example submissions to be assessed by the owner of the planner
  *
  * This is here to cache the DB query because the same list is needed later in view.php
  *
  * @see workshop::get_examples_for_reviewer() for the format of returned value
  * @return array
  */
 public function get_examples() {
     if (is_null($this->examples)) {
         $this->examples = $this->workshop->get_examples_for_reviewer($this->userid);
     }
     return $this->examples;
 }
开发者ID:nuckey,项目名称:moodle,代码行数:14,代码来源:locallib.php


示例8: optional_param

$edit = optional_param('edit', false, PARAM_BOOL);
// open for editing?
$delete = optional_param('delete', false, PARAM_BOOL);
// example removal requested
$confirm = optional_param('confirm', false, PARAM_BOOL);
// example removal request confirmed
$assess = optional_param('assess', false, PARAM_BOOL);
// assessment required
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
    print_error('guestsarenotallowed');
}
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->exsubmission_url($id), array('edit' => $edit));
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
if ($edit) {
    $PAGE->navbar->add(get_string('exampleediting', 'workshop'));
} else {
    $PAGE->navbar->add(get_string('example', 'workshop'));
}
$output = $PAGE->get_renderer('mod_workshop');
if ($id) {
    // example is specified
    $example = $workshop->get_example_by_id($id);
} else {
    // no example specified - create new one
    require_capability('mod/workshop:manageexamples', $workshop->context);
开发者ID:rushi963,项目名称:moodle,代码行数:31,代码来源:exsubmission.php


示例9: definition

 /**
  * Definition of the setting form elements
  */
 public function definition()
 {
     global $OUTPUT;
     $mform = $this->_form;
     $workshop = $this->_customdata['workshop'];
     $current = $this->_customdata['current'];
     if (!empty($workshop->submissionend)) {
         $strtimeexpected = workshop::timestamp_formats($workshop->submissionend);
     }
     if (!empty($current->timeallocated)) {
         $strtimeexecuted = workshop::timestamp_formats($current->timeallocated);
     }
     $mform->addElement('header', 'scheduledallocationsettings', get_string('scheduledallocationsettings', 'workshopallocation_scheduled'));
     $mform->addHelpButton('scheduledallocationsettings', 'scheduledallocationsettings', 'workshopallocation_scheduled');
     $mform->addElement('checkbox', 'enablescheduled', get_string('enablescheduled', 'workshopallocation_scheduled'), get_string('enablescheduledinfo', 'workshopallocation_scheduled'), 1);
     $mform->addElement('header', 'scheduledallocationinfo', get_string('currentstatus', 'workshopallocation_scheduled'));
     if ($current === false) {
         $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultdisabled', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))));
     } else {
         if (!empty($current->timeallocated)) {
             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution1', 'workshopallocation_scheduled', $strtimeexecuted) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid'))));
             if ($current->resultstatus == workshop_allocation_result::STATUS_EXECUTED) {
                 $strstatus = get_string('resultexecuted', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/valid')));
             } else {
                 if ($current->resultstatus == workshop_allocation_result::STATUS_FAILED) {
                     $strstatus = get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')));
                 } else {
                     $strstatus = get_string('resultvoid', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid')));
                 }
             }
             if (!empty($current->resultmessage)) {
                 $strstatus .= html_writer::empty_tag('br') . $current->resultmessage;
                 // yes, this is ugly. better solution suggestions are welcome.
             }
             $mform->addElement('static', 'inforesult', get_string('currentstatusresult', 'workshopallocation_scheduled'), $strstatus);
             if ($current->timeallocated < $workshop->submissionend) {
                 $mform->addElement('static', 'infoexpected', get_string('currentstatusnext', 'workshopallocation_scheduled'), get_string('currentstatusexecution2', 'workshopallocation_scheduled', $strtimeexpected) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                 $mform->addHelpButton('infoexpected', 'currentstatusnext', 'workshopallocation_scheduled');
             } else {
                 $mform->addElement('checkbox', 'reenablescheduled', get_string('currentstatusreset', 'workshopallocation_scheduled'), get_string('currentstatusresetinfo', 'workshopallocation_scheduled'));
                 $mform->addHelpButton('reenablescheduled', 'currentstatusreset', 'workshopallocation_scheduled');
             }
         } else {
             if (empty($current->enabled)) {
                 $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultdisabled', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))));
             } else {
                 if ($workshop->phase != workshop::PHASE_SUBMISSION) {
                     $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))) . html_writer::empty_tag('br') . get_string('resultfailedphase', 'workshopallocation_scheduled'));
                 } else {
                     if (empty($workshop->submissionend)) {
                         $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('resultfailed', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/invalid'))) . html_writer::empty_tag('br') . get_string('resultfaileddeadline', 'workshopallocation_scheduled'));
                     } else {
                         if ($workshop->submissionend < time()) {
                             // next cron will execute it
                             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution4', 'workshopallocation_scheduled') . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                         } else {
                             $mform->addElement('static', 'infostatus', get_string('currentstatusexecution', 'workshopallocation_scheduled'), get_string('currentstatusexecution3', 'workshopallocation_scheduled', $strtimeexpected) . ' ' . html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('i/caution'))));
                         }
                     }
                 }
             }
         }
     }
     parent::definition();
     $mform->addHelpButton('randomallocationsettings', 'randomallocationsettings', 'workshopallocation_scheduled');
 }
开发者ID:evltuma,项目名称:moodle,代码行数:69,代码来源:settings_form.php


示例10: workshop_cron

/**
 * Regular jobs to execute via cron
 *
 * @return boolean true on success, false otherwise
 */
function workshop_cron() {
    global $CFG, $DB;

    $now = time();

    mtrace(' processing workshop subplugins ...');
    cron_execute_plugin_type('workshopallocation', 'workshop allocation methods');

    // now when the scheduled allocator had a chance to do its job, check if there
    // are some workshops to switch into the assessment phase
    $workshops = $DB->get_records_select("workshop",
        "phase = 20 AND phaseswitchassessment = 1 AND submissionend > 0 AND submissionend < ?", array($now));

    if (!empty($workshops)) {
        mtrace('Processing automatic assessment phase switch in '.count($workshops).' workshop(s) ... ', '');
        require_once($CFG->dirroot.'/mod/workshop/locallib.php');
        foreach ($workshops as $workshop) {
            $cm = get_coursemodule_from_instance('workshop', $workshop->id, $workshop->course, false, MUST_EXIST);
            $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
            $workshop = new workshop($workshop, $cm, $course);
            $workshop->switch_phase(workshop::PHASE_ASSESSMENT);
            $workshop->log('update switch phase', $workshop->view_url(), $workshop->phase);
            // disable the automatic switching now so that it is not executed again by accident
            // if the teacher changes the phase back to the submission one
            $DB->set_field('workshop', 'phaseswitchassessment', 0, array('id' => $workshop->id));

            // todo inform the teachers
        }
        mtrace('done');
    }

    return true;
}
开发者ID:ncsu-delta,项目名称:moodle,代码行数:38,代码来源:lib.php


示例11: validation

 /**
  * Validates the form input
  *
  * @param array $data submitted data
  * @param array $files submitted files
  * @return array eventual errors indexed by the field name
  */
 public function validation($data, $files)
 {
     $errors = parent::validation($data, $files);
     // Validate lists of allowed extensions.
     foreach (array('submissionfiletypes', 'overallfeedbackfiletypes') as $fieldname) {
         if (isset($data[$fieldname])) {
             $invalidextensions = workshop::invalid_file_extensions($data[$fieldname], array_keys(core_filetypes::get_types()));
             if ($invalidextensions) {
                 $errors[$fieldname] = get_string('err_unknownfileextension', 'mod_workshop', workshop::clean_file_extensions($invalidextensions));
             }
         }
     }
     // check the phases borders are valid
     if ($data['submissionstart'] > 0 and $data['submissionend'] > 0 and $data['submissionstart'] >= $data['submissionend']) {
         $errors['submissionend'] = get_string('submissionendbeforestart', 'mod_workshop');
     }
     if ($data['assessmentstart'] > 0 and $data['assessmentend'] > 0 and $data['assessmentstart'] >= $data['assessmentend']) {
         $errors['assessmentend'] = get_string('assessmentendbeforestart', 'mod_workshop');
     }
     // check the phases do not overlap
     if (max($data['submissionstart'], $data['submissionend']) > 0 and max($data['assessmentstart'], $data['assessmentend']) > 0) {
         $phasesubmissionend = max($data['submissionstart'], $data['submissionend']);
         $phaseassessmentstart = min($data['assessmentstart'], $data['assessmentend']);
         if ($phaseassessmentstart == 0) {
             $phaseassessmentstart = max($data['assessmentstart'], $data['assessmentend']);
         }
         if ($phasesubmissionend > 0 and $phaseassessmentstart > 0 and $phaseassessmentstart < $phasesubmissionend) {
             foreach (array('submissionend', 'submissionstart', 'assessmentstart', 'assessmentend') as $f) {
                 if ($data[$f] > 0) {
                     $errors[$f] = get_string('phasesoverlap', 'mod_workshop');
                     break;
                 }
             }
         }
     }
     // Check that the submission grade pass is a valid number.
     if (!empty($data['submissiongradepass'])) {
         $submissiongradefloat = unformat_float($data['submissiongradepass'], true);
         if ($submissiongradefloat === false) {
             $errors['submissiongradepass'] = get_string('err_numeric', 'form');
         } else {
             if ($submissiongradefloat > $data['grade']) {
                 $errors['submissiongradepass'] = get_string('gradepassgreaterthangrade', 'grades', $data['grade']);
             }
         }
     }
     // Check that the grade pass is a valid number.
     if (!empty($data['gradinggradepass'])) {
         $gradepassfloat = unformat_float($data['gradinggradepass'], true);
         if ($gradepassfloat === false) {
             $errors['gradinggradepass'] = get_string('err_numeric', 'form');
         } else {
             if ($gradepassfloat > $data['gradinggrade']) {
                 $errors['gradinggradepass'] = get_string('gradepassgreaterthangrade', 'grades', $data['gradinggrade']);
             }
         }
     }
     return $errors;
 }
开发者ID:sirromas,项目名称:lms,代码行数:66,代码来源:mod_form.php


示例12: test_lcm

 public function test_lcm()
 {
     $this->resetAfterTest(true);
     // fixture setup + exercise SUT + verify in one step
     $this->assertEquals(workshop::lcm(1, 4), 4);
     $this->assertEquals(workshop::lcm(2, 4), 4);
     $this->assertEquals(workshop::lcm(4, 2), 4);
     $this->assertEquals(workshop::lcm(2, 3), 6);
     $this->assertEquals(workshop::lcm(6, 4), 12);
 }
开发者ID:abhilash1994,项目名称:moodle,代码行数:10,代码来源:locallib_test.php


示例13: dirname

require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$cmid = required_param('cmid', PARAM_INT);
// course module id
$sid = required_param('sid', PARAM_INT);
// example submission id
$aid = required_param('aid', PARAM_INT);
// the user's assessment id
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
require_login($course, false, $cm);
if (isguestuser()) {
    print_error('guestsarenotallowed');
}
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$strategy = $workshop->grading_strategy_instance();
$PAGE->set_url($workshop->excompare_url($sid, $aid));
$example = $workshop->get_example_by_id($sid);
$assessment = $workshop->get_assessment_by_id($aid);
if ($assessment->submissionid != $example->id) {
    print_error('invalidarguments');
}
$mformassessment = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, false);
if ($refasid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1))) {
    $reference = $workshop->get_assessment_by_id($refasid);
    $mformreference = $strategy->get_assessment_form($PAGE->url, 'assessment', $reference, false);
}
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$isreviewer = $USER->id == $assessment->reviewerid;
if ($canmanage) {
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:excompare.php


示例14: workshop_user_complete

/**
 * Print a detailed representation of what a user has done with
 * a given particular instance of this module, for user activity reports.
 *
 * @return string HTML
 */
function workshop_user_complete($course, $user, $mod, $workshop)
{
    global $CFG, $DB, $OUTPUT;
    require_once dirname(__FILE__) . '/locallib.php';
    require_once $CFG->libdir . '/gradelib.php';
    $workshop = new workshop($workshop, $mod, $course);
    $grades = grade_get_grades($course->id, 'mod', 'workshop', $workshop->id, $user->id);
    if (!empty($grades->items[0]->grades)) {
        $submissiongrade = reset($grades->items[0]->grades);
        $info = get_string('submissiongrade', 'workshop') . ': ' . $submissiongrade->str_long_grade;
        echo html_writer::tag('li', $info, array('class' => 'submissiongrade'));
    }
    if (!empty($grades->items[1]->grades)) {
        $assessmentgrade = reset($grades->items[1]->grades);
        $info = get_string('gradinggrade', 'workshop') . ': ' . $assessmentgrade->str_long_grade;
        echo html_writer::tag('li', $info, array('class' => 'gradinggrade'));
    }
    if (has_capability('mod/workshop:viewallsubmissions', $workshop->context)) {
        if ($submission = $workshop->get_submission_by_author($user->id)) {
            $title = format_string($submission->title);
            $url = $workshop->submission_url($submission->id);
            $link = html_writer::link($url, $title);
            $info = get_string('submission', 'workshop') . ': ' . $link;
            echo html_writer::tag('li', $info, array('class' => 'submission'));
        }
    }
    if (has_capability('mod/workshop:viewallassessments', $workshop->context)) {
        if ($assessments = $workshop->get_assessments_by_reviewer($user->id)) {
            foreach ($assessments as $assessment) {
                $a = new stdclass();
                $a->submissionurl = $workshop->submission_url($assessment->submissionid)->out();
                $a->assessmenturl = $workshop->assess_url($assessment->id)->out();
                $a->submissiontitle = s($assessment->submissiontitle);
                echo html_writer::tag('li', get_string('assessmentofsubmission', 'workshop', $a));
            }
        }
    }
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:44,代码来源:lib.php


示例15: workshop_reset_userdata

/**
 * Performs the reset of all workshop instances in the course.
 *
 * @param stdClass $data The actual course reset settings.
 * @return array List of results, each being array[(string)component, (string)item, (string)error]
 */
function workshop_reset_userdata(stdClass $data) {
    global $CFG, $DB;

    if (empty($data->reset_workshop_submissions)
            and empty($data->reset_workshop_assessments)
            and empty($data->reset_workshop_phase) ) {
        // Nothing to do here.
        return array();
    }

    $workshoprecords = $DB->get_records('workshop', array('course' => $data->courseid));

    if (empty($workshoprecords)) {
        // What a boring course - no workshops here!
        return array();
    }

    require_once($CFG->dirroot . '/mod/workshop/locallib.php');

    $course = $DB->get_record('course', array('id' => $data->courseid), '*', MUST_EXIST);
    $status = array();

    foreach ($workshoprecords as $workshoprecord) {
        $cm = get_coursemodule_from_instance('workshop', $workshoprecord->id, $course->id, false, MUST_EXIST);
        $workshop = new workshop($workshoprecord, $cm, $course);
        $status = array_merge($status, $workshop->reset_userdata($data));
    }

    return $status;
}
开发者ID:rohitshriwas,项目名称:moodle,代码行数:36,代码来源:lib.php


示例16: admin_setting_configselect

    for ($i = 5; $i >= 0; $i--) {
        $options[$i] = $i;
    }
    $settings->add(new admin_setting_configselect('workshop/gradedecimals', get_string('gradedecimals', 'workshop'),
                        get_string('configgradedecimals', 'workshop'), 0, $options));

    if (isset($CFG->maxbytes)) {
        $options = get_max_upload_sizes($CFG->maxbytes);
        $settings->add(new admin_setting_configselect('workshop/maxbytes', get_string('maxbytes', 'workshop'),
                            get_string('configmaxbytes', 'workshop'), 0, $options));
    }

    $settings->add(new admin_setting_configselect('workshop/strategy', get_string('strategy', 'workshop'),
                        get_string('configstrategy', 'workshop'), 'accumulative', workshop::available_strategies_list()));

    $options = workshop::available_example_modes_list();
    $settings->add(new admin_setting_configselect('workshop/examplesmode', get_string('examplesmode', 'workshop'),
                        get_string('configexamplesmode', 'workshop'), workshop::EXAMPLES_VOLUNTARY, $options));

    // include the settings of allocation subplugins
    $allocators = get_plugin_list('workshopallocation');
    foreach ($allocators as $allocator => $path) {
        if (file_exists($settingsfile = $path . '/settings.php')) {
            $settings->add(new admin_setting_heading('workshopallocationsetting'.$allocator,
                    get_string('allocation', 'workshop') . ' - ' . get_string('pluginname', 'workshopallocation_' . $allocator), ''));
            include($settingsfile);
        }
    }

    // include the settings of grading strategy subplugins
    $strategies = get_plugin_list('workshopform');
开发者ID:Burick,项目名称:moodle,代码行数:31,代码来源:settings.php


示例17: render_workshop_grading_report

 /**
  * Renders the workshop grading report
  *
  * @param workshop_grading_report $gradingreport
  * @return string html code
  */
 protected function render_workshop_grading_report(workshop_grading_report $gradingreport)
 {
     $data = $gradingreport->get_data();
     $options = $gradingreport->get_options();
     $grades = $data->grades;
     $userinfo = $data->userinfo;
     if (empty($grades)) {
         return '';
     }
     $table = new html_table();
     $table->attributes['class'] = 'grading-report';
     $sortbyfirstname = $this->helper_sortable_heading(get_string('firstname'), 'firstname', $options->sortby, $options->sorthow);
     $sortbylastname = $this->helper_sortable_heading(get_string('lastname'), 'lastname', $options->sortby, $options->sorthow);
     if (self::fullname_format() == 'lf') {
         $sortbyname = $sortbylastname . ' / ' . $sortbyfirstname;
     } else {
         $sortbyname = $sortbyfirstname . ' / ' . $sortbylastname;
     }
     $table->head = array();
     $table->head[] = $sortbyname;
     $table->head[] = $this->helper_sortable_heading(get_string('submission', 'workshop'), 'submissiontitle', $options->sortby, $options->sorthow);
     $table->head[] = $this->helper_sortable_heading(get_string('receivedgrades', 'workshop'));
     if ($options->showsubmissiongrade) {
         $table->head[] = $this->helper_sortable_heading(get_string('submissiongradeof', 'workshop', $data->maxgrade), 'submissiongrade', $options->sortby, $options->sorthow);
     }
     $table->head[] = $this->helper_sortable_heading(get_string('givengrades', 'workshop'));
     if ($options->showgradinggrade) {
         $table->head[] = $this->helper_sortable_heading(get_string('gradinggradeof', 'workshop', $data->maxgradinggrade), 'gradinggrade', $options->sortby, $options->sorthow);
     }
     $table->rowclasses = array();
     $table->colclasses = array();
     $table->data = array();
     foreach ($grades as $participant) {
         $numofreceived = count($participant->reviewedby);
         $numofgiven = count($participant->reviewerof);
         $published = $participant->submissionpublished;
         // compute the number of <tr> table rows needed to display this participant
         if ($numofreceived > 0 and $numofgiven > 0) {
             $numoftrs = workshop::lcm($numofreceived, $numofgiven);
             $spanreceived = $numoftrs / $numofreceived;
             $spangiven = $numoftrs / $numofgiven;
         } elseif ($numofreceived == 0 and $numofgiven > 0) {
             $numoftrs = $numofgiven;
             $spanreceived = $numoftrs;
             $spangiven = $numoftrs / $numofgiven;
         } elseif ($numofreceived > 0 and $numofgiven == 0) {
             $numoftrs = $numofreceived;
             $spanreceived = $numoftrs / $numofreceived;
             $spangiven = $numoftrs;
         } else {
             $numoftrs = 1;
             $spanreceived = 1;
             $spangiven = 1;
         }
         for ($tr = 0; $tr < $numoftrs; $tr++) {
             $row = new html_table_row();
             if ($published) {
                 $row->attributes['class'] = 'published';
             }
             // column #1 - participant - spans over all rows
             if ($tr == 0) {
                 $cell = new html_table_cell();
                 $cell->text = $this->helper_grading_report_participant($participant, $userinfo);
                 $cell->rowspan = $numoftrs;
                 $cell->attributes['class'] = 'participant';
                 $row->cells[] = $cell;
             }
             // column #2 - submission - spans over all rows
             if ($tr == 0) {
                 $cell = new html_table_cell();
                 $cell->text = $this->helper_grading_report_submission($participant);
                 $cell->rowspan = $numoftrs;
                 $cell->attributes['class'] = 'submission';
                 $row->cells[] = $cell;
             }
             // column #3 - received grades
             if ($tr % $spanreceived == 0) {
                 $idx = intval($tr / $spanreceived);
                 $assessment = self::array_nth($participant->reviewedby, $idx);
                 $cell = new html_table_cell();
                 $cell->text = $this->helper_grading_report_assessment($assessment, $options->showreviewernames, $userinfo, get_string('gradereceivedfrom', 'workshop'));
                 $cell->rowspan = $spanreceived;
                 $cell->attributes['class'] = 'receivedgrade';
                 if (is_null($assessment) or is_null($assessment->grade)) {
                     $cell->attributes['class'] .= ' null';
                 } else {
                     $cell->attributes['class'] .= ' notnull';
                 }
                 $row->cells[] = $cell;
             }
             // column #4 - total grade for submission
             if ($options->showsubmissiongrade and $tr == 0) {
                 $cell = new html_table_cell();
                 $cell->text = $this->helper_grading_report_grade($participant->submissiongrade, $participant->submissiongradeover);
//.........这里部分代码省略.........
开发者ID:vuchannguyen,项目名称:web,代码行数:101,代码来源:renderer.php


示例18: require_once

 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */

require_once(dirname(dirname(dirname(__FILE__))).'/config.php');
require_once(dirname(__FILE__).'/locallib.php');

$cmid       = required_param('cmid', PARAM_INT);

$cm         = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course     = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);

require_login($course, false, $cm);
require_capability('mod/workshop:editdimensions', $PAGE->context);

$workshop   = $DB 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP wp_query类代码示例发布时间:2022-05-23
下一篇:
PHP wordfence类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap