ILIAS  trunk Revision v11.0_alpha-1846-g895b5f47236
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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...
 
 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 ...> ... 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)
 
 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 ( )

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: shib_login.php:22
__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 145 of file class.ilPortfolioDataSet.php.

References null.

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

◆ getSupportedVersions()

ilPortfolioDataSet::getSupportedVersions ( )

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

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

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 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 
)

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

References ilImportMapping\addMapping(), ilObjectFactory\getInstanceByObjId(), ilImportMapping\getMapping(), ILIAS\Repository\int(), and ilDataSet\stripTags().

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  $newObj = new ilPortfolioTemplatePage();
207  $newObj->setPortfolioId($prtt_id);
208  $newObj->setTitle($a_rec["Title"]);
209  $newObj->setType($a_rec["Type"]);
210  $newObj->setOrderNr($a_rec["OrderNr"]);
211  $newObj->create(true);
212 
213  $a_mapping->addMapping("components/ILIAS/COPage", "pg", "prtt:" . $a_rec["Id"], "prtt:" . $newObj->getId());
214  }
215  break;
216  }
217  }
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 101 of file class.ilPortfolioDataSet.php.

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

101  : void
102  {
103  $ilDB = $this->db;
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  }
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: