ILIAS  trunk Revision v11.0_alpha-1761-g6dbbfa7b760
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilVerificationObject 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 ilVerificationObject:
+ Collaboration diagram for ilVerificationObject:

Public Member Functions

 __construct (int $a_id=0, bool $a_reference=true)
 
 hasProperty (string $a_name)
 Check if given property is valid. More...
 
 getPropertyType (string $a_name)
 Get property data type. More...
 
 getProperty (string $a_name)
 Get property value. More...
 
 setProperty (string $a_name, $a_value)
 Set property value. More...
 
 getFilePath ()
 
 getOfflineFilename ()
 
- Public Member Functions inherited from ilObject2
 __construct (int $a_id=0, bool $a_reference=true)
 Constructor. More...
 
 read ()
 
 create (bool $a_clone_mode=false)
 
 update ()
 
 delete ()
 
 cloneMetaData (ilObject $target_obj)
 
 cloneObject (int $target_id, int $copy_id=0, bool $omit_tree=false)
 
- Public Member Functions inherited from ilObject
 getObjectProperties ()
 
 flushObjectProperties ()
 
 withReferences ()
 determines whether objects are referenced or not (got ref ids or not) More...
 
 processAutoRating ()
 
 read ()
 
 getId ()
 
 setId (int $id)
 
 setRefId (int $ref_id)
 
 getRefId ()
 
 getType ()
 
 setType (string $type)
 
 getPresentationTitle ()
 get presentation title Normally same as title Overwritten for sessions More...
 
 getTitle ()
 
 getUntranslatedTitle ()
 Get untranslated object title WebDAV needs to access the untranslated title of an object. More...
 
 setTitle (string $title)
 
 getDescription ()
 
 setDescription (string $description)
 
 getLongDescription ()
 get object long description (stored in object_description) More...
 
 getImportId ()
 
 setImportId (string $import_id)
 
 setOfflineStatus (bool $status)
 
 getOfflineStatus ()
 
 supportsOfflineHandling ()
 
 getOwner ()
 
 getOwnerName ()
 get full name of object owner More...
 
 setOwner (int $usr_id)
 
 getCreateDate ()
 Get create date in YYYY-MM-DD HH-MM-SS format. More...
 
 getLastUpdateDate ()
 Get last update date in YYYY-MM-DD HH-MM-SS format. More...
 
 create ()
 note: title, description and type should be set when this function is called More...
 
 update ()
 
 MDUpdateListener (string $element)
 Metadata update listener. More...
 
 createMetaData ()
 
 updateMetaData ()
 
 deleteMetaData ()
 
 updateOwner ()
 update owner of object in db More...
 
 putInTree (int $parent_ref_id)
 maybe this method should be in tree object!? More...
 
 setPermissions (int $parent_ref_id)
 
 setParentRolePermissions (int $parent_ref_id)
 Initialize the permissions of parent roles (local roles of categories, global roles...) This method is overwritten in e.g. More...
 
 createReference ()
 creates reference for object More...
 
 countReferences ()
 
 delete ()
 delete object or referenced object (in the case of a referenced object, object data is only deleted if last reference is deleted) This function removes an object entirely from system!! More...
 
 initDefaultRoles ()
 init default roles settings Purpose of this function is to create a local role folder and local roles, that are needed depending on the object type. More...
 
 applyDidacticTemplate (int $tpl_id)
 
 getXMLZip ()
 
 getHTMLDirectory ()
 
 appendCopyInfo (int $target_id, int $copy_id)
 Prepend Copy info if object with same name exists in that container. More...
 
 cloneDependencies (int $target_id, int $copy_id)
 Clone object dependencies. More...
 
 cloneMetaData (ilObject $target_obj)
 Copy meta data. More...
 
 selfOrParentWithRatingEnabled ()
 
 getPossibleSubObjects (bool $filter=true)
 get all possible sub objects of this type the object can decide which types of sub objects are possible jut in time overwrite if the decision distinguish from standard model More...
 

Static Public Member Functions

static initStorage (int $a_id, ?string $a_subdir=null)
 
- Static Public Member Functions inherited from ilObject
static _lookupObjIdByImportId (string $import_id)
 Get (latest) object id for an import id. More...
 
static _lookupImportId (int $obj_id)
 
static _lookupOwnerName (int $owner_id)
 Lookup owner name for owner id. More...
 
static _getIdForImportId (string $import_id)
 
static _getAllReferences (int $id)
 get all reference ids for object ID More...
 
static _lookupTitle (int $obj_id)
 
static lookupOfflineStatus (int $obj_id)
 Lookup offline status using objectDataCache. More...
 
static _lookupOwner (int $obj_id)
 Lookup owner user ID for object ID. More...
 
static _getIdsForTitle (string $title, string $type='', bool $partial_match=false)
 
static _lookupDescription (int $obj_id)
 
static _lookupLastUpdate (int $obj_id, bool $formatted=false)
 
static _getLastUpdateOfObjects (array $obj_ids)
 
static _lookupObjId (int $ref_id)
 
static _setDeletedDate (int $ref_id, int $deleted_by)
 
static setDeletedDates (array $ref_ids, int $user_id)
 
static _resetDeletedDate (int $ref_id)
 
static _lookupDeletedDate (int $ref_id)
 
static _writeTitle (int $obj_id, string $title)
 write title to db (static) More...
 
static _writeDescription (int $obj_id, string $desc)
 write description to db (static) More...
 
static _writeImportId (int $obj_id, string $import_id)
 write import id to db (static) More...
 
static _lookupType (int $id, bool $reference=false)
 
static _isInTrash (int $ref_id)
 
static _hasUntrashedReference (int $obj_id)
 checks whether an object has at least one reference that is not in trash More...
 
static _lookupObjectId (int $ref_id)
 
static _getObjectsDataForType (string $type, bool $omit_trash=false)
 get all objects of a certain type More...
 
static _exists (int $id, bool $reference=false, ?string $type=null)
 checks if an object exists in object_data More...
 
static _getObjectsByType (string $obj_type="", ?int $owner=null)
 
static _prepareCloneSelection (array $ref_ids, string $new_type, bool $show_path=true)
 Prepare copy wizard object selection. More...
 
static getIconForType (string $type)
 
static _getIcon (int $obj_id=0, string $size="big", string $type="", bool $offline=false)
 Get icon for repository item. More...
 
static collectDeletionDependencies (array &$deps, int $ref_id, int $obj_id, string $type, int $depth=0)
 Collect deletion dependencies. More...
 
static getDeletionDependencies (int $obj_id)
 Get deletion dependencies. More...
 
static getLongDescriptions (array $obj_ids)
 
static getAllOwnedRepositoryObjects (int $user_id)
 
static fixMissingTitles ($type, array &$obj_title_map)
 Try to fix missing object titles. More...
 
static _lookupCreationDate (int $obj_id)
 
static _getObjectTypeIdByTitle (string $type, ?\ilDBInterface $ilDB=null)
 

Data Fields

const TYPE_STRING = 1
 
const TYPE_BOOL = 2
 
const TYPE_INT = 3
 
const TYPE_DATE = 4
 
const TYPE_RAW = 5
 
const TYPE_ARRAY = 6
 
- Data Fields inherited from ilObject
const TITLE_LENGTH = 255
 
const DESC_LENGTH = 128
 
const LONG_DESC_LENGTH = 4000
 
const TABLE_OBJECT_DATA = "object_data"
 
array $objectList
 
string $untranslatedTitle
 

Protected Member Functions

 getPropertyMap ()
 Return property map (name => type) More...
 
 importProperty (string $a_type, $a_data=null, ?string $a_raw_data=null)
 Import property from database. More...
 
 exportProperty (string $a_name)
 Export property to database. More...
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 doUpdate ()
 
 saveProperties ()
 Save current properties to database. More...
 
 doDelete ()
 
 handleQuotaUpdate ()
 
- Protected Member Functions inherited from ilObject2
 initType ()
 
 doRead ()
 
 doCreate (bool $clone_mode=false)
 
 beforeCreate ()
 If overwritten this method should return true, there is currently no "abort" handling for cases where "false" is returned. More...
 
 doUpdate ()
 
 beforeUpdate ()
 
 doDelete ()
 
 beforeDelete ()
 
 doCloneObject (ilObject2 $new_obj, int $a_target_id, ?int $a_copy_id=null)
 
 beforeCloneObject ()
 
- Protected Member Functions inherited from ilObject
 doMDUpdateListener (string $a_element)
 
 beforeMDUpdateListener (string $a_element)
 
 doCreateMetaData ()
 
 beforeCreateMetaData ()
 
 doUpdateMetaData ()
 
 beforeUpdateMetaData ()
 
 doDeleteMetaData ()
 
 beforeDeleteMetaData ()
 
 handleAutoRating ()
 
 hasAutoRating ()
 

Protected Attributes

array $map = array()
 
array $properties = array()
 
- Protected Attributes inherited from ilObject
ilLogger $obj_log
 
ILIAS $ilias
 
ilObjectDefinition $obj_definition
 
ilDBInterface $db
 
ilLogger $log
 
ilErrorHandling $error
 
ilTree $tree
 
ilAppEventHandler $app_event_handler
 
ilRbacAdmin $rbac_admin
 
ilRbacReview $rbac_review
 
ilObjUser $user
 
ilLanguage $lng
 
LOMServices $lom_services
 
bool $call_by_reference
 
int $max_title = self::TITLE_LENGTH
 
int $max_desc = self::DESC_LENGTH
 
bool $add_dots = true
 
int $ref_id = null
 
string $type = ""
 
string $title = ""
 
string $desc = ""
 
string $long_desc = ""
 
int $owner = 0
 
string $create_date = ""
 
string $last_update = ""
 
string $import_id = ""
 
bool $register = false
 

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 Verification object base class

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 24 of file class.ilVerificationObject.php.

Constructor & Destructor Documentation

◆ __construct()

ilVerificationObject::__construct ( int  $a_id = 0,
bool  $a_reference = true 
)

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

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), and getPropertyMap().

39  {
40  global $DIC;
41 
42  $this->db = $DIC->database();
43  $this->map = $this->getPropertyMap();
44  parent::__construct($a_id, $a_reference);
45  }
global $DIC
Definition: shib_login.php:22
__construct(Container $dic, ilPlugin $plugin)
getPropertyMap()
Return property map (name => type)
+ Here is the call graph for this function:

Member Function Documentation

◆ doCreate()

ilVerificationObject::doCreate ( bool  $clone_mode = false)
protected

Definition at line 198 of file class.ilVerificationObject.php.

References saveProperties().

198  : void
199  {
200  $this->saveProperties();
201  }
saveProperties()
Save current properties to database.
+ Here is the call graph for this function:

◆ doDelete()

ilVerificationObject::doDelete ( )
protected

Definition at line 238 of file class.ilVerificationObject.php.

References ilObject\$db, $ilDB, and handleQuotaUpdate().

238  : void
239  {
240  $ilDB = $this->db;
241 
242  if ($this->id) {
243  // remove all files
244  $storage = new ilVerificationStorageFile($this->id);
245  $storage->delete();
246 
247  $this->handleQuotaUpdate();
248 
249  $ilDB->manipulate("DELETE FROM il_verification" .
250  " WHERE id = " . $ilDB->quote($this->id, "integer"));
251  }
252  }
ilDBInterface $db
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ doRead()

ilVerificationObject::doRead ( )
protected

Definition at line 179 of file class.ilVerificationObject.php.

References ilObject\$db, $ilDB, and importProperty().

179  : void
180  {
181  $ilDB = $this->db;
182 
183  if ($this->id) {
184  $set = $ilDB->query("SELECT * FROM il_verification" .
185  " WHERE id = " . $ilDB->quote($this->id, "integer"));
186  if ($ilDB->numRows($set)) {
187  while ($row = $ilDB->fetchAssoc($set)) {
188  $this->importProperty(
189  $row["type"],
190  $row["parameters"],
191  $row["raw_data"]
192  );
193  }
194  }
195  }
196  }
importProperty(string $a_type, $a_data=null, ?string $a_raw_data=null)
Import property from database.
ilDBInterface $db
+ Here is the call graph for this function:

◆ doUpdate()

ilVerificationObject::doUpdate ( )
protected

Definition at line 203 of file class.ilVerificationObject.php.

References saveProperties().

203  : void
204  {
205  $this->saveProperties();
206  }
saveProperties()
Save current properties to database.
+ Here is the call graph for this function:

◆ exportProperty()

ilVerificationObject::exportProperty ( string  $a_name)
protected

Export property to database.

Returns
array(parameters, raw_data)

Definition at line 147 of file class.ilVerificationObject.php.

References getProperty(), getPropertyType(), IL_CAL_DATE, and null.

Referenced by saveProperties().

147  : ?array
148  {
149  $data_type = $this->getPropertyType($a_name);
150  if ($data_type) {
151  $value = $this->getProperty($a_name);
152  $raw_data = null;
153 
154  switch ($data_type) {
155  case self::TYPE_DATE:
156  if ($value) {
157  $value = $value->get(IL_CAL_DATE);
158  }
159  break;
160 
161  case self::TYPE_ARRAY:
162  if ($value) {
163  $value = serialize($value);
164  }
165  break;
166 
167  case self::TYPE_RAW:
168  $raw_data = $value;
169  $value = null;
170  break;
171  }
172 
173  return array("parameters" => $value,
174  "raw_data" => $raw_data);
175  }
176  return null;
177  }
getPropertyType(string $a_name)
Get property data type.
getProperty(string $a_name)
Get property value.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFilePath()

ilVerificationObject::getFilePath ( )

Definition at line 272 of file class.ilVerificationObject.php.

References $path, ilObject\getId(), and getProperty().

272  : string
273  {
274  $file = $this->getProperty("file");
275  if ($file) {
276  $path = self::initStorage($this->getId(), "certificate");
277  return $path . $file;
278  }
279  return "";
280  }
getProperty(string $a_name)
Get property value.
$path
Definition: ltiservices.php:29
+ Here is the call graph for this function:

◆ getOfflineFilename()

ilVerificationObject::getOfflineFilename ( )

Definition at line 282 of file class.ilVerificationObject.php.

References ilFileUtils\getASCIIFilename(), and ilObject\getTitle().

282  : string
283  {
284  return ilFileUtils::getASCIIFilename($this->getTitle()) . ".pdf";
285  }
static getASCIIFilename(string $a_filename)
+ Here is the call graph for this function:

◆ getProperty()

ilVerificationObject::getProperty ( string  $a_name)

Get property value.

Returns
mixed

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

References hasProperty(), and null.

Referenced by exportProperty(), and getFilePath().

76  {
77  if ($this->hasProperty($a_name)) {
78  return $this->properties[$a_name];
79  }
80  return null;
81  }
hasProperty(string $a_name)
Check if given property is valid.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPropertyMap()

ilVerificationObject::getPropertyMap ( )
abstractprotected

Return property map (name => type)

Referenced by __construct(), and saveProperties().

+ Here is the caller graph for this function:

◆ getPropertyType()

ilVerificationObject::getPropertyType ( string  $a_name)

Get property data type.

Definition at line 63 of file class.ilVerificationObject.php.

References hasProperty(), and null.

Referenced by exportProperty(), and importProperty().

63  : ?int
64  {
65  if ($this->hasProperty($a_name)) {
66  return (int) $this->map[$a_name];
67  }
68  return null;
69  }
hasProperty(string $a_name)
Check if given property is valid.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ handleQuotaUpdate()

ilVerificationObject::handleQuotaUpdate ( )
protected

Definition at line 287 of file class.ilVerificationObject.php.

Referenced by doDelete(), and saveProperties().

287  : void
288  {
289  }
+ Here is the caller graph for this function:

◆ hasProperty()

ilVerificationObject::hasProperty ( string  $a_name)

Check if given property is valid.

Definition at line 55 of file class.ilVerificationObject.php.

Referenced by getProperty(), getPropertyType(), and setProperty().

55  : bool
56  {
57  return array_key_exists($a_name, $this->map);
58  }
+ Here is the caller graph for this function:

◆ importProperty()

ilVerificationObject::importProperty ( string  $a_type,
  $a_data = null,
?string  $a_raw_data = null 
)
protected

Import property from database.

Parameters
string$a_type
mixed$a_data
?string$a_raw_data

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

References getPropertyType(), IL_CAL_DATE, ILIAS\Repository\int(), null, and setProperty().

Referenced by doRead().

105  : void {
106  $data_type = $this->getPropertyType($a_type);
107  if ($data_type) {
108  $value = null;
109 
110  switch ($data_type) {
111  case self::TYPE_STRING:
112  $value = (string) $a_data;
113  break;
114 
115  case self::TYPE_BOOL:
116  $value = (bool) $a_data;
117  break;
118 
119  case self::TYPE_INT:
120  $value = (int) $a_data;
121  break;
122 
123  case self::TYPE_DATE:
124  $value = new ilDate($a_data, IL_CAL_DATE);
125  break;
126 
127  case self::TYPE_ARRAY:
128  if ($a_data) {
129  $value = unserialize($a_data, ['allowed_classes' => false]);
130  }
131  break;
132 
133  case self::TYPE_RAW:
134  $value = $a_raw_data;
135  break;
136  }
137 
138  $this->setProperty($a_type, $value);
139  }
140  }
getPropertyType(string $a_name)
Get property data type.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
const IL_CAL_DATE
setProperty(string $a_name, $a_value)
Set property value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initStorage()

static ilVerificationObject::initStorage ( int  $a_id,
?string  $a_subdir = null 
)
static

Definition at line 254 of file class.ilVerificationObject.php.

References $path.

254  : string
255  {
256  $storage = new ilVerificationStorageFile($a_id);
257  $storage->create();
258 
259  $path = $storage->getAbsolutePath() . "/";
260 
261  if ($a_subdir) {
262  $path .= $a_subdir . "/";
263 
264  if (!is_dir($path)) {
265  mkdir($path);
266  }
267  }
268 
269  return $path;
270  }
$path
Definition: ltiservices.php:29
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

◆ saveProperties()

ilVerificationObject::saveProperties ( )
protected

Save current properties to database.

Definition at line 211 of file class.ilVerificationObject.php.

References ilObject\$db, $ilDB, ilObject\$type, exportProperty(), getPropertyMap(), and handleQuotaUpdate().

Referenced by doCreate(), and doUpdate().

211  : bool
212  {
213  $ilDB = $this->db;
214 
215  if ($this->id) {
216  // remove all existing properties
217  $ilDB->manipulate("DELETE FROM il_verification" .
218  " WHERE id = " . $ilDB->quote($this->id, "integer"));
219 
220  foreach ($this->getPropertyMap() as $name => $type) {
221  $property = $this->exportProperty($name);
222 
223  $fields = array("id" => array("integer", $this->id),
224  "type" => array("text", $name),
225  "parameters" => array("text", $property["parameters"]),
226  "raw_data" => array("text", $property["raw_data"]));
227 
228  $ilDB->insert("il_verification", $fields);
229  }
230 
231  $this->handleQuotaUpdate();
232 
233  return true;
234  }
235  return false;
236  }
string $type
ilDBInterface $db
exportProperty(string $a_name)
Export property to database.
getPropertyMap()
Return property map (name => type)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setProperty()

ilVerificationObject::setProperty ( string  $a_name,
  $a_value 
)

Set property value.

Parameters
mixed$a_value

Definition at line 87 of file class.ilVerificationObject.php.

References hasProperty().

Referenced by importProperty().

87  : void
88  {
89  if ($this->hasProperty($a_name)) {
90  $this->properties[$a_name] = $a_value;
91  }
92  }
hasProperty(string $a_name)
Check if given property is valid.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $map

array ilVerificationObject::$map = array()
protected

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

◆ $properties

array ilVerificationObject::$properties = array()
protected

Definition at line 27 of file class.ilVerificationObject.php.

◆ TYPE_ARRAY

const ilVerificationObject::TYPE_ARRAY = 6

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

◆ TYPE_BOOL

const ilVerificationObject::TYPE_BOOL = 2

Definition at line 30 of file class.ilVerificationObject.php.

◆ TYPE_DATE

const ilVerificationObject::TYPE_DATE = 4

Definition at line 32 of file class.ilVerificationObject.php.

◆ TYPE_INT

const ilVerificationObject::TYPE_INT = 3

Definition at line 31 of file class.ilVerificationObject.php.

◆ TYPE_RAW

const ilVerificationObject::TYPE_RAW = 5

Definition at line 33 of file class.ilVerificationObject.php.

◆ TYPE_STRING

const ilVerificationObject::TYPE_STRING = 1

Definition at line 29 of file class.ilVerificationObject.php.


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