ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilMDCreator.php
Go to the documentation of this file.
1 <?php
2 
3 
4 /*
5  +-----------------------------------------------------------------------------+
6  | ILIAS open source |
7  +-----------------------------------------------------------------------------+
8  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9  | |
10  | This program is free software; you can redistribute it and/or |
11  | modify it under the terms of the GNU General Public License |
12  | as published by the Free Software Foundation; either version 2 |
13  | of the License, or (at your option) any later version. |
14  | |
15  | This program is distributed in the hope that it will be useful, |
16  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18  | GNU General Public License for more details. |
19  | |
20  | You should have received a copy of the GNU General Public License |
21  | along with this program; if not, write to the Free Software |
22  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23  +-----------------------------------------------------------------------------+
24 */
25 
26 
37 {
38  public $md_obj = null;
39 
40  /*
41  * rbac_id ref_id of rbac object (e.g for page objects the obj_id of the content object)
42  */
43  public $rbac_id;
44 
45  /*
46  * obj_id (e.g for structure objects the obj_id of the structure object)
47  */
48  public $obj_id;
49 
50  /*
51  * type of the object (e.g st,pg,crs ...)
52  */
53  public $obj_type;
54 
55  public function __construct($a_rbac_id, $a_obj_id, $a_type)
56  {
57  include_once 'Services/MetaData/classes/class.ilMD.php';
58 
59  if ($a_obj_id == 0) {
60  $a_obj_id = $a_rbac_id;
61  }
62 
63  $this->rbac_id = $a_rbac_id;
64  $this->obj_id = $a_obj_id;
65  $this->obj_type = $a_type;
66 
67  $this->md_obj = new ilMD($a_rbac_id, $a_obj_id, $a_type);
68  }
69 
70  // SET/GET
71  public function setTitle($a_title)
72  {
73  $this->title = $a_title;
74  }
75  public function getTitle()
76  {
77  return $this->title;
78  }
79  public function setDescription($a_desc)
80  {
81  $this->description = $a_desc;
82  }
83  public function getDescription()
84  {
85  return $this->description;
86  }
87  public function setTitleLanguage($a_lng)
88  {
89  $this->title_lng = $a_lng;
90  }
91  public function &getTitleLanguage()
92  {
93  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
94 
95  return new ilMDLanguageItem($this->title_lng);
96  }
97  public function setDescriptionLanguage($a_lng)
98  {
99  $this->title_lng = $a_lng;
100  }
101  public function &getDescriptionLanguage()
102  {
103  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
104 
105  return new ilMDLanguageItem($this->title_lng);
106  }
107  public function setLanguage($a_lng)
108  {
109  $this->title_lng = $a_lng;
110  }
111  public function &getLanguage()
112  {
113  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
114 
115  return new ilMDLanguageItem($this->title_lng);
116  }
117  public function setKeyword($a_key)
118  {
119  $this->keyword = $a_key;
120  }
121  public function getKeyword()
122  {
123  return $this->keyword;
124  }
125 
126 
127  public function getRBACId()
128  {
129  return $this->rbac_id;
130  }
131  public function getObjId()
132  {
133  return $this->obj_id;
134  }
135  public function getObjType()
136  {
137  return $this->obj_type;
138  }
139  public function setKeywordLanguage($a_lng)
140  {
141  $this->title_lng = $a_lng;
142  }
143  public function &getKeywordLanguage()
144  {
145  include_once 'Services/MetaData/classes/class.ilMDLanguageItem.php';
146 
147  return new ilMDLanguageItem($this->title_lng);
148  }
149  public function setCatalog($a_cat)
150  {
151  $this->catalog = $a_cat;
152  }
153  public function getCatalog()
154  {
155  return $this->catalog ? $this->catalog : 'ILIAS';
156  }
157  public function setEntry($a_entry)
158  {
159  $this->entry = $a_entry;
160  }
161  public function getEntry()
162  {
163  return $this->entry ? $this->entry : 'il__' . $this->getObjType() . '_' . $this->getObjId();
164  }
165  public function setStructure($a_structure)
166  {
167  $this->structure = $a_structure;
168  }
169  public function getStructure()
170  {
171  return $this->structure ? $this->structure : 'Hierarchical';
172  }
173 
174 
175 
176  public function create()
177  {
178  $this->__createGeneral();
179  }
180 
181  // PROTECTED
182  public function __createGeneral()
183  {
184  $md_gen = &$this->md_obj->addGeneral();
185 
186  $md_gen->setStructure($this->getStructure());
187  $md_gen->setTitle($this->getTitle());
188  $md_gen->setTitleLanguage($this->getTitleLanguage());
189  $md_gen->save();
190 
191  $md_ide = &$md_gen->addIdentifier();
192  $md_ide->setCatalog($this->getCatalog());
193  $md_ide->setEntry($this->getEntry());
194  $md_ide->save();
195 
196  $md_lng = &$md_gen->addLanguage();
197  $md_lng->setLanguage($this->getLanguage());
198  $md_lng->save();
199 
200  $md_des = &$md_gen->addDescription();
201  $md_des->setDescription($this->getDescription());
202  $md_des->setDescriptionLanguage($this->getDescriptionLanguage());
203  $md_des->save();
204 
205  $md_key = &$md_gen->addKeyword();
206  $md_key->setKeyword($this->getKeyword());
207  $md_key->setKeywordLanguage($this->getKeywordLanguage());
208  $md_key->save();
209 
210  return true;
211  }
212 }
setEntry($a_entry)
setDescriptionLanguage($a_lng)
setTitle($a_title)
$a_type
Definition: workflow.php:92
setStructure($a_structure)
setDescription($a_desc)
__construct($a_rbac_id, $a_obj_id, $a_type)
setKeywordLanguage($a_lng)
setTitleLanguage($a_lng)