当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjFile类代码示例

本文整理汇总了PHP中ilObjFile的典型用法代码示例。如果您正苦于以下问题:PHP ilObjFile类的具体用法?PHP ilObjFile怎么用?PHP ilObjFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ilObjFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: renderImages

 /**
  * Renders the specified object into images.
  * The images do not need to be of the preview image size.
  * 
  * @param ilObjFile $obj The object to create images from.
  * @return array An array of ilRenderedImage containing the absolute file paths to the images.
  */
 protected function renderImages($obj)
 {
     $filepath = $obj->getFile();
     $tmpPath = $this->prepareFileForExec($filepath);
     $isTemporary = $tmpPath != $filepath;
     return array(new ilRenderedImage($tmpPath . "[0]", $isTemporary));
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:14,代码来源:class.ilImageMagickRenderer.php

示例2: renderImages

 /**
  * Renders the specified object into images.
  * The images do not need to be of the preview image size.
  * 
  * @param ilObjFile $obj The object to create images from.
  * @return array An array of ilRenderedImage containing the absolute file paths to the images.
  */
 protected function renderImages($obj)
 {
     $numOfPreviews = $this->getMaximumNumberOfPreviews();
     // get file path
     $filepath = $obj->getFile();
     $inputFile = $this->prepareFileForExec($filepath);
     // create a temporary file name and remove its extension
     $output = str_replace(".tmp", "", ilUtil::ilTempnam());
     // use '#' instead of '%' as it gets replaced by 'escapeShellArg' on windows!
     $outputFile = $output . "_#02d.png";
     // create images with ghostscript (we use PNG here as it has better transparency quality)
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=pngalpha -dEPSCrop -r72 -o $outputFile $inputFile
     // gswin32c -dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=5 -sDEVICE=jpeg -dJPEGQ=90 -r72 -o $outputFile $inputFile
     $args = sprintf("-dBATCH -dNOPAUSE -dSAFER -dFirstPage=1 -dLastPage=%d -sDEVICE=pngalpha -dEPSCrop -r72 -o %s %s", $numOfPreviews, str_replace("#", "%", ilUtil::escapeShellArg($outputFile)), ilUtil::escapeShellArg($inputFile));
     ilUtil::execQuoted(PATH_TO_GHOSTSCRIPT, $args);
     // was a temporary file created? then delete it
     if ($filepath != $inputFile) {
         @unlink($inputFile);
     }
     // check each file and add it
     $images = array();
     $outputFile = str_replace("#", "%", $outputFile);
     for ($i = 1; $i <= $numOfPreviews; $i++) {
         $imagePath = sprintf($outputFile, $i);
         if (!file_exists($imagePath)) {
             break;
         }
         $images[] = new ilRenderedImage($imagePath);
     }
     return $images;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:class.ilGhostscriptRenderer.php

示例3: getXmlExportHeadDependencies

 /**
  * Get head dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "pg") {
         // get all media objects and files of the page
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Modules/File/classes/class.ilObjFile.php";
         $mob_ids = array();
         $file_ids = array();
         foreach ($a_ids as $pg_id) {
             $pg_id = explode(":", $pg_id);
             // get media objects
             $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($mids as $mid) {
                 if (ilObject::_lookupType($mid) == "mob") {
                     $mob_ids[] = $mid;
                 }
             }
             // get files
             $files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($files as $file) {
                 if (ilObject::_lookupType($file) == "file") {
                     $file_ids[] = $file;
                 }
             }
         }
         return array(array("component" => "Services/MediaObjects", "entity" => "mob", "ids" => $mob_ids), array("component" => "Modules/File", "entity" => "file", "ids" => $file_ids));
     }
     return array();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:37,代码来源:class.ilCOPageExporter.php

示例4: recurseFolder

 /**
  * private functions which iterates through all folders and files 
  * and create an according file structure in a temporary directory. This function works recursive. 
  *
  * @param integer $refid reference it
  * @param tmpdictory $tmpdir
  * @return returns first created directory
  */
 private static function recurseFolder($refid, $title, $tmpdir)
 {
     global $rbacsystem, $tree, $ilAccess;
     $tmpdir = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($title);
     ilUtil::makeDir($tmpdir);
     $subtree = $tree->getChildsByTypeFilter($refid, array("fold", "file"));
     foreach ($subtree as $child) {
         if (!$ilAccess->checkAccess("read", "", $child["ref_id"])) {
             continue;
         }
         if (ilObject::_isInTrash($child["ref_id"])) {
             continue;
         }
         if ($child["type"] == "fold") {
             ilObjFolder::recurseFolder($child["ref_id"], $child["title"], $tmpdir);
         } else {
             $newFilename = $tmpdir . DIRECTORY_SEPARATOR . ilUtil::getASCIIFilename($child["title"]);
             // copy to temporal directory
             $oldFilename = ilObjFile::_lookupAbsolutePath($child["obj_id"]);
             if (!copy($oldFilename, $newFilename)) {
                 throw new ilFileException("Could not copy " . $oldFilename . " to " . $newFilename);
             }
             touch($newFilename, filectime($oldFilename));
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:34,代码来源:class.ilObjWorkspaceFolder.php

示例5: supports

 /**
  * 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());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:20,代码来源:class.ilFilePreviewRenderer.php

示例6: addFile

 /**
  * add an File with id.
  *
  * @param string $session_id    current session
  * @param int $target_id refid of parent in repository
  * @param string $file_xml   qti xml description of test
  *
  * @return int reference id in the tree, 0 if not successful
  */
 function addFile($sid, $target_id, $file_xml)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacsystem, $tree, $ilLog, $ilAccess;
     if (!($target_obj =& ilObjectFactory::getInstanceByRefId($target_id, false))) {
         return $this->__raiseError('No valid target given.', 'Client');
     }
     if (ilObject::_isInTrash($target_id)) {
         return $this->__raiseError("Parent with ID {$target_id} has been deleted.", 'CLIENT_TARGET_DELETED');
     }
     // Check access
     $allowed_types = array('cat', 'grp', 'crs', 'fold', 'root');
     if (!in_array($target_obj->getType(), $allowed_types)) {
         return $this->__raiseError('No valid target type. Target must be reference id of "course, group, category or folder"', 'Client');
     }
     if (!$ilAccess->checkAccess('create', '', $target_id, "file")) {
         return $this->__raiseError('No permission to create Files in target  ' . $target_id . '!', 'Client');
     }
     // create object, put it into the tree and use the parser to update the settings
     include_once './Modules/File/classes/class.ilFileXMLParser.php';
     include_once './Modules/File/classes/class.ilFileException.php';
     include_once './Modules/File/classes/class.ilObjFile.php';
     $file = new ilObjFile();
     try {
         $fileXMLParser = new ilFileXMLParser($file, $file_xml);
         if ($fileXMLParser->start()) {
             global $ilLog;
             $ilLog->write(__METHOD__ . ': File type: ' . $file->getFileType());
             $file->create();
             $file->createReference();
             $file->putInTree($target_id);
             $file->setPermissions($target_id);
             // we now can save the file contents since we know the obj id now.
             $fileXMLParser->setFileContents();
             #$file->update();
             return $file->getRefId();
         } else {
             return $this->__raiseError("Could not add file", "Server");
         }
     } catch (ilFileException $exception) {
         return $this->__raiseError($exception->getMessage(), $exception->getCode() == ilFileException::$ID_MISMATCH ? "Client" : "Server");
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:56,代码来源:class.ilSoapFileAdministration.php

示例7: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     include_once './Modules/File/classes/class.ilObjFile.php';
     // case i container
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
     } else {
         $newObj = new ilObjFile();
         $newObj->create(true);
     }
     include_once "./Modules/File/classes/class.ilFileXMLParser.php";
     $parser = new ilFileXMLParser($newObj, $a_xml);
     $parser->setImportDirectory($this->getImportDirectory());
     $parser->startParsing();
     $newObj->createProperties(false, false);
     $parser->setFileContents();
     $this->current_obj = $newObj;
     $newObj->update();
     // this is necessary for case ii (e.g. wiki import)
     $a_mapping->addMapping("Modules/File", "file", $a_id, $newObj->getId());
     $a_mapping->addMapping("Services/MetaData", "md", $a_id . ":0:file", $newObj->getId() . ":0:file");
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:28,代码来源:class.ilFileImporter.php

示例8: handleFileUpload

 /**
  * Handles the upload of a single file and adds it to the parent object.
  * 
  * @param array $file_upload An array containing the file upload parameters.
  * @return object The response object.
  */
 protected function handleFileUpload($file_upload)
 {
     global $ilUser;
     // file upload params
     $filename = $file_upload["name"];
     $type = $file_upload["type"];
     $size = $file_upload["size"];
     $temp_name = $file_upload["tmp_name"];
     // additional params
     $title = $file_upload["title"];
     $description = $file_upload["description"];
     $extract = $file_upload["extract"];
     $keep_structure = $file_upload["keep_structure"];
     // create answer object
     $response = new stdClass();
     $response->fileName = $filename;
     $response->fileSize = intval($size);
     $response->fileType = $type;
     $response->fileUnzipped = $extract;
     $response->error = null;
     // extract archive?
     if ($extract) {
         $zip_file = $filename;
         $adopt_structure = $keep_structure;
         include_once "Services/Utilities/classes/class.ilFileUtils.php";
         // Create unzip-directory
         $newDir = ilUtil::ilTempnam();
         ilUtil::makeDir($newDir);
         // Check if permission is granted for creation of object, if necessary
         if ($this->id_type != self::WORKSPACE_NODE_ID) {
             $type = ilObject::_lookupType((int) $this->parent_id, true);
         } else {
             $type = ilObject::_lookupType($this->tree->lookupObjectId($this->parent_id), false);
         }
         $tree = $access_handler = null;
         switch ($type) {
             // workspace structure
             case 'wfld':
             case 'wsrt':
                 $permission = $this->checkPermissionBool("create", "", "wfld");
                 $containerType = "WorkspaceFolder";
                 $tree = $this->tree;
                 $access_handler = $this->getAccessHandler();
                 break;
                 // use categories as structure
             // use categories as structure
             case 'cat':
             case 'root':
                 $permission = $this->checkPermissionBool("create", "", "cat");
                 $containerType = "Category";
                 break;
                 // use folders as structure (in courses)
             // use folders as structure (in courses)
             default:
                 $permission = $this->checkPermissionBool("create", "", "fold");
                 $containerType = "Folder";
                 break;
         }
         try {
             // 	processZipFile (
             //		Dir to unzip,
             //		Path to uploaded file,
             //		should a structure be created (+ permission check)?
             //		ref_id of parent
             //		object that contains files (folder or category)
             //		should sendInfo be persistent?)
             ilFileUtils::processZipFile($newDir, $temp_name, $adopt_structure && $permission, $this->parent_id, $containerType, $tree, $access_handler);
         } catch (ilFileUtilsException $e) {
             $response->error = $e->getMessage();
         } catch (Exception $ex) {
             $response->error = $ex->getMessage();
         }
         ilUtil::delDir($newDir);
         // #15404
         if ($this->id_type != self::WORKSPACE_NODE_ID) {
             foreach (ilFileUtils::getNewObjects() as $parent_ref_id => $objects) {
                 if ($parent_ref_id != $this->parent_id) {
                     continue;
                 }
                 foreach ($objects as $object) {
                     $this->after_creation_callback_objects[] = $object;
                 }
             }
         }
     } else {
         if (trim($title) == "") {
             $title = $filename;
         } else {
             // BEGIN WebDAV: Ensure that object title ends with the filename extension
             $fileExtension = ilObjFileAccess::_getFileExtension($filename);
             $titleExtension = ilObjFileAccess::_getFileExtension($title);
             if ($titleExtension != $fileExtension && strlen($fileExtension) > 0) {
                 $title .= '.' . $fileExtension;
             }
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilObjFileGUI.php

示例9: setDefaultLinkXml

 /**
  * 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("&", "&amp;", $this->determineFileDownloadLink()) . "&amp;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);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:53,代码来源:class.ilSCORM2004PageGUI.php

示例10: getMaterialInfo

 /**
  * Get material file name and goto url
  * 
  * @param int $a_wsp_id
  * @return array caption, url 
  */
 function getMaterialInfo($a_wsp_id)
 {
     global $ilUser;
     if (!$this->ws_tree) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $this->ws_tree = new ilWorkspaceTree($ilUser->getId());
         $this->ws_access = new ilWorkspaceAccessHandler($caption);
     }
     $obj_id = $this->ws_tree->lookupObjectId($a_wsp_id);
     $caption = ilObject::_lookupTitle($obj_id);
     if (!$this->offline_mode) {
         $url = $this->ws_access->getGotoLink($a_wsp_id, $obj_id);
     } else {
         $url = $this->offline_mode . "file_" . $obj_id . "/";
         // all possible material types for now
         switch (ilObject::_lookupType($obj_id)) {
             case "tstv":
                 include_once "Modules/Test/classes/class.ilObjTestVerification.php";
                 $obj = new ilObjTestVerification($obj_id, false);
                 $url .= $obj->getOfflineFilename();
                 break;
             case "excv":
                 include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
                 $obj = new ilObjExerciseVerification($obj_id, false);
                 $url .= $obj->getOfflineFilename();
                 break;
             case "file":
                 $file = new ilObjFile($obj_id, false);
                 $url .= $file->getFilename();
                 break;
         }
     }
     return array($caption, $url);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:41,代码来源:class.ilPersonalSkillsGUI.php

示例11: initForm

 /**
  * init Form
  *
  * @param string $a_mode values: create | edit
  */
 public function initForm()
 {
     global $lng, $ilCtrl;
     //table_id
     $hidden_prop = new ilHiddenInputGUI("table_id");
     $hidden_prop->setValue($this->table_id);
     $this->form->addItem($hidden_prop);
     $ilCtrl->setParameter($this, "record_id", $this->record_id);
     $this->form->setFormAction($ilCtrl->getFormAction($this));
     $allFields = $this->table->getRecordFields();
     foreach ($allFields as $field) {
         $item = ilDataCollectionDatatype::getInputField($field);
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
             $fieldref = $field->getFieldRef();
             $reffield = ilDataCollectionCache::getFieldCache($fieldref);
             $options = array();
             if (!$field->isNRef()) {
                 $options[""] = '--';
             }
             $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
             foreach ($reftable->getRecords() as $record) {
                 // If the referenced field is MOB or FILE, we display the filename in the dropdown
                 if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) {
                     $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
                     $options[$record->getId()] = $file_obj->getFileName();
                 } else {
                     if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
                         $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
                         $options[$record->getId()] = $media_obj->getTitle();
                     } else {
                         $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
                     }
                 }
             }
             $item->setOptions($options);
         }
         if ($this->record_id) {
             $record = ilDataCollectionCache::getRecordCache($this->record_id);
         }
         $item->setRequired($field->getRequired());
         //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB && ($this->record_id && $record->getId() != 0 && ($record->getRecordFieldValue($field->getId()) != "-" || $record->getRecordFieldValue($field->getId()) != ""))) {
             $item->setRequired(false);
         }
         if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
             $item->setDisabled(true);
         }
         $this->form->addItem($item);
     }
     // Add possibility to change the owner in edit mode
     if ($this->record_id) {
         $ownerField = $this->table->getField('owner');
         $inputfield = ilDataCollectionDatatype::getInputField($ownerField);
         $this->form->addItem($inputfield);
     }
     // save and cancel commands
     if (isset($this->record_id)) {
         $this->form->setTitle($lng->txt("dcl_update_record"));
         $this->form->addCommandButton("save", $lng->txt("dcl_update_record"));
         $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
     } else {
         $this->form->setTitle($lng->txt("dcl_add_new_record"));
         $this->form->addCommandButton("save", $lng->txt("save"));
         $this->form->addCommandButton("cancelSave", $lng->txt("cancel"));
     }
     $ilCtrl->setParameter($this, "table_id", $this->table_id);
     $ilCtrl->setParameter($this, "record_id", $this->record_id);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:73,代码来源:class.ilDataCollectionRecordEditGUI.php

示例12: createFileItem

 /**
  * insert new file item
  */
 function createFileItem()
 {
     global $lng;
     if ($_FILES["file"]["name"] == "") {
         $_GET["subCmd"] = "-";
         ilUtil::sendFailure($lng->txt("upload_error_file_not_found"));
         return false;
     }
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $fileObj = new ilObjFile();
     $fileObj->setType("file");
     $fileObj->setTitle($_FILES["file"]["name"]);
     $fileObj->setDescription("");
     $fileObj->setFileName($_FILES["file"]["name"]);
     $fileObj->setFileType($_FILES["file"]["type"]);
     $fileObj->setFileSize($_FILES["file"]["size"]);
     $fileObj->setMode("filelist");
     $fileObj->create();
     $fileObj->raiseUploadError(false);
     // upload file to filesystem
     $fileObj->createDirectory();
     $fileObj->getUploadFile($_FILES["file"]["tmp_name"], $_FILES["file"]["name"]);
     return $fileObj;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:27,代码来源:class.ilPCFileListGUI.php

示例13: initForm

 /**
  * init Form
  */
 public function initForm()
 {
     $this->form = new ilPropertyFormGUI();
     $prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl';
     // Used by datacolleciton.js to select input elements
     $this->form->setId($prefix . $this->table_id . $this->record_id);
     $hidden_prop = new ilHiddenInputGUI("table_id");
     $hidden_prop->setValue($this->table_id);
     $this->form->addItem($hidden_prop);
     if ($this->record_id) {
         $hidden_prop = new ilHiddenInputGUI("record_id");
         $hidden_prop->setValue($this->record_id);
         $this->form->addItem($hidden_prop);
     }
     $this->ctrl->setParameter($this, "record_id", $this->record_id);
     $this->form->setFormAction($this->ctrl->getFormAction($this));
     $allFields = $this->table->getRecordFields();
     $inline_css = '';
     foreach ($allFields as $field) {
         $item = ilDataCollectionDatatype::getInputField($field);
         if ($item === NULL) {
             continue;
             // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input
         }
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
             $fieldref = $field->getFieldRef();
             $reffield = ilDataCollectionCache::getFieldCache($fieldref);
             $options = array();
             if (!$field->isNRef()) {
                 $options[""] = $this->lng->txt('dcl_please_select');
             }
             $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId());
             foreach ($reftable->getRecords() as $record) {
                 // If the referenced field is MOB or FILE, we display the filename in the dropdown
                 switch ($reffield->getDatatypeId()) {
                     case ilDataCollectionDatatype::INPUTFORMAT_FILE:
                         $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false);
                         $options[$record->getId()] = $file_obj->getFileName();
                         break;
                     case ilDataCollectionDatatype::INPUTFORMAT_MOB:
                         $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false);
                         $options[$record->getId()] = $media_obj->getTitle();
                         break;
                     case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
                         $options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref);
                         break;
                     default:
                         $options[$record->getId()] = $record->getRecordFieldValue($fieldref);
                         break;
                 }
             }
             asort($options);
             $item->setOptions($options);
             if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
                 // FSX use this to apply to MultiSelectInputGUI
                 //					if (!$field->isNRef()) { // addCustomAttribute only defined for single selects
                 if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) {
                     $item->addCustomAttribute('data-ref="1"');
                     $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"');
                     $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"');
                 }
                 //					}
             }
             if ($item instanceof ilMultiSelectInputGUI) {
                 $item->setWidth(400);
                 $item->setHeight(100);
                 $inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} ';
             }
         }
         if ($this->record_id) {
             $record = ilDataCollectionCache::getRecordCache($this->record_id);
         }
         $item->setRequired($field->getRequired());
         //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it.
         if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) {
             if ($this->record_id and $record->getId()) {
                 $field_value = $record->getRecordFieldValue($field->getId());
                 if ($field_value) {
                     $item->setRequired(false);
                 }
             }
             // If this is an ajax request to return the form, input files are currently not supported
             if ($this->ctrl->isAsynch()) {
                 $item->setDisabled(true);
             }
         }
         if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) {
             $item->setDisabled(true);
         }
         $this->form->addItem($item);
     }
     $this->tpl->addInlineCss($inline_css);
     // Add possibility to change the owner in edit mode
     if ($this->record_id) {
         $ownerField = $this->table->getField('owner');
         $inputfield = ilDataCollectionDatatype::getInputField($ownerField);
         $this->form->addItem($inputfield);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilDataCollectionRecordEditGUI.php

示例14: deleteFile

 public function deleteFile($obj_id)
 {
     if (ilObject2::_lookupObjId($obj_id)) {
         $file = new ilObjFile($obj_id, false);
         $file->delete();
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:7,代码来源:class.ilDataCollectionRecord.php

示例15: exportFileItems

 /**
  * export files of file itmes
  *
  */
 function exportFileItems($a_target_dir, &$expLog)
 {
     include_once "./Modules/File/classes/class.ilObjFile.php";
     if (is_array($this->file_ids)) {
         foreach ($this->file_ids as $file_id) {
             $expLog->write(date("[y-m-d H:i:s] ") . "File Item " . $file_id);
             if (ilObject::_lookupType($file_id) == "file") {
                 $file_obj = new ilObjFile($file_id, false);
                 $file_obj->export($a_target_dir);
                 unset($file_obj);
             } else {
                 $expLog->write(date("[y-m-d H:i:s] ") . "File Item not found, ID: " . $file_id);
             }
         }
     }
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $linked_mobs = array();
     if (is_array($this->mob_ids)) {
         // mobs directly embedded into pages
         foreach ($this->mob_ids as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $media_obj->exportFiles($a_target_dir, $expLog);
                 $lmobs = $media_obj->getLinkedMediaObjects($this->mob_ids);
                 $linked_mobs = array_merge($linked_mobs, $lmobs);
                 unset($media_obj);
             }
         }
         // linked mobs (in map areas)
         foreach ($linked_mobs as $mob_id) {
             if ($mob_id > 0 && ilObject::_exists($mob_id)) {
                 $expLog->write(date("[y-m-d H:i:s] ") . "Media Object " . $mob_id);
                 $media_obj = new ilObjMediaObject($mob_id);
                 $media_obj->exportFiles($a_target_dir);
                 unset($media_obj);
             }
         }
     }
     //media files in questions
     foreach ($this->q_media as $media) {
         if ($media != "") {
             error_log($media);
             copy($media, $a_target_dir . "/objects/" . basename($media));
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:51,代码来源:class.ilSCORM2004Asset.php


注:本文中的ilObjFile类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。