public function initGUI(ilObjCloudGUI $gui_class, $perm_create_folder, $perm_upload_items, $perm_delete_files, $perm_delete_folders, $perm_download, $perm_files_visible, $perm_folders_visible)
 {
     global $ilTabs, $lng, $tpl;
     $ilTabs->activateTab("content");
     $this->setGuiClass($gui_class);
     $this->setPermUploadItems($perm_upload_items);
     $this->setPermCreateFolders($perm_create_folder);
     $this->setPermDeleteFiles($perm_delete_files);
     $this->setPermDeleteFolders($perm_delete_folders);
     $this->setPermDownload($perm_download);
     $this->setPermFilesVisible($perm_files_visible);
     $this->setPermFoldersVisible($perm_folders_visible);
     try {
         ilCloudConnector::checkServiceActive($this->getGUIClass()->object->getServiceName());
         $this->beforeInitGUI();
         $tpl->addJavaScript("./Modules/Cloud/js/ilCloudFileList.js");
         $tpl->addJavaScript("./Modules/Cloud/js/jquery.address.js");
         $tpl->addJavascript("./Services/UIComponent/AdvancedSelectionList/js/AdvancedSelectionList.js");
         $tpl->addCss("./Modules/Cloud/templates/css/cloud.css");
         include_once "./Services/YUI/classes/class.ilYuiUtil.php";
         ilYuiUtil::initConnection();
         $this->tpl_file_tree = new ilTemplate("tpl.cloud_file_tree.html", true, true, "Modules/Cloud");
         $file_tree = new ilCloudFileTree($this->getGUIClass()->object->getRootFolder(), $this->getGUIClass()->object->getRootId(), $this->getGUIClass()->object->getId(), $this->getGUIClass()->object->getServiceName());
         $file_tree->storeFileTreeToSession();
         $this->addToolbar($file_tree->getRootNode());
         $this->tpl_file_tree->setVariable("ASYNC_GET_BLOCK", json_encode($this->getGUIClass()->ctrl->getLinkTargetByClass("ilobjcloudgui", "asyncGetBlock", true)));
         $this->tpl_file_tree->setVariable("ASYNC_CREATE_FOLDER", json_encode($this->getGUIClass()->ctrl->getLinkTargetByClass("ilcloudplugincreatefoldergui", "asyncCreateFolder", true)));
         $this->tpl_file_tree->setVariable("ASYNC_UPLOAD_FILE", json_encode($this->getGUIClass()->ctrl->getLinkTargetByClass("ilcloudpluginuploadgui", "asyncUploadFile", true)));
         $this->tpl_file_tree->setVariable("ASYNC_DELETE_ITEM", json_encode($this->getGUIClass()->ctrl->getLinkTargetByClass("ilcloudplugindeletegui", "asyncDeleteItem", true)));
         $this->tpl_file_tree->setVariable("ROOT_ID", json_encode($file_tree->getRootNode()->getId()));
         $this->tpl_file_tree->setVariable("ROOT_PATH", json_encode($file_tree->getRootNode()->getPath()));
         if (isset($_POST["path"])) {
             $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($_POST["path"]));
             $file_tree->updateFileTree($_POST["path"]);
             $node = $file_tree->getNodeFromPath($_POST["path"]);
             $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($node->getId()));
         } else {
             $this->tpl_file_tree->setVariable("CURRENT_PATH", json_encode($file_tree->getRootNode()->getPath()));
             $this->tpl_file_tree->setVariable("CURRENT_ID", json_encode($file_tree->getRootNode()->getID()));
         }
         $txt_max_file_size = $lng->txt("file_notice") . " " . ilCloudConnector::getPluginClass($this->getGUIClass()->object->getServiceName(), $this->getGUIClass()->object->getId())->getMaxFileSize() . " MB";
         $this->tpl_file_tree->setVariable("MAX_FILE_SIZE", json_encode($txt_max_file_size));
         $this->beforeSetContent();
         $tpl->setContent($this->tpl_file_tree->get());
         $tpl->setPermanentLink("cld", $this->getGuiClass()->object->getRefId(), "_path__endPath");
         /**
                     else
                     {
                         $file_tree = ilCloudFileTree::getFileTreeFromSession();
                         if($_GET["current_path"] && $_GET["current_id"] && $file_tree && $file_tree->getId() == $this->getGUIClass()->object->getId())
                         {
                             $path = $_GET["current_path"];
                             $id = $_GET["current_id"];
         
                         }
                         else
                         {
                             $path = $gui_class->object->getRootFolder();
                             $id = $gui_class->object->getRootId();
                             ilCloudFileTree::clearFileTreeSession();
                             $file_tree = new ilCloudFileTree($this->getGUIClass()->object->getRootFolder(), $this->getGUIClass()->object->getRootId(), $this->getGUIClass()->object->getId(), $this->getGUIClass()->object->getServiceName());
                         }
         
         
                         $file_tree->updateFileTree($path);
                         $file_tree_gui = ilCloudConnector::getFileTreeGUIClass($this->getService(), $file_tree);
                         $this->content = $file_tree_gui->getFolderHtml($this->getGuiClass(), $id, $this->getPermDeleteFiles(), $this->getPermDeleteFolders(), $this->getPermDownload(), $this->getPermFilesVisible(), $this->getPermCreateFolders());
                         $tpl->setContent($this->content);
                     }**/
         $this->afterInitGUI();
     } catch (Exception $e) {
         if ($e->getCode() == ilCloudException::AUTHENTIFICATION_FAILED) {
             $this->getGUIClass()->object->setAuthComplete(false);
             $this->getGUIClass()->object->doUpdate();
         }
         ilUtil::sendFailure($e->getMessage());
     }
 }
 /**
  * Delete data from db
  */
 function doDelete()
 {
     global $ilDB;
     if ($this->getServiceName() != null) {
         $plugin_class = ilCloudConnector::getPluginClass($this->getServiceName(), $this->getId());
         if ($plugin_class) {
             $plugin_class->doDelete($this->getId());
         }
     }
     $ilDB->manipulate("DELETE FROM il_cld_data WHERE " . " id = " . $ilDB->quote($this->getId(), "integer"));
 }
 /**
  * @param $service_name
  * @param $obj_id
  */
 public function __construct($service_name, $obj_id)
 {
     $this->plugin_object = ilCloudConnector::getPluginClass($service_name, $obj_id);
 }
 /**
  * @param $id
  * @param $tmp_name
  * @param $file_name
  * @throws ilCloudException
  */
 public function uploadFileToService($current_id, $tmp_name, $file_name)
 {
     $plugin = ilCloudConnector::getPluginClass($this->getServiceName(), $this->getId());
     $max_file_size = $plugin->getMaxFileSize();
     if ($max_file_size >= filesize($tmp_name) / (1024 * 1024)) {
         $current_node = $this->getNodeFromId($current_id);
         $current_node->setLoadingComplete(false);
         $this->storeFileTreeToSession();
         try {
             $service = ilCloudConnector::getServiceClass($this->getServiceName(), $this->getId());
             $service->putFile($tmp_name, $file_name, $current_node->getPath(), $this);
         } catch (Exception $e) {
             if ($e instanceof ilCloudException) {
                 throw $e;
             }
             throw new ilCloudException(ilCloudException::UPLOAD_FAILED, $e->getMessage());
         }
     } else {
         throw new ilCloudException(ilCloudException::UPLOAD_FAILED_MAX_FILESIZE, filesize($tmp_name) / (1024 * 1024) . " MB");
     }
 }