See Release Notes
Long Term Support Release
Differences Between: [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 namespace repository_googledocs\local\node; 18 19 use repository_googledocs\helper; 20 21 /** 22 * Class used to represent a folder node in the googledocs repository. 23 * 24 * @package repository_googledocs 25 * @copyright 2021 Mihail Geshoski <mihail@moodle.com> 26 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 27 */ 28 class folder_node implements node { 29 30 /** @var string The ID of the folder node. */ 31 private $id; 32 33 /** @var string The title of the folder node. */ 34 private $title; 35 36 /** @var bool The timestamp representing the last modified date. */ 37 private $modified; 38 39 /** @var string The path of the folder node. */ 40 private $path; 41 42 /** 43 * Constructor. 44 * 45 * @param \stdClass $gdfolder The Google Drive folder object 46 * @param string $path The path of the folder node 47 */ 48 public function __construct(\stdClass $gdfolder, string $path) { 49 $this->id = $gdfolder->id; 50 $this->title = $gdfolder->name; 51 $this->modified = $gdfolder->modifiedTime ? strtotime($gdfolder->modifiedTime) : ''; 52 $this->path = $path; 53 } 54 55 /** 56 * Create a repository folder array. 57 * 58 * This method returns an array which structure is compatible to represent a folder node in the repository. 59 * 60 * @return array|null The node array or null if the node could not be created 61 */ 62 public function create_node_array(): ?array { 63 global $OUTPUT; 64 65 return [ 66 'id' => $this->id, 67 'title' => $this->title, 68 'path' => helper::build_node_path($this->id, $this->title, $this->path), 69 'date' => $this->modified, 70 'thumbnail' => $OUTPUT->image_url(file_folder_icon(64))->out(false), 71 'thumbnail_height' => 64, 72 'thumbnail_width' => 64, 73 'children' => [], 74 ]; 75 } 76 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body