ILIAS  release_7 Revision v7.30-3-g800a261c036
ilMD5295Lifecycle Class Reference
+ Inheritance diagram for ilMD5295Lifecycle:
+ Collaboration diagram for ilMD5295Lifecycle:

Public Member Functions

 getPossibleSubelements ()
 
getContributeIds ()
 
getContribute ($a_contribute_id)
 
addContribute ()
 
 setStatus ($a_status)
 
 getStatus ()
 
 setVersion ($a_version)
 
 getVersion ()
 
 setVersionLanguage ($lng_obj)
 
getVersionLanguage ()
 
 getVersionLanguageCode ()
 
 save ()
 
 update ()
 
 delete ()
 
 __getFields ()
 
 read ()
 
 toXML (&$writer)
 
- Public Member Functions inherited from ilMD5295Base
 __construct ( $a_rbac_id=0, $a_obj_id=0, $a_type=0)
 
 setRBACId ($a_id)
 
 getRBACId ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setObjType ($a_type)
 
 getObjType ()
 
 setMetaId ($a_meta_id, $a_read_data=true)
 
 getMetaId ()
 
 setParentType ($a_parent_type)
 
 getParentType ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 setExportMode ($a_export_mode=true)
 
 getExportMode ()
 
 validate ()
 
 update ()
 
 save ()
 
 delete ()
 
 toXML (&$writer)
 

Static Public Member Functions

static _getId ($a_rbac_id, $a_obj_id)
 

Additional Inherited Members

- Data Fields inherited from ilMD5295Base
 $rbac_id
 
 $obj_id
 
 $obj_type
 
 $export_mode = false
 
- Protected Attributes inherited from ilMD5295Base
 $log
 

Detailed Description

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

Member Function Documentation

◆ __getFields()

ilMD5295Lifecycle::__getFields ( )

Definition at line 176 of file class.ilMD5295Lifecycle.php.

References ilMD5295Base\getObjId(), ilMD5295Base\getObjType(), ilMD5295Base\getRBACId(), getStatus(), getVersion(), and getVersionLanguageCode().

Referenced by save().

177  {
178  return array('rbac_id' => array('integer',$this->getRBACId()),
179  'obj_id' => array('integer',$this->getObjId()),
180  'obj_type' => array('text',$this->getObjType()),
181  'lifecycle_status' => array('text',$this->getStatus()),
182  'meta_version' => array('text',$this->getVersion()),
183  'version_language' => array('text',$this->getVersionLanguageCode()));
184  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getId()

static ilMD5295Lifecycle::_getId (   $a_rbac_id,
  $a_obj_id 
)
static

Definition at line 246 of file class.ilMD5295Lifecycle.php.

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilMD5295\getLifecycle().

247  {
248  global $DIC;
249 
250  $ilDB = $DIC['ilDB'];
251 
252  $query = "SELECT meta_lifecycle_id FROM il_meta_lifecycle " .
253  "WHERE rbac_id = " . $ilDB->quote($a_rbac_id, 'integer') . " " .
254  "AND obj_id = " . $ilDB->quote($a_obj_id, 'integer');
255 
256 
257  $res = $ilDB->query($query);
258  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
259  return $row->meta_lifecycle_id;
260  }
261  return false;
262  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ addContribute()

& ilMD5295Lifecycle::addContribute ( )

Definition at line 62 of file class.ilMD5295Lifecycle.php.

References ilMD5295Base\getMetaId(), ilMD5295Base\getObjId(), ilMD5295Base\getObjType(), and ilMD5295Base\getRBACId().

63  {
64  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Contribute.php';
65 
66  $con = new ilMD5295Contribute($this->getRBACId(), $this->getObjId(), $this->getObjType());
67  $con->setParentId($this->getMetaId());
68  $con->setParentType('meta_lifecycle');
69 
70  return $con;
71  }
+ Here is the call graph for this function:

◆ delete()

ilMD5295Lifecycle::delete ( )

Definition at line 153 of file class.ilMD5295Lifecycle.php.

References $DIC, $ilDB, $query, $res, getContribute(), getContributeIds(), and ilMD5295Base\getMetaId().

154  {
155  global $DIC;
156 
157  $ilDB = $DIC['ilDB'];
158 
159  // Delete 'contribute'
160  foreach ($this->getContributeIds() as $id) {
161  $con = $this->getContribute($id);
162  $con->delete();
163  }
164 
165 
166  if ($this->getMetaId()) {
167  $query = "DELETE FROM il_meta_lifecycle " .
168  "WHERE meta_lifecycle_id = " . $ilDB->quote($this->getMetaId(), 'integer');
169  $res = $ilDB->manipulate($query);
170  return true;
171  }
172  return false;
173  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
& getContribute($a_contribute_id)
+ Here is the call graph for this function:

◆ getContribute()

& ilMD5295Lifecycle::getContribute (   $a_contribute_id)

Definition at line 50 of file class.ilMD5295Lifecycle.php.

Referenced by delete(), and toXML().

51  {
52  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Contribute.php';
53 
54  if (!$a_contribute_id) {
55  return false;
56  }
57  $con = new ilMD5295Contribute();
58  $con->setMetaId($a_contribute_id);
59 
60  return $con;
61  }
+ Here is the caller graph for this function:

◆ getContributeIds()

& ilMD5295Lifecycle::getContributeIds ( )

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

References ilMD5295Contribute\_getIds(), ilMD5295Base\getMetaId(), ilMD5295Base\getObjId(), and ilMD5295Base\getRBACId().

Referenced by delete(), and toXML().

45  {
46  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Contribute.php';
47 
48  return ilMD5295Contribute::_getIds($this->getRBACId(), $this->getObjId(), $this->getMetaId(), 'meta_lifecycle');
49  }
static _getIds($a_rbac_id, $a_obj_id, $a_parent_id, $a_parent_type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPossibleSubelements()

ilMD5295Lifecycle::getPossibleSubelements ( )

Definition at line 36 of file class.ilMD5295Lifecycle.php.

37  {
38  $subs['Contribute'] = 'meta_contribute';
39 
40  return $subs;
41  }

◆ getStatus()

ilMD5295Lifecycle::getStatus ( )

Definition at line 89 of file class.ilMD5295Lifecycle.php.

Referenced by __getFields(), and toXML().

90  {
91  return $this->status;
92  }
+ Here is the caller graph for this function:

◆ getVersion()

ilMD5295Lifecycle::getVersion ( )

Definition at line 97 of file class.ilMD5295Lifecycle.php.

Referenced by __getFields(), and toXML().

98  {
99  return $this->version;
100  }
+ Here is the caller graph for this function:

◆ getVersionLanguage()

& ilMD5295Lifecycle::getVersionLanguage ( )

Definition at line 107 of file class.ilMD5295Lifecycle.php.

108  {
109  return $this->version_language;
110  }

◆ getVersionLanguageCode()

ilMD5295Lifecycle::getVersionLanguageCode ( )

Definition at line 111 of file class.ilMD5295Lifecycle.php.

Referenced by __getFields(), and toXML().

112  {
113  if (is_object($this->version_language)) {
114  return $this->version_language->getLanguageCode();
115  }
116  return false;
117  }
+ Here is the caller graph for this function:

◆ read()

ilMD5295Lifecycle::read ( )

Definition at line 186 of file class.ilMD5295Lifecycle.php.

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilMD5295Base\getMetaId(), ilMD5295Base\setObjId(), ilMD5295Base\setObjType(), ilMD5295Base\setRBACId(), setStatus(), setVersion(), and setVersionLanguage().

187  {
188  global $DIC;
189 
190  $ilDB = $DIC['ilDB'];
191 
192  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295LanguageItem.php';
193 
194  if ($this->getMetaId()) {
195  $query = "SELECT * FROM il_meta_lifecycle " .
196  "WHERE meta_lifecycle_id = " . $ilDB->quote($this->getMetaId(), 'integer');
197 
198  $res = $this->db->query($query);
199  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
200  $this->setRBACId($row->rbac_id);
201  $this->setObjId($row->obj_id);
202  $this->setObjType($row->obj_type);
203  $this->setStatus($row->lifecycle_status);
204  $this->setVersion($row->meta_version);
205  $this->setVersionLanguage(new ilMD5295LanguageItem($row->version_language));
206  }
207  }
208  return true;
209  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:

◆ save()

ilMD5295Lifecycle::save ( )

Definition at line 119 of file class.ilMD5295Lifecycle.php.

References $DIC, $ilDB, __getFields(), ilMD5295Base\getMetaId(), and ilMD5295Base\setMetaId().

120  {
121  global $DIC;
122 
123  $ilDB = $DIC['ilDB'];
124 
125  $fields = $this->__getFields();
126  $fields['meta_lifecycle_id'] = array('integer',$next_id = $ilDB->nextId('il_meta_lifecycle'));
127 
128  if ($this->db->insert('il_meta_lifecycle', $fields)) {
129  $this->setMetaId($next_id);
130  return $this->getMetaId();
131  }
132  return false;
133  }
global $DIC
Definition: goto.php:24
global $ilDB
setMetaId($a_meta_id, $a_read_data=true)
+ Here is the call graph for this function:

◆ setStatus()

ilMD5295Lifecycle::setStatus (   $a_status)

Definition at line 75 of file class.ilMD5295Lifecycle.php.

Referenced by read().

76  {
77  switch ($a_status) {
78  case 'Draft':
79  case 'Final':
80  case 'Revised':
81  case 'Unavailable':
82  $this->status = $a_status;
83 
84  // no break
85  default:
86  return false;
87  }
88  }
+ Here is the caller graph for this function:

◆ setVersion()

ilMD5295Lifecycle::setVersion (   $a_version)

Definition at line 93 of file class.ilMD5295Lifecycle.php.

Referenced by read().

94  {
95  $this->version = $a_version;
96  }
+ Here is the caller graph for this function:

◆ setVersionLanguage()

ilMD5295Lifecycle::setVersionLanguage (   $lng_obj)

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

Referenced by read().

102  {
103  if (is_object($lng_obj)) {
104  $this->version_language = &$lng_obj;
105  }
106  }
+ Here is the caller graph for this function:

◆ toXML()

ilMD5295Lifecycle::toXML ( $writer)

Definition at line 216 of file class.ilMD5295Lifecycle.php.

References getContribute(), getContributeIds(), ilMD5295Base\getObjId(), ilMD5295Base\getRBACId(), getStatus(), getVersion(), and getVersionLanguageCode().

217  {
218  $writer->xmlStartTag('Lifecycle', array('Status' => $this->getStatus()
219  ? $this->getStatus()
220  : 'Draft'));
221  $writer->xmlElement(
222  'Version',
223  array('Language' => $this->getVersionLanguageCode()
224  ? $this->getVersionLanguageCode()
225  : 'en'),
226  $this->getVersion()
227  );
228 
229  // contribute
230  $contributes = $this->getContributeIds();
231  foreach ($contributes as $id) {
232  $con = &$this->getContribute($id);
233  $con->toXML($writer);
234  }
235  if (!count($contributes)) {
236  include_once 'Services/Migration/DBUpdate_5295/classes/class.ilMD5295Contribute.php';
237  $con = new ilMD5295Contribute($this->getRBACId(), $this->getObjId());
238  $con->toXML($writer);
239  }
240  $writer->xmlEndTag('Lifecycle');
241  }
& getContribute($a_contribute_id)
+ Here is the call graph for this function:

◆ update()

ilMD5295Lifecycle::update ( )

Definition at line 135 of file class.ilMD5295Lifecycle.php.

References $DIC, $ilDB, and ilMD5295Base\getMetaId().

136  {
137  global $DIC;
138 
139  $ilDB = $DIC['ilDB'];
140 
141  if ($this->getMetaId()) {
142  if ($this->db->update(
143  'il_meta_lifecycle',
144  $this->__getFields(),
145  array("meta_lifecycle_id" => array('integer',$this->getMetaId()))
146  )) {
147  return true;
148  }
149  }
150  return false;
151  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

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