ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPortfolioDataSet Class Reference

Portfolio Data set class. More...

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

Public Member Functions

 getSupportedVersions ()
 Get supported versions. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 readData ($a_entity, $a_version, $a_ids, $a_field="")
 Read data. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record. More...
 
 importRecord ($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 Import record. More...
 
- Public Member Functions inherited from ilDataSet
 __construct ()
 Constructor. More...
 
 init ($a_entity, $a_schema_version)
 Init. More...
 
 getSupportedVersions ()
 Get supported version. More...
 
 readData ($a_entity, $a_version, $a_ids)
 Read data from DB. More...
 
 setExportDirectories ($a_relative, $a_absolute)
 Set export directories. More...
 
 setImportDirectory ($a_val)
 Set import directory. More...
 
 getImportDirectory ()
 Get import directory. More...
 
 setDSPrefix ($a_val)
 Set XML dataset namespace prefix. More...
 
 getDSPrefix ()
 Get XML dataset namespace prefix. More...
 
 getDSPrefixString ()
 
 getDirectDataFromQuery ($a_query, $a_convert_to_leading_upper=true, $a_set=true)
 Get data from query.This is a standard procedure, all db field names are directly mapped to abstract fields. More...
 
 convertToLeadingUpper ($a_str)
 Make xyz_abc a XyzAbc string. More...
 
 getJsonRepresentation ()
 Get json representation. More...
 
 getXmlRepresentation ( $a_entity, $a_schema_version, $a_ids, $a_field="", $a_omit_header=false, $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 ($a_writer, $a_prefixes, $a_entity, $a_schema_version, $a_ids, $a_field="")
 Add records xml. More...
 
 afterXmlRecordWriting ($a_entity, $a_version, $a_set)
 After xml record writing hook record. More...
 
 getNamespaces (&$namespaces, $a_entity, $a_schema_version)
 Get xml namespaces. More...
 
 getXmlRecord ($a_entity, $a_version, $a_set)
 Get xml record for version. More...
 
 getJsonRecord ($a_set)
 Get json record for version. More...
 
 getXmlTypes ($a_entity, $a_version)
 Get xml types. More...
 
 getJsonTypes ($a_entity, $a_version)
 Get json types. More...
 
 getXMLEntityName ($a_entity, $a_version)
 Get entity name for xml (may be overwritten) More...
 
 getXMLEntityTag ($a_entity, $a_schema_version)
 Get entity tag. More...
 
 getJsonEntityName ($a_entity, $a_version)
 Get entity name for json (may be overwritten) More...
 
 setImport ($a_val)
 Set import object. More...
 
 getImport ()
 Get import object. More...
 
 setCurrentInstallationId ($a_val)
 Set current installation id. More...
 
 getCurrentInstallationId ()
 Get current installation id. More...
 

Protected Member Functions

 getTypes ($a_entity, $a_version)
 Get field types for entity. More...
 
 getDependencies ($a_entity, $a_version, $a_rec, $a_ids)
 Determine the dependent sets of data. More...
 
- Protected Member Functions inherited from ilDataSet
 getTypes ($a_entity, $a_version)
 Get (abstract) types for (abstract) field names. More...
 
 getXmlNamespace ($a_entity, $a_schema_version)
 Get xml namespace. More...
 
 createObjectExportId ($a_type, $a_id)
 Build ilias export id. More...
 
 parseObjectExportId ($a_id, $a_fallback_id=null)
 Parse export id. More...
 

Protected Attributes

 $current_portfolio
 
- Protected Attributes inherited from ilDataSet
 $current_installation_id = ""
 
 $db
 
 $ds_log
 

Additional Inherited Members

- Data Fields inherited from ilDataSet
 $dircnt
 
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
 

Detailed Description

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
Version
$Id$

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

Member Function Documentation

◆ getDependencies()

ilPortfolioDataSet::getDependencies (   $a_entity,
  $a_version,
  $a_rec,
  $a_ids 
)
protected

Determine the dependent sets of data.

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

References array.

129  {
130  switch ($a_entity) {
131  case "prtt":
132  return array(
133  "portfolio_page" => array("ids" => $a_rec["Id"])
134  );
135  }
136  return false;
137  }
Create styles array
The data for the language used.

◆ getSupportedVersions()

ilPortfolioDataSet::getSupportedVersions ( )

Get supported versions.

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

References array.

27  {
28  return array("4.4.0", "5.0.0");
29  }
Create styles array
The data for the language used.

◆ getTypes()

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

Get field types for entity.

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

References array.

43  {
44  if ($a_entity == "prtt") {
45  switch ($a_version) {
46  case "4.4.0":
47  case "5.0.0":
48  return array(
49  "Id" => "integer",
50  "Title" => "text",
51  "Description" => "text",
52  "Comments" => "integer",
53  "BgColor" => "text",
54  "FontColor" => "text",
55  "Img" => "text",
56  "Ppic" => "integer",
57  "Dir" => "directory"
58  );
59  }
60  }
61 
62  if ($a_entity == "portfolio_page") {
63  switch ($a_version) {
64  case "4.4.0":
65  case "5.0.0":
66  return array(
67  "Id" => "integer",
68  "PortfolioId" => "integer",
69  "Title" => "integer",
70  "OrderNr" => "integer",
71  "Type" => "text"
72  );
73  }
74  }
75  }
Create styles array
The data for the language used.

◆ getXmlNamespace()

ilPortfolioDataSet::getXmlNamespace (   $a_entity,
  $a_schema_version 
)

Get xml namespace.

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

35  {
36  return "http://www.ilias.de/xml/Modules/Portfolio/" . $a_entity;
37  }

◆ getXmlRecord()

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

Get xml record.

Parameters

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

References ilNote\commentsActivated(), and ilObjPortfolioBase\initStorage().

146  {
147  if ($a_entity == "prtt") {
148  include_once("./Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php");
149  $dir = ilObjPortfolioTemplate::initStorage($a_set["Id"]);
150  $a_set["Dir"] = $dir;
151 
152  include_once("./Services/Notes/classes/class.ilNote.php");
153  $a_set["Comments"] = ilNote::commentsActivated($a_set["Id"], 0, "prtt");
154  }
155 
156  return $a_set;
157  }
static initStorage($a_id, $a_subdir=null)
Init file system storage.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
+ Here is the call graph for this function:

◆ importRecord()

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

Import record.

Parameters

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

References ilDataSet\getImportDirectory(), ilObjectFactory\getInstanceByObjId(), ilObjPortfolioBase\initStorage(), and ilUtil\rCopy().

166  {
167  switch ($a_entity) {
168  case "prtt":
169  include_once("./Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php");
170 
171  // container copy
172  if ($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"])) {
173  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
174  } else {
175  $newObj = new ilObjPortfolioTemplate();
176  $newObj->create();
177  }
178 
179  $newObj->setTitle($a_rec["Title"]);
180  $newObj->setDescription($a_rec["Description"]);
181  $newObj->setPublicComments($a_rec["Comments"]);
182  $newObj->setBackgroundColor($a_rec["BgColor"]);
183  $newObj->setFontColor($a_rec["FontColor"]);
184  $newObj->setProfilePicture($a_rec["Ppic"]);
185  $newObj->setImage($a_rec["Img"]);
186  $newObj->update();
187 
188  // handle image(s)
189  if ($a_rec["Img"]) {
190  $dir = str_replace("..", "", $a_rec["Dir"]);
191  if ($dir != "" && $this->getImportDirectory() != "") {
192  $source_dir = $this->getImportDirectory() . "/" . $dir;
193  $target_dir = ilObjPortfolioTemplate::initStorage($newObj->getId());
194  ilUtil::rCopy($source_dir, $target_dir);
195  }
196  }
197 
198  $a_mapping->addMapping("Modules/Portfolio", "prtt", $a_rec["Id"], $newObj->getId());
199  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
200  break;
201 
202  case "portfolio_page":
203  $prtt_id = (int) $a_mapping->getMapping("Modules/Portfolio", "prtt", $a_rec["PortfolioId"]);
204  if ($prtt_id) {
205  include_once("./Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php");
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("Services/COPage", "pg", "prtt:" . $a_rec["Id"], "prtt:" . $newObj->getId());
214  }
215  break;
216  }
217  }
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
static initStorage($a_id, $a_subdir=null)
Init file system storage.
getImportDirectory()
Get import directory.
Page for portfolio template.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
+ Here is the call graph for this function:

◆ readData()

ilPortfolioDataSet::readData (   $a_entity,
  $a_version,
  $a_ids,
  $a_field = "" 
)

Read data.

Parameters

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

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

84  {
85  $ilDB = $this->db;
86 
87  if (!is_array($a_ids)) {
88  $a_ids = array($a_ids);
89  }
90 
91  if ($a_entity == "prtt") {
92  switch ($a_version) {
93  case "4.4.0":
94  $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
95  "prtf.comments,prtf.bg_color,prtf.font_color,prtf.img,prtf.ppic" .
96  " FROM usr_portfolio prtf" .
97  " JOIN object_data od ON (od.obj_id = prtf.id)" .
98  " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
99  " AND od.type = " . $ilDB->quote("prtt", "text"));
100  break;
101 
102  case "5.0.0":
103  $this->getDirectDataFromQuery("SELECT prtf.id,od.title,od.description," .
104  "prtf.bg_color,prtf.font_color,prtf.img,prtf.ppic" .
105  " FROM usr_portfolio prtf" .
106  " JOIN object_data od ON (od.obj_id = prtf.id)" .
107  " WHERE " . $ilDB->in("prtf.id", $a_ids, false, "integer") .
108  " AND od.type = " . $ilDB->quote("prtt", "text"));
109  break;
110  }
111  }
112 
113  if ($a_entity == "portfolio_page") {
114  switch ($a_version) {
115  case "4.4.0":
116  case "5.0.0":
117  $this->getDirectDataFromQuery("SELECT id,portfolio_id,title,order_nr,type" .
118  " FROM usr_portfolio_page" .
119  " WHERE " . $ilDB->in("portfolio_id", $a_ids, false, "integer"));
120  break;
121  }
122  }
123  }
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
Create styles array
The data for the language used.
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $current_portfolio

ilPortfolioDataSet::$current_portfolio
protected

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


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