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


PHP ilObjMediaObject::getMediaItem方法代码示例

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


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

示例1: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     if ($a_set["type"] == "mob") {
         // output thumbnail
         $mob = new ilObjMediaObject($a_set["id"]);
         $med = $mob->getMediaItem("Standard");
         $target = $med->getThumbnailTarget();
         if ($target != "") {
             $this->tpl->setCurrentBlock("thumbnail");
             $this->tpl->setVariable("IMG_THUMB", $target);
             $this->tpl->parseCurrentBlock();
         }
     } else {
         if ($a_set["type"] == "incl") {
             $this->tpl->setCurrentBlock("thumbnail");
             $this->tpl->setVariable("IMG_THUMB", ilUtil::getImagePath("icon_pg.svg"));
             $this->tpl->parseCurrentBlock();
         }
     }
     // allow editing of media objects
     if ($this->parent_obj->mode != "getObject" && $a_set["type"] == "mob") {
         // output edit link
         $this->tpl->setCurrentBlock("edit");
         $ilCtrl->setParameter($this->parent_obj, "clip_item_id", $a_set["id"]);
         $ilCtrl->setParameterByClass("ilObjMediaObjectGUI", "clip_item_id", $a_set["id"]);
         $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilObjMediaObjectGUI", "edit", array("ilEditClipboardGUI")));
         $this->tpl->setVariable("TEXT_OBJECT", $a_set["title"] . " [" . $a_set["id"] . "]");
         $this->tpl->parseCurrentBlock();
     } else {
         $this->tpl->setCurrentBlock("show");
         $this->tpl->setVariable("TEXT_OBJECT2", $a_set["title"] . " [" . $a_set["id"] . "]");
         $this->tpl->parseCurrentBlock();
     }
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
     if ($a_set["type"] == "mob") {
         $this->tpl->setVariable("MEDIA_INFO", ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
     }
     $this->tpl->setVariable("CHECKBOX_ID", $a_set["type"] . ":" . $a_set["id"]);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.ilClipboardTableGUI.php

示例2: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $this->tpl->setCurrentBlock("link");
     switch ($a_set["type"]) {
         case "fold":
             $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
             $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set["obj_id"]);
             $this->tpl->setVariable("LINK_VIEW", $ilCtrl->getLinkTarget($this->parent_obj, $this->parent_cmd));
             $this->tpl->parseCurrentBlock();
             if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) {
                 $this->tpl->setCurrentBlock("edit");
                 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
                 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $a_set["obj_id"]);
                 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTarget($this->parent_obj, "editFolder"));
                 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $_GET[$this->folder_par]);
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".svg")));
             $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
             break;
         case "pg":
             if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_SINGLE) {
                 $this->tpl->setVariable("TXT_NO_LINK_TITLE", $a_set["title"]);
             } else {
                 $this->tpl->setVariable("ONCLICK", "il.MediaPool.preview('" . $a_set["child"] . "'); return false;");
                 $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
                 $ilCtrl->setParameterByClass("ilobjmediapoolgui", "mepitem_id", $a_set["child"]);
             }
             if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) {
                 $this->tpl->setCurrentBlock("edit");
                 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
                 $ilCtrl->setParameterByClass("ilmediapoolpagegui", "mepitem_id", $a_set["child"]);
                 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilmediapoolpagegui", "edit"));
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_pg.svg")));
             $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
             break;
         case "mob":
             $this->tpl->setVariable("ONCLICK", "il.MediaPool.preview('" . $a_set["child"] . "'); return false;");
             $this->tpl->setVariable("TXT_TITLE", $a_set["title"]);
             $ilCtrl->setParameterByClass("ilobjmediaobjectgui", "mepitem_id", $a_set["child"]);
             $ilCtrl->setParameter($this->parent_obj, "mob_id", $a_set["foreign_id"]);
             // edit link
             if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId()) && $this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT) {
                 $this->tpl->setCurrentBlock("edit");
                 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
                 $this->tpl->setVariable("EDIT_LINK", $ilCtrl->getLinkTargetByClass("ilobjmediaobjectgui", "edit"));
                 $this->tpl->parseCurrentBlock();
             }
             $this->tpl->setCurrentBlock("link");
             $this->tpl->setCurrentBlock("tbl_content");
             // output thumbnail (or mob icon)
             if (ilObject::_lookupType($a_set["foreign_id"]) == "mob") {
                 $mob = new ilObjMediaObject($a_set["foreign_id"]);
                 $med = $mob->getMediaItem("Standard");
                 $target = "";
                 if ($med) {
                     $target = $med->getThumbnailTarget();
                 }
                 if ($target != "") {
                     $this->tpl->setVariable("IMG", ilUtil::img($target));
                 } else {
                     $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_set["type"] . ".svg")));
                 }
                 if ($med && ilUtil::deducibleSize($med->getFormat()) && $med->getLocationType() == "Reference") {
                     $size = @getimagesize($med->getLocation());
                     if ($size[0] > 0 && $size[1] > 0) {
                         $wr = $size[0] / 80;
                         $hr = $size[1] / 80;
                         $r = max($wr, hr);
                         $w = (int) ($size[0] / $r);
                         $h = (int) ($size[1] / $r);
                         $this->tpl->setVariable("IMG", ilUtil::img($med->getLocation(), "", $w, $h));
                     }
                 }
                 // output media info
                 include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
                 $this->tpl->setVariable("MEDIA_INFO", ilObjMediaObjectGUI::_getMediaInfoHTML($mob));
                 $ilCtrl->setParameter($this->parent_obj, $this->folder_par, $this->current_folder);
             }
             break;
     }
     if ($ilAccess->checkAccess("write", "", $this->media_pool->getRefId())) {
         if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_EDIT || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT && $a_set["type"] == "mob" || $this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_CONTENT && $a_set["type"] == "pg") {
             $this->tpl->setCurrentBlock("chbox");
             $this->tpl->setVariable("CHECKBOX_ID", $a_set["child"]);
             $this->tpl->parseCurrentBlock();
             $this->tpl->setCurrentBlock("tbl_content");
         } else {
             if ($this->getMode() == ilMediaPoolTableGUI::IL_MEP_SELECT_SINGLE && $a_set["type"] == "mob") {
                 $this->tpl->setCurrentBlock("radio");
                 $this->tpl->setVariable("RADIO_ID", $a_set["child"]);
//.........这里部分代码省略.........
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilMediaPoolTableGUI.php

示例3: 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

示例4: deliverMobFile

 /**
  * Deliver mob file
  *
  * @param
  * @return
  */
 function deliverMobFile($a_purpose = "Standard", $a_increase_download_cnt = false)
 {
     $mob = $this->getMobId();
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mob = new ilObjMediaObject($mob);
     $mob_dir = ilObjMediaObject::_getDirectory($mob->getId());
     // check purpose
     if (!$mob->hasPurposeItem($a_purpose)) {
         return false;
     }
     $m_item = $mob->getMediaItem($a_purpose);
     if ($m_item->getLocationType() != "Reference") {
         $file = $mob_dir . "/" . $m_item->getLocation();
         if (file_exists($file) && is_file($file)) {
             if ($a_increase_download_cnt) {
                 $this->increaseDownloadCounter();
             }
             ilUtil::deliverFile($file, $m_item->getLocation());
         } else {
             ilUtil::sendFailure("File not found!", true);
             return false;
         }
     } else {
         if ($a_increase_download_cnt) {
             $this->increaseDownloadCounter();
         }
         ilUtil::redirect($m_item->getLocation());
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:35,代码来源:class.ilNewsItem.php

示例5: 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

示例6: showPrintView


//.........这里部分代码省略.........
                 $page_gui = new ilGlossaryDefPageGUI($def["id"]);
                 $page_gui->setTemplateOutput(false);
                 $page_gui->setOutputMode("print");
                 $this->tpl->setCurrentBlock("definition");
                 $page_gui->setFileDownloadLink("#");
                 $page_gui->setFullscreenLink("#");
                 $page_gui->setSourceCodeDownloadScript("#");
                 $output = $page_gui->showPage();
                 $this->tpl->setVariable("VAL_DEFINITION", $output);
                 $this->tpl->parseCurrentBlock();
             }
             // output term
             $this->tpl->setCurrentBlock("term");
             $this->tpl->setVariable("VAL_TERM", $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]));
             $this->tpl->parseCurrentBlock();
         }
         // output glossary header
         $annex_cnt++;
         $this->tpl->setCurrentBlock("glossary");
         $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("glo");
         $this->tpl->setVariable("TXT_GLOSSARY", $annex_title);
         $this->tpl->parseCurrentBlock();
         $annexes[] = $annex_title;
     }
     // referenced images
     if (count($media_links) > 0) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
         foreach ($media_links as $media) {
             if (substr($media["Target"], 0, 4) == "il__") {
                 $arr = explode("_", $media["Target"]);
                 $id = $arr[count($arr) - 1];
                 $med_obj = new ilObjMediaObject($id);
                 $med_item = $med_obj->getMediaItem("Standard");
                 if (is_object($med_item)) {
                     if (is_int(strpos($med_item->getFormat(), "image"))) {
                         $this->tpl->setCurrentBlock("ref_image");
                         // image source
                         if ($med_item->getLocationType() == "LocalFile") {
                             $this->tpl->setVariable("IMG_SOURCE", ilUtil::getWebspaceDir("output") . "/mobs/mm_" . $id . "/" . $med_item->getLocation());
                         } else {
                             $this->tpl->setVariable("IMG_SOURCE", $med_item->getLocation());
                         }
                         if ($med_item->getCaption() != "") {
                             $this->tpl->setVariable("IMG_TITLE", $med_item->getCaption());
                         } else {
                             $this->tpl->setVariable("IMG_TITLE", $med_obj->getTitle());
                         }
                         $this->tpl->parseCurrentBlock();
                     }
                 }
             }
         }
         // output glossary header
         $annex_cnt++;
         $this->tpl->setCurrentBlock("ref_images");
         $annex_title = $this->lng->txt("cont_annex") . " " . chr(64 + $annex_cnt) . ": " . $this->lng->txt("cont_ref_images");
         $this->tpl->setVariable("TXT_REF_IMAGES", $annex_title);
         $this->tpl->parseCurrentBlock();
         $annexes[] = $annex_title;
     }
     // output learning module title and toc
     if ($output_header) {
         $this->tpl->setCurrentBlock("print_header");
         $this->tpl->setVariable("LM_TITLE", $this->lm->getTitle());
         if ($this->lm->getDescription() != "none") {
开发者ID:bheyser,项目名称:qplskl,代码行数:67,代码来源:class.ilLMPresentationGUI.php

示例7: fillRowTitleAndDescription

 /**
  * Populates the title and description in the row
  *
  * @param ilObjMediaObject $a_mediaObject the media object
  * @param string           $a_title       the title
  */
 private function fillRowTitleAndDescription($a_mediaObject, $a_title)
 {
     $this->tpl->setVariable('TXT_TITLE', $a_title);
     $this->tpl->setVariable('TXT_DESCRIPTION', $a_mediaObject->getMediaItem("Standard")->getCaption());
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:11,代码来源:class.ilRoomSharingFloorPlansTableGUI.php

示例8: moveIntLinks

 function moveIntLinks($a_from_to)
 {
     $this->buildDom();
     $changed = false;
     // resolve normal internal links
     $xpc = xpath_new_context($this->dom);
     $path = "//IntLink";
     $res =& xpath_eval($xpc, $path);
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $target = $res->nodeset[$i]->get_attribute("Target");
         $type = $res->nodeset[$i]->get_attribute("Type");
         $obj_id = ilInternalLink::_extractObjIdOfTarget($target);
         if ($a_from_to[$obj_id] > 0 && is_int(strpos($target, "__"))) {
             if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") {
                 $res->nodeset[$i]->set_attribute("Target", "il__pg_" . $a_from_to[$obj_id]);
                 $changed = true;
             }
             if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") {
                 $res->nodeset[$i]->set_attribute("Target", "il__st_" . $a_from_to[$obj_id]);
                 $changed = true;
             }
         }
     }
     unset($xpc);
     // map areas
     $this->addHierIDs();
     $xpc = xpath_new_context($this->dom);
     $path = "//MediaAlias";
     $res =& xpath_eval($xpc, $path);
     require_once "Services/MediaObjects/classes/class.ilMediaItem.php";
     require_once "Services/COPage/classes/class.ilMediaAliasItem.php";
     for ($i = 0; $i < count($res->nodeset); $i++) {
         $media_object_node = $res->nodeset[$i]->parent_node();
         $page_content_node = $media_object_node->parent_node();
         $c_hier_id = $page_content_node->get_attribute("HierId");
         // first check, wheter we got instance map areas -> take these
         $std_alias_item = new ilMediaAliasItem($this->dom, $c_hier_id, "Standard");
         $areas = $std_alias_item->getMapAreas();
         $correction_needed = false;
         if (count($areas) > 0) {
             // check if correction needed
             foreach ($areas as $area) {
                 if ($area["Type"] == "PageObject" || $area["Type"] == "StructureObject") {
                     $t = $area["Target"];
                     $tid = _extractObjIdOfTarget($t);
                     if ($a_from_to[$tid] > 0) {
                         $correction_needed = true;
                     }
                 }
             }
         } else {
             $areas = array();
             // get object map areas and check whether at least one must
             // be corrected
             $oid = $res->nodeset[$i]->get_attribute("OriginId");
             if (substr($oid, 0, 4) == "il__") {
                 $id_arr = explode("_", $oid);
                 $id = $id_arr[count($id_arr) - 1];
                 $mob = new ilObjMediaObject($id);
                 $med_item = $mob->getMediaItem("Standard");
                 $med_areas = $med_item->getMapAreas();
                 foreach ($med_areas as $area) {
                     $link_type = $area->getLinkType() == "int" ? "IntLink" : "ExtLink";
                     $areas[] = array("Nr" => $area->getNr(), "Shape" => $area->getShape(), "Coords" => $area->getCoords(), "Link" => array("LinkType" => $link_type, "Href" => $area->getHref(), "Title" => $area->getTitle(), "Target" => $area->getTarget(), "Type" => $area->getType(), "TargetFrame" => $area->getTargetFrame()));
                     if ($area->getType() == "PageObject" || $area->getType() == "StructureObject") {
                         $t = $area->getTarget();
                         $tid = ilInternalLink::_extractObjIdOfTarget($t);
                         if ($a_from_to[$tid] > 0) {
                             $correction_needed = true;
                         }
                         //var_dump($a_from_to);
                     }
                 }
             }
         }
         // correct map area links
         if ($correction_needed) {
             $changed = true;
             $std_alias_item->deleteAllMapAreas();
             foreach ($areas as $area) {
                 if ($area["Link"]["LinkType"] == "IntLink") {
                     $target = $area["Link"]["Target"];
                     $type = $area["Link"]["Type"];
                     $obj_id = ilInternalLink::_extractObjIdOfTarget($target);
                     if ($a_from_to[$obj_id] > 0) {
                         if ($type == "PageObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "pg") {
                             $area["Link"]["Target"] = "il__pg_" . $a_from_to[$obj_id];
                         }
                         if ($type == "StructureObject" && ilLMObject::_lookupType($a_from_to[$obj_id]) == "st") {
                             $area["Link"]["Target"] = "il__st_" . $a_from_to[$obj_id];
                         }
                     }
                 }
                 $std_alias_item->addMapArea($area["Shape"], $area["Coords"], $area["Link"]["Title"], array("Type" => $area["Link"]["Type"], "TargetFrame" => $area["Link"]["TargetFrame"], "Target" => $area["Link"]["Target"], "Href" => $area["Link"]["Href"], "LinkType" => $area["Link"]["LinkType"]));
             }
         }
     }
     unset($xpc);
     return $changed;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:100,代码来源:class.ilPageObject.php

示例9: initForm

 /**
  * Initializes a form for either displaying a room, adding a new room or editing an existing
  * room. The difference between those three forms is subtle but important: the form for
  * displaying rooms displays the information of the room without the ability of editing them.
  * The form for creating a room allows the input of values but contains no values initially. The
  * form for editing a room contains information that have been set before.
  * The creation of either those forms is determined by the mode parameter.
  *
  * @param string $a_mode the mode this form is centered around
  *
  * @return ilPropertyFormGUI the form with the given mode
  */
 private function initForm($a_mode = "show")
 {
     $form_gui =& new ilPropertyFormGUI();
     $form_gui->setMultipart(true);
     $form_gui->setTitle($this->lng->txt("rep_robj_xrs_room_properties"));
     $form_gui->setDescription($this->lng->txt("rep_robj_xrs_room_prop_description"));
     $name = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_name"), "name");
     $name->setDisabled(true);
     $form_gui->addItem($name);
     $type = new ilRoomSharingTextInputGUI($this->lng->txt("rep_robj_xrs_room_type"), "type");
     $type->setDisabled(true);
     $form_gui->addItem($type);
     $min_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_min_alloc"), "min_alloc");
     $min_alloc->setDisabled(true);
     $form_gui->addItem($min_alloc);
     $max_alloc = new ilRoomSharingNumberInputGUI($this->lng->txt("rep_robj_xrs_room_max_alloc"), "max_alloc");
     $max_alloc->setDisabled(true);
     $form_gui->addItem($max_alloc);
     $floor_plan = new ilSelectInputGUI($this->lng->txt("rep_robj_xrs_room_floor_plans"), "file_id");
     $floor_plan->setOptions($this->room_obj->getAllFloorplans());
     $floor_plan->setDisabled(true);
     $form_gui->addItem($floor_plan);
     if (count($this->room_obj->getAllAvailableAttributes())) {
         $defined_attributes = $this->room_obj->getAttributes();
         $show_mode_with_exist_attrs = $a_mode == "show" && count($defined_attributes) > 0;
         if ($a_mode == "edit" || $a_mode == "create" || $show_mode_with_exist_attrs) {
             $attributes_header = new ilFormSectionHeaderGUI();
             $attribute_header_text = $this->createAttributeHeaderText();
             $attributes_header->setTitle($this->lng->txt("rep_robj_xrs_room_attributes") . $attribute_header_text);
             $form_gui->addItem($attributes_header);
         }
         foreach ($this->room_obj->getAllAvailableAttributes() as $attr) {
             $attribute_amount_by_id = $this->room_obj->getAttributeAmountById($attr['id']);
             $amount_not_given = !ilRoomSharingNumericUtils::isPositiveNumber($attribute_amount_by_id, true);
             if ($a_mode == "show" && $amount_not_given) {
                 continue;
             } else {
                 $attr_field = new ilRoomSharingNumberInputGUI($attr['name'], self::ATTRIBUTE_ID_PREFIX . $attr['id']);
                 $attr_field->setValue($attribute_amount_by_id);
                 $attr_field->setMinValue(0);
                 $attr_field->setDisabled($a_mode == "show");
                 $form_gui->addItem($attr_field);
             }
         }
     }
     if ($a_mode == "edit" || $a_mode == "create") {
         $name->setDisabled(false);
         $name->setRequired(true);
         $type->setDisabled(false);
         $min_alloc->setDisabled(false);
         $min_alloc->setMinValue(0);
         $max_alloc->setDisabled(false);
         $max_alloc->setRequired(true);
         $max_alloc->setMinValue(0);
         $floor_plan->setDisabled(false);
         if ($a_mode == "create") {
             $min_alloc->setValue("0");
             $form_gui->addCommandButton($this->ctrl->getLinkTarget($this, "addRoom"), $this->lng->txt("rep_robj_xrs_add_room"));
         } else {
             $form_gui->addCommandButton("saveRoom", $this->lng->txt("save"));
         }
     }
     if ($a_mode == "edit" || $a_mode == "show") {
         $name->setValue($this->room_obj->getName());
         $type->setValue($this->room_obj->getType());
         $min_alloc->setValue($this->room_obj->getMinAlloc());
         $max_alloc->setValue($this->room_obj->getMaxAlloc());
         $floor_plan->setValue($this->room_obj->getFileId());
         if ($a_mode == "show") {
             $floor_plan->setDisabled(true);
             $mobj = new ilObjMediaObject($this->room_obj->getFileId());
             $mitems = $mobj->getMediaItems();
             if (!empty($mitems)) {
                 $med = $mobj->getMediaItem("Standard");
                 $target = $med->getThumbnailTarget();
                 $image_with_link = "<br><a target='_blank' href='" . $mobj->getDataDirectory() . "/" . $med->getLocation() . "'>" . ilUtil::img($target) . "</a>";
                 $floor_plan->setInfo($image_with_link);
             }
         }
     }
     $form_gui->setFormAction($this->ctrl->getFormAction($this));
     return $form_gui;
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:95,代码来源:class.ilRoomSharingRoomGUI.php

示例10: confirmDeleteObject

 /**
  * Before deleting a floor plan, the user has to confirm it via a
  * confirmation GUI which is created in this function.
  */
 public function confirmDeleteObject()
 {
     if (!$this->permission->checkPrivilege(PRIVC::DELETE_FLOORPLANS)) {
         ilUtil::sendFailure($this->lng->txt("rep_robj_xrs_no_permission_for_action"));
         $this->ctrl->redirectByClass('ilinfoscreengui', 'showSummary', 'showSummary');
         return false;
     }
     $this->tabs->clearTargets();
     $this->tabs->setBackTarget($this->lng->txt('rep_robj_xrs_back_to_floor_plans'), $this->ctrl->getLinkTarget($this, 'render'));
     $cgui = new ilConfirmationGUI();
     $cgui->setFormAction($this->ctrl->getFormAction($this));
     $fplan = $fplan = new ilRoomSharingFloorPlans($this->pool_id, new ilRoomsharingDatabase($this->pool_id));
     // check if floorplan is associated to a room
     $allRooms = $fplan->getRoomsWithFloorplan((int) $_GET['file_id']);
     foreach ($allRooms as $room) {
         $rooms[] = $room["name"];
     }
     if (empty($rooms)) {
         $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
     } else {
         $roomsWithPlan = implode(", ", $rooms);
         $cgui->setHeaderText($this->lng->txt("info_delete_sure") . '<br>' . $this->lng->txt("rep_robj_xrs_floor_plans_room_assoc") . ' ' . $roomsWithPlan);
     }
     // the buttons for confirming and cancelling the deletion
     $cgui->setCancel($this->lng->txt("cancel"), "render");
     $cgui->setConfirm($this->lng->txt("delete"), "removeFloorplan");
     // the table which includes the thumbnail picture and the title
     $mobj = new ilObjMediaObject((int) $_GET['file_id']);
     $med = $mobj->getMediaItem("Standard");
     $target = $med->getThumbnailTarget();
     $cgui->addItem('file_id', (int) $_GET['file_id'], $mobj->getTitle(), $target);
     $this->tpl->setContent($cgui->getHTML());
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:37,代码来源:class.ilRoomSharingFloorPlansGUI.php

示例11: updateMediaObject

 /**
  * Updates the media object with the file informations for the updateFloorPlanInfosWithFile
  * and addFloorPlan function.
  *
  * @param ilObjMediaObject $a_mediaObj
  * @param array            $a_fileinfo with format and filename
  */
 private function updateMediaObject($a_mediaObj, $a_fileinfo)
 {
     $media_item = $a_mediaObj->getMediaItem("Standard");
     $media_item->setFormat($a_fileinfo["format"]);
     $media_item->setLocation($a_fileinfo["filename"]);
     $media_item->setLocationType("LocalFile");
     $a_mediaObj->update();
 }
开发者ID:studer-raimann,项目名称:RoomSharing,代码行数:15,代码来源:class.ilRoomSharingFloorPlans.php

示例12: fillRow

 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // access
     if ($enable_internal_rss && !$this->presentation_mode) {
         $this->tpl->setCurrentBlock("access");
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", "");
     if (ilObject::_exists($a_set["mob_id"])) {
         if ($a_set["update_date"] != "") {
             $this->tpl->setCurrentBlock("last_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();
         }
         $mob = new ilObjMediaObject($a_set["mob_id"]);
         $med = $mob->getMediaItem("Standard");
         $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
         $this->tpl->setVariable("VAL_DESCRIPTION", $a_set["content"]);
         $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
         $this->tpl->setVariable("VAL_CREATED", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
         $this->tpl->setVariable("TXT_DURATION", $lng->txt("mcst_play_time"));
         if ($a_set["playtime"] != "00:00:00") {
             $this->tpl->setVariable("VAL_DURATION", $a_set["playtime"]);
         } else {
             $this->tpl->setVariable("VAL_DURATION", "-");
         }
         if (!$this->edit_order) {
             if ($this->downloadable) {
                 $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
                 // to keep always the order of the purposes
                 // iterate through purposes and display the according mediaitems
                 foreach (ilObjMediaCast::$purposes as $purpose) {
                     $a_mob = $mob->getMediaItem($purpose);
                     if (!is_object($a_mob)) {
                         continue;
                     }
                     $ilCtrl->setParameterByClass("ilobjmediacastgui", "purpose", $a_mob->getPurpose());
                     $file = ilObjMediaObject::_lookupItemPath($a_mob->getMobId(), false, false, $a_mob->getPurpose());
                     if (is_file($file)) {
                         $size = filesize($file);
                         $size = ", " . sprintf("%.1f MB", $size / 1024 / 1024);
                     }
                     $format = $a_mob->getFormat() != "" ? $a_mob->getFormat() : "audio/mpeg";
                     $this->tpl->setCurrentBlock("downloadable");
                     $this->tpl->setVariable("TXT_DOWNLOAD", $lng->txt("mcst_download_" . strtolower($a_mob->getPurpose())));
                     $this->tpl->setVariable("CMD_DOWNLOAD", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "downloadItem"));
                     $this->tpl->setVariable("TITLE_DOWNLOAD", "(" . $format . $size . ")");
                     $this->tpl->parseCurrentBlock();
                 }
             }
             include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
             $mpl = new ilMediaPlayerGUI();
             if (is_object($med)) {
                 if (strcasecmp("Reference", $med->getLocationType()) == 0) {
                     $mpl->setFile($med->getLocation());
                 } else {
                     $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
                 }
                 $mpl->setMimeType($med->getFormat());
                 //$mpl->setDisplayHeight($med->getHeight());
                 $mpl->setDisplayWidth("640");
                 $mpl->setDisplayHeight("480");
                 $mpl->setVideoPreviewPic($mob->getVideoPreviewPic());
                 $mpl->setTitle($a_set["title"]);
                 $mpl->setDescription($a_set["content"]);
                 $med_alt = $mob->getMediaItem("VideoAlternative");
                 if (is_object($med_alt)) {
                     $mpl->setAlternativeVideoFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med_alt->getLocation());
                     $mpl->setAlternativeVideoMimeType($med_alt->getFormat());
                 }
             }
             //$this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
             $this->tpl->setVariable("PLAYER", $mpl->getPreviewHtml());
             // edit link
             $ilCtrl->setParameterByClass("ilobjmediacastgui", "item_id", $a_set["id"]);
             if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]) && !$this->presentation_mode) {
                 $this->tpl->setCurrentBlock("edit");
                 $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
                 $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "editCastItem"));
                 if (!is_int(strpos($med->getFormat(), "image/"))) {
                     $this->tpl->setVariable("TXT_DET_PLAYTIME", $lng->txt("mcst_det_playtime"));
                     $this->tpl->setVariable("CMD_DET_PLAYTIME", $ilCtrl->getLinkTargetByClass("ilobjmediacastgui", "determinePlaytime"));
                 }
                 $this->tpl->parseCurrentBlock();
                 $this->tpl->setCurrentBlock("edit_checkbox");
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilMediaCastTableGUI.php

示例13: 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

示例14: 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

示例15: showNews

 /**
  * show news
  */
 function showNews()
 {
     global $lng, $ilCtrl, $ilUser;
     // workaround for dynamic mode (if cache is disabled, showNews has no data)
     if (empty(self::$st_data)) {
         $this->setData($this->getNewsData());
     }
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $news = new ilNewsItem($_GET["news_id"]);
     $tpl = new ilTemplate("tpl.show_news.html", true, true, "Services/News");
     // get current item in data set
     $previous = $next = "";
     reset($this->data);
     $c = current($this->data);
     $curr_cnt = 1;
     while ($c["id"] > 0 && $c["id"] != $_GET["news_id"]) {
         $previous = $c;
         $c = next($this->data);
         $curr_cnt++;
     }
     // collect news items to show
     $news_list = array();
     if (is_array($c["aggregation"])) {
         //$agg_obj_id = ilObject::_lookupObjId($c["agg_ref_id"]);
         //$agg_obj_type = ilObject::_lookupType($agg_obj_id);
         //$agg_obj_title = ilObject::_lookupObjId($agg_obj_id);
         $news_list[] = array("ref_id" => $c["agg_ref_id"], "agg_ref_id" => $c["agg_ref_id"], "aggregation" => $c["aggregation"], "user_id" => "", "content_type" => "text", "mob_id" => 0, "visibility" => "", "content" => "", "content_long" => "", "update_date" => $news->getUpdateDate(), "creation_date" => "", "content_is_lang_var" => false, "loc_context" => $_GET["news_context"], "context_obj_type" => $news->getContextObjType(), "title" => "");
         foreach ($c["aggregation"] as $c_item) {
             ilNewsItem::_setRead($ilUser->getId(), $c_item["id"]);
             $c_item["loc_context"] = $c_item["ref_id"];
             $c_item["loc_stop"] = $_GET["news_context"];
             $news_list[] = $c_item;
         }
     } else {
         $news_list[] = array("ref_id" => $_GET["news_context"], "user_id" => $news->getUserId(), "content_type" => $news->getContentType(), "mob_id" => $news->getMobId(), "visibility" => $news->getVisibility(), "priority" => $news->getPriority(), "content" => $news->getContent(), "content_long" => $news->getContentLong(), "update_date" => $news->getUpdateDate(), "creation_date" => $news->getCreationDate(), "context_sub_obj_type" => $news->getContextSubObjType(), "context_obj_type" => $news->getContextObjType(), "context_sub_obj_id" => $news->getContextSubObjId(), "content_is_lang_var" => $news->getContentIsLangVar(), "content_text_is_lang_var" => $news->getContentTextIsLangVar(), "loc_context" => $_GET["news_context"], "title" => $news->getTitle());
         ilNewsItem::_setRead($ilUser->getId(), $_GET["news_id"]);
     }
     foreach ($news_list as $item) {
         // user
         if ($item["user_id"] > 0 && ilObject::_exists($item["user_id"])) {
             // get login
             if (ilObjUser::_exists($item["user_id"])) {
                 $user = new ilObjUser($item["user_id"]);
                 $displayname = $user->getLogin();
             } else {
                 // this should actually not happen, since news entries
                 // should be deleted when the user is going to be removed
                 $displayname = "&lt;" . strtolower($lng->txt("deleted")) . "&gt;";
             }
             $tpl->setCurrentBlock("user_info");
             $tpl->setVariable("VAL_AUTHOR", $displayname);
             $tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
             $tpl->parseCurrentBlock();
         }
         // media player
         if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
             include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
             include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
             $mob = new ilObjMediaObject($item["mob_id"]);
             $med = $mob->getMediaItem("Standard");
             $mpl = new ilMediaPlayerGUI();
             if (strcasecmp("Reference", $med->getLocationType()) == 0) {
                 $mpl->setFile($med->getLocation());
             } else {
                 $mpl->setFile(ilObjMediaObject::_getURL($mob->getId()) . "/" . $med->getLocation());
             }
             $mpl->setDisplayHeight($med->getHeight());
             $tpl->setCurrentBlock("player");
             $tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
             $tpl->parseCurrentBlock();
         }
         // access
         if ($enable_internal_rss && $item["visibility"] != "") {
             $obj_id = ilObject::_lookupObjId($item["ref_id"]);
             $tpl->setCurrentBlock("access");
             $tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
             if ($item["visibility"] == NEWS_PUBLIC || $item["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
             } else {
                 $tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
             }
             $tpl->parseCurrentBlock();
         }
         // content
         if (trim($item["content"]) != "") {
             $tpl->setCurrentBlock("content");
             $tpl->setVariable("VAL_CONTENT", nl2br($this->makeClickable(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]))));
             //$tpl->setVariable("VAL_CONTENT", nl2br($item["content"]));
             $tpl->parseCurrentBlock();
         }
         if (trim($item["content_long"]) != "") {
             $tpl->setCurrentBlock("long");
             $tpl->setVariable("VAL_LONG_CONTENT", $this->makeClickable($item["content_long"]));
             $tpl->parseCurrentBlock();
         }
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilNewsForContextBlockGUI.php


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