Skip to content

Commit

Permalink
started import/export
Browse files Browse the repository at this point in the history
  • Loading branch information
gvollbach committed Jan 19, 2017
1 parent 69c5d10 commit e1e7d5b
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 7 deletions.
29 changes: 29 additions & 0 deletions classes/class.ilInteractiveVideoExportGUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php
require_once 'Services/Export/classes/class.ilExportGUI.php';
/**
* Class ilInteractiveVideoExportGUI
*/
class ilInteractiveVideoExportGUI extends ilExportGUI
{
/**
* {@inheritdoc}
*/
protected function buildExportTableGUI()
{
require_once 'class.ilInteractiveVideoExportTableGUI.php';
$table = new ilInteractiveVideoExportTableGUI($this, 'listExportFiles', $this->obj);
return $table;
}

/**
* Download file
*/
public function download()
{
if(isset($_GET['file']) && $_GET['file'])
{
$_POST['file'] = array($_GET['file']);
}
parent::download();
}
}
35 changes: 35 additions & 0 deletions classes/class.ilInteractiveVideoExportTableGUI.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?php
/* Copyright (c) 1998-2015 ILIAS open source, Extended GPL, see docs/LICENSE */

require_once 'Services/Export/classes/class.ilExportTableGUI.php';
require_once 'Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';

/**
* Class ilInteractiveVideoExportTableGUI
*/
class ilInteractiveVideoExportTableGUI extends ilExportTableGUI
{
/**
* Constructor
*
* @access public
* @param
* @return
*/
public function __construct($a_parent_obj, $a_parent_cmd, $a_exp_obj)
{
parent::__construct($a_parent_obj, $a_parent_cmd, $a_exp_obj);

// NOT REQUIRED ANYMORE, PROBLEM NOW FIXED IN THE ROOT
// KEEP CODE, JF OPINIONS / ROOT FIXINGS CAN CHANGE
//$this->addCustomColumn($this->lng->txt('actions'), $this, 'formatActionsList');
}

/***
*
*/
protected function initMultiCommands()
{
$this->addMultiCommand('confirmDeletion', $this->lng->txt('delete'));
}
}
24 changes: 24 additions & 0 deletions classes/class.ilInteractiveVideoExporter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
require_once './Services/Export/classes/class.ilXmlExporter.php';

/**
* Class ilInteractiveVideoExporter
*/
class ilInteractiveVideoExporter extends ilXmlExporter
{
public function getXmlRepresentation($a_entity, $a_schema_version, $a_id)
{
// TODO: Implement getXmlRepresentation() method.
}

public function init()
{
// TODO: Implement init() method.
}

public function getValidSchemaVersions($a_entity)
{
// TODO: Implement getValidSchemaVersions() method.
}

}
14 changes: 14 additions & 0 deletions classes/class.ilInteractiveVideoImporter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
require_once './Services/Export/classes/class.ilXmlImporter.php';

/**
* Class ilInteractiveVideoImporter
*/
class ilInteractiveVideoImporter extends ilXmlImporter
{
public function importXmlRepresentation($a_entity, $a_id, $a_xml, $a_mapping)
{
// TODO: Implement importXmlRepresentation() method.
}

}
10 changes: 9 additions & 1 deletion classes/class.ilInteractiveVideoPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class ilInteractiveVideoPlugin extends ilRepositoryObjectPlugin
private static $instance = null;

/**
* @return ilPlugin
* @return ilInteractiveVideoPlugin | ilPlugin
*/
public static function getInstance()
{
Expand Down Expand Up @@ -144,4 +144,12 @@ public function updateLanguages()
ilObjLanguage::replaceLangModule($lang, $prefix, $elements);
}
}

/**
* @return bool
*/
public function isCoreMin52()
{
return version_compare(ILIAS_VERSION_NUMERIC, '5.2.0', '>=');
}
}
34 changes: 30 additions & 4 deletions classes/class.ilObjInteractiveVideoGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* @ilCtrl_Calls ilObjInteractiveVideoGUI: ilPermissionGUI, ilInfoScreenGUI, ilObjectCopyGUI, ilRepositorySearchGUI, ilPublicUserProfileGUI, ilCommonActionDispatcherGUI, ilMDEditorGUI
* @ilCtrl_Calls ilObjInteractiveVideoGUI: ilInteractiveVideoLearningProgressGUI
* @ilCtrl_Calls ilObjInteractiveVideoGUI: ilPropertyFormGUI
* @ilCtrl_Calls ilObjInteractiveVideoGUI: ilInteractiveVideoExportGUI
*/
class ilObjInteractiveVideoGUI extends ilObjectPluginGUI implements ilDesktopItemHandling
{
Expand Down Expand Up @@ -110,7 +111,14 @@ public function performCommand($cmd)
$gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
$this->ctrl->forwardCommand($gui);
break;

case "ilinteractivevideoexportgui":
$this->checkPermission('write');
$ilTabs->setTabActive('export');
$plugin->includeClass('class.ilInteractiveVideoExportGUI.php');
$exp_gui = new ilInteractiveVideoExportGUI($this);
$exp_gui->addFormat('xml', $this->lng->txt('export'));
$this->ctrl->forwardCommand($exp_gui);
break;
default:
switch($cmd)
{
Expand Down Expand Up @@ -477,9 +485,20 @@ protected function updateCustom(ilPropertyFormGUI $a_form)
*/
protected function initCreationForms($type)
{
return array(
self::CFORM_NEW => $this->initCreateForm($type)
);
if(ilInteractiveVideoPlugin::getInstance()->isCoreMin52())
{
$form_array = array(
self::CFORM_NEW => $this->initCreateForm($type),
self::CFORM_IMPORT => $this->initImportForm($type)
);
}
else
{
$form_array = array(
self::CFORM_NEW => $this->initCreateForm($type)
);
}
return $form_array;
}

/**
Expand Down Expand Up @@ -801,6 +820,13 @@ protected function setTabs()
$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();
}
Expand Down
5 changes: 3 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 = '2.0.5';
$version = '2.0.6';

// ilias min and max version; must always reflect the versions that should
// run with the plugin
Expand All @@ -14,4 +14,5 @@
$responsible = 'Nadia Ahmad / Michael Jansen / Max Becker / Guido Vollbach';
$responsible_mail = '[email protected] / [email protected] / [email protected] / [email protected]';

$learning_progress = true;
$learning_progress = true;
$supports_export = true;

0 comments on commit e1e7d5b

Please sign in to comment.