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


PHP assign::can_edit_submission方法代码示例

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


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

示例1: col_userid

 /**
  * Format a column of data for display.
  *
  * @param stdClass $row
  * @return string
  */
 public function col_userid(stdClass $row)
 {
     global $USER;
     $edit = '';
     $actions = array();
     $urlparams = array('id' => $this->assignment->get_course_module()->id, 'rownum' => $this->rownum, 'action' => 'grade');
     $url = new moodle_url('/mod/assign/view.php', $urlparams);
     $noimage = null;
     if (!$row->grade) {
         $description = get_string('grade');
     } else {
         $description = get_string('updategrade', 'assign');
     }
     $actions['grade'] = new action_menu_link_secondary($url, $noimage, $description);
     // Everything we need is in the row.
     $submission = $row;
     $flags = $row;
     if ($this->assignment->get_instance()->teamsubmission) {
         // Use the cache for this.
         $submission = false;
         $group = false;
         $this->get_group_and_submission($row->id, $group, $submission, -1);
     }
     $submissionsopen = $this->assignment->submissions_open($row->id, true, $submission, $flags, $this->gradinginfo);
     $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);
     // Hide for offline assignments.
     if ($this->assignment->is_any_submission_plugin_enabled()) {
         if (!$row->status || $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT || !$this->assignment->get_instance()->submissiondrafts) {
             if (!$row->locked) {
                 $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'lock', 'sesskey' => sesskey(), 'page' => $this->currpage);
                 $url = new moodle_url('/mod/assign/view.php', $urlparams);
                 $description = get_string('preventsubmissionsshort', 'assign');
                 $actions['lock'] = new action_menu_link_secondary($url, $noimage, $description);
             } else {
                 $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'unlock', 'sesskey' => sesskey(), 'page' => $this->currpage);
                 $url = new moodle_url('/mod/assign/view.php', $urlparams);
                 $description = get_string('allowsubmissionsshort', 'assign');
                 $actions['unlock'] = new action_menu_link_secondary($url, $noimage, $description);
             }
         }
         if ($submissionsopen && $USER->id != $row->id && $caneditsubmission) {
             $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'editsubmission', 'sesskey' => sesskey(), 'page' => $this->currpage);
             $url = new moodle_url('/mod/assign/view.php', $urlparams);
             $description = get_string('editsubmission', 'assign');
             $actions['editsubmission'] = new action_menu_link_secondary($url, $noimage, $description);
         }
     }
     if (($this->assignment->get_instance()->duedate || $this->assignment->get_instance()->cutoffdate) && $this->hasgrantextension) {
         $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'grantextension', 'sesskey' => sesskey(), 'page' => $this->currpage);
         $url = new moodle_url('/mod/assign/view.php', $urlparams);
         $description = get_string('grantextension', 'assign');
         $actions['grantextension'] = new action_menu_link_secondary($url, $noimage, $description);
     }
     if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED && $this->assignment->get_instance()->submissiondrafts) {
         $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'reverttodraft', 'sesskey' => sesskey(), 'page' => $this->currpage);
         $url = new moodle_url('/mod/assign/view.php', $urlparams);
         $description = get_string('reverttodraftshort', 'assign');
         $actions['reverttodraft'] = new action_menu_link_secondary($url, $noimage, $description);
     }
     if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT && $this->assignment->get_instance()->submissiondrafts && $caneditsubmission && $submissionsopen && $row->id != $USER->id) {
         $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'submitotherforgrading', 'sesskey' => sesskey(), 'page' => $this->currpage);
         $url = new moodle_url('/mod/assign/view.php', $urlparams);
         $description = get_string('submitforgrading', 'assign');
         $actions['submitforgrading'] = new action_menu_link_secondary($url, $noimage, $description);
     }
     $ismanual = $this->assignment->get_instance()->attemptreopenmethod == ASSIGN_ATTEMPT_REOPEN_METHOD_MANUAL;
     $hassubmission = !empty($row->status);
     $notreopened = $hassubmission && $row->status != ASSIGN_SUBMISSION_STATUS_REOPENED;
     $isunlimited = $this->assignment->get_instance()->maxattempts == ASSIGN_UNLIMITED_ATTEMPTS;
     $hasattempts = $isunlimited || $row->attemptnumber < $this->assignment->get_instance()->maxattempts - 1;
     if ($ismanual && $hassubmission && $notreopened && $hasattempts) {
         $urlparams = array('id' => $this->assignment->get_course_module()->id, 'userid' => $row->id, 'action' => 'addattempt', 'sesskey' => sesskey(), 'page' => $this->currpage);
         $url = new moodle_url('/mod/assign/view.php', $urlparams);
         $description = get_string('addattempt', 'assign');
         $actions['addattempt'] = new action_menu_link_secondary($url, $noimage, $description);
     }
     $menu = new action_menu();
     $menu->set_owner_selector('.gradingtable-actionmenu');
     $menu->set_alignment(action_menu::TL, action_menu::BL);
     $menu->set_constraint('.gradingtable > .no-overflow');
     $menu->set_menu_trigger(get_string('edit'));
     foreach ($actions as $action) {
         $menu->add($action);
     }
     // Prioritise the menu ahead of all other actions.
     $menu->prioritise = true;
     $edit .= $this->output->render($menu);
     return $edit;
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:95,代码来源:gradingtable.php

示例2: col_userid

    /**
     * Format a column of data for display.
     *
     * @param stdClass $row
     * @return string
     */
    public function col_userid(stdClass $row) {
        global $USER;

        $edit = '';

        $actions = array();

        $urlparams = array('id'=>$this->assignment->get_course_module()->id,
                           'rownum'=>$this->rownum,
                           'action'=>'grade');
        $url = new moodle_url('/mod/assign/view.php', $urlparams);

        if (!$row->grade) {
            $description = get_string('grade');
        } else {
            $description = get_string('updategrade', 'assign');
        }
        $actions[$url->out(false)] = $description;

        $submissionsopen = $this->assignment->submissions_open($row->id);
        $caneditsubmission = $this->assignment->can_edit_submission($row->id, $USER->id);

        // Hide for offline assignments.
        if ($this->assignment->is_any_submission_plugin_enabled()) {
            if (!$row->status ||
                    $row->status == ASSIGN_SUBMISSION_STATUS_DRAFT ||
                    !$this->assignment->get_instance()->submissiondrafts) {

                if (!$row->locked) {
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                       'userid'=>$row->id,
                                       'action'=>'lock',
                                       'sesskey'=>sesskey(),
                                       'page'=>$this->currpage);
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);

                    $description = get_string('preventsubmissionsshort', 'assign');
                    $actions[$url->out(false)] = $description;
                } else {
                    $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                       'userid'=>$row->id,
                                       'action'=>'unlock',
                                       'sesskey'=>sesskey(),
                                       'page'=>$this->currpage);
                    $url = new moodle_url('/mod/assign/view.php', $urlparams);
                    $description = get_string('allowsubmissionsshort', 'assign');
                    $actions[$url->out(false)] = $description;
                }
            }

            if (($this->assignment->get_instance()->duedate ||
                   $this->assignment->get_instance()->cutoffdate) &&
                   $this->hasgrantextension) {
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                   'userid'=>$row->id,
                                   'action'=>'grantextension',
                                   'sesskey'=>sesskey(),
                                   'page'=>$this->currpage);
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
                $description = get_string('grantextension', 'assign');
                $actions[$url->out(false)] = $description;
            }
            if ($submissionsopen &&
                    $USER->id != $row->id &&
                    $caneditsubmission) {
                $urlparams = array('id' => $this->assignment->get_course_module()->id,
                                   'userid'=>$row->id,
                                   'action'=>'editsubmission',
                                   'sesskey'=>sesskey(),
                                   'page'=>$this->currpage);
                $url = new moodle_url('/mod/assign/view.php', $urlparams);
                $description = get_string('editsubmission', 'assign');
                $actions[$url->out(false)] = $description;
            }
        }
        if ($row->status == ASSIGN_SUBMISSION_STATUS_SUBMITTED &&
                $this->assignment->get_instance()->submissiondrafts) {
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
                               'userid'=>$row->id,
                               'action'=>'reverttodraft',
                               'sesskey'=>sesskey(),
                               'page'=>$this->currpage);
            $url = new moodle_url('/mod/assign/view.php', $urlparams);
            $description = get_string('reverttodraftshort', 'assign');
            $actions[$url->out(false)] = $description;
        }
        if ($row->status == ASSIGN_SUBMISSION_STATUS_DRAFT &&
                $this->assignment->get_instance()->submissiondrafts &&
                $caneditsubmission &&
                $submissionsopen &&
                $row->id != $USER->id) {
            $urlparams = array('id' => $this->assignment->get_course_module()->id,
                               'userid'=>$row->id,
                               'action'=>'submitotherforgrading',
//.........这里部分代码省略.........
开发者ID:rwijaya,项目名称:moodle,代码行数:101,代码来源:gradingtable.php


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