/**
  * Creates link for an room agreement file if such exists.
  *
  * @return string link
  */
 private function getRoomAgreementLink()
 {
     $linkPresentation = "";
     $fileId = $this->object->getRoomsAgreementFileId();
     if (!empty($fileId) && $fileId != "0") {
         $agreementFile = new ilObjMediaObject($fileId);
         $media = $agreementFile->getMediaItem("Standard");
         $source = $agreementFile->getDataDirectory() . "/" . $media->getLocation();
         $linkPresentation = "<p> <a target=\"_blank\" href=\"" . $source . "\">" . $this->lng->txt('rep_robj_xrs_current_rooms_user_agreement') . "</a></p>";
     }
     return $linkPresentation;
 }
 /**
  * Generate the link to the room agreement.
  *
  * @param integer $a_file_id
  *
  * @return string
  */
 private function getFileLinkForUserAgreementId($a_file_id)
 {
     $agreement_file = new ilObjMediaObject($a_file_id);
     $media = $agreement_file->getMediaItem("Standard");
     $source = $agreement_file->getDataDirectory() . "/" . $media->getLocation();
     $link = "<p> <a target=\"_blank\" href=\"" . $source . "\">" . $this->lng->txt('rep_robj_xrs_current_rooms_user_agreement') . "</a></p>";
     return $link;
 }
 protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
 {
     $parent_obj_ids = array();
     foreach ($a_mob->getUsages() as $item) {
         $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
         if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
             $parent_obj_ids[] = $parent_obj_id;
         }
     }
     // we could suppress this if object is present in a (repository) media pool
     // but this would lead to "quota-breaches" when the pool item is deleted
     // and "suddenly" all workspace owners get filesize added to their
     // respective quotas, regardless of current status
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
 }
示例#4
0
 protected static function handleQuotaUpdate(ilObjMediaObject $a_mob)
 {
     global $ilSetting;
     // if neither workspace nor portfolios are activated, we skip
     // the quota update here. this due to performance reasons on installations
     // that do not use workspace/portfolios, but heavily copy content.
     // in extreme cases (media object in pool and personal blog, deactivate workspace, change media object,
     // this may lead to incorrect data in the quota calculation)
     if ($ilSetting->get("disable_personal_workspace") && !$ilSetting->get('user_portfolios')) {
         return;
     }
     $parent_obj_ids = array();
     foreach ($a_mob->getUsages() as $item) {
         $parent_obj_id = $a_mob->getParentObjectIdForUsage($item);
         if ($parent_obj_id && !in_array($parent_obj_id, $parent_obj_ids)) {
             $parent_obj_ids[] = $parent_obj_id;
         }
     }
     // we could suppress this if object is present in a (repository) media pool
     // but this would lead to "quota-breaches" when the pool item is deleted
     // and "suddenly" all workspace owners get filesize added to their
     // respective quotas, regardless of current status
     include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::handleUpdatedSourceObject($a_mob->getType(), $a_mob->getId(), ilUtil::dirSize($a_mob->getDataDirectory()), $parent_obj_ids);
 }
 /**
  * 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;
 }
 /**
  * Populates the Image Thumbnail in the row
  *
  * @param ilObjMediaObject $a_mediaObject the media object
  * @param string           $a_type        the image type
  */
 private function fillRowImage($a_mediaObject, $a_type)
 {
     $med = $a_mediaObject->getMediaItem("Standard");
     $this->tpl->setVariable("LINK_VIEW", $a_mediaObject->getDataDirectory() . "/" . $med->getLocation());
     $target = $med->getThumbnailTarget();
     if ($target !== "") {
         $this->tpl->setVariable("IMG", ilUtil::img($target));
     } else {
         $this->tpl->setVariable("IMG", ilUtil::img(ilUtil::getImagePath("icon_" . $a_type . ".png")));
     }
 }