ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
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 $ilPluginAdmin;
40 
41  $cloud_services = $ilPluginAdmin->getActivePluginsForSlot("Modules", "Cloud", "cldh");
42  if (!$cloud_services)
43  {
45  }
46  $services_names = array();
47  foreach ($cloud_services as $service)
48  {
49  $services_names[$service] = $service;
50  }
51  return $services_names;
52  }
53 
59  public static function checkServiceActive($name)
60  {
61  if (!$name)
62  {
64  }
65 
66  if (array_key_exists($name, ilCloudConnector::getActiveServices()))
67  {
68  return true;
69  } else
70  {
72  }
73  }
74 
80  protected static function getFullClassName($service_name, $class_name)
81  {
82  if (file_exists("./Customizing/global/plugins/Modules/Cloud/CloudHook/" . $service_name . "/classes/class.il" .$service_name . $class_name.".php"))
83  {
84  include_once("./Customizing/global/plugins/Modules/Cloud/CloudHook/" . $service_name . "/classes/class.il" .$service_name . $class_name.".php");
85  $class_full_name = "il" . $service_name . $class_name;
86  return $class_full_name;
87  }
88  return "ilCloudPlugin" .$class_name;
89  }
97  public static function getServiceClass($service_name, $obj_id, $connect = true)
98  {
99  if (!$service_name)
100  {
102  }
103 
104  if (array_key_exists($service_name, ilCloudConnector::getActiveServices()))
105  {
106  $class_name = ilCloudConnector::getFullClassName($service_name, "Service");
107  return new $class_name($service_name, $obj_id);
108  } else
109  {
110  throw new ilCloudException(ilCloudException::SERVICE_NOT_ACTIVE, $service_name);
111  }
112  }
113 
119  public static function getPluginClass($service_name, $obj_id)
120  {
121  $class_name = ilCloudConnector::getFullClassName($service_name, "");
122  return new $class_name($service_name, $obj_id);
123  }
124 
130  public static function getPluginHookClass($service_name)
131  {
132  $class_name = ilCloudConnector::getFullClassName($service_name, "Plugin");
133  return new $class_name($service_name);
134  }
135 
141  public static function getSettingsGUIClass(ilCloudPluginService $plugin_service_class)
142  {
143  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "SettingsGUI");
144  return new $class_name($plugin_service_class);
145  }
146 
152  public static function getActionListGUIClass(ilCloudPluginService $plugin_service_class)
153  {
154  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "ActionListGUI");
155  return new $class_name($plugin_service_class);
156  }
157 
163  public static function getItemCreationListGUIClass(ilCloudPluginService $plugin_service_class)
164  {
165  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "ItemCreationListGUI");
166  return new $class_name($plugin_service_class);
167  }
168 
174  public static function getInitGUIClass(ilCloudPluginService $plugin_service_class)
175  {
176  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "InitGUI");
177  return new $class_name($plugin_service_class);
178  }
179 
186  public static function getFileTreeGUIClass(ilCloudPluginService $plugin_service_class, ilCloudFileTree $file_tree)
187  {
188  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "FileTreeGUI");
189  return new $class_name($plugin_service_class, $file_tree);
190  }
191 
197  public static function getCreateFolderGUIClass(ilCloudPluginService $plugin_service_class)
198  {
199  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "CreateFolderGUI");
200  return new $class_name($plugin_service_class);
201  }
202 
208  public static function getUploadGUIClass(ilCloudPluginService $plugin_service_class)
209  {
210  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "UploadGUI");
211  return new $class_name($plugin_service_class);
212  }
213 
218  public static function getDeleteGUIClass(ilCloudPluginService $plugin_service_class)
219  {
220  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "DeleteGUI");
221  return new $class_name($plugin_service_class);
222  }
223 
228  public static function getHeaderActionGUIClass(ilCloudPluginService $plugin_service_class)
229  {
230  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "HeaderActionGUI");
231  return new $class_name($plugin_service_class);
232  }
233 
238  public static function getCreationGUIClass(ilCloudPluginService $plugin_service_class)
239  {
240  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "CreationGUI");
241  return new $class_name($plugin_service_class);
242  }
243 
248  public static function getInfoScreenGUIClass(ilCloudPluginService $plugin_service_class)
249  {
250  $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "InfoScreenGUI");
251  return new $class_name($plugin_service_class);
252  }
253 }
254 ?>
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)
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)
static getFileTreeGUIClass(ilCloudPluginService $plugin_service_class, ilCloudFileTree $file_tree)
static getPluginClass($service_name, $obj_id)
static checkServiceActive($name)
Class ilCloudPluginService.
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.