/** * Gets all floorplans. * * @return type return of $this->ilDB->query */ public function getAllFloorplans() { $set = $this->ilDB->query('SELECT * FROM ' . dbc::FLOORPLANS_TABLE . ' WHERE pool_id = ' . $this->ilDB->quote($this->pool_id, 'integer') . ' order by file_id DESC'); $floorplans = array(); $row = $this->ilDB->fetchAssoc($set); while ($row) { $mobj = new ilObjMediaObject($row['file_id']); $row["title"] = $mobj->getTitle(); $floorplans[] = $row; $row = $this->ilDB->fetchAssoc($set); } return $floorplans; }
/** * init Form * * @param string $a_mode values: create | edit */ public function initForm() { global $lng, $ilCtrl; //table_id $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->table_id); $this->form->addItem($hidden_prop); $ilCtrl->setParameter($this, "record_id", $this->record_id); $this->form->setFormAction($ilCtrl->getFormAction($this)); $allFields = $this->table->getRecordFields(); foreach ($allFields as $field) { $item = ilDataCollectionDatatype::getInputField($field); if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $fieldref = $field->getFieldRef(); $reffield = ilDataCollectionCache::getFieldCache($fieldref); $options = array(); if (!$field->isNRef()) { $options[""] = '--'; } $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId()); foreach ($reftable->getRecords() as $record) { // If the referenced field is MOB or FILE, we display the filename in the dropdown if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) { $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $file_obj->getFileName(); } else { if ($reffield->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) { $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $media_obj->getTitle(); } else { $options[$record->getId()] = $record->getRecordFieldValue($fieldref); } } } $item->setOptions($options); } if ($this->record_id) { $record = ilDataCollectionCache::getRecordCache($this->record_id); } $item->setRequired($field->getRequired()); //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it. if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB && ($this->record_id && $record->getId() != 0 && ($record->getRecordFieldValue($field->getId()) != "-" || $record->getRecordFieldValue($field->getId()) != ""))) { $item->setRequired(false); } if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) { $item->setDisabled(true); } $this->form->addItem($item); } // Add possibility to change the owner in edit mode if ($this->record_id) { $ownerField = $this->table->getField('owner'); $inputfield = ilDataCollectionDatatype::getInputField($ownerField); $this->form->addItem($inputfield); } // save and cancel commands if (isset($this->record_id)) { $this->form->setTitle($lng->txt("dcl_update_record")); $this->form->addCommandButton("save", $lng->txt("dcl_update_record")); $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel")); } else { $this->form->setTitle($lng->txt("dcl_add_new_record")); $this->form->addCommandButton("save", $lng->txt("save")); $this->form->addCommandButton("cancelSave", $lng->txt("cancel")); } $ilCtrl->setParameter($this, "table_id", $this->table_id); $ilCtrl->setParameter($this, "record_id", $this->record_id); }
/** * init Form */ public function initForm() { $this->form = new ilPropertyFormGUI(); $prefix = $this->ctrl->isAsynch() ? 'dclajax' : 'dcl'; // Used by datacolleciton.js to select input elements $this->form->setId($prefix . $this->table_id . $this->record_id); $hidden_prop = new ilHiddenInputGUI("table_id"); $hidden_prop->setValue($this->table_id); $this->form->addItem($hidden_prop); if ($this->record_id) { $hidden_prop = new ilHiddenInputGUI("record_id"); $hidden_prop->setValue($this->record_id); $this->form->addItem($hidden_prop); } $this->ctrl->setParameter($this, "record_id", $this->record_id); $this->form->setFormAction($this->ctrl->getFormAction($this)); $allFields = $this->table->getRecordFields(); $inline_css = ''; foreach ($allFields as $field) { $item = ilDataCollectionDatatype::getInputField($field); if ($item === NULL) { continue; // Fields calculating values at runtime, e.g. ilDataCollectionFormulaField do not have input } if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { $fieldref = $field->getFieldRef(); $reffield = ilDataCollectionCache::getFieldCache($fieldref); $options = array(); if (!$field->isNRef()) { $options[""] = $this->lng->txt('dcl_please_select'); } $reftable = ilDataCollectionCache::getTableCache($reffield->getTableId()); foreach ($reftable->getRecords() as $record) { // If the referenced field is MOB or FILE, we display the filename in the dropdown switch ($reffield->getDatatypeId()) { case ilDataCollectionDatatype::INPUTFORMAT_FILE: $file_obj = new ilObjFile($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $file_obj->getFileName(); break; case ilDataCollectionDatatype::INPUTFORMAT_MOB: $media_obj = new ilObjMediaObject($record->getRecordFieldValue($fieldref), false); $options[$record->getId()] = $media_obj->getTitle(); break; case ilDataCollectionDatatype::INPUTFORMAT_DATETIME: $options[$record->getId()] = $record->getRecordFieldSingleHTML($fieldref); break; default: $options[$record->getId()] = $record->getRecordFieldValue($fieldref); break; } } asort($options); $item->setOptions($options); if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) { // FSX use this to apply to MultiSelectInputGUI // if (!$field->isNRef()) { // addCustomAttribute only defined for single selects if ($reftable->hasPermissionToAddRecord($_GET['ref_id'])) { $item->addCustomAttribute('data-ref="1"'); $item->addCustomAttribute('data-ref-table-id="' . $reftable->getId() . '"'); $item->addCustomAttribute('data-ref-field-id="' . $reffield->getId() . '"'); } // } } if ($item instanceof ilMultiSelectInputGUI) { $item->setWidth(400); $item->setHeight(100); $inline_css .= 'div#' . $item->getFieldId() . '{resize:both;} '; } } if ($this->record_id) { $record = ilDataCollectionCache::getRecordCache($this->record_id); } $item->setRequired($field->getRequired()); //WORKAROUND. If field is from type file: if it's required but already has a value it is no longer required as the old value is taken as default without the form knowing about it. if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE || $field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB) { if ($this->record_id and $record->getId()) { $field_value = $record->getRecordFieldValue($field->getId()); if ($field_value) { $item->setRequired(false); } } // If this is an ajax request to return the form, input files are currently not supported if ($this->ctrl->isAsynch()) { $item->setDisabled(true); } } if (!ilObjDataCollection::_hasWriteAccess($this->parent_obj->ref_id) && $field->getLocked()) { $item->setDisabled(true); } $this->form->addItem($item); } $this->tpl->addInlineCss($inline_css); // Add possibility to change the owner in edit mode if ($this->record_id) { $ownerField = $this->table->getField('owner'); $inputfield = ilDataCollectionDatatype::getInputField($ownerField); $this->form->addItem($inputfield); } // save and cancel commands if ($this->record_id) { $this->form->setTitle($this->lng->txt("dcl_update_record")); $this->form->addCommandButton("save", $this->lng->txt("dcl_update_record")); if (!$this->ctrl->isAsynch()) { $this->form->addCommandButton("cancelUpdate", $this->lng->txt("cancel")); } } else { $this->form->setTitle($this->lng->txt("dcl_add_new_record")); $this->form->addCommandButton("save", $this->lng->txt("save")); if (!$this->ctrl->isAsynch()) { $this->form->addCommandButton("cancelSave", $this->lng->txt("cancel")); } } $this->ctrl->setParameter($this, "table_id", $this->table_id); $this->ctrl->setParameter($this, "record_id", $this->record_id); }
/** * show print view */ function showPrintView() { global $ilUser, $lng, $ilCtrl; include_once "./Modules/LearningModule/classes/class.ilLMPage.php"; if (!$this->lm->isActivePrintView()) { return; } $this->renderPageTitle(); $c_obj_id = $this->getCurrentPageId(); // set values according to selection if ($_POST["sel_type"] == "page") { if (!is_array($_POST["obj_id"]) || !in_array($c_obj_id, $_POST["obj_id"])) { $_POST["obj_id"][] = $c_obj_id; } } if ($_POST["sel_type"] == "chapter" && $c_obj_id > 0) { $path = $this->lm_tree->getPathFull($c_obj_id); $chap_id = $path[1]["child"]; if ($chap_id > 0) { $_POST["obj_id"][] = $chap_id; } } //var_dump($_GET); //var_dump($_POST); // set style sheets if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_STYLESHEET", ilObjStyleSheet::getContentPrintStyle()); } else { $style_name = $ilUser->getPref("style") . ".css"; $this->tpl->setVariable("LOCATION_STYLESHEET", "./style/" . $style_name); } // content style $this->tpl->setCurrentBlock("ContentStyle"); if (!$this->offlineMode()) { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", ilObjStyleSheet::getContentStylePath($this->lm->getStyleSheetId())); } else { $this->tpl->setVariable("LOCATION_CONTENT_STYLESHEET", "content_style/content.css"); } $this->tpl->parseCurrentBlock(); // syntax style $this->tpl->setCurrentBlock("SyntaxStyle"); $this->tpl->setVariable("LOCATION_SYNTAX_STYLESHEET", ilObjStyleSheet::getSyntaxStylePath()); $this->tpl->parseCurrentBlock(); //$this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation()); $this->tpl->addBlockFile("CONTENT", "content", "tpl.lm_print_view.html", true); // set title header $this->tpl->setVariable("HEADER", $this->lm->getTitle()); $nodes = $this->lm_tree->getSubtree($this->lm_tree->getNodeData($this->lm_tree->getRootId())); include_once "./Modules/LearningModule/classes/class.ilLMPageGUI.php"; include_once "./Modules/LearningModule/classes/class.ilLMPageObject.php"; include_once "./Modules/LearningModule/classes/class.ilStructureObject.php"; $act_level = 99999; $activated = false; $glossary_links = array(); $output_header = false; $media_links = array(); // get header and footer if ($this->lm->getFooterPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getFooterPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getFooterPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $footer_page_content = $page_object_gui->showPage(); } } if ($this->lm->getHeaderPage() > 0 && !$this->lm->getHideHeaderFooterPrint()) { if (ilLMObject::_exists($this->lm->getHeaderPage())) { $page_object_gui = $this->getLMPageGUI($this->lm->getHeaderPage()); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $header_page_content = $page_object_gui->showPage(); } } // add free selected pages if (is_array($_POST["obj_id"])) { foreach ($_POST["obj_id"] as $k) { if ($k > 0 && !$this->lm_tree->isInTree($k)) { if (ilLMObject::_lookupType($k) == "pg") { $nodes[] = array("obj_id" => $k, "type" => "pg", "free" => true); } } } } else { ilUtil::sendFailure($lng->txt("cont_print_no_page_selected"), true); $ilCtrl->redirect($this, "showPrintViewSelection"); } foreach ($nodes as $node_key => $node) { // check page activation $active = ilLMPage::_lookupActive($node["obj_id"], $this->lm->getType(), $this->lm_set->get("time_scheduled_page_activation")); if ($node["type"] == "pg" && !$active) { continue; } // print all subchapters/subpages if higher chapter // has been selected if ($node["depth"] <= $act_level) { if (is_array($_POST["obj_id"]) && in_array($node["obj_id"], $_POST["obj_id"])) { $act_level = $node["depth"]; $activated = true; } else { $act_level = 99999; $activated = false; } } if ($activated && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node["obj_id"])) { // output learning module header if ($node["type"] == "du") { $output_header = true; } // output chapter title if ($node["type"] == "st") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $chap = new ilStructureObject($this->lm, $node["obj_id"]); $this->tpl->setCurrentBlock("print_chapter"); $chapter_title = $chap->_getPresentationTitle($node["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang); $this->tpl->setVariable("CHAP_TITLE", $chapter_title); if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($nodes[$node_key + 1]["type"] == "pg") { $this->tpl->setVariable("CHAP_HEADER", $header_page_content); $did_chap_page_header = true; } } $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); } // output page if ($node["type"] == "pg") { if (($ilUser->getId() == ANONYMOUS_USER_ID || $this->needs_to_be_purchased) && $this->lm_gui->object->getPublicAccessMode() == "selected") { if (!ilLMObject::_isPagePublic($node["obj_id"])) { continue; } } $this->tpl->setCurrentBlock("print_item"); // get page $page_id = $node["obj_id"]; $page_object_gui = $this->getLMPageGUI($page_id); $page_object = $page_object_gui->getPageObject(); include_once "./Services/Style/classes/class.ilObjStyleSheet.php"; $page_object_gui->setStyleId(ilObjStyleSheet::getEffectiveContentStyleId($this->lm->getStyleSheetId(), "lm")); // get lm page $lm_pg_obj = new ilLMPageObject($this->lm, $page_id); $lm_pg_obj->setLMId($this->lm->getId()); // determine target frames for internal links $page_object_gui->setLinkFrame($_GET["frame"]); $page_object_gui->setOutputMode("print"); $page_object_gui->setPresentationTitle(""); if ($this->lm->getPageHeader() == IL_PAGE_TITLE || $node["free"] === true) { $page_title = ilLMPageObject::_getPresentationTitle($lm_pg_obj->getId(), $this->lm->getPageHeader(), $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), false, 0, $this->lang); // prevent page title after chapter title // that have the same content if ($this->lm->isActiveNumbering()) { $chapter_title = trim(substr($chapter_title, strpos($chapter_title, " "))); } if ($page_title != $chapter_title) { $page_object_gui->setPresentationTitle($page_title); } } // handle header / footer $hcont = $header_page_content; $fcont = $footer_page_content; if ($this->lm->getPageHeader() == IL_CHAPTER_TITLE) { if ($did_chap_page_header) { $hcont = ""; } if ($nodes[$node_key + 1]["type"] == "pg" && !($nodes[$node_key + 1]["depth"] <= $act_level && !in_array($nodes[$node_key + 1]["obj_id"], $_POST["obj_id"]))) { $fcont = ""; } } $page_object_gui->setFileDownloadLink("#"); $page_object_gui->setFullscreenLink("#"); $page_object_gui->setSourceCodeDownloadScript("#"); $page_content = $page_object_gui->showPage(); if ($this->lm->getPageHeader() != IL_PAGE_TITLE) { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont); } else { $this->tpl->setVariable("CONTENT", $hcont . $page_content . $fcont . "<br />"); } $chapter_title = ""; $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_block"); $this->tpl->parseCurrentBlock(); // get internal links $int_links = ilInternalLink::_getTargetsOfSource($this->lm->getType() . ":pg", $node["obj_id"]); $got_mobs = false; foreach ($int_links as $key => $link) { if ($link["type"] == "git" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $glossary_links[$key] = $link; } if ($link["type"] == "mob" && ($link["inst"] == IL_INST_ID || $link["inst"] == 0)) { $got_mobs = true; $mob_links[$key] = $link; } } // this is not cool because of performance reasons // unfortunately the int link table does not // store the target frame (we want to append all linked // images but not inline images (i.e. mobs with no target // frame)) if ($got_mobs) { $page_object->buildDom(); $links = $page_object->getInternalLinks(); foreach ($links as $link) { if ($link["Type"] == "MediaObject" && $link["TargetFrame"] != "" && $link["TargetFrame"] != "None") { $media_links[] = $link; } } } } } } $annex_cnt = 0; $annexes = array(); // glossary if (count($glossary_links) > 0 && !$this->lm->isActivePreventGlossaryAppendix()) { include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php"; include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php"; // sort terms $terms = array(); foreach ($glossary_links as $key => $link) { $term = ilGlossaryTerm::_lookGlossaryTerm($link["id"]); $terms[$term . ":" . $key] = array("key" => $key, "link" => $link, "term" => $term); } $terms = ilUtil::sortArray($terms, "term", "asc"); //ksort($terms); foreach ($terms as $t) { $link = $t["link"]; $key = $t["key"]; $defs = ilGlossaryDefinition::getDefinitionList($link["id"]); $def_cnt = 1; // output all definitions of term foreach ($defs as $def) { // definition + number, if more than 1 definition if (count($defs) > 1) { $this->tpl->setCurrentBlock("def_title"); $this->tpl->setVariable("TXT_DEFINITION", $this->lng->txt("cont_definition") . " " . $def_cnt++); $this->tpl->parseCurrentBlock(); } include_once "./Modules/Glossary/classes/class.ilGlossaryDefPageGUI.php"; $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") { include_once "Services/MetaData/classes/class.ilMD.php"; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); $md_gen = $md->getGeneral(); foreach ($md_gen->getDescriptionIds() as $id) { $md_des = $md_gen->getDescription($id); $description = $md_des->getDescription(); } $this->tpl->setVariable("LM_DESCRIPTION", $description); } $this->tpl->parseCurrentBlock(); // output toc $nodes2 = $nodes; foreach ($nodes2 as $node2) { if ($node2["type"] == "st" && ilObjContentObject::_checkPreconditionsOfPage($this->lm->getRefId(), $this->lm->getId(), $node2["obj_id"])) { for ($j = 1; $j < $node2["depth"]; $j++) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", ilStructureObject::_getPresentationTitle($node2["obj_id"], $this->lm->isActiveNumbering(), $this->lm_set->get("time_scheduled_page_activation"), 0, $this->lang)); $this->tpl->parseCurrentBlock(); } } // annexes foreach ($annexes as $annex) { $this->tpl->setCurrentBlock("indent"); $this->tpl->setVariable("IMG_BLANK", ilUtil::getImagePath("browser/blank.png")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("toc_entry"); $this->tpl->setVariable("TXT_TOC_TITLE", $annex); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("toc"); $this->tpl->setVariable("TXT_TOC", $this->lng->txt("cont_toc")); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("print_start_block"); $this->tpl->parseCurrentBlock(); } // output author information include_once 'Services/MetaData/classes/class.ilMD.php'; $md = new ilMD($this->lm->getId(), 0, $this->lm->getType()); if (is_object($lifecycle = $md->getLifecycle())) { $sep = $author = ""; foreach ($ids = $lifecycle->getContributeIds() as $con_id) { $md_con = $lifecycle->getContribute($con_id); if ($md_con->getRole() == "Author") { foreach ($ent_ids = $md_con->getEntityIds() as $ent_id) { $md_ent = $md_con->getEntity($ent_id); $author = $author . $sep . $md_ent->getEntity(); $sep = ", "; } } } if ($author != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("author"); $this->tpl->setVariable("TXT_AUTHOR", $this->lng->txt("meta_author")); $this->tpl->setVariable("LM_AUTHOR", $author); $this->tpl->parseCurrentBlock(); } } // output copyright information if (is_object($md_rights = $md->getRights())) { $copyright = $md_rights->getDescription(); include_once 'Services/MetaData/classes/class.ilMDUtils.php'; $copyright = ilMDUtils::_parseCopyright($copyright); if ($copyright != "") { $this->lng->loadLanguageModule("meta"); $this->tpl->setCurrentBlock("copyright"); $this->tpl->setVariable("TXT_COPYRIGHT", $this->lng->txt("meta_copyright")); $this->tpl->setVariable("LM_COPYRIGHT", $copyright); $this->tpl->parseCurrentBlock(); } } $this->tpl->show(false); }
function getExportResources() { $export_files = array(); require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php"; include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php"; include_once "./Modules/File/classes/class.ilObjFile.php"; $tree = new ilTree($this->slm_object->getId()); $tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node'); $tree->setTreeTablePK("slm_id"); foreach ($tree->getSubTree($tree->getNodeData($this->node_object->getId()), true, 'page') as $page) { $page_obj = new ilSCORM2004Page($page["obj_id"]); $page_obj->buildDom(); $mob_ids = $page_obj->collectMediaObjects(false); foreach ($mob_ids as $mob_id) { if ($mob_id > 0 && ilObject::_exists($mob_id)) { $path = ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false); $media_obj = new ilObjMediaObject($mob_id); $export_files[$i]["date"] = $media_obj->getCreateDate(); $export_files[$i]["size"] = @filesize($path); // could be remote, e.g. youtube video $export_files[$i]["file"] = $media_obj->getTitle(); $export_files[$i]["type"] = $media_obj->getDescription(); $export_files[$i]["path"] = $path; $this->ctrl->setParameter($this, "resource", rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id, false, false))); $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadResource"); $i++; } } include_once "./Services/COPage/classes/class.ilPCFileList.php"; $file_ids = ilPCFileList::collectFileItems($page_obj, $page_obj->getDomDoc()); foreach ($file_ids as $file_id) { $file_obj = new ilObjFile($file_id, false); $export_files[$i]["date"] = $file_obj->getCreateDate(); $export_files[$i]["size"] = $file_obj->getFileSize(); $export_files[$i]["file"] = $file_obj->getFileName(); $export_files[$i]["type"] = $file_obj->getFileType(); $export_files[$i]["file_id"] = $file_id; $this->ctrl->setParameter($this, "file_id", $file_id); $export_files[$i]["link"] = $this->ctrl->getLinkTarget($this, "downloadFile", ""); $i++; } unset($page_obj); } return $export_files; }
/** * Function to parse incoming data from form input value $value. returns the strin/number/etc. to store in the database. * @param $value * @return int|string */ public function parseExportValue($value) { $return = false; if ($this->id == ilDataCollectionDatatype::INPUTFORMAT_FILE) { if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") { return; } $file = $value; if ($file != "-") { $file_obj = new ilObjFile($file, false); $file_name = $file_obj->getFileName(); $return = $file_name; } else { $return = $file; } } elseif ($this->id == ilDataCollectionDatatype::INPUTFORMAT_MOB) { $file = $value; if ($file != "-") { $mob = new ilObjMediaObject($file, false); $mob_name = $mob->getTitle(); $return = $mob_name; } else { $return = $file; } } elseif ($this->id == ilDataCollectionDatatype::INPUTFORMAT_DATETIME) { $return = substr($value, 0, 10); } elseif ($this->id == ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN) { $return = $value ? 1 : 0; } else { $return = $value; } return $return; }
/** * 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"]); }
/** * 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()); }
function start() { global $ilDB; ilUtil::makeDir($this->target_dir_absolute . "/objects"); $query_frm = 'SELECT * FROM frm_settings fs ' . 'JOIN object_data od ON fs.obj_id = od.obj_id ' . 'JOIN frm_data ON top_frm_fk = od.obj_id ' . 'WHERE fs.obj_id = ' . $ilDB->quote($this->forum_id, 'integer'); $res = $ilDB->query($query_frm); while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) { break; } $this->xmlStartTag("Forum", null); $this->xmlElement("Id", null, (int) $row->top_pk); $this->xmlElement("ObjId", null, (int) $row->obj_id); $this->xmlElement("Title", null, $row->title); $this->xmlElement("Description", null, $row->description); $this->xmlElement("DefaultView", null, (int) $row->default_view); $this->xmlElement("Pseudonyms", null, (int) $row->anonymized); $this->xmlElement("Statistics", null, (int) $row->statistics_enabled); $this->xmlElement("PostingActivation", null, (int) $row->post_activation); $this->xmlElement("PresetSubject", null, (int) $row->preset_subject); $this->xmlElement("PresetRe", null, (int) $row->add_re_subject); $this->xmlElement("NotificationType", null, $row->notification_type); $this->xmlElement("ForceNotification", null, (int) $row->admin_force_noti); $this->xmlElement("ToggleNotification", null, (int) $row->user_toggle_noti); $this->xmlElement("LastPost", null, $row->top_last_post); $this->xmlElement("Moderator", null, (int) $row->top_mods); $this->xmlElement("CreateDate", null, $row->top_date); $this->xmlElement("UpdateDate", null, $row->top_update); $this->xmlElement("UpdateUserId", null, $row->update_user); $this->xmlElement("UserId", null, (int) $row->top_usr_id); $query_thr = "SELECT frm_threads.* " . " FROM frm_threads " . " INNER JOIN frm_data ON top_pk = thr_top_fk " . 'WHERE top_frm_fk = ' . $ilDB->quote($this->forum_id, 'integer'); $res = $ilDB->query($query_thr); while ($row = $ilDB->fetchObject($res)) { $this->xmlStartTag("Thread"); $this->xmlElement("Id", null, (int) $row->thr_pk); $this->xmlElement("Subject", null, $row->thr_subject); $this->xmlElement("UserId", null, (int) $row->thr_usr_id); $this->xmlElement("Alias", null, $row->thr_usr_alias); $this->xmlElement("LastPost", null, $row->thr_last_post); $this->xmlElement("CreateDate", null, $row->thr_date); $this->xmlElement("UpdateDate", null, $row->thr_date); $this->xmlElement("ImportName", null, $row->import_name); $this->xmlElement("Sticky", null, (int) $row->is_sticky); $this->xmlElement("Closed", null, (int) $row->is_closed); $query = 'SELECT frm_posts.*, frm_posts_tree.* FROM frm_posts INNER JOIN frm_data ON top_pk = pos_top_fk INNER JOIN frm_posts_tree ON pos_fk = pos_pk WHERE pos_thr_fk = ' . $ilDB->quote($row->thr_pk, 'integer') . ' '; $query .= " ORDER BY frm_posts_tree.lft ASC"; $resPosts = $ilDB->query($query); $lastDepth = null; while ($rowPost = $ilDB->fetchObject($resPosts)) { /* // Used for nested postings if( $rowPost->depth < $lastDepth ) { for( $i = $rowPost->depth; $i <= $lastDepth; $i++ ) { $this->xmlEndTag("Post"); } }*/ $this->xmlStartTag("Post"); $this->xmlElement("Id", null, (int) $rowPost->pos_pk); $this->xmlElement("UserId", null, (int) $rowPost->pos_usr_id); $this->xmlElement("Alias", null, $rowPost->pos_usr_alias); $this->xmlElement("Subject", null, $rowPost->pos_subject); $this->xmlElement("CreateDate", null, $rowPost->pos_date); $this->xmlElement("UpdateDate", null, $rowPost->pos_update); $this->xmlElement("UpdateUserId", null, (int) $rowPost->update_user); $this->xmlElement("Censorship", null, (int) $rowPost->pos_cens); $this->xmlElement("CensorshipMessage", null, $rowPost->pos_cens_com); $this->xmlElement("Notification", null, $rowPost->notify); $this->xmlElement("ImportName", null, $rowPost->import_name); $this->xmlElement("Status", null, (int) $rowPost->pos_status); $this->xmlElement("Message", null, ilRTE::_replaceMediaObjectImageSrc($rowPost->pos_message, 0)); $media_exists = false; $mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $rowPost->pos_pk); foreach ($mobs as $mob) { $moblabel = "il_" . IL_INST_ID . "_mob_" . $mob; if (ilObjMediaObject::_exists($mob)) { if (!$media_exists) { $this->xmlStartTag("MessageMediaObjects"); $media_exists = true; } $mob_obj = new ilObjMediaObject($mob); $imgattrs = array("label" => $moblabel, "uri" => $this->target_dir_relative . "/objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle()); $this->xmlElement("MediaObject", $imgattrs, NULL); $mob_obj->exportFiles($this->target_dir_absolute); } } if ($media_exists) { $this->xmlEndTag("MessageMediaObjects"); } $this->xmlElement("Lft", null, (int) $rowPost->lft); $this->xmlElement("Rgt", null, (int) $rowPost->rgt); $this->xmlElement("Depth", null, (int) $rowPost->depth); $this->xmlElement("ParentId", null, (int) $rowPost->parent_pos); $tmp_file_obj = new ilFileDataForum($this->forum_id, $rowPost->pos_pk); $set = array(); if (count($tmp_file_obj->getFilesOfPost())) { foreach ($tmp_file_obj->getFilesOfPost() as $file) { $this->xmlStartTag("Attachment"); copy($file['path'], $this->target_dir_absolute . "/" . basename($file['path'])); $content = $this->target_dir_relative . "/" . basename($file['path']); $this->xmlElement("Content", null, $content); $this->xmlEndTag("Attachment"); } } //Used for nested postings //$lastDepth = $rowPost->depth; $this->xmlEndTag("Post"); } /* // Used for nested postings if( $lastDepth ) { for( $i = 1; $i <= $lastDepth ; $i++ ) { $this->xmlEndTag("Post"); } $lastDepth = null; }*/ $this->xmlEndTag("Thread"); } $this->xmlEndTag("Forum"); return true; }
/** * Checks whether or not the new title of an existing floorplan is not already taken. * The new title of a floorplan should of course not collide with its current title. * * @param string $a_title the new title that is about to be set * @param string $a_file_id the id of the floorplan whose name is about to be changed * * @return boolean true, if the name is taken; false otherwise */ private function isTitleForUpdateAlreadyTaken($a_title, $a_file_id) { $taken = false; $media_obj = new ilObjMediaObject($a_file_id); $old_title = $media_obj->getTitle(); if ($a_title != $old_title) { $taken = $this->isTitleAlreadyTaken($a_title); } return $taken; }
/** * @param $value * @param ilDataCollectionRecordField $record_field * @param bool|true $link * @return int|string */ public function parseSortingValue($value, ilDataCollectionRecordField $record_field, $link = true) { switch ($this->id) { case self::INPUTFORMAT_DATETIME: return strtotime($value); case self::INPUTFORMAT_FILE: if (!ilObject2::_exists($value) || ilObject2::_lookupType($value, false) != "file") { return ''; } $file_obj = new ilObjFile($value, false); return $file_obj->getTitle(); case self::INPUTFORMAT_MOB: $mob = new ilObjMediaObject($value, false); return $mob->getTitle(); case ilDataCollectionDatatype::INPUTFORMAT_TEXT: $arr_properties = $record_field->getField()->getProperties(); if ($arr_properties[ilDataCollectionField::PROPERTYID_URL]) { if ($json = json_decode($value)) { return $json->title ? $json->title : $json->link; } else { return $value; } } else { return $value; } default: return $value; } }