本文整理汇总了PHP中ilObjMediaObject::getMediaItems方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjMediaObject::getMediaItems方法的具体用法?PHP ilObjMediaObject::getMediaItems怎么用?PHP ilObjMediaObject::getMediaItems使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjMediaObject
的用法示例。
在下文中一共展示了ilObjMediaObject::getMediaItems方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMediaItems
/**
* get MediaItems for id and updates local variable mcst_item
*
* @return array of ilMediaItem
*
*/
protected function getMediaItems($id)
{
include_once "./Services/News/classes/class.ilNewsItem.php";
$this->mcst_item = new ilNewsItem($id);
// create dummy object in db (we need an id)
include_once "./Services/MediaObjects/classes/class.ilObjMediaObjectGUI.php";
$mob = new ilObjMediaObject($this->mcst_item->getMobId());
return $mob->getMediaItems();
}
示例2: 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;
}