1<?php 2/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */ 3 4require_once('class.ilCloudPluginListGUI.php'); 5require_once('./Services/UIComponent/GroupedList/classes/class.ilGroupedListGUI.php'); 6require_once('./Services/FileUpload/classes/class.ilFileUploadGUI.php'); 7require_once('./Modules/Cloud/classes/class.ilCloudGroupedListGUI.php'); 8 9/** 10 * Class ilCloudPluginItemCreationListGUI 11 * 12 * Class for the drawing of the list 'add new item'. Can be extended by the plugin if needed. 13 * 14 * @author Timon Amstutz timon.amstutz@ilub.unibe.ch 15 * @version $Id$ 16 * @extends ilCloudPluginListGUI 17 * @ingroup ModulesCloud 18 */ 19class ilCloudPluginItemCreationListGUI extends ilCloudPluginListGUI 20{ 21 22 /** 23 * @var ilGroupedListGUI 24 */ 25 protected $gl = null; 26 27 28 /** 29 * @param bool $showUpload 30 * @param bool $showCreateFolders 31 * 32 * @return string 33 */ 34 public function getGroupedListItemsHTML($showUpload = false, $showCreateFolders = false) 35 { 36 $gl = $this->getGroupedListItems($showUpload, $showCreateFolders); 37 38 return $gl->getHTML(); 39 } 40 41 42 /** 43 * @param bool $show_upload 44 * @param bool $show_create_folders 45 * 46 * @return ilCloudGroupedListGUI 47 */ 48 public function getGroupedListItems($show_upload = false, $show_create_folders = false) 49 { 50 global $DIC; 51 $lng = $DIC['lng']; 52 53 $this->gl = new ilCloudGroupedListGUI(); 54 55 $this->addItemsBefore(); 56 $this->gl->setAsDropDown(true); 57 58 if ($show_upload) { 59 ilFileUploadGUI::initFileUpload(); 60 $icon_path = ilUtil::getImagePath('icon_dcl_file.svg'); 61 $img = ilUtil::img($icon_path); 62 $a_ttip = $lng->txt('cld_info_add_file_to_current_directory'); 63 $this->gl->addEntry($img . ' ' 64 . $lng->txt('cld_add_file'), '#', '_top', 'javascript:il.CloudFileList.uploadFile();', '', 'il_cld_add_file', $a_ttip, 'bottom center', 'top center', false); 65 } 66 67 if ($show_create_folders) { 68 $icon_path = ilUtil::getImagePath('icon_dcl_fold.svg'); 69 $img1 = ilUtil::img($icon_path); 70 $a_ttip1 = $lng->txt('cld_info_add_folder_to_current_directory'); 71 $this->gl->addEntry($img1 . ' ' 72 . $lng->txt('cld_add_folder'), '#', '_top', 'javascript:il.CloudFileList.createFolder();', '', 'il_cld_add_file', $a_ttip1, 'bottom center', 'top center', false); 73 } 74 75 $this->addItemsAfter(); 76 77 return $this->gl; 78 } 79 80 81 protected function addItemsBefore() 82 { 83 } 84 85 86 protected function addItemsAfter() 87 { 88 } 89} 90