Skip to content

Commit

Permalink
Merge pull request #1 from DatabayAG/master
Browse files Browse the repository at this point in the history
current iv
  • Loading branch information
kosmicunifr authored Mar 20, 2019
2 parents 4ac0773 + 68e206c commit 8bbcef7
Show file tree
Hide file tree
Showing 18 changed files with 555 additions and 324 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.0.18
1. Block modal closing by clicking on the background
* If enabled, a modal dialogue won't be closed if a user clicks on the background.
2. Autoresume after question modal is closed
* If enabled, the video will be automatically resumed after closing a the modal question dialogue.

# 2.0.12
1. Display task above videos
2. Possibility to create a comment (private/public) on reflection question
Expand Down
1 change: 1 addition & 0 deletions classes/class.SimpleChoiceQuestion.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ public function cloneQuestionObject($old_comment_id, $new_comment_id)
global $ilDB;

$_POST['answer'] = array();
$_POST['correct'] = array();

$res = $ilDB->queryF('
SELECT *
Expand Down
2 changes: 1 addition & 1 deletion classes/class.SimpleChoiceQuestionStatistics.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ public function getResponseFrequency($question_id)
*/
global $ilDB;
$res = $ilDB->queryF(
'SELECT count(rep_robj_xvid_answers.answer_id) AS counter FROM rep_robj_xvid_question
'SELECT rep_robj_xvid_answers.answer_id, count(rep_robj_xvid_answers.answer_id) AS counter FROM rep_robj_xvid_question
LEFT JOIN rep_robj_xvid_qus_text ON rep_robj_xvid_qus_text.question_id = rep_robj_xvid_question.question_id
RIGHT JOIN rep_robj_xvid_answers ON rep_robj_xvid_qus_text.answer_id = rep_robj_xvid_answers.answer_id
WHERE rep_robj_xvid_question.question_id = %s GROUP BY rep_robj_xvid_answers.answer_id',
Expand Down
2 changes: 2 additions & 0 deletions classes/class.ilInteractiveVideoExporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ private function exportXMLSettings()
$this->xml_writer->xmlElement('getTask', null, (string)$this->object->getTask());
$this->xml_writer->xmlElement('getLearningProgressMode', null, (int)$this->object->getLearningProgressMode());
$this->xml_writer->xmlElement('noComment', null, (int)$this->object->getDisableComment());
$this->xml_writer->xmlElement('fixedModal', null, (int)$this->object->isFixedModal());
$this->xml_writer->xmlElement('autoResumeAfterQuestion', null, (int)$this->object->isAutoResumeAfterQuestion());

$this->exportQuestions();
$this->exportVideoSourceObject();
Expand Down
12 changes: 11 additions & 1 deletion classes/class.ilInteractiveVideoXMLParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ public function handlerBeginTag($xmlParser, $tagName, $tagAttributes)
case 'getLearningProgressMode':
case 'noCommentStream':
case 'noComment':
case 'fixedModal':
case 'autoResumeAfterQuestion':
case 'studentMarker':
if($this->inSettingsTag)
{
Expand Down Expand Up @@ -222,8 +224,16 @@ public function handlerEndTag($xmlParser, $tagName)
$this->xvid_obj->setNoCommentStream(trim($this->cdata));
$this->cdata = '';
break;
case 'fixedModal':
$this->xvid_obj->setFixedModal(trim($this->cdata));
$this->cdata = '';
break;
case 'autoResumeAfterQuestion':
$this->xvid_obj->setAutoResumeAfterQuestion(trim($this->cdata));
$this->cdata = '';
break;
case 'studentMarker':
$this->xvid_obj->setMarkerForStudents(trim($this->cdata));
# $this->xvid_obj->setMarkerForStudents(trim($this->cdata));
$this->cdata = '';
break;
case 'SourceId':
Expand Down
78 changes: 67 additions & 11 deletions classes/class.ilObjInteractiveVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,15 @@ class ilObjInteractiveVideo extends ilObjectPlugin implements ilLPStatusPluginIn
*/
protected $task;

/**
* @var boolean
*/
protected $auto_resume_after_question = 0;

/**
* @var boolean
*/
protected $fixed_modal = 0;

/**
* @var SimpleChoiceQuestion[]
Expand Down Expand Up @@ -147,6 +156,8 @@ protected function doRead()
$this->setTaskActive($row['is_task']);
$this->setTask($row['task']);
$this->setDisableComment($row['no_comment']);
$this->setAutoResumeAfterQuestion($row['auto_resume']);
$this->setFixedModal($row['fixed_modal']);

$this->getVideoSourceObject($row['source_id']);
$this->setLearningProgressMode($row['lp_mode']);
Expand Down Expand Up @@ -216,6 +227,8 @@ protected function doCreate($a_clone_mode = false)
$is_task = $this->task_active;
$task = $this->task;
$no_comment = $this->disable_comment;
$auto_resume = $this->auto_resume_after_question;
$fixed_modal = $this->fixed_modal;
}
else
{
Expand All @@ -227,6 +240,8 @@ protected function doCreate($a_clone_mode = false)
$is_task = (int)$_POST['is_task'];
$task = ilUtil::stripSlashes($_POST['task']);
$no_comment = (int)$_POST['no_comment'];
$auto_resume = (int)$_POST['auto_resume'];
$fixed_modal = (int)$_POST['fixed_modal'];
}

$ilDB->insert(
Expand All @@ -240,6 +255,8 @@ protected function doCreate($a_clone_mode = false)
'is_online' => array('integer', $online),
'source_id' => array('text', $source_id),
'is_task' => array('integer',$is_task ),
'auto_resume' => array('integer',$auto_resume ),
'fixed_modal' => array('integer',$fixed_modal ),
'task' => array('text', $task),
'no_comment' => array('integer', $no_comment)
)
Expand Down Expand Up @@ -294,7 +311,9 @@ protected function doUpdate()
'is_online' =>array('integer', $this->isOnline()),
'source_id' =>array('text', $this->getSourceId()),
'is_task' => array('integer', $this->getTaskActive()),
'task' => array('text', $this->getTask()),
'task' => array('text', $this->getTask()),
'auto_resume' => array('integer', $this->isAutoResumeAfterQuestion()),
'fixed_modal' => array('integer', $this->isFixedModal()),
'lp_mode' => array('integer', $this->getLearningProgressMode()),
'no_comment' => array('integer', $this->getDisableComment())
),
Expand All @@ -306,16 +325,19 @@ protected function doUpdate()
*/
public function beforeDelete()
{
$this->getVideoSourceObject($this->getSourceId());
$this->video_source_object->beforeDeleteVideoSource($this->getId());
self::deleteComments(self::getCommentIdsByObjId($this->getId(), false));

/**
* @var $ilDB ilDB
*/
global $ilDB;
$ilDB->manipulate('DELETE FROM ' . self::TABLE_NAME_OBJECTS . ' WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer'));
$this->deleteMetaData();
if (((!$this->referenced) || ($this->countReferences() == 1)) && $this->video_source_object !== null ) {
$this->getVideoSourceObject($this->getSourceId());
$this->video_source_object->beforeDeleteVideoSource($this->getId());
self::deleteComments(self::getCommentIdsByObjId($this->getId(), false));

/**
* @var $ilDB ilDB
*/
global $ilDB;
$ilDB->manipulate('DELETE FROM ' . self::TABLE_NAME_OBJECTS . ' WHERE obj_id = ' . $ilDB->quote($this->getId(), 'integer'));
$this->deleteMetaData();
}
return true;
}

/**
Expand Down Expand Up @@ -354,6 +376,8 @@ protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null)
'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()),
'lp_mode' => array('integer', $this->getLearningProgressMode())
)
);
Expand Down Expand Up @@ -1137,4 +1161,36 @@ public function uploadImage($comment_id, $question, array $a_upload)
return false;
}

/**
* @return bool
*/
public function isAutoResumeAfterQuestion()
{
return $this->auto_resume_after_question;
}

/**
* @param bool $auto_resume_after_question
*/
public function setAutoResumeAfterQuestion($auto_resume_after_question)
{
$this->auto_resume_after_question = $auto_resume_after_question;
}

/**
* @return bool
*/
public function isFixedModal()
{
return $this->fixed_modal;
}

/**
* @param bool $fixed_modal
*/
public function setFixedModal($fixed_modal)
{
$this->fixed_modal = $fixed_modal;
}

}
7 changes: 5 additions & 2 deletions classes/class.ilObjInteractiveVideoAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */

require_once 'Services/Repository/classes/class.ilObjectPluginAccess.php';
require_once 'Services/AccessControl/interfaces/interface.ilConditionHandling.php';
require_once 'Services/AccessControl/interfaces/interface.ilConditionHandling.php';
if(version_compare(ILIAS_VERSION_NUMERIC, '5.4.0', '>=')) {
require_once 'Services/Conditions/interfaces/interface.ilConditionHandling.php';
} else{
require_once 'Services/AccessControl/interfaces/interface.ilConditionHandling.php';
}
require_once 'Services/WebAccessChecker/interfaces/interface.ilWACCheckingClass.php';

/**
Expand Down
78 changes: 56 additions & 22 deletions classes/class.ilObjInteractiveVideoGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,8 @@ protected function initPlayerConfig($edit_screen = false)
$config_tpl->setVariable('SAVE', $plugin->txt('save'));
$config_tpl->setVariable('ADD_COMMENT', $plugin->txt('insert_comment'));
$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());
$ck_editor = new ilTemplate("tpl.ckeditor_mathjax.html", true, true, $plugin->getDirectory());
$mathJaxSetting = new ilSetting('MathJax');
if($mathJaxSetting->get('enable'))
Expand Down Expand Up @@ -487,22 +489,20 @@ protected function initPlayerConfig($edit_screen = false)
$config_tpl->setVariable('USER_IMAGE', ilObjComment::getUserImageInBase64($ilUser->getId()));
}

$stop_points = $this->objComment->getStopPoints();
$comments = $this->objComment->getContentComments();

if($edit_screen)
$stop_points = array();
$comments = array();
$image_cache = array();
if( ! $edit_screen)
{
$config_tpl->setVariable('STOP_POINTS', json_encode(array()));
$config_tpl->setVariable('COMMENTS', json_encode(array()));
$config_tpl->setVariable('USER_IMAGES_CACHE', json_encode(array()));
}
else
{
$config_tpl->setVariable('STOP_POINTS', json_encode($stop_points));
$config_tpl->setVariable('COMMENTS', json_encode($comments));
$config_tpl->setVariable('USER_IMAGES_CACHE', json_encode(ilObjComment::getUserImageCache()));
$stop_points = $this->objComment->getStopPoints();
$comments = $this->objComment->getContentComments();
$image_cache = ilObjComment::getUserImageCache();
}

$config_tpl->setVariable('STOP_POINTS', json_encode($stop_points));
$config_tpl->setVariable('COMMENTS', json_encode($comments));
$config_tpl->setVariable('USER_IMAGES_CACHE', json_encode($image_cache));

return $config_tpl->get();
}

Expand Down Expand Up @@ -547,6 +547,12 @@ protected function updateCustom(ilPropertyFormGUI $a_form)
$no_comment = $a_form->getInput('no_comment');
$this->object->setDisableComment((int)$no_comment);

$auto_resume = $a_form->getInput('auto_resume');
$this->object->setAutoResumeAfterQuestion((int)$auto_resume);

$fixed_modal = $a_form->getInput('fixed_modal');
$this->object->setFixedModal((int)$fixed_modal);

$factory = new ilInteractiveVideoSourceFactory();
$source = $factory->getVideoSourceObject($a_form->getInput('source_id'));
$source->doUpdateVideoSource($this->obj_id);
Expand Down Expand Up @@ -646,31 +652,57 @@ protected function appendDefaultFormOptions(ilPropertyFormGUI $a_form)
{
$plugin = ilInteractiveVideoPlugin::getInstance();

$section = new ilFormSectionHeaderGUI();
$section->setTitle($plugin->txt('task'));
$a_form->addItem($section);

$description_switch = new ilCheckboxInputGUI($plugin->txt('task_switch'),'is_task');
$description_switch->setInfo($plugin->txt('task_switch_info'));
$description = xvidUtils::constructTextAreaFormElement('task', 'task');
$description_switch->addSubItem($description);
$a_form->addItem($description_switch);

$anonymized = new ilCheckboxInputGUI($plugin->txt('is_anonymized'), 'is_anonymized');
$anonymized->setInfo($plugin->txt('is_anonymized_info'));
$a_form->addItem($anonymized);
$section = new ilFormSectionHeaderGUI();
$section->setTitle($plugin->txt('comments'));
$a_form->addItem($section);

$anonymize = new ilCheckboxInputGUI($plugin->txt('is_anonymized'), 'is_anonymized');
$anonymize->setInfo($plugin->txt('is_anonymized_info'));
$a_form->addItem($anonymize);

$is_public = new ilCheckboxInputGUI($plugin->txt('is_public'), 'is_public');
$is_public->setInfo($plugin->txt('is_public_info'));
$a_form->addItem($is_public);

$chronology = new ilCheckboxInputGUI($plugin->txt('is_chronologic'), 'is_chronologic');
$chronology->setInfo($plugin->txt('is_chronologic_info'));
$a_form->addItem($chronology);

$no_comment = new ilCheckboxInputGUI($plugin->txt('no_comment'), 'no_comment');
$no_comment->setInfo($plugin->txt('no_comment_info'));
$a_form->addItem($no_comment);

$section = new ilFormSectionHeaderGUI();
$section->setTitle($plugin->txt('questions'));
$a_form->addItem($section);

$repeat = new ilCheckboxInputGUI($plugin->txt('is_repeat'), 'is_repeat');
$repeat->setInfo($plugin->txt('is_repeat_info'));
$a_form->addItem($repeat);

$chrono = new ilCheckboxInputGUI($plugin->txt('is_chronologic'), 'is_chronologic');
$chrono->setInfo($plugin->txt('is_chronologic_info'));
$a_form->addItem($chrono);
$section = new ilFormSectionHeaderGUI();
$section->setTitle('modal');
$a_form->addItem($section);

$no_comment = new ilCheckboxInputGUI($plugin->txt('no_comment'), 'no_comment');
$no_comment->setInfo($plugin->txt('no_comment_info'));
$a_form->addItem($no_comment);
$auto_resume = new ilCheckboxInputGUI($plugin->txt('auto_resume'), 'auto_resume');
$auto_resume->setInfo($plugin->txt('auto_resume_info'));
$auto_resume->setValue(1);
$a_form->addItem($auto_resume);

$fixed_modal = new ilCheckboxInputGUI($plugin->txt('fixed_modal'), 'fixed_modal');
$fixed_modal->setInfo($plugin->txt('fixed_modal_info'));
$fixed_modal->setValue(1);
$a_form->addItem($fixed_modal);
}

/**
Expand Down Expand Up @@ -699,6 +731,8 @@ protected function getEditFormCustomValues(array &$a_values)
$a_values['source_id'] = $this->object->getSourceId();
$a_values['is_task'] = $this->object->getTaskActive();
$a_values['task'] = $this->object->getTask();
$a_values['auto_resume'] = $this->object->isAutoResumeAfterQuestion();
$a_values['fixed_modal'] = $this->object->isFixedModal();
}

public function editProperties()
Expand Down
4 changes: 2 additions & 2 deletions js/InteractiveVideoPlayerAbstract.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ il.InteractiveVideoPlayerAbstract = (function (scope) {
pub.setCurrentTime(time);
scope.InteractiveVideo.last_stopPoint = time;
}
pub.resumeVideo();
pub.play();
};

pub.resumeVideo = function ()
{
if(scope.InteractiveVideo.auto_resume === true)
if(scope.InteractiveVideo.auto_resume === "1")
{
pub.play();
}
Expand Down
4 changes: 3 additions & 1 deletion js/InteractiveVideoPlayerComments.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ il.InteractiveVideoPlayerComments = (function (scope) {
pro.preselectValueOfEndTimeSelection = function(time, element)
{
element.val(time);
$('#comment_time_end').timepicker('setTime', time);
if($('#comment_time_end').size() > 0) {
$('#comment_time_end').timepicker('setTime', time);
}
};

pub.protect = pro;
Expand Down
Loading

0 comments on commit 8bbcef7

Please sign in to comment.