ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCloudConnector.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 include_once('./Modules/Cloud/exceptions/class.ilCloudException.php');
5 include_once('class.ilCloudPluginItemCreationListGUI.php');
6 include_once('class.ilCloudPluginActionListGUI.php');
7 include_once('class.ilCloudPlugin.php');
8 include_once('class.ilCloudPluginInitGUI.php');
9 include_once('class.ilCloudPluginSettingsGUI.php');
10 include_once('class.ilCloudPluginService.php');
11 include_once('class.ilCloudPluginFileTreeGUI.php');
12 include_once('class.ilCloudPluginUploadGUI.php');
13 include_once('class.ilCloudPluginDeleteGUI.php');
14 include_once('class.ilCloudPluginCreateFolderGUI.php');
15 include_once('class.ilCloudPluginHeaderActionGUI.php');
16 include_once('class.ilCloudPluginCreationGUI.php');
17 include_once('class.ilCloudPluginInfoScreenGUI.php');
18 
31 {
32 
37  public static function getActiveServices()
38  {
39  global $DIC;
40  $ilPluginAdmin = $DIC['ilPluginAdmin'];
41 
42  $cloud_services = $ilPluginAdmin->getActivePluginsForSlot("Modules", "Cloud", "cldh");
43  if (!$cloud_services) {
45  }
46  $services_names = array();
47  foreach ($cloud_services as $service) {
48  $services_names[$service] = $service;
49  }
50  return $services_names;
51  }
52 
58  public static function checkServiceActive($name)
59  {
60  if (!$name) {
62  }
63 
64  if (array_key_exists($name, ilCloudConnector::getActiveServices())) {
65  return true;
66  } else {
68  }
69  }
70 
76  protected static function getFullClassName($service_name, $class_name)
77  {
78  if (file_exists("./Customizing/global/plugins/Modules/Cloud/CloudHook/" . $service_name . "/classes/class.il" . $service_name . $class_name . ".php")) {
79  include_once("./Customizing/global/plugins/Modules/Cloud/CloudHook/" . $service_name . "/classes/class.il" . $service_name . $class_name . ".php");
80  $class_full_name = "il" . $service_name . $class_name;
81  return $class_full_name;
82  }
83  return "ilCloudPlugin" . $class_name;
84  }
92  public static function getServiceClass($service_name, $obj_id, $connect = true)
93  {
94  if (!$service_name) {
96  }
97 
98  if (array_key_exists($service_name, ilCloudConnector::getActiveServices())) {
99  $class_name = ilCloudConnector::getFullClassName($service_name, "Service");
100  return new $class_name($service_name, $obj_id);
101  } else {
102  throw new ilCloudException(ilCloudException::SERVICE_NOT_ACTIVE, $service_name);
103  }
104  }
105 
111  public static function getPluginClass($service_name, $obj_id)
112  {
113  $class_name = ilCloudConnector::getFullClassName($service_name, "");
114  return new $class_name($service_name, $obj_id);
115  }
116 
122  public static function getPluginHookClass($service_name)
123  {
124  $class_name = ilCloudConnector::getFullClassName($service_name, "Plugin");
125  return new $class_name($service_name);
126  }
127 
133  public static function getSettingsGUIClass(ilCloudPluginService $plugin_service_class)
134  {
135  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "SettingsGUI");
136  return new $class_name($plugin_service_class);
137  }
138 
144  public static function getActionListGUIClass(ilCloudPluginService $plugin_service_class)
145  {
146  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "ActionListGUI");
147  return new $class_name($plugin_service_class);
148  }
149 
155  public static function getItemCreationListGUIClass(ilCloudPluginService $plugin_service_class)
156  {
157  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "ItemCreationListGUI");
158  return new $class_name($plugin_service_class);
159  }
160 
166  public static function getInitGUIClass(ilCloudPluginService $plugin_service_class)
167  {
168  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "InitGUI");
169  return new $class_name($plugin_service_class);
170  }
171 
178  public static function getFileTreeGUIClass(ilCloudPluginService $plugin_service_class, ilCloudFileTree $file_tree)
179  {
180  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "FileTreeGUI");
181  return new $class_name($plugin_service_class, $file_tree);
182  }
183 
189  public static function getCreateFolderGUIClass(ilCloudPluginService $plugin_service_class)
190  {
191  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "CreateFolderGUI");
192  return new $class_name($plugin_service_class);
193  }
194 
200  public static function getUploadGUIClass(ilCloudPluginService $plugin_service_class)
201  {
202  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "UploadGUI");
203  return new $class_name($plugin_service_class);
204  }
205 
210  public static function getDeleteGUIClass(ilCloudPluginService $plugin_service_class)
211  {
212  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "DeleteGUI");
213  return new $class_name($plugin_service_class);
214  }
215 
220  public static function getHeaderActionGUIClass(ilCloudPluginService $plugin_service_class)
221  {
222  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "HeaderActionGUI");
223  return new $class_name($plugin_service_class);
224  }
225 
230  public static function getCreationGUIClass(ilCloudPluginService $plugin_service_class)
231  {
232  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "CreationGUI");
233  return new $class_name($plugin_service_class);
234  }
235 
240  public static function getInfoScreenGUIClass(ilCloudPluginService $plugin_service_class)
241  {
242  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "InfoScreenGUI");
243  return new $class_name($plugin_service_class);
244  }
245 }
getPluginHookObject()
For shorter access.
ilCloudConnector class Needed to check if a a plugin making a conncection to a service like GoogleDri...
static getActionListGUIClass(ilCloudPluginService $plugin_service_class)
global $DIC
Definition: saml.php:7
static getInitGUIClass(ilCloudPluginService $plugin_service_class)
static getDeleteGUIClass(ilCloudPluginService $plugin_service_class)
static getUploadGUIClass(ilCloudPluginService $plugin_service_class)
ilCloudFileTree class
static getCreateFolderGUIClass(ilCloudPluginService $plugin_service_class)
$service
Definition: login.php:15
static getFileTreeGUIClass(ilCloudPluginService $plugin_service_class, ilCloudFileTree $file_tree)
if($format !==null) $name
Definition: metadata.php:146
static getPluginClass($service_name, $obj_id)
static checkServiceActive($name)
Class ilCloudPluginService.
Create styles array
The data for the language used.
static getFullClassName($service_name, $class_name)
static getPluginHookClass($service_name)
static getHeaderActionGUIClass(ilCloudPluginService $plugin_service_class)
static getServiceClass($service_name, $obj_id, $connect=true)
static getInfoScreenGUIClass(ilCloudPluginService $plugin_service_class)
static getSettingsGUIClass(ilCloudPluginService $plugin_service_class)
static getCreationGUIClass(ilCloudPluginService $plugin_service_class)
static getItemCreationListGUIClass(ilCloudPluginService $plugin_service_class)
Class ilCloudException.