ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilObjectNewTypeAddedObjective Class Reference
+ Inheritance diagram for ilObjectNewTypeAddedObjective:
+ Collaboration diagram for ilObjectNewTypeAddedObjective:

Public Member Functions

 __construct (string $type, string $type_title)
 
 getHash ()
 
 getLabel ()
 
 isNotable ()
 
 getPreconditions (Environment $environment)
 
 achieve (Environment $environment)
 
 isApplicable (Environment $environment)
 

Protected Attributes

string $type
 
string $type_title
 

Detailed Description

Definition at line 24 of file class.ilObjectNewTypeAddedObjective.php.

Constructor & Destructor Documentation

◆ __construct()

ilObjectNewTypeAddedObjective::__construct ( string  $type,
string  $type_title 
)

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

References $type, and $type_title.

30  {
31  $this->type = $type;
32  $this->type_title = $type_title;
33  }

Member Function Documentation

◆ achieve()

ilObjectNewTypeAddedObjective::achieve ( Environment  $environment)

Definition at line 60 of file class.ilObjectNewTypeAddedObjective.php.

References $id, $type, $type_title, and ILIAS\Setup\Environment\getResource().

60  : Environment
61  {
62  $db = $environment->getResource(Environment::RESOURCE_DATABASE);
63 
64  $id = $db->nextId("object_data");
65 
66  $values = [
67  'obj_id' => ['integer', $id],
68  'type' => ['text', 'typ'],
69  'title' => ['text', $this->type],
70  'description' => ['text', $this->type_title],
71  'owner' => ['integer', -1],
72  'create_date' => ['timestamp', date("Y-m-d H:i:s")],
73  'last_update' => ['timestamp', date("Y-m-d H:i:s")]
74  ];
75 
76  $db->insert("object_data", $values);
77 
78  return $environment;
79  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
An environment holds resources to be used in the setup process.
Definition: Environment.php:27
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
+ Here is the call graph for this function:

◆ getHash()

ilObjectNewTypeAddedObjective::getHash ( )

Definition at line 35 of file class.ilObjectNewTypeAddedObjective.php.

35  : string
36  {
37  return hash("sha256", self::class . "::" . $this->type);
38  }

◆ getLabel()

ilObjectNewTypeAddedObjective::getLabel ( )

Definition at line 40 of file class.ilObjectNewTypeAddedObjective.php.

40  : string
41  {
42  return "Add new type $this->type to object data";
43  }

◆ getPreconditions()

ilObjectNewTypeAddedObjective::getPreconditions ( Environment  $environment)
Returns
[]

Definition at line 53 of file class.ilObjectNewTypeAddedObjective.php.

53  : array
54  {
55  return [
57  ];
58  }

◆ isApplicable()

ilObjectNewTypeAddedObjective::isApplicable ( Environment  $environment)

Definition at line 81 of file class.ilObjectNewTypeAddedObjective.php.

References ilObject\_getObjectTypeIdByTitle(), and ILIAS\Setup\Environment\getResource().

81  : bool
82  {
83  $db = $environment->getResource(Environment::RESOURCE_DATABASE);
84  if (is_null(ilObject::_getObjectTypeIdByTitle($this->type, $db))) {
85  return true;
86  }
87  return false;
88  }
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
static _getObjectTypeIdByTitle(string $type, ?\ilDBInterface $ilDB=null)
+ Here is the call graph for this function:

◆ isNotable()

ilObjectNewTypeAddedObjective::isNotable ( )

Definition at line 45 of file class.ilObjectNewTypeAddedObjective.php.

45  : bool
46  {
47  return true;
48  }

Field Documentation

◆ $type

string ilObjectNewTypeAddedObjective::$type
protected

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

Referenced by __construct(), and achieve().

◆ $type_title

string ilObjectNewTypeAddedObjective::$type_title
protected

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

Referenced by __construct(), and achieve().


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