ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
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.

Member Function Documentation

◆ achieve()

ilObjectNewTypeAddedObjective::achieve ( Environment  $environment)

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

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 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
An environment holds resources to be used in the setup process.
Definition: Environment.php:28
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.

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

+ 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
\ilDatabaseInitializedObjective[]

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

◆ isApplicable()

ilObjectNewTypeAddedObjective::isApplicable ( Environment  $environment)

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

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 }
static _getObjectTypeIdByTitle(string $type, \ilDBInterface $ilDB=null)

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

+ 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: