ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 
 getXmlRecord (string $a_entity, string $a_version, array $a_set)
 
 importRecord (string $a_entity, array $a_types, array $a_rec, ilImportMapping $a_mapping, string $a_schema_version)
 
- 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...
 
 setExportDirectories (string $a_relative, string $a_absolute)
 
 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 ...> ... 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...
 

Protected Member Functions

 getXmlNamespace (string $a_entity, string $a_schema_version)
 
 getTypes (string $a_entity, string $a_version)
 
 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)
 
 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
string $current_installation_id = ""
 
array $data = []
 
ilDBInterface $db
 
ilLogger $ds_log
 
string $import_directory = ""
 
string $entity = ""
 
string $schema_version = ""
 
string $relative_export_dir = ""
 
string $absolute_export_dir = ""
 
string $ds_prefix = "ds"
 
string $version = ""
 
ilSurveyImporter $import
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
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 ( )

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

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

36  {
37  global $DIC;
38 
40  $this->notes = $DIC->notes();
41  }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
+ 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

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

137  : array {
138  if ($a_entity === "prtt") {
139  return array(
140  "portfolio_page" => array("ids" => $a_rec["Id"] ?? null)
141  );
142  }
143  return [];
144  }

◆ getSupportedVersions()

ilPortfolioDataSet::getSupportedVersions ( )

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

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

◆ getTypes()

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

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  }
72  }
73 
74  if ($a_entity === "portfolio_page") {
75  switch ($a_version) {
76  case "4.4.0":
77  case "5.0.0":
78  return array(
79  "Id" => "integer",
80  "PortfolioId" => "integer",
81  "Title" => "integer",
82  "OrderNr" => "integer",
83  "Type" => "text"
84  );
85  }
86  }
87  return [];
88  }

◆ getXmlNamespace()

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

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 
)

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

References ilObjPortfolioBase\initStorage().

150  : array {
151  if ($a_entity === "prtt") {
152  $dir = ilObjPortfolioTemplate::initStorage($a_set["Id"]);
153  $a_set["Dir"] = $dir;
154 
155  $a_set["Comments"] = $this->notes->domain()->commentsActive((int) $a_set["Id"]);
156  }
157 
158  return $a_set;
159  }
static initStorage(int $a_id, string $a_subdir=null)
Init file system storage.
+ Here is the call graph for this function:

◆ importRecord()

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

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

References ilImportMapping\addMapping(), ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), ilObjPortfolioBase\initStorage(), ILIAS\Repository\int(), ilFileUtils\rCopy(), and ilDataSet\stripTags().

168  : void {
169  $a_rec = $this->stripTags($a_rec);
170  switch ($a_entity) {
171  case "prtt":
172 
173  // container copy
174  if ($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"])) {
175  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
176  } else {
177  $newObj = new ilObjPortfolioTemplate();
178  $newObj->create();
179  }
180 
181  $newObj->setTitle($a_rec["Title"]);
182  $newObj->setDescription($a_rec["Description"]);
183  $newObj->setPublicComments($a_rec["Comments"]);
184  $newObj->setBackgroundColor($a_rec["BgColor"]);
185  $newObj->setFontColor($a_rec["FontColor"]);
186  $newObj->setProfilePicture($a_rec["Ppic"]);
187  $newObj->setImage($a_rec["Img"]);
188  $newObj->update();
189 
190  // handle image(s)
191  if ($a_rec["Img"]) {
192  $dir = str_replace("..", "", $a_rec["Dir"]);
193  if ($dir !== "" && $this->getImportDirectory() !== "") {
194  $source_dir = $this->getImportDirectory() . "/" . $dir;
195  $target_dir = ilObjPortfolioTemplate::initStorage($newObj->getId());
196  ilFileUtils::rCopy($source_dir, $target_dir);
197  }
198  }
199 
200  $a_mapping->addMapping("Modules/Portfolio", "prtt", $a_rec["Id"], $newObj->getId());
201  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
202  break;
203 
204  case "portfolio_page":
205  $prtt_id = (int) $a_mapping->getMapping("Modules/Portfolio", "prtt", $a_rec["PortfolioId"]);
206  if ($prtt_id) {
207  $newObj = new ilPortfolioTemplatePage();
208  $newObj->setPortfolioId($prtt_id);
209  $newObj->setTitle($a_rec["Title"]);
210  $newObj->setType($a_rec["Type"]);
211  $newObj->setOrderNr($a_rec["OrderNr"]);
212  $newObj->create(true);
213 
214  $a_mapping->addMapping("Services/COPage", "pg", "prtt:" . $a_rec["Id"], "prtt:" . $newObj->getId());
215  }
216  break;
217  }
218  }
static initStorage(int $a_id, string $a_subdir=null)
Init file system storage.
static rCopy(string $a_sdir, string $a_tdir, bool $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
stripTags(array $rec, array $omit_keys=[])
+ Here is the call graph for this function:

◆ readData()

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

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

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

90  : void
91  {
92  $ilDB = $this->db;
93 
94  if (!is_array($a_ids)) {
95  $a_ids = array($a_ids);
96  }
97 
98  if ($a_entity === "prtt") {
99  switch ($a_version) {
100  case "4.4.0":
101  $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
102  "prtf.comments,prtf.bg_color,prtf.font_color,prtf.img,prtf.ppic" .
103  " FROM usr_portfolio prtf" .
104  " JOIN object_data od ON (od.obj_id = prtf.id)" .
105  " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
106  " AND od.type = " . $ilDB->quote("prtt", "text"));
107  break;
108 
109  case "5.0.0":
110  $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
111  "prtf.bg_color,prtf.font_color,prtf.img,prtf.ppic" .
112  " FROM usr_portfolio prtf" .
113  " JOIN object_data od ON (od.obj_id = prtf.id)" .
114  " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
115  " AND od.type = " . $ilDB->quote("prtt", "text"));
116  break;
117  }
118  }
119 
120  if ($a_entity === "portfolio_page") {
121  switch ($a_version) {
122  case "4.4.0":
123  case "5.0.0":
124  $this->getDirectDataFromQuery("SELECT id,portfolio_id,title,order_nr,type" .
125  " FROM usr_portfolio_page" .
126  " WHERE " . $ilDB->in("portfolio_id", $a_ids, false, "integer"));
127  break;
128  }
129  }
130  }
ilDBInterface $db
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 ...
+ 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: