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


PHP assign::count_submissions_with_status方法代码示例

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


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

示例1: view_course_index

 /**
  * View a summary listing of all assignments in the current course.
  *
  * @return string
  */
 private function view_course_index()
 {
     global $USER;
     $o = '';
     $course = $this->get_course();
     $strplural = get_string('modulenameplural', 'assign');
     if (!($cms = get_coursemodules_in_course('assign', $course->id, 'm.duedate'))) {
         $o .= $this->get_renderer()->notification(get_string('thereareno', 'moodle', $strplural));
         $o .= $this->get_renderer()->continue_button(new moodle_url('/course/view.php', array('id' => $course->id)));
         return $o;
     }
     $strsectionname = '';
     $usesections = course_format_uses_sections($course->format);
     $modinfo = get_fast_modinfo($course);
     if ($usesections) {
         $strsectionname = get_string('sectionname', 'format_' . $course->format);
         $sections = $modinfo->get_section_info_all();
     }
     $courseindexsummary = new assign_course_index_summary($usesections, $strsectionname);
     $timenow = time();
     $currentsection = '';
     foreach ($modinfo->instances['assign'] as $cm) {
         if (!$cm->uservisible) {
             continue;
         }
         $timedue = $cms[$cm->id]->duedate;
         $sectionname = '';
         if ($usesections && $cm->sectionnum) {
             $sectionname = get_section_name($course, $sections[$cm->sectionnum]);
         }
         $submitted = '';
         $context = context_module::instance($cm->id);
         $assignment = new assign($context, $cm, $course);
         if (has_capability('mod/assign:grade', $context)) {
             $submitted = $assignment->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED);
         } else {
             if (has_capability('mod/assign:submit', $context)) {
                 $usersubmission = $assignment->get_user_submission($USER->id, false);
                 if (!empty($usersubmission->status)) {
                     $submitted = get_string('submissionstatus_' . $usersubmission->status, 'assign');
                 } else {
                     $submitted = get_string('submissionstatus_', 'assign');
                 }
             }
         }
         $gradinginfo = grade_get_grades($course->id, 'mod', 'assign', $cm->instance, $USER->id);
         if (isset($gradinginfo->items[0]->grades[$USER->id]) && !$gradinginfo->items[0]->grades[$USER->id]->hidden) {
             $grade = $gradinginfo->items[0]->grades[$USER->id]->str_grade;
         } else {
             $grade = '-';
         }
         $courseindexsummary->add_assign_info($cm->id, $cm->name, $sectionname, $timedue, $submitted, $grade);
     }
     $o .= $this->get_renderer()->render($courseindexsummary);
     $o .= $this->view_footer();
     return $o;
 }
开发者ID:covex-nn,项目名称:moodle,代码行数:62,代码来源:locallib.php

示例2: array

$table = new html_table();
$table->head = array($strplural, get_string('duedate', 'assign'), get_string('submissions', 'assign'));
$table->align = array('left', 'left', 'center');
$table->data = array();
foreach ($assignments as $assignment) {
    $cm = get_coursemodule_from_instance('assign', $assignment->id, 0, false, MUST_EXIST);
    $link = html_writer::link(new moodle_url('/mod/assign/view.php', array('id' => $cm->id)), $assignment->name);
    $date = '-';
    if (!empty($assignment->duedate)) {
        $date = userdate($assignment->duedate);
    }
    $context = context_module::instance($cm->id);
    $instance = new assign($context, $cm, $course);
    $submitted = '';
    if (has_capability('mod/assign:grade', $context)) {
        $submitted = $instance->count_submissions_with_status(ASSIGN_SUBMISSION_STATUS_SUBMITTED);
    } else {
        if (has_capability('mod/assign:submit', $context)) {
            $submission = $DB->get_record('assign_submission', array('assignment' => $assignment->id, 'userid' => $USER->id));
            if (!empty($submission->status)) {
                $submitted = get_string('submissionstatus_' . $submission->status, 'assign');
            } else {
                $submitted = get_string('submissionstatus_', 'assign');
            }
        }
    }
    $row = array($link, $date, $submitted);
    $table->data[] = $row;
}
echo html_writer::table($table);
echo $OUTPUT->footer();
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:31,代码来源:index.php


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