/** * Copies/Moves a question from the clipboard * * @access private */ function pasteFromClipboard() { global $ilDB; if (array_key_exists("qpl_clipboard", $_SESSION)) { foreach ($_SESSION["qpl_clipboard"] as $question_object) { if (strcmp($question_object["action"], "move") == 0) { $result = $ilDB->queryF("SELECT obj_fi FROM qpl_questions WHERE question_id = %s", array('integer'), array($question_object["question_id"])); if ($result->numRows() == 1) { $row = $ilDB->fetchAssoc($result); $source_questionpool = $row["obj_fi"]; // change the questionpool id in the qpl_questions table $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET obj_fi = %s WHERE question_id = %s", array('integer', 'integer'), array($this->getId(), $question_object["question_id"])); // move question data to the new target directory $source_path = CLIENT_WEB_DIR . "/assessment/" . $source_questionpool . "/" . $question_object["question_id"] . "/"; if (@is_dir($source_path)) { $target_path = CLIENT_WEB_DIR . "/assessment/" . $this->getId() . "/"; if (!@is_dir($target_path)) { include_once "./Services/Utilities/classes/class.ilUtil.php"; ilUtil::makeDirParents($target_path); } @rename($source_path, $target_path . $question_object["question_id"]); } // update question count of source question pool ilObjQuestionPool::_updateQuestionCount($source_questionpool); } } else { $this->copyQuestion($question_object["question_id"], $this->getId()); } } } // update question count of question pool ilObjQuestionPool::_updateQuestionCount($this->getId()); unset($_SESSION["qpl_clipboard"]); }
/** * Saves the question to the database * * @param integer $original_id * @access public */ function saveToDb($original_id = "") { global $ilDB; $this->updateSuggestedSolutions(); // remove unused media objects from ILIAS $this->cleanupMediaObjectUsage(); $complete = "0"; if ($this->isComplete()) { $complete = "1"; } // update the question time stamp and completion status $affectedRows = $ilDB->manipulateF("UPDATE qpl_questions SET tstamp = %s, owner = %s, complete = %s WHERE question_id = %s", array('integer', 'integer', 'integer', 'text'), array(time(), $this->getOwner() <= 0 ? $this->ilias->account->id : $this->getOwner(), $complete, $this->getId())); // update question count of question pool include_once "./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"; ilObjQuestionPool::_updateQuestionCount($this->obj_id); $this->notifyQuestionEdited($this); }