本文整理汇总了PHP中workshop::log方法的典型用法代码示例。如果您正苦于以下问题:PHP workshop::log方法的具体用法?PHP workshop::log怎么用?PHP workshop::log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类workshop
的用法示例。
在下文中一共展示了workshop::log方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// load the grading strategy logic
$strategy = $workshop->grading_strategy_instance();
if (is_null($assessment->grade) and !$assessmenteditable) {
$mform = null;
} else {
// load the assessment form and process the submitted data eventually
$mform = $strategy->get_assessment_form($PAGE->url, 'assessment', $assessment, $assessmenteditable,
array('editableweight' => $cansetassessmentweight));
$mform->set_data(array('weight' => $assessment->weight)); // other values are set by subplugins
if ($mform->is_cancelled()) {
redirect($workshop->view_url());
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
if (is_null($assessment->grade)) {
$workshop->log('add assessment', $workshop->assess_url($assessment->id), $assessment->submissionid);
} else {
$workshop->log('update assessment', $workshop->assess_url($assessment->id), $assessment->submissionid);
}
$rawgrade = $strategy->save_assessment($assessment, $data);
if (isset($data->weight) and $cansetassessmentweight) {
$DB->set_field('workshop_assessments', 'weight', $data->weight, array('id' => $assessment->id));
}
if (!is_null($rawgrade) and isset($data->saveandclose)) {
redirect($workshop->view_url());
} else {
// either it is not possible to calculate the $rawgrade
// or the reviewer has chosen "Save and continue"
redirect($PAGE->url);
}
}
示例2: redirect
$currentdata = file_prepare_standard_editor($currentdata, 'feedbackauthor', $workshop->overall_feedback_content_options(),
$workshop->context, 'mod_workshop', 'overallfeedback_content', $assessment->id);
if ($workshop->overallfeedbackfiles) {
$currentdata = file_prepare_standard_filemanager($currentdata, 'feedbackauthorattachment',
$workshop->overall_feedback_attachment_options(), $workshop->context, 'mod_workshop', 'overallfeedback_attachment',
$assessment->id);
}
}
$mform->set_data($currentdata);
if ($mform->is_cancelled()) {
redirect($workshop->view_url());
} elseif ($assessmenteditable and ($data = $mform->get_data())) {
if ($canmanage) {
if (is_null($assessment->grade)) {
$workshop->log('add reference assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
} else {
$workshop->log('update reference assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
}
} else {
if (is_null($assessment->grade)) {
$workshop->log('add example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
} else {
$workshop->log('update example assessment', $workshop->exassess_url($assessment->id), $assessment->submissionid);
}
}
// Let the grading strategy subplugin save its data.
$rawgrade = $strategy->save_assessment($assessment, $data);
// Store the data managed by the workshop core.
示例3: array
// open for editing?
$assess = optional_param('assess', false, PARAM_BOOL);
// instant 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->submission_url(), array('cmid' => $cmid, 'id' => $id, 'edit' => $edit));
if ($id) {
// submission is specified
$submission = $workshop->get_submission_by_id($id);
$workshop->log('view submission', $workshop->submission_url($submission->id), $submission->id);
} else {
// no submission specified
if (!($submission = $workshop->get_submission_by_author($USER->id))) {
$submission = new stdclass();
$submission->id = null;
$submission->authorid = $USER->id;
$submission->example = 0;
$submission->grade = null;
$submission->gradeover = null;
$submission->published = null;
$submission->feedbackauthor = null;
$submission->feedbackauthorformat = editors_get_preferred_format();
}
}
$ownsubmission = $submission->authorid == $USER->id;
示例4: 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;
}
示例5: array
$w = optional_param('w', 0, PARAM_INT);
// workshop instance ID
$editmode = optional_param('editmode', null, PARAM_BOOL);
if ($id) {
$cm = get_coursemodule_from_id('workshop', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
} else {
$workshop = $DB->get_record('workshop', array('id' => $w), '*', MUST_EXIST);
$course = $DB->get_record('course', array('id' => $workshop->course), '*', MUST_EXIST);
$cm = get_coursemodule_from_instance('workshop', $workshop->id, $course->id, false, MUST_EXIST);
}
require_login($course, true, $cm);
require_capability('mod/workshop:view', $PAGE->context);
$workshop = new workshop($workshop, $cm, $course);
$workshop->log('view');
if (!is_null($editmode) && $PAGE->user_allowed_editing()) {
$USER->editing = $editmode;
}
$PAGE->set_url($workshop->view_url());
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
$output = $PAGE->get_renderer('mod_workshop');
$userplan = new workshop_user_plan($workshop, $USER->id);
/// Output starts here
echo $output->header();
echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
echo $output->render($userplan);
switch ($workshop->phase) {
case workshop::PHASE_SETUP:
if (trim($workshop->intro)) {
示例6: dirname
*/
require_once dirname(dirname(dirname(__FILE__))) . '/config.php';
require_once dirname(__FILE__) . '/locallib.php';
$cmid = required_param('cmid', PARAM_INT);
// course module
$confirm = optional_param('confirm', false, PARAM_BOOL);
// confirmation
// the params to be re-passed to view.php
$page = optional_param('page', 0, PARAM_INT);
$sortby = optional_param('sortby', 'lastname', PARAM_ALPHA);
$sorthow = optional_param('sorthow', 'ASC', PARAM_ALPHA);
$cm = get_coursemodule_from_id('workshop', $cmid, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshop, $cm, $course);
$PAGE->set_url($workshop->aggregate_url(), compact('confirm', 'page', 'sortby', 'sorthow'));
require_login($course, false, $cm);
require_capability('mod/workshop:overridegrades', $PAGE->context);
// load and init the grading evaluator
$evaluator = $workshop->grading_evaluation_instance();
$settingsform = $evaluator->get_settings_form($PAGE->url);
if ($settingsdata = $settingsform->get_data()) {
$workshop->aggregate_submission_grades();
// updates 'grade' in {workshop_submissions}
$evaluator->update_grading_grades($settingsdata);
// updates 'gradinggrade' in {workshop_assessments}
$workshop->aggregate_grading_grades();
// updates 'gradinggrade' in {workshop_aggregations}
$workshop->log('update aggregate grades');
}
redirect(new moodle_url($workshop->view_url(), compact('page', 'sortby', 'sorthow')));
示例7: array
$eventdata['objectid'] = $workshop->id;
$eventdata['context'] = $workshop->context;
$eventdata['courseid'] = $course->id;
$eventdata['other']['content'] = $workshop->phase;
$PAGE->set_url($workshop->view_url());
$event = \mod_workshop\event\course_module_viewed::create($eventdata);
$event->add_record_snapshot('course', $course);
$event->add_record_snapshot('workshop', $workshoprecord);
$event->add_record_snapshot('course_modules', $cm);
$event->set_page_detail();
$event->trigger();
// If the phase is to be switched, do it asap. This just has to happen after triggering
// the event so that the scheduled allocator had a chance to allocate submissions.
if ($workshop->phase == workshop::PHASE_SUBMISSION and $workshop->phaseswitchassessment and $workshop->submissionend > 0 and $workshop->submissionend < time()) {
$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));
$workshop->phaseswitchassessment = 0;
}
if (!is_null($editmode) && $PAGE->user_allowed_editing()) {
$USER->editing = $editmode;
}
$PAGE->set_title($workshop->name);
$PAGE->set_heading($course->fullname);
if ($perpage and $perpage > 0 and $perpage <= 1000) {
require_sesskey();
set_user_preference('workshop_perpage', $perpage);
redirect($PAGE->url);
}
示例8: dirname
*
* @package mod
* @subpackage workshop
* @copyright 2010 David Mudrak <david.mudrak@gmail.com>
* @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';
$id = required_param('id', PARAM_INT);
// course_module ID
$tool = required_param('tool', PARAM_ALPHA);
$cm = get_coursemodule_from_id('workshop', $id, 0, false, MUST_EXIST);
$course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST);
$workshop = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
require_login($course, false, $cm);
$workshop = new workshop($workshop, $cm, $course);
require_sesskey();
switch ($tool) {
case 'clearaggregatedgrades':
require_capability('mod/workshop:overridegrades', $workshop->context);
$workshop->log('update clear aggregated grades');
$workshop->clear_submission_grades();
$workshop->clear_grading_grades();
break;
case 'clearassessments':
require_capability('mod/workshop:overridegrades', $workshop->context);
$workshop->log('update clear assessments');
$workshop->clear_assessments();
break;
}
redirect($workshop->view_url());
示例9: array
// 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));
if ($id) {
// example is specified
$example = $workshop->get_example_by_id($id);
$workshop->log('view example', $workshop->exsubmission_url($example->id), $example->id);
} else {
// no example specified - create new one
require_capability('mod/workshop:manageexamples', $workshop->context);
$example = new stdclass();
$example->id = null;
$example->authorid = $USER->id;
$example->example = 1;
}
$canmanage = has_capability('mod/workshop:manageexamples', $workshop->context);
$canassess = has_capability('mod/workshop:peerassess', $workshop->context);
$refasid = $DB->get_field('workshop_assessments', 'id', array('submissionid' => $example->id, 'weight' => 1));
if ($example->id and ($canmanage or $workshop->assessing_examples_allowed() and $canassess)) {
// ok you can go
} elseif (is_null($example->id) and $canmanage) {
// ok you can go