コード例 #1
0
ファイル: locallib.php プロジェクト: JP-Git/moodle
 /**
  * Constructor for this class
  * @param stdClass $data - The data from the previous batch form
  */
 function __construct($data)
 {
     if (isset($data->upgradeselected)) {
         $this->continuemessage = get_string('upgradeselectedcount', 'tool_assignmentupgrade', count(explode(',', $data->selectedassignments)));
         $this->continueurl = new moodle_url('/admin/tool/assignmentupgrade/batchupgrade.php', array('upgradeselected' => '1', 'confirm' => '1', 'sesskey' => sesskey(), 'selected' => $data->selectedassignments));
     } else {
         if (isset($data->upgradeall)) {
             if (!tool_assignmentupgrade_any_upgradable_assignments()) {
                 $this->continuemessage = get_string('noassignmentstoupgrade', 'tool_assignmentupgrade');
                 $this->continueurl = '';
             } else {
                 $this->continuemessage = get_string('upgradeallconfirm', 'tool_assignmentupgrade');
                 $this->continueurl = new moodle_url('/admin/tool/assignmentupgrade/batchupgrade.php', array('upgradeall' => '1', 'confirm' => '1', 'sesskey' => sesskey()));
             }
         }
     }
 }
コード例 #2
0
 /**
  * This table loads a list of the old assignment instances and tests them to see
  * if they can be upgraded
  *
  * @param int $perpage How many per page
  * @param int $rowoffset The starting row for pagination
  */
 public function __construct($perpage, $rowoffset = 0)
 {
     global $PAGE;
     parent::__construct('tool_assignmentupgrade_assignments');
     $this->perpage = $perpage;
     $this->output = $PAGE->get_renderer('tool_assignmentupgrade');
     $this->define_baseurl(new moodle_url('/admin/tool/assignmentupgrade/listnotupgraded.php'));
     $this->anyupgradableassignments = tool_assignmentupgrade_any_upgradable_assignments();
     // Do some business - then set the sql.
     if ($rowoffset) {
         $this->rownum = $rowoffset - 1;
     }
     $fields = 'a.id as id,
                a.name as name,
                a.assignmenttype as type,
                c.shortname as courseshortname,
                c.id as courseid,
                COUNT(s.id) as submissioncount';
     $from = '{assignment} a JOIN {course} c ON a.course = c.id ' . ' LEFT JOIN {assignment_submissions} s ON a.id = s.assignment';
     $where = '1 = 1';
     $where .= ' GROUP BY a.id, a.name, a.assignmenttype, c.shortname, c.id ';
     $this->set_sql($fields, $from, $where, array());
     $this->set_count_sql('SELECT COUNT(*) FROM {assignment} a JOIN {course} c ON a.course = c.id', array());
     $columns = array();
     $headers = array();
     $columns[] = 'select';
     $headers[] = get_string('select', 'tool_assignmentupgrade') . '<div class="selectall">' . '<input type="checkbox" name="selectall" title="' . get_string('selectall') . '"/>' . '</div>';
     $columns[] = 'upgradable';
     $headers[] = get_string('upgradable', 'tool_assignmentupgrade');
     $columns[] = 'id';
     $headers[] = get_string('assignmentid', 'tool_assignmentupgrade');
     $columns[] = 'courseshortname';
     $headers[] = get_string('course');
     $columns[] = 'name';
     $headers[] = get_string('name');
     $columns[] = 'type';
     $headers[] = get_string('assignmenttype', 'tool_assignmentupgrade');
     $columns[] = 'submissioncount';
     $headers[] = get_string('submissions', 'tool_assignmentupgrade');
     // Set the columns.
     $this->define_columns($columns);
     $this->define_headers($headers);
     $this->no_sorting('upgradable');
     $this->no_sorting('select');
 }