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


PHP ilObjMediaObject::_getDirectory方法代码示例

本文整理汇总了PHP中ilObjMediaObject::_getDirectory方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::_getDirectory方法的具体用法?PHP ilObjMediaObject::_getDirectory怎么用?PHP ilObjMediaObject::_getDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjMediaObject的用法示例。


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

示例1: getPageDiskSize

 public function getPageDiskSize()
 {
     $quota_sum = 0;
     $this->buildDom();
     $dom = $this->getDom();
     if ($dom instanceof php4DOMDocument) {
         $dom = $dom->myDOMDocument;
     }
     $xpath_temp = new DOMXPath($dom);
     // mobs
     include_once "Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $nodes = $xpath_temp->query("//PageContent/MediaObject/MediaAlias");
     foreach ($nodes as $node) {
         $mob_id = array_pop(explode("_", $node->getAttribute("OriginId")));
         $mob_dir = ilObjMediaObject::_getDirectory($mob_id);
         $quota_sum += ilUtil::dirSize($mob_dir);
     }
     return $quota_sum;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:19,代码来源:class.ilPortfolioTemplatePage.php

示例2: uploadRoomsAgreement

 /**
  * Uploads a new rooms agreement by using the ILIAS MediaObject Service.
  * If the old file id is given, the old file will be deleted.
  *
  * @param array  $a_newfile   an array containing the input values of the form
  * @param string $a_oldFileId to delete trash
  *
  * @return string uploaded file id
  */
 public function uploadRoomsAgreement($a_newfile, $a_oldFileId = "0")
 {
     if (!empty($a_oldFileId) && $a_oldFileId != "0") {
         $agreementFile = new ilObjMediaObject($a_oldFileId);
         $agreementFile->delete();
     }
     $mediaObj = new ilObjMediaObject();
     $mediaObj->setTitle("RoomSharingRoomsAgreement");
     $mediaObj->setDescription("RoomSharingRoomsAgreement");
     $mediaObj->create();
     $mob_dir = ilObjMediaObject::_getDirectory($mediaObj->getId());
     if (!is_dir($mob_dir)) {
         $mediaObj->createDirectory();
     }
     $file_name = ilUtil::getASCIIFilename($a_newfile["name"]);
     $file_name_mod = str_replace(" ", "_", $file_name);
     $file = $mob_dir . "/" . $file_name_mod;
     ilUtil::moveUploadedFile($a_newfile["tmp_name"], $file_name_mod, $file);
     ilUtil::renameExecutables($mob_dir);
     $format = ilObjMediaObject::getMimeType($file);
     $media_item = new ilMediaItem();
     $mediaObj->addMediaItem($media_item);
     $media_item->setPurpose("Standard");
     $media_item->setFormat($format);
     $media_item->setLocation($file_name_mod);
     $media_item->setLocationType("LocalFile");
     $mediaObj->update();
     return $mediaObj->getId();
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:38,代码来源:class.ilObjRoomSharing.php

示例3: getDirectory

 /**
  * get media file directory
  */
 function getDirectory()
 {
     return ilObjMediaObject::_getDirectory($this->getMobId());
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:7,代码来源:class.ilMediaItem.php

示例4: parseHTML

 /**
  * function parses stored value in database to a html output for eg. the record list gui.
  * @param $value
  * @return mixed
  */
 public function parseHTML($value, ilDataCollectionRecordField $record_field)
 {
     switch ($this->id) {
         case self::INPUTFORMAT_DATETIME:
             $html = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATETIME));
             break;
         case self::INPUTFORMAT_FILE:
             global $ilCtrl;
             if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
                 $html = "";
                 break;
             }
             $file_obj = new ilObjFile($value, false);
             $ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "record_id", $record_field->getRecord()->getId());
             $ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "field_id", $record_field->getField()->getId());
             $html = "<a href=" . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordlistgui", "sendFile") . " >" . $file_obj->getFileName() . "</a>";
             break;
         case self::INPUTFORMAT_MOB:
             $mob = new ilObjMediaObject($value, false);
             $dir = ilObjMediaObject::_getDirectory($mob->getId());
             $media_item = $mob->getMediaItem('Standard');
             if (!$media_item->location) {
                 $html = "";
                 break;
             }
             $html = '<img src="' . $dir . "/" . $media_item->location . '" />';
             break;
         case self::INPUTFORMAT_BOOLEAN:
             switch ($value) {
                 case 0:
                     $im = ilUtil::getImagePath('icon_not_ok.png');
                     break;
                 case 1:
                     $im = ilUtil::getImagePath('icon_ok.png');
                     break;
             }
             $html = "<img src='" . $im . "'>";
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
             //Property URL
             $arr_properties = $record_field->getField()->getProperties();
             if ($arr_properties[ilDataCollectionField::PROPERTYID_URL]) {
                 $link = $value;
                 if (preg_match("/^[a-z0-9!#\$%&'*+=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\$/i", $value)) {
                     $value = "mailto:" . $value;
                 } elseif (!preg_match('~(^(news|(ht|f)tp(s?)\\://){1}\\S+)~i', $value)) {
                     return $link;
                 }
                 if (strlen($link) > self::LINK_MAX_LENGTH) {
                     $link = substr($value, 0, (self::LINK_MAX_LENGTH - 3) / 2);
                     $link .= "...";
                     $link .= substr($value, -(self::LINK_MAX_LENGTH - 3) / 2);
                 }
                 $html = "<a target='_blank' href='" . $value . "'>" . $link . "</a>";
             } else {
                 $html = $value;
             }
             // BEGIN EASTEREGG
             /*if(strtolower($value) == "nyan it plx!"){
             			$link = ilLink::_getLink($_GET['ref_id']);
             			$html = "<a href='http://nyanit.com/".$link."'>Data Collections rock!</a>";
             		}*/
             // END EASTEREGG
             break;
         default:
             $html = $value;
             break;
     }
     return $html;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:75,代码来源:class.ilDataCollectionDatatype.php

示例5: handleEvent

 /**
  * Handle the event
  *
  * @param    string        component, e.g. "Services/User"
  * @param    event         event, e.g. "afterUpdate"
  * @param    array         array of event specific parameters
  */
 public function handleEvent($a_component, $a_event, $a_parameter)
 {
     // Adds access rights for standard participants to courses
     // Only needed for Soziale Arbeit
     // create course part of code
     if ($a_component == 'Modules/Course' && $a_event == 'create') {
         $crs = $a_parameter['object'];
         //activation unlimited, not offline
         $crs->setActivationType(IL_CRS_ACTIVATION_UNLIMITED);
         $crs->setOfflineStatus(false);
         global $affected_crs;
         $affected_crs = $a_parameter['obj_id'];
     }
     // Adds access rights for standard participants to courses
     // Only needed for Soziale Arbeit
     // update course part of code
     if ($a_component == 'Modules/Course' && $a_event == 'update') {
         global $tree, $rbacreview, $rbacadmin, $affected_crs;
         $crs = $a_parameter['object'];
         $ref_id = $crs->getRefId();
         //check if new Course is in "Soziale Arbeit -> Bachelor"
         if ($affected_crs == $a_parameter['obj_id'] && in_array(4781, $obj_path = $tree->getPathId($ref_id))) {
             //Get the current access rights on the course
             $user_role = $this->_getGlobalUserRoleId();
             $local_ops = $rbacreview->getRoleOperationsOnObject($user_role, $ref_id);
             $local_ops = array_map('strval', $local_ops);
             //Get the access rights of the standard course user and remove rights that the standard user doesn't have
             $non_member_template_id = $this->__getCrsNonMemberTemplateId();
             $template_ops = $rbacreview->getOperationsOfRole($non_member_template_id, 'crs', ROLE_FOLDER_ID);
             $role_folders = array_intersect($obj_path, $rbacreview->getFoldersAssignedToRole($user_role));
             end($role_folders);
             $parent_role_folder = prev($role_folders);
             $parent_ops = $this->__getTemplatePolicies($user_role, $parent_role_folder, 'crs');
             $template_ops = $this->__intersectPolicies($template_ops, $parent_ops);
             //Get the local and the next higher policies
             $local_policies = $this->__getTemplatePolicies($user_role, $ref_id);
             $parent_policies = $this->__getTemplatePolicies($user_role, $parent_role_folder);
             $non_member_policies = $this->__getTemplatePolicies($non_member_template_id, '');
             $non_member_policies = array_values($this->__intersectPolicies($non_member_policies, $parent_policies));
             if ($local_ops == $template_ops && $local_policies == $non_member_policies) {
                 $rbacadmin->copyRoleTemplatePermissions($user_role, $parent_role_folder, $ref_id, $user_role);
                 $local_policies = $this->__getTemplatePolicies($user_role, $ref_id, 'crs');
                 $rbacadmin->grantPermission($user_role, $local_policies, $ref_id);
             }
         }
     }
     // FFMPEG Conversion of media files
     if ($a_component == 'Services/MediaObjects' && $a_event == 'update' && isset($a_parameter) && count($a_parameter) > 0 && isset($a_parameter['object'])) {
         $allMediaItems = $a_parameter['object']->getMediaItems();
         $ffmpegQueue = 'ffmpegQueue.txt';
         foreach ($allMediaItems as $media_item) {
             $filename = $media_item->location;
             include_once "./Modules/MediaCast/classes/class.ilMediaCastSettings.php";
             $settings = ilMediaCastSettings::_getInstance();
             $purposeSuffixes = $settings->getPurposeSuffixes();
             if (in_array(mb_strtolower(substr($filename, strrpos($filename, '.') + 1)), $purposeSuffixes['VideoPortable'])) {
                 global $ilUser;
                 $folder = ilObjMediaObject::_getDirectory($a_parameter['object']->getId());
                 if (substr($filename, -3) != 'mp4') {
                     $numofLines = ilHSLUObjectDefaultsPlugin::lineCount($ffmpegQueue);
                     ilUtil::sendSuccess('Ihre Datei wurde hochgeladen und wird nun in ein Streaming-kompatibles Format konvertiert. Sie werden via Mail informiert, sobald die Konvertierung abgeschlossen ist. Vor der aktuell hochgeladenen Datei hat es ' . $numofLines . ' andere in der Warteschlange. Besten Dank für Ihre Geduld.', true);
                 }
                 file_put_contents($ffmpegQueue, $folder . '/' . $filename . '|' . $folder . '/' . substr($filename, 0, strrpos($filename, '.')) . '.mp4|' . $ilUser->getEmail() . "\n", FILE_APPEND);
                 //geht nicht wegen client cache
                 //@copy('Customizing/mob_vpreview.png', $folder.'/mob_vpreview.png');
                 @chmod($folder, 0775);
                 //set new media format
                 $media_item->setFormat('video/mp4');
                 $media_item->setLocation(substr($filename, 0, strrpos($filename, '.')) . '.mp4');
                 $media_item->update();
             } else {
                 if (in_array(mb_strtolower(substr($filename, strrpos($filename, '.') + 1)), $purposeSuffixes['AudioPortable']) && substr($filename, -3) != 'mp3') {
                     global $ilUser;
                     $folder = ilObjMediaObject::_getDirectory($a_parameter['object']->getId());
                     $numofLines = ilHSLUObjectDefaultsPlugin::lineCount($ffmpegQueue);
                     ilUtil::sendSuccess('Ihre Datei wurde hochgeladen und wird nun in ein Streaming-kompatibles Format konvertiert. Sie werden via Mail informiert, sobald die Konvertierung abgeschlossen ist. Vor der aktuell hochgeladenen Datei hat es ' . $numofLines . ' andere in der Warteschlange. Besten Dank für Ihre Geduld.', true);
                     file_put_contents($ffmpegQueue, $folder . '/' . $filename . '|' . $folder . '/' . substr($filename, 0, strrpos($filename, '.')) . '.mp3|' . $ilUser->getEmail() . "\n", FILE_APPEND);
                     //geht nicht wegen client cache
                     //@copy('Customizing/mob_vpreview.png', $folder.'/mob_vpreview.png');
                     @chmod($folder, 0775);
                     //set new media format
                     $media_item->setFormat('audio/mpeg');
                     $media_item->setLocation(substr($filename, 0, strrpos($filename, '.')) . '.mp3');
                     $media_item->update();
                 }
             }
         }
     }
 }
开发者ID:HochschuleLuzern,项目名称:HSLUObjectDefaults,代码行数:96,代码来源:class.ilHSLUObjectDefaultsPlugin.php

示例6: createMediaFromUploadDir

 /**
  * Create media object from upload directory
  */
 function createMediaFromUploadDir()
 {
     $mset = new ilSetting("mobs");
     $upload_dir = trim($mset->get("upload_dir"));
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     if (is_array($_POST["file"]) && ilMainMenuGUI::_checkAdministrationPermission()) {
         foreach ($_POST["file"] as $f) {
             $f = str_replace("..", "", $f);
             $fullpath = $upload_dir . "/" . $f;
             $mob = new ilObjMediaObject();
             $mob->setTitle(basename($fullpath));
             $mob->setDescription("");
             $mob->create();
             // determine and create mob directory, move uploaded file to directory
             //$mob_dir = ilUtil::getWebspaceDir()."/mobs/mm_".$a_mob->getId();
             $mob->createDirectory();
             $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
             $media_item = new ilMediaItem();
             $mob->addMediaItem($media_item);
             $media_item->setPurpose("Standard");
             $file = $mob_dir . "/" . basename($fullpath);
             ilUtil::moveUploadedFile($fullpath, basename($fullpath), $file, false, $_POST["action"]);
             // get mime type
             $format = ilObjMediaObject::getMimeType($file);
             $location = basename($fullpath);
             // set real meta and object data
             $media_item->setFormat($format);
             $media_item->setLocation($location);
             $media_item->setLocationType("LocalFile");
             $mob->setDescription($format);
             // determine width and height of known image types
             $wh = ilObjMediaObject::_determineWidthHeight(500, 400, $format, "File", $mob_dir . "/" . $location, $media_item->getLocation(), true, true, "", "");
             $media_item->setWidth($wh["width"]);
             $media_item->setHeight($wh["height"]);
             if ($wh["info"] != "") {
                 //				ilUtil::sendInfo($wh["info"], true);
             }
             $media_item->setHAlign("Left");
             ilUtil::renameExecutables($mob_dir);
             $mob->update();
             // put it into current folder
             $mep_item = new ilMediaPoolItem();
             $mep_item->setTitle($mob->getTitle());
             $mep_item->setType("mob");
             $mep_item->setForeignId($mob->getId());
             $mep_item->create();
             $tree = $this->object->getTree();
             $parent = $_GET["mepitem_id"] == "" ? $tree->getRootId() : $_GET["mepitem_id"];
             $tree->insertNode($mep_item->getId(), $parent);
         }
     }
     ilUtil::redirect("ilias.php?baseClass=ilMediaPoolPresentationGUI&cmd=listMedia&ref_id=" . $_GET["ref_id"] . "&mepitem_id=" . $_GET["mepitem_id"]);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:56,代码来源:class.ilObjMediaPoolGUI.php

示例7: dbImportSco

 public function dbImportSco($slm, $sco, $asset = false)
 {
     $qtis = array();
     $d = ilUtil::getDir($this->packageFolder);
     foreach ($d as $f) {
         //continue;
         if ($f[type] == 'file' && substr($f[entry], 0, 4) == 'qti_') {
             include_once "./Services/QTI/classes/class.ilQTIParser.php";
             include_once "./Modules/Test/classes/class.ilObjTest.php";
             $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f[entry], IL_MO_VERIFY_QTI, 0, "");
             $result = $qtiParser->startParsing();
             $founditems =& $qtiParser->getFoundItems();
             //					die(print_r($founditems));
             foreach ($founditems as $qp) {
                 $newObj = new ilObjTest(0, true);
                 // This creates a lot of invalid repository objects for each question
                 // question are not repository objects (see e.g. table object_data), alex 29 Sep 2009
                 //					$newObj->setType ( $qp ['type'] );
                 //					$newObj->setTitle ( $qp ['title'] );
                 //					$newObj->create ( true );
                 //					$newObj->createReference ();
                 //					$newObj->putInTree ($_GET ["ref_id"]);
                 //					$newObj->setPermissions ( $sco->getId ());
                 //					$newObj->notify ("new", $_GET["ref_id"], $sco->getId (), $_GET["ref_id"], $newObj->getRefId () );
                 //					$newObj->mark_schema->flush ();
                 $qtiParser = new ilQTIParser($this->packageFolder . "/" . $f[entry], IL_MO_PARSE_QTI, 0, "");
                 $qtiParser->setTestObject($newObj);
                 $result = $qtiParser->startParsing();
                 //					$newObj->saveToDb ();
                 $qtis = array_merge($qtis, $qtiParser->getImportMapping());
             }
         }
     }
     //exit;
     include_once 'Modules/Scorm2004/classes/class.ilSCORM2004Page.php';
     $doc = new SimpleXMLElement($this->imsmanifest->saveXml());
     $l = $doc->xpath("/ContentObject/MetaData");
     if ($l[0]) {
         include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
         $mdxml =& new ilMDXMLCopier($l[0]->asXML(), $slm->getId(), $sco->getId(), $sco->getType());
         $mdxml->startParsing();
         $mdxml->getMDObject()->update();
     }
     $l = $doc->xpath("/ContentObject/PageObject");
     foreach ($l as $page_xml) {
         $tnode = $page_xml->xpath('MetaData/General/Title');
         $page = new ilSCORM2004PageNode($slm);
         $page->setTitle($tnode[0]);
         $page->setSLMId($slm->getId());
         $page->create(true);
         ilSCORM2004Node::putInTree($page, $sco->getId(), $target);
         $pmd = $page_xml->xpath("MetaData");
         if ($pmd[0]) {
             include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
             $mdxml =& new ilMDXMLCopier($pmd[0]->asXML(), $slm->getId(), $page->getId(), $page->getType());
             $mdxml->startParsing();
             $mdxml->getMDObject()->update();
         }
         $tnode = $page_xml->xpath("//MediaObject/MediaAlias | //InteractiveImage/MediaAlias");
         foreach ($tnode as $ttnode) {
             include_once './Services/MediaObjects/classes/class.ilObjMediaObject.php';
             $OriginId = $ttnode[OriginId];
             $medianodes = $doc->xpath("//MediaObject[MetaData/General/Identifier/@Entry='" . $OriginId . "']");
             $medianode = $medianodes[0];
             if ($medianode) {
                 $media_object = new ilObjMediaObject();
                 $media_object->setTitle($medianode->MetaData->General->Title);
                 $media_object->setDescription($medianode->MetaData->General->Description);
                 $media_object->create(false);
                 $mmd = $medianode->xpath("MetaData");
                 if ($mmd[0]) {
                     include_once 'Services/MetaData/classes/class.ilMDXMLCopier.php';
                     $mdxml =& new ilMDXMLCopier($mmd[0]->asXML(), 0, $media_object->getId(), $media_object->getType());
                     $mdxml->startParsing();
                     $mdxml->getMDObject()->update();
                 }
                 // determine and create mob directory, move uploaded file to directory
                 $media_object->createDirectory();
                 $mob_dir = ilObjMediaObject::_getDirectory($media_object->getId());
                 foreach ($medianode->MediaItem as $xMediaItem) {
                     $media_item =& new ilMediaItem();
                     $media_object->addMediaItem($media_item);
                     $media_item->setPurpose($xMediaItem[Purpose]);
                     $media_item->setFormat($xMediaItem->Format);
                     $media_item->setLocation($xMediaItem->Location);
                     $media_item->setLocationType($xMediaItem->Location[Type]);
                     $media_item->setWidth($xMediaItem->Layout[Width]);
                     $media_item->setHeight($xMediaItem->Layout[Height]);
                     $media_item->setHAlign($xMediaItem->Layout[HorizontalAlign]);
                     $media_item->setCaption($xMediaItem->Caption);
                     $media_item->setTextRepresentation($xMediaItem->TextRepresentation);
                     $nr = 0;
                     // add map areas (external links only)
                     foreach ($xMediaItem->MapArea as $n => $v) {
                         if ($v->ExtLink[Href] != "") {
                             include_once "./Services/MediaObjects/classes/class.ilMapArea.php";
                             $ma = new ilMapArea();
                             $map_area = new ilMapArea();
                             $map_area->setShape($v[Shape]);
                             $map_area->setCoords($v[Coords]);
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:ilSCORM13Package.php

示例8: getFirstMediaObjectAsTag

 protected function getFirstMediaObjectAsTag($a_width = 144, $a_height = 144, $a_export_directory = null)
 {
     $this->obj->buildDom();
     $mob_ids = $this->obj->collectMediaObjects();
     if ($mob_ids) {
         require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         foreach ($mob_ids as $mob_id) {
             $mob_obj = new ilObjMediaObject($mob_id);
             $mob_item = $mob_obj->getMediaItem("Standard");
             if (stristr($mob_item->getFormat(), "image")) {
                 $mob_size = $mob_item->getOriginalSize();
                 if ($mob_size["width"] >= $a_width || $mob_size["height"] >= $a_height) {
                     if (!$a_export_directory) {
                         $mob_dir = ilObjMediaObject::_getDirectory($mob_obj->getId());
                     } else {
                         // see ilCOPageHTMLExport::exportHTMLMOB()
                         $mob_dir = "./mobs/mm_" . $mob_obj->getId();
                     }
                     $mob_res = self::parseImage($mob_size["width"], $mob_size["height"], $a_width, $a_height);
                     return '<img' . ' src="' . $mob_dir . "/" . $mob_item->getLocation() . '"' . ' width="' . $mob_res[0] . '"' . ' height="' . $mob_res[1] . '"' . ' class="ilBlogListItemSnippetPreviewImage ilFloatLeft noMirror"' . ' />';
                 }
             }
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:25,代码来源:class.ilBlogPostingGUI.php

示例9: importRecord

 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     //echo $a_entity;
     //var_dump($a_rec);
     switch ($a_entity) {
         case "mob":
             //var_dump($a_rec);
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $newObj = new ilObjMediaObject();
             $newObj->setType("mob");
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->create();
             $newObj->createDirectory();
             ilObjMediaObject::_createThumbnailDirectory($newObj->getId());
             $this->current_mob = $newObj;
             $dir = str_replace("..", "", $a_rec["Dir"]);
             if ($dir != "" && $this->getImportDirectory() != "") {
                 $source_dir = $this->getImportDirectory() . "/" . $dir;
                 $target_dir = $dir = ilObjMediaObject::_getDirectory($newObj->getId());
                 ilUtil::rCopy($source_dir, $target_dir);
             }
             $a_mapping->addMapping("Services/MediaObjects", "mob", $a_rec["Id"], $newObj->getId());
             //echo "<br>++add++"."0:".$a_rec["Id"].":mob+0:".$newObj->getId().":mob"."+";
             $a_mapping->addMapping("Services/MetaData", "md", "0:" . $a_rec["Id"] . ":mob", "0:" . $newObj->getId() . ":mob");
             break;
         case "mob_media_item":
             // determine parent mob
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             $mob_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob", $a_rec["MobId"]);
             if (is_object($this->current_mob) && $this->current_mob->getId() == $mob_id) {
                 $mob = $this->current_mob;
             } else {
                 $mob = new ilObjMediaObject($mob_id);
             }
             include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
             $newObj = new ilMediaItem();
             $newObj->setMobId($mob_id);
             $newObj->setWidth($a_rec["Width"]);
             $newObj->setHeight($a_rec["Height"]);
             $newObj->setCaption($a_rec["Caption"]);
             $newObj->setNr($a_rec["Nr"]);
             $newObj->setPurpose($a_rec["Purpose"]);
             $newObj->setLocation($a_rec["Location"]);
             $newObj->setLocationType($a_rec["LocationType"]);
             $newObj->setFormat($a_rec["Format"]);
             $newObj->setTextRepresentation($a_rec["TextRepresentation"]);
             $newObj->create();
             $this->current_media_item = $newObj;
             $a_mapping->addMapping("Services/MediaObjects", "mob_media_item", $a_rec["Id"], $newObj->getId());
             break;
         case "mob_mi_parameter":
             // get media item
             include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
             $med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
             if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) {
                 $med = $this->current_media_item;
             } else {
                 $med = new ilMediaItem($med_id);
             }
             $med->writeParameter($a_rec["Name"], $a_rec["Value"]);
             break;
         case "mob_mi_map_area":
             // get media item
             include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
             $med_id = (int) $a_mapping->getMapping("Services/MediaObjects", "mob_media_item", $a_rec["MiId"]);
             if (is_object($this->current_media_item) && $this->current_media_item->getId() == $med_id) {
                 $med = $this->current_media_item;
             } else {
                 $med = new ilMediaItem($med_id);
             }
             include_once "./Services/MediaObjects/classes/class.ilMapArea.php";
             $map_area = new ilMapArea();
             $map_area->setItemId($med_id);
             $map_area->setNr($a_rec["Nr"]);
             $map_area->setShape($a_rec["Shape"]);
             $map_area->setCoords($a_rec["Coords"]);
             $map_area->setLinkType($a_rec["LinkType"]);
             $map_area->setTitle($a_rec["Title"]);
             $map_area->setHref($a_rec["Href"]);
             $map_area->setTarget($a_rec["Target"]);
             $map_area->setType($a_rec["Type"]);
             $map_area->setTargetFrame($a_rec["TargetFrame"]);
             $map_area->setHighlightMode($a_rec["HighlightMode"]);
             $map_area->setHighlightClass($a_rec["HighlightClass"]);
             $map_area->create();
             break;
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:95,代码来源:class.ilMediaObjectDataSet.php

示例10: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // context
     $obj_id = ilObject::_lookupObjId($a_set["ref_id"]);
     $obj_type = ilObject::_lookupType($obj_id);
     $obj_title = ilObject::_lookupTitle($obj_id);
     // user
     if ($a_set["user_id"] > 0) {
         $this->tpl->setCurrentBlock("user_info");
         if ($obj_type == "frm") {
             include_once "./Modules/Forum/classes/class.ilForumProperties.php";
             if (ilForumProperties::_isAnonymized($a_set["context_obj_id"])) {
                 if ($a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
                     include_once "./Modules/Forum/classes/class.ilForumPost.php";
                     $post = new ilForumPost($a_set["context_sub_obj_id"]);
                     if ($post->getUserAlias() != "") {
                         $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias()));
                     } else {
                         $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                     }
                 } else {
                     $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                 }
             } else {
                 if (ilObject::_exists($a_set["user_id"])) {
                     $user_obj = new ilObjUser($a_set["user_id"]);
                     $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
                 }
             }
         } else {
             if (ilObject::_exists($a_set["user_id"])) {
                 $user_obj = new ilObjUser($a_set["user_id"]);
                 $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
             }
         }
         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
         $this->tpl->parseCurrentBlock();
     }
     // media player
     if ($a_set["content_type"] == NEWS_AUDIO && $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
         $mob = new ilObjMediaObject($a_set["mob_id"]);
         $med = $mob->getMediaItem("Standard");
         $mpl = new ilMediaPlayerGUI();
         $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"]) . "/" . $med->getLocation());
         $this->tpl->setCurrentBlock("player");
         $this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
         $this->tpl->parseCurrentBlock();
     }
     // access
     if ($enable_internal_rss) {
         $this->tpl->setCurrentBlock("access");
         include_once "./Services/Block/classes/class.ilBlockSetting.php";
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     // content
     if ($a_set["content"] != "") {
         $this->tpl->setCurrentBlock("content");
         $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["content_long"] != "") {
         $this->tpl->setCurrentBlock("long");
         $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["update_date"] != $a_set["creation_date"]) {
         $this->tpl->setCurrentBlock("ni_update");
         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
         $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     // forum hack, not nice
     $add = "";
     if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
         include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
         $pos = $a_set["context_sub_obj_id"];
         $thread = ilObjForumAccess::_getThreadForPosting($pos);
         if ($thread > 0) {
             $add = "_" . $thread . "_" . $pos;
         }
     }
     $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $a_set["ref_id"] . $add;
     $this->tpl->setCurrentBlock("context");
     $cont_loc = new ilLocatorGUI();
     $cont_loc->addContextItems($a_set["ref_id"], true);
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilPDNewsTableGUI.php

示例11: _getMediaInfoHTML

 /**
  * get media info as html
  */
 function _getMediaInfoHTML(&$a_mob)
 {
     global $lng;
     $tpl =& new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
     $types = array("Standard", "Fullscreen");
     foreach ($types as $type) {
         if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
             continue;
         }
         $med = $a_mob->getMediaItem($type);
         if (!$med) {
             return "";
         }
         $tpl->setCurrentBlock("media_info");
         if ($type == "Standard") {
             $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
         } else {
             $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
         }
         $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
         $tpl->setVariable("VAL_LOCATION", $med->getLocation());
         if ($med->getLocationType() == "LocalFile") {
             $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
             if (is_file($file)) {
                 $size = filesize($file);
             } else {
                 $size = 0;
             }
             $tpl->setVariable("VAL_FILE_SIZE", " ({$size} " . $lng->txt("bytes") . ")");
         }
         $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
         $tpl->setVariable("VAL_FORMAT", $med->getFormat());
         if ($med->getWidth() != "" && $med->getHeight() != "") {
             $tpl->setCurrentBlock("size");
             $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
             $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
             $tpl->parseCurrentBlock();
         }
         // original size
         if ($orig_size = $med->getOriginalSize()) {
             if ($orig_size["width"] != $med->getWidth() || $orig_size["height"] != $med->getHeight()) {
                 $tpl->setCurrentBlock("orig_size");
                 $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
                 $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
                 $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
                 $tpl->parseCurrentBlock();
             }
         }
         // output caption
         if ($med && strlen($med->getCaption())) {
             $tpl->setCurrentBlock('additional_info');
             $tpl->setVariable('ADD_INFO', $lng->txt('cont_caption') . ': ' . $med->getCaption());
             $tpl->parseCurrentBlock();
         }
         // output keywords
         if ($type == "Standard") {
             include_once './Services/MetaData/classes/class.ilMDKeyword.php';
             if (count($kws = ilMDKeyword::lookupKeywords(0, $med->getMobId()))) {
                 $tpl->setCurrentBlock('additional_info');
                 $tpl->setVariable('ADD_INFO', $lng->txt('keywords') . ': ' . implode(', ', $kws));
                 $tpl->parseCurrentBlock();
             }
         }
         $tpl->setCurrentBlock("media_info");
         $tpl->parseCurrentBlock();
     }
     return $tpl->get();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:71,代码来源:class.ilObjMediaObjectGUI.php

示例12: _getMediaInfoHTML

 /**
  * get media info as html
  */
 function _getMediaInfoHTML(&$a_mob)
 {
     global $lng;
     $tpl =& new ilTemplate("tpl.media_info.html", true, true, "Services/MediaObjects");
     $types = array("Standard", "Fullscreen");
     foreach ($types as $type) {
         if ($type == "Fullscreen" && !$a_mob->hasFullScreenItem()) {
             continue;
         }
         $med =& $a_mob->getMediaItem($type);
         $tpl->setCurrentBlock("media_info");
         if ($type == "Standard") {
             $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_std_view"));
         } else {
             $tpl->setVariable("TXT_PURPOSE", $lng->txt("cont_fullscreen"));
         }
         $tpl->setVariable("TXT_TYPE", $lng->txt("cont_" . strtolower($med->getLocationType())));
         $tpl->setVariable("VAL_LOCATION", $med->getLocation());
         if ($med->getLocationType() == "LocalFile") {
             $file = ilObjMediaObject::_getDirectory($med->getMobId()) . "/" . $med->getLocation();
             if (is_file($file)) {
                 $size = filesize($file);
             } else {
                 $size = 0;
             }
             $tpl->setVariable("VAL_FILE_SIZE", " ({$size} " . $lng->txt("bytes") . ")");
         }
         $tpl->setVariable("TXT_FORMAT", $lng->txt("cont_format"));
         $tpl->setVariable("VAL_FORMAT", $med->getFormat());
         if ($med->getWidth() != "" && $med->getHeight() != "") {
             $tpl->setCurrentBlock("size");
             $tpl->setVariable("TXT_SIZE", $lng->txt("size"));
             $tpl->setVariable("VAL_SIZE", $med->getWidth() . "x" . $med->getHeight());
             $tpl->parseCurrentBlock();
         }
         // original size
         if ($orig_size = $med->getOriginalSize()) {
             if ($orig_size["width"] != $med->getWidth() || $orig_size["height"] != $med->getHeight()) {
                 $tpl->setCurrentBlock("orig_size");
                 $tpl->setVariable("TXT_ORIG_SIZE", $lng->txt("cont_orig_size"));
                 $tpl->setVariable("ORIG_WIDTH", $orig_size["width"]);
                 $tpl->setVariable("ORIG_HEIGHT", $orig_size["height"]);
                 $tpl->parseCurrentBlock();
             }
         }
         $tpl->setCurrentBlock("media_info");
         $tpl->parseCurrentBlock();
     }
     return $tpl->get();
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:53,代码来源:class.ilObjMediaObjectGUI.php

示例13: parseHTML

 /**
  * function parses stored value in database to a html output for eg. the record list gui.
  *
  * @param                             $value
  * @param ilDataCollectionRecordField $record_field
  *
  * @return mixed
  */
 public function parseHTML($value, ilDataCollectionRecordField $record_field, $link = true)
 {
     global $ilAccess, $ilCtrl, $lng;
     switch ($this->id) {
         case self::INPUTFORMAT_DATETIME:
             $html = ilDatePresentation::formatDate(new ilDate($value, IL_CAL_DATETIME));
             break;
         case self::INPUTFORMAT_FILE:
             if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") {
                 $html = "";
                 break;
             }
             $file_obj = new ilObjFile($value, false);
             $ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "record_id", $record_field->getRecord()->getId());
             $ilCtrl->setParameterByClass("ildatacollectionrecordlistgui", "field_id", $record_field->getField()->getId());
             $html = '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordlistgui", "sendFile") . '">' . $file_obj->getFileName() . '</a>';
             if (ilPreview::hasPreview($file_obj->getId())) {
                 ilPreview::createPreview($file_obj);
                 // Create preview if not already existing
                 $preview = new ilPreviewGUI((int) $_GET['ref_id'], ilPreviewGUI::CONTEXT_REPOSITORY, $file_obj->getId(), $ilAccess);
                 $preview_status = ilPreview::lookupRenderStatus($file_obj->getId());
                 $preview_status_class = "";
                 $preview_text_topic = "preview_show";
                 if ($preview_status == ilPreview::RENDER_STATUS_NONE) {
                     $preview_status_class = "ilPreviewStatusNone";
                     $preview_text_topic = "preview_none";
                 }
                 $wrapper_html_id = 'record_field_' . $record_field->getId();
                 $script_preview_click = $preview->getJSCall($wrapper_html_id);
                 $preview_title = $lng->txt($preview_text_topic);
                 $preview_icon = ilUtil::getImagePath("preview.png", "Services/Preview");
                 $html = '<div id="' . $wrapper_html_id . '">' . $html;
                 $html .= '<span class="il_ContainerItemPreview ' . $preview_status_class . '"><a href="javascript:void(0);" onclick="' . $script_preview_click . '" title="' . $preview_title . '"><img src="' . $preview_icon . '" height="16" width="16"></a></span></div>';
             }
             break;
         case self::INPUTFORMAT_MOB:
             $mob = new ilObjMediaObject($value, false);
             $med = $mob->getMediaItem('Standard');
             if (!$med->location) {
                 $html = "";
                 break;
             }
             $arr_properties = $record_field->getField()->getProperties();
             $is_linked_field = $arr_properties[ilDataCollectionField::PROPERTYID_LINK_DETAIL_PAGE_MOB];
             $has_view = ilDataCollectionRecordViewViewdefinition::getIdByTableId($record_field->getRecord()->getTableId());
             if (in_array($med->getSuffix(), array('jpg', 'jpeg', 'png', 'gif'))) {
                 // Image
                 $dir = ilObjMediaObject::_getDirectory($mob->getId());
                 $width = (int) $arr_properties[ilDataCollectionField::PROPERTYID_WIDTH];
                 $height = (int) $arr_properties[ilDataCollectionField::PROPERTYID_HEIGHT];
                 $html = ilUtil::img($dir . "/" . $med->location, '', $width, $height);
                 if ($is_linked_field and $has_view and $link) {
                     $ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $record_field->getRecord()->getId());
                     $html = '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord') . '">' . $html . '</a>';
                 }
             } else {
                 // Video/Audio
                 $mpl = new ilMediaPlayerGUI($med->getId(), '');
                 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
                 $mpl->setMimeType($med->getFormat());
                 $mpl->setDisplayWidth((int) $arr_properties[ilDataCollectionField::PROPERTYID_WIDTH] . 'px');
                 $mpl->setDisplayHeight((int) $arr_properties[ilDataCollectionField::PROPERTYID_HEIGHT] . 'px');
                 $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
                 $html = $mpl->getPreviewHtml();
                 if ($is_linked_field and $has_view) {
                     global $lng;
                     $ilCtrl->setParameterByClass('ildatacollectionrecordviewgui', 'record_id', $record_field->getRecord()->getId());
                     $html = $html . '<a href="' . $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord') . '">' . $lng->txt('details') . '</a>';
                 }
             }
             break;
         case self::INPUTFORMAT_BOOLEAN:
             switch ($value) {
                 case 0:
                     $im = ilUtil::getImagePath('icon_not_ok.svg');
                     break;
                 case 1:
                     $im = ilUtil::getImagePath('icon_ok.svg');
                     break;
             }
             $html = "<img src='" . $im . "'>";
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
             //Property URL
             $arr_properties = $record_field->getField()->getProperties();
             if ($arr_properties[ilDataCollectionField::PROPERTYID_URL]) {
                 $link = $value;
                 if (preg_match("/^[a-z0-9!#\$%&'*+=?^_`{|}~-]+(?:\\.[a-z0-9!#\$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\$/i", $value)) {
                     $value = "mailto:" . $value;
                 } elseif (!preg_match('~(^(news|(ht|f)tp(s?)\\://){1}\\S+)~i', $value)) {
                     return $link;
                 }
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilDataCollectionDatatype.php

示例14: extractPreviewImageObject

 /**
  * Extract preview image
  *
  * @param
  * @return
  */
 function extractPreviewImageObject()
 {
     global $ilCtrl;
     $this->checkPermission("write");
     $this->mcst_item = new ilNewsItem($_GET["item_id"]);
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     $mob = new ilObjMediaObject($this->mcst_item->getMobId());
     try {
         $sec = (int) $_POST["sec"];
         if ($sec < 0) {
             $sec = 0;
         }
         if ($mob->getVideoPreviewPic() != "") {
             $mob->removeAdditionalFile($mob->getVideoPreviewPic(true));
         }
         include_once "./Services/MediaObjects/classes/class.ilFFmpeg.php";
         $med = $mob->getMediaItem("Standard");
         $mob_file = ilObjMediaObject::_getDirectory($mob->getId()) . "/" . $med->getLocation();
         $new_file = ilFFmpeg::extractImage($mob_file, "mob_vpreview.png", ilObjMediaObject::_getDirectory($mob->getId()), $sec);
         if ($new_file != "") {
             ilUtil::sendInfo($this->lng->txt("mcst_image_extracted"), true);
         } else {
             ilUtil::sendFailure($this->lng->txt("mcst_no_extraction_possible"), true);
         }
     } catch (ilException $e) {
         if (DEVMODE == 1) {
             $ret = ilFFmpeg::getLastReturnValues();
             $add = is_array($ret) && count($ret) > 0 ? "<br />" . implode($ret, "<br />") : "";
         }
         ilUtil::sendFailure($e->getMessage() . $add, true);
     }
     $ilCtrl->redirect($this, "editCastItem");
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:39,代码来源:class.ilObjMediaCastGUI.php

示例15: configureFile

 /**
  * Configures the file for the updateFloorPlanInfosWithFile and addFloorPlan function.
  *
  * @param ilObjMediaObject $a_mediaObj
  * @param array            $a_newfile
  *
  * @return array with format and filename
  */
 private function configureFile($a_mediaObj, $a_newfile = NULL)
 {
     if ($this->mobjMock) {
         return $a_newfile;
     }
     $mob_dir = ilObjMediaObject::_getDirectory($a_mediaObj->getId());
     if (!is_dir($mob_dir)) {
         $a_mediaObj->createDirectory();
     }
     $file_name = ilUtil::getASCIIFilename($a_newfile["name"]);
     $file_name_mod = str_replace(" ", "_", $file_name);
     $file = $mob_dir . "/" . $file_name_mod;
     // construct file path
     ilUtil::moveUploadedFile($a_newfile["tmp_name"], $file_name_mod, $file);
     ilUtil::renameExecutables($mob_dir);
     $format = ilObjMediaObject::getMimeType($file);
     return array("format" => $format, "filename" => $file_name_mod);
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:26,代码来源:class.ilRoomSharingFloorPlans.php


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