ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 = ""
 

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 137 of file class.ilPortfolioDataSet.php.

References array.

138  {
139  switch ($a_entity)
140  {
141  case "prtt":
142  return array (
143  "portfolio_page" => array("ids" => $a_rec["Id"])
144  );
145  }
146  return false;
147  }
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  {
46  switch ($a_version)
47  {
48  case "4.4.0":
49  case "5.0.0":
50  return array(
51  "Id" => "integer",
52  "Title" => "text",
53  "Description" => "text",
54  "Comments" => "integer",
55  "BgColor" => "text",
56  "FontColor" => "text",
57  "Img" => "text",
58  "Ppic" => "integer",
59  "Dir" => "directory"
60  );
61  }
62  }
63 
64  if ($a_entity == "portfolio_page")
65  {
66  switch ($a_version)
67  {
68  case "4.4.0":
69  case "5.0.0":
70  return array(
71  "Id" => "integer",
72  "PortfolioId" => "integer",
73  "Title" => "integer",
74  "OrderNr" => "integer",
75  "Type" => "text"
76  );
77  }
78  }
79  }
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 155 of file class.ilPortfolioDataSet.php.

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

156  {
157  if ($a_entity == "prtt")
158  {
159  include_once("./Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php");
160  $dir = ilObjPortfolioTemplate::initStorage($a_set["Id"]);
161  $a_set["Dir"] = $dir;
162 
163  include_once("./Services/Notes/classes/class.ilNote.php");
164  $a_set["Comments"] = ilNote::commentsActivated($a_set["Id"], 0, "prtt");
165  }
166 
167  return $a_set;
168  }
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 176 of file class.ilPortfolioDataSet.php.

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

177  {
178  switch ($a_entity)
179  {
180  case "prtt":
181  include_once("./Modules/Portfolio/classes/class.ilObjPortfolioTemplate.php");
182 
183  // container copy
184  if($new_id = $a_mapping->getMapping("Services/Container", "objs", $a_rec["Id"]))
185  {
186  $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
187  }
188  else
189  {
190  $newObj = new ilObjPortfolioTemplate();
191  $newObj->create();
192  }
193 
194  $newObj->setTitle($a_rec["Title"]);
195  $newObj->setDescription($a_rec["Description"]);
196  $newObj->setPublicComments($a_rec["Comments"]);
197  $newObj->setBackgroundColor($a_rec["BgColor"]);
198  $newObj->setFontColor($a_rec["FontColor"]);
199  $newObj->setProfilePicture($a_rec["Ppic"]);
200  $newObj->setImage($a_rec["Img"]);
201  $newObj->update();
202 
203  // handle image(s)
204  if($a_rec["Img"])
205  {
206  $dir = str_replace("..", "", $a_rec["Dir"]);
207  if ($dir != "" && $this->getImportDirectory() != "")
208  {
209  $source_dir = $this->getImportDirectory()."/".$dir;
210  $target_dir = ilObjPortfolioTemplate::initStorage($newObj->getId());
211  ilUtil::rCopy($source_dir, $target_dir);
212  }
213  }
214 
215  $a_mapping->addMapping("Modules/Portfolio", "prtt", $a_rec["Id"], $newObj->getId());
216  $a_mapping->addMapping("Services/Object", "obj", $a_rec["Id"], $newObj->getId());
217  break;
218 
219  case "portfolio_page":
220  $prtt_id = (int)$a_mapping->getMapping("Modules/Portfolio", "prtt", $a_rec["PortfolioId"]);
221  if($prtt_id)
222  {
223  include_once("./Modules/Portfolio/classes/class.ilPortfolioTemplatePage.php");
224  $newObj = new ilPortfolioTemplatePage();
225  $newObj->setPortfolioId($prtt_id);
226  $newObj->setTitle($a_rec["Title"]);
227  $newObj->setType($a_rec["Type"]);
228  $newObj->setOrderNr($a_rec["OrderNr"]);
229  $newObj->create(true);
230 
231  $a_mapping->addMapping("Services/COPage", "pg", "prtt:".$a_rec["Id"], "prtt:".$newObj->getId());
232  }
233  break;
234  }
235  }
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 87 of file class.ilPortfolioDataSet.php.

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

88  {
89  global $ilDB;
90 
91  if (!is_array($a_ids))
92  {
93  $a_ids = array($a_ids);
94  }
95 
96  if ($a_entity == "prtt")
97  {
98  switch ($a_version)
99  {
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  {
122  switch ($a_version)
123  {
124  case "4.4.0":
125  case "5.0.0":
126  $this->getDirectDataFromQuery("SELECT id,portfolio_id,title,order_nr,type".
127  " FROM usr_portfolio_page".
128  " WHERE ".$ilDB->in("portfolio_id", $a_ids, false, "integer"));
129  break;
130  }
131  }
132  }
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: