/** * Determines whether the specified preview object is supported by the renderer. * * @param ilPreview $preview The preview object to check. * @return bool true, if the renderer supports the specified preview object; otherwise, false. */ public function supports($preview) { // let parent check first if (!parent::supports($preview)) { return false; } // get file extension require_once "./Modules/File/classes/class.ilObjFile.php"; include_once './Modules/File/classes/class.ilObjFileAccess.php'; $filename = ilObjFile::_lookupFileName($preview->getObjId()); $ext = ilObjFileAccess::_getFileExtension($filename); // contains that extension? return in_array($ext, $this->getSupportedFileFormats()); }
/** * Set standard link xml (currently only glossaries) */ function setDefaultLinkXml() { $int_links = $this->getPageObject()->getInternalLinks(true); $this->glossary_links = $int_links; //var_dump($int_links); // key is il__git_18:GlossaryItem:Glossary::4 => id is il__git_18_4, $link_info = "<IntLinkInfos>"; $targetframe = "None"; $ltarget = ""; foreach ($int_links as $int_link) { $onclick = ""; $target = $int_link["Target"]; $targetframe = "None"; if (substr($target, 0, 4) == "il__") { $target_arr = explode("_", $target); $target_id = $target_arr[count($target_arr) - 1]; $type = $int_link["Type"]; switch ($type) { case "GlossaryItem": $ltarget = ""; //$href = "./goto.php?target=git_".$target_id; $href = "#"; $onclick = 'OnClick="return false;"'; $anc_par = 'Anchor=""'; $targetframe = "Glossary"; break; case "File": $ltarget = ""; if ($this->getOutputMode() == "offline") { if (ilObject::_lookupType($target_id) == "file") { include_once "./Modules/File/classes/class.ilObjFile.php"; $href = "./files/file_" . $target_id . "/" . ilObjFile::_lookupFileName($target_id); $ltarget = "_blank"; } } else { $href = str_replace("&", "&", $this->determineFileDownloadLink()) . "&file_id=il__file_" . $target_id; //echo htmlentities($href); } $anc_par = 'Anchor=""'; $targetframe = "None"; //??? break; } $link_info .= "<IntLinkInfo {$onclick} Target=\"{$target}\" Type=\"{$type}\" " . $anc_par . " " . "TargetFrame=\"{$targetframe}\" LinkHref=\"{$href}\" LinkTarget=\"{$ltarget}\" />"; } } $link_info .= "</IntLinkInfos>"; $this->setLinkXML($link_info); //var_dump($link_info); }
/** * Add a content from ILIAS to the Adobe Connect server * * @return string cmd */ public function addContentFromILIAS() { require_once 'Modules/File/classes/class.ilFSStorageFile.php'; require_once 'Modules/File/classes/class.ilObjFileAccess.php'; if (!(int) $_POST['file_id']) { ilUtil::sendInfo($this->txt('content_select_one')); return $this->showFileSearchResult($_SESSION['contents']['search_result']); } /** @noinspection PhpUndefinedClassInspection */ $fss = new ilFSStorageFile((int) $_POST['file_id']); /** @noinspection PhpUndefinedClassInspection */ $version_subdir = '/' . sprintf("%03d", ilObjFileAccess::_lookupVersion($_POST['file_id'])); include_once './Modules/File/classes/class.ilObjFile.php'; $file_name = ilObjFile::_lookupFileName((int) $_POST['file_id']); $object_title = ilObject::_lookupTitle((int) $_POST['file_id']); $file = $fss->getAbsolutePath() . $version_subdir . '/' . $file_name; $this->pluginObj->includeClass('class.ilAdobeConnectDuplicateContentException.php'); try { $curl = curl_init($this->object->addContent($object_title, '')); curl_setopt($curl, CURLOPT_VERBOSE, true); curl_setopt($curl, CURLOPT_POST, true); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); #curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($curl, CURL_UPLOAD, true); curl_setopt($curl, CURLOPT_POSTFIELDS, array('name' => $object_title, 'file' => '@' . $file)); $postResult = curl_exec($curl); curl_close($curl); unset($_SESSION['contents']['search_result']); ilUtil::sendSuccess($this->txt('virtualClassroom_content_added')); return $this->showContent(); } catch (ilAdobeConnectDuplicateContentException $e) { ilUtil::sendFailure($this->txt($e->getMessage())); return $this->showFileSearchResult($_SESSION['contents']['search_result']); } }
/** * return absolute path for version * */ public static function _lookupAbsolutePath($obj_id, $a_version = null) { $file_storage = new ilFSStorageFile($obj_id); $filename = ilObjFile::_lookupFileName($obj_id); $version_subdir = ""; if (!is_numeric($a_version)) { $a_version = ilObjFile::_lookupVersion($obj_id); } $version_subdir = DIRECTORY_SEPARATOR . sprintf("%03d", $a_version); return $file_storage->getAbsolutePath() . $version_subdir . DIRECTORY_SEPARATOR . $filename; }