Exemplo n.º 1
0
 /**
  * add standard meta data sections
  */
 function addMetaDataSections($a_rep_obj_id, $a_obj_id, $a_type)
 {
     global $lng;
     $lng->loadLanguageModule("meta");
     include_once "./Services/MetaData/classes/class.ilMD.php";
     $md = new ilMD($a_rep_obj_id, $a_obj_id, $a_type);
     if ($md_gen = $md->getGeneral()) {
         // get first descrption
         // The description is shown on the top of the page.
         // Thus it is not necessary to show it again.
         foreach ($md_gen->getDescriptionIds() as $id) {
             $md_des = $md_gen->getDescription($id);
             $description = $md_des->getDescription();
             break;
         }
         // get language(s)
         $langs = array();
         foreach ($ids = $md_gen->getLanguageIds() as $id) {
             $md_lan = $md_gen->getLanguage($id);
             if ($md_lan->getLanguageCode() != "") {
                 $langs[] = $lng->txt("meta_l_" . $md_lan->getLanguageCode());
             }
         }
         $langs = implode($langs, ", ");
         // keywords
         $keywords = array();
         foreach ($ids = $md_gen->getKeywordIds() as $id) {
             $md_key = $md_gen->getKeyword($id);
             $keywords[] = $md_key->getKeyword();
         }
         $keywords = implode($keywords, ", ");
     }
     // authors
     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 = ", ";
                 }
             }
         }
     }
     // copyright
     $copyright = "";
     if (is_object($rights = $md->getRights())) {
         include_once 'Services/MetaData/classes/class.ilMDUtils.php';
         $copyright = ilMDUtils::_parseCopyright($rights->getDescription());
     }
     // learning time
     #if(is_object($educational = $md->getEducational()))
     #{
     #	$learning_time = $educational->getTypicalLearningTime();
     #}
     $learning_time = "";
     if (is_object($educational = $md->getEducational())) {
         if ($seconds = $educational->getTypicalLearningTimeSeconds()) {
             $learning_time = ilFormat::_secondsToString($seconds);
         }
     }
     // output
     // description
     if ($description != "") {
         $this->addSection($lng->txt("description"));
         $this->addProperty("", nl2br($description));
     }
     // general section
     $this->addSection($lng->txt("meta_general"));
     if ($langs != "") {
         $this->addProperty($lng->txt("language"), $langs);
     }
     if ($keywords != "") {
         $this->addProperty($lng->txt("keywords"), $keywords);
     }
     if ($author != "") {
         $this->addProperty($lng->txt("author"), $author);
     }
     if ($copyright != "") {
         $this->addProperty($lng->txt("meta_copyright"), $copyright);
     }
     if ($learning_time != "") {
         $this->addProperty($lng->txt("meta_typical_learning_time"), $learning_time);
     }
 }
Exemplo n.º 2
0
 /**
  * show download list
  */
 function showDownloadList()
 {
     //$this->tpl = new ilTemplate("tpl.lm_toc.html", true, true, true);
     $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();
     $this->renderPageTitle();
     $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
     $this->tpl->getStandardTemplate();
     $this->tpl->setVariable("TABS", $this->lm_gui->setilLMMenu($this->offlineMode(), $this->getExportFormat(), "download", true));
     $this->ilLocator();
     //$this->tpl->stopTitleFloating();
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.lm_download_list.html", "Modules/LearningModule");
     // set title header
     $this->tpl->setTitle($this->lm->getTitle());
     $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
     /*
     		$this->tpl->setVariable("TXT_BACK", $this->lng->txt("back"));
     		$this->ctrl->setParameter($this, "obj_id", $_GET["obj_id"]);
     		$this->tpl->setVariable("LINK_BACK",
     			$this->ctrl->getLinkTarget($this, "")); */
     // output copyright information
     include_once 'Services/MetaData/classes/class.ilMD.php';
     $md = new ilMD($this->lm->getId(), 0, $this->lm->getType());
     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();
         }
     }
     // create table
     require_once "./Services/Table/classes/class.ilTableGUI.php";
     $tbl = new ilTableGUI();
     // load files templates
     $this->tpl->addBlockfile("DOWNLOAD_TABLE", "download_table", "tpl.table.html");
     // load template for table content data
     $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule");
     $export_files = array();
     $types = array("xml", "html", "scorm");
     foreach ($types as $type) {
         if ($this->lm->getPublicExportFile($type) != "") {
             if (is_file($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type))) {
                 $dir = $this->lm->getExportDirectory($type);
                 $size = filesize($this->lm->getExportDirectory($type) . "/" . $this->lm->getPublicExportFile($type));
                 $export_files[] = array("type" => $type, "file" => $this->lm->getPublicExportFile($type), "size" => $size);
             }
         }
     }
     $num = 0;
     $tbl->setTitle($this->lng->txt("download"));
     $tbl->setHeaderNames(array($this->lng->txt("cont_format"), $this->lng->txt("cont_file"), $this->lng->txt("size"), $this->lng->txt("date"), ""));
     $cols = array("format", "file", "size", "date", "download");
     $header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"], "cmd" => "showDownloadList", "cmdClass" => strtolower(get_class($this)));
     $tbl->setHeaderVars($cols, $header_params);
     $tbl->setColumnWidth(array("10%", "30%", "20%", "20%", "20%"));
     $tbl->disable("sort");
     // control
     $tbl->setOrderColumn($_GET["sort_by"]);
     $tbl->setOrderDirection($_GET["sort_order"]);
     $tbl->setLimit($_GET["limit"]);
     $tbl->setOffset($_GET["offset"]);
     $tbl->setMaxCount($this->maxcount);
     // ???
     //$this->tpl->setVariable("COLUMN_COUNTS", 5);
     // footer
     //$tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
     $tbl->disable("footer");
     $tbl->setMaxCount(count($export_files));
     $export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
     $tbl->render();
     if (count($export_files) > 0) {
         $i = 0;
         foreach ($export_files as $exp_file) {
             if (!$exp_file["size"] > 0) {
                 continue;
             }
             $this->tpl->setCurrentBlock("tbl_content");
             $this->tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
             $css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
             $this->tpl->setVariable("CSS_ROW", $css_row);
             $this->tpl->setVariable("TXT_SIZE", $exp_file["size"]);
             $this->tpl->setVariable("TXT_FORMAT", strtoupper($exp_file["type"]));
             $this->tpl->setVariable("CHECKBOX_ID", $exp_file["type"] . ":" . $exp_file["file"]);
             $file_arr = explode("__", $exp_file["file"]);
             $this->tpl->setVariable("TXT_DATE", date("Y-m-d H:i:s", $file_arr[0]));
             $this->tpl->setVariable("TXT_DOWNLOAD", $this->lng->txt("download"));
             $this->ctrl->setParameter($this, "type", $exp_file["type"]);
             $this->tpl->setVariable("LINK_DOWNLOAD", $this->ctrl->getLinkTarget($this, "downloadExportFile"));
             $this->tpl->parseCurrentBlock();
         }
     } else {
         $this->tpl->setCurrentBlock("notfound");
         $this->tpl->setVariable("TXT_OBJECT_NOT_FOUND", $this->lng->txt("obj_not_found"));
         $this->tpl->setVariable("NUM_COLS", 5);
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->show();
 }