/** * @param string $a_cmd * @param string $a_permission * @param int $a_ref_id * @param int $a_obj_id * @param string $a_user_id * @return bool */ function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_user_id = "") { global $ilUser, $rbacsystem; $object = new ilObjCloud($a_ref_id); /** * Check if plugin of object is active */ try { ilCloudConnector::checkServiceActive($object->getServiceName()); } catch (Exception $e) { return false; } if ($a_user_id == "") { $a_user_id = $ilUser->getId(); } /** * Check if authentication is complete. If not, only the owner of the object has access. This prevents the * authentication of an account which does not belong to the owner. */ if (!ilObjCloudAccess::checkAuthStatus($a_obj_id) && $a_user_id != $object->getOwnerId()) { return false; } switch ($a_permission) { case "visible": case "read": if (!ilObjCloudAccess::checkOnline($a_obj_id) && !$rbacsystem->checkAccessOfUser($a_user_id, "write", $a_ref_id)) { return false; } break; } return true; }
/** * @param $obj_id */ public function __construct($service_name, $obj_id, $cloud_modul_object = null) { $this->setObjId($obj_id); $this->plugin_hook_object = ilCloudConnector::getPluginHookClass($service_name); if (!is_object($this->plugin_hook_object)) { throw new ilCloudException(ilCloudException::PLUGIN_HOOK_COULD_NOT_BE_INSTANTIATED); } $this->admin_config_object = new ilCloudPluginConfig($this->plugin_hook_object->getPluginConfigTableName()); if (!$this->read()) { $this->create(); } if (!$cloud_modul_object) { $cloud_modul_object = new ilObjCloud($obj_id, false); } $this->setCloudModulObject($cloud_modul_object); }
function addToolbar($root_node) { global $lng, $ilToolbar, $tpl; $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService()); $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($list_gui_html) { // toolbar $ov_id = "il_add_new_cld_item_v"; $ov_trigger_id = $ov_id . "_tr"; $toolbar_locator = new ilLocatorGUI(); $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node)); $ilToolbar->setId('xcld_toolbar'); $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>"); $ilToolbar->addSeparator(); $ilToolbar->addButton($lng->txt("cld_add_new_item"), "#", "", "", "", $ov_trigger_id, 'submit emphsubmit'); include_once "Services/UIComponent/Overlay/classes/class.ilOverlayGUI.php"; $ov = new ilOverlayGUI($ov_id); $ov->add(); $ov->addTrigger($ov_trigger_id, "click", $ov_trigger_id, false, "tl", "tr"); $tpl->setVariable("SELECT_OBJTYPE_REPOS", '<div id="' . $ov_id . '" class="ilOverlay ilNoDisplay">' . $list_gui_html . '</div>'); } }
/** * @param ilCloudFileNode $node * @param ilObjCloudGUI $gui_class * @param bool $delete_files * @param bool $delete_folder * @param bool $download * * @return string */ public function getItemHtml(ilCloudFileNode $node, ilObjCloudGUI $gui_class, $delete_files = false, $delete_folder = false, $download = false) { global $ilCtrl; $item = new ilTemplate("tpl.container_list_item.html", true, true, "Services/Container/"); $action_list_gui = ilCloudConnector::getActionListGUIClass($this->getService()); $item->setVariable("COMMAND_SELECTION_LIST", $action_list_gui->getSelectionListItemsHTML($delete_files, $delete_folder, $node)); $item->setVariable("DIV_CLASS", "ilContainerListItemOuter"); $item->touchBlock("d_1"); include_once './Services/Calendar/classes/class.ilDate.php'; $modified = ilDatePresentation::formatDate(new ilDateTime($node->getModified(), IL_CAL_UNIX)); if ($node->getIconPath() != "") { $item->setVariable("SRC_ICON", $node->getIconPath()); } // Folder with content if ($node->getIsDir()) { if ($node->getIconPath() == "") { // $item->setVariable("SRC_ICON", "./Modules/Cloud/templates/images/icon_folder_b.png"); $item->setVariable("SRC_ICON", ilUtil::getImagePath('icon_fold.svg')); } $item->setVariable("TXT_DESC", ' '); $item->setVariable("TXT_TITLE_LINKED", basename($node->getPath())); $item->setVariable("HREF_TITLE_LINKED", $this->getLinkToFolder($node)); } else { if ($node->getIconPath() == "") { // $item->setVariable("SRC_ICON", "./Modules/Cloud/templates/images/icon_file_b.png"); $item->setVariable("SRC_ICON", ilUtil::getImagePath('icon_file.svg')); } $item->setVariable("TXT_DESC", pathinfo($node->getPath(), PATHINFO_EXTENSION) . " " . $node->getSize() . " " . $modified); if ($download) { $item->setVariable("TXT_TITLE_LINKED", basename($node->getPath())); $item->setVariable("HREF_TITLE_LINKED", $ilCtrl->getLinkTarget($gui_class, "getFile") . "&id=" . $node->getId()); } else { $item->setVariable("TXT_TITLE", basename($node->getPath())); } } $this->setItemVariablePlugin($item, $node); return $item->get(); }
/** * @param $service_name * @param $obj_id */ public function __construct($service_name, $obj_id) { $this->plugin_object = ilCloudConnector::getPluginClass($service_name, $obj_id); }
function asyncGetActionListContent() { $action_list = ilCloudConnector::getActionListGUIClass($this->plugin_service); $file_tree = ilCloudFileTree::getFileTreeFromSession(); return $action_list->asyncGetContent($this->checkPermissionBool("delete_files"), $this->checkPermissionBool("delete_folders"), $file_tree->getNodeFromId($_GET["node_id"])); }
/** * 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 $root_node */ public function addToolbar($root_node) { global $lng, $ilToolbar, $ilLog; $create_list_gui = ilCloudConnector::getItemCreationListGUIClass($this->getService()); $list_gui_html = $create_list_gui->getGroupedListItemsHTML($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($list_gui_html) { //toolbar $toolbar_locator = new ilLocatorGUI(); $toolbar_locator->addItem($this->getGuiClass()->object->getTitle(), ilCloudPluginFileTreeGUI::getLinkToFolder($root_node)); $ilToolbar->setId('xcld_toolbar'); $ilToolbar->addText("<div class='xcld_locator'>" . $toolbar_locator->getHtml() . "</div>"); $ilToolbar->addSeparator(); include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; $adv = new ilAdvancedSelectionListGUI(); $adv->setListTitle($lng->txt("cld_add_new_item")); $ilCloudGroupedListGUI = $create_list_gui->getGroupedListItems($this->getPermUploadItems(), $this->getPermCreateFolders()); if ($ilCloudGroupedListGUI->hasItems()) { $adv->setGroupedList($ilCloudGroupedListGUI); } $adv->setStyle(ilAdvancedSelectionListGUI::STYLE_EMPH); $ilToolbar->addText($adv->getHTML()); } }
/** * @param ilCloudPluginService $plugin_service_class * @return ilCloudPluginInfoScreenGUI */ public static function getInfoScreenGUIClass(ilCloudPluginService $plugin_service_class) { $class_name = ilCloudConnector::getFullClassName($plugin_service_class->getPluginHookObject()->getPluginName(), "InfoScreenGUI"); return new $class_name($plugin_service_class); }
/** * @param $id * @throws ilCloudException */ public function downloadFromService($id) { try { $service = ilCloudConnector::getServiceClass($this->getServiceName(), $this->getId()); $node = $this->getNodeFromId($id); $service->getFile($node->getPath(), $this); } catch (Exception $e) { if ($e instanceof ilCloudException) { throw $e; } throw new ilCloudException(ilCloudException::DOWNLOAD_FAILED, $e->getMessage()); } }