Source for file file.php

Documentation is available at file.php

  1. <?php
  2.     // This file is part of the Sloodle project (www.sloodle.org)
  3.     
  4.     /**
  5.     * Displays summary information about a Sloodle Object assignment submission.
  6.     *
  7.     * @package sloodle
  8.     * @copyright Copyright (c) 2008 Sloodle (various contributors)
  9.     * @license http://www.gnu.org/licenses/gpl-3.0.html GNU GPL v3
  10.     *
  11.     * @contributor (various Moodle guys!)
  12.     * @contributor Peter R. Bloomfield
  13.     */
  14.  
  15.     /** Includes the Moodle configuration */
  16.     require_once("../../../../config.php");
  17.     /** Includes the assignment library. */
  18.     require_once("../../lib.php");
  19.     /** Includes the Sloodle Object assignment type. */
  20.     require_once("assignment.class.php");
  21.  
  22.     $id     required_param('id'PARAM_INT);      // Course Module ID
  23.     $userid required_param('userid'PARAM_INT);  // User ID
  24.  
  25.     if ($cm get_coursemodule_from_id('assignment'$id)) {
  26.         error("Course Module ID was incorrect");
  27.     }
  28.  
  29.     if ($assignment get_record("assignment""id"$cm->instance)) {
  30.         error("Assignment ID was incorrect");
  31.     }
  32.  
  33.     if ($course get_record("course""id"$assignment->course)) {
  34.         error("Course is misconfigured");
  35.     }
  36.  
  37.     if ($user get_record("user""id"$userid)) {
  38.         error("User is misconfigured");
  39.     }
  40.  
  41.     require_login($course->idfalse$cm);
  42.  
  43.     if (($USER->id != $user->id&& !has_capability('mod/assignment:grade'get_context_instance(CONTEXT_MODULE$cm->id))) {
  44.         error("You can not view this assignment");
  45.     }
  46.  
  47.     if ($assignment->assignmenttype != 'sloodleobject'{
  48.         error("Incorrect assignment type");
  49.     }
  50.  
  51.     $assignmentinstance new assignment_sloodleobject($cm->id$assignment$cm$course);
  52.  
  53.     if ($submission $assignmentinstance->get_submission($user->id)) {
  54.         print_header(fullname($user,true).': '.$assignment->name);
  55.         
  56.         // Get the Sloodle submission data
  57.         $sloodle_submission new assignment_sloodleobject_submission();
  58.         $sloodle_submission->load_submission($submission);
  59.  
  60.         print_simple_box_start('center''''''''generalbox''dates');
  61.         echo '<table>';
  62.         if ($assignment->timedue{
  63.             echo '<tr><td class="c0">'.get_string('duedate','assignment').':</td>';
  64.             echo '    <td class="c1">'.userdate($assignment->timedue).'</td></tr>';
  65.         }
  66.         echo '<tr><td class="c0">'.get_string('lastedited').':</td>';
  67.         echo '    <td class="c1">'.userdate($submission->timemodified);
  68.         // Show the number of prims
  69.         echo ' ('.get_string('numprims''sloodle'$sloodle_submission->num_prims).')</td></tr>';
  70.         echo '</table>';
  71.         print_simple_box_end();
  72.  
  73.         // Display the summary info
  74.         print_simple_box($sloodle_submission->text_summary()'center''100%');
  75.         close_window_button();
  76.         print_footer('none');
  77.     else {
  78.         print_string('emptysubmission''assignment');
  79.     }
  80.  
  81. ?>

Documentation generated on Mon, 16 Jun 2008 15:56:19 +0100 by phpDocumentor 1.4.0