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


PHP ilRTE::_replaceMediaObjectImageSrc方法代码示例

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


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

示例1: fromXML

 /**
  * Creates a question from a QTI file
  *
  * Receives parameters from a QTI parser and creates a valid ILIAS question object
  *
  * @param object $item The QTI item object
  * @param integer $questionpool_id The id of the parent questionpool
  * @param integer $tst_id The id of the parent test if the question is part of a test
  * @param object $tst_object A reference to the parent test object
  * @param integer $question_counter A reference to a question counter to count the questions of an imported question pool
  * @param array $import_mapping An array containing references to included ILIAS objects
  * @access public
  */
 function fromXML(&$item, $questionpool_id, &$tst_id, &$tst_object, &$question_counter, &$import_mapping)
 {
     global $ilUser;
     // empty session variable for imported xhtml mobs
     unset($_SESSION["import_mob_xhtml"]);
     $presentation = $item->getPresentation();
     $duration = $item->getDuration();
     $now = getdate();
     $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
     $feedbacksgeneric = array();
     $this->addGeneralMetadata($item);
     $this->object->setTitle($item->getTitle());
     $this->object->setNrOfTries($item->getMaxattempts());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     $this->object->setPoints($item->getMetadataEntry("points"));
     $this->object->setOrderText($item->getMetadataEntry("ordertext"));
     $this->object->setTextSize($item->getMetadataEntry("textsize"));
     $this->object->setSeparator($item->getMetadataEntry("separator"));
     // additional content editing mode information
     $this->object->setAdditionalContentEditingMode($this->fetchAdditionalContentEditingModeInformation($item));
     $this->object->saveToDb();
     // handle the import of media objects in XHTML code
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 $importfile = $this->getTstImportArchivDirectory() . '/' . $mob["uri"];
             } else {
                 $importfile = $this->getQplImportArchivDirectory() . '/' . $mob["uri"];
             }
             $GLOBALS['ilLog']->write(__METHOD__ . ': import mob from dir: ' . $importfile);
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true, null, null, null, $tst_id);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:73,代码来源:class.assOrderingHorizontalImport.php

示例2: parse

 protected function parse()
 {
     $peer_data = array();
     if ($this->show_peer_review) {
         $peer_data = $this->ass->getAllPeerReviews();
     }
     include_once "Services/User/classes/class.ilUserUtil.php";
     include_once "Services/RTE/classes/class.ilRTE.php";
     foreach (ilExAssignment::getAllDeliveredFiles($this->ass->getExerciseId(), $this->ass->getId()) as $file) {
         if (trim($file["atext"])) {
             $data[$file["user_id"]] = array("uid" => $file["user_id"], "uname" => ilUserUtil::getNamePresentation($file["user_id"]), "udate" => $file["ts"], "utext" => ilRTE::_replaceMediaObjectImageSrc($file["atext"], 1));
             if (isset($peer_data[$file["user_id"]])) {
                 $data[$file["user_id"]]["peer"] = $peer_data[$file["user_id"]];
             }
         }
     }
     $this->setData($data);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:18,代码来源:class.ilExAssignmentListTextTableGUI.php

示例3: importXmlRepresentation

 /**
  * Import XML
  *
  * @param
  * @return
  */
 function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
 {
     // Container import => test object already created
     if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_id)) {
         $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
         #$newObj->setImportDirectory(dirname(rtrim($this->getImportDirectory(),'/')));
     } else {
         // Shouldn't happen
         $GLOBALS['ilLog']->write(__METHOD__ . ': Called in non container mode');
         return false;
     }
     include_once "./Services/Survey/classes/class.SurveyImportParser.php";
     list($xml_file) = $this->parseXmlFileNames();
     if (!@file_exists($xml_file)) {
         $GLOBALS['ilLog']->write(__METHOD__ . ': Cannot find xml definition: ' . $xml_file);
         return false;
     }
     $import = new SurveyImportParser(-1, $xml_file, TRUE);
     $import->setSurveyObject($newObj);
     $import->startParsing();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             $importfile = dirname($xml_file) . "/" . $mob["uri"];
             if (file_exists($importfile)) {
                 $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
                 ilObjMediaObject::_saveUsage($media_object->getId(), "svy:html", $newObj->getId());
                 $newObj->setIntroduction(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $newObj->getIntroduction()));
                 $newObj->setOutro(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $newObj->getOutro()));
             } else {
                 global $ilLog;
                 $ilLog->write("Error: Could not open XHTML mob file for test introduction during test import. File {$importfile} does not exist!");
             }
         }
         $newObj->setIntroduction(ilRTE::_replaceMediaObjectImageSrc($newObj->getIntroduction(), 1));
         $newObj->setOutro(ilRTE::_replaceMediaObjectImageSrc($newObj->getOutro(), 1));
         $newObj->saveToDb();
     }
     $a_mapping->addMapping("Modules/Survey", "svy", $a_id, $newObj->getId());
     return true;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:49,代码来源:class.ilSurveyImporter.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: 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) $this->getShuffle();
     $result['feedback'] = array("onenotcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), false), "allcorrect" => $this->feedbackOBJ->getGenericFeedbackTestPresentation($this->getId(), true));
     $answers = array();
     $has_image = false;
     foreach ($this->getAnswers() as $key => $answer_obj) {
         if ((string) $answer_obj->getImage()) {
             $has_image = true;
         }
         array_push($answers, array("answertext" => (string) $answer_obj->getAnswertext(), "points" => (double) $answer_obj->getPoints(), "order" => (int) $answer_obj->getOrder(), "image" => (string) $answer_obj->getImage(), "feedback" => ilRTE::_replaceMediaObjectImageSrc($this->feedbackOBJ->getSpecificAnswerFeedbackExportPresentation($this->getId(), $key), 0)));
     }
     $result['answers'] = $answers;
     if ($has_image) {
         $result['path'] = $this->getImagePathWeb();
         $result['thumb'] = $this->getThumbSize();
     }
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:31,代码来源:class.assSingleChoice.php

示例6: fromXML


//.........这里部分代码省略.........
                                     foreach ($ifb->flow_mat as $fmat) {
                                         if (count($fmat->material)) {
                                             foreach ($fmat->material as $material) {
                                                 $feedbacksgeneric[1] = $material;
                                             }
                                         }
                                     }
                                 }
                             } else {
                                 if (strcmp($ifb->getIdent(), "response_onenotcorrect") == 0) {
                                     // found a feedback for the identifier
                                     if (count($ifb->material)) {
                                         foreach ($ifb->material as $material) {
                                             $feedbacksgeneric[0] = $material;
                                         }
                                     }
                                     if (count($ifb->flow_mat) > 0) {
                                         foreach ($ifb->flow_mat as $fmat) {
                                             if (count($fmat->material)) {
                                                 foreach ($fmat->material as $material) {
                                                     $feedbacksgeneric[0] = $material;
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->object->setTitle($item->getTitle());
     $this->object->setNrOfTries($item->getMaxattempts());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     $textrating = $item->getMetadataEntry("textrating");
     if (strlen($textrating) == 0) {
         $textrating = "ci";
     }
     $this->object->setTextRating($textgap_rating);
     $this->object->setCorrectAnswers($item->getMetadataEntry("correctanswers"));
     $response = current($responses);
     $counter = 0;
     if (is_array($response)) {
         foreach ($response as $answer) {
             $this->object->addAnswer($answer["solution"], $answer["points"], $counter);
             $counter++;
         }
     }
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     foreach ($feedbacksgeneric as $correctness => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacksgeneric[$correctness] = $m;
     }
     // handle the import of media objects in XHTML code
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 $importfile = $this->getTstImportArchivDirectory() . '/' . $mob["uri"];
             } else {
                 $importfile = $this->getQplImportArchivDirectory() . '/' . $mob["uri"];
             }
             $GLOBALS['ilLog']->write(__METHOD__ . ': import mob from dir: ' . $importfile);
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
             foreach ($feedbacksgeneric as $correctness => $material) {
                 $feedbacksgeneric[$correctness] = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $material);
             }
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     foreach ($feedbacksgeneric as $correctness => $material) {
         $this->object->saveFeedbackGeneric($correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
     }
     $this->object->saveToDb();
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true, null, null, null, $tst_id);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.assTextSubsetImport.php

示例7: loadFromDb

 /**
  * Loads a assJavaApplet object from a database
  *
  * Loads a assJavaApplet object from a database (experimental)
  *
  * @param object $db A pear DB object
  * @param integer $question_id A unique key which defines the multiple choice test in the database
  * @access public
  */
 function loadFromDb($question_id)
 {
     global $ilDB;
     $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
     if ($result->numRows() == 1) {
         $data = $ilDB->fetchAssoc($result);
         $this->setId($question_id);
         $this->setObjId($data["obj_fi"]);
         $this->setNrOfTries($data['nr_of_tries']);
         $this->setTitle($data["title"]);
         $this->setComment($data["description"]);
         $this->setOriginalId($data["original_id"]);
         $this->setAuthor($data["author"]);
         $this->setPoints($data["points"]);
         $this->setOwner($data["owner"]);
         include_once "./Services/RTE/classes/class.ilRTE.php";
         $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
         $this->setJavaAppletFilename($data["image_file"]);
         $this->splitParams($data["params"]);
         $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
     }
     parent::loadFromDb($question_id);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:32,代码来源:class.assJavaApplet.php

示例8: loadFromDb

 /**
  * Loads a assTextSubset object from a database
  *
  * @param object $db A pear DB object
  * @param integer $question_id A unique key which defines the multiple choice test in the database
  * @access public
  */
 function loadFromDb($question_id)
 {
     global $ilDB;
     $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
     if ($result->numRows() == 1) {
         $data = $ilDB->fetchAssoc($result);
         $this->setId($question_id);
         $this->setObjId($data["obj_fi"]);
         $this->setNrOfTries($data['nr_of_tries']);
         $this->setTitle($data["title"]);
         $this->setComment($data["description"]);
         $this->setOriginalId($data["original_id"]);
         $this->setAuthor($data["author"]);
         $this->setPoints($data["points"]);
         $this->setOwner($data["owner"]);
         include_once "./Services/RTE/classes/class.ilRTE.php";
         $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
         $this->setCorrectAnswers($data["correctanswers"]);
         $this->setTextRating($data["textgap_rating"]);
         $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
         try {
             $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
         } catch (ilTestQuestionPoolException $e) {
         }
     }
     $result = $ilDB->queryF("SELECT * FROM qpl_a_textsubset WHERE question_fi = %s ORDER BY aorder ASC", array('integer'), array($question_id));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerBinaryStateImage.php";
     if ($result->numRows() > 0) {
         while ($data = $ilDB->fetchAssoc($result)) {
             array_push($this->answers, new ASS_AnswerBinaryStateImage($data["answertext"], $data["points"], $data["aorder"]));
         }
     }
     parent::loadFromDb($question_id);
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:41,代码来源:class.assTextSubset.php

示例9: showItems

 public function showItems()
 {
     global $ilObjDataCache, $ilUser, $ilToolbar;
     include_once './Services/Payment/classes/class.ilPaymentPrices.php';
     include_once './Services/Payment/classes/class.ilPaymentCurrency.php';
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.pay_shopping_cart.html', 'Services/Payment');
     //		var_dump($_SESSION['shop_user_id']);
     //		if(isset($_SESSION['shop_user_id']))
     //		{
     //
     //			$this->user_obj->_toggleActiveStatusOfUsers(array($this->user_obj->getId()), 1);
     //		}
     if ($_SESSION['forceShoppingCartRedirect'] == '1') {
         $_SESSION['forceShoppingCartRedirect'] = 0;
         $this->tpl->touchBlock("close_js");
         return true;
     }
     $this->initShoppingCartObject();
     include_once './Services/Payment/classes/class.ilPaymentSettings.php';
     $genSet = ilPaymentSettings::_getInstance();
     $pay_methods = $this->_getPayMethods(true);
     $num_items = 0;
     $desc = array();
     //course_objects
     $is_crs_object = false;
     $crs_obj_ids = array();
     //file_objects,exercise_objects
     $is_file_object = false;
     // learning_modules,
     $is_lm_object = false;
     $lm_obj_ids = array();
     if ($genSet->get('show_sr_shoppingcart') == 1) {
         require_once 'Services/RTE/classes/class.ilRTE.php';
         $regulations = ilRTE::_replaceMediaObjectImageSrc($genSet->get('statutory_regulations'), 1);
         $this->tpl->setVariable('REGULATIONS_TITLE', $this->lng->txt('statutory_regulations'));
         $this->tpl->setVariable('REGULATIONS', $regulations);
     }
     $ilToolbar->addButton($this->lng->txt('payment_back_to_shop'), 'ilias.php?baseClass=ilShopController');
     foreach ($pay_methods as $pay_method) {
         $this->totalVat = 0;
         $tpl = new ilTemplate($this->_getTemplateFilename($pay_method['pm_title']), true, 'Services/Payment');
         $coupon_session_id = $pay_method['pm_title'];
         if (count($items = $this->psc_obj->getEntries($pay_method['pm_id']))) {
             $counter = 0;
             $paypal_counter = 0;
             $total_price = 0;
             foreach ($items as $item) {
                 $tmp_pobject = new ilPaymentObject($this->user_obj, $item['pobject_id']);
                 $obj_id = $ilObjDataCache->lookupObjId($tmp_pobject->getRefId());
                 $obj_type = $ilObjDataCache->lookupType($obj_id);
                 $obj_title = $ilObjDataCache->lookupTitle($obj_id);
                 $desc[] = "[" . $obj_type . "] " . $obj_title;
                 $price_arr = ilPaymentPrices::_getPrice($item['price_id']);
                 # checks object_type: needed for purchasing file or crs objects without login
                 switch ($obj_type) {
                     case 'crs':
                         // if is_crs there an user-account will be autogenerated
                         $is_crs_object = true;
                         $_SESSION['is_crs_object'] = true;
                         $crs_obj_ids[] = $obj_id;
                         $_SESSION['crs_obj_ids'] = $crs_obj_ids;
                         break;
                     case 'lm':
                     case 'sahs':
                     case 'htlm':
                     case 'tst':
                         $is_lm_object = true;
                         $_SESSION['is_lm_object'] = true;
                         $lm_obj_ids[] = $obj_id;
                         $_SESSION['lm_obj_ids'] = $lm_obj_ids;
                         break;
                     case 'exc':
                     case 'file':
                         $is_file_object = true;
                         break;
                     default:
                         break;
                 }
                 $direct_paypal_info_output = true;
                 $assigned_coupons = '';
                 if (!empty($_SESSION['coupons'][$coupon_session_id])) {
                     $price = $price_arr['price'];
                     $item['math_price'] = (double) $price;
                     foreach ($_SESSION['coupons'][$coupon_session_id] as $key => $coupon) {
                         $this->coupon_obj->setId($coupon['pc_pk']);
                         $this->coupon_obj->setCurrentCoupon($coupon);
                         if ($this->coupon_obj->isObjectAssignedToCoupon($tmp_pobject->getRefId())) {
                             $assigned_coupons .= $this->lng->txt('paya_coupons_coupon') . ': ' . $coupon['pcc_code'];
                             $_SESSION['coupons'][$coupon_session_id][$key]['total_objects_coupon_price'] += (double) $price;
                             $_SESSION['coupons'][$coupon_session_id][$key]['items'][] = $item;
                             $direct_paypal_info_output = false;
                         }
                     }
                 }
                 $f_result[$counter]['item'] = ilUtil::formCheckBox(0, 'item[]', $item['psc_id']);
                 $subtype = '';
                 if ($obj_type == 'exc') {
                     $subtype = ' (' . $this->lng->txt($tmp_pobject->getSubtype()) . ')';
                     $f_result[$counter]['title'] = "<a href=\"goto.php?target=" . $obj_type . "_" . $tmp_pobject->getRefId() . "\">" . $obj_title . "</a>" . $subtype;
                 } else {
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilShopShoppingCartGUI.php

示例10: fromXML


//.........这里部分代码省略.........
                                 if (count($ifb->material)) {
                                     foreach ($ifb->material as $material) {
                                         $feedbacksgeneric[0] = $material;
                                     }
                                 }
                                 if (count($ifb->flow_mat) > 0) {
                                     foreach ($ifb->flow_mat as $fmat) {
                                         if (count($fmat->material)) {
                                             foreach ($fmat->material as $material) {
                                                 $feedbacksgeneric[0] = $material;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $this->object->setTitle($item->getTitle());
     $this->object->setNrOfTries($item->getMaxattempts());
     $this->object->setComment($item->getComment());
     $this->object->setAuthor($item->getAuthor());
     $this->object->setOwner($ilUser->getId());
     $this->object->setQuestion($this->object->QTIMaterialToString($item->getQuestiontext()));
     $this->object->setObjId($questionpool_id);
     $this->object->setEstimatedWorkingTime($duration["h"], $duration["m"], $duration["s"]);
     $this->object->setJavaAppletFilename($applet->getUri());
     $this->object->setJavaWidth($applet->getWidth());
     $this->object->setJavaHeight($applet->getHeight());
     $this->object->setJavaCode($javacode);
     $this->object->setJavaCodebase($javacodebase);
     $this->object->setJavaArchive($javaarchive);
     $this->object->setPoints($maxpoints);
     foreach ($params as $pair) {
         $this->object->addParameter($pair["key"], $pair["value"]);
     }
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     $javaapplet =& base64_decode($applet->getContent());
     $javapath = $this->object->getJavaPath();
     if (!file_exists($javapath)) {
         include_once "./Services/Utilities/classes/class.ilUtil.php";
         ilUtil::makeDirParents($javapath);
     }
     $javapath .= $this->object->getJavaAppletFilename();
     $fh = fopen($javapath, "wb");
     if ($fh == false) {
         //									global $ilErr;
         //									$ilErr->raiseError($this->object->lng->txt("error_save_image_file") . ": $php_errormsg", $ilErr->MESSAGE);
         //									return;
     } else {
         $javafile = fwrite($fh, $javaapplet);
         fclose($fh);
     }
     // handle the import of media objects in XHTML code
     foreach ($feedbacksgeneric as $correctness => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacksgeneric[$correctness] = $m;
     }
     $questiontext = $this->object->getQuestion();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 $importfile = $this->getTstImportArchivDirectory() . '/' . $mob["uri"];
             } else {
                 $importfile = $this->getQplImportArchivDirectory() . '/' . $mob["uri"];
             }
             $GLOBALS['ilLog']->write(__METHOD__ . ': import mob from dir: ' . $importfile);
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
             foreach ($feedbacksgeneric as $correctness => $material) {
                 $feedbacksgeneric[$correctness] = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $material);
             }
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     foreach ($feedbacksgeneric as $correctness => $material) {
         $this->object->saveFeedbackGeneric($correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
     }
     $this->object->saveToDb();
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true, null, null, null, $tst_id);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.assJavaAppletImport.php

示例11: loadFromDb

 /**
  * Loads a assClozeTest object from a database
  *
  * @param integer $question_id A unique key which defines the cloze test in the database
  *
  */
 public function loadFromDb($question_id)
 {
     global $ilDB;
     $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
     if ($result->numRows() == 1) {
         $data = $ilDB->fetchAssoc($result);
         $this->setId($question_id);
         $this->setNrOfTries($data['nr_of_tries']);
         $this->setObjId($data["obj_fi"]);
         $this->setTitle($data["title"]);
         $this->setComment($data["description"]);
         $this->setOriginalId($data["original_id"]);
         $this->setAuthor($data["author"]);
         $this->setPoints($data["points"]);
         $this->setOwner($data["owner"]);
         $this->setQuestion($this->cleanQuestiontext($data["question_text"]));
         $this->setFixedTextLength($data["fixed_textlen"]);
         $this->setIdenticalScoring($data['tstamp'] == 0 ? true : $data["identical_scoring"]);
         // replacement of old syntax with new syntax
         include_once "./Services/RTE/classes/class.ilRTE.php";
         $this->question = ilRTE::_replaceMediaObjectImageSrc($this->question, 1);
         $this->setTextgapRating($data["textgap_rating"]);
         $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
         try {
             $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
         } catch (ilTestQuestionPoolException $e) {
         }
         // open the cloze gaps with all answers
         include_once "./Modules/TestQuestionPool/classes/class.assAnswerCloze.php";
         include_once "./Modules/TestQuestionPool/classes/class.assClozeGap.php";
         $result = $ilDB->queryF("SELECT * FROM qpl_a_cloze WHERE question_fi = %s ORDER BY gap_id, aorder ASC", array("integer"), array($question_id));
         if ($result->numRows() > 0) {
             $this->gaps = array();
             while ($data = $ilDB->fetchAssoc($result)) {
                 switch ($data["cloze_type"]) {
                     case CLOZE_TEXT:
                         if (!array_key_exists($data["gap_id"], $this->gaps)) {
                             $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_TEXT);
                         }
                         $answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
                         $this->gaps[$data["gap_id"]]->addItem($answer);
                         break;
                     case CLOZE_SELECT:
                         if (!array_key_exists($data["gap_id"], $this->gaps)) {
                             $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_SELECT);
                             $this->gaps[$data["gap_id"]]->setShuffle($data["shuffle"]);
                         }
                         $answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
                         $this->gaps[$data["gap_id"]]->addItem($answer);
                         break;
                     case CLOZE_NUMERIC:
                         if (!array_key_exists($data["gap_id"], $this->gaps)) {
                             $this->gaps[$data["gap_id"]] = new assClozeGap(CLOZE_NUMERIC);
                         }
                         $answer = new assAnswerCloze($data["answertext"], $data["points"], $data["aorder"]);
                         $answer->setLowerBound($data["lowerlimit"]);
                         $answer->setUpperBound($data["upperlimit"]);
                         $this->gaps[$data["gap_id"]]->addItem($answer);
                         break;
                 }
             }
         }
     }
     parent::loadFromDb($question_id);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:71,代码来源:class.assClozeTest.php

示例12: exportHTML

 /**
  * Export to HTML.
  *
  */
 function exportHTML()
 {
     global $lng, $tpl, $ilUser, $ilAccess, $ilias;
     if (!$ilAccess->checkAccess('read,visible', '', $_GET['ref_id'])) {
         $ilias->raiseError($lng->txt('permission_denied'), $ilias->error_obj->MESSAGE);
     }
     $tplEx = new ilTemplate('tpl.forums_export_html.html', true, true, 'Modules/Forum');
     // threads
     //for ($j = 0; $j < count($_POST['forum_id']); $j++)
     for ($j = 0; $j < count($_POST['thread_ids']); $j++) {
         //$objCurrentTopic = new ilForumTopic(addslashes($_POST['forum_id'][$j]), $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id']));
         $objCurrentTopic = new ilForumTopic(addslashes($_POST['thread_ids'][$j]), $ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id']));
         // get forum- and thread-data
         $this->frm->setMDB2WhereCondition('top_pk = %s ', array('integer'), array($objCurrentTopic->getForumId()));
         if (is_array($frmData = $this->frm->getOneTopic())) {
             $objFirstPostNode = $objCurrentTopic->getFirstPostNode();
             $objCurrentTopic->setOrderField('frm_posts_tree.rgt');
             $postTree = $objCurrentTopic->getPostTree($objFirstPostNode);
             $posNum = count($postTree);
             $z = 0;
             foreach ($postTree as $post) {
                 $tplEx->setCurrentBlock('posts_row');
                 $rowCol = ilUtil::switchColor($z++, 'tblrow2', 'tblrow1');
                 $tplEx->setVariable('ROWCOL', $rowCol);
                 $authorinfo = new ilForumAuthorInformation($post->getUserId(), $post->getUserAlias(), $post->getImportName());
                 $tplEx->setVariable('AUTHOR', $authorinfo->getAuthorName());
                 if ($post->getUserId()) {
                     // get create- and update-dates
                     if ($post->getUpdateUserId()) {
                         $authorinfo = new ilForumAuthorInformation($post->getUpdateUserId(), '', '');
                         $tplEx->setVariable('POST_UPDATE', "<br />[" . $lng->txt('edited_on') . ": " . $this->frm->convertDate($post->getChangeDate()) . " - " . strtolower($lng->txt('from')) . " " . $authorinfo->getAuthorName() . "]");
                     }
                     if ($authorinfo->getAuthor()->getPref('public_profile') != 'n') {
                         $tplEx->setVariable('TXT_REGISTERED', $lng->txt('registered_since'));
                         $tplEx->setVariable('REGISTERED_SINCE', $this->frm->convertDate($authorinfo->getAuthor()->getCreateDate()));
                     }
                     if ($ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])) {
                         $numPosts = $this->frm->countUserArticles($post->getUserId());
                     } else {
                         $numPosts = $this->frm->countActiveUserArticles($post->getUserId());
                     }
                     $tplEx->setVariable('TXT_NUM_POSTS', $lng->txt('forums_posts'));
                     $tplEx->setVariable('NUM_POSTS', $numPosts);
                 }
                 $tplEx->setVariable('SUBJECT', $post->getSubject());
                 $tplEx->setVariable('TXT_CREATE_DATE', $lng->txt('forums_thread_create_date'));
                 $tplEx->setVariable('POST_DATE', $this->frm->convertDate($post->getCreateDate()));
                 $tplEx->setVariable('SPACER', "<hr noshade width=\"100%\" size=\"1\" align=\"center\" />");
                 if ($post->isCensored()) {
                     $tplEx->setVariable('POST', nl2br(stripslashes($post->getCensorshipComment())));
                 } else {
                     /** @todo mjansen: possible bugfix for mantis #8223 */
                     if ($post->getMessage() == strip_tags($post->getMessage())) {
                         // We can be sure, that there are not html tags
                         $post->setMessage(nl2br($post->getMessage()));
                     }
                     $tplEx->setVariable('POST', ilRTE::_replaceMediaObjectImageSrc($this->frm->prepareText($post->getMessage(), 0, '', 'export'), 1));
                 }
                 $tplEx->parseCurrentBlock('posts_row');
                 unset($author);
             }
             // foreach ($postTree as $post)
             $tplEx->setCurrentBlock('posttable');
             $tplEx->setVariable('TXT_AUTHOR', $lng->txt('author'));
             $tplEx->setVariable('TXT_POST', $lng->txt('forums_thread') . ': ' . $objCurrentTopic->getSubject());
             $tplEx->parseCurrentBlock('posttable');
             // Thread Headline
             $tplEx->setCurrentBlock('thread_headline');
             $tplEx->setVariable('T_TITLE', $objCurrentTopic->getSubject());
             if ($ilAccess->checkAccess('moderate_frm', '', $_GET['ref_id'])) {
                 $tplEx->setVariable('T_NUM_POSTS', $objCurrentTopic->countPosts());
             } else {
                 $tplEx->setVariable('T_NUM_POSTS', $objCurrentTopic->countActivePosts());
             }
             $tplEx->setVariable('T_NUM_VISITS', $objCurrentTopic->getVisits());
             $tplEx->setVariable('T_FORUM', $frmData['top_name']);
             $authorinfo = new ilForumAuthorInformation($objCurrentTopic->getUserId(), $objCurrentTopic->getUserAlias(), $objCurrentTopic->getImportName());
             $tplEx->setVariable('T_AUTHOR', $authorinfo->getAuthorName());
             $tplEx->setVariable('T_TXT_FORUM', $lng->txt('forum') . ': ');
             $tplEx->setVariable('T_TXT_TOPIC', $lng->txt('forums_thread') . ': ');
             $tplEx->setVariable('T_TXT_AUTHOR', $lng->txt('forums_thread_create_from') . ': ');
             $tplEx->setVariable('T_TXT_NUM_POSTS', $lng->txt('forums_articles') . ': ');
             $tplEx->setVariable('T_TXT_NUM_VISITS', $lng->txt('visits') . ': ');
             $tplEx->parseCurrentBlock('thread_headline');
             $tplEx->setCurrentBlock('thread_block');
             $tplEx->parseCurrentBlock('thread_block');
             $tplEx->setCurrentBlock('forum_block');
             $tplEx->parseCurrentBlock('forum_block');
         }
         // if (is_array($frmData = $this->frm->getOneTopic()))
     }
     // for ($j = 0; $j < count($_POST["forum_id"]); $j++)
     ilUtil::deliverData($tplEx->get(), 'forum_html_export_' . $_GET['ref_id'] . '.html');
     exit;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:99,代码来源:class.ilForumExportGUI.php

示例13: fromXML


//.........这里部分代码省略.........
     $this->object->setThumbSize($item->getMetadataEntry("thumb_size"));
     $this->object->saveToDb();
     foreach ($answers as $answerData) {
         $answer = new ilAssKprimChoiceAnswer();
         $answer->setImageFsDir($this->object->getImagePath());
         $answer->setImageWebDir($this->object->getImagePathWeb());
         $answer->setPosition($answerData['answerorder']);
         $answer->setAnswertext($answerData['answertext']);
         $answer->setCorrectness($answerData['correctness']);
         if (isset($answerData['imagefile']['label'])) {
             $answer->setImageFile($answerData['imagefile']['label']);
         }
         $this->object->addAnswer($answer);
     }
     // additional content editing mode information
     $this->object->setAdditionalContentEditingMode($this->fetchAdditionalContentEditingModeInformation($item));
     $this->object->saveToDb();
     foreach ($answers as $answer) {
         if (is_array($answer["imagefile"]) && count($answer["imagefile"]) > 0) {
             $image =& base64_decode($answer["imagefile"]["content"]);
             $imagepath = $this->object->getImagePath();
             include_once "./Services/Utilities/classes/class.ilUtil.php";
             if (!file_exists($imagepath)) {
                 ilUtil::makeDirParents($imagepath);
             }
             $imagepath .= $answer["imagefile"]["label"];
             if ($fh = fopen($imagepath, "wb")) {
                 $imagefile = fwrite($fh, $image);
                 fclose($fh);
             }
         }
     }
     $feedbackSetting = $item->getMetadataEntry('feedback_setting');
     if (!is_null($feedbackSetting)) {
         $this->object->feedbackOBJ->saveSpecificFeedbackSetting($this->object->getId(), $feedbackSetting);
     }
     // handle the import of media objects in XHTML code
     foreach ($feedbacks as $ident => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacks[$ident] = $m;
     }
     foreach ($feedbacksgeneric as $correctness => $material) {
         $m = $this->object->QTIMaterialToString($material);
         $feedbacksgeneric[$correctness] = $m;
     }
     $questiontext = $this->object->getQuestion();
     $answers =& $this->object->getAnswers();
     if (is_array($_SESSION["import_mob_xhtml"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/RTE/classes/class.ilRTE.php";
         foreach ($_SESSION["import_mob_xhtml"] as $mob) {
             if ($tst_id > 0) {
                 $importfile = $this->getTstImportArchivDirectory() . '/' . $mob["uri"];
             } else {
                 $importfile = $this->getQplImportArchivDirectory() . '/' . $mob["uri"];
             }
             $GLOBALS['ilLog']->write(__METHOD__ . ': import mob from dir: ' . $importfile);
             $media_object =& ilObjMediaObject::_saveTempFileAsMediaObject(basename($importfile), $importfile, FALSE);
             ilObjMediaObject::_saveUsage($media_object->getId(), "qpl:html", $this->object->getId());
             $questiontext = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $questiontext);
             foreach ($answers as $key => $value) {
                 $answer_obj =& $answers[$key];
                 $answer_obj->setAnswertext(str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $answer_obj->getAnswertext()));
             }
             foreach ($feedbacks as $ident => $material) {
                 $feedbacks[$ident] = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $material);
             }
             foreach ($feedbacksgeneric as $correctness => $material) {
                 $feedbacksgeneric[$correctness] = str_replace("src=\"" . $mob["mob"] . "\"", "src=\"" . "il_" . IL_INST_ID . "_mob_" . $media_object->getId() . "\"", $material);
             }
         }
     }
     $this->object->setQuestion(ilRTE::_replaceMediaObjectImageSrc($questiontext, 1));
     foreach ($answers as $key => $value) {
         $answer_obj =& $answers[$key];
         $answer_obj->setAnswertext(ilRTE::_replaceMediaObjectImageSrc($answer_obj->getAnswertext(), 1));
     }
     foreach ($feedbacks as $ident => $material) {
         $this->object->feedbackOBJ->importSpecificAnswerFeedback($this->object->getId(), $ident, ilRTE::_replaceMediaObjectImageSrc($material, 1));
     }
     foreach ($feedbacksgeneric as $correctness => $material) {
         $this->object->feedbackOBJ->importGenericFeedback($this->object->getId(), $correctness, ilRTE::_replaceMediaObjectImageSrc($material, 1));
     }
     $this->object->saveToDb();
     if (count($item->suggested_solutions)) {
         foreach ($item->suggested_solutions as $suggested_solution) {
             $this->object->setSuggestedSolution($suggested_solution["solution"]->getContent(), $suggested_solution["gap_index"], true);
         }
         $this->object->saveToDb();
     }
     if ($tst_id > 0) {
         $q_1_id = $this->object->getId();
         $question_id = $this->object->duplicate(true, null, null, null, $tst_id);
         $tst_object->questions[$question_counter++] = $question_id;
         $import_mapping[$item->getIdent()] = array("pool" => $q_1_id, "test" => $question_id);
     } else {
         $import_mapping[$item->getIdent()] = array("pool" => $this->object->getId(), "test" => 0);
     }
     //$ilLog->write(strftime("%D %T") . ": finished import multiple choice question (single response)");
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.assKprimChoiceImport.php

示例14: 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" => nl2br(ilRTE::_replaceMediaObjectImageSrc($this->getFeedbackGeneric(0), 0)), "allcorrect" => nl2br(ilRTE::_replaceMediaObjectImageSrc($this->getFeedbackGeneric(1), 0)));
     if ($this->getOrderingType() == OQ_PICTURES) {
         $result['path'] = $this->getImagePathWeb();
     }
     $counter = 1;
     $answers = array();
     foreach ($this->getAnswers() as $answer_obj) {
         $answers[$counter] = $answer_obj->getAnswertext();
         $counter++;
     }
     $answers = $this->pcArrayShuffle($answers);
     $arr = array();
     foreach ($answers as $order => $answer) {
         array_push($arr, array("answertext" => (string) $answer, "order" => (int) $order));
     }
     $result['answers'] = $arr;
     $mobs = ilObjMediaObject::_getMobsOfObject("qpl:html", $this->getId());
     $result['mobs'] = $mobs;
     return json_encode($result);
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:34,代码来源:class.assOrderingQuestion.php

示例15: loadFromDb

 /**
  * Loads a assOrderingQuestion object from a database
  *
  * @param object $db A pear DB object
  * @param integer $question_id A unique key which defines the multiple choice test in the database
  * @access public
  */
 function loadFromDb($question_id)
 {
     global $ilDB;
     $result = $ilDB->queryF("SELECT qpl_questions.*, " . $this->getAdditionalTableName() . ".* FROM qpl_questions LEFT JOIN " . $this->getAdditionalTableName() . " ON " . $this->getAdditionalTableName() . ".question_fi = qpl_questions.question_id WHERE qpl_questions.question_id = %s", array("integer"), array($question_id));
     if ($result->numRows() == 1) {
         $data = $ilDB->fetchAssoc($result);
         $this->setId($question_id);
         $this->setObjId($data["obj_fi"]);
         $this->setTitle($data["title"]);
         $this->setComment($data["description"]);
         $this->setOriginalId($data["original_id"]);
         $this->setAuthor($data["author"]);
         $this->setNrOfTries($data['nr_of_tries']);
         $this->setPoints($data["points"]);
         $this->setOwner($data["owner"]);
         include_once "./Services/RTE/classes/class.ilRTE.php";
         $this->setQuestion(ilRTE::_replaceMediaObjectImageSrc($data["question_text"], 1));
         $this->ordering_type = strlen($data["ordering_type"]) ? $data["ordering_type"] : OQ_TERMS;
         $this->thumb_geometry = $data["thumb_geometry"];
         $this->element_height = $data["element_height"];
         $this->setEstimatedWorkingTime(substr($data["working_time"], 0, 2), substr($data["working_time"], 3, 2), substr($data["working_time"], 6, 2));
         try {
             $this->setAdditionalContentEditingMode($data['add_cont_edit_mode']);
         } catch (ilTestQuestionPoolException $e) {
         }
     }
     $result = $ilDB->queryF("SELECT * FROM qpl_a_ordering WHERE question_fi = %s ORDER BY solution_order ASC", array('integer'), array($question_id));
     include_once "./Modules/TestQuestionPool/classes/class.assAnswerOrdering.php";
     if ($result->numRows() > 0) {
         while ($data = $ilDB->fetchAssoc($result)) {
             include_once "./Services/RTE/classes/class.ilRTE.php";
             $data["answertext"] = ilRTE::_replaceMediaObjectImageSrc($data["answertext"], 1);
             array_push($this->answers, new ASS_AnswerOrdering($data["answertext"], $data["random_id"], $data['depth'] ? $data['depth'] : 0));
         }
     }
     parent::loadFromDb($question_id);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:44,代码来源:class.assOrderingQuestion.php


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