Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added option to change the CSV export delimiter per InteractiveVideo item for Ilias 8 version. #52

Open
wants to merge 3 commits into
base: r8
Choose a base branch
from
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
22 changes: 21 additions & 1 deletion classes/class.ilObjInteractiveVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class ilObjInteractiveVideo extends ilObjectPlugin implements ilLPStatusPluginIn
* @var boolean
*/
protected $fixed_modal = 0;

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

/**
* @var int
*/
Expand Down Expand Up @@ -127,6 +133,7 @@ protected function doRead(): void
$this->setEnableToolbar($row['show_toolbar'] ?: 0);
$this->setAutoResumeAfterQuestion($row['auto_resume'] ?: 0);
$this->setFixedModal($row['fixed_modal'] ?: 0);
$this->setCSVExportDelimiter($row['csv_export_delimiter'] ?: 0);
$this->setShowTocFirst($row['show_toc_first'] ?: 0);
$this->setEnableCommentStream($row['disable_comment_stream'] ?: 0);
$this->setNoCommentStream($row['no_comment_stream'] ?: 0);
Expand Down Expand Up @@ -333,6 +340,7 @@ protected function doCreate(bool $clone_mode = false): void
'is_task' => ['integer', $is_task],
'auto_resume' => ['integer', $auto_resume],
'fixed_modal' => ['integer', $fixed_modal],
'csv_export_delimiter' => ['text', ";"],
'task' => ['text', $task],
'enable_comment' => ['integer', 1],
'show_toolbar' => ['integer', $show_toolbar],
Expand Down Expand Up @@ -370,7 +378,7 @@ protected function doCreate(bool $clone_mode = false): void
protected function doUpdate(): void
{
parent::doUpdate();

$old_source_id = $this->getOldVideoSource();
if($old_source_id != null && $old_source_id != $this->getSourceId())
{
Expand All @@ -389,6 +397,7 @@ protected function doUpdate(): void
'task' => ['text', $this->getTask()],
'auto_resume' => ['integer', $this->isAutoResumeAfterQuestion()],
'fixed_modal' => ['integer', $this->isFixedModal()],
'csv_export_delimiter' => ['text', $this->getCSVExportDelimiter()],
'show_toc_first' => ['integer', $this->getShowTocFirst()],
'disable_comment_stream' => ['integer', $this->getEnableCommentStream()],
'lp_mode' => ['integer', $this->getLearningProgressMode()],
Expand Down Expand Up @@ -446,6 +455,7 @@ protected function doCloneObject(ilObject2 $new_obj, int $a_target_id, ?int $a_c
'task' => ['text', $this->getTask()],
'auto_resume' => ['integer', $this->isAutoResumeAfterQuestion()],
'fixed_modal' => ['integer', $this->isFixedModal()],
'csv_export_delimiter' => ['text', $this->getCSVExportDelimiter()],
'show_toc_first' => ['integer', $this->getShowTocFirst()],
'disable_comment_stream' => ['integer', $this->getEnableCommentStream()],
'lp_mode' => ['integer', $this->getLearningProgressMode()],
Expand Down Expand Up @@ -1242,6 +1252,16 @@ public function setFixedModal(bool $fixed_modal): void
$this->fixed_modal = $fixed_modal;
}

public function getCSVExportDelimiter(): string
{
return $this->csv_export_delimiter;
}

public function setCSVExportDelimiter(string $csv_export_delimiter): void
{
$this->csv_export_delimiter = $csv_export_delimiter;
}

public function getShowTocFirst(): int
{
return $this->show_toc_first;
Expand Down
20 changes: 17 additions & 3 deletions classes/class.ilObjInteractiveVideoGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,6 +961,9 @@ protected function updateCustom(ilPropertyFormGUI $form): void
$fixed_modal = $form->getInput('fixed_modal');
$this->object->setFixedModal((int)$fixed_modal);

$csv_export_delimiter = $form->getInput('csv_export_delimiter');
$this->object->setCSVExportDelimiter(ilInteractiveVideoPlugin::stripSlashesWrapping($csv_export_delimiter));

$marker_for_students = $form->getInput('marker_for_students');
$this->object->setMarkerForStudents((int)$marker_for_students);

Expand Down Expand Up @@ -1157,6 +1160,15 @@ protected function appendDefaultFormOptions(ilPropertyFormGUI $a_form): void
$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 @@ -1199,6 +1211,7 @@ protected function getEditFormCustomValues(array &$a_values): void
$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();
$a_values["marker_for_students"]= $this->object->getMarkerForStudents();
$a_values["layout_width"] = $this->object->getLayoutWidth();
}
Expand Down Expand Up @@ -3661,7 +3674,7 @@ public function completeCsvExport(): void
$data = $simple->getScoreForAllQuestionsAndAllUser($this->obj_id);

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

$head_row = [];
array_push($head_row, $lng->txt('name'));
Expand Down Expand Up @@ -3710,7 +3723,7 @@ public function exportMyComments(): void
$data = $this->object->getCommentsTableDataByUserId();

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

$head_row = [];
array_push($head_row, $lng->txt('id'));
Expand All @@ -3719,6 +3732,7 @@ public function exportMyComments(): void
array_push($head_row, $plugin->txt('comment_title'));
array_push($head_row, $plugin->txt('comment'));
array_push($head_row, $plugin->txt('visibility'));
array_push($head_row, $plugin->txt('is_private'));
array_push($head_row, $plugin->txt('reply_to'));

array_push($csv, ilCSVUtil::processCSVRow($head_row, TRUE, $separator) );
Expand Down Expand Up @@ -3750,7 +3764,7 @@ public function exportAllComments(): void
$data = $this->object->getCommentsTableData(true, false, false, true);

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

$head_row = [];

Expand Down
9 changes: 6 additions & 3 deletions lang/ilias_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ cancel#:#Abbrechen
sure_delete_comment#:#Sind Sie sicher, dass Sie den gewählten Kommentare/Fragen/Kapitel löschen möchten?
missing_comment_text#:#Bitte geben Sie einen Kommentar ein.
missing_stopping_point#:#Der Haltepunkt wurde nicht zum Server übertragen. Bitte versuchen Sie es erneut.
invalid_comment_ids#:#Einige Kommentare konnten nicht gefunden werden.
invalid_comment_ids#:#Einige Kommentare konnten nicht gefunden werden.
comments_successfully_deleted#:#Die gewählten Kommentare wurden erfolgreich gelöscht.
insert_comment#:#Neue Frage / Neuen Kommentar einfügen
edit_comment#:#Kommentar bearbeiten
Expand Down Expand Up @@ -129,7 +129,7 @@ crs_create_xvid#:#Interaktives Video anlegen
cat_create_xvid#:#Interaktives Video anlegen
root_create_xvid#:#Interaktives Video anlegen
fold_create_xvid#:#Interaktives Video anlegen
rbac_create_xvid#:#Interaktives Video anlegen
rbac_create_xvid#:#Interaktives Video anlegen
source#:#Quelle
installed_version#:#Installierte Databank Version: %s, Datei Datenbank Version %s
source_does_not_exist#:#Quelle existiert nicht mehr oder wurde in der Administration deaktiviert
Expand Down Expand Up @@ -176,7 +176,7 @@ export_all_comments#:#Alle Kommentare exportieren
question_image#:#Bild für Frage
extract#:#Thumbnail aus Video erzeugen
use_this_image#:#Dieses Bild verwenden
time_for_preview#:#Zeitpunkt:
time_for_preview#:#Zeitpunkt:
comment_title_info#:#Der Titel wird im Kommentarstream angezeigt und ist für die Kursteilnehmer damit immer sichtbar.
correct_answer#:#Richtig
wrong_answer#:#Falsch
Expand Down Expand Up @@ -280,3 +280,6 @@ please_create_object_first#:#Um ein Opencast Video nutzen zu können, müssen Si
meo#:#Vimeo
meo_vimeo_info#:#Geben Sie bitte eine Vimeo-URL ein.
meo_url#:#Vimeo-URL
export_section#:#Export
csv_export_delimiter#:#CSV-Exporttrennzeichen
csv_export_delimiter_info#:#Ändern Sie das Standardtrennzeichen für CSV-Exporte.
13 changes: 8 additions & 5 deletions lang/ilias_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ send#:#Check
close#:#Close
question#:#Question
is_anonymized#:#Anonymize Comments
is_anonymized_info#:#If enabled all comments are shown without usernames
is_anonymized_info#:#If enabled all comments are shown without usernames
is_public#:#Publish All Comments
is_public_info#:#If enabled all users are able to read all PUBLIC comments. Otherwise they are only able to see own comments and public comments created by administrators (in the tab "Questions, chapters and comments")
correct_answered#:#Answered correctly
Expand All @@ -101,7 +101,7 @@ feedback#:#Feedback
already_answered#:#Question already answered.
reflection#:#Reflective question
answers#:#Answers
sure_update_question#:#Are you sure, you want to save the question? Existing user results will be deleted!
sure_update_question#:#Are you sure, you want to save the question? Existing user results will be deleted!
question_type_info#:#You can choose between one of three available question types: a single choice, a multiple choice or a self-reflexion quertion. Self-reflexion questions do not have answer options and will be marked as "passed" once they have been shown to a user at least once.
is_jump_correct_info#:#In case the question was answered correctly, you can select a jump label (time stamp) within the video to which the user can jump using a button. This button will be shown along with the feedback text.
is_jump_wrong_info#:#In case the question was answered incorrectly, you can select a jump label (time stamp) within the video to which the user can jump using a button. This button will be shown along with the feedback text.
Expand Down Expand Up @@ -131,7 +131,7 @@ crs_create_xvid#:#Create Interactive Video
cat_create_xvid#:#Create Interactive Video
root_create_xvid#:#Create Interactive Video
fold_create_xvid#:#Create Interactive Video
rbac_create_xvid#:#Create Interactive Video
rbac_create_xvid#:#Create Interactive Video
source#:#Source
installed_version#:#Installed Database Version: %s, File Database Version %s
source_does_not_exist#:#Source does not exist anymore or was disabled in the administration
Expand Down Expand Up @@ -178,7 +178,7 @@ export_all_comments#:#Export All Comments
question_image#:#Question image
extract#:#Generate Thumbnail from Video
use_this_image#:#Use this image
time_for_preview#:#Time:
time_for_preview#:#Time:
comment_title_info#:#The title is always visible in the comment screen.
correct_answer#:#Correct
wrong_answer#:#Wrong
Expand Down Expand Up @@ -280,4 +280,7 @@ opc_title#:#Title
please_create_object_first#:#To use an Opencast video, you must first create an «Interactive Video» object. To do so, specify a title and click «Add Interactive Video».
meo#:#Vimeo
meo_vimeo_info#:#Please insert a Vimeo URL.
meo_url#:#Vimeo URL
meo_url#:#Vimeo URL
export_section#:#Export
csv_export_delimiter#:#CSV export delimiter
csv_export_delimiter_info#:#Change the default delimiter for CSV exports.
4 changes: 2 additions & 2 deletions plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$id = 'xvid';

// code version; must be changed for all code changes
$version = "3.5.2";
$version = "3.5.3";

// ilias min and max version; must always reflect the versions that should
// run with the plugin
Expand All @@ -15,4 +15,4 @@
$responsible_mail = '[email protected] / [email protected] / [email protected]';

$learning_progress = true;
$supports_export = true;
$supports_export = true;
23 changes: 18 additions & 5 deletions sql/dbupdate.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
'length' => '4',
'notnull' => true
)
);
);
$ilDB->createTable('rep_robj_xvid_question', $fields);
$ilDB->addPrimaryKey('rep_robj_xvid_question', array('question_id'));
$ilDB->createSequence('rep_robj_xvid_question');
Expand Down Expand Up @@ -414,15 +414,15 @@
)
);
}

$res = $ilDB->queryF('SELECT comment_id FROM rep_robj_xvid_comments WHERE repeat_question = %s',
array('integer'), array(1));

while($row = $ilDB->fetchAssoc($res))
{
$comment_ids[] = $row['comment_id'];
}

$ilDB->manipulateF('
UPDATE rep_robj_xvid_question
SET rep_robj_xvid_question.repeat_question = %s
Expand Down Expand Up @@ -523,7 +523,7 @@
'notnull' => true,
'default' => 0));
}
}
}
?>
<#25>
<?php
Expand Down Expand Up @@ -1229,3 +1229,16 @@
'default' => 1));
}
?>
<#84>
<?php
if(!$ilDB->tableColumnExists('rep_robj_xvid_objects', 'csv_export_delimiter'))
{
$ilDB->addTableColumn('rep_robj_xvid_objects', 'csv_export_delimiter',
array(
'type' => 'text',
'length' => 1,
'notnull' => true,
'default' => ";")
);
}
?>