Skip to content
GitLab
Explore
Sign in
formatest
FormATest_QuestionSetPool
Compare revisions
dac62171f9f4b208778bdbb4996d236af1fe3adc to 381d5850e2bde24749dbdf4affb7ff3984e296ea
Hide whitespace changes
Inline
Side-by-side
Parser/classes/Factory/ManufacturerInterface.php
View file @
381d5850
...
@@ -7,36 +7,37 @@
...
@@ -7,36 +7,37 @@
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
interface
ManufacturerInterface
{
interface
ManufacturerInterface
{
/**
/**
* Get an singleton of the manufacturer
* Get an singleton of the manufacturer
*
*
* @return ManufacturerInterface
* @return ManufacturerInterface
*/
*/
public
static
function
_getInstance
();
public
static
function
_getInstance
();
/**
/**
* Create a new specific Composite object which is representing the delivered Attribute
* Create a new specific Composite object which is representing the delivered Attribute
*
*
* @param string $attribute
* @param string $attribute
*
*
* @return AbstractComposite
* @return AbstractComposite
*/
*/
public
function
manufacture
(
$attribute
);
public
function
manufacture
(
$attribute
);
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
();
public
function
getPattern
();
/**
/**
* Matches a delivered string with a the pattern returned by getPattern implemented in the explicit Manufacturer
* Matches a delivered string with a the pattern returned by getPattern implemented in the explicit Manufacturer
*
*
* @param string $subject
* @param string $subject
*
*
* @see ManufacturerInterface::getPattern()
* @see ManufacturerInterface::getPattern()
* @return array
* @return array
*/
*/
public
function
match
(
$subject
);
public
function
match
(
$subject
);
}
}
\ No newline at end of file
Parser/classes/Factory/OperationManufacturer.php
View file @
381d5850
...
@@ -8,118 +8,121 @@ require_once "AbstractManufacturer.php";
...
@@ -8,118 +8,121 @@ require_once "AbstractManufacturer.php";
* Date: 25.03.13
* Date: 25.03.13
* Time: 15:12
* Time: 15:12
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
OperationManufacturer
extends
AbstractManufacturer
{
class
OperationManufacturer
extends
AbstractManufacturer
{
/**
/**
* A Singleton Instance of the OperationManufacturer
* A Singleton Instance of the OperationManufacturer
*
*
* @see OperatoinManufacturer::_getInstance()
* @see OperatoinManufacturer::_getInstance()
* @see OperationManufacturer::__construct()
* @see OperationManufacturer::__construct()
*
*
* @var null|OperationManufacturer
* @var null|OperationManufacturer
*/
*/
protected
static
$instance
=
null
;
protected
static
$instance
=
null
;
/**
/**
* Get an Instance of OperationManufacturer
* Get an Instance of OperationManufacturer
*
*
* @return OperationManufacturer
* @return OperationManufacturer
*/
*/
public
static
function
_getInstance
(){
public
static
function
_getInstance
()
if
(
self
::
$instance
==
null
){
{
self
::
$instance
=
new
OperationManufacturer
();
if
(
self
::
$instance
==
null
)
{
}
self
::
$instance
=
new
OperationManufacturer
();
return
self
::
$instance
;
}
}
return
self
::
$instance
;
}
/**
/**
* Create a new specific Composite object which is representing the delivered Attribute
* Create a new specific Composite object which is representing the delivered Attribute
*
*
* @param string $attribute
* @param string $attribute
*
*
* @return AbstractComposite|AndOperation|EqualsOperation|GreaterOperation|GreaterOrEqualsOperation|LesserOperation|LesserOrEqualsOperation|NotEqualsOperation|OrOperation
* @return AbstractComposite|AndOperation|EqualsOperation|GreaterOperation|GreaterOrEqualsOperation|LesserOperation|LesserOrEqualsOperation|NotEqualsOperation|OrOperation
* @throws UnsupportedOperation
* @throws UnsupportedOperation
*/
*/
public
function
manufacture
(
$attribute
)
public
function
manufacture
(
$attribute
)
{
{
$operation
=
""
;
$operation
=
""
;
switch
(
$attribute
)
switch
(
$attribute
)
{
{
case
LesserOperation
::
$pattern
:
case
LesserOperation
::
$pattern
:
$operation
=
new
LesserOperation
();
$operation
=
new
LesserOperation
();
break
;
break
;
case
LesserOrEqualsOperation
::
$pattern
:
case
LesserOrEqualsOperation
::
$pattern
:
$operation
=
new
LesserOrEqualsOperation
();
$operation
=
new
LesserOrEqualsOperation
();
break
;
break
;
case
EqualsOperation
::
$pattern
:
case
EqualsOperation
::
$pattern
:
$operation
=
new
EqualsOperation
();
$operation
=
new
EqualsOperation
();
break
;
break
;
case
GreaterOrEqualsOperation
::
$pattern
:
case
GreaterOrEqualsOperation
::
$pattern
:
$operation
=
new
GreaterOrEqualsOperation
();
$operation
=
new
GreaterOrEqualsOperation
();
break
;
break
;
case
GreaterOperation
::
$pattern
:
case
GreaterOperation
::
$pattern
:
$operation
=
new
GreaterOperation
();
$operation
=
new
GreaterOperation
();
break
;
break
;
case
NotEqualsOperation
::
$pattern
:
case
NotEqualsOperation
::
$pattern
:
$operation
=
new
NotEqualsOperation
();
$operation
=
new
NotEqualsOperation
();
break
;
break
;
case
AndOperation
::
$pattern
:
case
AndOperation
::
$pattern
:
$operation
=
new
AndOperation
();
$operation
=
new
AndOperation
();
break
;
break
;
case
OrOperation
::
$pattern
:
case
OrOperation
::
$pattern
:
$operation
=
new
OrOperation
();
$operation
=
new
OrOperation
();
break
;
break
;
default
:
default
:
throw
new
UnsupportedOperation
(
$attribute
);
throw
new
UnsupportedOperation
(
$attribute
);
break
;
break
;
}
}
return
$operation
;
return
$operation
;
}
}
/**
/**
* This function create a regular expression to match all operators in a condition. <br />
* This function create a regular expression to match all operators in a condition. <br />
* The following string is created by this function <b>'/[\!&\|<>=]+/'</b><br />
* The following string is created by this function <b>'/[\!&\|<>=]+/'</b><br />
* It matches all operators in a condition and is divided into the following parts:
* It matches all operators in a condition and is divided into the following parts:
*
*
* <pre>
* <pre>
* NEGATION: !
* NEGATION: !
* AND: &
* AND: &
* OR: |
* OR: |
* LESSER: <
* LESSER: <
* LESSER OR EQUALS: <=
* LESSER OR EQUALS: <=
* EQUALS =
* EQUALS =
* GREATER OR EQUALS >=
* GREATER OR EQUALS >=
* GREATER >
* GREATER >
* NOT EQUALS <>
* NOT EQUALS <>
* </pre>
* </pre>
*
*
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
// return '/[&\|<>=]+/';
// return '/[&\|<>=]+/';
return
'/&|\||(?<!<|>)=|<(?!=|>)|>(?!=)|<=|>=|<>/'
;
return
'/&|\||(?<!<|>)=|<(?!=|>)|>(?!=)|<=|>=|<>/'
;
}
}
/**
/**
* Private construtor to prevent creating an object of OperationManufacturer
* Private construtor to prevent creating an object of OperationManufacturer
*/
*/
private
function
__construct
()
private
function
__construct
()
{
{
require_once
__DIR__
.
'/../Operations/LesserOperation.php'
;
require_once
__DIR__
.
'/../Operations/LesserOperation.php'
;
require_once
__DIR__
.
'/../Operations/LesserOrEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/LesserOrEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/EqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/EqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/GreaterOrEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/GreaterOrEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/GreaterOperation.php'
;
require_once
__DIR__
.
'/../Operations/GreaterOperation.php'
;
require_once
__DIR__
.
'/../Operations/NotEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/NotEqualsOperation.php'
;
require_once
__DIR__
.
'/../Operations/AndOperation.php'
;
require_once
__DIR__
.
'/../Operations/AndOperation.php'
;
require_once
__DIR__
.
'/../Operations/OrOperation.php'
;
require_once
__DIR__
.
'/../Operations/OrOperation.php'
;
require_once
__DIR__
.
'/../Exception/UnsupportedOperation.php'
;
require_once
__DIR__
.
'/../Exception/UnsupportedOperation.php'
;
}
}
/**
/**
* Private clone to prevent cloning an object of OperationManufacturer
* Private clone to prevent cloning an object of OperationManufacturer
*/
*/
private
function
__clone
()
{}
private
function
__clone
()
{
}
}
}
Parser/classes/Operations/AbstractOperation.php
View file @
381d5850
...
@@ -8,32 +8,33 @@ include_once __DIR__ . "/../AbstractComposite.php";
...
@@ -8,32 +8,33 @@ include_once __DIR__ . "/../AbstractComposite.php";
* Date: 25.03.13
* Date: 25.03.13
* Time: 15:37
* Time: 15:37
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
abstract
class
AbstractOperation
extends
AbstractComposite
{
abstract
class
AbstractOperation
extends
AbstractComposite
{
/**
/**
* @var bool
* @var bool
*/
*/
protected
$negated
=
false
;
protected
$negated
=
false
;
/**
/**
* @return string
* @return string
*/
*/
abstract
public
function
getPattern
();
abstract
public
function
getPattern
();
/**
/**
* @param boolean $negated
* @param boolean $negated
*/
*/
public
function
setNegated
(
$negated
)
public
function
setNegated
(
$negated
)
{
{
$this
->
negated
=
$negated
;
$this
->
negated
=
$negated
;
}
}
/**
/**
* @return boolean
* @return boolean
*/
*/
public
function
isNegated
()
public
function
isNegated
()
{
{
return
$this
->
negated
;
return
$this
->
negated
;
}
}
}
}
Parser/classes/Operations/AndOperation.php
View file @
381d5850
...
@@ -8,28 +8,29 @@ include_once 'AbstractOperation.php';
...
@@ -8,28 +8,29 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:58
* Time: 14:58
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
AndOperation
extends
AbstractOperation
{
class
AndOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"&"
;
public
static
$pattern
=
"&"
;
/**
/**
* Get a human readable description of the Composite element
* Get a human readable description of the Composite element
* @return string
* @return string
*/
*/
public
function
getDescription
()
public
function
getDescription
()
{
{
return
"und "
;
return
"und "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/EqualsOperation.php
View file @
381d5850
...
@@ -8,25 +8,26 @@ include_once 'AbstractOperation.php';
...
@@ -8,25 +8,26 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:57
* Time: 14:57
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
EqualsOperation
extends
AbstractOperation
{
class
EqualsOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"="
;
public
static
$pattern
=
"="
;
/**
/**
* Get a human readable description of the Composite element
* Get a human readable description of the Composite element
* @return string
* @return string
*/
*/
public
function
getDescription
()
public
function
getDescription
()
{
{
return
'mit genau '
;
return
'mit genau '
;
}
}
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/GreaterOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:57
* Time: 14:57
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
GreaterOperation
extends
AbstractOperation
{
class
GreaterOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
">"
;
public
static
$pattern
=
">"
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"mit mehr als "
;
return
"mit mehr als "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/GreaterOrEqualsOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:58
* Time: 14:58
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
GreaterOrEqualsOperation
extends
AbstractOperation
{
class
GreaterOrEqualsOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
">="
;
public
static
$pattern
=
">="
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"mit mehr oder genau "
;
return
"mit mehr oder genau "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/LesserOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:57
* Time: 14:57
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
LesserOperation
extends
AbstractOperation
{
class
LesserOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"<"
;
public
static
$pattern
=
"<"
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"mit weniger als "
;
return
"mit weniger als "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/LesserOrEqualsOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:58
* Time: 14:58
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
LesserOrEqualsOperation
extends
AbstractOperation
{
class
LesserOrEqualsOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"<="
;
public
static
$pattern
=
"<="
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"mit weniger oder gleich "
;
return
"mit weniger oder gleich "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/NotEqualsOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:57
* Time: 14:57
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
NotEqualsOperation
extends
AbstractOperation
{
class
NotEqualsOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"<>"
;
public
static
$pattern
=
"<>"
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"nicht mit "
;
return
"nicht mit "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
Parser/classes/Operations/OrOperation.php
View file @
381d5850
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
...
@@ -8,24 +8,25 @@ include_once 'AbstractOperation.php';
* Date: 25.03.13
* Date: 25.03.13
* Time: 14:58
* Time: 14:58
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
OrOperation
extends
AbstractOperation
{
class
OrOperation
extends
AbstractOperation
{
/**
/**
* @var string
* @var string
*/
*/
public
static
$pattern
=
"|"
;
public
static
$pattern
=
"|"
;
function
getDescription
()
public
function
getDescription
()
{
{
return
"oder "
;
return
"oder "
;
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getPattern
()
public
function
getPattern
()
{
{
return
self
::
$pattern
;
return
self
::
$pattern
;
}
}
}
}
README.md
View file @
381d5850
# ILIAS QuestionSetPool
# ILIAS QuestionSetPool
*
For ILIAS versions:
5.3
.0 -
5.4
.999
*
For ILIAS versions:
6
.0 -
6
.999
## Installation Instructions
## Installation Instructions
1.
Create the plugin path:
1.
Create the plugin path:
...
@@ -20,3 +20,10 @@
...
@@ -20,3 +20,10 @@
3. Select **Plugins** from the **Administration** main menu drop down.
3. Select **Plugins** from the **Administration** main menu drop down.
4. Search the **QuestionSetPool** plugin in the list of plugin and choose **Activate** from the **Actions** drop down.
4. Search the **QuestionSetPool** plugin in the list of plugin and choose **Activate** from the **Actions** drop down.
5. Choose **Configure** from the **Actions** drop down and enter the required data.
5. Choose **Configure** from the **Actions** drop down and enter the required data.
## Dependencies
### Graphviz
Please install [`Graphviz`](https://graphviz.org/). Graphviz is required for
the graph visualization of the question paths.
\ No newline at end of file
classes/class.ilObjQuestionSetPool.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Repository/classes/class.ilObjectPlugin.php'
;
require_once
'models/interface.ilPluginModelInterface.php'
;
require_once
'models/interface.ilPluginModelInterface.php'
;
require_once
'Modules/TestQuestionPool/interfaces/interface.ilQuestionEditingFormConsumer.php'
;
/**
/**
* Class ilObjQuestionSetPool
* Class ilObjQuestionSetPool
...
@@ -11,53 +9,53 @@ require_once 'Modules/TestQuestionPool/interfaces/interface.ilQuestionEditingFor
...
@@ -11,53 +9,53 @@ require_once 'Modules/TestQuestionPool/interfaces/interface.ilQuestionEditingFor
* Date: 23.09.13
* Date: 23.09.13
* Time: 13:12
* Time: 13:12
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
ilObjQuestionSetPool
extends
ilObjectPlugin
implements
ilPluginModelInterface
,
ilQuestionEditingFormConsumer
class
ilObjQuestionSetPool
extends
ilObjectPlugin
implements
ilPluginModelInterface
,
ilQuestionEditingFormConsumer
{
{
/**
/**
* @var ilQuestionSetPoolPlugin
* @var ilQuestionSetPoolPlugin
*/
*/
public
$plugin
;
public
$plugin
;
/**
/**
* Boolean to check weather the object is online
* Boolean to check weather the object is online
*
*
* @var boolean
* @var boolean
*/
*/
protected
$online
;
protected
$online
;
/**
/**
* @var ilQuestionSetPoolSetList
* @var ilQuestionSetPoolSetList
*/
*/
protected
$set_list
;
protected
$set_list
;
/**
/**
* @var array
* @var array
*/
*/
protected
static
$online_status_map
=
array
();
protected
static
$online_status_map
=
array
();
/**
/**
* @var bool
* @var bool
*/
*/
private
$skillServiceEnabled
=
false
;
private
$skillServiceEnabled
=
false
;
/**
/**
* @var null|bool
* @var null|bool
*/
*/
private
static
$isSkillManagementGloballyActivated
=
null
;
private
static
$isSkillManagementGloballyActivated
=
null
;
/**
/**
* @param int $a_ref_id
* @param int $a_ref_id
*/
*/
public
function
__construct
(
$a_ref_id
=
0
)
public
function
__construct
(
$a_ref_id
=
0
)
{
{
global
$DIC
;
global
$DIC
;
require_once
'models/class.ilQuestionSetPoolSetList.php'
;
require_once
'models/class.ilQuestionSetPoolSetList.php'
;
parent
::
__construct
(
$a_ref_id
);
parent
::
__construct
(
$a_ref_id
);
$DIC
->
language
()
->
loadLanguageModule
(
'assessment'
);
$DIC
->
language
()
->
loadLanguageModule
(
'assessment'
);
}
}
public
function
checkQuestionParent
(
$questionId
)
public
function
checkQuestionParent
(
$questionId
)
{
{
...
@@ -72,484 +70,455 @@ class ilObjQuestionSetPool extends ilObjectPlugin implements ilPluginModelInterf
...
@@ -72,484 +70,455 @@ class ilObjQuestionSetPool extends ilObjectPlugin implements ilPluginModelInterf
return
(
bool
)
$row
[
'cnt'
];
return
(
bool
)
$row
[
'cnt'
];
}
}
/**
/**
* @return string
* @return string
*/
*/
public
function
getQuestionEditingFormBackTargetLabel
()
public
function
getQuestionEditingFormBackTargetLabel
()
{
{
return
ilQuestionSetPoolPlugin
::
getInstance
()
->
txt
(
'back_to_qsp'
);
return
ilQuestionSetPoolPlugin
::
getInstance
()
->
txt
(
'back_to_qsp'
);
}
}
/**
/**
* @param $context
* @param $context
* @return string
* @return string
*/
*/
public
function
getQuestionEditingFormBackTarget
(
$context
)
public
function
getQuestionEditingFormBackTarget
(
$context
)
{
{
global
$DIC
;
global
$DIC
;
$ilCtrl
=
$DIC
->
ctrl
();
$ilCtrl
=
$DIC
->
ctrl
();
$params
=
@
json_decode
(
base64_decode
(
$context
),
true
);
$params
=
@
json_decode
(
base64_decode
(
$context
),
true
);
$ilCtrl
->
setParameterByClass
(
'ilObjPluginDispatchGUI'
,
'ref_id'
,
$this
->
getRefId
());
$ilCtrl
->
setParameterByClass
(
'ilObjPluginDispatchGUI'
,
'ref_id'
,
$this
->
getRefId
());
$url
=
$ilCtrl
->
getLinkTargetByClass
(
array
(
'ilObjPluginDispatchGUI'
,
'ilObjQuestionSetPoolGUI'
),
''
,
''
,
false
,
false
);
$url
=
$ilCtrl
->
getLinkTargetByClass
(
array
(
'ilObjPluginDispatchGUI'
,
'ilObjQuestionSetPoolGUI'
),
''
,
''
,
false
,
false
);
foreach
((
array
)
$params
as
$key
=>
$value
)
foreach
((
array
)
$params
as
$key
=>
$value
)
{
{
$url
=
ilUtil
::
appendUrlParameterString
(
$url
,
$key
.
'='
.
$value
);
$url
=
ilUtil
::
appendUrlParameterString
(
$url
,
$key
.
'='
.
$value
);
}
}
return
$url
;
return
$url
;
}
}
/**
/**
*
*
*/
*/
protected
function
initType
()
protected
function
initType
()
{
{
require_once
'class.ilQuestionSetPoolPlugin.php'
;
require_once
'class.ilQuestionSetPoolPlugin.php'
;
$this
->
setType
(
ilQuestionSetPoolPlugin
::
getPluginId
());
$this
->
setType
(
ilQuestionSetPoolPlugin
::
getPluginId
());
}
}
protected
function
doRead
()
protected
function
doRead
()
{
{
global
$DIC
;
global
$DIC
;
$ilDB
=
$DIC
->
database
();
$ilDB
=
$DIC
->
database
();
$this
->
set_list
=
new
ilQuestionSetPoolSetList
(
$this
);
$this
->
set_list
=
new
ilQuestionSetPoolSetList
(
$this
);
$result
=
$ilDB
->
queryF
(
$result
=
$ilDB
->
queryF
(
"SELECT * FROM rep_robj_xqsp_data WHERE id = %s"
,
"SELECT * FROM rep_robj_xqsp_data WHERE id = %s"
,
array
(
"integer"
),
array
(
"integer"
),
array
(
$this
->
id
)
array
(
$this
->
id
)
);
);
$data
=
$ilDB
->
fetchAssoc
(
$result
);
$data
=
$ilDB
->
fetchAssoc
(
$result
);
$this
->
setOnline
(
$data
[
"is_online"
]);
$this
->
setOnline
(
$data
[
"is_online"
]);
$this
->
setSkillServiceEnabled
(
$data
[
'skill_service'
]);
$this
->
setSkillServiceEnabled
(
$data
[
'skill_service'
]);
}
}
/**
/**
*
*
*/
*/
public
function
doCreate
()
public
function
doCreate
()
{
{
global
$DIC
;
global
$DIC
;
$ilDB
=
$DIC
->
database
();
$ilDB
=
$DIC
->
database
();
$this
->
set_list
=
new
ilQuestionSetPoolSetList
(
$this
);
$this
->
set_list
=
new
ilQuestionSetPoolSetList
(
$this
);
$ilDB
->
insert
(
$ilDB
->
insert
(
$this
->
plugin
->
getAdditionalDataTable
(),
$this
->
plugin
->
getAdditionalDataTable
(),
array
(
array
(
"id"
=>
array
(
"integer"
,
$this
->
id
),
"id"
=>
array
(
"integer"
,
$this
->
id
),
"is_online"
=>
array
(
"integer"
,
$this
->
isOnline
())
"is_online"
=>
array
(
"integer"
,
$this
->
isOnline
())
)
)
);
);
$this
->
createMetaData
();
$this
->
createMetaData
();
}
}
/**
/**
*
*
*/
*/
public
function
doUpdate
()
public
function
doUpdate
()
{
{
global
$DIC
;
global
$DIC
;
$ilDB
=
$DIC
->
database
();
$ilDB
=
$DIC
->
database
();
$ilDB
->
update
(
$ilDB
->
update
(
$this
->
plugin
->
getAdditionalDataTable
(),
$this
->
plugin
->
getAdditionalDataTable
(),
array
(
array
(
"is_online"
=>
array
(
"integer"
,
$this
->
isOnline
()),
"is_online"
=>
array
(
"integer"
,
$this
->
isOnline
()),
'skill_service'
=>
array
(
'integer'
,
$this
->
isSkillServiceEnabled
())
'skill_service'
=>
array
(
'integer'
,
$this
->
isSkillServiceEnabled
())
),
),
array
(
array
(
"id"
=>
array
(
"integer"
,
$this
->
id
)
"id"
=>
array
(
"integer"
,
$this
->
id
)
)
)
);
);
$this
->
updateMetaData
();
$this
->
updateMetaData
();
}
}
/**
/**
* Cascade delete children
* Cascade delete children
*/
*/
protected
function
beforeDelete
()
protected
function
beforeDelete
()
{
{
$sets
=
$this
->
set_list
->
getData
();
$sets
=
$this
->
set_list
->
getData
();
foreach
(
$sets
as
$set
)
{
foreach
(
$sets
as
$set
)
/**
{
* @var $set ilQuestionSetPoolSet
/**
*/
* @var $set ilQuestionSetPoolSet
$set
->
remove
();
*/
}
$set
->
remove
();
}
return
true
;
}
return
true
;
}
protected
function
doDelete
()
{
protected
function
doDelete
()
global
$DIC
;
{
$ilDB
=
$DIC
->
database
();
global
$DIC
;
$ilDB
=
$DIC
->
database
();
$query
=
'DELETE FROM '
.
$this
->
plugin
->
getAdditionalDataTable
()
.
' WHERE id = '
.
$ilDB
->
quote
(
$this
->
getId
(),
'integer'
);
$ilDB
->
manipulate
(
$query
);
$query
=
'DELETE FROM '
.
$this
->
plugin
->
getAdditionalDataTable
()
.
' WHERE id = '
.
$ilDB
->
quote
(
$this
->
getId
(),
'integer'
);
$ilDB
->
manipulate
(
$query
);
$this
->
deleteMetaData
();
}
$this
->
deleteMetaData
();
}
/**
* @param ilObjQuestionSetPool $new_obj
/**
* @param int $a_target_id
* @param ilObjQuestionSetPool $new_obj
* @param int $a_copy_id
* @param int $a_target_id
*/
* @param int $a_copy_id
public
function
doCloneObject
(
$new_obj
,
$a_target_id
,
$a_copy_id
=
null
)
*/
{
public
function
doCloneObject
(
$new_obj
,
$a_target_id
,
$a_copy_id
=
NULL
)
$this
->
cloneMetaData
(
$new_obj
);
{
$this
->
cloneQuestionSets
(
$new_obj
);
$this
->
cloneMetaData
(
$new_obj
);
}
$this
->
cloneQuestionSets
(
$new_obj
);
}
/**
* @param ilObjQuestionSetPool| ilObjFormATest $new_obj
/**
*/
* @param ilObjQuestionSetPool| ilObjFormATest $new_obj
public
function
cloneQuestionSets
(
$new_obj
)
*/
{
public
function
cloneQuestionSets
(
$new_obj
)
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
{
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
$setlist
=
$this
->
getSetList
();
$sets
=
$setlist
->
loadData
();
$setlist
=
$this
->
getSetList
();
foreach
((
array
)
$sets
as
$set_index
=>
$set_data
)
{
$sets
=
$setlist
->
loadData
();
$set
=
new
ilQuestionSetPoolSet
((
int
)
$set_data
[
'id'
]);
foreach
((
array
)
$sets
as
$set_index
=>
$set_data
)
$set
->
read
();
{
$set
=
new
ilQuestionSetPoolSet
((
int
)
$set_data
[
'id'
]);
$new_set
=
new
ilQuestionSetPoolSet
();
$set
->
read
();
$new_set
->
setContainerObjId
(
$new_obj
->
getId
());
$new_set
->
setTitle
((
string
)
$set
->
getTitle
());
$new_set
=
new
ilQuestionSetPoolSet
();
$new_set
->
setDescription
((
string
)
$set
->
getDescription
());
$new_set
->
setContainerObjId
(
$new_obj
->
getId
());
$new_set
->
update
();
$new_set
->
setTitle
((
string
)
$set
->
getTitle
());
$new_set
->
setDescription
((
string
)
$set
->
getDescription
());
// Export QuestionList
$new_set
->
update
();
$question_mapping
=
$this
->
cloneQuestionList
(
$set
,
$new_set
);
// Export QuestionList
// Export Paths
$question_mapping
=
$this
->
cloneQuestionList
(
$set
,
$new_set
);
$this
->
clonePathList
(
$set
->
getPathList
(),
$new_set
,
$question_mapping
);
}
// Export Paths
}
$this
->
clonePathList
(
$set
->
getPathList
(),
$new_set
,
$question_mapping
);
}
/**
}
* @param ilQuestionSetPoolSet $source_set
* @param ilQuestionSetPoolSet $new_set
/**
* @return array
* @param ilQuestionSetPoolSet $source_set
*/
* @param ilQuestionSetPoolSet $new_set
protected
function
cloneQuestionList
(
ilQuestionSetPoolSet
$source_set
,
ilQuestionSetPoolSet
$new_set
)
* @return array
{
*/
$questionList
=
$source_set
->
getQuestionList
();
protected
function
cloneQuestionList
(
ilQuestionSetPoolSet
$source_set
,
ilQuestionSetPoolSet
$new_set
)
$questions
=
$questionList
->
loadData
();
{
$questionList
=
$source_set
->
getQuestionList
();
$mapping
=
array
();
$questions
=
$questionList
->
loadData
();
foreach
((
array
)
$questions
as
$question_index
=>
$question
)
{
$mapping
=
array
();
$mapping
=
$questionList
->
cloneQuestionList
(
array
(
$question
[
'question_id'
]),
$source_set
,
$new_set
)
+
$mapping
;
}
foreach
((
array
)
$questions
as
$question_index
=>
$question
)
{
return
$mapping
;
$mapping
=
$questionList
->
cloneQuestionList
(
array
(
$question
[
'question_id'
]),
$source_set
,
$new_set
)
+
$mapping
;
}
}
/**
return
$mapping
;
* @param ilQuestionSetPoolPathList $pathList
}
* @param ilQuestionSetPoolSet $new_set
* @param array $question_mapping A map of integer values, old_question_fi -> new_question_fi
/**
*/
* @param ilQuestionSetPoolPathList $pathList
protected
function
clonePathList
(
ilQuestionSetPoolPathList
$pathList
,
ilQuestionSetPoolSet
$new_set
,
array
$question_mapping
)
* @param ilQuestionSetPoolSet $new_set
{
* @param array $question_mapping A map of integer values, old_question_fi -> new_question_fi
$paths
=
$pathList
->
loadData
();
*/
foreach
((
array
)
$paths
as
$path_index
=>
$path_data
)
{
protected
function
clonePathList
(
ilQuestionSetPoolPathList
$pathList
,
ilQuestionSetPoolSet
$new_set
,
array
$question_mapping
)
$path
=
new
ilQuestionSetPoolPath
();
{
$path
->
setId
(
$path_data
[
'id'
]);
$paths
=
$pathList
->
loadData
();
$path
->
read
();
foreach
((
array
)
$paths
as
$path_index
=>
$path_data
)
{
$new_path
=
new
ilQuestionSetPoolPath
();
$path
=
new
ilQuestionSetPoolPath
();
$new_path
->
setSet
(
$new_set
);
$path
->
setId
(
$path_data
[
'id'
]);
$new_path
->
setTitle
(
$path
->
getTitle
());
$path
->
read
();
$new_path
->
setIndex
(
$path
->
getIndex
());
$new_path
->
import
();
$new_path
=
new
ilQuestionSetPoolPath
();
$new_path
->
setSet
(
$new_set
);
// Nodes
$new_path
->
setTitle
(
$path
->
getTitle
());
$this
->
cloneNodeList
(
$path
->
getNodes
(),
$new_path
,
$question_mapping
);
$new_path
->
setIndex
(
$path
->
getIndex
());
}
$new_path
->
import
();
}
// Nodes
/**
$this
->
cloneNodeList
(
$path
->
getNodes
(),
$new_path
,
$question_mapping
);
* @param ilQuestionSetPoolNodeList $nodeList
}
* @param ilQuestionSetPoolPath $new_path
}
* @param array $question_mapping A map of integer values, old_question_fi -> new_question_fi
* $question_mapping A map of integer values, old_question_fi -> new_question_fi
/**
*/
* @param ilQuestionSetPoolNodeList $nodeList
protected
function
cloneNodeList
(
ilQuestionSetPoolNodeList
$nodeList
,
ilQuestionSetPoolPath
$new_path
,
array
$question_mapping
)
* @param ilQuestionSetPoolPath $new_path
{
* @param array $question_mapping A map of integer values, old_question_fi -> new_question_fi
$nodes
=
$nodeList
->
loadData
();
* $question_mapping A map of integer values, old_question_fi -> new_question_fi
foreach
((
array
)
$nodes
as
$node_index
=>
$node_data
)
{
*/
$node
=
new
ilQuestionSetPoolNode
((
int
)
$node_data
[
'id'
]);
protected
function
cloneNodeList
(
ilQuestionSetPoolNodeList
$nodeList
,
ilQuestionSetPoolPath
$new_path
,
array
$question_mapping
)
$node
->
read
();
{
$nodes
=
$nodeList
->
loadData
();
$new_node
=
new
ilQuestionSetPoolNode
();
foreach
((
array
)
$nodes
as
$node_index
=>
$node_data
)
if
(
isset
(
$question_mapping
[
$node
->
getQuestion
()
->
getId
()]))
{
{
$new_node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$question_mapping
[
$node
->
getQuestion
()
->
getId
()]));
$node
=
new
ilQuestionSetPoolNode
((
int
)
$node_data
[
'id'
]);
}
else
{
$node
->
read
();
$new_node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$node
->
getQuestion
()
->
getId
()));
}
$new_node
=
new
ilQuestionSetPoolNode
();
$new_node
->
setPath
(
$new_path
);
if
(
isset
(
$question_mapping
[
$node
->
getQuestion
()
->
getId
()]))
$new_node
->
setInitialCondition
(
$node
->
getInitialCondition
());
{
$new_node
->
setDominantScoring
(
$node
->
getDominantScoring
());
$new_node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$question_mapping
[
$node
->
getQuestion
()
->
getId
()]));
$new_node
->
setTrueFeedback
(
$node
->
getTrueFeedback
());
}
$new_node
->
setFalseFeedback
(
$node
->
getFalseFeedback
());
else
$new_node
->
import
();
{
$new_node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$node
->
getQuestion
()
->
getId
()));
// Jump Conditions
}
$this
->
cloneJumpConditions
(
$node
->
getJumpConditionList
(),
$new_node
);
$new_node
->
setPath
(
$new_path
);
}
$new_node
->
setInitialCondition
(
$node
->
getInitialCondition
());
}
$new_node
->
setDominantScoring
(
$node
->
getDominantScoring
());
$new_node
->
setTrueFeedback
(
$node
->
getTrueFeedback
());
/**
$new_node
->
setFalseFeedback
(
$node
->
getFalseFeedback
());
* @param ilQuestionSetPoolJumpConditionList $jumpConditionList
$new_node
->
import
();
* @param ilQuestionSetPoolNode $new_node
*/
// Jump Conditions
protected
function
cloneJumpConditions
(
ilQuestionSetPoolJumpConditionList
$jumpConditionList
,
ilQuestionSetPoolNode
$new_node
)
$this
->
cloneJumpConditions
(
$node
->
getJumpConditionList
(),
$new_node
);
{
}
$jumpConditions
=
$jumpConditionList
->
getData
();
}
foreach
((
array
)
$jumpConditions
as
$jmp_con_index
=>
$jumpCondition_data
)
{
$jumpCondition
=
new
ilQuestionSetPoolJumpCondition
();
/**
$jumpCondition
->
setId
(
$jumpCondition_data
[
'id'
]);
* @param ilQuestionSetPoolJumpConditionList $jumpConditionList
$jumpCondition
->
read
();
* @param ilQuestionSetPoolNode $new_node
*/
$new_jump_con
=
new
ilQuestionSetPoolJumpCondition
();
protected
function
cloneJumpConditions
(
ilQuestionSetPoolJumpConditionList
$jumpConditionList
,
ilQuestionSetPoolNode
$new_node
)
$new_jump_con
->
setNode
(
$new_node
);
{
$new_jump_con
->
setQuestion
(
$new_node
->
getQuestion
());
$jumpConditions
=
$jumpConditionList
->
getData
();
$new_jump_con
->
setJumpCondition
(
$jumpCondition
->
getJumpCondition
());
foreach
((
array
)
$jumpConditions
as
$jmp_con_index
=>
$jumpCondition_data
)
$new_jump_con
->
setRepititions
(
$jumpCondition
->
getRepititions
());
{
$new_jump_con
->
setTrueFeedback
(
$jumpCondition
->
getTrueFeedback
());
$jumpCondition
=
new
ilQuestionSetPoolJumpCondition
();
$new_jump_con
->
setTrueJumpFeedback
(
$jumpCondition
->
getTrueJumpFeedback
());
$jumpCondition
->
setId
(
$jumpCondition_data
[
'id'
]);
$new_jump_con
->
setFalseFeedback
(
$jumpCondition
->
getFalseFeedback
());
$jumpCondition
->
read
();
$new_jump_con
->
import
();
$new_jump_con
=
new
ilQuestionSetPoolJumpCondition
();
}
$new_jump_con
->
setNode
(
$new_node
);
}
$new_jump_con
->
setQuestion
(
$new_node
->
getQuestion
());
$new_jump_con
->
setJumpCondition
(
$jumpCondition
->
getJumpCondition
());
/**
$new_jump_con
->
setRepititions
(
$jumpCondition
->
getRepititions
());
* @param boolean $online
$new_jump_con
->
setTrueFeedback
(
$jumpCondition
->
getTrueFeedback
());
*/
$new_jump_con
->
setTrueJumpFeedback
(
$jumpCondition
->
getTrueJumpFeedback
());
public
function
setOnline
(
$online
)
$new_jump_con
->
setFalseFeedback
(
$jumpCondition
->
getFalseFeedback
());
{
$this
->
online
=
$online
;
$new_jump_con
->
import
();
}
}
}
/**
* @return boolean
/**
*/
* @param boolean $online
public
function
isOnline
()
*/
{
public
function
setOnline
(
$online
)
return
$this
->
online
;
{
}
$this
->
online
=
$online
;
}
/**
* @return ilQuestionSetPoolSetList
/**
*/
* @return boolean
public
function
getSetList
()
*/
{
public
function
isOnline
()
return
$this
->
set_list
;
{
}
return
$this
->
online
;
}
/**
* @return array
/**
*/
* @return ilQuestionSetPoolSetList
public
function
toArray
()
*/
{
public
function
getSetList
()
return
array
(
{
'title'
=>
$this
->
getTitle
(),
return
$this
->
set_list
;
'description'
=>
$this
->
getDescription
(),
}
'online'
=>
$this
->
isOnline
(),
'skill_service'
=>
$this
->
isSkillServiceEnabled
()
/**
);
* @return array
}
*/
public
function
toArray
()
/**
{
* @param ilPropertyFormGUI $form
return
array
(
*/
'title'
=>
$this
->
getTitle
(),
public
function
bindForm
(
ilPropertyFormGUI
$form
)
'description'
=>
$this
->
getDescription
(),
{
'online'
=>
$this
->
isOnline
(),
$this
->
setTitle
(
$form
->
getInput
(
'title'
));
'skill_service'
=>
$this
->
isSkillServiceEnabled
()
$this
->
setDescription
(
$form
->
getInput
(
'description'
));
);
$this
->
setOnline
(
$form
->
getInput
(
'online'
));
}
$this
->
setSkillServiceEnabled
((
bool
)
$form
->
getInput
(
'skill_service'
));
}
/**
* @param ilPropertyFormGUI $form
/**
*/
* @param int $obj_id
public
function
bindForm
(
ilPropertyFormGUI
$form
)
* @return bool
{
*/
$this
->
setTitle
(
$form
->
getInput
(
'title'
));
public
static
function
getOnlineStatusByObjId
(
$obj_id
)
$this
->
setDescription
(
$form
->
getInput
(
'description'
));
{
$this
->
setOnline
(
$form
->
getInput
(
'online'
));
if
(
isset
(
self
::
$online_status_map
[
$obj_id
]))
{
$this
->
setSkillServiceEnabled
((
bool
)
$form
->
getInput
(
'skill_service'
));
return
(
bool
)
self
::
$online_status_map
[
$obj_id
];
}
}
/**
self
::
preloadDataForLists
(
array
(
$obj_id
));
* @param int $obj_id
}
* @return bool
*/
/**
public
static
function
getOnlineStatusByObjId
(
$obj_id
)
* @param array $obj_ids
{
* @param array $ref_ids
if
(
isset
(
self
::
$online_status_map
[
$obj_id
]))
*/
{
public
static
function
preloadDataForLists
(
array
$obj_ids
,
array
$ref_ids
=
array
())
return
(
bool
)
self
::
$online_status_map
[
$obj_id
];
{
}
global
$DIC
;
$ilDB
=
$DIC
->
database
();
self
::
preloadDataForLists
(
array
(
$obj_id
));
}
if
(
is_array
(
$obj_ids
)
&&
count
(
$obj_ids
)
==
1
)
{
$in
=
' id = '
.
$ilDB
->
quote
(
current
(
$obj_ids
),
'integer'
)
.
' '
;
/**
}
else
{
* @param array $obj_ids
$in
=
$ilDB
->
in
(
'id'
,
$obj_ids
,
false
,
'integer'
);
* @param array $ref_ids
}
*/
public
static
function
preloadDataForLists
(
array
$obj_ids
,
array
$ref_ids
=
array
())
$query
=
"
{
global
$DIC
;
$ilDB
=
$DIC
->
database
();
if
(
is_array
(
$obj_ids
)
&&
count
(
$obj_ids
)
==
1
)
{
$in
=
' id = '
.
$ilDB
->
quote
(
current
(
$obj_ids
),
'integer'
)
.
' '
;
}
else
{
$in
=
$ilDB
->
in
(
'id'
,
$obj_ids
,
false
,
'integer'
);
}
$query
=
"
SELECT id, is_online
SELECT id, is_online
FROM rep_robj_xqsp_data
FROM rep_robj_xqsp_data
WHERE
$in
WHERE
$in
"
;
"
;
$res
=
$ilDB
->
query
(
$query
);
$res
=
$ilDB
->
query
(
$query
);
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res
))
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res
))
{
{
self
::
$online_status_map
[
$row
[
'id'
]]
=
$row
[
'is_online'
];
self
::
$online_status_map
[
$row
[
'id'
]]
=
$row
[
'is_online'
];
}
}
}
}
public
static
function
getAvailableQuestionSetPools
(
$could_be_offline
=
false
)
public
static
function
getAvailableQuestionSetPools
(
$could_be_offline
=
FALSE
)
{
{
global
$DIC
;
global
$DIC
;
$ilDB
=
$DIC
->
database
();
$ilDB
=
$DIC
->
database
();
$ilUser
=
$DIC
->
user
();
$ilUser
=
$DIC
->
user
();
$result_array
=
array
();
$result_array
=
array
();
$pools
=
ilUtil
::
_getObjectsByOperations
(
"xqsp"
,
"read"
,
$ilUser
->
getId
(),
-
1
);
$pools
=
ilUtil
::
_getObjectsByOperations
(
"xqsp"
,
"read"
,
$ilUser
->
getId
(),
-
1
);
$obj_ids
=
array
();
$obj_ids
=
array
();
$ref_ids
=
array
();
$ref_ids
=
array
();
foreach
(
$pools
as
$ref_id
)
{
foreach
(
$pools
as
$ref_id
)
$obj_ids
[
$ref_id
]
=
ilObject
::
_lookupObjId
(
$ref_id
);
{
$ref_ids
[
ilObject
::
_lookupObjId
(
$ref_id
)]
=
$ref_id
;
$obj_ids
[
$ref_id
]
=
ilObject
::
_lookupObjId
(
$ref_id
);
}
$ref_ids
[
ilObject
::
_lookupObjId
(
$ref_id
)]
=
$ref_id
;
}
if
(
$could_be_offline
)
{
$result
=
$ilDB
->
query
(
"SELECT id FROM rep_robj_xqsp_data WHERE "
.
$ilDB
->
in
(
"id"
,
$obj_ids
,
false
,
"integer"
));
if
(
$could_be_offline
)
}
else
{
{
$result
=
$ilDB
->
queryF
(
$result
=
$ilDB
->
query
(
"SELECT id FROM rep_robj_xqsp_data WHERE "
.
$ilDB
->
in
(
"id"
,
$obj_ids
,
false
,
"integer"
));
"SELECT id FROM rep_robj_xqsp_data WHERE is_online = %s AND "
.
$ilDB
->
in
(
"id"
,
$obj_ids
,
false
,
"integer"
),
}
array
(
"integer"
),
else
array
(
1
)
{
);
$result
=
$ilDB
->
queryF
(
}
"SELECT id FROM rep_robj_xqsp_data WHERE is_online = %s AND "
.
$ilDB
->
in
(
"id"
,
$obj_ids
,
false
,
"integer"
),
array
(
"integer"
),
while
((
$row
=
$ilDB
->
fetchAssoc
(
$result
))
!=
null
)
{
array
(
1
)
$pool
=
new
ilObjQuestionSetPool
();
);
$pool
->
setRefId
(
$ref_ids
[
$row
[
"id"
]]);
}
$pool
->
read
();
$result_array
[
$row
[
"id"
]]
=
$pool
;
while
((
$row
=
$ilDB
->
fetchAssoc
(
$result
))
!=
null
)
}
{
$pool
=
new
ilObjQuestionSetPool
();
return
$result_array
;
$pool
->
setRefId
(
$ref_ids
[
$row
[
"id"
]]);
}
$pool
->
read
();
$result_array
[
$row
[
"id"
]]
=
$pool
;
public
static
function
canSynchronizeSet
(
$set_id
)
}
{
global
$DIC
;
return
$result_array
;
$rbacsystem
=
$DIC
->
rbac
()
->
system
();
}
if
(
$set_id
==
null
)
{
public
static
function
canSynchronizeSet
(
$set_id
)
return
false
;
{
}
global
$DIC
;
$rbacsystem
=
$DIC
->
rbac
()
->
system
();
$set
=
new
ilQuestionSetPoolSet
(
$set_id
);
$set
->
read
();
if
(
$set_id
==
null
)
if
(
$set
->
getContainerObjId
()
!=
null
)
{
{
$available
=
array_keys
(
self
::
getAvailableQuestionSetPools
());
return
false
;
}
if
(
in_array
(
$set
->
getContainerObjId
(),
$available
))
{
$refs
=
ilObject
::
_getAllReferences
(
$set
->
getContainerObjId
());
$set
=
new
ilQuestionSetPoolSet
(
$set_id
);
foreach
(
$refs
as
$ref
)
{
$set
->
read
();
if
(
$rbacsystem
->
checkAccess
(
"write"
,
$ref
)
&&
ilObject
::
_hasUntrashedReference
(
$set
->
getContainerObjId
()))
{
if
(
$set
->
getContainerObjId
()
!=
null
)
return
true
;
{
}
$available
=
array_keys
(
self
::
getAvailableQuestionSetPools
());
}
}
if
(
in_array
(
$set
->
getContainerObjId
(),
$available
))
}
{
$refs
=
ilObject
::
_getAllReferences
(
$set
->
getContainerObjId
());
return
false
;
foreach
(
$refs
as
$ref
)
}
{
if
(
$rbacsystem
->
checkAccess
(
"write"
,
$ref
)
&&
ilObject
::
_hasUntrashedReference
(
$set
->
getContainerObjId
()))
/**
{
* @param boolean $skillServiceEnabled
return
true
;
*/
}
public
function
setSkillServiceEnabled
(
$skillServiceEnabled
)
}
{
}
$this
->
skillServiceEnabled
=
$skillServiceEnabled
;
}
}
return
false
;
/**
}
* @return bool
*/
/**
public
function
isSkillServiceEnabled
()
* @param boolean $skillServiceEnabled
{
*/
if
(
!
self
::
isSkillManagementGloballyActivated
())
{
public
function
setSkillServiceEnabled
(
$skillServiceEnabled
)
return
false
;
{
}
$this
->
skillServiceEnabled
=
$skillServiceEnabled
;
}
return
$this
->
skillServiceEnabled
;
}
/**
* @return bool
/**
*/
* @return bool
public
function
isSkillServiceEnabled
()
*/
{
public
static
function
isSkillManagementGloballyActivated
()
if
(
!
self
::
isSkillManagementGloballyActivated
())
{
{
if
(
self
::
$isSkillManagementGloballyActivated
===
null
)
{
return
false
;
$skmgSet
=
new
ilSkillManagementSettings
();
}
self
::
$isSkillManagementGloballyActivated
=
$skmgSet
->
isActivated
();
return
$this
->
skillServiceEnabled
;
}
}
return
self
::
$isSkillManagementGloballyActivated
;
/**
}
* @return bool
*/
public
static
function
isSkillManagementGloballyActivated
()
{
if
(
self
::
$isSkillManagementGloballyActivated
===
null
)
{
include_once
'./Services/Skill/classes/class.ilSkillManagementSettings.php'
;
$skmgSet
=
new
ilSkillManagementSettings
();
self
::
$isSkillManagementGloballyActivated
=
$skmgSet
->
isActivated
();
}
return
self
::
$isSkillManagementGloballyActivated
;
}
}
}
classes/class.ilObjQuestionSetPoolAccess.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Repository/classes/class.ilObjectPluginAccess.php'
;
require_once
'class.ilObjQuestionSetPool.php'
;
require_once
'class.ilObjQuestionSetPool.php'
;
/**
/**
...
@@ -10,60 +9,57 @@ require_once 'class.ilObjQuestionSetPool.php';
...
@@ -10,60 +9,57 @@ require_once 'class.ilObjQuestionSetPool.php';
* Date: 23.09.13
* Date: 23.09.13
* Time: 13:46
* Time: 13:46
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
ilObjQuestionSetPoolAccess
extends
ilObjectPluginAccess
class
ilObjQuestionSetPoolAccess
extends
ilObjectPluginAccess
{
{
/**
/**
* @param string $a_cmd
* @param string $a_cmd
* @param string $a_permission
* @param string $a_permission
* @param int $a_ref_id
* @param int $a_ref_id
* @param int $a_obj_id
* @param int $a_obj_id
* @param string $a_user_id
* @param string $a_user_id
* @return bool
* @return bool
*/
*/
public
function
_checkAccess
(
$a_cmd
,
$a_permission
,
$a_ref_id
,
$a_obj_id
,
$a_user_id
=
''
)
public
function
_checkAccess
(
$a_cmd
,
$a_permission
,
$a_ref_id
,
$a_obj_id
,
$a_user_id
=
''
)
{
{
/**
/**
* @var $ilUser ilObjUser
* @var $ilUser ilObjUser
* @var $ilAccess ilAccessHandler
* @var $ilAccess ilAccessHandler
*/
*/
global
$ilUser
,
$ilAccess
;
global
$ilUser
,
$ilAccess
;
if
(
!
$a_user_id
)
if
(
!
$a_user_id
)
{
{
$a_user_id
=
$ilUser
->
getId
();
$a_user_id
=
$ilUser
->
getId
();
}
}
switch
(
$a_permission
)
switch
(
$a_permission
)
{
{
case
'read'
:
case
'read'
:
if
(
if
(
!
ilObjQuestionSetPoolAccess
::
checkOnline
(
$a_obj_id
)
&&
!
ilObjQuestionSetPoolAccess
::
checkOnline
(
$a_obj_id
)
&&
!
$ilAccess
->
checkAccessOfUser
(
$a_user_id
,
'write'
,
''
,
$a_ref_id
)
!
$ilAccess
->
checkAccessOfUser
(
$a_user_id
,
'write'
,
''
,
$a_ref_id
)
)
{
)
return
false
;
{
}
return
false
;
return
true
;
}
}
return
true
;
}
return
true
;
return
true
;
}
}
/**
/**
* @param int $a_obj_id
* @param int $a_obj_id
*/
*/
public
static
function
checkOnline
(
$a_obj_id
)
public
static
function
checkOnline
(
$a_obj_id
)
{
{
return
ilObjQuestionSetPool
::
getOnlineStatusByObjId
(
$a_obj_id
);
return
ilObjQuestionSetPool
::
getOnlineStatusByObjId
(
$a_obj_id
);
}
}
/**
/**
* @param array $a_obj_ids
* @param array $a_obj_ids
* @param array $a_ref_ids
* @param array $a_ref_ids
*/
*/
static
function
_preloadData
(
$a_obj_ids
,
$a_ref_ids
)
public
static
function
_preloadData
(
$a_obj_ids
,
$a_ref_ids
)
{
{
ilObjQuestionSetPool
::
preloadDataForLists
(
$a_obj_ids
,
$a_ref_ids
);
ilObjQuestionSetPool
::
preloadDataForLists
(
$a_obj_ids
,
$a_ref_ids
);
}
}
}
}
classes/class.ilObjQuestionSetPoolGUI.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Repository/classes/class.ilObjectPluginGUI.php'
;
require_once
'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandling.php'
;
/**
/**
* Class ilObjQuestionSetPoolGUI
* Class ilObjQuestionSetPoolGUI
* Date: 23.09.13
* Date: 23.09.13
...
@@ -17,360 +14,295 @@ require_once 'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandlin
...
@@ -17,360 +14,295 @@ require_once 'Services/PersonalDesktop/interfaces/interface.ilDesktopItemHandlin
class
ilObjQuestionSetPoolGUI
extends
ilObjectPluginGUI
implements
ilDesktopItemHandling
class
ilObjQuestionSetPoolGUI
extends
ilObjectPluginGUI
implements
ilDesktopItemHandling
{
{
/**
/**
* @var ilObjQuestionSetPool
* @var ilObjQuestionSetPool
*/
*/
public
$object
;
public
$object
;
public
$plugin
;
public
$plugin
;
/**
/**
* @param string $cmd
* @param string $cmd
* @return mixed
* @return mixed
*/
*/
public
function
performCommand
(
$cmd
)
public
function
performCommand
(
$cmd
)
{
{
/**
/**
* @var $ilTabs ilTabsGUI
* @var $ilTabs ilTabsGUI
* @var $tpl ilTemplate
* @var $tpl ilTemplate
*/
*/
global
$ilTabs
,
$tpl
;
global
$ilTabs
,
$tpl
;
require_once
"./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/classes/dispatcher/class.ilPluginDispatcher.php"
;
$tpl
->
setDescription
(
$this
->
object
->
getDescription
());
$tpl
->
setDescription
(
$this
->
object
->
getDescription
());
$this
->
lng
->
loadLanguageModule
(
'assessment'
);
$tpl
->
addCss
(
'./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/templates/default/xqsp.css'
);
$this
->
lng
->
loadLanguageModule
(
'assessment'
);
$tpl
->
addCss
(
'./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/templates/default/xqsp.css'
);
$next_class
=
$this
->
ctrl
->
getNextClass
(
$this
);
switch
(
$next_class
)
{
$next_class
=
$this
->
ctrl
->
getNextClass
(
$this
);
case
'ilquestionsetpoolskilladministrationgui'
:
switch
(
$next_class
)
require_once
'controllers/class.ilQuestionSetPoolSkillAdministrationGUI.php'
;
{
$this
->
prepareOutput
();
case
'ilquestionsetpoolskilladministrationgui'
:
$this
->
addHeaderAction
();
require_once
'controllers/class.ilQuestionSetPoolSkillAdministrationGUI.php'
;
$this
->
prepareOutput
();
$gui
=
new
ilQuestionSetPoolSkillAdministrationGUI
(
$this
);
$this
->
addHeaderAction
();
$this
->
ctrl
->
forwardCommand
(
$gui
);
break
;
$gui
=
new
ilQuestionSetPoolSkillAdministrationGUI
(
$this
);
$this
->
ctrl
->
forwardCommand
(
$gui
);
case
'ilmdeditorgui'
:
break
;
$this
->
checkPermission
(
'write'
);
$md_gui
=
new
ilMDEditorGUI
(
$this
->
object
->
getId
(),
0
,
$this
->
object
->
getType
());
case
'ilmdeditorgui'
:
$md_gui
->
addObserver
(
$this
->
object
,
'MDUpdateListener'
,
'General'
);
$this
->
checkPermission
(
'write'
);
$ilTabs
->
setTabActive
(
'meta_data'
);
require_once
'Services/MetaData/classes/class.ilMDEditorGUI.php'
;
return
$this
->
ctrl
->
forwardCommand
(
$md_gui
);
$md_gui
=
new
ilMDEditorGUI
(
$this
->
object
->
getId
(),
0
,
$this
->
object
->
getType
());
break
;
$md_gui
->
addObserver
(
$this
->
object
,
'MDUpdateListener'
,
'General'
);
$ilTabs
->
setTabActive
(
'meta_data'
);
case
'ilpublicuserprofilegui'
:
return
$this
->
ctrl
->
forwardCommand
(
$md_gui
);
$profile_gui
=
new
ilPublicUserProfileGUI
(
$_GET
[
'user'
]);
break
;
$profile_gui
->
setBackUrl
(
$this
->
ctrl
->
getLinkTarget
(
$this
,
'showContent'
));
$this
->
tpl
->
setContent
(
$this
->
ctrl
->
forwardCommand
(
$profile_gui
));
case
'ilpublicuserprofilegui'
:
break
;
require_once
'Services/User/classes/class.ilPublicUserProfileGUI.php'
;
$profile_gui
=
new
ilPublicUserProfileGUI
(
$_GET
[
'user'
]);
case
'ilcommonactiondispatchergui'
:
$profile_gui
->
setBackUrl
(
$this
->
ctrl
->
getLinkTarget
(
$this
,
'showContent'
));
$gui
=
ilCommonActionDispatcherGUI
::
getInstanceFromAjaxCall
();
$this
->
tpl
->
setContent
(
$this
->
ctrl
->
forwardCommand
(
$profile_gui
));
$this
->
ctrl
->
forwardCommand
(
$gui
);
break
;
break
;
case
"ilquestionsetpoolexportgui"
:
case
'ilcommonactiondispatchergui'
:
$this
->
checkPermission
(
'write'
);
require_once
'Services/Object/classes/class.ilCommonActionDispatcherGUI.php'
;
$ilTabs
->
setTabActive
(
'export'
);
$gui
=
ilCommonActionDispatcherGUI
::
getInstanceFromAjaxCall
();
$this
->
getPlugin
()
->
includeClass
(
'class.ilQuestionSetPoolExportGUI.php'
);
$this
->
ctrl
->
forwardCommand
(
$gui
);
$exp_gui
=
new
ilQuestionSetPoolExportGUI
(
$this
);
break
;
$exp_gui
->
addFormat
(
'xml'
,
$this
->
lng
->
txt
(
'qpl_export_xml'
));
case
"ilquestionsetpoolexportgui"
:
$this
->
ctrl
->
forwardCommand
(
$exp_gui
);
$this
->
checkPermission
(
'write'
);
break
;
$ilTabs
->
setTabActive
(
'export'
);
default
:
$this
->
getPlugin
()
->
includeClass
(
'class.ilQuestionSetPoolExportGUI.php'
);
switch
(
$cmd
)
{
$exp_gui
=
new
ilQuestionSetPoolExportGUI
(
$this
);
case
'redrawHeaderAction'
:
$exp_gui
->
addFormat
(
'xml'
,
$this
->
lng
->
txt
(
'qpl_export_xml'
));
case
'addToDesk'
:
$this
->
ctrl
->
forwardCommand
(
$exp_gui
);
case
'removeFromDesk'
:
break
;
if
(
in_array
(
$cmd
,
array
(
'addToDesk'
,
'removeFromDesk'
)))
{
default
:
$cmd
.
=
'Object'
;
switch
(
$cmd
)
}
{
$this
->
checkPermission
(
'read'
);
case
'redrawHeaderAction'
:
$this
->
$cmd
();
case
'addToDesk'
:
break
;
case
'removeFromDesk'
:
if
(
in_array
(
$cmd
,
array
(
'addToDesk'
,
'removeFromDesk'
)))
default
:
{
$this
->
ensureEntityExistance
();
$cmd
.
=
'Object'
;
require_once
"./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/classes/dispatcher/class.ilPluginDispatcher.php"
;
}
$dispatcher
=
ilPluginDispatcher
::
getInstance
(
$this
);
$this
->
checkPermission
(
'read'
);
$dispatcher
->
dispatch
(
$cmd
);
$this
->
$cmd
();
break
;
break
;
}
break
;
default
:
}
$this
->
ensureEntityExistance
();
$dispatcher
=
ilPluginDispatcher
::
getInstance
(
$this
);
$this
->
addHeaderAction
();
$dispatcher
->
dispatch
(
$cmd
);
}
break
;
}
protected
function
redirectToDefaultPage
()
break
;
{
}
$this
->
ctrl
->
redirect
(
$this
);
}
$this
->
addHeaderAction
();
}
protected
function
ensureEntityExistance
()
{
protected
function
redirectToDefaultPage
()
if
(
isset
(
$_GET
[
'set_id'
])
&&
(
int
)
$_GET
[
'set_id'
])
{
{
$set_id
=
(
int
)
$_GET
[
'set_id'
];
$this
->
ctrl
->
redirect
(
$this
);
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
}
if
(
!
ilQuestionSetPoolSet
::
exists
(
$set_id
))
{
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_set'
),
true
);
protected
function
ensureEntityExistance
()
$this
->
redirectToDefaultPage
();
{
}
if
(
isset
(
$_GET
[
'set_id'
])
&&
(
int
)
$_GET
[
'set_id'
])
}
{
$set_id
=
(
int
)
$_GET
[
'set_id'
];
if
(
isset
(
$_GET
[
'path_id'
])
&&
(
int
)
$_GET
[
'path_id'
])
{
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$path_id
=
(
int
)
$_GET
[
'path_id'
];
if
(
!
ilQuestionSetPoolSet
::
exists
(
$set_id
))
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
{
if
(
!
ilQuestionSetPoolPath
::
exists
(
$path_id
))
{
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_set'
),
true
);
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_path'
),
true
);
$this
->
redirectToDefaultPage
();
$this
->
redirectToDefaultPage
();
}
}
}
}
if
(
isset
(
$_GET
[
'path_id'
])
&&
(
int
)
$_GET
[
'path_id'
])
if
(
isset
(
$_GET
[
'node_id'
])
&&
(
int
)
$_GET
[
'node_id'
])
{
{
$node_id
=
(
int
)
$_GET
[
'node_id'
];
$path_id
=
(
int
)
$_GET
[
'path_id'
];
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
if
(
!
ilQuestionSetPoolNode
::
exists
(
$node_id
))
{
if
(
!
ilQuestionSetPoolPath
::
exists
(
$path_id
))
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_node'
),
true
);
{
$this
->
redirectToDefaultPage
();
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_path'
),
true
);
}
$this
->
redirectToDefaultPage
();
}
}
}
}
/**
if
(
isset
(
$_GET
[
'node_id'
])
&&
(
int
)
$_GET
[
'node_id'
])
* Public wrapper for permission checks
{
* @param string $permission
$node_id
=
(
int
)
$_GET
[
'node_id'
];
* @return bool
$this
->
getPlugin
()
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
*/
if
(
!
ilQuestionSetPoolNode
::
exists
(
$node_id
))
public
function
hasPermission
(
$permission
)
{
{
ilUtil
::
sendFailure
(
$this
->
txt
(
'poss_sync_err_node'
),
true
);
return
$this
->
checkPermissionBool
(
$permission
);
$this
->
redirectToDefaultPage
();
}
}
}
/**
}
* Public wrapper for permission assumption
* @param string $permission
/**
* @return bool
* Public wrapper for permission checks
*/
* @param string $permission
public
function
ensurePermission
(
$permission
)
* @return bool
{
*/
return
$this
->
checkPermission
(
$permission
);
public
function
hasPermission
(
$permission
)
}
{
return
$this
->
checkPermissionBool
(
$permission
);
/**
}
*
*/
/**
public
function
populateContentStyleBlock
()
* Public wrapper for permission assumption
{
* @param string $permission
$this
->
tpl
->
setCurrentBlock
(
"ContentStyle"
);
* @return bool
$this
->
tpl
->
setVariable
(
"LOCATION_CONTENT_STYLESHEET"
,
ilObjStyleSheet
::
getContentStylePath
(
0
));
*/
$this
->
tpl
->
parseCurrentBlock
();
public
function
ensurePermission
(
$permission
)
{
$this
->
tpl
->
addCss
(
ilUtil
::
getStyleSheetLocation
(
"output"
,
"test_print.css"
,
"Modules/Test"
),
"print"
);
return
$this
->
checkPermission
(
$permission
);
$this
->
tpl
->
addCss
(
ilUtil
::
getStyleSheetLocation
(
"output"
,
"ta.css"
,
"Modules/Test"
),
"screen"
);
}
}
/**
/**
*
*
*/
*/
public
function
populateContentStyleBlock
()
public
function
populateSyntaxStyleBlock
()
{
{
include_once
(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php"
);
$this
->
tpl
->
setCurrentBlock
(
"SyntaxStyle"
);
$this
->
tpl
->
setCurrentBlock
(
"ContentStyle"
);
$this
->
tpl
->
setVariable
(
"LOCATION_SYNTAX_STYLESHEET"
,
ilObjStyleSheet
::
getSyntaxStylePath
());
$this
->
tpl
->
setVariable
(
"LOCATION_CONTENT_STYLESHEET"
,
ilObjStyleSheet
::
getContentStylePath
(
0
));
$this
->
tpl
->
parseCurrentBlock
();
$this
->
tpl
->
parseCurrentBlock
();
}
$this
->
tpl
->
addCss
(
ilUtil
::
getStyleSheetLocation
(
"output"
,
"test_print.css"
,
"Modules/Test"
),
"print"
);
/**
$this
->
tpl
->
addCss
(
ilUtil
::
getStyleSheetLocation
(
"output"
,
"ta.css"
,
"Modules/Test"
),
"screen"
);
* Functions that must be overwritten
}
*/
public
function
getType
()
/**
{
*
require_once
"./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/classes/class.ilQuestionSetPoolPlugin.php"
;
*/
return
ilQuestionSetPoolPlugin
::
getPluginId
();
public
function
populateSyntaxStyleBlock
()
}
{
$this
->
tpl
->
setCurrentBlock
(
"SyntaxStyle"
);
/**
$this
->
tpl
->
setVariable
(
"LOCATION_SYNTAX_STYLESHEET"
,
ilObjStyleSheet
::
getSyntaxStylePath
());
* Cmd that will be redirected to after creation of a new object.
$this
->
tpl
->
parseCurrentBlock
();
*/
}
public
function
getAfterCreationCmd
()
{
/**
return
"ilQuestionSetPoolPropertiesGUI.edit"
;
* Functions that must be overwritten
}
*/
public
function
getType
()
public
function
getStandardCmd
()
{
{
require_once
"./Customizing/global/plugins/Services/Repository/RepositoryObject/QuestionSetPool/classes/class.ilQuestionSetPoolPlugin.php"
;
return
"ilQuestionSetPoolSetsGUI.show"
;
return
ilQuestionSetPoolPlugin
::
getPluginId
();
}
}
/**
/**
* @param string $type
* Cmd that will be redirected to after creation of a new object.
* @return array
*/
*/
public
function
getAfterCreationCmd
()
protected
function
initCreationForms
(
$type
)
{
{
return
"ilQuestionSetPoolPropertiesGUI.edit"
;
return
array
(
}
self
::
CFORM_NEW
=>
$this
->
initCreateForm
(
$type
),
self
::
CFORM_IMPORT
=>
$this
->
initImportForm
(
$type
)
public
function
getStandardCmd
()
);
{
}
return
"ilQuestionSetPoolSetsGUI.show"
;
}
/**
* @param string $type
/**
* @return ilPropertyFormGUI
* @param string $type
*/
* @return array
public
function
initCreateForm
(
$type
)
*/
{
protected
function
initCreationForms
(
$type
)
$form
=
parent
::
initCreateForm
(
$type
);
{
// Add additional form elements for creation form here
return
array
(
return
$form
;
self
::
CFORM_NEW
=>
$this
->
initCreateForm
(
$type
),
}
self
::
CFORM_IMPORT
=>
$this
->
initImportForm
(
$type
)
);
/**
}
* @param $a_new_type
* @return ilPropertyFormGUI
/**
*/
* @param string $type
public
function
initImportForm
(
$a_new_type
)
* @return ilPropertyFormGUI
{
*/
$form
=
parent
::
initImportForm
(
$a_new_type
);
public
function
initCreateForm
(
$type
)
{
// select question pool
$form
=
parent
::
initCreateForm
(
$type
);
include_once
(
"./Modules/Test/classes/class.ilObjTest.php"
);
// Add additional form elements for creation form here
$tst
=
new
ilObjTest
();
return
$form
;
$questionpools
=
$tst
->
getAvailableQuestionpools
(
true
,
false
,
true
,
true
);
}
$this
->
getPlugin
()
->
includeClass
(
'class.ilQuestionSetPoolImporter.php'
);
$options
=
array
(
/**
ilQuestionSetPoolImporter
::
SINGLE_IMPORT_NEW_POOL
=>
$this
->
lng
->
txt
(
"assessment_new_pool"
),
* @param $a_new_type
ilQuestionSetPoolImporter
::
SINGLE_IMPORT_NO_POOL
=>
$this
->
lng
->
txt
(
'assessment_no_pool'
)
* @return ilPropertyFormGUI
);
*/
public
function
initImportForm
(
$a_new_type
)
if
(
is_array
(
$questionpools
)
&&
count
(
$questionpools
))
{
{
foreach
(
$questionpools
as
$key
=>
$value
)
{
$form
=
parent
::
initImportForm
(
$a_new_type
);
$options
[
$key
]
=
$value
[
"title"
];
}
// select question pool
}
include_once
(
"./Modules/Test/classes/class.ilObjTest.php"
);
$pool
=
new
ilSelectInputGUI
(
$this
->
lng
->
txt
(
"select_questionpool"
),
"qpl"
);
$tst
=
new
ilObjTest
();
$pool
->
setOptions
(
$options
);
$questionpools
=
$tst
->
getAvailableQuestionpools
(
TRUE
,
FALSE
,
TRUE
,
TRUE
);
$form
->
addItem
(
$pool
);
$this
->
getPlugin
()
->
includeClass
(
'class.ilQuestionSetPoolImporter.php'
);
$options
=
array
(
return
$form
;
ilQuestionSetPoolImporter
::
SINGLE_IMPORT_NEW_POOL
=>
$this
->
lng
->
txt
(
"assessment_new_pool"
),
}
ilQuestionSetPoolImporter
::
SINGLE_IMPORT_NO_POOL
=>
$this
->
lng
->
txt
(
'assessment_no_pool'
)
);
/**
*
if
(
is_array
(
$questionpools
)
&&
count
(
$questionpools
))
*/
{
public
function
setTabs
()
foreach
(
$questionpools
as
$key
=>
$value
)
{
{
$this
->
tabs_gui
->
clearTargets
();
$options
[
$key
]
=
$value
[
"title"
];
}
if
(
$this
->
checkPermissionBool
(
'read'
))
{
}
$this
->
tabs_gui
->
addTab
(
'content'
,
$this
->
txt
(
'question_sets'
),
$this
->
ctrl
->
getLinkTarget
(
$this
,
'ilQuestionSetPoolSetsGUI.show'
));
$pool
=
new
ilSelectInputGUI
(
$this
->
lng
->
txt
(
"select_questionpool"
),
"qpl"
);
}
$pool
->
setOptions
(
$options
);
$form
->
addItem
(
$pool
);
$this
->
addInfoTab
();
return
$form
;
if
(
$this
->
checkPermissionBool
(
'read'
)
&&
$this
->
object
->
isSkillServiceEnabled
()
&&
ilObjQuestionSetPool
::
isSkillManagementGloballyActivated
())
{
}
$link
=
$this
->
ctrl
->
getLinkTargetByClass
(
array
(
'ilQuestionSetPoolSkillAdministrationGUI'
,
'ilAssQuestionSkillAssignmentsGUI'
),
/**
ilAssQuestionSkillAssignmentsGUI
::
CMD_SHOW_SKILL_QUEST_ASSIGNS
*
);
*/
public
function
setTabs
()
$this
->
tabs_gui
->
addTarget
(
'tst_tab_competences'
,
$link
);
{
}
$this
->
tabs_gui
->
clearTargets
();
if
(
$this
->
checkPermissionBool
(
'write'
))
{
if
(
$this
->
checkPermissionBool
(
'read'
))
$this
->
tabs_gui
->
addTab
(
'properties'
,
$this
->
lng
->
txt
(
'properties'
),
$this
->
ctrl
->
getLinkTarget
(
$this
,
'ilQuestionSetPoolPropertiesGUI.edit'
));
{
$this
->
tabs_gui
->
addTarget
(
'meta_data'
,
$this
->
ctrl
->
getLinkTargetByClass
(
'ilmdeditorgui'
,
''
),
''
,
'ilmdeditorgui'
);
$this
->
tabs_gui
->
addTab
(
'content'
,
$this
->
txt
(
'question_sets'
),
$this
->
ctrl
->
getLinkTarget
(
$this
,
'ilQuestionSetPoolSetsGUI.show'
));
$this
->
tabs_gui
->
addTarget
(
"export"
,
$this
->
ctrl
->
getLinkTargetByClass
(
"ilquestionsetpoolexportgui"
,
""
),
""
,
"ilquestionsetpoolexportgui"
);
}
}
$this
->
addInfoTab
();
$this
->
addPermissionTab
();
}
if
(
$this
->
checkPermissionBool
(
'read'
)
&&
$this
->
object
->
isSkillServiceEnabled
()
&&
ilObjQuestionSetPool
::
isSkillManagementGloballyActivated
())
{
/**
require_once
'Modules/TestQuestionPool/classes/class.ilAssQuestionSkillAssignmentsGUI.php'
;
* @param string $a_sub_type
* @param int $a_sub_id
$link
=
$this
->
ctrl
->
getLinkTargetByClass
(
* @return ilObjectListGUI|ilObjQuestionSetPoolListGUI
array
(
'ilQuestionSetPoolSkillAdministrationGUI'
,
'ilAssQuestionSkillAssignmentsGUI'
),
*/
ilAssQuestionSkillAssignmentsGUI
::
CMD_SHOW_SKILL_QUEST_ASSIGNS
protected
function
initHeaderAction
(
$a_sub_type
=
null
,
$a_sub_id
=
null
)
);
{
/**
$this
->
tabs_gui
->
addTarget
(
'tst_tab_competences'
,
$link
);
* @var $ilUser ilObjUser
}
*/
global
$ilUser
;
if
(
$this
->
checkPermissionBool
(
'write'
))
{
$lg
=
parent
::
initHeaderAction
();
$this
->
tabs_gui
->
addTab
(
'properties'
,
$this
->
lng
->
txt
(
'properties'
),
$this
->
ctrl
->
getLinkTarget
(
$this
,
'ilQuestionSetPoolPropertiesGUI.edit'
));
if
(
$lg
instanceof
ilObjQuestionSetPoolListGUI
)
{
$this
->
tabs_gui
->
addTarget
(
'meta_data'
,
$this
->
ctrl
->
getLinkTargetByClass
(
'ilmdeditorgui'
,
''
),
''
,
'ilmdeditorgui'
);
if
(
$ilUser
->
getId
()
!=
ANONYMOUS_USER_ID
)
{
$this
->
tabs_gui
->
addTarget
(
"export"
,
$this
->
ctrl
->
getLinkTargetByClass
(
"ilquestionsetpoolexportgui"
,
""
),
""
,
"ilquestionsetpoolexportgui"
);
// Maybe handle notifications in future ...
}
}
}
$this
->
addPermissionTab
();
}
return
$lg
;
}
/**
* @param string $a_sub_type
* @param int $a_sub_id
* @return ilObjectListGUI|ilObjQuestionSetPoolListGUI
*/
protected
function
initHeaderAction
(
$a_sub_type
=
null
,
$a_sub_id
=
null
)
{
/**
* @var $ilUser ilObjUser
*/
global
$ilUser
;
$lg
=
parent
::
initHeaderAction
();
if
(
$lg
instanceof
ilObjQuestionSetPoolListGUI
)
{
if
(
$ilUser
->
getId
()
!=
ANONYMOUS_USER_ID
)
{
// Maybe handle notifications in future ...
}
}
return
$lg
;
}
/**
* @see ilDesktopItemHandling::addToDesk()
*/
public
function
addToDeskObject
()
{
/**
* @var $ilSetting ilSetting
* @var $lng ilLanguage
*/
global
$ilSetting
,
$lng
;
if
((
int
)
$ilSetting
->
get
(
'disable_my_offers'
))
{
$this
->
ctrl
->
redirect
(
$this
);
return
;
}
include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php'
;
ilDesktopItemGUI
::
addToDesktop
();
ilUtil
::
sendSuccess
(
$lng
->
txt
(
'added_to_desktop'
),
true
);
$this
->
ctrl
->
redirect
(
$this
);
}
/**
* @see ilDesktopItemHandling::removeFromDesk()
*/
public
function
removeFromDeskObject
()
{
global
$ilSetting
,
$lng
;
if
((
int
)
$ilSetting
->
get
(
'disable_my_offers'
))
{
$this
->
ctrl
->
redirect
(
$this
);
return
;
}
include_once
'./Services/PersonalDesktop/classes/class.ilDesktopItemGUI.php'
;
ilDesktopItemGUI
::
removeFromDesktop
();
ilUtil
::
sendSuccess
(
$lng
->
txt
(
'removed_from_desktop'
),
true
);
$this
->
ctrl
->
redirect
(
$this
);
}
}
}
classes/class.ilObjQuestionSetPoolListGUI.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Repository/classes/class.ilObjectPluginListGUI.php'
;
/**
/**
* Class ilObjQuestionSetPoolListGUI
* Class ilObjQuestionSetPoolListGUI
*
*
* Date: 01.10.13
* Date: 01.10.13
* Time: 13:22
* Time: 13:22
* @author Thomas Joußen <tjoussen@databay.de>
* @author Thomas Joußen <tjoussen@databay.de>
*/
*/
class
ilObjQuestionSetPoolListGUI
extends
ilObjectPluginListGUI
class
ilObjQuestionSetPoolListGUI
extends
ilObjectPluginListGUI
{
{
public
function
getGuiClass
()
public
function
getGuiClass
()
{
{
return
'ilObj'
.
ilQuestionSetPoolPlugin
::
getName
()
.
'GUI'
;
return
'ilObj'
.
ilQuestionSetPoolPlugin
::
getName
()
.
'GUI'
;
}
}
public
function
initCommands
()
public
function
initCommands
()
{
{
$this
->
copy_enabled
=
true
;
$this
->
copy_enabled
=
true
;
return
array
(
return
array
(
array
(
array
(
'permission'
=>
'read'
,
'permission'
=>
'read'
,
'cmd'
=>
'infoScreen'
,
'cmd'
=>
'infoScreen'
,
'default'
=>
true
'default'
=>
true
),
),
array
(
array
(
'permission'
=>
'write'
,
'permission'
=>
'write'
,
'cmd'
=>
'ilQuestionSetPoolPropertiesGUI.edit'
,
'cmd'
=>
'ilQuestionSetPoolPropertiesGUI.edit'
,
'default'
=>
false
'default'
=>
false
)
)
);
);
}
}
public
function
initType
()
public
function
initType
()
{
{
require_once
'class.ilQuestionSetPoolPlugin.php'
;
require_once
'class.ilQuestionSetPoolPlugin.php'
;
$this
->
setType
(
ilQuestionSetPoolPlugin
::
getPluginId
());
$this
->
setType
(
ilQuestionSetPoolPlugin
::
getPluginId
());
}
}
/**
/**
* @return array
* @return array
*/
*/
public
function
getProperties
()
public
function
getProperties
()
{
{
/**
/**
* @var $lng ilLanguage
* @var $lng ilLanguage
*/
*/
global
$lng
;
global
$lng
;
$props
=
array
();
$props
=
array
();
include_once
"class.ilObjQuestionSetPoolAccess.php"
;
include_once
"class.ilObjQuestionSetPoolAccess.php"
;
if
(
!
ilObjQuestionSetPoolAccess
::
checkOnline
(
$this
->
obj_id
))
{
if
(
!
ilObjQuestionSetPoolAccess
::
checkOnline
(
$this
->
obj_id
))
$props
[]
=
array
(
"alert"
=>
true
,
"property"
=>
$lng
->
txt
(
"status"
),
{
"value"
=>
$lng
->
txt
(
"offline"
));
$props
[]
=
array
(
"alert"
=>
true
,
"property"
=>
$lng
->
txt
(
"status"
),
}
"value"
=>
$lng
->
txt
(
"offline"
));
}
return
$props
;
}
return
$props
;
}
}
}
classes/class.ilObjQuestionSetPoolXMLParser.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Xml/classes/class.ilSaxParser.php'
;
/**
/**
* Class ilObjQuestionSetPoolXMLParser
* Class ilObjQuestionSetPoolXMLParser
* @author Nadia Matuschek <nmatuschek@databay.de>
* @author Nadia Matuschek <nmatuschek@databay.de>
*/
*/
class
ilObjQuestionSetPoolXMLParser
extends
ilSaxParser
class
ilObjQuestionSetPoolXMLParser
extends
ilSaxParser
{
{
/**
/**
* @var ilObjQuestionSetPool
* @var ilObjQuestionSetPool
*/
*/
private
$xqsp_obj
;
private
$xqsp_obj
;
private
$inSettingsTag
;
private
$inSettingsTag
;
private
$inMetaDataTag
;
private
$inMetaDataTag
;
private
$inMdGeneralTag
;
private
$inMdGeneralTag
;
public
$sets
=
array
();
public
$sets
=
array
();
private
$questions
=
array
();
private
$questions
=
array
();
private
$paths
=
array
();
private
$paths
=
array
();
private
$nodes
=
array
();
private
$nodes
=
array
();
private
$jump_conditions
=
array
();
private
$jump_conditions
=
array
();
protected
$importDirectory
=
''
;
protected
$importDirectory
=
''
;
/**
/**
* @param ilObjQuestionSetPool $xqsp_obj
* @param ilObjQuestionSetPool $xqsp_obj
* @param $xmlFile
* @param $xmlFile
*/
*/
public
function
__construct
(
ilObjQuestionSetPool
$xqsp_obj
,
$xmlFile
)
public
function
__construct
(
ilObjQuestionSetPool
$xqsp_obj
,
$xmlFile
)
{
{
$this
->
xqsp_obj
=
$xqsp_obj
;
$this
->
xqsp_obj
=
$xqsp_obj
;
$this
->
inSettingsTag
=
false
;
$this
->
inSettingsTag
=
false
;
$this
->
inMetaDataTag
=
false
;
$this
->
inMetaDataTag
=
false
;
$this
->
inMdGeneralTag
=
false
;
$this
->
inMdGeneralTag
=
false
;
parent
::
__construct
(
$xmlFile
);
parent
::
__construct
(
$xmlFile
);
}
}
/**
/**
* Set import directory
* Set import directory
*
*
* @param string import directory
* @param string import directory
*/
*/
public
function
setImportDirectory
(
$a_val
)
public
function
setImportDirectory
(
$a_val
)
{
{
$this
->
importDirectory
=
$a_val
;
$this
->
importDirectory
=
$a_val
;
}
}
/**
/**
* Get import directory
* Get import directory
*
*
* @return string import directory
* @return string import directory
*/
*/
public
function
getImportDirectory
()
public
function
getImportDirectory
()
{
{
return
$this
->
importDirectory
;
return
$this
->
importDirectory
;
}
}
/**
/**
* @param $xmlParser
* @param $xmlParser
*/
*/
public
function
setHandlers
(
$xmlParser
)
public
function
setHandlers
(
$xmlParser
)
{
{
xml_set_object
(
$xmlParser
,
$this
);
xml_set_object
(
$xmlParser
,
$this
);
xml_set_element_handler
(
$xmlParser
,
'handlerBeginTag'
,
'handlerEndTag'
);
xml_set_element_handler
(
$xmlParser
,
'handlerBeginTag'
,
'handlerEndTag'
);
xml_set_character_data_handler
(
$xmlParser
,
'handlerCharacterData'
);
xml_set_character_data_handler
(
$xmlParser
,
'handlerCharacterData'
);
}
}
/**
/**
* @param $xmlParser
* @param $xmlParser
* @param $tagName
* @param $tagName
* @param $tagAttributes
* @param $tagAttributes
*/
*/
public
function
handlerBeginTag
(
$xmlParser
,
$tagName
,
$tagAttributes
)
public
function
handlerBeginTag
(
$xmlParser
,
$tagName
,
$tagAttributes
)
{
{
switch
(
$tagName
)
switch
(
$tagName
)
{
{
case
'MetaData'
:
case
'MetaData'
:
$this
->
inMetaDataTag
=
true
;
$this
->
inMetaDataTag
=
true
;
break
;
break
;
case
'General'
:
case
'General'
:
if
(
$this
->
inMetaDataTag
)
{
if
(
$this
->
inMetaDataTag
)
$this
->
inMdGeneralTag
=
true
;
{
}
$this
->
inMdGeneralTag
=
true
;
break
;
}
break
;
case
'Description'
:
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
{
case
'Description'
:
$this
->
cdata
=
''
;
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
}
{
break
;
$this
->
cdata
=
''
;
}
case
'Settings'
:
break
;
$this
->
inSettingsTag
=
true
;
break
;
case
'Settings'
:
$this
->
inSettingsTag
=
true
;
case
'Online'
:
break
;
case
'SkillService'
:
if
(
$this
->
inSettingsTag
)
{
case
'Online'
:
$this
->
cdata
=
''
;
case
'SkillService'
:
}
if
(
$this
->
inSettingsTag
)
break
;
{
case
'SetId'
:
$this
->
cdata
=
''
;
case
'SetTitle'
:
}
case
'SetDescription'
:
break
;
case
'OriginalId'
:
case
'SetId'
:
$this
->
cdata
=
''
;
case
'SetTitle'
:
break
;
case
'SetDescription'
:
}
case
'OriginalId'
:
}
$this
->
cdata
=
''
;
break
;
/**
}
* @param $xmlParser
}
* @param $tagName
*/
/**
public
function
handlerEndTag
(
$xmlParser
,
$tagName
)
* @param $xmlParser
{
* @param $tagName
switch
(
$tagName
)
{
*/
case
'MetaData'
:
public
function
handlerEndTag
(
$xmlParser
,
$tagName
)
$this
->
inMetaDataTag
=
false
;
{
break
;
switch
(
$tagName
)
{
case
'General'
:
case
'MetaData'
:
if
(
$this
->
inMetaDataTag
)
{
$this
->
inMetaDataTag
=
false
;
$this
->
inMdGeneralTag
=
false
;
break
;
}
break
;
case
'General'
:
if
(
$this
->
inMetaDataTag
)
case
'Title'
:
{
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
{
$this
->
inMdGeneralTag
=
false
;
$this
->
xqsp_obj
->
setTitle
(
trim
(
$this
->
cdata
));
}
$this
->
cdata
=
''
;
break
;
}
break
;
case
'Title'
:
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
case
'Description'
:
{
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
{
$this
->
xqsp_obj
->
setTitle
(
trim
(
$this
->
cdata
));
$this
->
xqsp_obj
->
setDescription
(
trim
(
$this
->
cdata
));
$this
->
cdata
=
''
;
$this
->
cdata
=
''
;
}
}
break
;
break
;
case
'Description'
:
case
'Settings'
:
if
(
$this
->
inMetaDataTag
&&
$this
->
inMdGeneralTag
)
$this
->
inSettingsTag
=
false
;
{
break
;
$this
->
xqsp_obj
->
setDescription
(
trim
(
$this
->
cdata
));
$this
->
cdata
=
''
;
case
'Online'
:
}
$this
->
xqsp_obj
->
setOnline
((
bool
)
trim
(
$this
->
cdata
));
break
;
$this
->
cdata
=
''
;
break
;
case
'Settings'
:
$this
->
inSettingsTag
=
false
;
case
'SkillService'
:
break
;
$this
->
xqsp_obj
->
setSkillServiceEnabled
((
bool
)
trim
(
$this
->
cdata
));
$this
->
cdata
=
''
;
case
'Online'
:
break
;
$this
->
xqsp_obj
->
setOnline
((
bool
)
trim
(
$this
->
cdata
));
// sets
$this
->
cdata
=
''
;
case
'SetId'
:
break
;
case
'SetTitle'
:
case
'SetDescription'
:
case
'SkillService'
:
case
'OriginalId'
:
$this
->
xqsp_obj
->
setSkillServiceEnabled
((
bool
)
trim
(
$this
->
cdata
));
$this
->
import_set
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
cdata
=
''
;
$this
->
cdata
=
''
;
break
;
break
;
// sets
// question
case
'SetId'
:
case
'QuestionId'
:
case
'SetTitle'
:
case
'QuestionIndex'
:
case
'SetDescription'
:
case
'QuestionOriginalId'
:
case
'OriginalId'
:
$this
->
import_question
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
import_set
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
cdata
=
''
;
$this
->
cdata
=
''
;
break
;
break
;
// paths
// question
case
'PathId'
:
case
'QuestionId'
:
case
'PathTitle'
:
case
'QuestionIndex'
:
case
'PathQuestionSetId'
:
case
'QuestionOriginalId'
:
case
'PathIndex'
:
$this
->
import_question
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
import_path
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
cdata
=
''
;
$this
->
cdata
=
''
;
break
;
break
;
// paths
//nodes
case
'PathId'
:
case
'NodeId'
:
case
'PathTitle'
:
case
'NodeQuestionId'
:
case
'PathQuestionSetId'
:
case
'NodePathId'
:
case
'PathIndex'
:
case
'NodeIndex'
:
$this
->
import_path
[
$tagName
]
=
trim
(
$this
->
cdata
);
case
'NodeInitialCondition'
:
$this
->
cdata
=
''
;
case
'NodeDominantScoring'
:
break
;
case
'NodeTrueFeedback'
:
//nodes
case
'NodeFalseFeedback'
:
case
'NodeId'
:
$this
->
import_node
[
$tagName
]
=
trim
(
$this
->
cdata
);
case
'NodeQuestionId'
:
$this
->
cdata
=
''
;
case
'NodePathId'
:
break
;
case
'NodeIndex'
:
// jump conditions
case
'NodeInitialCondition'
:
case
'JumpConditionId'
:
case
'NodeDominantScoring'
:
case
'JumpConditionText'
:
case
'NodeTrueFeedback'
:
case
'JumpConditionNodeId'
:
case
'NodeFalseFeedback'
:
case
'JumpConditionQuestionId'
:
$this
->
import_node
[
$tagName
]
=
trim
(
$this
->
cdata
);
case
'JumpConditionRepetitions'
:
$this
->
cdata
=
''
;
case
'JumpConditionSorting'
:
break
;
case
'JumpConditionTrueFeedback'
:
// jump conditions
case
'JumpConditionTrueJumpFeedback'
:
case
'JumpConditionId'
:
case
'JumpConditionFalseFeedback'
:
case
'JumpConditionText'
:
$this
->
import_jump_condition
[
$tagName
]
=
trim
(
$this
->
cdata
);
case
'JumpConditionNodeId'
:
$this
->
cdata
=
''
;
case
'JumpConditionQuestionId'
:
break
;
case
'JumpConditionRepetitions'
:
case
'Set'
:
case
'JumpConditionSorting'
:
//'addSet';
case
'JumpConditionTrueFeedback'
:
$this
->
sets
[]
=
array
(
$this
->
import_set
,
'questions'
=>
$this
->
questions
,
'paths'
=>
$this
->
paths
);
case
'JumpConditionTrueJumpFeedback'
:
$this
->
questions
=
array
();
case
'JumpConditionFalseFeedback'
:
$this
->
paths
=
array
();
$this
->
import_jump_condition
[
$tagName
]
=
trim
(
$this
->
cdata
);
$this
->
import_set
=
array
();
$this
->
cdata
=
''
;
break
;
break
;
case
'Set'
:
case
'Question'
:
//'addSet';
// addQuesion
$this
->
sets
[]
=
array
(
$this
->
import_set
,
'questions'
=>
$this
->
questions
,
'paths'
=>
$this
->
paths
);
$this
->
questions
[]
=
$this
->
import_question
;
$this
->
questions
=
array
();
$this
->
import_question
=
array
();
$this
->
paths
=
array
();
break
;
$this
->
import_set
=
array
();
break
;
case
'Path'
:
// addPath
case
'Question'
:
$this
->
paths
[]
=
array
(
$this
->
import_path
,
'nodes'
=>
$this
->
nodes
);
// addQuesion
$this
->
nodes
=
array
();
$this
->
questions
[]
=
$this
->
import_question
;
$this
->
import_path
=
array
();
$this
->
import_question
=
array
();
break
;
break
;
case
'Node'
:
case
'Path'
:
// addNode
// addPath
$this
->
nodes
[]
=
array
(
$this
->
import_node
,
'jump_conditions'
=>
$this
->
jump_conditions
);
$this
->
paths
[]
=
array
(
$this
->
import_path
,
'nodes'
=>
$this
->
nodes
);
$this
->
jump_conditions
=
array
();
$this
->
nodes
=
array
();
$this
->
import_node
=
array
();
$this
->
import_path
=
array
();
break
;
break
;
case
'JumpCondition'
:
case
'Node'
:
// addJumpConditition
// addNode
$this
->
jump_conditions
[]
=
$this
->
import_jump_condition
;
$this
->
nodes
[]
=
array
(
$this
->
import_node
,
'jump_conditions'
=>
$this
->
jump_conditions
);
$this
->
import_jump_condition
=
array
();
$this
->
jump_conditions
=
array
();
break
;
$this
->
import_node
=
array
();
}
break
;
}
case
'JumpCondition'
:
public
function
handlerCharacterData
(
$xmlParser
,
$charData
)
// addJumpConditition
{
$this
->
jump_conditions
[]
=
$this
->
import_jump_condition
;
if
(
$charData
!=
"
\n
"
)
{
$this
->
import_jump_condition
=
array
();
// Replace multiple tabs with one space
break
;
$charData
=
preg_replace
(
"/
\t
+/"
,
" "
,
$charData
);
}
}
$this
->
cdata
.
=
$charData
;
}
public
function
handlerCharacterData
(
$xmlParser
,
$charData
)
}
{
if
(
$charData
!=
"
\n
"
)
public
function
getQuestionSetPoolObject
()
{
{
// Replace multiple tabs with one space
return
$this
->
xqsp_obj
;
$charData
=
preg_replace
(
"/
\t
+/"
,
" "
,
$charData
);
}
$this
->
cdata
.
=
$charData
;
public
function
getSetsArray
()
}
{
}
return
$this
->
sets
;
}
public
function
getQuestionSetPoolObject
()
}
{
return
$this
->
xqsp_obj
;
}
public
function
getSetsArray
()
{
return
$this
->
sets
;
}
}
\ No newline at end of file
classes/class.ilQuestionSetPoolExportGUI.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
require_once
'Services/Export/classes/class.ilExportGUI.php'
;
/**
/**
* Export User Interface Class
* Export User Interface Class
* @author Nadia Matuschek <nmatuschek@databay.de>
* @author Nadia Matuschek <nmatuschek@databay.de>
*/
*/
class
ilQuestionSetPoolExportGUI
extends
ilExportGUI
class
ilQuestionSetPoolExportGUI
extends
ilExportGUI
{
{
/**
/**
* {@inheritdoc}
* {@inheritdoc}
*/
*/
protected
function
buildExportTableGUI
()
protected
function
buildExportTableGUI
()
{
{
require_once
'tables/class.ilQuestionSetPoolExportTableGUI.php'
;
require_once
'tables/class.ilQuestionSetPoolExportTableGUI.php'
;
$table
=
new
ilQuestionSetPoolExportTableGUI
(
$this
,
'listExportFiles'
,
$this
->
obj
);
$table
=
new
ilQuestionSetPoolExportTableGUI
(
$this
,
'listExportFiles'
,
$this
->
obj
);
return
$table
;
return
$table
;
}
}
/**
/**
* Download file
* Download file
*/
*/
public
function
download
()
public
function
download
()
{
{
if
(
isset
(
$_GET
[
'file'
])
&&
$_GET
[
'file'
])
if
(
isset
(
$_GET
[
'file'
])
&&
$_GET
[
'file'
])
{
{
$_POST
[
'file'
]
=
array
(
$_GET
[
'file'
]);
$_POST
[
'file'
]
=
array
(
$_GET
[
'file'
]);
}
}
parent
::
download
();
parent
::
download
();
}
}
}
}
\ No newline at end of file
classes/class.ilQuestionSetPoolExporter.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
include_once
'./Services/Export/classes/class.ilXmlExporter.php'
;
include_once
'./Services/Xml/classes/class.ilXmlWriter.php'
;
include_once
'./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php'
;
/**
/**
* Class ilQuestionSetPoolExporter
* Class ilQuestionSetPoolExporter
* author Nadia Matuschek <nmatuschek@databay.de>
* author Nadia Matuschek <nmatuschek@databay.de>
*/
*/
class
ilQuestionSetPoolExporter
extends
ilXmlExporter
class
ilQuestionSetPoolExporter
extends
ilXmlExporter
{
{
/**
/**
* @var ilXmlWriter
* @var ilXmlWriter
*/
*/
protected
$xml_writer
=
NULL
;
protected
$xml_writer
=
null
;
/**
/**
* @var string
* @var string
*/
*/
protected
$export_dir
=
''
;
protected
$export_dir
=
''
;
/**
/**
* @var string
* @var string
*/
*/
protected
$subdir
=
''
;
protected
$subdir
=
''
;
/**
/**
* @var string
* @var string
*/
*/
protected
$filename
=
''
;
protected
$filename
=
''
;
/**
/**
* @var string
* @var string
*/
*/
protected
$qti_filename
=
''
;
protected
$qti_filename
=
''
;
/**
/**
* @var string
* @var string
*/
*/
protected
$zipfilename
=
''
;
protected
$zipfilename
=
''
;
/**
/**
* @var array with question ids to export
* @var array with question ids to export
*/
*/
protected
$questions
=
array
();
protected
$questions
=
array
();
/**
/**
* @var ilLog
* @var ilLog
*/
*/
protected
$expLog
=
NULL
;
protected
$expLog
=
null
;
/**
/**
* Initialisation
* Initialisation
*/
*/
function
init
()
public
function
init
()
{
{
}
}
/**
/**
* ilQuestionSetPoolExporter constructor.
* ilQuestionSetPoolExporter constructor.
*/
*/
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
plugin_object
=
ilPlugin
::
getPluginObject
(
'Services'
,
'Repository'
,
'robj'
,
'QuestionSetPool'
);
$this
->
plugin_object
=
ilPlugin
::
getPluginObject
(
'Services'
,
'Repository'
,
'robj'
,
'QuestionSetPool'
);
}
}
/**
/**
*
*
*/
*/
public
function
initLogFile
()
public
function
initLogFile
()
{
{
include_once
"./Services/Logging/classes/class.ilLog.php"
;
$this
->
expLog
=
new
ilLog
(
$this
->
getExportDirectory
(),
"export.log"
);
$this
->
expLog
=
new
ilLog
(
$this
->
getExportDirectory
(),
"export.log"
);
$this
->
expLog
->
delete
();
$this
->
expLog
->
delete
();
$this
->
expLog
->
setLogFormat
(
""
);
$this
->
expLog
->
setLogFormat
(
""
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export"
);
}
}
/**
/**
* creates data directory for export files
* creates data directory for export files
* (data_dir/qpl_data/qpl_<id>/export, depending on data
* (data_dir/qpl_data/qpl_<id>/export, depending on data
* directory that is set in ILIAS setup/ini)
* directory that is set in ILIAS setup/ini)
*/
*/
public
function
createExportDirectory
()
function
createExportDirectory
()
{
{
global
$ilErr
;
global
$ilErr
;
$xqsp_data_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
;
include_once
"./Services/Utilities/classes/class.ilUtil.php"
;
ilUtil
::
makeDir
(
$xqsp_data_dir
);
$xqsp_data_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
;
if
(
!
is_writable
(
$xqsp_data_dir
))
{
ilUtil
::
makeDir
(
$xqsp_data_dir
);
$ilErr
->
raiseError
(
"Questionpool Data Directory ("
.
$xqsp_data_dir
.
") not writeable."
,
$ilErr
->
FATAL
);
if
(
!
is_writable
(
$xqsp_data_dir
))
}
{
$ilErr
->
raiseError
(
"Questionpool Data Directory ("
.
$xqsp_data_dir
.
") not writeable."
,
$ilErr
->
FATAL
);
// create learning module directory (data_dir/lm_data/lm_<id>)
}
$xqsp_dir
=
$xqsp_data_dir
.
"/xqsp_"
.
$this
->
object
->
getId
();
ilUtil
::
makeDir
(
$xqsp_dir
);
// create learning module directory (data_dir/lm_data/lm_<id>)
if
(
!@
is_dir
(
$xqsp_dir
))
{
$xqsp_dir
=
$xqsp_data_dir
.
"/xqsp_"
.
$this
->
object
->
getId
();
$ilErr
->
raiseError
(
"Creation of QuestionSetPool Directory failed. xqsp_"
,
$ilErr
->
FATAL
);
ilUtil
::
makeDir
(
$xqsp_dir
);
}
if
(
!@
is_dir
(
$xqsp_dir
))
// // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
{
// ilUtil::makeDir($this->getExportDirectory('xls'));
$ilErr
->
raiseError
(
"Creation of QuestionSetPool Directory failed. xqsp_"
,
$ilErr
->
FATAL
);
// if(!@is_dir($this->getExportDirectory('xls')))
}
// {
// // create Export subdirectory (data_dir/lm_data/lm_<id>/Export)
// $ilErr->raiseError("Creation of Export Directory failed. xls", $ilErr->FATAL);
// ilUtil::makeDir($this->getExportDirectory('xls'));
// }
// if(!@is_dir($this->getExportDirectory('xls')))
ilUtil
::
makeDir
(
$this
->
getExportDirectory
(
'zip'
));
// {
if
(
!@
is_dir
(
$this
->
getExportDirectory
(
'zip'
)))
{
// $ilErr->raiseError("Creation of Export Directory failed. xls", $ilErr->FATAL);
$ilErr
->
raiseError
(
"Creation of Export Directory failed. zip"
,
$ilErr
->
FATAL
);
// }
}
ilUtil
::
makeDir
(
$this
->
getExportDirectory
(
'zip'
));
}
if
(
!@
is_dir
(
$this
->
getExportDirectory
(
'zip'
)))
{
/**
$ilErr
->
raiseError
(
"Creation of Export Directory failed. zip"
,
$ilErr
->
FATAL
);
* get export directory of questionsetpool
}
* @param string $type
* @return string
}
*/
public
function
getExportDirectory
(
$type
=
""
)
/**
{
* get export directory of questionsetpool
switch
(
$type
)
{
* @param string $type
case
'xml'
:
* @return string
$export_dir
=
ilExport
::
_getExportDirectory
(
$this
->
object
->
getId
(),
$type
,
$this
->
object
->
getType
());
*/
break
;
function
getExportDirectory
(
$type
=
""
)
{
include_once
"./Services/Utilities/classes/class.ilUtil.php"
;
switch
(
$type
)
{
case
'xml'
:
include_once
(
"./Services/Export/classes/class.ilExport.php"
);
$export_dir
=
ilExport
::
_getExportDirectory
(
$this
->
object
->
getId
(),
$type
,
$this
->
object
->
getType
());
break
;
// case 'xls':
// case 'xls':
case
'zip'
:
case
'zip'
:
$export_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
.
"/xqsp_"
.
$this
->
object
->
getId
()
.
"/export_
$type
"
;
$export_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
.
"/xqsp_"
.
$this
->
object
->
getId
()
.
"/export_
$type
"
;
break
;
break
;
default
:
default
:
$export_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
.
"/xqsp_"
.
$this
->
object
->
getId
()
.
"/export"
;
$export_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
.
"/xqsp_"
.
$this
->
object
->
getId
()
.
"/export"
;
break
;
break
;
}
}
return
$export_dir
;
return
$export_dir
;
}
}
/**
/**
*
*
*/
*/
public
function
exportPagesXML
()
public
function
exportPagesXML
()
{
{
global
$ilBench
;
global
$ilBench
;
$this
->
mob_ids
=
array
();
$this
->
mob_ids
=
array
();
$this
->
file_ids
=
array
();
$this
->
file_ids
=
array
();
$attrs
=
array
();
$attrs
=
array
();
$attrs
[
"Type"
]
=
"QuestionSetPool_FormATest"
;
$attrs
[
"Type"
]
=
"QuestionSetPool_FormATest"
;
$this
->
xml_writer
->
xmlStartTag
(
"ContentObject"
,
$attrs
);
$this
->
xml_writer
->
xmlStartTag
(
"ContentObject"
,
$attrs
);
// MetaData
// MetaData
$this
->
exportXMLMetaData
();
$this
->
exportXMLMetaData
();
// Settings
// Settings
$this
->
exportXMLSettings
();
$this
->
exportXMLSettings
();
// Question Sets
// Question Sets
$this
->
exportQuestionSets
();
$this
->
exportQuestionSets
();
// PageObjects
// PageObjects
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export Page Objects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export Page Objects"
);
$ilBench
->
start
(
"ContentObjectExport"
,
"exportPageObjects"
);
$ilBench
->
start
(
"ContentObjectExport"
,
"exportPageObjects"
);
$this
->
qpl_obj
->
exportXMLPageObjects
(
$this
->
xml_writer
,
IL_INST_ID
,
$this
->
expLog
,
$this
->
questions
);
$this
->
qpl_obj
->
exportXMLPageObjects
(
$this
->
xml_writer
,
IL_INST_ID
,
$this
->
expLog
,
$this
->
questions
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportPageObjects"
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportPageObjects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export Page Objects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export Page Objects"
);
// add media objects which were added with tiny mce
// add media objects which were added with tiny mce
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export Media Objects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export Media Objects"
);
$export_dir
=
$this
->
exp
->
export_run_dir
;
$export_dir
=
$this
->
exp
->
export_run_dir
;
$ilBench
->
start
(
"ContentObjectExport"
,
"exportMediaObjects"
);
$ilBench
->
start
(
"ContentObjectExport"
,
"exportMediaObjects"
);
$this
->
exportXHTMLMediaObjects
(
$export_dir
);
$this
->
exportXHTMLMediaObjects
(
$export_dir
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportMediaObjects"
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportMediaObjects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export Media Objects"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export Media Objects"
);
if
(
is_array
(
$this
->
qpl_obj
->
file_ids
)
&&
count
(
$this
->
qpl_obj
->
file_ids
)
>
0
)
if
(
is_array
(
$this
->
qpl_obj
->
file_ids
)
&&
count
(
$this
->
qpl_obj
->
file_ids
)
>
0
)
{
{
// FileItems
// FileItems
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export File Items"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Start Export File Items"
);
$ilBench
->
start
(
"ContentObjectExport"
,
"exportFileItems"
);
$ilBench
->
start
(
"ContentObjectExport"
,
"exportFileItems"
);
$this
->
exportFileItems
(
$this
->
export_dir
.
"/"
.
$this
->
subdir
,
$this
->
expLog
);
$this
->
exportFileItems
(
$this
->
export_dir
.
"/"
.
$this
->
subdir
,
$this
->
expLog
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportFileItems"
);
$ilBench
->
stop
(
"ContentObjectExport"
,
"exportFileItems"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export File Items"
);
$this
->
expLog
->
write
(
date
(
"[y-m-d H:i:s] "
)
.
"Finished Export File Items"
);
}
}
$this
->
xml_writer
->
xmlEndTag
(
"ContentObject"
);
$this
->
xml_writer
->
xmlEndTag
(
"ContentObject"
);
}
}
/**
/**
* export content objects meta data to xml (see ilias_co.dtd)
* export content objects meta data to xml (see ilias_co.dtd)
*/
*/
public
function
exportXMLMetaData
()
function
exportXMLMetaData
()
{
{
$md2xml
=
new
ilMD2XML
(
$this
->
object
->
getId
(),
0
,
$this
->
object
->
getType
());
include_once
(
"Services/MetaData/classes/class.ilMD2XML.php"
);
$md2xml
->
setExportMode
(
true
);
$md2xml
=
new
ilMD2XML
(
$this
->
object
->
getId
(),
0
,
$this
->
object
->
getType
());
$md2xml
->
startExport
();
$md2xml
->
setExportMode
(
true
);
$this
->
xml_writer
->
appendXML
(
$md2xml
->
getXML
());
$md2xml
->
startExport
();
}
$this
->
xml_writer
->
appendXML
(
$md2xml
->
getXML
());
}
/**
*
/**
*/
*
private
function
exportXMLSettings
()
*/
{
private
function
exportXMLSettings
()
$this
->
xml_writer
->
xmlStartTag
(
'Settings'
);
{
$this
->
xml_writer
->
xmlStartTag
(
'Settings'
);
$this
->
xml_writer
->
xmlElement
(
'Title'
,
null
,
(
string
)
$this
->
object
->
getTitle
());
$this
->
xml_writer
->
xmlElement
(
'Description'
,
null
,
(
string
)
$this
->
object
->
getDescription
());
$this
->
xml_writer
->
xmlElement
(
'Title'
,
null
,
(
string
)
$this
->
object
->
getTitle
());
$this
->
xml_writer
->
xmlElement
(
'Online'
,
null
,
(
int
)
$this
->
object
->
isOnline
());
$this
->
xml_writer
->
xmlElement
(
'Description'
,
null
,
(
string
)
$this
->
object
->
getDescription
());
$this
->
xml_writer
->
xmlElement
(
'SkillService'
,
null
,
(
int
)
$this
->
object
->
isSkillServiceEnabled
());
$this
->
xml_writer
->
xmlElement
(
'Online'
,
null
,
(
int
)
$this
->
object
->
isOnline
());
$this
->
xml_writer
->
xmlElement
(
'SkillService'
,
null
,
(
int
)
$this
->
object
->
isSkillServiceEnabled
());
$this
->
xml_writer
->
xmlEndTag
(
'Settings'
);
}
$this
->
xml_writer
->
xmlEndTag
(
'Settings'
);
}
/**
*
/**
*/
*
protected
function
exportQuestionSets
()
*/
{
protected
function
exportQuestionSets
()
$this
->
plugin_object
=
ilQuestionSetPoolPlugin
::
getInstance
();
{
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$this
->
plugin_object
=
ilQuestionSetPoolPlugin
::
getInstance
();
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
$setlist
=
$this
->
object
->
getSetList
();
$sets
=
array
();
$setlist
=
$this
->
object
->
getSetList
();
$sets
=
$setlist
->
loadData
();
$sets
=
array
();
$sets
=
$setlist
->
loadData
();
$this
->
xml_writer
->
xmlStartTag
(
'QuestionSets'
);
foreach
(
$sets
as
$set_index
=>
$set_data
)
{
$this
->
xml_writer
->
xmlStartTag
(
'QuestionSets'
);
$set
=
new
ilQuestionSetPoolSet
((
int
)
$set_data
[
'id'
]);
foreach
(
$sets
as
$set_index
=>
$set_data
)
$set
->
read
();
{
$set
=
new
ilQuestionSetPoolSet
((
int
)
$set_data
[
'id'
]);
$this
->
xml_writer
->
xmlStartTag
(
'Set'
);
$set
->
read
();
$this
->
xml_writer
->
xmlElement
(
'SetId'
,
null
,
(
int
)
$set
->
getId
());
$this
->
xml_writer
->
xmlElement
(
'SetTitle'
,
null
,
(
string
)
$set
->
getTitle
());
$this
->
xml_writer
->
xmlStartTag
(
'Set'
);
$this
->
xml_writer
->
xmlElement
(
'SetDescription'
,
null
,
(
string
)
$set
->
getDescription
());
$this
->
xml_writer
->
xmlElement
(
'SetId'
,
null
,
(
int
)
$set
->
getId
());
$this
->
xml_writer
->
xmlElement
(
'SetTitle'
,
null
,
(
string
)
$set
->
getTitle
());
$this
->
xml_writer
->
xmlElement
(
'OriginalId'
,
null
,
(
int
)
$set
->
getOriginalId
());
$this
->
xml_writer
->
xmlElement
(
'SetDescription'
,
null
,
(
string
)
$set
->
getDescription
());
// Export QuestionList
$this
->
xml_writer
->
xmlElement
(
'OriginalId'
,
null
,
(
int
)
$set
->
getOriginalId
());
$this
->
exportQuestionList
(
$set
->
getQuestionList
());
// Export QuestionList
// Export Paths
$this
->
exportQuestionList
(
$set
->
getQuestionList
());
$this
->
exportPathList
(
$set
->
getPathList
());
// Export Paths
$this
->
xml_writer
->
xmlEndTag
(
'Set'
);
$this
->
exportPathList
(
$set
->
getPathList
());
}
$this
->
xml_writer
->
xmlEndTag
(
'Set'
);
$this
->
xml_writer
->
xmlEndTag
(
'QuestionSets'
);
}
}
$this
->
xml_writer
->
xmlEndTag
(
'QuestionSets'
);
/**
}
* @param ilQuestionSetPoolSetQuestionList $questionList
*/
/**
protected
function
exportQuestionList
(
ilQuestionSetPoolSetQuestionList
$questionList
)
* @param ilQuestionSetPoolSetQuestionList $questionList
{
*/
$questions
=
array
();
protected
function
exportQuestionList
(
ilQuestionSetPoolSetQuestionList
$questionList
)
$questions
=
$questionList
->
loadData
();
{
$this
->
xml_writer
->
xmlStartTag
(
'Questions'
);
$questions
=
array
();
foreach
(
$questions
as
$question_index
=>
$question
)
{
$questions
=
$questionList
->
loadData
();
$this
->
xml_writer
->
xmlStartTag
(
'Question'
);
$this
->
xml_writer
->
xmlStartTag
(
'Questions'
);
$this
->
xml_writer
->
xmlElement
(
'QuestionId'
,
null
,
$question
[
'question_id'
]);
foreach
(
$questions
as
$question_index
=>
$question
)
$this
->
xml_writer
->
xmlElement
(
'QuestionIndex'
,
null
,
$question
[
'question_index'
]);
{
$this
->
xml_writer
->
xmlElement
(
'QuestionOriginalId'
,
null
,
$question
[
'original_id'
]);
$this
->
xml_writer
->
xmlStartTag
(
'Question'
);
$this
->
xml_writer
->
xmlEndTag
(
'Question'
);
$this
->
xml_writer
->
xmlElement
(
'QuestionId'
,
null
,
$question
[
'question_id'
]);
$this
->
questions
[
$question
[
'question_id'
]]
=
$question
[
'question_id'
];
$this
->
xml_writer
->
xmlElement
(
'QuestionIndex'
,
null
,
$question
[
'question_index'
]);
}
$this
->
xml_writer
->
xmlElement
(
'QuestionOriginalId'
,
null
,
$question
[
'original_id'
]);
$this
->
xml_writer
->
xmlEndTag
(
'Questions'
);
$this
->
xml_writer
->
xmlEndTag
(
'Question'
);
if
(
is_array
(
$this
->
questions
)
&&
count
(
$this
->
questions
)
>
0
)
{
$this
->
questions
[
$question
[
'question_id'
]]
=
$question
[
'question_id'
];
$this
->
exportQuestions
();
}
}
$this
->
xml_writer
->
xmlEndTag
(
'Questions'
);
}
if
(
is_array
(
$this
->
questions
)
&&
count
(
$this
->
questions
)
>
0
)
{
/**
$this
->
exportQuestions
();
* @param ilQuestionSetPoolPathList $pathlist
}
*/
}
protected
function
exportPathList
(
ilQuestionSetPoolPathList
$pathList
)
{
/**
$paths
=
array
();
* @param ilQuestionSetPoolPathList $pathlist
$paths
=
$pathList
->
loadData
();
*/
protected
function
exportPathList
(
ilQuestionSetPoolPathList
$pathList
)
$this
->
xml_writer
->
xmlStartTag
(
'Paths'
);
{
foreach
(
$paths
as
$path_index
=>
$path_data
)
{
$paths
=
array
();
$path
=
new
ilQuestionSetPoolPath
();
$paths
=
$pathList
->
loadData
();
$path
->
setId
(
$path_data
[
'id'
]);
$path
->
read
();
$this
->
xml_writer
->
xmlStartTag
(
'Paths'
);
$this
->
xml_writer
->
xmlStartTag
(
'Path'
);
foreach
(
$paths
as
$path_index
=>
$path_data
)
$this
->
xml_writer
->
xmlElement
(
'PathId'
,
null
,
(
int
)
$path
->
getId
());
{
$this
->
xml_writer
->
xmlElement
(
'PathTitle'
,
null
,
(
string
)
$path
->
getTitle
());
$path
=
new
ilQuestionSetPoolPath
();
$this
->
xml_writer
->
xmlElement
(
'PathQuestionSetId'
,
null
,
(
int
)
$path_data
[
'questionset_fi'
]);
$path
->
setId
(
$path_data
[
'id'
]);
$this
->
xml_writer
->
xmlElement
(
'PathIndex'
,
null
,
$path
->
getIndex
());
$path
->
read
();
$this
->
xml_writer
->
xmlStartTag
(
'Path'
);
// Nodes
$this
->
xml_writer
->
xmlElement
(
'PathId'
,
null
,
(
int
)
$path
->
getId
());
$this
->
exportNodeList
(
$path
->
getNodes
());
$this
->
xml_writer
->
xmlElement
(
'PathTitle'
,
null
,
(
string
)
$path
->
getTitle
());
$this
->
xml_writer
->
xmlElement
(
'PathQuestionSetId'
,
null
,
(
int
)
$path_data
[
'questionset_fi'
]);
$this
->
xml_writer
->
xmlEndTag
(
'Path'
);
$this
->
xml_writer
->
xmlElement
(
'PathIndex'
,
null
,
$path
->
getIndex
());
}
$this
->
xml_writer
->
xmlEndTag
(
'Paths'
);
// Nodes
}
$this
->
exportNodeList
(
$path
->
getNodes
());
/**
$this
->
xml_writer
->
xmlEndTag
(
'Path'
);
* @param ilQuestionSetPoolNodeList $nodelist
}
*/
$this
->
xml_writer
->
xmlEndTag
(
'Paths'
);
protected
function
exportNodeList
(
ilQuestionSetPoolNodeList
$nodeList
)
}
{
$nodes
=
array
();
/**
$nodes
=
$nodeList
->
loadData
();
* @param ilQuestionSetPoolNodeList $nodelist
*/
$this
->
xml_writer
->
xmlStartTag
(
'Nodes'
);
protected
function
exportNodeList
(
ilQuestionSetPoolNodeList
$nodeList
)
foreach
(
$nodes
as
$node_index
=>
$node_data
)
{
{
$node
=
new
ilQuestionSetPoolNode
((
int
)
$node_data
[
'id'
]);
$nodes
=
array
();
$node
->
read
();
$nodes
=
$nodeList
->
loadData
();
$this
->
xml_writer
->
xmlStartTag
(
'Node'
);
$this
->
xml_writer
->
xmlStartTag
(
'Nodes'
);
$this
->
xml_writer
->
xmlElement
(
'NodeId'
,
null
,
(
int
)
$node
->
getId
());
foreach
(
$nodes
as
$node_index
=>
$node_data
)
$this
->
xml_writer
->
xmlElement
(
'NodeQuestionId'
,
null
,
(
int
)
$node_data
[
'question_fi'
]);
{
$this
->
xml_writer
->
xmlElement
(
'NodePathId'
,
null
,
(
int
)
$node_data
[
'path_fi'
]);
$node
=
new
ilQuestionSetPoolNode
((
int
)
$node_data
[
'id'
]);
$this
->
xml_writer
->
xmlElement
(
'NodeIndex'
,
null
,
(
int
)
$node
->
getIndex
());
$node
->
read
();
$this
->
xml_writer
->
xmlStartTag
(
'Node'
);
$this
->
xml_writer
->
xmlElement
(
'NodeInitialCondition'
,
null
,
$node
->
getInitialCondition
());
$this
->
xml_writer
->
xmlElement
(
'NodeDominantScoring'
,
null
,
$node
->
getDominantScoring
());
$this
->
xml_writer
->
xmlElement
(
'NodeId'
,
null
,
(
int
)
$node
->
getId
());
$this
->
xml_writer
->
xmlElement
(
'NodeQuestionId'
,
null
,
(
int
)
$node_data
[
'question_fi'
]);
$this
->
xml_writer
->
xmlElement
(
'NodeTrueFeedback'
,
null
,
$node
->
getTrueFeedback
());
$this
->
xml_writer
->
xmlElement
(
'NodePathId'
,
null
,
(
int
)
$node_data
[
'path_fi'
]);
$this
->
xml_writer
->
xmlElement
(
'NodeFalseFeedback'
,
null
,
$node
->
getFalseFeedback
());
$this
->
xml_writer
->
xmlElement
(
'NodeIndex'
,
null
,
(
int
)
$node
->
getIndex
());
// Jump Conditions
$this
->
xml_writer
->
xmlElement
(
'NodeInitialCondition'
,
null
,
$node
->
getInitialCondition
());
$this
->
exportJumpConditions
(
$node
->
getJumpConditionList
());
$this
->
xml_writer
->
xmlElement
(
'NodeDominantScoring'
,
null
,
$node
->
getDominantScoring
());
$this
->
xml_writer
->
xmlEndTag
(
'Node'
);
$this
->
xml_writer
->
xmlElement
(
'NodeTrueFeedback'
,
null
,
$node
->
getTrueFeedback
());
}
$this
->
xml_writer
->
xmlElement
(
'NodeFalseFeedback'
,
null
,
$node
->
getFalseFeedback
());
$this
->
xml_writer
->
xmlEndTag
(
'Nodes'
);
}
// Jump Conditions
$this
->
exportJumpConditions
(
$node
->
getJumpConditionList
());
/**
* @param ilQuestionSetPoolJumpConditionList $jumpConditionList
$this
->
xml_writer
->
xmlEndTag
(
'Node'
);
*/
}
protected
function
exportJumpConditions
(
ilQuestionSetPoolJumpConditionList
$jumpConditionList
)
$this
->
xml_writer
->
xmlEndTag
(
'Nodes'
);
{
}
$jumpConditions
=
array
();
$jumpConditions
=
$jumpConditionList
->
getData
();
/**
* @param ilQuestionSetPoolJumpConditionList $jumpConditionList
$this
->
xml_writer
->
xmlStartTag
(
'JumpConditions'
);
*/
protected
function
exportJumpConditions
(
ilQuestionSetPoolJumpConditionList
$jumpConditionList
)
foreach
(
$jumpConditions
as
$jmp_con_index
=>
$jumpCondition_data
)
{
{
$jumpCondition
=
new
ilQuestionSetPoolJumpCondition
();
$jumpConditions
=
array
();
$jumpCondition
->
setId
(
$jumpCondition_data
[
'id'
]);
$jumpConditions
=
$jumpConditionList
->
getData
();
$jumpCondition
->
read
();
$this
->
xml_writer
->
xmlStartTag
(
'JumpConditions'
);
$this
->
xml_writer
->
xmlStartTag
(
'JumpCondition'
);
$this
->
xml_writer
->
xmlElement
(
'JumpConditionId'
,
null
,
(
int
)
$jumpCondition
->
getId
());
foreach
(
$jumpConditions
as
$jmp_con_index
=>
$jumpCondition_data
)
$this
->
xml_writer
->
xmlElement
(
'JumpConditionText'
,
null
,
(
string
)
$jumpCondition
->
getJumpCondition
());
{
$jumpCondition
=
new
ilQuestionSetPoolJumpCondition
();
$this
->
xml_writer
->
xmlElement
(
'JumpConditionNodeId'
,
null
,
(
int
)
$jumpCondition_data
[
'node_fi'
]);
$jumpCondition
->
setId
(
$jumpCondition_data
[
'id'
]);
$this
->
xml_writer
->
xmlElement
(
'JumpConditionQuestionId'
,
null
,
$jumpCondition_data
[
'question_fi'
]);
$jumpCondition
->
read
();
$this
->
xml_writer
->
xmlElement
(
'JumpConditionRepetitions'
,
null
,
$jumpCondition
->
getRepititions
());
$this
->
xml_writer
->
xmlStartTag
(
'JumpCondition'
);
$this
->
xml_writer
->
xmlElement
(
'JumpConditionSorting'
,
null
,
$jumpCondition
->
getSorting
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionId'
,
null
,
(
int
)
$jumpCondition
->
getId
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionTrueFeedback'
,
null
,
$jumpCondition
->
getTrueFeedback
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionText'
,
null
,
(
string
)
$jumpCondition
->
getJumpCondition
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionTrueJumpFeedback'
,
null
,
$jumpCondition
->
getTrueJumpFeedback
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionFalseFeedback'
,
null
,
$jumpCondition
->
getFalseFeedback
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionNodeId'
,
null
,
(
int
)
$jumpCondition_data
[
'node_fi'
]);
$this
->
xml_writer
->
xmlElement
(
'JumpConditionQuestionId'
,
null
,
$jumpCondition_data
[
'question_fi'
]);
$this
->
xml_writer
->
xmlEndTag
(
'JumpCondition'
);
}
$this
->
xml_writer
->
xmlElement
(
'JumpConditionRepetitions'
,
null
,
$jumpCondition
->
getRepititions
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionSorting'
,
null
,
$jumpCondition
->
getSorting
());
$this
->
xml_writer
->
xmlEndTag
(
'JumpConditions'
);
$this
->
xml_writer
->
xmlElement
(
'JumpConditionTrueFeedback'
,
null
,
$jumpCondition
->
getTrueFeedback
());
}
$this
->
xml_writer
->
xmlElement
(
'JumpConditionTrueJumpFeedback'
,
null
,
$jumpCondition
->
getTrueJumpFeedback
());
$this
->
xml_writer
->
xmlElement
(
'JumpConditionFalseFeedback'
,
null
,
$jumpCondition
->
getFalseFeedback
());
/**
* Default ilias questionpool export
$this
->
xml_writer
->
xmlEndTag
(
'JumpCondition'
);
*/
}
protected
function
exportQuestions
()
{
$this
->
xml_writer
->
xmlEndTag
(
'JumpConditions'
);
// write qti file
}
ilUtil
::
makeDirParents
(
$this
->
export_dir
);
$qti_file
=
fopen
(
$this
->
export_dir
.
"/"
.
$this
->
qti_filename
,
"w"
);
/**
fwrite
(
$qti_file
,
$this
->
qpl_obj
->
questionsToXML
(
$this
->
questions
));
* Default ilias questionpool export
fclose
(
$qti_file
);
*/
}
protected
function
exportQuestions
()
{
/**
// write qti file
* @param $a_export_dir
ilUtil
::
makeDirParents
(
$this
->
export_dir
);
*/
$qti_file
=
fopen
(
$this
->
export_dir
.
"/"
.
$this
->
qti_filename
,
"w"
);
public
function
exportXHTMLMediaObjects
(
$a_export_dir
)
fwrite
(
$qti_file
,
$this
->
qpl_obj
->
questionsToXML
(
$this
->
questions
));
{
fclose
(
$qti_file
);
ilUtil
::
makeDirParents
(
$a_export_dir
.
"/objects/"
);
}
foreach
(
$this
->
questions
as
$question_id
)
{
/**
$mobs
=
ilObjMediaObject
::
_getMobsOfObject
(
"qpl:html"
,
$question_id
);
* @param $a_export_dir
foreach
(
$mobs
as
$mob
)
{
*/
if
(
ilObjMediaObject
::
_exists
(
$mob
))
{
function
exportXHTMLMediaObjects
(
$a_export_dir
)
$mob_obj
=
new
ilObjMediaObject
(
$mob
);
{
$mob_obj
->
exportFiles
(
$a_export_dir
);
include_once
(
"./Services/MediaObjects/classes/class.ilObjMediaObject.php"
);
unset
(
$mob_obj
);
ilUtil
::
makeDirParents
(
$a_export_dir
.
"/objects/"
);
}
}
foreach
(
$this
->
questions
as
$question_id
)
}
{
}
$mobs
=
ilObjMediaObject
::
_getMobsOfObject
(
"qpl:html"
,
$question_id
);
foreach
(
$mobs
as
$mob
)
/**
{
* Main export method for single object export AND export within an container (crs, cat, ...)
if
(
ilObjMediaObject
::
_exists
(
$mob
))
* @param $a_entity
{
* @param $a_schema_version
$mob_obj
=
new
ilObjMediaObject
(
$mob
);
* @param $a_id
$mob_obj
->
exportFiles
(
$a_export_dir
);
* @return string
unset
(
$mob_obj
);
*/
}
public
function
getXmlRepresentation
(
$a_entity
,
$a_schema_version
,
$a_id
)
}
{
}
$ref_id
=
current
(
ilObject
::
_getAllReferences
(
$a_id
));
}
$date
=
time
();
/**
$this
->
export_dir
=
$this
->
getAbsoluteExportDirectory
();
* Main export method for single object export AND export within an container (crs, cat, ...)
$this
->
subdir
=
$date
.
"__"
.
IL_INST_ID
.
"__"
.
"xqsp"
.
"_"
.
$a_id
;
* @param $a_entity
$this
->
filename
=
$this
->
subdir
.
".xml"
;
* @param $a_schema_version
$this
->
qti_filename
=
"xqsp_qti.xml"
;
* @param $a_id
* @return string
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPool.php'
);
*/
public
function
getXmlRepresentation
(
$a_entity
,
$a_schema_version
,
$a_id
)
$this
->
object
=
new
ilObjQuestionSetPool
(
$ref_id
);
{
$this
->
xml_writer
=
new
ilXmlWriter
();
$ref_id
=
current
(
ilObject
::
_getAllReferences
(
$a_id
));
$this
->
qpl_obj
=
new
ilObjQuestionPool
();
$date
=
time
();
// get Log File
$this
->
export_dir
=
$this
->
getAbsoluteExportDirectory
();
ilUtil
::
makeDirParents
(
$this
->
getExportDirectory
());
$this
->
subdir
=
$date
.
"__"
.
IL_INST_ID
.
"__"
.
"xqsp"
.
"_"
.
$a_id
;
$this
->
initLogFile
();
$this
->
filename
=
$this
->
subdir
.
".xml"
;
$this
->
exportPagesXML
();
$this
->
qti_filename
=
"xqsp_qti.xml"
;
return
$this
->
xml_writer
->
xmlDumpMem
();
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPool.php'
);
}
$this
->
object
=
new
ilObjQuestionSetPool
(
$ref_id
);
/**
$this
->
xml_writer
=
new
ilXmlWriter
();
* @param $a_entity
* @return array
$this
->
qpl_obj
=
new
ilObjQuestionPool
();
*/
// get Log File
public
function
getValidSchemaVersions
(
$a_entity
)
ilUtil
::
makeDirParents
(
$this
->
getExportDirectory
());
{
$this
->
initLogFile
();
return
array
(
$this
->
exportPagesXML
();
'5.1.0'
=>
array
(
'namespace'
=>
'http://www.ilias.de/'
,
return
$this
->
xml_writer
->
xmlDumpMem
();
'xsd_file'
=>
'xqsp_5_1.xsd'
,
}
'uses_dataset'
=>
false
,
'min'
=>
'5.1.0'
,
/**
'max'
=>
'5.1.999'
* @param $a_entity
)
* @return array
);
*/
}
public
function
getValidSchemaVersions
(
$a_entity
)
{
/**
return
array
(
* @param $a_entity
'5.1.0'
=>
array
(
* @param $a_target_release
'namespace'
=>
'http://www.ilias.de/'
,
* @param array $a_ids
'xsd_file'
=>
'xqsp_5_1.xsd'
,
* @return array
'uses_dataset'
=>
false
,
*/
'min'
=>
'5.1.0'
,
public
function
getXmlExportHeadDependencies
(
$a_entity
,
$a_target_release
,
$a_ids
)
'max'
=>
'5.1.999'
{
)
if
(
"xqsp"
==
$a_entity
)
{
);
// Array von QSP obj_ids
}
$qpl_obj_ids
=
array
();
/**
global
$ilDB
,
$ilObjDataCache
;
* @param $a_entity
//qs.id, qs.questionsetpool_fi, qst.question_fi, qpl_qst.obj_fi,
* @param $a_target_release
$res
=
$ilDB
->
query
(
'
* @param array $a_ids
* @return array
*/
public
function
getXmlExportHeadDependencies
(
$a_entity
,
$a_target_release
,
$a_ids
)
{
if
(
"xqsp"
==
$a_entity
)
{
// Array von QSP obj_ids
$qpl_obj_ids
=
array
();
global
$ilDB
,
$ilObjDataCache
;
//qs.id, qs.questionsetpool_fi, qst.question_fi, qpl_qst.obj_fi,
$res
=
$ilDB
->
query
(
'
SELECT qpl_qst.question_id, qpl_qst.original_id
SELECT qpl_qst.question_id, qpl_qst.original_id
FROM rep_robj_xqsp_qs qs
FROM rep_robj_xqsp_qs qs
INNER JOIN rep_robj_xqsp_qs_qst qst ON qs.id = qst.questionset_fi
INNER JOIN rep_robj_xqsp_qs_qst qst ON qs.id = qst.questionset_fi
INNER JOIN qpl_questions qpl_qst ON qst.question_fi = qpl_qst.question_id
INNER JOIN qpl_questions qpl_qst ON qst.question_fi = qpl_qst.question_id
WHERE '
.
$ilDB
->
in
(
'qs.questionsetpool_fi'
,
$a_ids
,
false
,
'integer'
));
WHERE '
.
$ilDB
->
in
(
'qs.questionsetpool_fi'
,
$a_ids
,
false
,
'integer'
));
$org_qst_ids
=
array
();
$org_qst_ids
=
array
();
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res
))
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res
))
{
{
$ids
[]
=
$row
;
$ids
[]
=
$row
;
if
(
$row
[
'original_id'
]
!==
null
)
{
if
(
$row
[
'original_id'
]
!==
NULL
)
$org_qst_ids
[]
=
$row
[
'original_id'
];
{
}
else
{
$org_qst_ids
[]
=
$row
[
'original_id'
];
$org_qst_ids
[]
=
$row
[
'question_id'
];
}
}
else
}
{
$org_qst_ids
[]
=
$row
[
'question_id'
];
if
(
is_array
(
$org_qst_ids
)
&&
count
(
$org_qst_ids
)
>
0
)
{
}
$res_2
=
$ilDB
->
query
(
'SELECT obj_fi FROM qpl_questions WHERE '
.
$ilDB
->
in
(
'question_id'
,
$org_qst_ids
,
false
,
'integer'
));
}
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res_2
))
{
if
(
is_array
(
$org_qst_ids
)
&&
count
(
$org_qst_ids
)
>
0
)
if
(
$ilObjDataCache
->
lookupType
(
$row
[
'obj_fi'
])
==
'qpl'
)
{
{
$qpl_obj_ids
[
$row
[
'obj_fi'
]]
=
$row
[
'obj_fi'
];
$res_2
=
$ilDB
->
query
(
'SELECT obj_fi FROM qpl_questions WHERE '
.
$ilDB
->
in
(
'question_id'
,
$org_qst_ids
,
false
,
'integer'
));
}
}
while
(
$row
=
$ilDB
->
fetchAssoc
(
$res_2
))
}
{
if
(
$ilObjDataCache
->
lookupType
(
$row
[
'obj_fi'
])
==
'qpl'
)
return
array
(
array
(
{
"component"
=>
"Modules/TestQuestionPool"
,
$qpl_obj_ids
[
$row
[
'obj_fi'
]]
=
$row
[
'obj_fi'
];
"entity"
=>
"qpl"
,
}
"ids"
=>
array_unique
(
$qpl_obj_ids
)));
}
}
}
return
parent
::
getXmlExportHeadDependencies
();
return
array
(
array
(
}
"component"
=>
"Modules/TestQuestionPool"
,
"entity"
=>
"qpl"
,
"ids"
=>
array_unique
(
$qpl_obj_ids
)));
}
return
parent
::
getXmlExportHeadDependencies
();
}
}
}
classes/class.ilQuestionSetPoolImporter.php
View file @
381d5850
<?php
<?php
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
/* Copyright (c) 1998-2016 ILIAS open source, Extended GPL, see docs/LICENSE */
include_once
(
"./Services/Export/classes/class.ilXmlImporter.php"
);
include_once
(
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"
);
/**
/**
* Class ilQuestionSetPoolImporter
* Class ilQuestionSetPoolImporter
* @author Nadia Matuschek <nmatuschek@databay.de>
* @author Nadia Matuschek <nmatuschek@databay.de>
*/
*/
class
ilQuestionSetPoolImporter
extends
ilXmlImporter
class
ilQuestionSetPoolImporter
extends
ilXmlImporter
{
{
const
SINGLE_IMPORT_NEW_POOL
=
-
1
;
const
SINGLE_IMPORT_NEW_POOL
=
-
1
;
const
SINGLE_IMPORT_NO_POOL
=
-
2
;
const
SINGLE_IMPORT_NO_POOL
=
-
2
;
/**
/**
* @var ilObjQuestionPool
* @var ilObjQuestionPool
*/
*/
protected
$qpl_obj
=
NULL
;
protected
$qpl_obj
=
null
;
protected
$is_single_import
=
true
;
protected
$is_single_import
=
true
;
/**
/**
* @var int[]
* @var int[]
*/
*/
protected
static
$pool_by_parent_id
=
array
();
protected
static
$pool_by_parent_id
=
array
();
protected
$current_parent_ref_id
=
0
;
protected
$current_parent_ref_id
=
0
;
/**
/**
* @var null
* @var null
*/
*/
protected
$xml_file
=
NULL
;
protected
$xml_file
=
null
;
/**
/**
* @var null
* @var null
*/
*/
protected
$qti_file
=
NULL
;
protected
$qti_file
=
null
;
/**
/**
* @var array
* @var array
*/
*/
protected
$qpl_qst_mapping
=
array
();
protected
$qpl_qst_mapping
=
array
();
/**
/**
* @param $xml_file
* @param $xml_file
*/
*/
private
function
setXmlFile
(
$xml_file
)
private
function
setXmlFile
(
$xml_file
)
{
{
$this
->
xml_file
=
$xml_file
;
$this
->
xml_file
=
$xml_file
;
}
}
public
function
getXmlFile
()
public
function
getXmlFile
()
{
{
return
$this
->
xml_file
;
return
$this
->
xml_file
;
}
}
/**
/**
* @param $qti_file
* @param $qti_file
*/
*/
public
function
setQtiFile
(
$qti_file
)
public
function
setQtiFile
(
$qti_file
)
{
{
$this
->
qti_file
=
$qti_file
;
$this
->
qti_file
=
$qti_file
;
}
}
public
function
getQtiFile
()
public
function
getQtiFile
()
{
{
return
$this
->
qti_file
;
return
$this
->
qti_file
;
}
}
/**
/**
* ilQuestionSetPoolImporter constructor.
* ilQuestionSetPoolImporter constructor.
*/
*/
public
function
__construct
()
public
function
__construct
()
{
{
$this
->
plugin_object
=
ilQuestionSetPoolPlugin
::
getInstance
();
$this
->
plugin_object
=
ilQuestionSetPoolPlugin
::
getInstance
();
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolSet.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolPath.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolNode.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
$this
->
plugin_object
->
includeClass
(
'models/class.ilQuestionSetPoolJumpCondition.php'
);
}
}
public
function
init
()
public
function
init
()
{
{
$qti_path
=
$this
->
getImportDirectory
()
.
'/Plugins/xqsp/set_1/expDir_1'
;
$qti_path
=
$this
->
getImportDirectory
()
.
'/Plugins/xqsp/set_1/expDir_1'
;
$qti_file
=
$qti_path
.
'/xqsp_qti.xml'
;
$qti_file
=
$qti_path
.
'/xqsp_qti.xml'
;
$xml_file
=
$this
->
getImportDirectory
()
.
'/Plugins/xqsp/set_1/export.xml'
;
$xml_file
=
$this
->
getImportDirectory
()
.
'/Plugins/xqsp/set_1/export.xml'
;
$this
->
validateXmlFile
(
$xml_file
);
$this
->
validateXmlFile
(
$xml_file
);
$this
->
setQtiFile
(
$qti_file
);
$this
->
setQtiFile
(
$qti_file
);
}
}
/**
/**
* @param $xml_file
* @param $xml_file
*/
*/
public
function
validateXmlFile
(
$xml_file
)
public
function
validateXmlFile
(
$xml_file
)
{
{
$this
->
plugin_object
->
includeClass
(
'class.ilQuestionSetPoolXmlValidator.php'
);
$this
->
plugin_object
->
includeClass
(
'class.ilQuestionSetPoolXmlValidator.php'
);
$validator
=
new
ilQuestionSetPoolXmlValidator
();
$validator
=
new
ilQuestionSetPoolXmlValidator
();
$validator
->
setXsdFile
(
'/xml/xqsp_5_1.xsd'
);
$validator
->
setXsdFile
(
'/xml/xqsp_5_1.xsd'
);
$validator
->
setXmlFile
(
$xml_file
);
$validator
->
setXmlFile
(
$xml_file
);
$validator
->
validate
();
$validator
->
validate
();
$this
->
setXmlFile
(
$xml_file
);
$this
->
setXmlFile
(
$xml_file
);
return
true
;
return
true
;
}
}
/**
/**
*
*
*/
*/
public
function
createImportDirectory
()
public
function
createImportDirectory
()
{
{
global
$ilErr
;
global
$ilErr
;
include_once
"./Services/Utilities/classes/class.ilUtil.php"
;
$xqsp_data_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
;
$xqsp_data_dir
=
ilUtil
::
getDataDir
()
.
"/xqsp_data"
;
ilUtil
::
makeDir
(
$xqsp_data_dir
);
ilUtil
::
makeDir
(
$xqsp_data_dir
);
if
(
!
is_writable
(
$xqsp_data_dir
))
{
if
(
!
is_writable
(
$xqsp_data_dir
))
$ilErr
->
raiseError
(
"QuestionSetPool Data Directory ("
.
$xqsp_data_dir
.
") not writeable."
,
$ilErr
->
error_obj
->
FATAL
);
{
}
$ilErr
->
raiseError
(
"QuestionSetPool Data Directory ("
.
$xqsp_data_dir
.
") not writeable."
,
$ilErr
->
error_obj
->
FATAL
);
}
// create QuestionSetPool directory (data_dir/xqsp_data/xqsp_import)
$import_dir
=
$xqsp_data_dir
.
"/xqsp_import"
;
// create QuestionSetPool directory (data_dir/xqsp_data/xqsp_import)
ilUtil
::
makeDir
(
$import_dir
);
$import_dir
=
$xqsp_data_dir
.
"/xqsp_import"
;
if
(
!@
is_dir
(
$import_dir
))
{
ilUtil
::
makeDir
(
$import_dir
);
$ilErr
->
raiseError
(
"Creation of QuestionSetPool import directory failed."
,
$ilErr
->
error_obj
->
FATAL
);
if
(
!@
is_dir
(
$import_dir
))
}
{
$ilErr
->
raiseError
(
"Creation of QuestionSetPool import directory failed."
,
$ilErr
->
error_obj
->
FATAL
);
$this
->
setImportDirectory
(
$import_dir
);
}
}
$this
->
setImportDirectory
(
$import_dir
);
public
function
initializeQplObject
(
$id
)
}
{
if
(
$id
<=
0
)
{
public
function
initializeQplObject
(
$id
)
$this
->
qpl_obj
=
$this
->
createQplObject
();
{
}
else
{
if
(
$id
<=
0
)
$this
->
qpl_obj
=
new
ilObjQuestionPool
(
$id
,
false
);
{
$this
->
qpl_obj
->
read
(
true
);
$this
->
qpl_obj
=
$this
->
createQplObject
();
}
}
}
else
{
/**
$this
->
qpl_obj
=
new
ilObjQuestionPool
(
$id
,
false
);
* Creates a new questionpool object
$this
->
qpl_obj
->
read
(
true
);
*
}
* copied from ilObjQuestionPoolGUI->importVerifiedFileObject()
}
*/
public
function
createQplObject
()
/**
{
* Creates a new questionpool object
// create new questionpool object
*
$qpl_obj
=
new
ilObjQuestionPool
(
0
,
true
);
* copied from ilObjQuestionPoolGUI->importVerifiedFileObject()
// set type of questionpool object
*/
$qpl_obj
->
setType
(
'qpl'
);
public
function
createQplObject
()
// set title of questionpool object to "dummy"
{
$qpl_obj
->
setTitle
(
"dummy"
);
// create new questionpool object
// set description of questionpool object
$qpl_obj
=
new
ilObjQuestionPool
(
0
,
true
);
$qpl_obj
->
setDescription
(
"questionpool creation"
);
// set type of questionpool object
// set online
$qpl_obj
->
setType
(
'qpl'
);
$qpl_obj
->
setOnline
(
true
);
// set title of questionpool object to "dummy"
// create the questionpool class in the ILIAS database (object_data table)
$qpl_obj
->
setTitle
(
"dummy"
);
$qpl_obj
->
create
(
true
);
// set description of questionpool object
// create a reference for the questionpool object in the ILIAS database (object_reference table)
$qpl_obj
->
setDescription
(
"questionpool creation"
);
$qpl_obj
->
createReference
();
// set online
$qpl_obj
->
setOnline
(
true
);
$qpl_obj
->
update
();
// create the questionpool class in the ILIAS database (object_data table)
$qpl_obj
->
saveToDb
();
$qpl_obj
->
create
(
true
);
return
$qpl_obj
;
// create a reference for the questionpool object in the ILIAS database (object_reference table)
}
$qpl_obj
->
createReference
();
/**
$qpl_obj
->
update
();
* Import questions to QPL questionpool
$qpl_obj
->
saveToDb
();
*/
return
$qpl_obj
;
protected
function
parseQtiFile
()
}
{
//@important do not delete this $_SESSION handling!!
/**
$tmp_dir
=
ilObjQuestionPool
::
_getImportDirectory
();
* Import questions to QPL questionpool
ilObjQuestionPool
::
_setImportDirectory
(
$this
->
getImportDirectoryBase
());
*/
protected
function
parseQtiFile
()
{
//@important do not delete this $_SESSION handling!!
include_once
"./Modules/TestQuestionPool/classes/class.ilObjQuestionPool.php"
;
$tmp_dir
=
ilObjQuestionPool
::
_getImportDirectory
();
ilObjQuestionPool
::
_setImportDirectory
(
$this
->
getImportDirectoryBase
());
$tmp_subdir
=
$_SESSION
[
"qpl_import_subdir"
];
$tmp_subdir
=
$_SESSION
[
"qpl_import_subdir"
];
$_SESSION
[
"qpl_import_subdir"
]
=
basename
(
$this
->
getImportDirectory
());
$_SESSION
[
"qpl_import_subdir"
]
=
basename
(
$this
->
getImportDirectory
());
// start parsing of QTI files
// start parsing of QTI files
include_once
"./Services/QTI/classes/class.ilQTIParser.php"
;
$qtiParser
=
new
ilQTIParser
(
$this
->
getQtiFile
(),
IL_MO_PARSE_QTI
,
$this
->
xqsp_obj
->
getId
());
$qtiParser
=
new
ilQTIParser
(
$this
->
getQtiFile
(),
IL_MO_PARSE_QTI
,
$this
->
xqsp_obj
->
getId
());
$result
=
$qtiParser
->
startParsing
();
$result
=
$qtiParser
->
startParsing
();
$this
->
addQuestionMapping
(
$qtiParser
->
getImportMapping
());
$this
->
addQuestionMapping
(
$qtiParser
->
getImportMapping
());
ilObjQuestionPool
::
_setImportDirectory
(
$tmp_dir
);
ilObjQuestionPool
::
_setImportDirectory
(
$tmp_dir
);
$_SESSION
[
"qpl_import_subdir"
]
=
$tmp_subdir
;
$_SESSION
[
"qpl_import_subdir"
]
=
$tmp_subdir
;
}
}
protected
function
addQuestionMapping
(
$qtiParser_import_mapping
)
protected
function
addQuestionMapping
(
$qtiParser_import_mapping
)
{
{
foreach
(
$qtiParser_import_mapping
as
$question_ident
=>
$pool_qst_ident
)
foreach
(
$qtiParser_import_mapping
as
$question_ident
=>
$pool_qst_ident
)
{
{
$exp_ident
=
explode
(
'_qst_'
,
$question_ident
);
$exp_ident
=
explode
(
'_qst_'
,
$question_ident
);
$old_qst_id
=
end
(
$exp_ident
);
$old_qst_id
=
end
(
$exp_ident
);
$new_qst_id
=
$pool_qst_ident
[
'pool'
];
$new_qst_id
=
$pool_qst_ident
[
'pool'
];
$this
->
qpl_qst_mapping
[
$old_qst_id
]
=
$new_qst_id
;
$this
->
qpl_qst_mapping
[
$old_qst_id
]
=
$new_qst_id
;
}
}
}
}
/**
/**
* @param array $set_data
* @param array $set_data
* @param array $set_questions
* @param array $set_questions
* @param array $set_paths
* @param array $set_paths
*/
*/
public
function
importQuestionSet
(
$set_data
,
$set_questions
,
$set_paths
,
$a_mapping
)
public
function
importQuestionSet
(
$set_data
,
$set_questions
,
$set_paths
,
$a_mapping
)
{
{
$set
=
new
ilQuestionSetPoolSet
();
$set
=
new
ilQuestionSetPoolSet
();
$set
->
setContainerObjId
(
$this
->
xqsp_obj
->
getId
());
$set
->
setContainerObjId
(
$this
->
xqsp_obj
->
getId
());
$set
->
setTitle
(
$set_data
[
'SetTitle'
]);
$set
->
setTitle
(
$set_data
[
'SetTitle'
]);
$set
->
setDescription
(
$set_data
[
'SetDescription'
]);
$set
->
setDescription
(
$set_data
[
'SetDescription'
]);
$set
->
setOriginalId
(
$set_data
[
'OriginialId'
]);
$set
->
setOriginalId
(
$set_data
[
'OriginialId'
]);
$set
->
update
();
$set
->
update
();
$this
->
addSetMapping
(
$set_data
[
'SetId'
],
$set
->
getId
());
$this
->
addSetMapping
(
$set_data
[
'SetId'
],
$set
->
getId
());
foreach
(
$set_questions
as
$set_question
)
foreach
(
$set_questions
as
$set_question
)
{
{
$original_question_id
=
$a_mapping
->
getMapping
(
'Modules/TestQuestionPool'
,
'quest'
,
$set_question
[
'QuestionOriginalId'
]);
$original_question_id
=
$a_mapping
->
getMapping
(
'Modules/TestQuestionPool'
,
'quest'
,
$set_question
[
'QuestionOriginalId'
]);
if
(
$original_question_id
)
{
if
(
$original_question_id
)
if
(
!
assQuestion
::
_questionExistsInPool
(
$original_question_id
))
{
{
$original_question_id
=
null
;
if
(
!
assQuestion
::
_questionExistsInPool
(
$original_question_id
))
}
{
}
$original_question_id
=
NULL
;
}
}
$copy_id
=
$set
->
getQuestionList
()
->
import
(
$this
->
qpl_qst_mapping
[
$set_question
[
'QuestionId'
]],
$original_question_id
);
$copy_id
=
$set
->
getQuestionList
()
->
import
(
$this
->
qpl_qst_mapping
[
$set_question
[
'QuestionId'
]],
$original_question_id
);
$this
->
qpl_qst_mapping
[
$set_question
[
'QuestionId'
]]
=
$copy_id
;
$this
->
qpl_qst_mapping
[
$set_question
[
'QuestionId'
]]
=
$copy_id
;
if
(
$original_question_id
==
0
||
$this
->
is_single_import
)
if
(
$original_question_id
==
0
||
$this
->
is_single_import
)
{
{
$this
->
qpl_qst_mapping
[
'new_qpl'
][
$set_question
[
'QuestionId'
]]
=
$copy_id
;
$this
->
qpl_qst_mapping
[
'new_qpl'
][
$set_question
[
'QuestionId'
]]
=
$copy_id
;
if
(
$set_question
[
'QuestionOriginalId'
])
{
if
(
$set_question
[
'QuestionOriginalId'
])
$a_mapping
->
addMapping
(
'Plugins/xqsp'
,
'org_qst_id'
,
$set_question
[
'QuestionOriginalId'
],
$copy_id
);
{
}
$a_mapping
->
addMapping
(
'Plugins/xqsp'
,
'org_qst_id'
,
$set_question
[
'QuestionOriginalId'
],
$copy_id
);
}
else
{
}
$this
->
qpl_qst_mapping
[
'new_qpl'
][
$set_question
[
'QuestionId'
]]
=
$original_question_id
;
}
}
else
}
{
$this
->
qpl_qst_mapping
[
'new_qpl'
][
$set_question
[
'QuestionId'
]]
=
$original_question_id
;
}
}
foreach
(
$set_paths
as
$set_path
)
foreach
(
$set_paths
as
$set_path
)
{
{
$path
=
new
ilQuestionSetPoolPath
();
$path
=
new
ilQuestionSetPoolPath
();
$path
->
setSet
(
$set
);
$path
->
setSet
(
$set
);
$path
->
setTitle
(
$set_path
[
0
][
'PathTitle'
]);
$path
->
setTitle
(
$set_path
[
0
][
'PathTitle'
]);
$path
->
import
();
$path
->
import
();
$this
->
addPathMapping
(
$set_data
[
0
][
'PathId'
],
$path
->
getId
());
$this
->
addPathMapping
(
$set_data
[
0
][
'PathId'
],
$path
->
getId
());
$nodes
=
$set_path
[
'nodes'
];
$nodes
=
$set_path
[
'nodes'
];
$this
->
importNodes
(
$nodes
,
$path
);
$this
->
importNodes
(
$nodes
,
$path
);
}
}
}
}
/**
/**
* @param array $nodes
* @param array $nodes
* @param ilQuestionSetPoolPath $path
* @param ilQuestionSetPoolPath $path
*/
*/
protected
function
importNodes
(
$nodes
,
ilQuestionSetPoolPath
$path
)
protected
function
importNodes
(
$nodes
,
ilQuestionSetPoolPath
$path
)
{
{
foreach
(
$nodes
as
$node_data
)
foreach
(
$nodes
as
$node_data
)
{
{
$node
=
new
ilQuestionSetPoolNode
();
$node
=
new
ilQuestionSetPoolNode
();
$node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$this
->
qpl_qst_mapping
[
$node_data
[
0
][
'NodeQuestionId'
]]));
$node
->
setQuestion
(
assQuestion
::
_instantiateQuestion
(
$this
->
qpl_qst_mapping
[
$node_data
[
0
][
'NodeQuestionId'
]]));
$node
->
setPath
(
$path
);
$node
->
setPath
(
$path
);
$node
->
setInitialCondition
(
$node_data
[
0
][
'NodeInitialCondition'
]);
$node
->
setInitialCondition
(
$node_data
[
0
][
'NodeInitialCondition'
]);
if
(
strlen
(
$node_data
[
0
][
'NodeDominantScoring'
]))
{
if
(
strlen
(
$node_data
[
0
][
'NodeDominantScoring'
]))
$node
->
setDominantScoring
(
$node_data
[
0
][
'NodeDominantScoring'
]);
{
}
$node
->
setDominantScoring
(
$node_data
[
0
][
'NodeDominantScoring'
]);
$node
->
setTrueFeedback
(
$node_data
[
0
][
'NodeTrueFeedback'
]);
}
$node
->
setFalseFeedback
(
$node_data
[
0
][
'NodeFalseFeedback'
]);
$node
->
setTrueFeedback
(
$node_data
[
0
][
'NodeTrueFeedback'
]);
$node
->
setFalseFeedback
(
$node_data
[
0
][
'NodeFalseFeedback'
]);
$node
->
import
();
$node
->
import
();
$this
->
addNodeMapping
(
$node_data
[
0
][
'NodeId'
],
$node
->
getId
());
$this
->
addNodeMapping
(
$node_data
[
0
][
'NodeId'
],
$node
->
getId
());
$jump_conditions
=
$node_data
[
'jump_conditions'
];
if
(
is_array
(
$jump_conditions
)
&&
count
(
$jump_conditions
)
==
0
)
{
$jump_conditions
=
$node_data
[
'jump_conditions'
];
continue
1
;
if
(
is_array
(
$jump_conditions
)
&&
count
(
$jump_conditions
)
==
0
)
}
{
$this
->
importJumpConditions
(
$jump_conditions
,
$node
);
continue
1
;
}
}
}
$this
->
importJumpConditions
(
$jump_conditions
,
$node
);
}
/**
}
* @param array $jump_conditions
* @param ilQuestionSetPoolNode $node
/**
*/
* @param array $jump_conditions
protected
function
importJumpConditions
(
$jump_conditions
,
ilQuestionSetPoolNode
$node
)
* @param ilQuestionSetPoolNode $node
{
*/
foreach
(
$jump_conditions
as
$jump_condition_data
)
{
protected
function
importJumpConditions
(
$jump_conditions
,
ilQuestionSetPoolNode
$node
)
$jump_con
=
new
ilQuestionSetPoolJumpCondition
();
{
$jump_con
->
setNode
(
$node
);
foreach
(
$jump_conditions
as
$jump_condition_data
)
$jump_con
->
setQuestion
(
{
$this
->
qpl_qst_mapping
[
$jump_condition_data
[
'JumpConditionQuestionId'
]]
?
$jump_con
=
new
ilQuestionSetPoolJumpCondition
();
assQuestion
::
_instantiateQuestion
(
$this
->
qpl_qst_mapping
[
$jump_condition_data
[
'JumpConditionQuestionId'
]])
:
$jump_con
->
setNode
(
$node
);
null
$jump_con
->
setQuestion
(
);
$this
->
qpl_qst_mapping
[
$jump_condition_data
[
'JumpConditionQuestionId'
]]
?
$jump_con
->
setJumpCondition
(
$jump_condition_data
[
'JumpConditionText'
]);
assQuestion
::
_instantiateQuestion
(
$this
->
qpl_qst_mapping
[
$jump_condition_data
[
'JumpConditionQuestionId'
]])
:
if
(
strlen
(
$jump_condition_data
[
'JumpConditionRepetitions'
]))
{
NULL
$jump_con
->
setRepititions
(
$jump_condition_data
[
'JumpConditionRepetitions'
]);
);
}
$jump_con
->
setJumpCondition
(
$jump_condition_data
[
'JumpConditionText'
]);
if
(
strlen
(
$jump_condition_data
[
'JumpConditionRepetitions'
]))
{
$jump_con
->
setRepititions
(
$jump_condition_data
[
'JumpConditionRepetitions'
]);
}
$jump_con
->
setTrueFeedback
(
$jump_condition_data
[
'JumpConditionTrueFeedback'
]);
$jump_con
->
setTrueFeedback
(
$jump_condition_data
[
'JumpConditionTrueFeedback'
]);
$jump_con
->
setTrueJumpFeedback
(
$jump_condition_data
[
'JumpConditionTrueJumpFeedback'
]);
$jump_con
->
setTrueJumpFeedback
(
$jump_condition_data
[
'JumpConditionTrueJumpFeedback'
]);
$jump_con
->
setFalseFeedback
(
$jump_condition_data
[
'JumpConditionFalseFeedback'
]);
$jump_con
->
setFalseFeedback
(
$jump_condition_data
[
'JumpConditionFalseFeedback'
]);
$jump_con
->
import
();
$jump_con
->
import
();
}
}
}
}
/**
/**
* @param $old_set_id
* @param $old_set_id
* @param $new_set_id
* @param $new_set_id
*/
*/
protected
function
addSetMapping
(
$old_set_id
,
$new_set_id
)
protected
function
addSetMapping
(
$old_set_id
,
$new_set_id
)
{
{
$this
->
set_mapping
[
$old_set_id
]
=
$new_set_id
;
$this
->
set_mapping
[
$old_set_id
]
=
$new_set_id
;
}
}
/**
/**
* @param $old_path_id
* @param $old_path_id
* @param $new_path_id
* @param $new_path_id
*/
*/
protected
function
addPathMapping
(
$old_path_id
,
$new_path_id
)
protected
function
addPathMapping
(
$old_path_id
,
$new_path_id
)
{
{
$this
->
path_mapping
[
$old_path_id
]
=
$new_path_id
;
$this
->
path_mapping
[
$old_path_id
]
=
$new_path_id
;
}
}
/**
/**
* @param $old_node_id
* @param $old_node_id
* @param $new_node_id
* @param $new_node_id
*/
*/
protected
function
addNodeMapping
(
$old_node_id
,
$new_node_id
)
protected
function
addNodeMapping
(
$old_node_id
,
$new_node_id
)
{
{
$this
->
node_mapping
[
$old_node_id
]
=
$new_node_id
;
$this
->
node_mapping
[
$old_node_id
]
=
$new_node_id
;
}
}
/**
/**
* Import XML
* Import XML
* @param $a_entity
* @param $a_entity
* @param $a_id
* @param $a_id
* @param $a_xml
* @param $a_xml
* @param $a_mapping
* @param $a_mapping
* @return bool
* @return bool
*/
*/
function
importXmlRepresentation
(
$a_entity
,
$a_id
,
$a_xml
,
$a_mapping
)
public
function
importXmlRepresentation
(
$a_entity
,
$a_id
,
$a_xml
,
$a_mapping
)
{
{
/**
/**
* @var $tree ilTree
* @var $tree ilTree
*/
*/
global
$tree
;
global
$tree
;
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPool.php'
);
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPool.php'
);
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPoolXMLParser.php'
);
$this
->
plugin_object
->
includeClass
(
'class.ilObjQuestionSetPoolXMLParser.php'
);
$parent_ref_id
=
0
;
$parent_ref_id
=
0
;
if
(
$new_id
=
$a_mapping
->
getMapping
(
'Services/Container'
,
'objs'
,
$a_id
))
if
(
$new_id
=
$a_mapping
->
getMapping
(
'Services/Container'
,
'objs'
,
$a_id
))
{
{
$ref_ids
=
ilObject
::
_getAllReferences
(
$new_id
);
$ref_ids
=
ilObject
::
_getAllReferences
(
$new_id
);
$ref_id
=
current
(
$ref_ids
);
$ref_id
=
current
(
$ref_ids
);
$parent_ref_id
=
$tree
->
getParentId
(
$ref_id
);
$parent_ref_id
=
$tree
->
getParentId
(
$ref_id
);
$this
->
xqsp_obj
=
ilObjectFactory
::
getInstanceByObjId
(
$new_id
,
false
);
$this
->
xqsp_obj
=
ilObjectFactory
::
getInstanceByObjId
(
$new_id
,
false
);
$this
->
xqsp_obj
->
setRefId
(
$ref_id
);
$this
->
xqsp_obj
->
setRefId
(
$ref_id
);
$this
->
is_single_import
=
false
;
$this
->
is_single_import
=
false
;
}
else
{
}
$this
->
xqsp_obj
=
new
ilObjQuestionSetPool
();
else
$this
->
xqsp_obj
->
create
(
true
);
{
$this
->
is_single_import
=
true
;
$this
->
xqsp_obj
=
new
ilObjQuestionSetPool
();
}
$this
->
xqsp_obj
->
create
(
true
);
$this
->
is_single_import
=
true
;
$this
->
current_parent_ref_id
=
$parent_ref_id
;
}
// import questions to QPL questionpool
$this
->
current_parent_ref_id
=
$parent_ref_id
;
$this
->
parseQtiFile
();
// import questions to QPL questionpool
$this
->
parseQtiFile
();
$parser
=
new
ilObjQuestionSetPoolXMLParser
(
$this
->
xqsp_obj
,
$this
->
getXmlFile
());
$parser
=
new
ilObjQuestionSetPoolXMLParser
(
$this
->
xqsp_obj
,
$this
->
getXmlFile
());
$parser
->
setImportDirectory
(
$this
->
getImportDirectory
());
$parser
->
setImportDirectory
(
$this
->
getImportDirectory
());
$parser
->
startParsing
();
$parser
->
startParsing
();
$this
->
xqsp_obj
=
$parser
->
getQuestionSetPoolObject
();
$this
->
xqsp_obj
=
$parser
->
getQuestionSetPoolObject
();
$this
->
xqsp_obj
->
update
();
$this
->
xqsp_obj
->
update
();
// create sets
// create sets
$sets
=
$parser
->
getSetsArray
();
$sets
=
$parser
->
getSetsArray
();
foreach
(
$sets
as
$set_data
)
foreach
(
$sets
as
$set_data
)
{
{
$this
->
importQuestionSet
(
$set_data
[
0
],
$set_data
[
'questions'
],
$set_data
[
'paths'
],
$a_mapping
);
$this
->
importQuestionSet
(
$set_data
[
0
],
$set_data
[
'questions'
],
$set_data
[
'paths'
],
$a_mapping
);
}
}
$a_mapping
->
addMapping
(
'Plugins/xqsp'
,
'xqsp'
,
$a_id
,
$this
->
xqsp_obj
->
getId
());
$a_mapping
->
addMapping
(
'Plugins/xqsp'
,
'xqsp'
,
$a_id
,
$this
->
xqsp_obj
->
getId
());
}
}
public
function
finalProcessing
(
$a_mapping
)
function
finalProcessing
(
$a_mapping
)
{
{
// Container import
// Container import
// Prüfen, ob in einer statischen Variable (z.B. self::$pool_by_parent[$this->current_parent_ref_id] schon eine Pool ID existiert
// Prüfen, ob in einer statischen Variable (z.B. self::$pool_by_parent[$this->current_parent_ref_id] schon eine Pool ID existiert
// Wenn ja, diesen Pool nehmen (sofern Bedarf für neue Originale)
// Wenn ja, diesen Pool nehmen (sofern Bedarf für neue Originale)
// Wenn nein, neuen Pool auf dieser Ebene -> mit putInTree($this->current_parent_ref_id) einhängen,
// Wenn nein, neuen Pool auf dieser Ebene -> mit putInTree($this->current_parent_ref_id) einhängen,
// und dann dessen ID hier merken: self::$pool_by_parent[$this->current_parent_ref_id]
// und dann dessen ID hier merken: self::$pool_by_parent[$this->current_parent_ref_id]
// Einzel-Import mit (ggf. erfolgter Wahl eines bestehenden Fragenpools als Ziel für Originale unserer Fragen)
// Einzel-Import mit (ggf. erfolgter Wahl eines bestehenden Fragenpools als Ziel für Originale unserer Fragen)
$new_qpl_id
=
(
int
)
$_POST
[
'qpl'
];
$new_qpl_id
=
(
int
)
$_POST
[
'qpl'
];
if
(
$_POST
[
'qpl'
]
==
self
::
SINGLE_IMPORT_NO_POOL
)
{
if
(
$_POST
[
'qpl'
]
==
self
::
SINGLE_IMPORT_NO_POOL
)
//Die neuen Fragen 'ohne pool' liegen schon im XQSP.
{
}
else
{
//Die neuen Fragen 'ohne pool' liegen schon im XQSP.
if
(
$new_qpl_id
>
0
)
{
}
$this
->
initializeQplObject
(
$new_qpl_id
);
else
}
{
// Containter-Import (Plugin liegt im Kurs, die Originale unserer Fragen liegen ggf.(!!) in ebenfalls importierten Fragenpools)
if
(
$new_qpl_id
>
0
)
elseif
(
$this
->
is_single_import
||
(
is_array
(
$this
->
qpl_qst_mapping
[
'new_qpl'
])
&&
count
(
$this
->
qpl_qst_mapping
[
'new_qpl'
])
>
0
))
{
{
$parent_ref_id
=
$a_mapping
->
getTargetId
();
$this
->
initializeQplObject
(
$new_qpl_id
);
if
(
!
$this
->
is_single_import
&&
$this
->
current_parent_ref_id
>
0
)
{
}
$parent_ref_id
=
$this
->
current_parent_ref_id
;
// Containter-Import (Plugin liegt im Kurs, die Originale unserer Fragen liegen ggf.(!!) in ebenfalls importierten Fragenpools)
}
else
if
(
$this
->
is_single_import
||
(
is_array
(
$this
->
qpl_qst_mapping
[
'new_qpl'
])
&&
count
(
$this
->
qpl_qst_mapping
[
'new_qpl'
])
>
0
))
{
$parent_ref_id
=
$a_mapping
->
getTargetId
();
if
(
!
$this
->
is_single_import
&&
$this
->
current_parent_ref_id
>
0
)
{
$parent_ref_id
=
$this
->
current_parent_ref_id
;
}
if
(
isset
(
self
::
$pool_by_parent_id
[
$parent_ref_id
]))
if
(
isset
(
self
::
$pool_by_parent_id
[
$parent_ref_id
]))
{
{
$pool_obj_id
=
self
::
$pool_by_parent_id
[
$parent_ref_id
];
$pool_obj_id
=
self
::
$pool_by_parent_id
[
$parent_ref_id
];
$this
->
initializeQplObject
(
$pool_obj_id
);
$this
->
initializeQplObject
(
$pool_obj_id
);
}
else
{
}
// es handelt sich um einen dummy pool
else
$this
->
initializeQplObject
(
0
);
{
// put the questionpool object in the administration tree
// es handelt sich um einen dummy pool
$this
->
qpl_obj
->
putInTree
(
$parent_ref_id
);
$this
->
initializeQplObject
(
0
);
// get default permissions and set the permissions for the questionpool object
// put the questionpool object in the administration tree
$this
->
qpl_obj
->
setPermissions
(
$parent_ref_id
);
$this
->
qpl_obj
->
putInTree
(
$parent_ref_id
);
// get default permissions and set the permissions for the questionpool object
$this
->
qpl_obj
->
setPermissions
(
$parent_ref_id
);
self
::
$pool_by_parent_id
[
$parent_ref_id
]
=
$this
->
qpl_obj
->
getId
();
self
::
$pool_by_parent_id
[
$parent_ref_id
]
=
$this
->
qpl_obj
->
getId
();
}
}
}
}
foreach
(
$this
->
qpl_qst_mapping
[
'new_qpl'
]
as
$new_id
)
foreach
(
$this
->
qpl_qst_mapping
[
'new_qpl'
]
as
$new_id
)
{
{
//Die neuen Fragen 'ohne pool' liegen schon im XQSP.
//Die neuen Fragen 'ohne pool' liegen schon im XQSP.
// jetzt müssen sie in den neu angelegten dummy pool (QPL) kopiert werden und die org_id im xqsp-pool angepasst werden.
// jetzt müssen sie in den neu angelegten dummy pool (QPL) kopiert werden und die org_id im xqsp-pool angepasst werden.
$source_qst
=
assQuestion
::
_instantiateQuestion
(
$new_id
);
$source_qst
=
assQuestion
::
_instantiateQuestion
(
$new_id
);
$is_xqsp_pool
=
(
ilObject
::
_lookupType
(
$source_qst
->
getObjId
())
==
'xqsp'
?
true
:
false
);
$is_xqsp_pool
=
(
ilObject
::
_lookupType
(
$source_qst
->
getObjId
())
==
'xqsp'
?
true
:
false
);
// This is the intended behaviour, see http://www.ilias.de/mantis/view.php?id=18325
// This is the intended behaviour, see http://www.ilias.de/mantis/view.php?id=18325
if
((
$source_qst
->
getOriginalId
()
==
null
||
$this
->
is_single_import
)
&&
$is_xqsp_pool
)
{
if
((
$source_qst
->
getOriginalId
()
==
NULL
||
$this
->
is_single_import
)
&&
$is_xqsp_pool
)
// Dies ist nur für Fragen "ohne pool" relevant!!!!
{
$clone_id
=
$source_qst
->
copyObject
(
$this
->
qpl_obj
->
getId
());
// Dies ist nur für Fragen "ohne pool" relevant!!!!
$source_qst
=
assQuestion
::
_instantiateQuestion
(
$new_id
);
$clone_id
=
$source_qst
->
copyObject
(
$this
->
qpl_obj
->
getId
());
$source_qst
->
setNewOriginalId
(
$clone_id
);
$source_qst
=
assQuestion
::
_instantiateQuestion
(
$new_id
);
$source_qst
->
saveToDb
();
$source_qst
->
setNewOriginalId
(
$clone_id
);
}
$source_qst
->
saveToDb
();
}
}
}
}
return
parent
::
finalProcessing
(
$a_mapping
);
}
}
return
parent
::
finalProcessing
(
$a_mapping
);
}
/**
* Create qti and xml file name
/**
* @return array
* Create qti and xml file name
*/
* @return array
protected
function
parseXmlFileNames
()
*/
{
protected
function
parseXmlFileNames
()
$GLOBALS
[
'ilLog'
]
->
write
(
__METHOD__
.
': '
.
$this
->
getImportDirectory
());
{
$GLOBALS
[
'ilLog'
]
->
write
(
__METHOD__
.
': '
.
$this
->
getImportDirectory
());
$basename
=
basename
(
$this
->
getImportDirectory
());
$basename
=
basename
(
$this
->
getImportDirectory
());
$xml
=
$this
->
getImportDirectory
()
.
'/'
.
$basename
.
'.xml'
;
$xml
=
$this
->
getImportDirectory
()
.
'/'
.
$basename
.
'.xml'
;
$qti
=
$this
->
getImportDirectory
()
.
'/'
.
preg_replace
(
'/xqsp/'
,
'qti'
,
$basename
)
.
'.xml'
;
$qti
=
$this
->
getImportDirectory
()
.
'/'
.
preg_replace
(
'/xqsp/'
,
'qti'
,
$basename
)
.
'.xml'
;
return
array
(
$xml
,
$qti
);
return
array
(
$xml
,
$qti
);
}
}
private
function
getImportDirectoryBase
()
private
function
getImportDirectoryBase
()
{
{
$dir
=
$this
->
getImportDirectory
();
$dir
=
$this
->
getImportDirectory
();
$dir
=
dirname
(
$dir
);
$dir
=
dirname
(
$dir
);
return
$dir
;
return
$dir
;
}
}
/**
/**
* @param array $mapping
* @param array $mapping
*/
*/
public
function
setExternalQplQuestionMapping
(
array
$mapping
)
public
function
setExternalQplQuestionMapping
(
array
$mapping
)
{
{
$this
->
qpl_qst_mapping
=
$mapping
;
$this
->
qpl_qst_mapping
=
$mapping
;
}
}
public
function
getExternalQplQuestionMapping
()
public
function
getExternalQplQuestionMapping
()
{
{
return
$this
->
qpl_qst_mapping
;
return
$this
->
qpl_qst_mapping
;
}
}
}
}
Prev
1
2
3
4
5
6
7
Next