当前位置: 首页>>代码示例>>PHP>>正文


PHP workshop::submission_url方法代码示例

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


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

示例1: array

// course module id
$id = optional_param('id', 0, PARAM_INT);
// submission id
$edit = optional_param('edit', false, PARAM_BOOL);
// 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');
}
$workshoprecord = $DB->get_record('workshop', array('id' => $cm->instance), '*', MUST_EXIST);
$workshop = new workshop($workshoprecord, $cm, $course);
$PAGE->set_url($workshop->submission_url(), array('cmid' => $cmid, 'id' => $id));
if ($edit) {
    $PAGE->url->param('edit', $edit);
}
if ($id) {
    // submission is specified
    $submission = $workshop->get_submission_by_id($id);
    $params = array('objectid' => $submission->id, 'context' => $workshop->context, 'courseid' => $workshop->course->id, 'relateduserid' => $submission->authorid, 'other' => array('workshopid' => $workshop->id));
    $event = \mod_workshop\event\submission_viewed::create($params);
    $event->trigger();
} else {
    // no submission specified
    if (!($submission = $workshop->get_submission_by_author($USER->id))) {
        $submission = new stdclass();
        $submission->id = null;
        $submission->authorid = $USER->id;
开发者ID:alanaipe2015,项目名称:moodle,代码行数:31,代码来源:submission.php

示例2: __construct


//.........这里部分代码省略.........
            $task->link = $workshop->updatemod_url();
            if (trim($workshop->instructreviewers)) {
                $task->completed = true;
            } elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
                $task->completed = false;
            }
            $phase->tasks['instructreviewers'] = $task;
        }
        if ($workshop->useexamples and $workshop->examplesmode == workshop::EXAMPLES_BEFORE_SUBMISSION
                and has_capability('mod/workshop:submit', $workshop->context, $userid, false)
                    and !has_capability('mod/workshop:manageexamples', $workshop->context, $userid)) {
            $task = new stdclass();
            $task->title = get_string('exampleassesstask', 'workshop');
            $examples = $this->get_examples();
            $a = new stdclass();
            $a->expected = count($examples);
            $a->assessed = 0;
            foreach ($examples as $exampleid => $example) {
                if (!is_null($example->grade)) {
                    $a->assessed++;
                }
            }
            $task->details = get_string('exampleassesstaskdetails', 'workshop', $a);
            if ($a->assessed == $a->expected) {
                $task->completed = true;
            } elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
                $task->completed = false;
            }
            $phase->tasks['examples'] = $task;
        }
        if (has_capability('mod/workshop:submit', $workshop->context, $userid, false)) {
            $task = new stdclass();
            $task->title = get_string('tasksubmit', 'workshop');
            $task->link = $workshop->submission_url();
            if ($DB->record_exists('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0, 'authorid'=>$userid))) {
                $task->completed = true;
            } elseif ($workshop->phase >= workshop::PHASE_ASSESSMENT) {
                $task->completed = false;
            } else {
                $task->completed = null;    // still has a chance to submit
            }
            $phase->tasks['submit'] = $task;
        }
        if (has_capability('mod/workshop:allocate', $workshop->context, $userid)) {
            $task = new stdclass();
            $task->title = get_string('allocate', 'workshop');
            $task->link = $workshop->allocation_url();
            $numofauthors = count(get_users_by_capability($workshop->context, 'mod/workshop:submit', 'u.id', '', '', '',
                    '', '', false, true));
            $numofsubmissions = $DB->count_records('workshop_submissions', array('workshopid'=>$workshop->id, 'example'=>0));
            $sql = 'SELECT COUNT(s.id) AS nonallocated
                      FROM {workshop_submissions} s
                 LEFT JOIN {workshop_assessments} a ON (a.submissionid=s.id)
                     WHERE s.workshopid = :workshopid AND s.example=0 AND a.submissionid IS NULL';
            $params['workshopid'] = $workshop->id;
            $numnonallocated = $DB->count_records_sql($sql, $params);
            if ($numofsubmissions == 0) {
                $task->completed = null;
            } elseif ($numnonallocated == 0) {
                $task->completed = true;
            } elseif ($workshop->phase > workshop::PHASE_SUBMISSION) {
                $task->completed = false;
            } else {
                $task->completed = null;    // still has a chance to allocate
            }
            $a = new stdclass();
开发者ID:nuckey,项目名称:moodle,代码行数:67,代码来源:locallib.php

示例3: 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

示例4: 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)) {
        $canviewsubmission = true;
        if (groups_get_activity_groupmode($workshop->cm) == SEPARATEGROUPS) {
            // user must have accessallgroups or share at least one group with the submission author
            if (!has_capability('moodle/site:accessallgroups', $workshop->context)) {
                $usersgroups = groups_get_activity_allowed_groups($workshop->cm);
                $authorsgroups = groups_get_all_groups($workshop->course->id, $user->id, $workshop->cm->groupingid, 'g.id');
                $sharedgroups = array_intersect_key($usersgroups, $authorsgroups);
                if (empty($sharedgroups)) {
                    $canviewsubmission = false;
                }
            }
        }
        if ($canviewsubmission and $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:ncsu-delta,项目名称:moodle,代码行数:59,代码来源:lib.php

示例5: array

// course module id
$id = optional_param('id', 0, PARAM_INT);
// submission id
$edit = optional_param('edit', false, PARAM_BOOL);
// 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;
开发者ID:vuchannguyen,项目名称:web,代码行数:31,代码来源:submission.php


注:本文中的workshop::submission_url方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。