ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilPortfolioDataSet Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPortfolioDataSet:
+ Collaboration diagram for ilPortfolioDataSet:

Public Member Functions

 __construct ()
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 
 init (string $a_entity, string $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 
 readData (string $a_entity, string $a_version, array $a_ids)
 Read data from DB. More...
 
 initByExporter (ilXmlExporter $xml_exporter)
 
 setImportDirectory (string $a_val)
 
 getImportDirectory ()
 
 setDSPrefix (string $a_val)
 
 getDSPrefix ()
 
 getDSPrefixString ()
 
 getDirectDataFromQuery (string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper (string $a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getXmlRepresentation (string $a_entity, string $a_schema_version, ?array $a_ids, string $a_field="", bool $a_omit_header=false, bool $a_omit_types=false)
 Get xml representation <dataset install_id="123" install_url="..."> <types entity="table_name" version="4.0.1"> <ftype name="field_1" type="text" > <ftype name="field_2" type="date" > <ftype name="field_3" type="integer" > </types> <types ...> ... </types> <set entity="table_name"> <rec> <field_1>content</field_1> <field_2>my_date</field_2> <field_3>my_number</field_3> </rec> ... </set> </dataset> More...
 
 addRecordsXml (ilXmlWriter $a_writer, array $a_prefixes, string $a_entity, string $a_schema_version, array $a_ids, ?string $a_field="")
 
 afterXmlRecordWriting (string $a_entity, string $a_version, array $a_set)
 
 getNamespaces (array &$namespaces, string $a_entity, string $a_schema_version)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 Get xml record for version. More...
 
 getXmlTypes (string $a_entity, string $a_version)
 Get xml types. More...
 
 getXMLEntityName (string $a_entity, string $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag (string $a_entity, string $a_schema_version)
 Get entity tag. More...
 
 setImport (ilSurveyImporter $a_val)
 
 getImport ()
 
 setCurrentInstallationId (string $a_val)
 
 getCurrentInstallationId ()
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 Needs to be overwritten for import use case. More...
 
 getCollection (array $record, string $entity, string $schema_version, string $field, string $value)
 
 getContainerExportConfig (array $record, string $entity, string $schema_version, string $field, string $value)
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
- Protected Member Functions inherited from ilDataSet
 getTypes (string $a_entity, string $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getExportDirInContainer (string $exp_dir)
 
 getIRSSContainerExportConfig (StorableResource $source_container, string $source_path, string $target_path="")
 
 getDependencies (string $a_entity, string $a_version, ?array $a_rec=null, ?array $a_ids=null)
 
 createObjectExportId (string $a_type, string $a_id)
 Build ilias export id. More...
 
 parseObjectExportId (string $a_id, ?string $a_fallback_id=null)
 Parse export id. More...
 
 stripTags (array $rec, array $omit_keys=[])
 

Protected Attributes

ilObjPortfolio $current_portfolio
 
ILIAS Notes Service $notes
 
- Protected Attributes inherited from ilDataSet
ILIAS ResourceStorage Services $irss
 
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $component_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 
ilExport $export
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
const DATASET_NS = 'http://www.ilias.de/Services/DataSet/ds/4_3'
 
const DATASET_NS_PREFIX = 'ds'
 
const EXPORT_NO_INST_ID = 1
 
const EXPORT_ID_ILIAS_LOCAL = 2
 
const EXPORT_ID_ILIAS_LOCAL_INVALID = 3
 
const EXPORT_ID_ILIAS_REMOTE = 4
 
const EXPORT_ID_ILIAS_REMOTE_INVALID = 5
 
const EXPORT_ID = 6
 
const EXPORT_ID_INVALID = 7
 
int $dircnt = 0
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Portfolio Data set class

Only for portfolio templates!

This class implements the following entities:

  • portfolio: object data (usr_portfolio)
  • portfolio_page: data from table usr_portfolio_page
Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om

Definition at line 30 of file class.ilPortfolioDataSet.php.

Constructor & Destructor Documentation

◆ __construct()

ilPortfolioDataSet::__construct ( )

Reimplemented from ilDataSet.

Definition at line 35 of file class.ilPortfolioDataSet.php.

36 {
37 global $DIC;
38
40 $this->notes = $DIC->notes();
41 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26

References $DIC, and ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getDependencies()

ilPortfolioDataSet::getDependencies ( string  $a_entity,
string  $a_version,
?array  $a_rec = null,
?array  $a_ids = null 
)
protected

Reimplemented from ilDataSet.

Definition at line 145 of file class.ilPortfolioDataSet.php.

150 : array {
151 if ($a_entity === "prtt") {
152 return array(
153 "portfolio_page" => array("ids" => $a_rec["Id"] ?? null)
154 );
155 }
156 return [];
157 }

◆ getSupportedVersions()

ilPortfolioDataSet::getSupportedVersions ( )

Reimplemented from ilDataSet.

Definition at line 44 of file class.ilPortfolioDataSet.php.

44 : array
45 {
46 return array("4.4.0", "5.0.0", "10.0");
47 }

◆ getTypes()

ilPortfolioDataSet::getTypes ( string  $a_entity,
string  $a_version 
)
protected

Get (abstract) types for (abstract) field names.

Please note that the abstract fields/types only depend on the version! Not on a choosen representation!

Returns
array types array, e.g. array("field_1" => "text", "field_2" => "integer", ...)

Reimplemented from ilDataSet.

Definition at line 54 of file class.ilPortfolioDataSet.php.

54 : array
55 {
56 if ($a_entity === "prtt") {
57 switch ($a_version) {
58 case "4.4.0":
59 case "5.0.0":
60 return array(
61 "Id" => "integer",
62 "Title" => "text",
63 "Description" => "text",
64 "Comments" => "integer",
65 "BgColor" => "text",
66 "FontColor" => "text",
67 "Img" => "text",
68 "Ppic" => "integer",
69 "Dir" => "directory"
70 );
71 case "10.0":
72 return array(
73 "Id" => "integer",
74 "Title" => "text",
75 "Description" => "text",
76 "Comments" => "integer",
77 "BgColor" => "text",
78 "FontColor" => "text",
79 "Ppic" => "integer"
80 );
81 }
82 }
83
84 if ($a_entity === "portfolio_page") {
85 switch ($a_version) {
86 case "4.4.0":
87 case "5.0.0":
88 case "10.0":
89 return array(
90 "Id" => "integer",
91 "PortfolioId" => "integer",
92 "Title" => "integer",
93 "OrderNr" => "integer",
94 "Type" => "text"
95 );
96 }
97 }
98 return [];
99 }

◆ getXmlNamespace()

ilPortfolioDataSet::getXmlNamespace ( string  $a_entity,
string  $a_schema_version 
)
protected

Reimplemented from ilDataSet.

Definition at line 49 of file class.ilPortfolioDataSet.php.

49 : string
50 {
51 return "https://www.ilias.de/xml/Modules/Portfolio/" . $a_entity;
52 }

◆ getXmlRecord()

ilPortfolioDataSet::getXmlRecord ( string  $a_entity,
string  $a_version,
array  $a_set 
)

Get xml record for version.

Parameters
array$a_setabstract data record

Reimplemented from ilDataSet.

Definition at line 159 of file class.ilPortfolioDataSet.php.

163 : array {
164 if ($a_entity === "prtt") {
165 $a_set["Comments"] = $this->notes->domain()->commentsActive((int) $a_set["Id"]);
166 }
167
168 return $a_set;
169 }

◆ importRecord()

ilPortfolioDataSet::importRecord ( string  $a_entity,
array  $a_types,
array  $a_rec,
ilImportMapping  $a_mapping,
string  $a_schema_version 
)

Needs to be overwritten for import use case.

Reimplemented from ilDataSet.

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

178 : void {
179 $a_rec = $this->stripTags($a_rec);
180 switch ($a_entity) {
181 case "prtt":
182
183 // container copy
184 if ($new_id = $a_mapping->getMapping("components/ILIAS/Container", "objs", $a_rec["Id"])) {
185 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
186 } else {
187 $newObj = new ilObjPortfolioTemplate();
188 $newObj->create();
189 }
190
191 $newObj->setTitle($a_rec["Title"]);
192 $newObj->setDescription($a_rec["Description"]);
193 $newObj->setPublicComments($a_rec["Comments"]);
194 $newObj->setBackgroundColor($a_rec["BgColor"]);
195 $newObj->setFontColor($a_rec["FontColor"]);
196 $newObj->setProfilePicture($a_rec["Ppic"]);
197 $newObj->update();
198
199 $a_mapping->addMapping("components/ILIAS/Portfolio", "prtt", $a_rec["Id"], $newObj->getId());
200 $a_mapping->addMapping("components/ILIAS/ILIASObject", "obj", $a_rec["Id"], $newObj->getId());
201 break;
202
203 case "portfolio_page":
204 $prtt_id = (int) $a_mapping->getMapping("components/ILIAS/Portfolio", "prtt", $a_rec["PortfolioId"]);
205 if ($prtt_id) {
206 if ((int) $a_rec["Type"] != ilPortfolioTemplatePage::TYPE_PAGE) {
207 return;
208 }
209 $newObj = new ilPortfolioTemplatePage();
210 $newObj->setPortfolioId($prtt_id);
211 $newObj->setTitle($a_rec["Title"]);
212 $newObj->setType($a_rec["Type"]);
213 $newObj->setOrderNr($a_rec["OrderNr"]);
214 $newObj->create(true);
215
216 $a_mapping->addMapping("components/ILIAS/COPage", "pg", "prtt:" . $a_rec["Id"], "prtt:" . $newObj->getId());
217 }
218 break;
219 }
220 }
stripTags(array $rec, array $omit_keys=[])
addMapping(string $a_comp, string $a_entity, string $a_old_id, string $a_new_id)
getMapping(string $a_comp, string $a_entity, string $a_old_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getInstanceByObjId(?int $obj_id, bool $stop_on_error=true)
get an instance of an Ilias object by object id
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), ILIAS\Repository\int(), and ilPortfolioPage\TYPE_PAGE.

+ Here is the call graph for this function:

◆ readData()

ilPortfolioDataSet::readData ( string  $a_entity,
string  $a_version,
array  $a_ids 
)

Read data from DB.

This should result in the abstract field structure of the version set in the constructor.

Reimplemented from ilDataSet.

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

101 : void
102 {
104
105 if (!is_array($a_ids)) {
106 $a_ids = array($a_ids);
107 }
108
109 if ($a_entity === "prtt") {
110 switch ($a_version) {
111 case "4.4.0":
112 $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
113 "prtf.comments,prtf.bg_color,prtf.font_color,prtf.img,prtf.ppic" .
114 " FROM usr_portfolio prtf" .
115 " JOIN object_data od ON (od.obj_id = prtf.id)" .
116 " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
117 " AND od.type = " . $ilDB->quote("prtt", "text"));
118 break;
119
120 case "5.0.0":
121 case "10.0":
122 $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
123 "prtf.bg_color,prtf.font_color,prtf.ppic" .
124 " FROM usr_portfolio prtf" .
125 " JOIN object_data od ON (od.obj_id = prtf.id)" .
126 " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
127 " AND od.type = " . $ilDB->quote("prtt", "text"));
128 break;
129 }
130 }
131
132 if ($a_entity === "portfolio_page") {
133 switch ($a_version) {
134 case "4.4.0":
135 case "5.0.0":
136 case "10.0":
137 $this->getDirectDataFromQuery("SELECT id,portfolio_id,title,order_nr,type" .
138 " FROM usr_portfolio_page" .
139 " WHERE " . $ilDB->in("portfolio_id", $a_ids, false, "integer"));
140 break;
141 }
142 }
143 }
getDirectDataFromQuery(string $a_query, bool $a_convert_to_leading_upper=true, bool $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
ilDBInterface $db

References ilDataSet\$db, $ilDB, and ilDataSet\getDirectDataFromQuery().

+ Here is the call graph for this function:

Field Documentation

◆ $current_portfolio

ilObjPortfolio ilPortfolioDataSet::$current_portfolio
protected

Definition at line 32 of file class.ilPortfolioDataSet.php.

◆ $notes

ILIAS Notes Service ilPortfolioDataSet::$notes
protected

Definition at line 33 of file class.ilPortfolioDataSet.php.


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