Differences Between: [Versions 310 and 403] [Versions 311 and 403] [Versions 39 and 403] [Versions 400 and 403] [Versions 401 and 403]
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 * Class for normalising the date data. 19 * 20 * @package core_calendar 21 * @copyright 2017 Andrew Nicols <andrew@nicols.co.uk> 22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 23 */ 24 25 namespace core_calendar\external; 26 27 defined('MOODLE_INTERNAL') || die(); 28 29 use core\external\exporter; 30 31 /** 32 * Class for normalising the date data. 33 * 34 * @package core_calendar 35 * @copyright 2017 Andrew Nicols <andrew@nicols.co.uk> 36 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 37 */ 38 class date_exporter extends exporter { 39 40 /** 41 * Constructor for date_exporter. 42 * 43 * @param array $data 44 * @param array $related The related information 45 */ 46 public function __construct($data, $related = []) { 47 $data['timestamp'] = $data[0]; 48 unset($data[0]); 49 50 parent::__construct($data, $related); 51 } 52 53 protected static function define_properties() { 54 return [ 55 'seconds' => [ 56 'type' => PARAM_INT, 57 ], 58 'minutes' => [ 59 'type' => PARAM_INT, 60 ], 61 'hours' => [ 62 'type' => PARAM_INT, 63 ], 64 'mday' => [ 65 'type' => PARAM_INT, 66 ], 67 'wday' => [ 68 'type' => PARAM_INT, 69 ], 70 'mon' => [ 71 'type' => PARAM_INT, 72 ], 73 'year' => [ 74 'type' => PARAM_INT, 75 ], 76 'yday' => [ 77 'type' => PARAM_INT, 78 ], 79 'weekday' => [ 80 'type' => PARAM_RAW, 81 ], 82 'month' => [ 83 'type' => PARAM_RAW, 84 ], 85 'timestamp' => [ 86 'type' => PARAM_INT, 87 ], 88 ]; 89 } 90 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body