Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 29 additions & 4 deletions classes/class.ilObjInteractiveVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ class ilObjInteractiveVideo extends ilObjectPlugin implements ilLPStatusPluginIn
*/
protected $fixed_modal = 0;

/**
* @var string
*/
protected $csv_export_delimiter = ";";

/**
* @var SimpleChoiceQuestion[]
*/
Expand Down Expand Up @@ -130,7 +135,7 @@ protected function doRead()
array($this->getId())
);
$row = $ilDB->fetchAssoc($res);

$this->setIsAnonymized($row['is_anonymized']);
$this->setIsRepeat($row['is_repeat']);
$this->setIsPublic($row['is_public']);
Expand All @@ -143,6 +148,7 @@ protected function doRead()
$this->setDisableToolbar($row['no_toolbar']);
$this->setAutoResumeAfterQuestion($row['auto_resume']);
$this->setFixedModal($row['fixed_modal']);
$this->setCSVExportDelimiter($row['csv_export_delimiter']);
$this->setShowTocFirst($row['show_toc_first']);
$this->setDisableCommentStream($row['disable_comment_stream']);

Expand Down Expand Up @@ -332,6 +338,7 @@ protected function doCreate($a_clone_mode = false)
'is_task' => array('integer',$is_task ),
'auto_resume' => array('integer',$auto_resume ),
'fixed_modal' => array('integer',$fixed_modal ),
'csv_export_delimiter' => array('text', ";"),
'task' => array('text', $task),
'no_comment' => array('integer', $no_comment),
'no_toolbar' => array('integer', $no_toolbar),
Expand Down Expand Up @@ -373,7 +380,7 @@ protected function doUpdate()
global $ilDB;

parent::doUpdate();

$old_source_id = $this->getOldVideoSource();
if($old_source_id != null && $old_source_id != $this->getSourceId())
{
Expand All @@ -389,12 +396,13 @@ 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()),
'csv_export_delimiter' => array('text', $this->getCSVExportDelimiter()),
'show_toc_first' => array('integer', $this->getShowTocFirst()),
'disable_comment_stream' => array('integer', $this->getDisableCommentStream()),
'lp_mode' => array('integer', $this->getLearningProgressMode()),
'lp_mode' => array('integer', $this->getLearningProgressMode()),
'no_comment' => array('integer', $this->getDisableComment()),
'no_toolbar' => array('integer', $this->getDisableToolbar())
),
Expand Down Expand Up @@ -463,6 +471,7 @@ 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()),
'csv_export_delimiter' => array('text', $this->getCSVExportDelimiter()),
'show_toc_first' => array('integer', $this->getShowTocFirst()),
'disable_comment_stream' => array('integer', $this->getDisableCommentStream()),
'lp_mode' => array('integer', $this->getLearningProgressMode())
Expand Down Expand Up @@ -1386,6 +1395,22 @@ public function setFixedModal($fixed_modal)
$this->fixed_modal = $fixed_modal;
}

/**
* @return string
*/
public function getCSVExportDelimiter()
{
return $this->csv_export_delimiter;
}

/**
* @param string $csv_export_delimiter
*/
public function setCSVExportDelimiter($csv_export_delimiter)
{
$this->csv_export_delimiter = $csv_export_delimiter;
}

/**
* @return int
*/
Expand Down
73 changes: 44 additions & 29 deletions classes/class.ilObjInteractiveVideoGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ilObjInteractiveVideoGUI extends ilObjectPluginGUI implements ilDesktopIte

/** @var ilObjInteractiveVideo $object */
public $object;

/** @var $objComment ilObjComment */
public $objComment;

Expand Down Expand Up @@ -182,16 +182,16 @@ public function performCommand($cmd)
}
else $this->editComments();
break;

case 'updateProperties':
case 'editProperties':
case 'addSubtitle':
case 'postAddSubtitle':
case 'confirmDeleteComment':
case 'confirmRemoveSubtitle':
case 'deleteComment':
case 'editComments':
case 'editQuestion':
case 'deleteComment':
case 'editComments':
case 'editQuestion':
case 'confirmUpdateQuestion':
case 'insertQuestion':
case 'completeCsvExport':
Expand Down Expand Up @@ -542,7 +542,7 @@ protected function initPlayerConfig($player_id, $video_type, $edit_screen = fals
$mathJaxSetting = new ilSetting('MathJax');
if($mathJaxSetting->get('enable'))
{

$tpl->addJavaScript($mathJaxSetting->get('path_to_mathjax'));
$ck_editor->setVariable('MATH_JAX_CONFIG', $mathJaxSetting->get('path_to_mathjax'));
}
Expand Down Expand Up @@ -650,6 +650,9 @@ protected function updateCustom(ilPropertyFormGUI $a_form)
$fixed_modal = $a_form->getInput('fixed_modal');
$this->object->setFixedModal((int)$fixed_modal);

$csv_export_delimiter = $a_form->getInput('csv_export_delimiter');
$this->object->setCSVExportDelimiter(ilUtil::stripSlashes($csv_export_delimiter));

$factory = new ilInteractiveVideoSourceFactory();
$source = $factory->getVideoSourceObject($a_form->getInput('source_id'));
$source->doUpdateVideoSource($this->obj_id);
Expand Down Expand Up @@ -814,6 +817,15 @@ protected function appendDefaultFormOptions(ilPropertyFormGUI $a_form)
$fixed_modal->setInfo($plugin->txt('fixed_modal_info'));
$fixed_modal->setValue(1);
$a_form->addItem($fixed_modal);

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

$csv_export_delimiter = new ilTextInputGUI($plugin->txt('csv_export_delimiter'), 'csv_export_delimiter');
$csv_export_delimiter->setInfo($plugin->txt('csv_export_delimiter_info'));
$csv_export_delimiter->setValue(";");
$a_form->addItem($csv_export_delimiter);
}

/**
Expand Down Expand Up @@ -851,6 +863,7 @@ protected function getEditFormCustomValues(array &$a_values)
$a_values['task'] = $this->object->getTask();
$a_values['auto_resume'] = $this->object->isAutoResumeAfterQuestion();
$a_values['fixed_modal'] = $this->object->isFixedModal();
$a_values['csv_export_delimiter'] = $this->object->getCSVExportDelimiter();
}

public function editProperties()
Expand Down Expand Up @@ -908,7 +921,7 @@ public function addSubtitle()
$form->setTarget("_top");
$form->setFormAction($ilCtrl->getFormAction($this, "update"));
$form->setTitle($this->plugin->txt("subtitle"));

$file = new ilFileInputGUI($this->plugin->txt('subtitle'), 'subtitle');
$file->setSuffixes(array('vtt'));
$form->addItem($file);
Expand Down Expand Up @@ -990,7 +1003,7 @@ protected function removeSubtitle(){
$this->object->removeSubtitleData($filename);
ilUtil::sendSuccess($this->plugin->txt('subtitle_removed'), true);
$this->ctrl->redirect($this, 'addSubtitle');

}

}
Expand Down Expand Up @@ -1040,7 +1053,7 @@ public function postAddSubtitle()
{
chmod($new_file, 0770);
}

}
$data_short = array();
$data_long = array();
Expand All @@ -1059,7 +1072,7 @@ public function postAddSubtitle()
}
}
$this->object->saveSubtitleData($data_short, $data_long);

$this->addSubtitle();
}

Expand Down Expand Up @@ -1138,7 +1151,7 @@ protected function appendFormsFromFactory(ilPropertyFormGUI $a_form)
$plugin = ilInteractiveVideoPlugin::getInstance();
$factory = new ilInteractiveVideoSourceFactory();
$sources = $factory->getVideoSources();

$item_group = new ilRadioGroupInputGUI($plugin->txt('source'), 'source_id');
$a_form->addItem($item_group);
$non_active = true;
Expand Down Expand Up @@ -1243,7 +1256,7 @@ protected function setTabs()
}
}
}

if($ilAccess->checkAccess('write', '', $this->object->getRefId()))
{
$ilTabs->addTab('editComments', ilInteractiveVideoPlugin::getInstance()->txt('questions_comments'), $this->ctrl->getLinkTarget($this, 'editComments'));
Expand Down Expand Up @@ -1307,7 +1320,7 @@ public function setSubTabs($a_tab)
}
$ilTabs->addSubTab('editMyComments', $plugin->txt('my_comments'),$this->ctrl->getLinkTarget($this,'editMyComments'));
$ilTabs->addSubTab('showMyResults', $plugin->txt('show_my_results'), $this->ctrl->getLinkTarget($this, 'showMyResults'));

if($ilAccess->checkAccess('write', '', $this->object->getRefId()))
{
$ilTabs->addSubTab('showResults', $plugin->txt('user_results'), $this->ctrl->getLinkTarget($this, 'showResults'));
Expand Down Expand Up @@ -1407,7 +1420,7 @@ public function postComment()
$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))
{
$comment->setIsReplyTo((int) $_POST['is_reply_to']);
Expand Down Expand Up @@ -1533,7 +1546,7 @@ private function initCommentForm()

$title = new ilTextInputGUI($this->lng->txt('title'), 'comment_title');
$form->addItem($title);

$time = new ilInteractiveVideoTimePicker($this->lng->txt('time'), 'comment_time');
#$time->setShowTime(true);
#$time->setShowSeconds(true);
Expand Down Expand Up @@ -2175,7 +2188,7 @@ public function editChapter(ilPropertyFormGUI $form = NULL)
* @throws ilTemplateException
*/
private function getCommentFormValues($comment_id = 0)
{
{
$values = array();
if($comment_id == 0)
{
Expand Down Expand Up @@ -2258,7 +2271,7 @@ public function initQuestionForm()
$title->setInfo($plugin->txt('comment_title_info'));
$title->setRequired(true);
$form->addItem($title);

$time = new ilInteractiveVideoTimePicker($this->lng->txt('time'), 'comment_time');

if(isset($_POST['comment_time']))
Expand Down Expand Up @@ -2302,7 +2315,7 @@ public function initQuestionForm()
$neutral_type->setOptions($neutral_type_options);
$neutral_type->setInfo($plugin->txt('neutral_type_info'));
$form->addItem($neutral_type);


$answer = new ilCustomInputGUI($this->lng->txt('answers'), 'answer_text');
$answer->setHtml($this->getInteractiveForm());
Expand Down Expand Up @@ -2609,7 +2622,7 @@ public function confirmUpdateQuestion()
$confirm->setConfirm($this->lng->txt('update'), 'updateQuestion');
foreach($_POST as $key=>$value)
{
//@todo .... very quick ... very dirty ....
//@todo .... very quick ... very dirty ....
if($key != 'cmd')
{
$form_values[$key] = $value;
Expand All @@ -2629,7 +2642,7 @@ public function updateQuestion()
$form = $this->initQuestionForm();
if(isset($_POST['form_values']))
{
//@todo .... very quick ... very wtf ....
//@todo .... very quick ... very wtf ....
$_POST = unserialize($_POST['form_values']);
$_FILES = unserialize($_REQUEST['form_files']);
}
Expand Down Expand Up @@ -2686,7 +2699,7 @@ private function performQuestionRefresh($comment_id, $form)
ilInteractiveVideoFFmpeg::removeSelectedImage($question->getQuestionImage());
$question->setQuestionImage(null);
}

$question->setQuestionText(ilUtil::stripSlashes($form->getInput('question_text'), false));
$question->setFeedbackCorrect(ilUtil::stripSlashes($form->getInput('feedback_correct'), false));
$question->setFeedbackOneWrong(ilUtil::stripSlashes($form->getInput('feedback_one_wrong'), false));
Expand All @@ -2696,7 +2709,7 @@ private function performQuestionRefresh($comment_id, $form)
$question->setShowCorrectIcon((int)$form->getInput('show_correct_icon'));
$question->setFeedbackCorrectId((int)$form->getInput('feedback_correct_obj'));
$question->setFeedbackWrongId((int)$form->getInput('feedback_wrong_obj'));

$question->setJumpCorrectTs((int) $form->getInput('jump_correct_ts'));

$question->setIsJumpWrong((int)$form->getInput('is_jump_wrong'));
Expand Down Expand Up @@ -3020,7 +3033,7 @@ public function postAnswerPerAjax()
}

/**
*
*
*/
public function generateThumbnailsFromSourcePerAjax()
{
Expand Down Expand Up @@ -3050,7 +3063,7 @@ public function generateThumbnailsFromSourcePerAjax()
$tpl_json->setVariable('JSON', json_encode(array('error' => $e->getMessage())));
$tpl_json->show("DEFAULT", false, true);
}


}
$this->callExit();
Expand Down Expand Up @@ -3085,7 +3098,7 @@ public function postVideoFinishedPerAjax()

$this->callExit();
}

protected function callExit()
{
exit();
Expand All @@ -3106,7 +3119,7 @@ public function completeCsvExport()
$data = $simple->getScoreForAllQuestionsAndAllUser($this->obj_id);

$csv = array();
$separator = ";";
$separator = $this->object->getCSVExportDelimiter();

$head_row = array();
array_push($head_row, $lng->txt('name'));
Expand Down Expand Up @@ -3155,14 +3168,15 @@ public function exportMyComments()
$data = $this->object->getCommentsTableDataByUserId();

$csv = array();
$separator = ";";
$separator = $this->object->getCSVExportDelimiter();

$head_row = array();
array_push($head_row, $lng->txt('id'));
array_push($head_row, $lng->txt('time'));
array_push($head_row, $plugin->txt('time_end') );
array_push($head_row, $plugin->txt('comment_title'));
array_push($head_row, $plugin->txt('comment'));
array_push($head_row, $plugin->txt('compulsory'));
array_push($head_row, $plugin->txt('visibility'));
array_push($csv, ilUtil::processCSVRow($head_row, TRUE, $separator) );
foreach ($data as $key => $row)
Expand Down Expand Up @@ -3193,7 +3207,7 @@ public function exportAllComments()
$data = $this->object->getCommentsTableData(true, false, false, true);

$csv = array();
$separator = ";";
$separator = $this->object->getCSVExportDelimiter();

$head_row = array();

Expand All @@ -3206,6 +3220,7 @@ public function exportAllComments()
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('is_table_of_content'));
array_push($head_row, $plugin->txt('type'));

array_push($csv, ilUtil::processCSVRow($head_row, TRUE, $separator) );
Expand Down Expand Up @@ -3233,7 +3248,7 @@ public static function _goto($a_target)
{
/**
* @var $ilCtrl ilCtrl
* @var $ilAccess ilAccessHandler
* @var $ilAccess ilAccessHandler
*/
global $ilCtrl, $ilAccess, $lng;

Expand Down
Loading