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


PHP ilObjMediaObject::_getMobsOfObject方法代码示例

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


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

示例1: getXmlExportHeadDependencies

 /**
  * Get head dependencies
  *
  * @param		string		entity
  * @param		string		target release
  * @param		array		ids
  * @return		array		array of array with keys "component", entity", "ids"
  */
 function getXmlExportHeadDependencies($a_entity, $a_target_release, $a_ids)
 {
     if ($a_entity == "pg") {
         // get all media objects and files of the page
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Modules/File/classes/class.ilObjFile.php";
         $mob_ids = array();
         $file_ids = array();
         foreach ($a_ids as $pg_id) {
             $pg_id = explode(":", $pg_id);
             // get media objects
             $mids = ilObjMediaObject::_getMobsOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($mids as $mid) {
                 if (ilObject::_lookupType($mid) == "mob") {
                     $mob_ids[] = $mid;
                 }
             }
             // get files
             $files = ilObjFile::_getFilesOfObject($pg_id[0] . ":pg", $pg_id[1]);
             foreach ($files as $file) {
                 if (ilObject::_lookupType($file) == "file") {
                     $file_ids[] = $file;
                 }
             }
         }
         return array(array("component" => "Services/MediaObjects", "entity" => "mob", "ids" => $mob_ids), array("component" => "Modules/File", "entity" => "file", "ids" => $file_ids));
     }
     return array();
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:37,代码来源:class.ilCOPageExporter.php

示例2: addMaterialTag

 /**
  * Creates an XML material tag from a plain text or xhtml text
  *
  * @param object $a_xml_writer Reference to the ILIAS XML writer
  * @param string $a_material plain text or html text containing the material
  * @return string XML material tag
  * @access public
  */
 function addMaterialTag(&$a_xml_writer, $a_material, $close_material_tag = TRUE, $add_mobs = TRUE, $attribs = NULL)
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $a_xml_writer->xmlStartTag("material", $attribs);
     $attrs = array("type" => "text/plain");
     if ($this->isHTML($a_material)) {
         $attrs["type"] = "text/xhtml";
     }
     $mattext = ilRTE::_replaceMediaObjectImageSrc($a_material, 0);
     $a_xml_writer->xmlElement("mattext", $attrs, $mattext);
     if ($add_mobs) {
         $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->getId());
         foreach ($mobs as $mob) {
             $mob_id = "il_" . IL_INST_ID . "_mob_" . $mob;
             if (strpos($mattext, $mob_id) !== FALSE) {
                 $mob_obj =& new ilObjMediaObject($mob);
                 $imgattrs = array("label" => $mob_id, "uri" => "objects/" . "il_" . IL_INST_ID . "_mob_" . $mob . "/" . $mob_obj->getTitle());
                 $a_xml_writer->xmlElement("matimage", $imgattrs, NULL);
             }
         }
     }
     if ($close_material_tag) {
         $a_xml_writer->xmlEndTag("material");
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:34,代码来源:class.ilObjSurvey.php

示例3: toJSON

 /**
  * Returns a JSON representation of the question
  */
 public function toJSON()
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $result = array();
     $result['id'] = (int) $this->getId();
     $result['type'] = (string) $this->getQuestionType();
     $result['title'] = (string) $this->getTitle();
     $result['question'] = $this->formatSAQuestion($this->getQuestion()) . '<br/>' . $this->getClozeText();
     $result['nr_of_tries'] = (int) $this->getNrOfTries();
     $result['shuffle'] = (bool) $this->getShuffle();
     $result['feedback'] = array("onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false), "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true));
     $gaps = array();
     foreach ($this->getGaps() as $key => $gap) {
         $items = array();
         foreach ($gap->getItems() as $item) {
             $jitem = array();
             $jitem['points'] = $item->getPoints();
             $jitem['value'] = $item->getAnswertext();
             $jitem['order'] = $item->getOrder();
             if ($gap->getType() == CLOZE_NUMERIC) {
                 $jitem['lowerbound'] = $item->getLowerBound();
                 $jitem['upperbound'] = $item->getUpperBound();
             } else {
                 $jitem['value'] = trim($jitem['value']);
             }
             array_push($items, $jitem);
         }
         if ($gap->getType() == CLOZE_TEXT || $gap->getType() == CLOZE_NUMERIC) {
             $jgap['size'] = $gap->getGapSize();
         }
         $jgap['shuffle'] = $gap->getShuffle();
         $jgap['type'] = $gap->getType();
         $jgap['item'] = $items;
         array_push($gaps, $jgap);
     }
     $result['gaps'] = $gaps;
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:43,代码来源:class.assClozeTest.php

示例4: toJSON

 /**
  * Returns a JSON representation of the question
  */
 public function toJSON()
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $result = array();
     $result['id'] = (int) $this->getId();
     $result['type'] = (string) $this->getQuestionType();
     $result['title'] = (string) $this->getTitle();
     $result['question'] = $this->formatSAQuestion($this->getQuestion());
     $result['text'] = (string) ilRTE::_replaceMediaObjectImageSrc($this->getErrorText(), 0);
     $result['nr_of_tries'] = (int) $this->getNrOfTries();
     $result['shuffle'] = (bool) $this->getShuffle();
     $result['feedback'] = array('onenotcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false)), 'allcorrect' => $this->formatSAQuestion($this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true)));
     $answers = array();
     foreach ($this->getErrorData() as $idx => $answer_obj) {
         array_push($answers, array("answertext_wrong" => (string) $answer_obj->text_wrong, "answertext_correct" => (string) $answer_obj->text_correct, "points" => (double) $answer_obj->points, "order" => (int) $idx + 1));
     }
     $result['correct_answers'] = $answers;
     $answers = array();
     $textarray = preg_split("/[\n\r]+/", $this->getErrorText());
     foreach ($textarray as $textidx => $text) {
         $items = preg_split("/\\s+/", trim($text));
         foreach ($items as $idx => $item) {
             if (substr($item, 0, 1) == "#") {
                 $item = substr($item, 1);
                 // #14115 - add position to correct answer
                 foreach ($result["correct_answers"] as $aidx => $answer) {
                     if ($answer["answertext_wrong"] == $item && !$answer["pos"]) {
                         $result["correct_answers"][$aidx]["pos"] = $this->getId() . "_" . $textidx . "_" . ($idx + 1);
                         break;
                     }
                 }
             }
             array_push($answers, array("answertext" => (string) ilUtil::prepareFormOutput($item), "order" => $this->getId() . "_" . $textidx . "_" . ($idx + 1)));
         }
         if ($textidx != sizeof($textarray) - 1) {
             array_push($answers, array("answertext" => "###", "order" => $this->getId() . "_" . $textidx . "_" . ($idx + 2)));
         }
     }
     $result['answers'] = $answers;
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:46,代码来源:class.assErrorText.php

示例5: exportXHTMLMediaObjects

 function exportXHTMLMediaObjects($a_export_dir)
 {
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mobs = ilObjMediaObject::_getMobsOfObject("tst:html", $this->test_obj->getId());
     foreach ($mobs as $mob) {
         if (ilObjMediaObject::_exists($mob)) {
             $mob_obj =& new ilObjMediaObject($mob);
             $mob_obj->exportFiles($a_export_dir);
             unset($mob_obj);
         }
     }
     foreach ($this->test_obj->questions as $question_id) {
         $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $question_id);
         foreach ($mobs as $mob) {
             if (ilObjMediaObject::_exists($mob)) {
                 $mob_obj =& new ilObjMediaObject($mob);
                 $mob_obj->exportFiles($a_export_dir);
                 unset($mob_obj);
             }
         }
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:22,代码来源:class.ilTestExport.php

示例6: getLastUpdateOfIncludedElements

 function getLastUpdateOfIncludedElements()
 {
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $mobs = ilObjMediaObject::_getMobsOfObject($this->getParentType() . ":pg", $this->getId());
     $files = ilObjFile::_getFilesOfObject($this->getParentType() . ":pg", $this->getId());
     $objs = array_merge($mobs, $files);
     return ilObject::_getLastUpdateOfObjects($objs);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:9,代码来源:class.ilPageObject.php

示例7: collectPageElements

 /**
  * Collect page elements (that need to be exported separately)
  *
  * @param string $a_pg_type page type
  * @param int $a_pg_id page id
  */
 function collectPageElements($a_type, $a_id)
 {
     // collect media objects
     $pg_mobs = ilObjMediaObject::_getMobsOfObject($a_type, $a_id);
     foreach ($pg_mobs as $pg_mob) {
         $this->mobs[$pg_mob] = $pg_mob;
     }
     // collect all files
     include_once "./Modules/File/classes/class.ilObjFile.php";
     $files = ilObjFile::_getFilesOfObject($a_type, $a_id);
     foreach ($files as $f) {
         $this->files[$f] = $f;
     }
     $skill_tree = $ws_tree = null;
     $pcs = ilPageContentUsage::getUsagesOfPage($a_id, $a_type);
     foreach ($pcs as $pc) {
         // skils
         if ($pc["type"] == "skmg") {
             $skill_id = $pc["id"];
             // get user id from portfolio page
             include_once "Services/Portfolio/classes/class.ilPortfolioPage.php";
             $page = new ilPortfolioPage(0, $a_id);
             $user_id = $page->create_user;
             // we only need 1 instance each
             if (!$skill_tree) {
                 include_once "Services/Skill/classes/class.ilSkillTree.php";
                 $skill_tree = new ilSkillTree();
                 include_once "Services/Skill/classes/class.ilPersonalSkill.php";
                 include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
                 $ws_tree = new ilWorkspaceTree($user_id);
             }
             // walk skill tree
             $b_skills = ilSkillTreeNode::getSkillTreeNodes($skill_id, true);
             foreach ($b_skills as $bs) {
                 $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
                 $level_data = $skill->getLevelData();
                 foreach ($level_data as $k => $v) {
                     // get assigned materials from personal skill
                     $mat = ilPersonalSkill::getAssignedMaterial($user_id, $bs["tref"], $v["id"]);
                     if (sizeof($mat)) {
                         foreach ($mat as $item) {
                             $wsp_id = $item["wsp_id"];
                             $obj_id = $ws_tree->lookupObjectId($wsp_id);
                             // all possible material types for now
                             switch (ilObject::_lookupType($obj_id)) {
                                 case "file":
                                     $this->files[$obj_id] = $obj_id;
                                     break;
                                 case "tstv":
                                     include_once "Modules/Test/classes/class.ilObjTestVerification.php";
                                     $obj = new ilObjTestVerification($obj_id, false);
                                     $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                     break;
                                 case "excv":
                                     include_once "Modules/Exercise/classes/class.ilObjExerciseVerification.php";
                                     $obj = new ilObjExerciseVerification($obj_id, false);
                                     $this->files_direct[$obj_id] = array($obj->getFilePath(), $obj->getOfflineFilename());
                                     break;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:72,代码来源:class.ilCOPageHTMLExport.php

示例8: exportXHTMLMediaObjects

 function exportXHTMLMediaObjects($a_export_dir)
 {
     global $ilBench;
     $ilBench->start("SurveyExport", "exportXHTMLMediaObjects");
     include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
     $mobs = ilObjMediaObject::_getMobsOfObject("svy:html", $this->survey_obj->getId());
     foreach ($mobs as $mob) {
         $mob_obj =& new ilObjMediaObject($mob);
         $mob_obj->exportFiles($a_export_dir);
         unset($mob_obj);
     }
     // #14850
     foreach ($this->survey_obj->questions as $question_id) {
         $mobs = ilObjMediaObject::_getMobsOfObject("spl:html", $question_id);
         foreach ($mobs as $mob) {
             $mob_obj =& new ilObjMediaObject($mob);
             $mob_obj->exportFiles($a_export_dir);
             unset($mob_obj);
         }
     }
     $ilBench->stop("SurveyExport", "exportXHTMLMediaObjects");
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilSurveyExport.php

示例9: viewThreadObject

 public function viewThreadObject()
 {
     /**
      * @var $tpl ilTemplate
      * @var $lng ilLanguage
      * @var $ilUser ilObjUser
      * @var $ilAccess ilAccessHandler
      * @var $rbacreview ilRbacReview
      * @var $ilNavigationHistory ilNavigationHistory
      * @var $ilCtrl ilCtrl
      * @var $ilToolbar ilToolbarGUI
      */
     global $tpl, $lng, $ilUser, $ilAccess, $rbacreview, $ilNavigationHistory, $ilCtrl, $frm, $ilToolbar, $ilLocator;
     $tpl->addCss('./Modules/Forum/css/forum_tree.css');
     if (!isset($_SESSION['viewmode'])) {
         $_SESSION['viewmode'] = $this->objProperties->getDefaultView();
     }
     // quick and dirty: check for treeview
     if (!isset($_SESSION['thread_control']['old'])) {
         $_SESSION['thread_control']['old'] = $_GET['thr_pk'];
         $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
     } else {
         if (isset($_SESSION['thread_control']['old']) && $_GET['thr_pk'] != $_SESSION['thread_control']['old']) {
             $_SESSION['thread_control']['new'] = $_GET['thr_pk'];
         }
     }
     if (isset($_GET['viewmode']) && $_GET['viewmode'] != $_SESSION['viewmode']) {
         $_SESSION['viewmode'] = $_GET['viewmode'];
     }
     if (isset($_GET['action']) && $_SESSION['viewmode'] != ilForumProperties::VIEW_DATE || $_SESSION['viewmode'] == ilForumProperties::VIEW_TREE) {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_TREE;
     } else {
         $_SESSION['viewmode'] = ilForumProperties::VIEW_DATE;
     }
     if (!$ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $this->ilias->raiseError($lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
     }
     // init objects
     $oForumObjects = $this->getForumObjects();
     /**
      * @var $forumObj ilObjForum
      */
     $forumObj = $oForumObjects['forumObj'];
     /**
      * @var $frm ilForum
      */
     $frm = $oForumObjects['frm'];
     /**
      * @var $file_obj ilFileDataForum
      */
     $file_obj = $oForumObjects['file_obj'];
     // download file
     if ($_GET['file']) {
         if (!($path = $file_obj->getFileDataByMD5Filename($_GET['file']))) {
             ilUtil::sendFailure($this->lng->txt('error_reading_file'));
         } else {
             ilUtil::deliverFile($path['path'], $path['clean_filename']);
         }
     }
     if (!$this->objCurrentTopic->getId()) {
         $ilCtrl->redirect($this, 'showThreads');
     }
     // Set context for login
     $append = '_' . $this->objCurrentTopic->getId() . ($this->objCurrentPost->getId() ? '_' . $this->objCurrentPost->getId() : '');
     $tpl->setLoginTargetPar('frm_' . $_GET['ref_id'] . $append);
     // delete temporary media object (not in case a user adds media objects and wants to save an invalid form)
     if ($_GET['action'] != 'showreply' && $_GET['action'] != 'showedit') {
         try {
             include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
             $mobs = ilObjMediaObject::_getMobsOfObject('frm~:html', $ilUser->getId());
             foreach ($mobs as $mob) {
                 if (ilObjMediaObject::_exists($mob)) {
                     ilObjMediaObject::_removeUsage($mob, 'frm~:html', $ilUser->getId());
                     $mob_obj = new ilObjMediaObject($mob);
                     $mob_obj->delete();
                 }
             }
         } catch (Exception $e) {
         }
     }
     require_once './Modules/Forum/classes/class.ilObjForum.php';
     require_once './Modules/Forum/classes/class.ilFileDataForum.php';
     $lng->loadLanguageModule('forum');
     // add entry to navigation history
     if (!$this->getCreationMode() && $ilAccess->checkAccess('read', '', $this->object->getRefId())) {
         $ilCtrl->setParameter($this, 'thr_pk', $this->objCurrentTopic->getId());
         $ilNavigationHistory->addItem($this->object->getRefId(), $ilCtrl->getLinkTarget($this, 'showThreads'), 'frm');
     }
     // save last access
     $forumObj->updateLastAccess($ilUser->getId(), (int) $this->objCurrentTopic->getId());
     $this->prepareThreadScreen($forumObj);
     $tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.forums_threads_view.html', 'Modules/Forum');
     if (isset($_GET['anchor'])) {
         $tpl->setVariable('JUMP2ANCHOR_ID', (int) $_GET['anchor']);
     }
     if ($_SESSION['viewmode'] == 'date' || $_SESSION['viewmode'] == ilForumProperties::VIEW_DATE) {
         $orderField = 'frm_posts_tree.fpt_date';
         $this->objCurrentTopic->setOrderDirection(in_array($this->objProperties->getDefaultView(), array(ilForumProperties::VIEW_DATE_ASC, ilForumProperties::VIEW_TREE)) ? 'ASC' : 'DESC');
     } else {
         $orderField = 'frm_posts_tree.rgt';
//.........这里部分代码省略.........
开发者ID:bheyser,项目名称:qplskl,代码行数:101,代码来源:class.ilObjForumGUI.php

示例10: exportHTMLGlossaryTerms

 /**
  * export glossary terms
  */
 function exportHTMLGlossaryTerms(&$a_glo_gui, $a_target_dir)
 {
     global $ilUser;
     include_once "./Services/COPage/classes/class.ilCOPageHTMLExport.php";
     $copage_export = new ilCOPageHTMLExport($a_target_dir);
     $copage_export->exportSupportScripts();
     // index.html file
     $a_glo_gui->tpl = new ilTemplate("tpl.main.html", true, true);
     $style_name = $ilUser->prefs["style"] . ".css";
     $a_glo_gui->tpl->setVariable("LOCATION_STYLESHEET", "./" . $style_name);
     $a_glo_gui->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
     $a_glo_gui->tpl->setTitle($this->getTitle());
     $content = $a_glo_gui->listTerms();
     $file = $a_target_dir . "/index.html";
     // open file
     if (!($fp = @fopen($file, "w+"))) {
         die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
     }
     chmod($file, 0770);
     fwrite($fp, $content);
     fclose($fp);
     $terms = $this->getTermList();
     $this->offline_mobs = array();
     $this->offline_files = array();
     foreach ($terms as $term) {
         $a_glo_gui->tpl = new ilTemplate("tpl.main.html", true, true);
         $a_glo_gui->tpl = $copage_export->getPreparedMainTemplate();
         //$tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
         // set style
         $style_name = $ilUser->prefs["style"] . ".css";
         $a_glo_gui->tpl->setVariable("LOCATION_STYLESHEET", "./" . $style_name);
         $_GET["term_id"] = $term["id"];
         $_GET["frame"] = "_blank";
         $content =& $a_glo_gui->listDefinitions($_GET["ref_id"], $term["id"], false);
         $file = $a_target_dir . "/term_" . $term["id"] . ".html";
         // open file
         if (!($fp = @fopen($file, "w+"))) {
             die("<b>Error</b>: Could not open \"" . $file . "\" for writing" . " in <b>" . __FILE__ . "</b> on line <b>" . __LINE__ . "</b><br />");
         }
         chmod($file, 0770);
         fwrite($fp, $content);
         fclose($fp);
         // store linked/embedded media objects of glosssary term
         include_once "./Modules/Glossary/classes/class.ilGlossaryDefinition.php";
         $defs = ilGlossaryDefinition::getDefinitionList($term["id"]);
         foreach ($defs as $def) {
             $def_mobs = ilObjMediaObject::_getMobsOfObject("gdf:pg", $def["id"]);
             foreach ($def_mobs as $def_mob) {
                 $this->offline_mobs[$def_mob] = $def_mob;
             }
             // get all files of page
             include_once "./Modules/File/classes/class.ilObjFile.php";
             $def_files = ilObjFile::_getFilesOfObject("gdf:pg", $def["id"]);
             $this->offline_files = array_merge($this->offline_files, $def_files);
         }
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:60,代码来源:class.ilObjGlossary.php

示例11: toJSON

 /**
  * Returns a JSON representation of the question
  * TODO
  */
 public function toJSON()
 {
     $result = array();
     $result['id'] = (int) $this->getId();
     $result['type'] = (string) $this->getQuestionType();
     $result['title'] = (string) $this->getTitle();
     $result['question'] = $this->formatSAQuestion($this->getQuestion());
     $result['nr_of_tries'] = (int) $this->getNrOfTries();
     $result['matching_mode'] = $this->getMatchingMode();
     $result['shuffle'] = true;
     $result['feedback'] = array("onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false), "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true));
     $terms = array();
     foreach ($this->getTerms() as $term) {
         $terms[] = array("text" => $term->text, "id" => (int) $term->identifier);
     }
     $result['terms'] = $terms;
     // alex 9.9.2010 as a fix for bug 6513 I added the question id
     // to the "def_id" in the array. The $pair->definition->identifier is not
     // unique, since it gets it value from the morder table field
     // this value is not changed, when a question is copied.
     // thus copying the same question on a page results in problems
     // when the second one (the copy) is answered.
     $definitions = array();
     foreach ($this->getDefinitions() as $def) {
         $definitions[] = array("text" => (string) $def->text, "id" => (int) $this->getId() . $def->identifier);
     }
     $result['definitions'] = $definitions;
     // #10353
     $matchings = array();
     foreach ($this->getMatchingPairs() as $pair) {
         $pid = $pair->definition->identifier;
         if ($this->getMatchingMode() == self::MATCHING_MODE_N_ON_N) {
             $pid .= '::' . $pair->term->identifier;
         }
         if (!isset($matchings[$pid]) || $matchings[$pid]["points"] < $pair->points) {
             $matchings[$pid] = array("term_id" => (int) $pair->term->identifier, "def_id" => (int) $this->getId() . $pair->definition->identifier, "points" => (int) $pair->points);
         }
     }
     $result['matchingPairs'] = array_values($matchings);
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     global $lng;
     $lng->loadLanguageModule('assessment');
     $result['reset_button_label'] = $lng->txt("reset_terms");
     return json_encode($result);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:50,代码来源:class.assMatchingQuestion.php

示例12: start

    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);
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilForumXMLWriter.php

示例13: toJSON

 /**
  * Returns a JSON representation of the question
  */
 public function toJSON()
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $result = array();
     $result['id'] = (int) $this->getId();
     $result['type'] = (string) $this->getQuestionType();
     $result['title'] = (string) $this->getTitle();
     $result['question'] = $this->formatSAQuestion($this->getQuestion());
     $result['nr_of_tries'] = (int) $this->getNrOfTries();
     $result['shuffle'] = (bool) true;
     $result['points'] = (bool) $this->getPoints();
     $result['feedback'] = array("onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false), "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true));
     $arr = array();
     foreach ($this->getOrderingElements() as $order => $answer) {
         array_push($arr, array("answertext" => (string) $answer, "order" => (int) $order + 1));
     }
     $result['answers'] = $arr;
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:24,代码来源:class.assOrderingHorizontal.php

示例14: toJSON

 /**
  * Returns a JSON representation of the question
  * TODO
  */
 public function toJSON()
 {
     include_once "./Services/RTE/classes/class.ilRTE.php";
     $result = array();
     $result['id'] = (int) $this->getId();
     $result['type'] = (string) $this->getQuestionType();
     $result['title'] = (string) $this->getTitle();
     $result['question'] = $this->formatSAQuestion($this->getQuestion());
     $result['nr_of_tries'] = (int) $this->getNrOfTries();
     $result['shuffle'] = true;
     $result['feedback'] = array("onenotcorrect" => nl2br(ilRTE::_replaceMediaObjectImageSrc($this->getFeedbackGeneric(0), 0)), "allcorrect" => nl2br(ilRTE::_replaceMediaObjectImageSrc($this->getFeedbackGeneric(1), 0)));
     $terms = array("" => array("id" => "-1", "term" => $this->lng->txt("please_select")));
     foreach ($this->getTerms() as $term) {
         $terms[(int) $term->identifier] = array("term" => $term->text, "id" => (int) $term->identifier);
     }
     // $terms = $this->pcArrayShuffle($terms);
     // alex 9.9.2010 as a fix for bug 6513 I added the question id
     // to the "def_id" in the array. The $pair->definition->identifier is not
     // unique, since it gets it value from the morder table field
     // this value is not changed, when a question is copied.
     // thus copying the same question on a page results in problems
     // when the second one (the copy) is answered.
     $pairs = array();
     foreach ($this->getDefinitions() as $def) {
         array_push($pairs, array("definition" => (string) $def->text, "def_id" => (int) $this->getId() . $def->identifier, "terms" => $terms));
     }
     $result['pairs'] = $pairs;
     // #10353
     $match = $points = array();
     foreach ($this->getMatchingPairs() as $pair) {
         $pid = $pair->definition->identifier;
         // we only need pairs with max. points for def-id
         if (!isset($match[$pid]) || $match[$pid]["points"] < $pair->points) {
             $match[$pid] = array("term_id" => (int) $pair->term->identifier, "def_id" => (int) $this->getId() . $pair->definition->identifier, "points" => (int) $pair->points);
         }
     }
     $result['match'] = array_values($match);
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:45,代码来源:class.assMatchingQuestion.php

示例15: deletePost

    /**
     * delete post and sub-posts
     * @param	integer	$post: ID	
     * @access	public
     * @return	integer	0 or thread-ID
     */
    public function deletePost($post)
    {
        global $ilDB;
        include_once "./Modules/Forum/classes/class.ilObjForum.php";
        // delete tree and get id's of all posts to delete
        $p_node = $this->getPostNode($post);
        $del_id = $this->deletePostTree($p_node);
        // Delete User read entries
        foreach ($del_id as $post_id) {
            ilObjForum::_deleteReadEntries($post_id);
        }
        // DELETE ATTACHMENTS ASSIGNED TO POST
        $this->__deletePostFiles($del_id);
        $dead_pos = count($del_id);
        $dead_thr = 0;
        // if deletePost is thread opener ...
        if ($p_node["parent"] == 0) {
            // delete thread access data
            include_once './Modules/Forum/classes/class.ilObjForum.php';
            ilObjForum::_deleteAccessEntries($p_node['tree']);
            // delete thread
            $dead_thr = $p_node["tree"];
            $statement = $ilDB->manipulateF('
				DELETE FROM frm_threads
				WHERE thr_pk = %s', array('integer'), array($p_node['tree']));
            // update num_threads
            $statement = $ilDB->manipulateF('
				UPDATE frm_data 
				SET top_num_threads = top_num_threads - 1 
				WHERE top_frm_fk = %s', array('integer'), array($this->id));
            // delete all related news
            $posset = $ilDB->queryf('
				SELECT * FROM frm_posts
				WHERE pos_thr_fk = %s', array('integer'), array($p_node['tree']));
            while ($posrec = $ilDB->fetchAssoc($posset)) {
                include_once "./Services/News/classes/class.ilNewsItem.php";
                $news_id = ilNewsItem::getFirstNewsIdForContext($this->id, "frm", $posrec["pos_pk"], "pos");
                if ($news_id > 0) {
                    $news_item = new ilNewsItem($news_id);
                    $news_item->delete();
                }
                try {
                    include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
                    $mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $posrec['pos_pk']);
                    foreach ($mobs as $mob) {
                        if (ilObjMediaObject::_exists($mob)) {
                            ilObjMediaObject::_removeUsage($mob, 'frm:html', $posrec['pos_pk']);
                            $mob_obj = new ilObjMediaObject($mob);
                            $mob_obj->delete();
                        }
                    }
                } catch (Exception $e) {
                }
            }
            // delete all posts of this thread
            $statement = $ilDB->manipulateF('
				DELETE FROM frm_posts
				WHERE pos_thr_fk = %s', array('integer'), array($p_node['tree']));
        } else {
            // delete this post and its sub-posts
            for ($i = 0; $i < $dead_pos; $i++) {
                $statement = $ilDB->manipulateF('
					DELETE FROM frm_posts
					WHERE pos_pk = %s', array('integer'), array($del_id[$i]));
                // delete related news item
                include_once "./Services/News/classes/class.ilNewsItem.php";
                $news_id = ilNewsItem::getFirstNewsIdForContext($this->id, "frm", $del_id[$i], "pos");
                if ($news_id > 0) {
                    $news_item = new ilNewsItem($news_id);
                    $news_item->delete();
                }
                try {
                    include_once 'Services/MediaObjects/classes/class.ilObjMediaObject.php';
                    $mobs = ilObjMediaObject::_getMobsOfObject('frm:html', $del_id[$i]);
                    foreach ($mobs as $mob) {
                        if (ilObjMediaObject::_exists($mob)) {
                            ilObjMediaObject::_removeUsage($mob, 'frm:html', $del_id[$i]);
                            $mob_obj = new ilObjMediaObject($mob);
                            $mob_obj->delete();
                        }
                    }
                } catch (Exception $e) {
                }
            }
            // update num_posts in frm_threads
            $statement = $ilDB->manipulateF('
				UPDATE frm_threads
				SET thr_num_posts = thr_num_posts - %s
				WHERE thr_pk = %s', array('integer', 'integer'), array($dead_pos, $p_node['tree']));
            // get latest post of thread and update last_post
            $res1 = $ilDB->queryf('
				SELECT * FROM frm_posts 
				WHERE pos_thr_fk = %s
				ORDER BY pos_date DESC', array('integer'), array($p_node['tree']));
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilForum.php


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