ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilDidacticTemplateSetting Class Reference
+ Collaboration diagram for ilDidacticTemplateSetting:

Public Member Functions

 __construct ($a_id=0)
 Constructor.
 getId ()
 Get id.
 enable ($a_status)
 Set enabled status.
 isEnabled ()
 Check if template is enabled.
 setTitle ($a_title)
 Set title.
 getTitle ()
 Get title.
 getDescription ()
 Get description.
 setDescription ($a_description)
 Set description.
 setInfo ($a_info)
 Set installation info text.
 getInfo ()
 Get installation info text.
 setType ($a_type)
 Set type.
 getType ()
 Get type.
 setAssignments (Array $a_ass)
 Set assignments.
 getAssignments ()
 Get object assignemnts.
 addAssignment ($a_obj_type)
 Add one assignment obj type.
 delete ()
 Delete settings.
 save ()
 Save settings.
 update ()
 Update settings ilDB $ilDB.
 toXml (ilXmlWriter $writer)
 Export.
 __clone ()
 Implemented clone method.

Data Fields

const TYPE_CREATION = 1

Protected Member Functions

 setId ($a_id)
 Set id.
 read ()
 read settings from db

Private Member Functions

 saveAssignments ()
 Save assignments in DB.
 saveAssignment ($a_obj_type)
 Add one object assignment ilDB $ilDB.
 deleteAssignments ()
 Delete assignments ilDB $ilDB.

Private Attributes

 $id = 0
 $enabled = false
 $title = ''
 $description = ''
 $info = ''
 $type = self::TYPE_CREATION
 $assignments = array()

Detailed Description

Definition at line 10 of file class.ilDidacticTemplateSetting.php.

Constructor & Destructor Documentation

ilDidacticTemplateSetting::__construct (   $a_id = 0)

Constructor.

Parameters
int$a_id

Definition at line 28 of file class.ilDidacticTemplateSetting.php.

References read(), and setId().

{
$this->setId($a_id);
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

ilDidacticTemplateSetting::__clone ( )

Implemented clone method.

Definition at line 395 of file class.ilDidacticTemplateSetting.php.

References enable(), and setId().

{
$this->setId(0);
$this->enable(false);
}

+ Here is the call graph for this function:

ilDidacticTemplateSetting::addAssignment (   $a_obj_type)

Add one assignment obj type.

Parameters
string$a_obj_type

Definition at line 164 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

{
$this->assignments[] = $a_obj_type;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::delete ( )

Delete settings.

Definition at line 172 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, ilDidacticTemplateObjSettings\deleteByTemplateId(), ilDidacticTemplateActionFactory\getActionsByTemplateId(), and getId().

{
global $ilDB;
// Delete settings
$query = 'DELETE FROM didactic_tpl_settings '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$ilDB->manipulate($query);
// Delete obj assignments
$query = 'DELETE FROM didactic_tpl_sa '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$ilDB->manipulate($query);
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
{
$action->delete();
}
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateSetting::deleteAssignments ( )
private

Delete assignments ilDB $ilDB.

Returns
bool

Definition at line 260 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, and getId().

Referenced by update().

{
global $ilDB;
$query = 'DELETE FROM didactic_tpl_sa '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$ilDB->manipulate($query);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::enable (   $a_status)

Set enabled status.

Parameters
bool$a_status

Definition at line 56 of file class.ilDidacticTemplateSetting.php.

Referenced by __clone(), and read().

{
$this->enabled = $a_status;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getAssignments ( )

Get object assignemnts.

Returns
array

Definition at line 155 of file class.ilDidacticTemplateSetting.php.

References $assignments.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), saveAssignments(), and toXml().

{
return (array) $this->assignments;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getDescription ( )

Get description.

Returns
string

Definition at line 92 of file class.ilDidacticTemplateSetting.php.

References $description.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), toXml(), and update().

{
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getId ( )

Get id.

Returns
int

Definition at line 47 of file class.ilDidacticTemplateSetting.php.

References $id.

Referenced by delete(), deleteAssignments(), ilDidacticTemplateImport\parseActions(), read(), save(), saveAssignment(), toXml(), and update().

{
return $this->id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getInfo ( )

Get installation info text.

Returns
string

Definition at line 119 of file class.ilDidacticTemplateSetting.php.

References $info.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), toXml(), and update().

{
return $this->info;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getTitle ( )

Get title.

Returns
string

Definition at line 83 of file class.ilDidacticTemplateSetting.php.

References $title.

Referenced by ilDidacticTemplateSettingsGUI\initEditTemplate(), save(), toXml(), and update().

{
return $this->title;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::getType ( )

Get type.

Returns
int

Definition at line 137 of file class.ilDidacticTemplateSetting.php.

References $type.

Referenced by save(), toXml(), and update().

{
return $this->type;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::isEnabled ( )

Check if template is enabled.

Returns
bool

Definition at line 65 of file class.ilDidacticTemplateSetting.php.

References $enabled.

Referenced by save(), and update().

{
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::read ( )
protected

read settings from db

Returns
bool

Read settings

Read assigned objects

Definition at line 297 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, $res, $row, addAssignment(), DB_FETCHMODE_OBJECT, enable(), getId(), setDescription(), setInfo(), setTitle(), and setType().

Referenced by __construct().

{
global $ilDB;
if(!$this->getId())
{
return false;
}
$query = 'SELECT * FROM didactic_tpl_settings dtpl '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->setType($row->type);
$this->enable($row->enabled);
$this->setTitle($row->title);
$this->setDescription($row->description);
$this->setInfo($row->info);
}
$query = 'SELECT * FROM didactic_tpl_sa '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->addAssignment($row->obj_type);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::save ( )

Save settings.

Definition at line 201 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, getDescription(), getId(), getInfo(), getTitle(), getType(), isEnabled(), saveAssignments(), and setId().

{
global $ilDB;
$this->setId($ilDB->nextId('didactic_tpl_settings'));
$query = 'INSERT INTO didactic_tpl_settings (id,enabled,title,description,info,type) '.
'VALUES( '.
$ilDB->quote($this->getId(),'integer').', '.
$ilDB->quote($this->isEnabled(),'integer').', '.
$ilDB->quote($this->getTitle(),'text').', '.
$ilDB->quote($this->getDescription(),'text').', '.
$ilDB->quote($this->getInfo(),'text').', '.
$ilDB->quote($this->getType(),'integer').
')';
$ilDB->manipulate($query);
$this->saveAssignments();
return true;
}

+ Here is the call graph for this function:

ilDidacticTemplateSetting::saveAssignment (   $a_obj_type)
private

Add one object assignment ilDB $ilDB.

Parameters
string$a_obj_type

Definition at line 243 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, and getId().

Referenced by saveAssignments().

{
global $ilDB;
$query = 'INSERT INTO didactic_tpl_sa (id,obj_type) '.
'VALUES( '.
$ilDB->quote($this->getId(),'integer').', '.
$ilDB->quote($a_obj_type,'text').
')';
$ilDB->manipulate($query);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::saveAssignments ( )
private

Save assignments in DB.

Returns
bool

Definition at line 229 of file class.ilDidacticTemplateSetting.php.

References getAssignments(), and saveAssignment().

Referenced by save(), and update().

{
foreach($this->getAssignments() as $ass)
{
$this->saveAssignment($ass);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::setAssignments ( Array  $a_ass)

Set assignments.

Parameters
array$a_ass

Definition at line 146 of file class.ilDidacticTemplateSetting.php.

{
$this->assignments = (array) $a_ass;
}
ilDidacticTemplateSetting::setDescription (   $a_description)

Set description.

Parameters
string$a_description

Definition at line 101 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

{
$this->description = $a_description;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::setId (   $a_id)
protected

Set id.

Parameters
int$a_id

Definition at line 38 of file class.ilDidacticTemplateSetting.php.

Referenced by __clone(), __construct(), and save().

{
$this->id = $a_id;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::setInfo (   $a_info)

Set installation info text.

Parameters
string$a_info

Definition at line 110 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

{
$this->info = $a_info;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

Definition at line 74 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

{
$this->title = $a_title;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::setType (   $a_type)

Set type.

Parameters
int$a_type

Definition at line 128 of file class.ilDidacticTemplateSetting.php.

Referenced by read().

{
$this->type = $a_type;
}

+ Here is the caller graph for this function:

ilDidacticTemplateSetting::toXml ( ilXmlWriter  $writer)

Export.

Parameters
ilXmlWriter$writer
Returns
ilXmlWriter

Definition at line 340 of file class.ilDidacticTemplateSetting.php.

References $info, $type, ilDidacticTemplateActionFactory\getActionsByTemplateId(), getAssignments(), getDescription(), getId(), getInfo(), getTitle(), getType(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

{
switch($this->getType())
{
case self::TYPE_CREATION:
$type = 'creation';
break;
}
$writer->xmlStartTag('didacticTemplate',array('type' => $type));
$writer->xmlElement('title',array(),$this->getTitle());
$writer->xmlElement('description', array(), $this->getDescription());
// info text with p-tags
if(strlen($this->getInfo()))
{
$writer->xmlStartTag('info');
$info_lines = (array) explode("\n",$this->getInfo());
foreach($info_lines as $info)
{
$trimmed_info = trim($info);
if(strlen($trimmed_info))
{
$writer->xmlElement('p', array(), $trimmed_info);
}
}
$writer->xmlEndTag('info');
}
// Assignments
$writer->xmlStartTag('assignments');
foreach($this->getAssignments() as $assignment)
{
$writer->xmlElement('assignment', array(), $assignment);
}
$writer->xmlEndTag('assignments');
$writer->xmlStartTag('actions');
include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateActionFactory.php';
{
$action->toXml($writer);
}
$writer->xmlEndTag('actions');
$writer->xmlEndTag('didacticTemplate');
return $writer;
}

+ Here is the call graph for this function:

ilDidacticTemplateSetting::update ( )

Update settings ilDB $ilDB.

Definition at line 274 of file class.ilDidacticTemplateSetting.php.

References $ilDB, $query, deleteAssignments(), getDescription(), getId(), getInfo(), getTitle(), getType(), isEnabled(), and saveAssignments().

{
global $ilDB;
$query = 'UPDATE didactic_tpl_settings '.
'SET '.
'enabled = '.$ilDB->quote($this->isEnabled(),'integer').', '.
'title = '.$ilDB->quote($this->getTitle(),'text').', '.
'description = '.$ilDB->quote($this->getDescription(),'text').', '.
'info = '.$ilDB->quote($this->getInfo(),'text').', '.
'type = '.$ilDB->quote($this->getType(),'integer').' '.
'WHERE id = '.$ilDB->quote($this->getId(),'integer');
$ilDB->manipulate($query);
$this->saveAssignments();
return true;
}

+ Here is the call graph for this function:

Field Documentation

ilDidacticTemplateSetting::$assignments = array()
private

Definition at line 21 of file class.ilDidacticTemplateSetting.php.

Referenced by getAssignments().

ilDidacticTemplateSetting::$description = ''
private

Definition at line 18 of file class.ilDidacticTemplateSetting.php.

Referenced by getDescription().

ilDidacticTemplateSetting::$enabled = false
private

Definition at line 16 of file class.ilDidacticTemplateSetting.php.

Referenced by isEnabled().

ilDidacticTemplateSetting::$id = 0
private

Definition at line 15 of file class.ilDidacticTemplateSetting.php.

Referenced by getId().

ilDidacticTemplateSetting::$info = ''
private

Definition at line 19 of file class.ilDidacticTemplateSetting.php.

Referenced by getInfo(), and toXml().

ilDidacticTemplateSetting::$title = ''
private

Definition at line 17 of file class.ilDidacticTemplateSetting.php.

Referenced by getTitle().

ilDidacticTemplateSetting::$type = self::TYPE_CREATION
private

Definition at line 20 of file class.ilDidacticTemplateSetting.php.

Referenced by getType(), and toXml().

const ilDidacticTemplateSetting::TYPE_CREATION = 1

The documentation for this class was generated from the following file: