diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3ec8c9246..1d7f7f7fe 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+# 2.6.0
+1. Compulsory questions
+2. Automatic scrolling if show all comments is active
+3. New Learning Progress mode
+4. Table of contents
+
# 2.0.25
1. Disable toolbar setting
diff --git a/VideoSources/class.ilInteractiveVideoSourceFactoryGUI.php b/VideoSources/class.ilInteractiveVideoSourceFactoryGUI.php
index fc65f133a..395936d53 100644
--- a/VideoSources/class.ilInteractiveVideoSourceFactoryGUI.php
+++ b/VideoSources/class.ilInteractiveVideoSourceFactoryGUI.php
@@ -64,7 +64,7 @@ public function getPlayer($player_id)
protected function sourceDoesNotExistsAnymore()
{
ilUtil::sendFailure(ilInteractiveVideoPlugin::getInstance()->txt('source_does_not_exist'), true);
- ilUtil::redirect('ilias.php?baseClass=ilPersonalDesktopGUI');
+ ilUtil::redirect('ilias.php?baseClass=ilDashboardGUI');
}
/**
diff --git a/VideoSources/class.ilInteractiveVideoUniqueIds.php b/VideoSources/class.ilInteractiveVideoUniqueIds.php
index 228028926..40fb4a58b 100644
--- a/VideoSources/class.ilInteractiveVideoUniqueIds.php
+++ b/VideoSources/class.ilInteractiveVideoUniqueIds.php
@@ -33,8 +33,7 @@ public static function getInstance()
*/
public function getNewId()
{
- $new_id = $this->generateUniqueId();
- return $new_id;
+ return $this->generateUniqueId();
}
/**
@@ -45,7 +44,7 @@ protected function generateUniqueId()
{
$unique_id = '';
for ($i = 0; $i <= self::ROUNDS; $i++) {
- $rand = 'iv_' . rand();
+ $rand = uniqid('iv_');
if (!in_array($rand, $this->id_container)) {
$this->id_container[$rand] = $rand;
$unique_id = $rand;
diff --git a/VideoSources/core/MediaObject/class.ilInteractiveVideoMediaObjectGUI.php b/VideoSources/core/MediaObject/class.ilInteractiveVideoMediaObjectGUI.php
index 17287d0aa..c45e9a9a0 100644
--- a/VideoSources/core/MediaObject/class.ilInteractiveVideoMediaObjectGUI.php
+++ b/VideoSources/core/MediaObject/class.ilInteractiveVideoMediaObjectGUI.php
@@ -55,7 +55,7 @@ public function getPlayer($player_id, $obj)
{
require_once 'Services/WebAccessChecker/classes/class.ilWACSignedPath.php';
$player = new ilTemplate(self::PATH . 'tpl/tpl.video.html', false, false);
- ilObjMediaObjectGUI::includePresentationJS($player);
+ ilObjMediaObjectGUI::includePresentationJS();
$media_object = new ilInteractiveVideoMediaObject();
$mob_id = $media_object->doReadVideoSource($obj->getId());
$mob_dir = ilObjMediaObject::_getDirectory($mob_id);
diff --git a/VideoSources/core/MediaObject/js/jquery.InteractiveVideoMediaElementPlayer.js b/VideoSources/core/MediaObject/js/jquery.InteractiveVideoMediaElementPlayer.js
index ad0f0d760..8e3188d54 100755
--- a/VideoSources/core/MediaObject/js/jquery.InteractiveVideoMediaElementPlayer.js
+++ b/VideoSources/core/MediaObject/js/jquery.InteractiveVideoMediaElementPlayer.js
@@ -13,35 +13,32 @@ $(document).ready(function () {
il.InteractiveVideo.last_stopPoint = -1;
il.InteractiveVideoSubtitle.initializeSubtitleTracks(player_id);
-
- il.InteractiveVideo[player_id].player = new MediaElementPlayer("#" + player_id, {
+ il.InteractiveVideo[player_id].player = new MediaElementPlayer(player_id, {
timerRate: 50,
enablePluginDebug: false,
+ stretching: "responsive",
success: function (media) {
-
- media.addEventListener('loadeddata', function () {
- player = $("video#" + player_id)[0];
-
- il.InteractiveVideoPlayerAbstract.config[player_id] = {
- pauseCallback: (function () {
- player.pause(player_id);
- }),
- playCallback: (function () {
- player.play(player_id);
- }),
- durationCallback: (function () {
- return player.duration;
- }),
- currentTimeCallback: (function () {
- return player.currentTime;
- }),
- setCurrentTimeCallback: (function (time) {
- player.setCurrentTime(time, player_id);
- })
- };
-
+ player = $("#" + player_id)[0];
+ il.InteractiveVideoPlayerAbstract.config[player_id] = {
+ pauseCallback: (function () {
+ player.pause(player_id);
+ }),
+ playCallback: (function () {
+ player.play(player_id);
+ }),
+ durationCallback: (function () {
+ return player.duration;
+ }),
+ currentTimeCallback: (function () {
+ return player.currentTime;
+ }),
+ setCurrentTimeCallback: (function (time) {
+ player.setCurrentTime(time, player_id);
+ })
+ };
+ media.addEventListener('loadedmetadata', function () {
il.InteractiveVideoPlayerComments.fillEndTimeSelector(il.InteractiveVideoPlayerAbstract.duration(player_id));
}, false);
diff --git a/VideoSources/core/MediaObject/lang/ilias_it.lang b/VideoSources/core/MediaObject/lang/ilias_it.lang
new file mode 100644
index 000000000..5860fbb63
--- /dev/null
+++ b/VideoSources/core/MediaObject/lang/ilias_it.lang
@@ -0,0 +1 @@
+imo#:#Carica file video
diff --git a/VideoSources/core/SimpleUrl/class.ilInteractiveVideoSimpleUrl.php b/VideoSources/core/SimpleUrl/class.ilInteractiveVideoSimpleUrl.php
index b9479ec25..7b1d0cbe5 100644
--- a/VideoSources/core/SimpleUrl/class.ilInteractiveVideoSimpleUrl.php
+++ b/VideoSources/core/SimpleUrl/class.ilInteractiveVideoSimpleUrl.php
@@ -168,7 +168,7 @@ public function getId()
*/
public function getClassPath()
{
- return 'VideoSources/plugin/InteractiveVideoFauVideoPortal/class.ilInteractiveVideoSimpleUrl.php';
+ return 'VideoSources/core/SimpleUrl/class.ilInteractiveVideoSimpleUrl.php';
}
/**
diff --git a/VideoSources/core/SimpleUrl/js/jquery.InteractiveVideoSimpleUrlPlayer.js b/VideoSources/core/SimpleUrl/js/jquery.InteractiveVideoSimpleUrlPlayer.js
index 8b3eae826..d3a2a012e 100755
--- a/VideoSources/core/SimpleUrl/js/jquery.InteractiveVideoSimpleUrlPlayer.js
+++ b/VideoSources/core/SimpleUrl/js/jquery.InteractiveVideoSimpleUrlPlayer.js
@@ -13,34 +13,32 @@ $( document ).ready(function() {
il.InteractiveVideo.last_stopPoint = -1;
il.InteractiveVideoSubtitle.initializeSubtitleTracks(player_id);
- il.InteractiveVideo[player_id].player = new MediaElementPlayer("#" + player_id, {
+ il.InteractiveVideo[player_id].player = new MediaElementPlayer(player_id, {
timerRate: 50,
enablePluginDebug: false,
+ stretching: "responsive",
success: function (media) {
-
- media.addEventListener('loadeddata', function () {
- player = $("video#" + player_id)[0];
-
- il.InteractiveVideoPlayerAbstract.config[player_id] = {
- pauseCallback: (function () {
- player.pause(player_id);
- }),
- playCallback: (function () {
- player.play(player_id);
- }),
- durationCallback: (function () {
- return player.duration;
- }),
- currentTimeCallback: (function () {
- return player.currentTime;
- }),
- setCurrentTimeCallback: (function (time) {
- player.setCurrentTime(time, player_id);
- })
- };
-
+ player = $("#" + player_id)[0];
+ il.InteractiveVideoPlayerAbstract.config[player_id] = {
+ pauseCallback: (function () {
+ player.pause(player_id);
+ }),
+ playCallback: (function () {
+ player.play(player_id);
+ }),
+ durationCallback: (function () {
+ return player.duration;
+ }),
+ currentTimeCallback: (function () {
+ return player.currentTime;
+ }),
+ setCurrentTimeCallback: (function (time) {
+ player.setCurrentTime(time, player_id);
+ })
+ };
+ media.addEventListener('loadedmetadata', function () {
il.InteractiveVideoPlayerComments.fillEndTimeSelector(il.InteractiveVideoPlayerAbstract.duration(player_id));
}, false);
diff --git a/VideoSources/core/SimpleUrl/lang/ilias_it.lang b/VideoSources/core/SimpleUrl/lang/ilias_it.lang
new file mode 100644
index 000000000..9c1010283
--- /dev/null
+++ b/VideoSources/core/SimpleUrl/lang/ilias_it.lang
@@ -0,0 +1,3 @@
+surl#:#Url
+simple_url#:#URL semplice
+simple_url_info#:#Inserisci un URL a un video.
\ No newline at end of file
diff --git a/VideoSources/core/Youtube/js/jquery.InteractiveVideoYoutubePlayer.js b/VideoSources/core/Youtube/js/jquery.InteractiveVideoYoutubePlayer.js
index d5fff5c78..663392d9f 100755
--- a/VideoSources/core/Youtube/js/jquery.InteractiveVideoYoutubePlayer.js
+++ b/VideoSources/core/Youtube/js/jquery.InteractiveVideoYoutubePlayer.js
@@ -17,7 +17,7 @@ function onYouTubeIframeAPIReady() {
$.each(il.InteractiveVideo, function (player_id, value) {
if (value.hasOwnProperty("player_type") && value.player_type === "ytb") {
var player = new YT.Player(player_id, {
- videoId: interactiveVideoYoutubeId,
+ videoId: $('#'+player_id).attr('data-youtube-id'),
events: {
'onStateChange': onPlayerStateChange,
'onReady': function (media) {
diff --git a/VideoSources/core/Youtube/lang/ilias_it.lang b/VideoSources/core/Youtube/lang/ilias_it.lang
new file mode 100644
index 000000000..84f07f15e
--- /dev/null
+++ b/VideoSources/core/Youtube/lang/ilias_it.lang
@@ -0,0 +1,3 @@
+ytb_youtube_url#:#URL YouTube
+ytb_youtube_info#:#Inserisci un URL di YouTube.
+ytb#:#YouTube
diff --git a/VideoSources/core/Youtube/tpl/tpl.video.html b/VideoSources/core/Youtube/tpl/tpl.video.html
index 1e9d59eaf..639db0711 100644
--- a/VideoSources/core/Youtube/tpl/tpl.video.html
+++ b/VideoSources/core/Youtube/tpl/tpl.video.html
@@ -1,18 +1 @@
-
-
-
\ No newline at end of file
+
diff --git a/classes/Form/class.ilTextAreaInputCkeditorGUI.php b/classes/Form/class.ilTextAreaInputCkeditorGUI.php
index 571591a48..d010e2690 100644
--- a/classes/Form/class.ilTextAreaInputCkeditorGUI.php
+++ b/classes/Form/class.ilTextAreaInputCkeditorGUI.php
@@ -18,9 +18,11 @@ public function __construct($a_title = "", $a_postvar = "")
$this->usePurifier(true);
}
- /**
- * Insert property html
- */
+ /**
+ * @param ilTemplate $a_tpl
+ * @return int|void
+ * @throws ilTemplateException
+ */
public function insert($a_tpl)
{
$this->appendJavascriptFile();
diff --git a/classes/class.SimpleChoiceQuestion.php b/classes/class.SimpleChoiceQuestion.php
index 67c46845b..c9e2d2a55 100644
--- a/classes/class.SimpleChoiceQuestion.php
+++ b/classes/class.SimpleChoiceQuestion.php
@@ -98,6 +98,16 @@ class SimpleChoiceQuestion
*/
protected $show_response_frequency = 0;
+ /**
+ * @var int
+ */
+ protected $show_best_solution = 0;
+
+ /**
+ * @var string
+ */
+ protected $show_best_solution_text = '';
+
/**
* @var int
*/
@@ -123,6 +133,11 @@ class SimpleChoiceQuestion
*/
protected $question_image = '';
+ /**
+ * @var int
+ */
+ protected $compulsory_question = 0;
+
/**
* @var string
*/
@@ -148,9 +163,9 @@ public function __construct($comment_id = 0)
*/
public function read()
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
SELECT *
@@ -172,7 +187,10 @@ public function read()
$this->setIsJumpWrong($row['is_jump_wrong']);
$this->setShowWrongIcon($row['show_wrong_icon']);
$this->setJumpWrongTs($row['jump_wrong_ts']);
+ $this->setCompulsoryQuestion($row['compulsory_question']);
$this->setShowResponseFrequency($row['show_response_frequency']);
+ $this->setShowBestSolution($row['show_best_solution']);
+ $this->setShowBestSolutionText($row['show_best_solution_text']);
$this->setFeedbackCorrectId($row['feedback_correct_ref_id']);
$this->setFeedbackWrongId($row['feedback_wrong_ref_id']);
$this->setRepeatQuestion($row['repeat_question']);
@@ -189,9 +207,9 @@ public function read()
*/
public function readQuestionById($qid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
SELECT *
@@ -230,6 +248,9 @@ public function setCommentId($comment_id)
*/
public static function isLimitAttemptsEnabled($question_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT limit_attempts FROM ' . self::TABLE_NAME_QUESTION . ' WHERE question_id = %s',
@@ -246,6 +267,9 @@ public static function isLimitAttemptsEnabled($question_id)
*/
public static function isRepeatQuestionEnabled($comment_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT repeat_question FROM ' . self::TABLE_NAME_QUESTION . ' WHERE comment_id = %s',
array('integer'), array($comment_id));
@@ -260,6 +284,32 @@ public static function isRepeatQuestionEnabled($comment_id)
* @return bool
*/
public static function existUserAnswer($comment_id)
+ {
+ /**
+ * @var $ilDB ilDBInterface
+ */
+ global $ilUser, $ilDB;
+
+ $res = $ilDB->queryF('
+ SELECT * FROM ' . self::TABLE_NAME_ANSWERS . ' ans
+ INNER JOIN ' . self::TABLE_NAME_QUESTION . ' qst on ans.question_id = qst.question_id
+ WHERE comment_id = %s
+ AND user_id = %s
+ ',
+ array('integer', 'integer'), array($comment_id, $ilUser->getId()));
+
+ if($ilDB->numRows($res) > 0)
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param $comment_id
+ * @return bool
+ */
+ public static function existAnswer($comment_id)
{
/**
* $ilUser ilUser
@@ -270,10 +320,9 @@ public static function existUserAnswer($comment_id)
$res = $ilDB->queryF('
SELECT * FROM ' . self::TABLE_NAME_ANSWERS . ' ans
INNER JOIN ' . self::TABLE_NAME_QUESTION . ' qst on ans.question_id = qst.question_id
- WHERE comment_id = %s
- AND user_id = %s
+ WHERE comment_id = %s
',
- array('integer', 'integer'), array($comment_id, $ilUser->getId()));
+ array('integer'), array($comment_id));
if($ilDB->numRows($res) > 0)
{
@@ -314,12 +363,56 @@ public function getUsersWithAnsweredQuestion($obj_id)
return array_values($usrIds);
}
+ /**
+ * @param int $obj_id
+ * @return array
+ */
+ public function getUsersWithAllAnsweredQuestionsMap($obj_id)
+ {
+ /**
+ * $ilDB ilDB
+ */
+ global $ilDB;
+
+ $res = $ilDB->queryF('
+ SELECT
+ rep_robj_xvid_answers.user_id, COUNT(DISTINCT(rep_robj_xvid_answers.answer_id))
+ FROM rep_robj_xvid_answers
+ INNER JOIN rep_robj_xvid_question
+ ON rep_robj_xvid_question.question_id = rep_robj_xvid_answers.question_id
+ AND rep_robj_xvid_question.type != %s
+ INNER JOIN rep_robj_xvid_comments
+ ON rep_robj_xvid_comments.comment_id = rep_robj_xvid_question.comment_id
+ AND rep_robj_xvid_comments.is_interactive = %s
+ WHERE rep_robj_xvid_comments.obj_id = %s
+ GROUP BY rep_robj_xvid_answers.user_id
+ HAVING COUNT(DISTINCT(rep_robj_xvid_answers.question_id)) = (
+ SELECT COUNT(rep_robj_xvid_question.question_id)
+ FROM rep_robj_xvid_comments
+ INNER JOIN rep_robj_xvid_question
+ ON rep_robj_xvid_question.comment_id = rep_robj_xvid_comments.comment_id
+ AND rep_robj_xvid_question.type != %s
+ WHERE rep_robj_xvid_comments.is_interactive = %s AND rep_robj_xvid_comments.obj_id = %s
+ );
+ ',
+ ['integer', 'integer', 'integer', 'integer', 'integer', 'integer'],
+ [2, 1, $obj_id, 2, 1, $obj_id]
+ );
+
+ $usrIds = [];
+ while ($row = $ilDB->fetchAssoc($res)) {
+ $usrIds[$row['user_id']] = $row['user_id'];
+ }
+
+ return $usrIds;
+ }
+
/**
* @param $obj_id
* @param $user_id
- * @return bool
+ * @return int
*/
- public function getUserWithAnsweredQuestion($obj_id, $user_id)
+ public function getNumberOfAnsweredQuestions($obj_id, $user_id)
{
/**
* $ilDB ilDB
@@ -327,19 +420,23 @@ public function getUserWithAnsweredQuestion($obj_id, $user_id)
global $ilDB;
$res = $ilDB->queryF('
- SELECT * FROM ' . self::TABLE_NAME_ANSWERS . ' ans
+ SELECT COUNT(DISTINCT(ans.question_id)) cnt FROM ' . self::TABLE_NAME_ANSWERS . ' ans
INNER JOIN ' . self::TABLE_NAME_QUESTION . ' qst on ans.question_id = qst.question_id
INNER JOIN ' . self::TABLE_NAME_COMMENTS . ' comment on qst.comment_id = comment.comment_id
WHERE obj_id = %s
AND ans.user_id = %s
',
- array('integer', 'integer'), array($obj_id, $user_id));
+ ['integer', 'integer'],
+ [$obj_id, $user_id]
+ );
- if($ilDB->numRows($res) > 0)
- {
- return true;
+ $row = $ilDB->fetchAssoc($res);
+
+ if (is_array($row) && isset($row['cnt'])) {
+ return (int) $row['cnt'];
}
- return false;
+
+ return 0;
}
/**
@@ -348,10 +445,9 @@ public function getUserWithAnsweredQuestion($obj_id, $user_id)
*/
public static function existUserAnswerForQuestionId($question_id)
{
- /**
- * $ilUser ilUser
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilUser, $ilDB;
$res = $ilDB->queryF('
@@ -373,9 +469,9 @@ public static function existUserAnswerForQuestionId($question_id)
*/
private function readAnswerDefinitions()
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
@@ -413,6 +509,9 @@ public function setQuestionId($question_id)
*/
public function cloneQuestionObject($old_comment_id, $new_comment_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$_POST['answer'] = array();
@@ -454,7 +553,10 @@ public function cloneQuestionObject($old_comment_id, $new_comment_id)
$this->setIsJumpWrong($row['is_jump_wrong']);
$this->setShowWrongIcon($row['show_wrong_icon']);
$this->setJumpWrongTs($row['jump_wrong_ts']);
+ $this->setCompulsoryQuestion($row['compulsory_question']);
$this->setShowResponseFrequency($row['show_response_frequency']);
+ $this->setShowBestSolution($row['show_best_solution']);
+ $this->setShowBestSolutionText($row['show_best_solution_text']);
$this->setFeedbackCorrectId($row['feedback_correct_ref_id']);
$this->setFeedbackWrongId($row['feedback_wrong_ref_id']);
$this->setRepeatQuestion($row['repeat_question']);
@@ -472,6 +574,9 @@ public function cloneQuestionObject($old_comment_id, $new_comment_id)
*/
public function getQuestionIdByCommentId($comment_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT question_id FROM ' . self::TABLE_NAME_QUESTION . ' WHERE comment_id = %s',
@@ -486,10 +591,9 @@ public function getQuestionIdByCommentId($comment_id)
*/
public function create()
{
- /**
- * @var $ilDB ilDB
- * @var $ilUser ilObjUser
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$question_id = $ilDB->nextId(self::TABLE_NAME_QUESTION);
$ilDB->insert(self::TABLE_NAME_QUESTION,
@@ -507,7 +611,10 @@ public function create()
'show_wrong_icon' => array('integer', $this->getShowWrongIcon()),
'is_jump_wrong' => array('integer', $this->getIsJumpWrong()),
'jump_wrong_ts' => array('integer', $this->getJumpWrongTs()),
+ 'compulsory_question' => array('integer', $this->getCompulsoryQuestion()),
'show_response_frequency' => array('integer', $this->getShowResponseFrequency()),
+ 'show_best_solution' => array('integer', $this->getShowBestSolution()),
+ 'show_best_solution_text' => array('text', $this->getShowBestSolutionText()),
'feedback_correct_ref_id' => array('integer', $this->getFeedbackCorrectId()),
'feedback_wrong_ref_id' => array('integer', $this->getFeedbackWrongId()),
'repeat_question' => array('integer', $this->getRepeatQuestion()),
@@ -555,20 +662,23 @@ public function create()
/**
* @param $oid
* @param null $a_user_id
- * @return int|array
+ * @return int|array
*/
public function getAllUsersWithCompletelyCorrectAnswers($oid, $a_user_id = null)
{
- $user_ids = array();
- /**
- * $ilDB ilDB
- */
+ $user_ids = [];
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
- 'SELECT sum(points) as points, rep_robj_xvid_score.user_id as usr_id FROM rep_robj_xvid_comments
- LEFT JOIN rep_robj_xvid_question ON rep_robj_xvid_question.comment_id = rep_robj_xvid_comments.comment_id
- LEFT JOIN rep_robj_xvid_answers ON rep_robj_xvid_answers.question_id = rep_robj_xvid_question.question_id
- LEFT JOIN rep_robj_xvid_score ON rep_robj_xvid_answers.user_id = rep_robj_xvid_score.user_id AND rep_robj_xvid_answers.question_id = rep_robj_xvid_score.question_id
+ '
+ SELECT SUM(points) points, rep_robj_xvid_score.user_id usr_id
+ FROM rep_robj_xvid_comments
+ INNER JOIN rep_robj_xvid_question
+ ON rep_robj_xvid_question.comment_id = rep_robj_xvid_comments.comment_id
+ INNER JOIN rep_robj_xvid_score
+ ON rep_robj_xvid_score.question_id = rep_robj_xvid_question.question_id
WHERE rep_robj_xvid_comments.obj_id = %s
AND is_interactive = 1
AND neutral_answer = 0
@@ -579,7 +689,7 @@ public function getAllUsersWithCompletelyCorrectAnswers($oid, $a_user_id = null)
);
while($row = $ilDB->fetchAssoc($res))
{
- $user_ids[$row['usr_id']] = $row['points'];
+ $user_ids[$row['usr_id']] = (int) $row['points'];
}
if($a_user_id != null && array_key_exists($a_user_id, $user_ids))
@@ -591,7 +701,6 @@ public function getAllUsersWithCompletelyCorrectAnswers($oid, $a_user_id = null)
return 0;
}
return $user_ids;
-
}
/**
@@ -786,6 +895,22 @@ public function setShowResponseFrequency($show_response_frequency)
$this->show_response_frequency = $show_response_frequency;
}
+ /**
+ * @return int
+ */
+ public function getShowBestSolution()
+ {
+ return $this->show_best_solution;
+ }
+
+ /**
+ * @param int $show_best_solution
+ */
+ public function setShowBestSolution($show_best_solution)
+ {
+ $this->show_best_solution = $show_best_solution;
+ }
+
/**
* @return int
*/
@@ -855,9 +980,9 @@ public function checkInput()
*/
public function existQuestionForCommentId($comment_id)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_QUESTION . ' WHERE comment_id = %s',
@@ -876,9 +1001,9 @@ public function existQuestionForCommentId($comment_id)
*/
public function getCommentTitleByCommentId($cid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
'SELECT comment_title FROM ' . self::TABLE_NAME_COMMENTS . ' WHERE comment_id = %s',
@@ -903,6 +1028,9 @@ public function getCommentTitleByCommentId($cid)
*/
public function getAllNonRepeatAnsweredQuestion($user_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
SELECT comments.comment_id comment
@@ -924,12 +1052,49 @@ public function getAllNonRepeatAnsweredQuestion($user_id)
return $results;
}
+ /**
+ * @param int $obj_id
+ * @return array
+ */
+ public static function getAllCompulsoryQuestions($obj_id)
+ {
+ /**
+ * @var $ilDB ilDBInterface
+ */
+ global $ilDB;
+ $res = $ilDB->queryF('
+ SELECT comments.comment_time, questions.question_id, comments.comment_id, points
+ FROM ' . self::TABLE_NAME_COMMENTS . ' comments,
+ ' . self::TABLE_NAME_QUESTION . ' questions
+ LEFT JOIN rep_robj_xvid_score ON questions.question_id = rep_robj_xvid_score.question_id
+ WHERE comments.comment_id = questions.comment_id
+ AND questions.compulsory_question = 1
+ AND comments.obj_id = %s',
+ array('integer'),
+ array((int)$obj_id)
+ );
+ $results = array();
+ while($row = $ilDB->fetchAssoc($res))
+ {
+ $results[$row['question_id']] = [
+ 'time' => $row['comment_time'],
+ 'question_id' => $row['question_id'],
+ 'comment_id' => $row['comment_id'],
+ 'answered' => $row['points'] != null ? true : false
+ ];
+ }
+ return $results;
+ }
+
/**
* @param int $user_id
* @return array
*/
public function getAllRepeatCorrectlyAnsweredQuestion($user_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
SELECT comments.comment_id comment
@@ -958,6 +1123,9 @@ public function getAllRepeatCorrectlyAnsweredQuestion($user_id)
*/
public function deleteUserResults($user_ids, $obj_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!is_array($user_ids))
@@ -982,6 +1150,9 @@ public function deleteUserResults($user_ids, $obj_id)
*/
public function getInteractiveQuestionIdsByObjId($obj_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
@@ -1007,6 +1178,9 @@ public function getInteractiveQuestionIdsByObjId($obj_id)
*/
public function getInteractiveNotNeutralQuestionIdsByObjId($obj_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
@@ -1031,6 +1205,9 @@ public function getInteractiveNotNeutralQuestionIdsByObjId($obj_id)
*/
public function deleteQuestionsResults($question_ids)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!is_array($question_ids))
@@ -1051,9 +1228,9 @@ public function deleteQuestionsResults($question_ids)
*/
public function getQuestionTextQuestionId($qid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
@@ -1072,10 +1249,9 @@ public function getQuestionTextQuestionId($qid)
*/
public function saveAnswer($qid, $answers)
{
- /**
- * $ilDB ilDB
- *
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
$usr_id = $ilUser->getId();
@@ -1143,9 +1319,9 @@ public function saveAnswer($qid, $answers)
*/
public function getTypeByQuestionId($qid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
@@ -1163,6 +1339,9 @@ public function getTypeByQuestionId($qid)
*/
public function removeAnswer($qid)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
$usr_id = $ilUser->getId();
$ilDB->queryF('DELETE FROM ' . self::TABLE_NAME_ANSWERS . ' WHERE question_id = %s AND user_id = %s',
@@ -1175,6 +1354,9 @@ public function removeAnswer($qid)
*/
public function removeScore($qid)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
$usr_id = $ilUser->getId();
$ilDB->queryF('DELETE FROM ' . self::TABLE_NAME_SCORE . ' WHERE question_id = %s AND user_id = %s',
@@ -1186,6 +1368,9 @@ public function removeScore($qid)
*/
public function deleteQuestionsIdByCommentId($comment_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT question_id FROM ' . self::TABLE_NAME_QUESTION . ' WHERE comment_id = %s',
@@ -1210,7 +1395,9 @@ public static function deleteQuestions($question_ids)
{
return;
}
-
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$ilDB->manipulate('DELETE FROM ' . self::TABLE_NAME_QUESTION . ' WHERE ' . $ilDB->in('question_id', $question_ids, false, 'integer'));
@@ -1317,4 +1504,38 @@ public function setQuestionImage($question_image)
{
$this->question_image = $question_image;
}
+
+ /**
+ * @return int
+ */
+ public function getCompulsoryQuestion()
+ {
+ return $this->compulsory_question;
+ }
+
+ /**
+ * @param int $compulsory_question
+ */
+ public function setCompulsoryQuestion($compulsory_question)
+ {
+ $this->compulsory_question = $compulsory_question;
+ }
+
+ /**
+ * @return string
+ */
+ public function getShowBestSolutionText()
+ {
+ return $this->show_best_solution_text;
+ }
+
+ /**
+ * @param string|null $show_best_solution_text
+ */
+ public function setShowBestSolutionText(?string $show_best_solution_text) : void
+ {
+ $this->show_best_solution_text = $show_best_solution_text;
+ }
+
+
}
diff --git a/classes/class.SimpleChoiceQuestionAjaxHandler.php b/classes/class.SimpleChoiceQuestionAjaxHandler.php
index fb7baa755..3e10a51fd 100644
--- a/classes/class.SimpleChoiceQuestionAjaxHandler.php
+++ b/classes/class.SimpleChoiceQuestionAjaxHandler.php
@@ -11,11 +11,13 @@
*/
class SimpleChoiceQuestionAjaxHandler
{
- /**
- * @param $feedback_ref_id
- * @param $json
- * @return mixed
- */
+ /**
+ * @param $feedback_ref_id
+ * @param $json
+ * @return mixed
+ * @throws ilDatabaseException
+ * @throws ilObjectNotFoundException
+ */
private function appendFeedback($feedback_ref_id, $json)
{
if($feedback_ref_id > 0)
@@ -27,16 +29,19 @@ private function appendFeedback($feedback_ref_id, $json)
return $json;
}
- /**
- * @param int $qid question_id
- * @return string
- */
+ /**
+ * @param $qid
+ * @return false|string
+ * @throws ilDatabaseException
+ * @throws ilObjectNotFoundException
+ */
public function getFeedbackForQuestion($qid)
{
$scoring = new SimpleChoiceQuestionScoring();
$score = $scoring->getScoreForQuestionOnUserId($qid);
$feedback = $scoring->getFeedbackByQuestionId($qid);
$json = array();
+ $correct = false;
if(is_array($feedback))
{
if($feedback['neutral_answer'] != 1)
@@ -89,6 +94,7 @@ public function getFeedbackForQuestion($qid)
$json['html'] = $start_div . $feedback['feedback_correct'] .'';
$json['is_timed'] = $feedback['is_jump_correct'];
$json['time'] = $feedback['jump_correct_ts'];
+ $correct = true;
}
}
else
@@ -110,18 +116,46 @@ public function getFeedbackForQuestion($qid)
$json['is_timed'] = $feedback['is_jump_correct'];
$json['time'] = $feedback['jump_correct_ts'];
}
+ $json['correct'] = $correct;
}
$json['html'] .= '';
$simple = new SimpleChoiceQuestionStatistics();
$json['response_frequency'] = $simple->getResponseFrequency((int)$qid);
+
+ $json['best_solution'] = '';
+ if($feedback['show_best_solution'] == "1" && $feedback['neutral_answer'] != 1) {
+ $json['html'] .= '';
+ $json['best_solution'] = '' . $this->getBestSolution($qid) . '
';
+ }
+
return json_encode($json);
}
+ /**
+ * @param int $qid
+ */
+ protected function getBestSolution($qid)
+ {
+ $best_solution = '';
+ $answers = $this->getAnswersForQuestionId($qid, false);
+ foreach($answers as $answer) {
+ $best_solution .= '';
+ }
+ return $best_solution;
+ }
+
/**
* @param $ref_id
* @return string
*/
+ /**
+ * @param $ref_id
+ * @return string
+ * @throws ilDatabaseException
+ * @throws ilObjectNotFoundException
+ * @throws ilTemplateException
+ */
protected function getLinkIfReadAccessForObjectByRefId($ref_id)
{
if($ref_id != null && $ref_id != 0)
@@ -149,22 +183,28 @@ protected function getLinkIfReadAccessForObjectByRefId($ref_id)
}
return '';
}
- /**
- * @param int $cid comment_id
- * @return string
- */
+
+ /**
+ * @param $cid
+ * @return false|string
+ * @throws ilDatabaseException
+ * @throws ilObjectNotFoundException
+ * @throws ilWACException
+ */
public function getJsonForCommentId($cid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
$res = $ilDB->queryF('
SELECT *
FROM rep_robj_xvid_question question,
- rep_robj_xvid_qus_text answers
+ rep_robj_xvid_qus_text answers,
+ rep_robj_xvid_comments comments
WHERE question.comment_id = %s
- AND question.question_id = answers.question_id',
+ AND question.question_id = answers.question_id
+ AND question.comment_id = comments.comment_id',
array('integer'), array((int)$cid)
);
@@ -192,6 +232,10 @@ public function getJsonForCommentId($cid)
$repeat_question = $row['repeat_question'];
$show_reflection_question_comment = $row['reflection_question_comment'];
$question_image = $row['question_image'];
+ $compulsory = $row['compulsory_question'];
+ $time = $row['comment_time'];
+ $show_best_solution = $row['show_best_solution'];
+ $show_best_solution_text = $row['show_best_solution_text'];
#$neutral_answer = $row['neutral_answer'];
$counter++;
}
@@ -227,7 +271,11 @@ public function getJsonForCommentId($cid)
$build_json['jump_wrong_ts'] = $jump_wrong_ts;
$build_json['show_response_frequency'] = $show_response_frequency;
$build_json['reflection_question_comment'] = $show_reflection_question_comment;
+ $build_json['compulsory_question'] = $compulsory;
+ $build_json['show_best_solution'] = $show_best_solution;
+ $build_json['show_best_solution_text'] = $show_best_solution_text;
$build_json['repeat_question'] = $repeat_question;
+ $build_json['time'] = $time;
if($question_image != null)
{
$build_json['question_image'] = ilWACSignedPath::signFile($question_image);
@@ -264,15 +312,16 @@ public function getJsonForCommentId($cid)
return json_encode($build_json);
}
- /**
- * @param $qid
- * @return string
- */
- public function getJsonForQuestionId($qid)
+ /**
+ * @param $qid
+ * @param bool $asJson
+ * @return false|string
+ */
+ public function getAnswersForQuestionId($qid, $asJson = true)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT answer_id, answer, correct FROM rep_robj_xvid_qus_text WHERE question_id = %s',
@@ -287,6 +336,9 @@ public function getJsonForQuestionId($qid)
{
$question_data[] = '';
}
- return json_encode($question_data);
+ if($asJson){
+ return json_encode($question_data);
+ }
+ return $question_data;
}
}
\ No newline at end of file
diff --git a/classes/class.SimpleChoiceQuestionScoring.php b/classes/class.SimpleChoiceQuestionScoring.php
index 994db2ada..b64b5ff73 100644
--- a/classes/class.SimpleChoiceQuestionScoring.php
+++ b/classes/class.SimpleChoiceQuestionScoring.php
@@ -13,10 +13,9 @@ class SimpleChoiceQuestionScoring
*/
public function getScoreForQuestionOnUserId($qid)
{
- /**
- * $ilUser ilUser
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
@@ -37,9 +36,9 @@ public function getScoreForQuestionOnUserId($qid)
*/
public function getFeedbackByQuestionId($qid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
@@ -57,11 +56,9 @@ public function getFeedbackByQuestionId($qid)
*/
public function getMyPoints($oid)
{
- /**
- * $ilUser ilUser
- * $ilDB ilDB
- * $lng ilLanguage
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser, $lng;
@@ -147,9 +144,9 @@ public function getMyPoints($oid)
*/
public function getCorrectAnswersForQuestion($qid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
diff --git a/classes/class.SimpleChoiceQuestionStatistics.php b/classes/class.SimpleChoiceQuestionStatistics.php
index a40746fba..63afaa678 100644
--- a/classes/class.SimpleChoiceQuestionStatistics.php
+++ b/classes/class.SimpleChoiceQuestionStatistics.php
@@ -14,9 +14,9 @@ class SimpleChoiceQuestionStatistics
*/
public function getQuestionCountForObject($oid)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
'SELECT count(question_id) count FROM rep_robj_xvid_comments comments, rep_robj_xvid_question questions
@@ -34,9 +34,9 @@ public function getQuestionCountForObject($oid)
*/
public function getPointsForUsers($oid)
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$questions_for_object = $this->getQuestionCountForObject($oid);
@@ -86,10 +86,9 @@ public function getScoreForAllQuestionsAndAllUser($oid)
{
$questions_list = $this->getQuestionIdsForObject($oid);
$questions_count = $this->getQuestionCountForObject($oid);
- /**
- * @var $ilDB ilDB
- */
-
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
SELECT score.user_id, points,questions.question_id, neutral_answer
@@ -187,6 +186,9 @@ public function getScoreForAllQuestionsAndAllUser($oid)
*/
public function getQuestionIdsForObject($oid)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$result_set = array();
$res = $ilDB->queryF(
@@ -213,9 +215,9 @@ public function getQuestionIdsForObject($oid)
*/
public function getQuestionsOverview($oid)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
'SELECT questions.question_id, questions.neutral_answer, score.user_id, score.points, comments.comment_id, comments.comment_title
@@ -285,9 +287,9 @@ public function getQuestionsOverview($oid)
*/
public function getAnsweredQuestionsFromUser($oid, $uid)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
'SELECT count(score.question_id) count FROM rep_robj_xvid_comments comments,
@@ -307,9 +309,9 @@ public function getAnsweredQuestionsFromUser($oid, $uid)
*/
public function getResponseFrequency($question_id)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
'SELECT rep_robj_xvid_answers.answer_id, count(rep_robj_xvid_answers.answer_id) AS counter FROM rep_robj_xvid_question
diff --git a/classes/class.ilHtmlInteractiveVideoPostPurifier.php b/classes/class.ilHtmlInteractiveVideoPostPurifier.php
index 6548dcf15..5e8143e9b 100644
--- a/classes/class.ilHtmlInteractiveVideoPostPurifier.php
+++ b/classes/class.ilHtmlInteractiveVideoPostPurifier.php
@@ -37,7 +37,7 @@ public function __construct()
* @return HTMLPurifier_Config Instance of HTMLPurifier_Config
*
*/
- protected function getPurifierConfigInstance()
+ protected function getPurifierConfigInstance() : HTMLPurifier_Config
{
include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
diff --git a/classes/class.ilInteractiveVideoCommentsTableGUI.php b/classes/class.ilInteractiveVideoCommentsTableGUI.php
index fa2b76a8e..9c4a0a009 100644
--- a/classes/class.ilInteractiveVideoCommentsTableGUI.php
+++ b/classes/class.ilInteractiveVideoCommentsTableGUI.php
@@ -33,7 +33,7 @@ public function isPublic() {
}
/**
- * @param ilObjectGUI $a_parent_obj
+ * @param ilObjectGUI|ilObjInteractiveVideoGUI $a_parent_obj
* @param string $a_parent_cmd
*/
public function __construct($a_parent_obj, $a_parent_cmd)
@@ -77,18 +77,21 @@ public function __construct($a_parent_obj, $a_parent_cmd)
$this->addColumn($this->lng->txt('user'), 'user_id');
}
$this->addColumn($this->lng->txt('title'), 'title');
- $this->addColumn($this->lng->txt('comment'), 'comment_text');
+ $this->addColumn($a_parent_obj->plugin->txt('comment_table_title'), 'comment_text');
if($ilAccess->checkAccess('write', '', $a_parent_obj->object->getRefId()) && $a_parent_cmd == 'editComments')
{
- $this->addColumn($a_parent_obj->plugin->txt('type'), 'is_interactive');
+ $this->addColumn($a_parent_obj->plugin->txt('type'), 'type');
+ $this->addColumn($a_parent_obj->plugin->txt('compulsory'), 'compulsory', '10%');
//$this->addColumn($a_parent_obj->plugin->txt('tutor'), 'is_tutor');
// $this->addCommandButton('showTutorInsertCommentForm', $this->lng->txt('insert'));
}
else
{
+ $this->addColumn($a_parent_obj->plugin->txt('compulsory'), 'compulsory', '10%');
$this->addColumn($a_parent_obj->plugin->txt('visibility'), 'is_private');
}
+
$this->addColumn($this->lng->txt('actions'), '', '10%');
$this->setSelectAllCheckbox('comment_id');
@@ -153,15 +156,18 @@ protected function fillRow($a_set)
$value = '';
}
}
- else if($key == 'is_interactive')
+ else if($key == 'type')
{
- $txt_value = $value == 1 ? 'question' : 'comment';
- $value = $this->lng->txt($txt_value);
+ $value = $this->lng->txt($value);
}
else if($key == 'is_tutor')
{
continue;
}
+ else if($key == 'compulsory')
+ {
+ $value = xvidUtils::yesNoString($value);
+ }
$this->tpl->setVariable('VAL_'.strtoupper($key), $value);
}
@@ -178,7 +184,10 @@ protected function fillRow($a_set)
}
else
{
- $link_target = $this->ctrl->getLinkTarget($this->parent_obj,$this->parent_cmd == 'editComments' ? 'editComment' : 'editMyComment');
+ $link_target = $this->ctrl->getLinkTarget($this->parent_obj,$this->parent_cmd == 'editComments' ? 'editComment' : 'editMyComment');
+ if($a_set['is_table_of_content'] === "1") {
+ $link_target = $this->ctrl->getLinkTarget($this->parent_obj,'editChapter');
+ }
}
$current_selection_list->addItem($this->lng->txt('edit'), '', $link_target);
diff --git a/classes/class.ilInteractiveVideoConfigGUI.php b/classes/class.ilInteractiveVideoConfigGUI.php
index bea3ae450..29eef65ca 100644
--- a/classes/class.ilInteractiveVideoConfigGUI.php
+++ b/classes/class.ilInteractiveVideoConfigGUI.php
@@ -34,9 +34,9 @@ class ilInteractiveVideoConfigGUI extends ilPluginConfigGUI
*/
protected $tabs;
- /**
- * @var ilDB
- */
+ /**
+ * @var $db ilDBInterface
+ */
protected $db;
/**
diff --git a/classes/class.ilInteractiveVideoDbUpdater.php b/classes/class.ilInteractiveVideoDbUpdater.php
index 201256e52..4d4a17979 100644
--- a/classes/class.ilInteractiveVideoDbUpdater.php
+++ b/classes/class.ilInteractiveVideoDbUpdater.php
@@ -7,6 +7,9 @@
class ilInteractiveVideoDbUpdater extends ilPluginDBUpdate
{
+ /**
+ * @var $db ilDBInterface
+ */
protected $db;
/**
diff --git a/classes/class.ilInteractiveVideoExporter.php b/classes/class.ilInteractiveVideoExporter.php
index c6f1c09f8..389b54463 100644
--- a/classes/class.ilInteractiveVideoExporter.php
+++ b/classes/class.ilInteractiveVideoExporter.php
@@ -115,6 +115,7 @@ private function exportXMLSettings()
$this->xml_writer->xmlElement('getLearningProgressMode', null, (int)$this->object->getLearningProgressMode());
$this->xml_writer->xmlElement('noComment', null, (int)$this->object->getDisableComment());
$this->xml_writer->xmlElement('noToolbar', null, (int)$this->object->getDisableToolbar());
+ $this->xml_writer->xmlElement('showTocFirst', null, (int)$this->object->getShowTocFirst());
$this->xml_writer->xmlElement('fixedModal', null, (int)$this->object->isFixedModal());
$this->xml_writer->xmlElement('autoResumeAfterQuestion', null, (int)$this->object->isAutoResumeAfterQuestion());
@@ -161,6 +162,7 @@ private function exportQuestions()
$this->xml_writer->xmlElement('CommentIsPrivate', null, (int) $row['is_private']);
$this->xml_writer->xmlElement('CommentTimeEnd', null, (int) $row['comment_time_end']);
$this->xml_writer->xmlElement('CommentIsReplyTo', null, (int) $row['is_reply_to']);
+ $this->xml_writer->xmlElement('CommentIsTableOfContent', null, (int) $row['is_table_of_content']);
$this->xml_writer->xmlElement('QuestionId', null, (int) $qid);
$this->xml_writer->xmlElement('QuestionText', null, (string) $row['question_text']);
diff --git a/classes/class.ilInteractiveVideoFFmpeg.php b/classes/class.ilInteractiveVideoFFmpeg.php
index 2ef43149a..3c1e2b353 100644
--- a/classes/class.ilInteractiveVideoFFmpeg.php
+++ b/classes/class.ilInteractiveVideoFFmpeg.php
@@ -38,14 +38,16 @@ static function extractImage($a_file, $a_target_filename, $a_target_dir = '', $a
}
}
- /**
- * @param $a_file
- * @param $a_target_filename
- * @param string $a_target_dir
- * @param int $a_sec
- * @param bool $return_json
- * @return string
- */
+ /**
+ * @param $a_file
+ * @param string $a_target_filename
+ * @param string $a_target_dir
+ * @param int $a_sec
+ * @param bool $return_json
+ * @return false|string
+ * @throws ilFFmpegException
+ * @throws ilWACException
+ */
static function extractImageWrapper($a_file, $a_target_filename = '', $a_target_dir = '', $a_sec = 1, $return_json = false)
{
$json_container = array();
diff --git a/classes/class.ilInteractiveVideoImporter.php b/classes/class.ilInteractiveVideoImporter.php
index b3f0bc03b..b20f05cd1 100644
--- a/classes/class.ilInteractiveVideoImporter.php
+++ b/classes/class.ilInteractiveVideoImporter.php
@@ -23,9 +23,22 @@ public function init()
$this->qti_path = $this->getImportDirectory().'/Plugins/xvid/set_1/expDir_1';
$this->xml_file = $this->getImportDirectory().'/Plugins/xvid/set_1/export.xml';
}
-
+
+ /**
+ * @param $a_entity
+ * @param $a_id
+ * @param $a_xml
+ * @param $a_mapping
+ * @return string|void
+ * @throws ilDatabaseException
+ * @throws ilObjectNotFoundException
+ * @throws ilSaxParserException
+ */
public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $tree, $ilDB;
$this->init();
diff --git a/classes/class.ilInteractiveVideoLearningProgressGUI.php b/classes/class.ilInteractiveVideoLearningProgressGUI.php
index cdd78c2da..88290095f 100644
--- a/classes/class.ilInteractiveVideoLearningProgressGUI.php
+++ b/classes/class.ilInteractiveVideoLearningProgressGUI.php
@@ -14,380 +14,380 @@
class ilInteractiveVideoLearningProgressGUI extends ilLearningProgressBaseGUI
{
- /**
- * @var ilObjInteractiveVideoGUI
- */
- protected $gui;
-
- /**
- * @var ilObjInteractiveVideo
- */
- public $object;
-
- /**
- * @var ilLanguage
- */
- public $lng;
-
- /**
- * @var ilCtrl
- */
- public $ctrl;
-
- /**
- * @var ilTemplate
- */
- public $tpl;
-
- /**
- * @var ilInteractiveVideoPlugin
- */
- public $plugin;
-
- /**
- * ilInteractiveVideoLearningProgressGUI constructor.
- * @param ilObjInteractiveVideoGUI $gui
- * @param ilObjInteractiveVideo $object
- */
- public function __construct(ilObjInteractiveVideoGUI $gui, ilObjInteractiveVideo $object)
- {
- global $tpl, $lng, $ilCtrl;
-
- $this->gui = $gui;
- $this->object = $object;
- $this->plugin = $this->gui->getPluginInstance();
-
- $this->tpl = $tpl;
- $this->lng = $lng;
- $this->ctrl = $ilCtrl;
- }
-
- /**
- *
- */
- public function executeCommand()
- {
- $cmd = $this->ctrl->getCmd();
- $this->$cmd();
- }
-
- /** LP related methods, maybe these could be move to another ilCtrl enabled class **/
- /**
- * @return int
- */
- public function getObjId()
- {
- return $this->object->getId();
- }
-
- private function addLearningProgressSubTabs()
- {
- /**
- * @var $ilTabs ilTabsGUI
- */
- global $ilTabs;
-
- if($this->gui->hasPermission('write') || $this->gui->hasPermission('read_learning_progress'))
- {
- if($this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
- {
- $ilTabs->addSubTab('lp_users', $this->gui->getPluginInstance()->txt('lp_users'), $this->ctrl->getLinkTarget($this, 'showLPUsers'));
- $ilTabs->addSubTab('lp_summary', $this->gui->getPluginInstance()->txt('lp_summary'), $this->ctrl->getLinkTarget($this, 'showLPSummary'));
- }
- $ilTabs->addSubTab('lp_settings', $this->lng->txt('trac_settings'), $this->ctrl->getLinkTarget($this, 'showLPSettings'));
- }
- else if($this->gui->hasPermission('read') && $this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
- {
- $ilTabs->addSubTab('lp_users', $this->gui->getPluginInstance()->txt('lp_users'), $this->ctrl->getLinkTarget($this, 'showLPUserDetails'));
- }
- }
-
- /**
- * @param ilPropertyFormGUI|null $form
- */
- public function showLPSettings(ilPropertyFormGUI $form = null)
- {
- /**
- * @var $ilTabs ilTabsGUI
- */
- global $ilTabs;
-
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- $this->addLearningProgressSubTabs();
- $ilTabs->activateSubTab('lp_settings');
-
- if(!($form instanceof ilPropertyFormGUI))
- {
- $form = $this->getLearningProgressSettingsForm();
- }
-
- $this->tpl->setContent($form->getHTML());
- }
-
- /**
- * Init property form
- *
- * @return ilPropertyFormGUI $form
- */
- public function getLearningProgressSettingsForm()
- {
- $form = new ilPropertyFormGUI();
- $form->setTitle($this->lng->txt('tracking_settings'));
- $form->setFormAction($this->ctrl->getFormAction($this, 'saveLearningProgressSettings'));
-
- $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
- $mod->setRequired(true);
- $form->addItem($mod);
-
- foreach($this->object->getLPValidModes() as $mode)
- {
- if($this->object->isCoreLPMode($mode))
- {
- $opt = new ilRadioOption(
- ilLPObjSettings::_mode2Text($mode),
- $mode,
- ilLPObjSettings::_mode2InfoText($mode)
- );
- }
- else
- {
- $opt = new ilRadioOption(
- $this->gui->getPluginInstance()->txt('lp_mode_title_' . $this->object->getInternalLabelForLPMode($mode)),
- $mode,
- $this->gui->getPluginInstance()->txt('lp_mode_desc_' . $this->object->getInternalLabelForLPMode($mode))
- );
- }
-
- $mod->addOption($opt);
- }
- $mod->setValue($this->object->getLearningProgressMode());
-
- $form->addCommandButton('saveLearningProgressSettings', $this->lng->txt('save'));
-
- return $form;
- }
-
- /**
- * Save learning progress settings
- */
- public function saveLearningProgressSettings()
- {
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- $form = $this->getLearningProgressSettingsForm();
- if($form->checkInput())
- {
- $this->addLearningProgressSubTabs();
-
- $new_mode = (int)$form->getInput('modus');
- $old_mode = (int)$this->object->getLearningProgressMode();
- $mode_changed = ($old_mode != $new_mode);
-
- $this->object->setLearningProgressMode($new_mode);
- $this->object->update();
-
- if($mode_changed)
- {
- include_once 'Services/Tracking/classes/class.ilLPStatusWrapper.php';
- ilLPStatusWrapper::_refreshStatus($this->object->getId());
- }
-
- ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
- $this->ctrl->redirect($this, 'showLPSettings');
- }
-
- $form->setValuesByPost();
- $this->showLPSettings($form);
- }
-
- /**
- *
- */
- public function showLPUsers()
- {
- /**
- * @var $ilTabs ilTabsGUI
- */
- global $ilTabs;
-
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- $this->addLearningProgressSubTabs();
- $ilTabs->activateSubTab('lp_users');
-
- $this->gui->getPluginInstance()->includeClass('class.ilInteractiveVideoLPUsersTableGUI.php');
- $table = new ilInteractiveVideoLPUsersTableGUI($this, 'showLPUsers', $this->object->getId(), $this->object->getRefId(), false);
- $this->tpl->setContent(implode('
', array($table->getHTML(), $this->__getLegendHTML())));
- }
-
- /**
- *
- */
- public function showLPSummary()
- {
- /**
- * @var $ilTabs ilTabsGUI
- */
- global $ilTabs;
-
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- $this->addLearningProgressSubTabs();
- $ilTabs->activateSubTab('lp_summary');
-
- $this->gui->getPluginInstance()->includeClass('class.ilInteractiveVideoLPSummaryTableGUI.php');
- $table = new ilInteractiveVideoLPSummaryTableGUI($this, 'showLPSummary', $this->object->getRefId(), $this->gui->getPluginInstance());
- $this->tpl->setContent(implode('
', array($table->getHTML(), $this->__getLegendHTML())));
- }
-
- public function showLPUserDetails()
- {
- /**
- * @var $ilTabs ilTabsGUI
- * @var $ilUser ilObjuser
- */
- global $ilTabs, $ilUser;
-
- $this->gui->ensurePermission('read');
-
- $this->addLearningProgressSubTabs();
- $ilTabs->activateSubTab('lp_summary');
-
- if($this->object->getLearningProgressMode() == ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
- {
- $this->ctrl->redirect($this->gui, $this->gui->getStandardCmd());
- }
-
- include_once('./Services/InfoScreen/classes/class.ilInfoScreenGUI.php');
- $cloned_controller = clone $this;
- $cloned_controller->object = null;
- $info = new ilInfoScreenGUI($cloned_controller);
- $info->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
- $info->addSection($this->lng->txt('trac_learning_progress'));
- include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
- $status = ilLearningProgressBaseGUI::__readStatus($this->object->getId(), $ilUser->getId());
- $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
- $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
- $info->addProperty($this->lng->txt('trac_status'), ilUtil::img($status_path, $status_text)." ".$status_text);
- include_once 'Services/Tracking/classes/class.ilLPMarks.php';
- if(strlen($mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId())))
- {
- $info->addProperty($this->lng->txt('trac_mark'),$mark);
- }
- if(strlen($comment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId())))
- {
- $info->addProperty($this->lng->txt('trac_comment'),$comment);
- }
-
- $this->tpl->setContent(implode('
', array($info->getHTML(), $this->__getLegendHTML())));
- }
-
- /**
- * @param ilPropertyFormGUI $form
- */
- public function editUser(ilPropertyFormGUI $form = null)
- {
- /**
- * @var $ilTabs ilTabsGUI
- */
- global $ilTabs;
-
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- $this->addLearningProgressSubTabs();
- $ilTabs->activateSubTab('lp_users');
-
- if(!isset($_GET['user_id']))
- {
- return $this->showLPUsers();
- }
-
- $user = ilObjectFactory::getInstanceByObjId((int)$_GET['user_id'], false);
- if(!$user instanceof ilObjUser)
- {
- return $this->showLPUsers();
- }
-
- include_once('./Services/InfoScreen/classes/class.ilInfoScreenGUI.php');
- $cloned_controller = clone $this;
- $cloned_controller->object = null;
- $info = new ilInfoScreenGUI($cloned_controller);
- $info->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
- $info->addSection($this->lng->txt('trac_user_data'));
- $info->addProperty($this->lng->txt('last_login'), ilDatePresentation::formatDate(new ilDateTime($user->getLastLogin(), IL_CAL_DATETIME)));
- $info->addProperty($this->lng->txt('trac_total_online'), ilDatePresentation::secondsToString(ilOnlineTracking::getOnlineTime($user->getId())));
-
- if(!$form instanceof ilPropertyFormGUI)
- {
- $form = $this->getLPMarksForm($user);
-
- include_once 'Services/Tracking/classes/class.ilLPMarks.php';
- $marks = new ilLPMarks($this->object->getId(), $user->getId());
-
- $form->setValuesByArray(array(
- 'comment' => $marks->getComment(),
- 'mark' => $marks->getMark()
- ));
- }
-
- $this->tpl->setContent(implode('
', array($form->getHtml(), $info->getHTML())));
- }
-
- /**
- * @param ilObjUser $user
- * @return ilPropertyFormGUI
- */
- protected function getLPMarksForm(ilObjUser $user)
- {
- require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
- $form = new ilPropertyFormGUI();
- $this->ctrl->setParameter($this, 'user_id', $user->getId());
- $form->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
- $form->setTitle($this->lng->txt('edit'). ': '. $this->lng->txt('trac_learning_progress_tbl_header') . $user->getFullname() );
- $form->setDescription($this->lng->txt('trac_mode').': '.ilLPObjSettings::_mode2Text($this->object->getLearningProgressMode()));
-
- $mark = new ilTextInputGUI($this->lng->txt('trac_mark'), 'mark');
- $mark->setSize(5);
- $form->addItem($mark);
-
- $comment = new ilTextInputGUI($this->lng->txt('trac_comment'), 'comment');
- $form->addItem($comment);
-
- $form->addCommandButton('updateLPUsers', $this->lng->txt('save'));
- $form->addCommandButton('showLPUsers', $this->lng->txt('cancel'));
-
- return $form;
- }
-
- public function updateLPUsers()
- {
- $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
-
- if(!isset($_GET['user_id']))
- {
- return $this->showLPUsers();
- }
-
- $user = ilObjectFactory::getInstanceByObjId((int)$_GET['user_id'], false);
- if(!$user instanceof ilObjUser)
- {
- return $this->showLPUsers();
- }
-
- $form = $this->getLPMarksForm($user);
- if($form->checkInput())
- {
- include_once 'Services/Tracking/classes/class.ilLPMarks.php';
- $marks = new ilLPMarks($this->object->getId(), $user->getId());
- $marks->setMark($form->getInput('mark'));
- $marks->setComment($form->getInput('comment'));
- $marks->update();
- ilUtil::sendSuccess($this->lng->txt('trac_update_edit_user'));
- return $this->showLPUsers();
- }
-
- $form->setValuesByPost();
- $this->editUser($form);
- }
+ /**
+ * @var ilObjInteractiveVideoGUI
+ */
+ protected $gui;
+
+ /**
+ * @var ilObjInteractiveVideo
+ */
+ public $object;
+
+ /**
+ * @var ilLanguage
+ */
+ public $lng;
+
+ /**
+ * @var ilCtrl
+ */
+ public $ctrl;
+
+ /**
+ * @var ilTemplate
+ */
+ public $tpl;
+
+ /**
+ * @var ilInteractiveVideoPlugin
+ */
+ public $plugin;
+
+ /**
+ * ilInteractiveVideoLearningProgressGUI constructor.
+ * @param ilObjInteractiveVideoGUI $gui
+ * @param ilObjInteractiveVideo $object
+ */
+ public function __construct(ilObjInteractiveVideoGUI $gui, ilObjInteractiveVideo $object)
+ {
+ global $tpl, $lng, $ilCtrl;
+
+ $this->gui = $gui;
+ $this->object = $object;
+ $this->plugin = $this->gui->getPluginInstance();
+
+ $this->tpl = $tpl;
+ $this->lng = $lng;
+ $this->ctrl = $ilCtrl;
+ }
+
+ /**
+ *
+ */
+ public function executeCommand()
+ {
+ $cmd = $this->ctrl->getCmd();
+ $this->$cmd();
+ }
+
+ /** LP related methods, maybe these could be move to another ilCtrl enabled class **/
+ /**
+ * @return int
+ */
+ public function getObjId()
+ {
+ return $this->object->getId();
+ }
+
+ private function addLearningProgressSubTabs()
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ */
+ global $ilTabs;
+
+ if ($this->gui->hasPermission('write') || $this->gui->hasPermission('read_learning_progress')) {
+ if ($this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED) {
+ $ilTabs->addSubTab('lp_users', $this->gui->getPluginInstance()->txt('lp_users'),
+ $this->ctrl->getLinkTarget($this, 'showLPUsers'));
+ $ilTabs->addSubTab('lp_summary', $this->gui->getPluginInstance()->txt('lp_summary'),
+ $this->ctrl->getLinkTarget($this, 'showLPSummary'));
+ }
+ $ilTabs->addSubTab('lp_settings', $this->lng->txt('trac_settings'),
+ $this->ctrl->getLinkTarget($this, 'showLPSettings'));
+ } else {
+ if ($this->gui->hasPermission('read') && $this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED) {
+ $ilTabs->addSubTab('lp_users', $this->gui->getPluginInstance()->txt('lp_users'),
+ $this->ctrl->getLinkTarget($this, 'showLPUserDetails'));
+ }
+ }
+ }
+
+ /**
+ * @param ilPropertyFormGUI|null $form
+ */
+ public function showLPSettings(ilPropertyFormGUI $form = null)
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ */
+ global $ilTabs;
+
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ $this->addLearningProgressSubTabs();
+ $ilTabs->activateSubTab('lp_settings');
+
+ if (!($form instanceof ilPropertyFormGUI)) {
+ $form = $this->getLearningProgressSettingsForm();
+ }
+
+ $this->tpl->setContent($form->getHTML());
+ }
+
+ /**
+ * Init property form
+ *
+ * @return ilPropertyFormGUI $form
+ */
+ public function getLearningProgressSettingsForm()
+ {
+ $form = new ilPropertyFormGUI();
+ $form->setTitle($this->lng->txt('tracking_settings'));
+ $form->setFormAction($this->ctrl->getFormAction($this, 'saveLearningProgressSettings'));
+
+ $mod = new ilRadioGroupInputGUI($this->lng->txt('trac_mode'), 'modus');
+ $mod->setRequired(true);
+ $form->addItem($mod);
+
+ foreach ($this->object->getLPValidModes() as $mode) {
+ if ($this->object->isCoreLPMode($mode)) {
+ $opt = new ilRadioOption(
+ ilLPObjSettings::_mode2Text($mode),
+ $mode,
+ ilLPObjSettings::_mode2InfoText($mode)
+ );
+ } else {
+ $opt = new ilRadioOption(
+ $this->gui->getPluginInstance()->txt('lp_mode_title_' . $this->object->getInternalLabelForLPMode($mode)),
+ $mode,
+ $this->gui->getPluginInstance()->txt('lp_mode_desc_' . $this->object->getInternalLabelForLPMode($mode))
+ );
+ }
+
+ $mod->addOption($opt);
+ }
+ $mod->setValue($this->object->getLearningProgressMode());
+
+ $form->addCommandButton('saveLearningProgressSettings', $this->lng->txt('save'));
+
+ return $form;
+ }
+
+ /**
+ * Save learning progress settings
+ */
+ public function saveLearningProgressSettings()
+ {
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ $form = $this->getLearningProgressSettingsForm();
+ if ($form->checkInput()) {
+ $this->addLearningProgressSubTabs();
+
+ $new_mode = (int) $form->getInput('modus');
+ $old_mode = (int) $this->object->getLearningProgressMode();
+ $mode_changed = ($old_mode != $new_mode);
+
+ $this->object->setLearningProgressMode($new_mode);
+ $this->object->update();
+
+ ilUtil::sendSuccess($this->lng->txt('trac_settings_saved'), true);
+ if ($mode_changed) {
+ $this->ctrl->redirect($this, 'refreshStatusAndShowLPSettings');
+ }
+
+ $this->ctrl->redirect($this, 'showLPSettings');
+ }
+
+ $form->setValuesByPost();
+ $this->showLPSettings($form);
+ }
+
+ /**
+ *
+ */
+ public function refreshStatusAndShowLPSettings()
+ {
+ $this->object->refreshLearningProgress();
+
+ $this->showLPSettings();
+ }
+
+ /**
+ *
+ */
+ public function showLPUsers()
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ */
+ global $ilTabs;
+
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ $this->addLearningProgressSubTabs();
+ $ilTabs->activateSubTab('lp_users');
+
+ $this->gui->getPluginInstance()->includeClass('class.ilInteractiveVideoLPUsersTableGUI.php');
+ $table = new ilInteractiveVideoLPUsersTableGUI($this, 'showLPUsers', $this->object->getId(),
+ $this->object->getRefId(), false);
+ $this->tpl->setContent(implode('
', array($table->getHTML(), $this->__getLegendHTML())));
+ }
+
+ /**
+ *
+ */
+ public function showLPSummary()
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ */
+ global $ilTabs;
+
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ $this->addLearningProgressSubTabs();
+ $ilTabs->activateSubTab('lp_summary');
+
+ $this->gui->getPluginInstance()->includeClass('class.ilInteractiveVideoLPSummaryTableGUI.php');
+ $table = new ilInteractiveVideoLPSummaryTableGUI($this, 'showLPSummary', $this->object->getRefId(),
+ $this->gui->getPluginInstance());
+ $this->tpl->setContent(implode('
', array($table->getHTML(), $this->__getLegendHTML())));
+ }
+
+ public function showLPUserDetails()
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ * @var $ilUser ilObjuser
+ */
+ global $ilTabs, $ilUser;
+
+ $this->gui->ensurePermission('read');
+
+ $this->addLearningProgressSubTabs();
+ $ilTabs->activateSubTab('lp_summary');
+
+ if ($this->object->getLearningProgressMode() == ilObjInteractiveVideo::LP_MODE_DEACTIVATED) {
+ $this->ctrl->redirect($this->gui, $this->gui->getStandardCmd());
+ }
+
+ include_once('./Services/InfoScreen/classes/class.ilInfoScreenGUI.php');
+ $cloned_controller = clone $this;
+ $cloned_controller->object = null;
+ $info = new ilInfoScreenGUI($cloned_controller);
+ $info->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
+ $info->addSection($this->lng->txt('trac_learning_progress'));
+ include_once("./Services/Tracking/classes/class.ilLearningProgressBaseGUI.php");
+ $status = ilLearningProgressBaseGUI::__readStatus($this->object->getId(), $ilUser->getId());
+ $status_path = ilLearningProgressBaseGUI::_getImagePathForStatus($status);
+ $status_text = ilLearningProgressBaseGUI::_getStatusText($status);
+ $info->addProperty($this->lng->txt('trac_status'),
+ ilUtil::img($status_path, $status_text) . " " . $status_text);
+ include_once 'Services/Tracking/classes/class.ilLPMarks.php';
+ if (strlen($mark = ilLPMarks::_lookupMark($ilUser->getId(), $this->object->getId()))) {
+ $info->addProperty($this->lng->txt('trac_mark'), $mark);
+ }
+ if (strlen($comment = ilLPMarks::_lookupComment($ilUser->getId(), $this->object->getId()))) {
+ $info->addProperty($this->lng->txt('trac_comment'), $comment);
+ }
+
+ $this->tpl->setContent(implode('
', array($info->getHTML(), $this->__getLegendHTML())));
+ }
+
+ /**
+ * @param ilPropertyFormGUI $form
+ */
+ public function editUser(ilPropertyFormGUI $form = null)
+ {
+ /**
+ * @var $ilTabs ilTabsGUI
+ */
+ global $ilTabs;
+
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ $this->addLearningProgressSubTabs();
+ $ilTabs->activateSubTab('lp_users');
+
+ if (!isset($_GET['user_id'])) {
+ return $this->showLPUsers();
+ }
+
+ $user = ilObjectFactory::getInstanceByObjId((int) $_GET['user_id'], false);
+ if (!$user instanceof ilObjUser) {
+ return $this->showLPUsers();
+ }
+
+ include_once('./Services/InfoScreen/classes/class.ilInfoScreenGUI.php');
+ $cloned_controller = clone $this;
+ $cloned_controller->object = null;
+ $info = new ilInfoScreenGUI($cloned_controller);
+ $info->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
+ $info->addSection($this->lng->txt('trac_user_data'));
+ $info->addProperty($this->lng->txt('last_login'),
+ ilDatePresentation::formatDate(new ilDateTime($user->getLastLogin(), IL_CAL_DATETIME)));
+ $info->addProperty($this->lng->txt('trac_total_online'),
+ ilDatePresentation::secondsToString(ilOnlineTracking::getOnlineTime($user->getId())));
+
+ if (!$form instanceof ilPropertyFormGUI) {
+ $form = $this->getLPMarksForm($user);
+
+ include_once 'Services/Tracking/classes/class.ilLPMarks.php';
+ $marks = new ilLPMarks($this->object->getId(), $user->getId());
+
+ $form->setValuesByArray(array(
+ 'comment' => $marks->getComment(),
+ 'mark' => $marks->getMark()
+ ));
+ }
+
+ $this->tpl->setContent(implode('
', array($form->getHtml(), $info->getHTML())));
+ }
+
+ /**
+ * @param ilObjUser $user
+ * @return ilPropertyFormGUI
+ */
+ protected function getLPMarksForm(ilObjUser $user)
+ {
+ require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
+ $form = new ilPropertyFormGUI();
+ $this->ctrl->setParameter($this, 'user_id', $user->getId());
+ $form->setFormAction($this->ctrl->getFormAction($this, 'editUser'));
+ $form->setTitle($this->lng->txt('edit') . ': ' . $this->lng->txt('trac_learning_progress_tbl_header') . $user->getFullname());
+ $form->setDescription($this->lng->txt('trac_mode') . ': ' . ilLPObjSettings::_mode2Text($this->object->getLearningProgressMode()));
+
+ $mark = new ilTextInputGUI($this->lng->txt('trac_mark'), 'mark');
+ $mark->setSize(5);
+ $form->addItem($mark);
+
+ $comment = new ilTextInputGUI($this->lng->txt('trac_comment'), 'comment');
+ $form->addItem($comment);
+
+ $form->addCommandButton('updateLPUsers', $this->lng->txt('save'));
+ $form->addCommandButton('showLPUsers', $this->lng->txt('cancel'));
+
+ return $form;
+ }
+
+ public function updateLPUsers()
+ {
+ $this->gui->ensureAtLeastOnePermission(array('write', 'read_learning_progress'));
+
+ if (!isset($_GET['user_id'])) {
+ return $this->showLPUsers();
+ }
+
+ $user = ilObjectFactory::getInstanceByObjId((int) $_GET['user_id'], false);
+ if (!$user instanceof ilObjUser) {
+ return $this->showLPUsers();
+ }
+
+ $form = $this->getLPMarksForm($user);
+ if ($form->checkInput()) {
+ include_once 'Services/Tracking/classes/class.ilLPMarks.php';
+ $marks = new ilLPMarks($this->object->getId(), $user->getId());
+ $marks->setMark($form->getInput('mark'));
+ $marks->setComment($form->getInput('comment'));
+ $marks->update();
+ ilUtil::sendSuccess($this->lng->txt('trac_update_edit_user'));
+ return $this->showLPUsers();
+ }
+
+ $form->setValuesByPost();
+ $this->editUser($form);
+ }
}
\ No newline at end of file
diff --git a/classes/class.ilInteractiveVideoPlugin.php b/classes/class.ilInteractiveVideoPlugin.php
index 44d1711e9..48f5310a7 100644
--- a/classes/class.ilInteractiveVideoPlugin.php
+++ b/classes/class.ilInteractiveVideoPlugin.php
@@ -53,7 +53,33 @@ public static function getInstance()
return self::$instance;
}
- /**
+ protected function beforeActivation()
+ {
+ $return = parent::beforeActivation();
+
+ require_once 'Services/Migration/DBUpdate_3560/classes/class.ilDBUpdateNewObjectType.php';
+ $type = 'xvid';
+ $typeId = ilDBUpdateNewObjectType::getObjectTypeId($type);
+ $readLpOpsId = ilDBUpdateNewObjectType::getCustomRBACOperationId('read_learning_progress');
+ $editLpOpsId = ilDBUpdateNewObjectType::getCustomRBACOperationId('edit_learning_progress');
+ $writeOpsId = ilDBUpdateNewObjectType::getCustomRBACOperationId('write');
+ if ($readLpOpsId && $editLpOpsId && $writeOpsId) {
+ $readLpAdded = ilDBUpdateNewObjectType::addRBACOperation($typeId, $readLpOpsId);
+ $editLpAdded = ilDBUpdateNewObjectType::addRBACOperation($typeId, $editLpOpsId);
+ if ($readLpAdded) {
+ ilDBUpdateNewObjectType::cloneOperation($type, $writeOpsId, $readLpOpsId);
+ }
+
+ if ($editLpAdded) {
+ ilDBUpdateNewObjectType::cloneOperation($type, $writeOpsId, $editLpOpsId);
+ }
+ }
+
+ return $return;
+ }
+
+
+ /**
* @return string
*/
public function getPluginName()
diff --git a/classes/class.ilInteractiveVideoSimpleChoiceQuestionsXMLParser.php b/classes/class.ilInteractiveVideoSimpleChoiceQuestionsXMLParser.php
index 9eaa54f0b..cdd395dab 100644
--- a/classes/class.ilInteractiveVideoSimpleChoiceQuestionsXMLParser.php
+++ b/classes/class.ilInteractiveVideoSimpleChoiceQuestionsXMLParser.php
@@ -33,10 +33,11 @@ class ilInteractiveVideoSimpleChoiceQuestionsXMLParser extends ilInteractiveVide
*/
protected $questions = 0;
- /**
- * @param ilObjInteractiveVideo $xvid_obj
- * @param $xmlFile
- */
+ /**
+ * ilInteractiveVideoSimpleChoiceQuestionsXMLParser constructor.
+ * @param ilObjInteractiveVideo $xvid_obj
+ * @param $xmlFile
+ */
public function __construct($xvid_obj, $xmlFile)
{
$this->xvid_obj = $xvid_obj;
diff --git a/classes/class.ilInteractiveVideoXMLParser.php b/classes/class.ilInteractiveVideoXMLParser.php
index 43cfbdd2b..0d88c7469 100644
--- a/classes/class.ilInteractiveVideoXMLParser.php
+++ b/classes/class.ilInteractiveVideoXMLParser.php
@@ -117,6 +117,7 @@ public function handlerBeginTag($xmlParser, $tagName, $tagAttributes)
case 'noCommentStream':
case 'noComment':
case 'noToolbar':
+ case 'showTocFirst':
case 'fixedModal':
case 'autoResumeAfterQuestion':
case 'studentMarker':
@@ -237,6 +238,10 @@ public function handlerEndTag($xmlParser, $tagName)
$this->xvid_obj->setAutoResumeAfterQuestion(trim($this->cdata));
$this->cdata = '';
break;
+ case 'show_toc_first':
+ $this->xvid_obj->setShowTocFirst(trim($this->cdata));
+ $this->cdata = '';
+ break;
case 'studentMarker':
# $this->xvid_obj->setMarkerForStudents(trim($this->cdata));
$this->cdata = '';
diff --git a/classes/class.ilObjComment.php b/classes/class.ilObjComment.php
index e6485e970..229141e19 100644
--- a/classes/class.ilObjComment.php
+++ b/classes/class.ilObjComment.php
@@ -69,6 +69,11 @@ class ilObjComment
*/
protected $is_private = 0;
+ /**
+ * @var int
+ */
+ protected $is_table_of_content = 0;
+
/**
* @var int
*/
@@ -99,11 +104,22 @@ class ilObjComment
*/
protected static $user_image_cache = array();
+ /**
+ * @var ilDBInterface
+ */
+ protected $db;
+
/**
* @param int $comment_id
*/
public function __construct($comment_id = 0)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
+ global $ilDB;
+ $this->db = $ilDB;
+
if($comment_id > 0)
{
$this->setCommentId($comment_id);
@@ -113,17 +129,13 @@ public function __construct($comment_id = 0)
public function read()
{
- /**
- * @var $ilDB ilDB
- */
- global $ilDB;
- $res = $ilDB->queryF(
+ $res = $this->db->queryF(
'SELECT * FROM rep_robj_xvid_comments WHERE comment_id = %s',
array('integer'),
array($this->getCommentId())
);
- $row = $ilDB->fetchAssoc($res);
+ $row = $this->db->fetchAssoc($res);
$this->setCommentText($row['comment_text']);
$this->setCommentTime($row['comment_time']);
@@ -134,6 +146,7 @@ public function read()
$this->setCommentTitle($row['comment_title']);
$this->setCommentTags($row['comment_tags']);
$this->setIsPrivate($row['is_private']);
+ $this->setIsTableOfContent($row['is_table_of_content']);
$this->setIsReplyTo($row['is_reply_to']);
}
@@ -143,11 +156,10 @@ public function read()
*/
public function create($return_next_id = false)
{
- /**
- * @var $ilDB ilDB
- * @var $ilUser ilObjUser
- */
- global $ilDB, $ilUser;
+ /**
+ * @var $ilUser ilObjUser
+ */
+ global $ilUser;
$purify = new ilHtmlInteractiveVideoPostPurifier();
$text = $purify->purify($this->getCommentText());
@@ -155,9 +167,9 @@ public function create($return_next_id = false)
{
$this->removeOldReplyTo($this->getIsReplyTo());
}
- $next_id = $ilDB->nextId('rep_robj_xvid_comments');
+ $next_id = $this->db->nextId('rep_robj_xvid_comments');
$this->setCommentId($next_id);
- $ilDB->insert('rep_robj_xvid_comments',
+ $this->db->insert('rep_robj_xvid_comments',
array(
'comment_id' => array('integer', $next_id),
'obj_id' => array('integer', $this->getObjId()),
@@ -170,6 +182,7 @@ public function create($return_next_id = false)
'comment_title' => array('text', $this->getCommentTitle()),
'comment_tags' => array('text', $this->getCommentTags()),
'is_private' => array('integer', $this->getIsPrivate()),
+ 'is_table_of_content'=> array('integer', $this->getIsTableOfContent()),
'is_reply_to' => array('integer', $this->getIsReplyTo())
));
if($return_next_id)
@@ -184,22 +197,24 @@ public function create($return_next_id = false)
*/
public function removeOldReplyTo($reply_to)
{
- global $ilDB, $ilUser;
- $ilDB->manipulateF('DELETE FROM rep_robj_xvid_comments WHERE is_reply_to = %s AND user_id = %s',
+ /**
+ * @var $ilUser ilObjUser
+ */
+ global $ilUser;
+ $this->db->manipulateF('DELETE FROM rep_robj_xvid_comments WHERE is_reply_to = %s AND user_id = %s',
array('integer', 'integer'), array($reply_to, $ilUser->getId()));
}
public function update()
{
- /**
- * @var $ilDB ilDB
- * @var $ilUser ilObjUser
- */
- global $ilDB, $ilUser;
+ /**
+ * @var $ilUser ilObjUser
+ */
+ global $ilUser;
$purify = new ilHtmlInteractiveVideoPostPurifier();
$text = $purify->purify($this->getCommentText());
- $ilDB->update('rep_robj_xvid_comments',
+ $this->db->update('rep_robj_xvid_comments',
array(
'is_interactive' => array('integer', (int)$this->isInteractive()),
'user_id' => array('integer', $ilUser->getId()),
@@ -209,6 +224,7 @@ public function update()
'comment_title' => array('text', $this->getCommentTitle()),
'comment_tags' => array('text', $this->getCommentTags()),
'is_private' => array('integer', $this->getIsPrivate()),
+ 'is_table_of_content'=> array('integer', $this->getIsTableOfContent()),
'is_reply_to' => array('integer', $this->getIsReplyTo())
),
array(
@@ -224,12 +240,11 @@ public function update()
*/
public function deleteComments($comment_ids)
{
- global $ilDB;
if(!is_array($comment_ids))
return false;
- $ilDB->manipulate('DELETE FROM rep_robj_xvid_comments WHERE ' . $ilDB->in('comment_id', $comment_ids, false, 'integer'));
+ $this->db->manipulate('DELETE FROM rep_robj_xvid_comments WHERE ' . $this->db->in('comment_id', $comment_ids, false, 'integer'));
}
@@ -238,12 +253,7 @@ public function deleteComments($comment_ids)
*/
public function getStopPoints()
{
- /**
- * @vas $ilDB ilDB
- */
- global $ilDB;
-
- $res = $ilDB->queryF(
+ $res = $this->db->queryF(
'SELECT comment_time
FROM rep_robj_xvid_comments
WHERE obj_id = %s
@@ -253,7 +263,7 @@ public function getStopPoints()
);
$stop_points = array();
- while($row = $ilDB->fetchAssoc($res))
+ while($row = $this->db->fetchAssoc($res))
{
$stop_points[] = $row['comment_time'];
}
@@ -261,13 +271,14 @@ public function getStopPoints()
return $stop_points;
}
- /**
- * @return array
- */
- public function getContentComments()
+ /**
+ * @param false $toc
+ * @return array
+ */
+ public function getContentComments($toc = false)
{
/**
- * @var $ilDB ilDB
+ * @var $ilDB
*/
global $ilDB, $ilUser;
@@ -283,7 +294,7 @@ public function getContentComments()
$query_data = array_merge($query_data, array($ilUser->getId(), 1, 1));
}
- $res = $ilDB->queryF(
+ $res = $this->db->queryF(
'SELECT *
FROM rep_robj_xvid_comments
WHERE obj_id = %s
@@ -297,7 +308,7 @@ public function getContentComments()
$comments = array();
$is_reply_to = array();
$i = 0;
- while($row = $ilDB->fetchAssoc($res))
+ while($row = $this->db->fetchAssoc($res))
{
$temp = array();
$temp['comment_id'] = $row['comment_id'];
@@ -323,6 +334,7 @@ public function getContentComments()
$temp['comment_tags'] = $row['comment_tags'];
$temp['is_interactive'] = $row['is_interactive'];
$temp['is_private'] = $row['is_private'];
+ $temp['is_table_of_content'] = $row['is_table_of_content'];
$temp['is_reply_to'] = $row['is_reply_to'];
$temp['replies'] = array();
@@ -332,7 +344,12 @@ public function getContentComments()
}
else
{
- $comments[$i] = $temp;
+ if($toc === false) {
+ $comments[$i] = $temp;
+ } elseif($toc === true && $temp['is_table_of_content'] === "1"){
+ $comments[$i] = $temp;
+ }
+
$i++;
}
}
@@ -370,9 +387,8 @@ protected function sortInReplies($is_reply_to, $comments)
*/
public function cloneTutorComments($old_id, $new_id)
{
- global $ilDB;
$questions_array = array();
- $res = $ilDB->queryF(
+ $res = $this->db->queryF(
'SELECT *
FROM rep_robj_xvid_comments
WHERE obj_id = %s
@@ -381,7 +397,7 @@ public function cloneTutorComments($old_id, $new_id)
array('integer'),
array($old_id)
);
- while($row = $ilDB->fetchAssoc($res))
+ while($row = $this->db->fetchAssoc($res))
{
$this->setObjId($new_id);
$this->setCommentText($row['comment_text']);
@@ -393,6 +409,7 @@ public function cloneTutorComments($old_id, $new_id)
$this->setCommentTitle($row['comment_title']);
$this->setCommentTags($row['comment_tags']);
$this->setIsPrivate($row['is_private']);
+ $this->setIsTableOfContent($row['is_table_of_content']);
$this->setIsReplyTo($row['is_reply_to']);
$new_comment_id = $this->create(true);
if((bool)$row['is_interactive'])
@@ -415,18 +432,23 @@ public static function getUserImageInBase64($user_id)
{
if(!array_key_exists($user_id, self::$user_image_cache))
{
- $img_file = ilObjUser::_getPersonalPicturePath($user_id, 'xxsmall');
- $img_file = preg_split('/\?/', $img_file);
- $img_file = $img_file[0];
- if(file_exists($img_file))
- {
- $binary = fread(fopen($img_file, "r"), filesize($img_file));
- self::$user_image_cache[$user_id] = 'data:image/jpeg;base64,' . base64_encode($binary);
- }
- else if(strlen($img_file) > 0)
- {
- self::$user_image_cache[$user_id] = $img_file;
- }
+ if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
+ $img_file = ilObjUser::_getPersonalPicturePath($user_id, 'xxsmall');
+ $img_file = preg_split('/\?/', $img_file);
+ $img_file = $img_file[0];
+ if(file_exists($img_file))
+ {
+ $binary = fread(fopen($img_file, "r"), filesize($img_file));
+ self::$user_image_cache[$user_id] = 'data:image/jpeg;base64,' . base64_encode($binary);
+ }
+ else if(strlen($img_file) > 0)
+ {
+ self::$user_image_cache[$user_id] = $img_file;
+ }
+ } else {
+ return null;
+ }
+
}
return self::$user_image_cache[$user_id];
@@ -440,7 +462,13 @@ public static function lookupUsername($user_id)
{
if(!array_key_exists($user_id, self::$user_name_cache))
{
- $user = new ilObjUser($user_id);
+ if (strlen(ilObjUser::_lookupLogin($user_id)) > 0) {
+ $user = new ilObjUser($user_id);
+ } else {
+ global $DIC;
+ $user = new ilObjUser();
+ $user->setLastname($DIC->language()->txt("deleted_user"));
+ }
if($user->hasPublicProfile())
{
self::$user_name_cache[$user_id] = $user->getFirstname() . ' ' . $user->getLastname();
@@ -454,7 +482,36 @@ public static function lookupUsername($user_id)
return self::$user_name_cache[$user_id];
}
-
+ /**
+ * @param int $question_id
+ * @return string
+ */
+ public static function getCommentTitleByQuestionId($question_id)
+ {
+ /**
+ * @vas $ilDB ilDB
+ */
+ global $ilDB;
+
+ $title = $question_id;
+
+ $res = $ilDB->queryF(
+ 'SELECT * FROM rep_robj_xvid_comments
+ INNER JOIN rep_robj_xvid_question
+ ON rep_robj_xvid_comments.comment_id = rep_robj_xvid_question.comment_id
+ WHERE rep_robj_xvid_question.question_id=%s;',
+ array('integer'),
+ array($question_id)
+ );
+
+ while($row = $ilDB->fetchAssoc($res))
+ {
+ $title = $row['comment_title'];
+ }
+
+ return $title;
+ }
+
################## SETTER & GETTER ##################
/**
* @return int
@@ -617,7 +674,21 @@ public function setIsPrivate($is_private)
$this->is_private = $is_private;
}
-
+ /**
+ * @return int
+ */
+ public function getIsTableOfContent()
+ {
+ return $this->is_table_of_content;
+ }
+
+ /**
+ * @param int $is_table_of_content
+ */
+ public function setIsTableOfContent($is_table_of_content)
+ {
+ $this->is_table_of_content = $is_table_of_content;
+ }
/**
* @return int
diff --git a/classes/class.ilObjInteractiveVideo.php b/classes/class.ilObjInteractiveVideo.php
index bcab7efb2..c06e4dcad 100644
--- a/classes/class.ilObjInteractiveVideo.php
+++ b/classes/class.ilObjInteractiveVideo.php
@@ -28,6 +28,9 @@ class ilObjInteractiveVideo extends ilObjectPlugin implements ilLPStatusPluginIn
/** @var int */
const LP_MODE_BY_QUESTIONS = 99;
+ /** @var int */
+ const LP_MODE_BY_ANSWERED_QUESTIONS = 100;
+
/** @var int */
protected $learning_progress_mode = self::LP_MODE_DEACTIVATED;
@@ -86,6 +89,12 @@ class ilObjInteractiveVideo extends ilObjectPlugin implements ilLPStatusPluginIn
/** @var int */
protected $disable_toolbar = 0;
+ /** @var int */
+ protected $show_toc_first = 0;
+
+ /** @var int */
+ protected $disable_comment_stream = 0;
+
/**
* @param $src_id
* @return ilInteractiveVideoSource
@@ -110,9 +119,9 @@ public function getVideoSourceObject($src_id)
protected function doRead()
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
@@ -134,6 +143,8 @@ protected function doRead()
$this->setDisableToolbar($row['no_toolbar']);
$this->setAutoResumeAfterQuestion($row['auto_resume']);
$this->setFixedModal($row['fixed_modal']);
+ $this->setShowTocFirst($row['show_toc_first']);
+ $this->setDisableCommentStream($row['disable_comment_stream']);
$this->getVideoSourceObject($row['source_id']);
$this->setLearningProgressMode($row['lp_mode']);
@@ -146,9 +157,9 @@ protected function doRead()
*/
protected function getOldVideoSource()
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF(
@@ -167,6 +178,9 @@ protected function getOldVideoSource()
*/
public function saveSubtitleData($data_short, $data_long)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$ilDB->manipulateF('DELETE FROM ' . self::TABLE_NAME_SUB_TITLE . ' WHERE obj_id = %s',
@@ -200,6 +214,9 @@ public function saveSubtitleData($data_short, $data_long)
*/
public function removeSubtitleData($filename)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$ilDB->manipulateF('DELETE FROM ' . self::TABLE_NAME_SUB_TITLE . ' WHERE obj_id = %s && file_name = %s',
@@ -211,7 +228,11 @@ public function removeSubtitleData($filename)
*/
public function getSubtitleData()
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
+
$res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_SUB_TITLE. ' WHERE obj_id = %s',
array('integer'), array($this->getId()));
@@ -226,6 +247,10 @@ public function getSubtitleData()
return $sub_title_data;
}
+ /**
+ * @param bool $a_clone_mode
+ * @throws ilException
+ */
protected function doCreate($a_clone_mode = false)
{
/**
@@ -253,6 +278,9 @@ protected function doCreate($a_clone_mode = false)
{
$this->getVideoSourceObject($src_id);
$this->video_source_object->doCreateVideoSource($this->getId());
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$ilDB->manipulateF('DELETE FROM ' . self::TABLE_NAME_OBJECTS . ' WHERE obj_id = %s',
@@ -271,6 +299,8 @@ protected function doCreate($a_clone_mode = false)
$no_toolbar = $this->disable_toolbar;
$auto_resume = $this->auto_resume_after_question;
$fixed_modal = $this->fixed_modal;
+ $show_toc_first = $this->show_toc_first;
+ $disable_comment_stream = $this->disable_comment_stream;
}
else
{
@@ -285,6 +315,8 @@ protected function doCreate($a_clone_mode = false)
$no_toolbar = (int)$_POST['no_toolbar'];
$auto_resume = (int)$_POST['auto_resume'];
$fixed_modal = (int)$_POST['fixed_modal'];
+ $show_toc_first = (int)$_POST['show_toc_first'];
+ $disable_comment_stream = (int)$_POST['disable_comment_stream'];
}
$ilDB->insert(
@@ -302,7 +334,9 @@ protected function doCreate($a_clone_mode = false)
'fixed_modal' => array('integer',$fixed_modal ),
'task' => array('text', $task),
'no_comment' => array('integer', $no_comment),
- 'no_toolbar' => array('integer', $no_toolbar)
+ 'no_toolbar' => array('integer', $no_toolbar),
+ 'show_toc_first' => array('integer', $show_toc_first),
+ 'disable_comment_stream' => array('integer', $disable_comment_stream)
)
);
@@ -333,9 +367,9 @@ protected function doCreate($a_clone_mode = false)
*/
protected function doUpdate()
{
- /**
- * @var $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
parent::doUpdate();
@@ -356,8 +390,10 @@ protected function doUpdate()
'source_id' =>array('text', $this->getSourceId()),
'is_task' => array('integer', $this->getTaskActive()),
'task' => array('text', $this->getTask()),
- 'auto_resume' => array('integer', $this->isAutoResumeAfterQuestion()),
- 'fixed_modal' => array('integer', $this->isFixedModal()),
+ 'auto_resume' => array('integer', $this->isAutoResumeAfterQuestion()),
+ 'fixed_modal' => array('integer', $this->isFixedModal()),
+ 'show_toc_first' => array('integer', $this->getShowTocFirst()),
+ 'disable_comment_stream' => array('integer', $this->getDisableCommentStream()),
'lp_mode' => array('integer', $this->getLearningProgressMode()),
'no_comment' => array('integer', $this->getDisableComment()),
'no_toolbar' => array('integer', $this->getDisableToolbar())
@@ -376,7 +412,7 @@ public function beforeDelete()
self::deleteComments(self::getCommentIdsByObjId($this->getId(), false));
/**
- * @var $ilDB ilDB
+ * @var $ilDB ilDBInterface
*/
global $ilDB;
$ilDB->manipulate('DELETE FROM ' . self::TABLE_NAME_OBJECTS . ' WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer'));
@@ -404,6 +440,9 @@ protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
$this->cloneMetaData($new_obj);
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$ilDB->manipulateF('DELETE FROM ' . self::TABLE_NAME_OBJECTS . ' WHERE obj_id = %s',
@@ -424,6 +463,8 @@ protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
'task' => array('text', $this->getTask()),
'auto_resume' => array('integer', $this->isAutoResumeAfterQuestion()),
'fixed_modal' => array('integer', $this->isFixedModal()),
+ 'show_toc_first' => array('integer', $this->getShowTocFirst()),
+ 'disable_comment_stream' => array('integer', $this->getDisableCommentStream()),
'lp_mode' => array('integer', $this->getLearningProgressMode())
)
);
@@ -459,14 +500,15 @@ protected function initType()
$this->setType('xvid');
}
-
-
/**
* @param $comment_ids
* @return array | bool
*/
public static function getQuestionIdsByCommentIds($comment_ids)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!is_array($comment_ids))
@@ -482,15 +524,23 @@ public static function getQuestionIdsByCommentIds($comment_ids)
return $question_ids;
}
- /**
- * @return array
- */
+ /**
+ * @param bool $replace_with_text
+ * @param bool $empty_string_if_null
+ * @param bool $replace_settings_with_text
+ * @param bool $strip_tags
+ * @return array
+ */
public function getCommentsTableData($replace_with_text = false, $empty_string_if_null = false, $replace_settings_with_text = false, $strip_tags = false)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('
- SELECT * FROM ' . self::TABLE_NAME_COMMENTS . '
+ SELECT *, comments.comment_id as cid FROM ' . self::TABLE_NAME_COMMENTS . ' comments
+ LEFT JOIN ' . self::TABLE_NAME_QUESTIONS . ' questions ON comments.comment_id = questions.comment_id
WHERE obj_id = %s
AND is_private = %s
ORDER BY comment_time ASC',
@@ -498,9 +548,8 @@ public function getCommentsTableData($replace_with_text = false, $empty_string_i
$counter = 0;
$table_data = array();
- while($row = $ilDB->fetchAssoc($res))
- {
- $table_data[$counter]['comment_id'] = $row['comment_id'];
+ while($row = $ilDB->fetchAssoc($res)) {
+ $table_data[$counter]['comment_id'] = $row['cid'];
if($replace_with_text)
{
@@ -518,29 +567,42 @@ public function getCommentsTableData($replace_with_text = false, $empty_string_i
if($strip_tags){
$table_data[$counter]['comment_text'] = strip_tags($row['comment_text']);
}
- if($replace_settings_with_text)
+ if($replace_settings_with_text )
{
$table_data[$counter]['is_tutor'] = xvidUtils::yesNoString($row['is_tutor']);
$table_data[$counter]['is_interactive'] = xvidUtils::yesNoString($row['is_interactive']);
+ $table_data[$counter]['compulsory'] = xvidUtils::yesNoString($row['compulsory_question']);
}
else
{
$table_data[$counter]['is_tutor'] = $row['is_tutor'];
$table_data[$counter]['is_interactive'] = $row['is_interactive'];
+ $table_data[$counter]['compulsory'] = $row['compulsory_question'] ? '1' : '0';
}
+ $table_data[$counter]['is_table_of_content'] = $row['is_table_of_content'];
+ $type = 'comment';
+ if($row['is_interactive'] == "1") {
+ $type = 'question';
+ } else if ( $row['is_table_of_content'] == "1") {
+ $type = 'chapter';
+ }
+ $table_data[$counter]['type'] = $type;
- $counter++;
- }
+ $counter++;
+ }
return $table_data;
}
- /**
- * @return array
- */
+ /**
+ * @return array
+ */
public function getCommentsTableDataByUserId()
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB, $ilUser;
$res = $ilDB->queryF('
@@ -562,7 +624,7 @@ public function getCommentsTableDataByUserId()
$table_data[$counter]['title'] = $row['comment_title'];
// $table_data[$counter]['user_id'] = $row['user_id'];
$table_data[$counter]['comment_text'] = $row['comment_text'];
-
+ $table_data[$counter]['compulsory'] = ilInteractiveVideoPlugin::getInstance()->txt('no');
if($row['is_private'] == 1)
{
$table_data[$counter]['is_private'] = ilInteractiveVideoPlugin::getInstance()->txt('private');
@@ -571,6 +633,7 @@ public function getCommentsTableDataByUserId()
{
$table_data[$counter]['is_private'] = ilInteractiveVideoPlugin::getInstance()->txt('public');
}
+
// $table_data[$counter]['is_tutor'] = $row['is_tutor'];
// $table_data[$counter]['is_interactive'] = $row['is_interactive'];
$counter++;
@@ -579,31 +642,51 @@ public function getCommentsTableDataByUserId()
return $table_data;
}
- /**
- * @param $comment_id
- * @return mixed
- */
+ /**
+ * @param $comment_id
+ * @return mixed
+ */
public function getCommentDataById($comment_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_COMMENTS . ' WHERE comment_id = %s',
array('integer'), array($comment_id));
- $row = $ilDB->fetchAssoc($res);
- return $row;
-
+ return $ilDB->fetchAssoc($res);
}
+ /**
+ * @return bool
+ */
+ public function doesTocCommentExists()
+ {
+ global $ilDB;
+
+ $res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_COMMENTS . ' WHERE is_table_of_content = %s AND obj_id = %s',
+ array('integer', 'integer'), array(1, $this->id));
+
+ $state = false;
+ while($row = $ilDB->fetchAssoc($res))
+ {
+ $state = true;
+ continue;
+ }
+ return $state;
+ }
+
/**
* @param $comment_id
* @return mixed
*/
public function getQuestionDataById($comment_id)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_QUESTIONS. ' WHERE comment_id = %s',
@@ -617,21 +700,21 @@ public function getQuestionDataById($comment_id)
/**
* @param $comment_id
- * @return string
+ * @return array
*/
public function getCommentTextById($comment_id)
{
/**
- * $ilDB ilDB
+ * @var $ilDB ilDBInterface
*/
global $ilDB;
- $res = $ilDB->queryF('SELECT comment_text FROM ' . self::TABLE_NAME_COMMENTS . ' WHERE comment_id = %s',
+ $res = $ilDB->queryF('SELECT comment_text, comment_title FROM ' . self::TABLE_NAME_COMMENTS . ' WHERE comment_id = %s',
array('integer'), array($comment_id));
$row = $ilDB->fetchAssoc($res);
- return (string)$row['comment_text'];
+ return ['text' => $row['comment_text'], 'title' => $row['comment_title']];
}
/**
@@ -641,9 +724,9 @@ public function getCommentTextById($comment_id)
*/
public function getCommentIdsByObjId($obj_id, $with_user_id = true)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$comment_ids = array();
@@ -664,20 +747,21 @@ public function getCommentIdsByObjId($obj_id, $with_user_id = true)
return $comment_ids;
}
- /**
- * delete
- * @param array $comment_ids
- * @return bool
- */
+ /**
+ * @param $comment_ids
+ * @return bool
+ */
public function deleteComments($comment_ids)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!is_array($comment_ids))
- return false;
+ {
+ return false;
+ }
$question_ids = self::getQuestionIdsByCommentIds($comment_ids);
SimpleChoiceQuestion::deleteQuestions($question_ids);
@@ -691,9 +775,9 @@ public function deleteComments($comment_ids)
*/
public function saveVideoStarted($obj_id, $usr_id)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!$this->doesLearningProgressEntryExists($obj_id, $usr_id))
{
@@ -714,9 +798,9 @@ public function saveVideoStarted($obj_id, $usr_id)
*/
public function saveVideoFinished($obj_id, $usr_id)
{
- /**
- * $ilDB ilDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
if(!$this->doesLearningProgressEntryExists($obj_id, $usr_id))
{
@@ -750,6 +834,9 @@ public function saveVideoFinished($obj_id, $usr_id)
*/
public function doesLearningProgressEntryExists($obj_id, $usr_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_LP . ' WHERE obj_id = %s AND usr_id = %s',
@@ -769,6 +856,9 @@ public function doesLearningProgressEntryExists($obj_id, $usr_id)
*/
public function getAllStartedAndFinishedUsers($obj_id)
{
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$usr_ids = array();
@@ -783,18 +873,15 @@ public function getAllStartedAndFinishedUsers($obj_id)
}
/**
- * @param $obj_id
- * @param $usr_id
+ * @param int $usr_id
* @return bool
*/
- public function isLearningProgressCompletedForUser($obj_id, $usr_id)
+ public function hasUserStartedAndFinishedVideo($usr_id)
{
- global $ilDB;
+ $res = $this->db->queryF('SELECT * FROM ' . self::TABLE_NAME_LP . ' WHERE obj_id = %s AND usr_id = %s AND started = 1 AND ended = 1',
+ array('integer', 'integer'),array($this->getId(), $usr_id));
- $res = $ilDB->queryF('SELECT * FROM ' . self::TABLE_NAME_LP . ' WHERE obj_id = %s AND usr_id = %s AND started = 1 AND ended = 1',
- array('integer', 'integer'), array($obj_id, $usr_id));
-
- $row = $ilDB->fetchAssoc($res);
+ $row = $this->db->fetchAssoc($res);
if($row == null)
{
return false;
@@ -947,120 +1034,177 @@ public function setVideoSourceImportObject($video_source_import_object)
$this->video_source_import_object = $video_source_import_object;
}
- /**
- * Get all user ids with LP status completed
- * @return array
- */
- public function getLPCompleted()
- {
- if(in_array($this->getLearningProgressMode(), array(self::LP_MODE_DEACTIVATED)))
- {
- return array();
- }
+ /**
+ * Get all user ids with LP status completed
+ * @return array
+ */
+ public function getLPCompleted()
+ {
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_DEACTIVATED])) {
+ return [];
+ }
- $user_ids = array();
+ $usrIds = [];
+ $simple = new SimpleChoiceQuestion();
+ $questionIds = $simple->getInteractiveNotNeutralQuestionIdsByObjId($this->getId());
- $simple = new SimpleChoiceQuestion();
- $qst = $simple->getInteractiveNotNeutralQuestionIdsByObjId($this->getId());
- if(is_array($qst) && count($qst) > 0)
- {
- $usrs_points = $simple->getAllUsersWithCompletelyCorrectAnswers($this->getId());
- foreach($usrs_points as $usr_id => $points)
- {
- if(is_array($qst) && ($points == count($qst)))
- {
- $user_ids[$usr_id] = $usr_id;
+ if ($questionIds === []) {
+ $usrIds = $this->getAllStartedAndFinishedUsers($this->getId());
+ } else {
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_QUESTIONS])) {
+ $usrs_points = $simple->getAllUsersWithCompletelyCorrectAnswers($this->getId());
+ foreach ($usrs_points as $usr_id => $points) {
+ if ($points === count($questionIds)) {
+ $usrIds[$usr_id] = $usr_id;
+ }
}
+ } elseif (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_ANSWERED_QUESTIONS])) {
+ $usrIds = $simple->getUsersWithAllAnsweredQuestionsMap($this->getId());
}
- }
- else
- {
- $user_ids = $this->getAllStartedAndFinishedUsers($this->getId());
- }
+ }
- return array_values($user_ids);
- }
+ return array_values($usrIds);
+ }
- /**
- * Get all user ids with LP status not attempted
- * @return array
- */
- public function getLPNotAttempted()
- {
- return [];
- }
+ /**
+ * Get all user ids with LP status not attempted
+ * @return array
+ */
+ public function getLPNotAttempted()
+ {
+ return [];
+ }
- /**
- * Get all user ids with LP status failed
- * @return array
- */
- public function getLPFailed()
- {
- if (in_array($this->getLearningProgressMode(), [self::LP_MODE_DEACTIVATED])) {
- return [];
+ /**
+ * Get all user ids with LP status failed
+ * @return array
+ */
+ public function getLPFailed()
+ {
+ if(in_array($this->getLearningProgressMode(), array(self::LP_MODE_DEACTIVATED)))
+ {
+ return array();
}
- $users = [];
-
- // NOT IMPLEMENTED
-
- return $users;
- }
+ return array();
+ }
- /**
- * Get all user ids with LP status in progress
- * @return array
- */
- public function getLPInProgress()
- {
+ /**
+ * Get all user ids with LP status in progress
+ * @return array
+ */
+ public function getLPInProgress()
+ {
if (in_array($this->getLearningProgressMode(), [self::LP_MODE_DEACTIVATED])) {
return [];
}
- $users = array_unique(array_values(array_map(static function (array $event) {
- return $event['usr_id'];
- }, ilChangeEvent::_lookupReadEvents($this->getId()))));
+ if (in_array(
+ $this->getLearningProgressMode(),
+ [
+ self::LP_MODE_BY_ANSWERED_QUESTIONS,
+ self::LP_MODE_BY_QUESTIONS,
+ ]
+ )) {
+ $users = array_unique(array_values(array_map(static function (array $event) {
+ return $event['usr_id'];
+ }, ilChangeEvent::_lookupReadEvents($this->getId()))));
- $simple = new SimpleChoiceQuestion();
- $users = array_unique(array_merge($users, $simple->getUsersWithAnsweredQuestion($this->getId())));
+ $simple = new SimpleChoiceQuestion();
+ $users = array_unique(array_merge($users, $simple->getUsersWithAnsweredQuestion($this->getId())));
- $users = array_diff($users, $this->getLPCompleted());
- $users = array_diff($users, $this->getLPFailed());
+ $users = array_diff($users, $this->getLPCompleted());
+ $users = array_diff($users, $this->getLPFailed());
- return $users;
- }
+ return $users;
+ }
- /**
- * Get current status for given user
- * @param int $a_user_id
- * @return int
- */
- public function getLPStatusForUser($a_user_id)
- {
+ return [];
+ }
+
+ /**
+ * Get current status for given user
+ * @param int $a_user_id
+ * @return int
+ */
+ public function getLPStatusForUser($a_user_id)
+ {
$status = ilLPStatus::LP_STATUS_NOT_ATTEMPTED_NUM;
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_DEACTIVATED])) {
+ return $status;
+ }
+
require_once 'Services/Tracking/classes/class.ilChangeEvent.php';
if (ilChangeEvent::hasAccessed($this->getId(), $a_user_id)) {
$status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
}
$simple = new SimpleChoiceQuestion();
+
$questionIds = $simple->getInteractiveNotNeutralQuestionIdsByObjId($this->getId());
- $userHasAnyAnswerData = $simple->getUserWithAnsweredQuestion($this->getId(), $a_user_id);
-
- if ($questionIds !== []) {
- $totalPointsOfUser = $simple->getAllUsersWithCompletelyCorrectAnswers($this->getId(), $a_user_id);
- if ($totalPointsOfUser == count($questionIds)) {
+ $numberOfAnsweredQuestions = $simple->getNumberOfAnsweredQuestions($this->getId(), $a_user_id);
+
+ if ($questionIds === []) {
+ if ($this->hasUserStartedAndFinishedVideo($a_user_id)) {
$status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
- } elseif ($userHasAnyAnswerData ) {
+ }
+ } else {
+ if ($numberOfAnsweredQuestions > 0) {
$status = ilLPStatus::LP_STATUS_IN_PROGRESS_NUM;
}
- } elseif ($this->isLearningProgressCompletedForUser($this->getId(), $a_user_id)) {
- $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
+
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_QUESTIONS])) {
+ $totalPointsOfUser = $simple->getAllUsersWithCompletelyCorrectAnswers($this->getId(), $a_user_id);
+ if ($totalPointsOfUser === count($questionIds)) {
+ $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
+ }
+ } elseif (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_ANSWERED_QUESTIONS])) {
+ if (count($questionIds) === $numberOfAnsweredQuestions) {
+ $status = ilLPStatus::LP_STATUS_COMPLETED_NUM;
+ }
+ }
}
return $status;
- }
+ }
+
+ /**
+ * @param int $usrId
+ * @return int
+ */
+ public function getPercentageForUser($usrId)
+ {
+ $percentage = 0;
+ $simple = new SimpleChoiceQuestion();
+
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_DEACTIVATED])) {
+ return $percentage;
+ }
+
+ $questionIds = $simple->getInteractiveNotNeutralQuestionIdsByObjId($this->getId());
+ if ($questionIds === []) {
+ if ($this->hasUserStartedAndFinishedVideo($usrId)) {
+ $percentage = 100;
+ }
+
+ return $percentage;
+ }
+
+ if (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_QUESTIONS])) {
+ $achievedPoints = $simple->getAllUsersWithCompletelyCorrectAnswers($this->getId(), $usrId);
+ $percentage = round(($achievedPoints / count($questionIds)) * 100);
+ } elseif (in_array($this->getLearningProgressMode(), [self::LP_MODE_BY_ANSWERED_QUESTIONS])) {
+ $numberOfAnsweredQuestions = $simple->getNumberOfAnsweredQuestions($this->getId(), $usrId);
+ $percentage = round(($numberOfAnsweredQuestions / count($questionIds)) * 100);
+ }
+
+ if ($percentage > 100) {
+ $percentage = 100;
+ }
+
+ return (int) $percentage;
+ }
/**
* @param int $learning_progress_mode
@@ -1085,7 +1229,8 @@ public function getLPValidModes()
{
return array(
self::LP_MODE_DEACTIVATED,
- self::LP_MODE_BY_QUESTIONS
+ self::LP_MODE_BY_QUESTIONS,
+ self::LP_MODE_BY_ANSWERED_QUESTIONS,
);
}
@@ -1114,22 +1259,25 @@ public function setDisableComment($disable_comment)
$this->disable_comment = $disable_comment;
}
- /**
- * @param $lp_mode
- * @return string
- * @throws ilException
- */
- public function getInternalLabelForLPMode($lp_mode)
- {
- switch($lp_mode)
- {
- case self::LP_MODE_BY_QUESTIONS:
- return 'by_questions';
- break;
- }
+ /**
+ * @param $lp_mode
+ * @return string
+ * @throws ilException
+ */
+ public function getInternalLabelForLPMode($lp_mode)
+ {
+ switch ($lp_mode) {
+ case self::LP_MODE_BY_QUESTIONS:
+ return 'by_questions';
+ break;
+
+ case self::LP_MODE_BY_ANSWERED_QUESTIONS:
+ return 'by_all_answered_questions';
+ break;
+ }
- throw new ilException(sprintf('The LP mode "%s" is unknown!', $lp_mode));
- }
+ throw new ilException(sprintf('The LP mode "%s" is unknown!', $lp_mode));
+ }
/**
* @return int
@@ -1176,7 +1324,12 @@ public function trackReadEvent()
ilChangeEvent::_recordReadEvent($this->getType(), $this->getRefId(), $this->getId(), $DIC->user()->getId());
}
-
+ /**
+ * @param $comment_id
+ * @param SimpleChoiceQuestion $question
+ * @param array $a_upload
+ * @return bool
+ */
public function uploadImage($comment_id, $question, array $a_upload)
{
if(!$this->id)
@@ -1233,6 +1386,38 @@ public function setFixedModal($fixed_modal)
$this->fixed_modal = $fixed_modal;
}
+ /**
+ * @return int
+ */
+ public function getShowTocFirst()
+ {
+ return $this->show_toc_first;
+ }
+
+ /**
+ * @param int $show_toc_first
+ */
+ public function setShowTocFirst($show_toc_first)
+ {
+ $this->show_toc_first = $show_toc_first;
+ }
+
+ /**
+ * @return int
+ */
+ public function getDisableCommentStream()
+ {
+ return $this->disable_comment_stream;
+ }
+
+ /**
+ * @param int $disable_comment_stream
+ */
+ public function setDisableCommentStream($disable_comment_stream)
+ {
+ $this->disable_comment_stream = $disable_comment_stream;
+ }
+
/**
* @return int
*/
@@ -1248,5 +1433,4 @@ public function setDisableToolbar($disable_toolbar)
{
$this->disable_toolbar = $disable_toolbar;
}
-
}
diff --git a/classes/class.ilObjInteractiveVideoAccess.php b/classes/class.ilObjInteractiveVideoAccess.php
index d605aea3a..dbbd039ae 100644
--- a/classes/class.ilObjInteractiveVideoAccess.php
+++ b/classes/class.ilObjInteractiveVideoAccess.php
@@ -61,9 +61,9 @@ public function _checkAccess($a_cmd, $a_permission, $a_ref_id, $a_obj_id, $a_use
*/
public static function checkOnline($a_id)
{
- /**
- * @var $ilDB iLDB
- */
+ /**
+ * @var $ilDB ilDBInterface
+ */
global $ilDB;
$set = $ilDB->query('
diff --git a/classes/class.ilObjInteractiveVideoGUI.php b/classes/class.ilObjInteractiveVideoGUI.php
index b690fdf9b..effdd71c4 100644
--- a/classes/class.ilObjInteractiveVideoGUI.php
+++ b/classes/class.ilObjInteractiveVideoGUI.php
@@ -1,7 +1,7 @@
{$cmd}();
+ }
+ }
+ else {
+ throw new ilException(sprintf("Unsupported plugin command %s ind %s", $cmd, __METHOD__));
+ }
}
break;
}
@@ -313,7 +328,14 @@ protected function buildContentTemplate($light_version = false)
$modal->setType(ilModalGUI::TYPE_LARGE);
$modal->setBody('');
$video_tpl->setVariable("MODAL_OVERLAY", $modal->getHTML());
- $video_tpl->setVariable('TXT_COMMENTS', $plugin->txt('comments'));
+
+ if($this->object->getDisableCommentStream() !== "1"){
+ $video_tpl->setVariable('TXT_COMMENTS', $plugin->txt('comments'));
+ }
+ if($this->object->doesTocCommentExists()){
+ $video_tpl->setVariable('TXT_TOC', $plugin->txt('toc'));
+ }
+
if($light_version) {
$video_tpl->setVariable('LIGHT_VERSION', 'iv_light_version');
}
@@ -381,9 +403,10 @@ protected function addBackButtonIfParameterExists($video_tpl)
}
}
- /**
- * @return string
- */
+ /**
+ * @return string
+ * @throws ilTemplateException
+ */
public function getInteractiveForm()
{
/**
@@ -392,7 +415,7 @@ public function getInteractiveForm()
global $tpl;
$plugin = ilInteractiveVideoPlugin::getInstance();
- $tpl->addJavaScript($plugin->getDirectory() . '/js/jquery.InteractiveVideoQuestionCreator.js');
+ $tpl->addJavaScript($plugin->getDirectory() . '/js/InteractiveVideoQuestionCreator.js');
$tpl->addCss($plugin->getDirectory() . '/templates/default/xvid.css');
$simple_choice = new SimpleChoiceQuestion();
$ajax_object = new SimpleChoiceQuestionAjaxHandler();
@@ -411,7 +434,7 @@ public function getInteractiveForm()
$question->setVariable('CORRECT_SOLUTION', $plugin->txt('correct_solution'));
if($question_id > 0)
{
- $question->setVariable('JSON', $ajax_object->getJsonForQuestionId($question_id));
+ $question->setVariable('JSON', $ajax_object->getAnswersForQuestionId($question_id));
$question->setVariable('QUESTION_TYPE', $simple_choice->getTypeByQuestionId($question_id));
$question->setVariable('QUESTION_TEXT', $simple_choice->getQuestionTextQuestionId($question_id));
}
@@ -471,7 +494,7 @@ protected function initPlayerConfig($player_id, $video_type, $edit_screen = fals
$tpl->addCss($plugin->getDirectory() . '/templates/default/xvid.css');
$tpl->addCss($plugin->getDirectory() . '/libs/Bootstraptoggle/bootstrap2-toggle.min.css');
$tpl->addJavaScript($plugin->getDirectory() . '/libs/Bootstraptoggle/bootstrap2-toggle.min.js');
- $tpl->addJavaScript($plugin->getDirectory() . '/js/jquery.InteractiveVideoQuestionViewer.js');
+ $tpl->addJavaScript($plugin->getDirectory() . '/js/InteractiveVideoQuestionViewer.js');
$tpl->addJavaScript($plugin->getDirectory() . '/js/InteractiveVideoPlayerComments.js');
$tpl->addJavaScript($plugin->getDirectory() . '/js/InteractiveVideoPlayerFunctions.js');
$tpl->addJavaScript($plugin->getDirectory() . '/js/InteractiveVideoPlayerAbstract.js');
@@ -495,7 +518,10 @@ protected function initPlayerConfig($player_id, $video_type, $edit_screen = fals
$config_tpl->setVariable('FEEDBACK_JUMP_TEXT', $plugin->txt('feedback_jump_text'));
$config_tpl->setVariable('LEARNING_RECOMMENDATION_TEXT', $plugin->txt('learning_recommendation'));
$config_tpl->setVariable('MORE_INFORMATION_TEXT', $plugin->txt('more_informations'));
+ $config_tpl->setVariable('SOLUTION_TEXT', $plugin->txt('solution'));
+ $config_tpl->setVariable('REPEAT_TEXT', $plugin->txt('repeat'));
$config_tpl->setVariable('ALREADY_ANSWERED_TEXT', $plugin->txt('already_answered'));
+ $config_tpl->setVariable('COMPULSORY', $plugin->txt('compulsory_question'));
$config_tpl->setVariable('QUESTION_TEXT', $plugin->txt('question'));
$config_tpl->setVariable('PRIVATE_TEXT', $plugin->txt('is_private_comment'));
$config_tpl->setVariable('RESET_TEXT', $plugin->txt('reset'));
@@ -504,9 +530,13 @@ protected function initPlayerConfig($player_id, $video_type, $edit_screen = fals
$config_tpl->setVariable('SWITCH_OFF', $plugin->txt('switch_off'));
$config_tpl->setVariable('SAVE', $plugin->txt('save'));
$config_tpl->setVariable('ADD_COMMENT', $plugin->txt('insert_comment'));
+ $config_tpl->setVariable('SHOW_BEST_SOLUTION', $plugin->txt('show_best_solution'));
+ $config_tpl->setVariable('AT_LEAST_ONE_ANSWER', $plugin->txt('at_least_one_answer'));
$config_tpl->setVariable('IS_CHRONOLOGIC_VALUE', $this->object->isChronologic());
$config_tpl->setVariable('AUTO_RESUME_AFTER_QUESTION', $this->object->isAutoResumeAfterQuestion());
$config_tpl->setVariable('FIXED_MODAL', $this->object->isFixedModal());
+ $config_tpl->setVariable('SHOW_TOC_FIRST', $this->object->getShowTocFirst());
+ $config_tpl->setVariable('DISABLE_COMMENT_STREAM', $this->object->getDisableCommentStream());
$config_tpl->setVariable('HAS_TRACKS', $this->getSubtitleDataAndFilesForJson());
$ck_editor = new ilTemplate("tpl.ckeditor_mathjax.html", true, true, $plugin->getDirectory());
$mathJaxSetting = new ilSetting('MathJax');
@@ -541,16 +571,22 @@ protected function initPlayerConfig($player_id, $video_type, $edit_screen = fals
$stop_points = array();
$comments = array();
+ $comments_toc= array();
$image_cache = array();
+ $compulsory_questions = array();
if( ! $edit_screen)
{
$stop_points = $this->objComment->getStopPoints();
$comments = $this->objComment->getContentComments();
+ $comments_toc= $this->objComment->getContentComments(true);
$image_cache = ilObjComment::getUserImageCache();
+ $compulsory_questions = SimpleChoiceQuestion::getAllCompulsoryQuestions($this->obj_id);
}
$config_tpl->setVariable('STOP_POINTS', json_encode($stop_points));
+ $config_tpl->setVariable('COMPULSORY_QUESTIONS', json_encode($compulsory_questions));
$config_tpl->setVariable('COMMENTS', json_encode($comments));
+ $config_tpl->setVariable('COMMENTS_TOC', json_encode($comments_toc));
$config_tpl->setVariable('USER_IMAGES_CACHE', json_encode($image_cache));
$config_tpl->setVariable('INTERACTIVE_VIDEO_REF_ID', $this->object->getRefId());
$config_tpl->setVariable('INTERACTIVE_INSTALLATION_CLIENT_ID', CLIENT_ID);
@@ -602,6 +638,12 @@ protected function updateCustom(ilPropertyFormGUI $a_form)
$no_toolbar = $a_form->getInput('no_toolbar');
$this->object->setDisableToolbar((int)$no_toolbar);
+ $show_toc_first = $a_form->getInput('show_toc_first');
+ $this->object->setShowTocFirst((int)$show_toc_first);
+
+ $disable_comment_stream = $a_form->getInput('disable_comment_stream');
+ $this->object->setDisableCommentStream((int)$disable_comment_stream);
+
$auto_resume = $a_form->getInput('auto_resume');
$this->object->setAutoResumeAfterQuestion((int)$auto_resume);
@@ -658,9 +700,10 @@ public function initCreateForm($type)
return $form;
}
- /**
- * @param ilPropertyFormGUI $a_form
- */
+ /**
+ * @param ilPropertyFormGUI $a_form
+ * @throws ilTemplateException
+ */
protected function initEditCustomForm(ilPropertyFormGUI $a_form)
{
/**
@@ -678,9 +721,10 @@ protected function initEditCustomForm(ilPropertyFormGUI $a_form)
}
- /**
- * @param ilPropertyFormGUI $a_form
- */
+ /**
+ * @param ilPropertyFormGUI $a_form
+ * @throws ilTemplateException
+ */
protected function appendCkEditorMathJaxSupportToForm(ilPropertyFormGUI $a_form)
{
/**
@@ -741,6 +785,14 @@ protected function appendDefaultFormOptions(ilPropertyFormGUI $a_form)
$no_toolbar->setInfo($plugin->txt('no_toolbar_info'));
$a_form->addItem($no_toolbar);
+ $show_toc_first = new ilCheckboxInputGUI($plugin->txt('show_toc_first'), 'show_toc_first');
+ $show_toc_first->setInfo($plugin->txt('show_toc_first_info'));
+ $a_form->addItem($show_toc_first);
+
+ $disable_comment_stream = new ilCheckboxInputGUI($plugin->txt('disable_comment_stream'), 'disable_comment_stream');
+ $disable_comment_stream->setInfo($plugin->txt('disable_comment_stream_info'));
+ $a_form->addItem($disable_comment_stream);
+
$section = new ilFormSectionHeaderGUI();
$section->setTitle($plugin->txt('questions'));
$a_form->addItem($section);
@@ -788,7 +840,13 @@ protected function getEditFormCustomValues(array &$a_values)
$a_values["is_chronologic"] = $this->object->isChronologic();
$a_values["no_comment"] = $this->object->getDisableComment();
$a_values["no_toolbar"] = $this->object->getDisableToolbar();
- $a_values['source_id'] = $this->object->getSourceId();
+ $a_values["show_toc_first"] = $this->object->getShowTocFirst();
+ $a_values["disable_comment_stream"] = $this->object->getDisableCommentStream();
+ $source_id = $this->object->getSourceId();
+ /*if(array_key_exists('xvid_source_id', $_GET) && $_GET['xvid_source_id'] !== ''){
+ $source_id = ilUtil::stripSlashes($_GET['xvid_source_id']);
+ }*/
+ $a_values['source_id'] = $source_id;
$a_values['is_task'] = $this->object->getTaskActive();
$a_values['task'] = $this->object->getTask();
$a_values['auto_resume'] = $this->object->isAutoResumeAfterQuestion();
@@ -797,6 +855,10 @@ protected function getEditFormCustomValues(array &$a_values)
public function editProperties()
{
+ global $DIC;
+ $customJS = ilUtil::stripSlashes($_GET['xvid_custom_js']);
+ $DIC->ui()->mainTemplate()->addOnLoadCode('"' . $customJS . '"');
+ $DIC->ui()->mainTemplate()->addOnLoadCode('console.log('. $customJS .')');
$this->edit();
}
@@ -942,7 +1004,7 @@ public function confirmRemoveSubtitle()
* @var $tpl ilTemplate
* @var $ilTabs ilTabsGUI
*/
- global $tpl, $ilTabs, $ilCtrl;
+ global $tpl, $ilTabs;
$ilTabs->activateTab('editProperties');
$ilTabs->activateSubTab('addSubtitle');
@@ -1094,7 +1156,6 @@ protected function appendFormsFromFactory(ilPropertyFormGUI $a_form)
}
$item_group->setValue($factory->getDefaultVideoSource());
-
if($non_active)
{
ilUtil::sendFailure(ilInteractiveVideoPlugin::getInstance()->txt('at_least_one_source'));
@@ -1153,22 +1214,7 @@ public function removeFromDeskObject()
*/
protected function initHeaderAction($a_sub_type = null, $a_sub_id = null)
{
- /**
- * @var $ilUser ilObjUser
- */
- global $ilUser;
-
- $lg = parent::initHeaderAction();
-
- if($lg instanceof ilObjInteractiveVideoListGUI)
- {
- if($ilUser->getId() != ANONYMOUS_USER_ID)
- {
- // Maybe handle notifications in future ...
- }
- }
-
- return $lg;
+ return parent::initHeaderAction();
}
protected function setTabs()
@@ -1208,31 +1254,34 @@ protected function setTabs()
}
require_once 'Services/Tracking/classes/class.ilLearningProgressAccess.php';
- if(ilLearningProgressAccess::checkAccess($this->object->getRefId(), true))
- {
- if($this->checkPermissionBool('write') || $this->checkPermissionBool('read_learning_progress'))
- {
- if($this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
- {
- $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLpUsers'));
- }
- else
- {
- $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLPSettings'));
- }
- }
- else if($this->checkPermissionBool('read') && $this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
- {
- $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLPUserDetails'));
- }
- }
- if($ilAccess->checkAccess('write', '', $this->object->getRefId()))
- {
- if(ilInteractiveVideoPlugin::getInstance()->isCoreMin52())
- {
- $ilTabs->addTab('export', $this->lng->txt('export'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoExportGUI', ''));
- }
- }
+ if(! $this->object instanceof ilObjRootFolder) {
+ if(ilLearningProgressAccess::checkAccess($this->object->getRefId(), true))
+ {
+ if($this->checkPermissionBool('write') || $this->checkPermissionBool('read_learning_progress'))
+ {
+ if($this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
+ {
+ $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLpUsers'));
+ }
+ else
+ {
+ $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLPSettings'));
+ }
+ }
+ else if($this->checkPermissionBool('read') && $this->object->getLearningProgressMode() != ilObjInteractiveVideo::LP_MODE_DEACTIVATED)
+ {
+ $ilTabs->addTab('learning_progress', $this->lng->txt('learning_progress'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoLearningProgressGUI', 'showLPUserDetails'));
+ }
+ }
+ if($ilAccess->checkAccess('write', '', $this->object->getRefId()))
+ {
+ if(ilInteractiveVideoPlugin::getInstance()->isCoreMin52())
+ {
+ $ilTabs->addTab('export', $this->lng->txt('export'), $this->ctrl->getLinkTargetByClass('ilInteractiveVideoExportGUI', ''));
+ }
+ }
+ }
+
$this->addPermissionTab();
}
@@ -1278,21 +1327,21 @@ public function hasPermission($permission)
return $this->checkPermissionBool($permission);
}
- /**
- * Public wrapper for permission assumption
- * @param string $permission
- * @return bool
- */
+ /**
+ * @param $permission
+ * @return bool
+ * @throws ilObjectException
+ */
public function ensurePermission($permission)
{
return $this->checkPermission($permission);
}
- /**
- * Public wrapper for permission assumption
- * @param string[] $permissions
- * @return bool
- */
+ /**
+ * @param array $permissions
+ * @return bool
+ * @throws ilObjectException
+ */
public function ensureAtLeastOnePermission(array $permissions)
{
foreach ($permissions as $permission) {
@@ -1314,7 +1363,9 @@ public function getPluginInstance()
#region COMMENTS
-
+ /**
+ * @throws ilTemplateException
+ */
public function postComment()
{
/**
@@ -1354,6 +1405,7 @@ public function postComment()
$comment->setUserId($ilUser->getId());
$comment->setCommentText(trim($_POST['comment_text']));
$comment->setCommentTime((float)$_POST['comment_time']);
+ $comment->setIsTableOfContent((int)$_POST['is_table_of_content']);
$comment->setCommentTimeEnd($seconds_end);
if(array_key_exists('is_reply_to', $_POST))
@@ -1397,9 +1449,8 @@ public function confirmDeleteComment()
if(!isset($_POST['comment_id']) || !is_array($_POST['comment_id']) || !count($_POST['comment_id']))
{
- ilUtil::sendFailure($this->lng->txt('select_one'));
- $this->editComments();
- return;
+ ilUtil::sendFailure($this->lng->txt('select_one'), true);
+ $this->ctrl->redirect($this, 'editComments');
}
require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
@@ -1418,7 +1469,13 @@ public function confirmDeleteComment()
{
foreach($post_ids as $comment_id)
{
- $confirm->addItem('comment_id[]', $comment_id, $this->object->getCommentTextById($comment_id));
+ $texts = $this->object->getCommentTextById($comment_id);
+ if(strlen($texts['title']) > 0){
+ $text = $texts['title'];
+ } else {
+ $text = $texts['text'];
+ }
+ $confirm->addItem('comment_id[]', $comment_id, $text);
}
$tpl->setContent($confirm->getHTML());
@@ -1454,9 +1511,10 @@ public function deleteComment()
$this->editComments();
}
- /**
- * @return ilPropertyFormGUI
- */
+ /**
+ * @return ilPropertyFormGUI
+ * @throws ilTemplateException
+ */
private function initCommentForm()
{
/**
@@ -1501,6 +1559,9 @@ private function initCommentForm()
if($ilUser->getId() != ANONYMOUS_USER_ID)
{
$is_private = new ilCheckboxInputGUI($plugin->txt('is_private_comment'), 'is_private');
+ if( $this->object->isPublic() == 0) {
+ $is_private->setChecked(true);
+ }
$form->addItem($is_private);
}
@@ -1521,6 +1582,77 @@ private function initCommentForm()
return $form;
}
+ /**
+ * @return ilPropertyFormGUI
+ */
+ private function initChapterForm()
+ {
+ $plugin = ilInteractiveVideoPlugin::getInstance();
+
+ $form = new ilPropertyFormGUI();
+ $form->setFormAction($this->ctrl->getFormAction($this, 'insertComment'));
+ $form->setTitle($plugin->txt('insert_chapter'));
+ $this->appendCkEditorMathJaxSupportToForm($form);
+ $section_header = new ilFormSectionHeaderGUI();
+ $section_header->setTitle($plugin->txt('general'));
+ $form->addItem($section_header);
+
+ $title = new ilTextInputGUI($this->lng->txt('title'), 'comment_title');
+ $title->setRequired(true);
+ $form->addItem($title);
+
+ $time = new ilInteractiveVideoTimePicker($this->lng->txt('time'), 'comment_time');
+ #$time->setShowTime(true);
+ #$time->setShowSeconds(true);
+
+ if(isset($_POST['comment_time']))
+ {
+ $seconds = $_POST['comment_time'];
+ $time->setValueByArray(array('comment_time' => (int)$seconds));
+ }
+ $form->addItem($time);
+
+ $section_header = new ilFormSectionHeaderGUI();
+ $section_header->setTitle($plugin->txt('comment'));
+ $form->addItem($section_header);
+
+ $comment = xvidUtils::constructTextAreaFormElement('comment', 'comment_text');
+ $form->addItem($comment);
+
+ $frm_id = new ilHiddenInputGUI('comment_id');
+ $form->addItem($frm_id);
+
+ $is_toc = new ilHiddenInputGUI('is_table_of_content');
+ $is_toc->setValue(1);
+ $form->addItem($is_toc);
+
+ return $form;
+ }
+
+ /**
+ *
+ */
+ public function showTutorInsertChapterForm()
+ {
+ /**
+ * @var $tpl ilTemplate
+ * @var $ilTabs ilTabsGUI
+ */
+ global $tpl, $ilTabs;
+
+ $this->setSubTabs('editComments');
+
+ $ilTabs->activateTab('editComments');
+ $ilTabs->activateSubTab('editComments');
+
+ $form = $this->initChapterForm();
+
+ $form->addCommandButton('insertTutorChapter', $this->lng->txt('insert'));
+ $form->addCommandButton('cancelComments', $this->lng->txt('cancel'));
+
+ $tpl->setContent($form->getHTML());
+ }
+
/**
*
*/
@@ -1576,6 +1708,9 @@ public function editMyComments()
$tpl->setContent($tbl->getHTML());
}
+ /**
+ * @throws ilTemplateException
+ */
public function updateMyComment()
{
$form = $this->initCommentForm();
@@ -1592,6 +1727,7 @@ public function updateMyComment()
$this->objComment->setCommentTitle((string)$form->getInput('comment_title'));
$this->objComment->setInteractive(0);
$this->objComment->setIsPrivate((int)$form->getInput('is_private'));
+ $this->objComment->setIsTableOfContent((int)$form->getInput('is_table_of_content'));
// calculate seconds
$comment_time = $form->getInput('comment_time');
@@ -1601,6 +1737,12 @@ public function updateMyComment()
$this->objComment->setCommentTimeEnd($comment_time_end);
$this->objComment->update();
+ if($comment_time_end <= $comment_time && $comment_time_end !== 0){
+ ilUtil::sendFailure($this->plugin->txt('endtime_warning'));
+ $form->setValuesByPost();
+ return $this->editMyComment($form);
+ }
+
$this->editMyComments();
}
else
@@ -1610,6 +1752,9 @@ public function updateMyComment()
}
}
+ /**
+ *
+ */
public function confirmDeleteMyComment()
{
/**
@@ -1624,9 +1769,8 @@ public function confirmDeleteMyComment()
if(!isset($_POST['comment_id']) || !is_array($_POST['comment_id']) || !count($_POST['comment_id']))
{
- ilUtil::sendFailure($this->lng->txt('select_one'));
- $this->editComments();
- return;
+ ilUtil::sendFailure($this->lng->txt('select_one'), true);
+ $this->ctrl->redirect($this, 'editMyComments');
}
require_once 'Services/Utilities/classes/class.ilConfirmationGUI.php';
@@ -1645,7 +1789,13 @@ public function confirmDeleteMyComment()
{
foreach($post_ids as $comment_id)
{
- $confirm->addItem('comment_id[]', $comment_id, $this->object->getCommentTextById($comment_id));
+ $texts = $this->object->getCommentTextById($comment_id);
+ if(strlen($texts['title']) > 0){
+ $text = $texts['title'];
+ } else {
+ $text = $texts['text'];
+ }
+ $confirm->addItem('comment_id[]', $comment_id, $text);
}
$tpl->setContent($confirm->getHTML());
@@ -1656,6 +1806,9 @@ public function confirmDeleteMyComment()
}
}
+ /**
+ *
+ */
public function deleteMyComment()
{
$plugin = ilInteractiveVideoPlugin::getInstance();
@@ -1729,6 +1882,9 @@ public function postTutorComment()
$this->editComments($current_time);
}
+ /**
+ * @throws ilTemplateException
+ */
public function updateComment()
{
$valid = false;
@@ -1751,6 +1907,7 @@ public function updateComment()
$this->objComment->setCommentTitle((string)$form->getInput('comment_title'));
$this->objComment->setInteractive(0);
$this->objComment->setIsPrivate((int)$form->getInput('is_private'));
+ $this->objComment->setIsTableOfContent((int)$form->getInput('is_table_of_content'));
$this->objComment->setCommentTime($comment_time);
$this->objComment->setCommentTimeEnd($comment_time_end);
@@ -1766,6 +1923,36 @@ public function updateComment()
}
}
+ public function updateChapter()
+ {
+ $valid = false;
+ $form = $this->initChapterForm();
+
+ if($form->checkInput()) {
+ $valid = true;
+ $comment_time = $form->getInput('comment_time');
+ $comment_id = $form->getInput('comment_id');
+ if ($comment_id > 0) {
+ $this->objComment = new ilObjComment($comment_id);
+ }
+ $this->objComment->setCommentText($form->getInput('comment_text'));
+ $this->objComment->setCommentTitle((string)$form->getInput('comment_title'));
+ $this->objComment->setInteractive(0);
+ $this->objComment->setIsPrivate((int)$form->getInput('is_private'));
+ $this->objComment->setIsTableOfContent((int)$form->getInput('is_table_of_content'));
+ $this->objComment->setCommentTime($comment_time);
+ }
+ if($valid){
+ $this->objComment->update();
+ $this->editComments();
+ }
+ else
+ {
+ $form->setValuesByPost();
+ $this->editChapter($form);
+ }
+ }
+
/**
* @param int $current_time
*/
@@ -1803,6 +1990,7 @@ public function editComments($current_time = 0)
$video_tpl->setVariable('TXT_INS_COMMENT', $plugin->txt('insert_comment'));
$video_tpl->setVariable('PLAYER_ID', $player_id);
$video_tpl->setVariable('TXT_INS_QUESTION', $plugin->txt('insert_question'));
+ $video_tpl->setVariable('TXT_INS_CHAPTER', $plugin->txt('insert_chapter'));
require_once("./Services/UIComponent/Modal/classes/class.ilModalGUI.php");
$modal = ilModalGUI::getInstance();
@@ -1822,6 +2010,7 @@ public function editComments($current_time = 0)
$video_tpl->setVariable('TABLE', $tbl->getHTML());
$tpl->setContent($video_tpl->get());
}
+
/**
*
*/
@@ -1831,11 +2020,25 @@ public function insertTutorComment()
}
/**
- * @param int $is_tutor
+ *
*/
- private function insertComment($is_tutor = 0)
+ public function insertTutorChapter()
{
- $form = $this->initCommentForm();
+ $this->insertComment(1, true);
+ }
+
+ /**
+ * @param int $is_tutor
+ * @param false $is_chapter
+ * @throws ilTemplateException
+ */
+ private function insertComment($is_tutor = 0, $is_chapter = false)
+ {
+ if($is_chapter) {
+ $form = $this->initChapterForm();
+ } else {
+ $form = $this->initCommentForm();
+ }
if($form->checkInput())
{
@@ -1848,6 +2051,7 @@ private function insertComment($is_tutor = 0)
// $this->objComment->setCommentTags((string)$form->getInput('comment_tags'));
$this->objComment->setCommentTitle((string)$form->getInput('comment_title'));
$this->objComment->setIsPrivate((int)$form->getInput('is_private'));
+ $this->objComment->setIsTableOfContent((int)$form->getInput('is_table_of_content'));
// calculate seconds
$comment_time = $form->getInput('comment_time');
@@ -1865,6 +2069,9 @@ private function insertComment($is_tutor = 0)
{
$form->setValuesByPost();
ilUtil::sendFailure($this->lng->txt('err_check_input'),true);
+ if($is_chapter === true) {
+ $this->ctrl->redirect($this, 'showTutorInsertChapterForm');
+ }
$this->ctrl->redirect($this, 'showTutorInsertCommentForm');
}
@@ -1878,9 +2085,10 @@ private function insertComment($is_tutor = 0)
}
}
- /**
- * @param ilPropertyFormGUI $form
- */
+ /**
+ * @param ilPropertyFormGUI|null $form
+ * @throws ilTemplateException
+ */
public function editMyComment(ilPropertyFormGUI $form = NULL)
{
/**
@@ -1908,9 +2116,10 @@ public function editMyComment(ilPropertyFormGUI $form = NULL)
$tpl->setContent($form->getHTML());
}
- /**
- * @param ilPropertyFormGUI $form
- */
+ /**
+ * @param ilPropertyFormGUI|null $form
+ * @throws ilTemplateException
+ */
public function editComment(ilPropertyFormGUI $form = NULL)
{
/**
@@ -1935,10 +2144,39 @@ public function editComment(ilPropertyFormGUI $form = NULL)
}
/**
- * @param int $comment_id
+ * @param ilPropertyFormGUI $form
*/
+ public function editChapter(ilPropertyFormGUI $form = NULL)
+ {
+ /**
+ * @var $tpl ilTemplate
+ * @var $ilTabs ilTabsGUI
+ */
+ global $tpl, $ilTabs;
+
+ $ilTabs->activateTab('editComments');
+ if(!($form instanceof ilPropertyFormGUI))
+ {
+ $form = $this->initChapterForm();
+ $form->setValuesByArray($this->getChapterFomValues(), true);
+ }
+
+ $form->setFormAction($this->ctrl->getFormAction($this, 'updateChapter'));
+ $form->setTitle(ilInteractiveVideoPlugin::getInstance()->txt('edit_chapter'));
+ $form->addCommandButton('updateChapter', $this->lng->txt('save'));
+ $form->addCommandButton('editComments', $this->lng->txt('cancel'));
+
+ $tpl->setContent($form->getHTML());
+ }
+
+ /**
+ * @param int $comment_id
+ * @return array|void
+ * @throws ilTemplateException
+ */
private function getCommentFormValues($comment_id = 0)
{
+ $values = array();
if($comment_id == 0)
{
if(!isset($_GET['comment_id']) && !isset($_POST['comment_id']))
@@ -1961,15 +2199,49 @@ private function getCommentFormValues($comment_id = 0)
$values['comment_title'] = $comment_data['comment_title'];
$values['comment_tags'] = $comment_data['comment_tags'];
$values['is_private'] = $comment_data['is_private'];
+ $values['is_table_of_content'] = $comment_data['is_table_of_content'];
return $values;
}
-#endregion
-#region QUESTIONS
/**
- * @return ilPropertyFormGUI
+ * @param int $comment_id
*/
+ private function getChapterFomValues($comment_id = 0)
+ {
+ if($comment_id == 0)
+ {
+ if(!isset($_GET['comment_id']) && !isset($_POST['comment_id']))
+ {
+ ilUtil::sendFailure(ilInteractiveVideoPlugin::getInstance()->txt('no_comment_id_given'), true);
+ return $this->showContent();
+ }
+ else
+ {
+ $comment_id = (int)$_GET['comment_id'] ? (int)$_GET['comment_id'] : (int)$_POST['comment_id'] ;
+ }
+ }
+
+ $comment_data = $this->object->getCommentDataById($comment_id);
+ $values['comment_id'] = $comment_data['comment_id'];
+ $values['comment_time'] = $comment_data['comment_time'];
+ $values['comment_time_end'] = $comment_data['comment_time_end'];
+ $values['comment_text'] = $comment_data['comment_text'];
+ $values['is_interactive'] = $comment_data['is_interactive'];
+ $values['comment_title'] = $comment_data['comment_title'];
+ $values['comment_tags'] = $comment_data['comment_tags'];
+ $values['is_private'] = $comment_data['is_private'];
+ $values['is_table_of_content'] = $comment_data['is_table_of_content'];
+
+ return $values;
+ }
+#endregion
+
+#region QUESTIONS
+ /**
+ * @return ilPropertyFormGUI
+ * @throws ilTemplateException
+ */
public function initQuestionForm()
{
$plugin = ilInteractiveVideoPlugin::getInstance();
@@ -2000,6 +2272,10 @@ public function initQuestionForm()
$repeat_question->setInfo($plugin->txt('repeat_question_info'));
$form->addItem($repeat_question);
+ $compulsory_question = new ilCheckboxInputGUI($plugin->txt('compulsory_question'), 'compulsory_question');
+ $compulsory_question->setInfo($plugin->txt('compulsory_question_info'));
+ $form->addItem($compulsory_question);
+
$limit_attempts = new ilCheckboxInputGUI($plugin->txt('limit_attempts'), 'limit_attempts');
$limit_attempts->setInfo($plugin->txt('limit_attempts_info'));
$form->addItem($limit_attempts);
@@ -2038,7 +2314,21 @@ public function initQuestionForm()
$section_header->setTitle($plugin->txt('feedback'));
$form->addItem($section_header);
- // Feedback correct
+ $show_best_solution = new ilCheckboxInputGUI($plugin->txt('show_best_solution'), 'show_best_solution');
+ $show_best_solution->setInfo($plugin->txt('show_best_solution_info'));
+
+ $show_best_solution_text = xvidUtils::constructTextAreaFormElement('best_solution_text', 'show_best_solution_text');
+ $show_best_solution_text->setInfo($plugin->txt('best_solution_text_info'));
+ $show_best_solution->addSubItem($show_best_solution_text);
+
+ $form->addItem($show_best_solution);
+
+ $show_response_frequency = new ilCheckboxInputGUI($plugin->txt('show_response_frequency'), 'show_response_frequency');
+ $show_response_frequency->setInfo($plugin->txt('show_response_frequency_info'));
+ $form->addItem($show_response_frequency);
+
+
+ // Feedback correct
$feedback_correct = xvidUtils::constructTextAreaFormElement('feedback_correct', 'feedback_correct');
$show_correct_icon = new ilCheckboxInputGUI($plugin->txt('show_correct_icon'), 'show_correct_icon');
$show_correct_icon->setInfo($plugin->txt('show_correct_icon_info'));
@@ -2082,10 +2372,6 @@ public function initQuestionForm()
$this->appendRepositorySelector($feedback_one_wrong, 'feedback_wrong_obj');
$form->addItem($feedback_one_wrong);
- $show_response_frequency = new ilCheckboxInputGUI($plugin->txt('show_response_frequency'), 'show_response_frequency');
- $show_response_frequency->setInfo($plugin->txt('show_response_frequency_info'));
- $form->addItem($show_response_frequency);
-
$show_comment_field = new ilCheckboxInputGUI($plugin->txt('show_comment_field'), 'show_comment_field');
$show_comment_field->setInfo($plugin->txt('show_comment_field_info'));
$form->addItem($show_comment_field);
@@ -2119,7 +2405,7 @@ public function initQuestionForm()
}
/**
- * @param ilPropertyFormGUI $form
+ * @param ilTextAreaInputGUI $form
* @param $post_var
*/
protected function appendRepositorySelector($form, $post_var)
@@ -2144,9 +2430,10 @@ protected function appendRepositorySelector($form, $post_var)
$form->addSubItem($root_ref_id);
}
- /**
- * @param ilPropertyFormGUI $form
- */
+ /**
+ * @param ilPropertyFormGUI|null $form
+ * @throws ilTemplateException
+ */
public function showTutorInsertQuestionForm(ilPropertyFormGUI $form = NULL)
{
/**
@@ -2168,7 +2455,9 @@ public function showTutorInsertQuestionForm(ilPropertyFormGUI $form = NULL)
$tpl->setContent($form->getHTML());
}
-
+ /**
+ * @throws ilTemplateException
+ */
public function insertQuestion()
{
$form = $this->initQuestionForm();
@@ -2205,9 +2494,10 @@ public function insertQuestion()
}
}
- /**
- * @param ilPropertyFormGUI $form
- */
+ /**
+ * @param ilPropertyFormGUI|null $form
+ * @throws ilTemplateException
+ */
public function editQuestion(ilPropertyFormGUI $form = NULL)
{
/**
@@ -2231,12 +2521,15 @@ public function editQuestion(ilPropertyFormGUI $form = NULL)
$tpl->setContent($form->getHTML());
}
- /**
- * @param int $comment_id
- * @return array
- */
+ /**
+ * @param int $comment_id
+ * @return array|void
+ * @throws ilTemplateException
+ */
private function getQuestionFormValues($comment_id = 0)
{
+ $values = array();
+
if($comment_id == 0)
{
if(!isset($_GET['comment_id']) && !isset($_POST['comment_id']))
@@ -2269,11 +2562,14 @@ private function getQuestionFormValues($comment_id = 0)
$values['jump_correct_ts'] = $question_data['question_data']['jump_correct_ts'];
$values['feedback_one_wrong'] = $question_data['question_data']['feedback_one_wrong'];
$values['show_response_frequency'] = $question_data['question_data']['show_response_frequency'];
+ $values['show_best_solution'] = $question_data['question_data']['show_best_solution'];
+ $values['show_best_solution_text'] = $question_data['question_data']['show_best_solution_text'];
$values['is_jump_wrong'] = $question_data['question_data']['is_jump_wrong'];
$values['show_wrong_icon'] = $question_data['question_data']['show_wrong_icon'];
$values['jump_wrong_ts'] = $question_data['question_data']['jump_wrong_ts'];
$values['limit_attempts'] = $question_data['question_data']['limit_attempts'];
$values['repeat_question'] = $question_data['question_data']['repeat_question'];
+ $values['compulsory_question'] = $question_data['question_data']['compulsory_question'];
$values['feedback_correct_obj'] = $question_data['question_data']['feedback_correct_ref_id'];
$values['feedback_wrong_obj'] = $question_data['question_data']['feedback_wrong_ref_id'];
$values['show_comment_field'] = $question_data['question_data']['reflection_question_comment'];
@@ -2283,7 +2579,9 @@ private function getQuestionFormValues($comment_id = 0)
return $values;
}
-
+ /**
+ *
+ */
public function confirmUpdateQuestion()
{
/**
@@ -2296,7 +2594,7 @@ public function confirmUpdateQuestion()
$comment_id = (int)$_POST['comment_id'];
$form_values = array();
- if(!$chk = SimpleChoiceQuestion::existUserAnswer($comment_id))
+ if(!$chk = SimpleChoiceQuestion::existAnswer($comment_id))
{
$this->updateQuestion();
}
@@ -2323,6 +2621,9 @@ public function confirmUpdateQuestion()
}
}
+ /**
+ * @throws ilTemplateException
+ */
public function updateQuestion()
{
$form = $this->initQuestionForm();
@@ -2403,7 +2704,10 @@ private function performQuestionRefresh($comment_id, $form)
$question->setJumpWrongTs((int)$form->getInput('jump_wrong_ts'));
$question->setShowResponseFrequency((int)$form->getInput('show_response_frequency'));
+ $question->setShowBestSolution((int)$form->getInput('show_best_solution'));
+ $question->setShowBestSolutionText(ilUtil::stripSlashes($form->getInput('show_best_solution_text'), false));
$question->setRepeatQuestion((int)$form->getInput('repeat_question'));
+ $question->setCompulsoryQuestion((int)$form->getInput('compulsory_question'));
$question->setReflectionQuestionComment((int)$form->getInput('show_comment_field'));
$question->setNeutralAnswer((int)$form->getInput('neutral_type'));
$question->deleteQuestionsIdByCommentId($comment_id);
@@ -2411,9 +2715,10 @@ private function performQuestionRefresh($comment_id, $form)
}
- /**
- * @return string
- */
+ /**
+ * @return string
+ * @throws ilTemplateException
+ */
public function getAnswerDefinitionsJSON()
{
$simple_choice = new SimpleChoiceQuestion();
@@ -2422,7 +2727,7 @@ public function getAnswerDefinitionsJSON()
$question = new ilTemplate("tpl.simple_questions.html", true, true, ilInteractiveVideoPlugin::getInstance()->getDirectory());
if($question_id > 0)
{
- $question->setVariable('JSON', $ajax_object->getJsonForQuestionId($question_id));
+ $question->setVariable('JSON', $ajax_object->getAnswersForQuestionId($question_id));
$question->setVariable('QUESTION_TYPE', $simple_choice->getTypeByQuestionId($question_id));
}
else
@@ -2434,6 +2739,9 @@ public function getAnswerDefinitionsJSON()
return $question->get();
}
+ /**
+ *
+ */
public function showResults()
{
/**
@@ -2456,6 +2764,9 @@ public function showResults()
$tpl->setContent($tbl->getHTML());
}
+ /**
+ *
+ */
public function showMyResults()
{
/**
@@ -2477,6 +2788,9 @@ public function showMyResults()
$tpl->setContent($tbl->getHTML());
}
+ /**
+ *
+ */
public function showCompleteOverviewOverAllResults()
{
/**
@@ -2499,6 +2813,9 @@ public function showCompleteOverviewOverAllResults()
}
+ /**
+ *
+ */
public function confirmDeleteUserResults()
{
/**
@@ -2585,6 +2902,9 @@ public function showQuestionsResults()
$tpl->setContent($tbl->getHTML());
}
+ /**
+ *
+ */
public function confirmDeleteQuestionsResults()
{
/**
@@ -2617,12 +2937,16 @@ public function confirmDeleteQuestionsResults()
foreach($question_ids as $question_id)
{
- $confirm->addItem('question_id[]', $question_id, $question_id);
+ $title = ilObjComment::getCommentTitleByQuestionId($question_id);
+ $confirm->addItem('question_id[]', $question_id, $title);
}
$tpl->setContent($confirm->getHTML());
}
+ /**
+ *
+ */
public function deleteQuestionsResults()
{
if(!isset($_POST['question_id']) || !is_array($_POST['question_id']) || !count($_POST['question_id']))
@@ -2650,6 +2974,9 @@ public function deleteQuestionsResults()
#endregion
#region AJAX
+ /**
+ *
+ */
public function getQuestionPerAjax()
{
$ajax_object = new SimpleChoiceQuestionAjaxHandler();
@@ -2668,6 +2995,9 @@ public function getQuestionPerAjax()
return;
}
+ /**
+ *
+ */
public function postAnswerPerAjax()
{
if(SimpleChoiceQuestion::isLimitAttemptsEnabled((int)$_POST['qid']) == false)
@@ -2683,6 +3013,8 @@ public function postAnswerPerAjax()
$simple_choice->saveAnswer((int) $_POST['qid'], $answer);
}
+ $this->object->refreshLearningProgress([$this->user->getId()]);
+
$this->showFeedbackPerAjax();
$this->callExit();
}
@@ -2761,6 +3093,9 @@ protected function callExit()
#endregion
#region EXPORT
+ /**
+ *
+ */
public function completeCsvExport()
{
@@ -2808,7 +3143,10 @@ public function completeCsvExport()
}
ilUtil::deliverData($csvoutput, $this->object->getTitle() . ".csv");
}
-
+
+ /**
+ *
+ */
public function exportMyComments()
{
global $lng;
@@ -2839,11 +3177,14 @@ public function exportMyComments()
$csvoutput = "";
foreach ($csv as $row)
{
- $csvoutput .= join($row, $separator) . "\n";
+ $csvoutput .= join($separator, $row) . "\n";
}
ilUtil::deliverData($csvoutput, $this->object->getTitle() . ".csv");
}
+ /**
+ *
+ */
public function exportAllComments()
{
global $lng;
@@ -2864,6 +3205,8 @@ public function exportAllComments()
array_push($head_row, $plugin->txt('comment'));
array_push($head_row, $plugin->txt('tutor'));
array_push($head_row, $plugin->txt('interactive'));
+ array_push($head_row, $plugin->txt('compulsory'));
+ array_push($head_row, $plugin->txt('type'));
array_push($csv, ilUtil::processCSVRow($head_row, TRUE, $separator) );
foreach ($data as $key => $row)
@@ -2878,7 +3221,7 @@ public function exportAllComments()
$csvoutput = "";
foreach ($csv as $row)
{
- $csvoutput .= join($row, $separator) . "\n";
+ $csvoutput .= join($separator, $row) . "\n";
}
ilUtil::deliverData($csvoutput, $this->object->getTitle() . ".csv");
}
diff --git a/classes/class.ilObjInteractiveVideoListGUI.php b/classes/class.ilObjInteractiveVideoListGUI.php
index 3594f1ccf..e02e74cc8 100644
--- a/classes/class.ilObjInteractiveVideoListGUI.php
+++ b/classes/class.ilObjInteractiveVideoListGUI.php
@@ -24,11 +24,6 @@ public function initCommands()
{
return array
(
- array(
- 'permission' => 'visible',
- 'cmd' => 'showContent',
- 'default' => true
- ),
array(
'permission' => 'read',
'cmd' => 'showContent',
diff --git a/classes/class.xvidUtils.php b/classes/class.xvidUtils.php
index 408ba0e82..6cecd97b8 100644
--- a/classes/class.xvidUtils.php
+++ b/classes/class.xvidUtils.php
@@ -70,6 +70,10 @@ public static function getTimeStringFromSeconds($seconds, $text_instead_of_null_
}
}
+ /**
+ * @param $number
+ * @return string
+ */
protected static function fillZeroIfSmallerTen($number)
{
if($number < 10)
@@ -105,10 +109,13 @@ public static function yesNoString( $value)
*/
public static function constructTextAreaFormElement($txt, $name)
{
- $text_area = new ilTextAreaInputCkeditorGUI(ilInteractiveVideoPlugin::getInstance()->txt($txt), $name);
- return $text_area;
+ return new ilTextAreaInputCkeditorGUI(ilInteractiveVideoPlugin::getInstance()->txt($txt), $name);
}
-
+
+ /**
+ * @param $path
+ * @return string
+ */
public static function ensureFileSavePathExists($path)
{
$path = ilUtil::getWebspaceDir() . self::INTERACTIVE_VIDEO . $path;
diff --git a/js/Form/InteractiveVideoPreviewPicker.js b/js/Form/InteractiveVideoPreviewPicker.js
index 0e3520a08..5533b1b52 100644
--- a/js/Form/InteractiveVideoPreviewPicker.js
+++ b/js/Form/InteractiveVideoPreviewPicker.js
@@ -1,7 +1,7 @@
il.InteractiveVideoPreviewPicker = (function (scope) {
'use strict';
- var pub = {}, pro = {};
+ let pub = {}, pro = {};
pub.config = {
modal_id : 'ffmpeg_extract_modal',
@@ -41,9 +41,9 @@ il.InteractiveVideoPreviewPicker = (function (scope) {
data: {time : $('#ffmpeg_time_picker').val()},
success: function (json)
{
- var images = JSON.parse(json);
- var html = '';
- var button = $('.use_as_question_image').html();
+ let images = JSON.parse(json);
+ let html = '';
+ let button = $('.use_as_question_image').html();
if(images.error === undefined)
{
$.each(images, function (key, value)
@@ -70,7 +70,7 @@ il.InteractiveVideoPreviewPicker = (function (scope) {
$('.question_image_select').off('click');
$('.question_image_select').on('click', function(){
- var img = $(this).parent().find('.preview_image').attr('src');
+ let img = $(this).parent().find('.preview_image').attr('src');
if($('#il_prop_cont_question_image').find('img').length > 0)
{
@@ -97,7 +97,7 @@ il.InteractiveVideoPreviewPicker = (function (scope) {
pro.makeModalBootstrapCompatible = function()
{
- var size = 'col-xs-12';
+ let size = 'col-xs-12';
$('.modal-body').addClass(size);
$('.modal-content').addClass(size);
};
diff --git a/js/InteractiveVideoPlayerAbstract.js b/js/InteractiveVideoPlayerAbstract.js
index b1a7fd8d3..0781de4fc 100644
--- a/js/InteractiveVideoPlayerAbstract.js
+++ b/js/InteractiveVideoPlayerAbstract.js
@@ -5,7 +5,7 @@ il.InteractiveVideoPlayerAbstract = (function (scope) {
//Done: Questions working
//Done: Comments working
//Player object exists by id
- var pub = {}, pro = {};
+ let pub = {}, pro = {};
pub.config = {
pauseCallback : null,
diff --git a/js/InteractiveVideoPlayerComments.js b/js/InteractiveVideoPlayerComments.js
index 3efdd402e..cd126810d 100644
--- a/js/InteractiveVideoPlayerComments.js
+++ b/js/InteractiveVideoPlayerComments.js
@@ -49,12 +49,16 @@ il.InteractiveVideoPlayerComments = (function (scope) {
pub.buildListElement = function (player_id, comment, time, username)
{
let css_class, value;
+ let list_item_id = 'list_item_' + comment.comment_id;
+ let comment_not_already_rendered = $('.' + list_item_id).length;
let player_data = scope.InteractiveVideoPlayerFunction.getPlayerDataObjectByPlayerId(player_id);
-
- if(pro.isBuildListElementAllowed(player_data, username))
+ if(pro.isBuildListElementAllowed(player_data, username)
+ && comment.is_table_of_content === "0"
+ && comment_not_already_rendered === 0
+ )
{
css_class = pro.getCSSClassForListElement();
- value = '' +
'' +
pro.buildCommentUserImage(player_data, comment) +
'
' + + pro.buildCommentTimeHtml(comment.comment_time, comment.is_interactive, player_id) + + '' + comment_title + add_span_arrow + '
' + + '