| 1 | 
           efrain | 
           1 | 
           <?php
  | 
        
        
            | 
            | 
           2 | 
           // This file is part of Moodle - http://moodle.org/
  | 
        
        
            | 
            | 
           3 | 
           //
  | 
        
        
            | 
            | 
           4 | 
           // Moodle is free software: you can redistribute it and/or modify
  | 
        
        
            | 
            | 
           5 | 
           // it under the terms of the GNU General Public License as published by
  | 
        
        
            | 
            | 
           6 | 
           // the Free Software Foundation, either version 3 of the License, or
  | 
        
        
            | 
            | 
           7 | 
           // (at your option) any later version.
  | 
        
        
            | 
            | 
           8 | 
           //
  | 
        
        
            | 
            | 
           9 | 
           // Moodle is distributed in the hope that it will be useful,
  | 
        
        
            | 
            | 
           10 | 
           // but WITHOUT ANY WARRANTY; without even the implied warranty of
  | 
        
        
            | 
            | 
           11 | 
           // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  | 
        
        
            | 
            | 
           12 | 
           // GNU General Public License for more details.
  | 
        
        
            | 
            | 
           13 | 
           //
  | 
        
        
            | 
            | 
           14 | 
           // You should have received a copy of the GNU General Public License
  | 
        
        
            | 
            | 
           15 | 
           // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  | 
        
        
            | 
            | 
           16 | 
              | 
        
        
            | 
            | 
           17 | 
           /**
  | 
        
        
            | 
            | 
           18 | 
            * This file contains the definition for the library class for edit PDF renderer.
  | 
        
        
            | 
            | 
           19 | 
            *
  | 
        
        
            | 
            | 
           20 | 
            * @package   assignfeedback_editpdf
  | 
        
        
            | 
            | 
           21 | 
            * @copyright 2012 Davo Smith
  | 
        
        
            | 
            | 
           22 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           23 | 
            */
  | 
        
        
            | 
            | 
           24 | 
              | 
        
        
            | 
            | 
           25 | 
           defined('MOODLE_INTERNAL') || die();
  | 
        
        
            | 
            | 
           26 | 
              | 
        
        
            | 
            | 
           27 | 
           /**
  | 
        
        
            | 
            | 
           28 | 
            * A custom renderer class that extends the plugin_renderer_base and is used by the editpdf feedback plugin.
  | 
        
        
            | 
            | 
           29 | 
            *
  | 
        
        
            | 
            | 
           30 | 
            * @package assignfeedback_editpdf
  | 
        
        
            | 
            | 
           31 | 
            * @copyright 2013 Davo Smith
  | 
        
        
            | 
            | 
           32 | 
            * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  | 
        
        
            | 
            | 
           33 | 
            */
  | 
        
        
            | 
            | 
           34 | 
           class assignfeedback_editpdf_widget implements renderable {
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
               /** @var int $assignment - Assignment instance id */
  | 
        
        
            | 
            | 
           37 | 
               public $assignment = 0;
  | 
        
        
            | 
            | 
           38 | 
               /** @var int $userid - The user id we are grading */
  | 
        
        
            | 
            | 
           39 | 
               public $userid = 0;
  | 
        
        
            | 
            | 
           40 | 
               /** @var mixed $attemptnumber - The attempt number we are grading */
  | 
        
        
            | 
            | 
           41 | 
               public $attemptnumber = 0;
  | 
        
        
            | 
            | 
           42 | 
               /** @var moodle_url $downloadurl */
  | 
        
        
            | 
            | 
           43 | 
               public $downloadurl = null;
  | 
        
        
            | 
            | 
           44 | 
               /** @var string $downloadfilename */
  | 
        
        
            | 
            | 
           45 | 
               public $downloadfilename = null;
  | 
        
        
            | 
            | 
           46 | 
               /** @var string[] $stampfiles */
  | 
        
        
            | 
            | 
           47 | 
               public $stampfiles = array();
  | 
        
        
            | 
            | 
           48 | 
               /** @var bool $readonly */
  | 
        
        
            | 
            | 
           49 | 
               public $readonly = true;
  | 
        
        
            | 
            | 
           50 | 
              | 
        
        
            | 
            | 
           51 | 
               /**
  | 
        
        
            | 
            | 
           52 | 
                * Constructor
  | 
        
        
            | 
            | 
           53 | 
                * @param int $assignment - Assignment instance id
  | 
        
        
            | 
            | 
           54 | 
                * @param int $userid - The user id we are grading
  | 
        
        
            | 
            | 
           55 | 
                * @param int $attemptnumber - The attempt number we are grading
  | 
        
        
            | 
            | 
           56 | 
                * @param moodle_url $downloadurl - A url to download the current generated pdf.
  | 
        
        
            | 
            | 
           57 | 
                * @param string $downloadfilename - Name of the generated pdf.
  | 
        
        
            | 
            | 
           58 | 
                * @param string[] $stampfiles - The file names of the stamps.
  | 
        
        
            | 
            | 
           59 | 
                * @param bool $readonly - Show the readonly interface (no tools).
  | 
        
        
            | 
            | 
           60 | 
                */
  | 
        
        
            | 
            | 
           61 | 
               public function __construct($assignment, $userid, $attemptnumber, $downloadurl,
  | 
        
        
            | 
            | 
           62 | 
                                           $downloadfilename, $stampfiles, $readonly) {
  | 
        
        
            | 
            | 
           63 | 
                   $this->assignment = $assignment;
  | 
        
        
            | 
            | 
           64 | 
                   $this->userid = $userid;
  | 
        
        
            | 
            | 
           65 | 
                   $this->attemptnumber = $attemptnumber;
  | 
        
        
            | 
            | 
           66 | 
                   $this->downloadurl = $downloadurl;
  | 
        
        
            | 
            | 
           67 | 
                   $this->downloadfilename = $downloadfilename;
  | 
        
        
            | 
            | 
           68 | 
                   $this->stampfiles = $stampfiles;
  | 
        
        
            | 
            | 
           69 | 
                   $this->readonly = $readonly;
  | 
        
        
            | 
            | 
           70 | 
               }
  | 
        
        
            | 
            | 
           71 | 
           }
  |