[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/mod/assign/tests/generator/ -> lib.php (source)

   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  defined('MOODLE_INTERNAL') || die();
  18  
  19  /**
  20   * assign module data generator class
  21   *
  22   * @package mod_assign
  23   * @category test
  24   * @copyright 2012 Paul Charsley
  25   * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  class mod_assign_generator extends testing_module_generator {
  28  
  29      public function create_instance($record = null, array $options = null) {
  30          $record = (object)(array)$record;
  31  
  32          $defaultsettings = array(
  33              'alwaysshowdescription'             => 1,
  34              'submissiondrafts'                  => 1,
  35              'requiresubmissionstatement'        => 0,
  36              'sendnotifications'                 => 0,
  37              'sendstudentnotifications'          => 1,
  38              'sendlatenotifications'             => 0,
  39              'duedate'                           => 0,
  40              'allowsubmissionsfromdate'          => 0,
  41              'grade'                             => 100,
  42              'cutoffdate'                        => 0,
  43              'teamsubmission'                    => 0,
  44              'requireallteammemberssubmit'       => 0,
  45              'teamsubmissiongroupingid'          => 0,
  46              'blindmarking'                      => 0,
  47              'attemptreopenmethod'               => 'none',
  48              'maxattempts'                       => -1,
  49              'markingworkflow'                   => 0,
  50              'markingallocation'                 => 0,
  51          );
  52  
  53          foreach ($defaultsettings as $name => $value) {
  54              if (!isset($record->{$name})) {
  55                  $record->{$name} = $value;
  56              }
  57          }
  58  
  59          return parent::create_instance($record, (array)$options);
  60      }
  61  }


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1