ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilAdvancedMDRecordScope Class Reference

Scope restrictions for advanced md records. More...

+ Collaboration diagram for ilAdvancedMDRecordScope:

Public Member Functions

 __construct (int $a_scope_id=0)
 
 setRecordId (int $a_record_id)
 
 getRecordId ()
 
 setScopeId (int $a_scope_id)
 
 getScopeId ()
 
 setRefId (int $a_ref_id)
 
 getRefId ()
 
 save ()
 
 update ()
 
 delete ()
 

Static Public Member Functions

static deleteByRecordId (int $a_record_id)
 

Protected Member Functions

 read ()
 

Protected Attributes

ilDBInterface $db
 
ilLogger $logger
 

Private Attributes

int $scope_id
 
int $record_id
 
int $ref_id
 

Detailed Description

Scope restrictions for advanced md records.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilAdvancedMDRecordScope.php.

Constructor & Destructor Documentation

◆ __construct()

ilAdvancedMDRecordScope::__construct ( int  $a_scope_id = 0)

@noinspection PhpUndefinedMethodInspection

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

35 {
36 global $DIC;
37
38 $this->db = $DIC->database();
40 $this->logger = $DIC->logger()->amet();
41
42 $this->scope_id = $a_scope_id;
43 $this->read();
44 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\Repository\logger(), and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilAdvancedMDRecordScope::delete ( )

Definition at line 99 of file class.ilAdvancedMDRecordScope.php.

99 : void
100 {
101 $query = 'DELETE FROM adv_md_record_scope ' .
102 'WHERE scope_id = ' . $this->db->quote($this->scope_id, 'integer');
103 $this->db->manipulate($query);
104 }

◆ deleteByRecordId()

static ilAdvancedMDRecordScope::deleteByRecordId ( int  $a_record_id)
static

Definition at line 106 of file class.ilAdvancedMDRecordScope.php.

106 : void
107 {
108 global $DIC;
109 $db = $DIC->database();
110
111 $query = 'DELETE FROM adv_md_record_scope ' .
112 'WHERE record_id = ' . $db->quote($a_record_id, 'integer');
113 $db->manipulate($query);
114 }
quote($value, string $type)
manipulate(string $query)
Run a (write) Query on the database.

References $db, $DIC, ilDBInterface\manipulate(), and ilDBInterface\quote().

Referenced by ilAdvancedMDRecord\delete(), and ilAdvancedMDRecord\update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRecordId()

ilAdvancedMDRecordScope::getRecordId ( )

Definition at line 51 of file class.ilAdvancedMDRecordScope.php.

51 : int
52 {
53 return $this->record_id;
54 }

References $record_id.

◆ getRefId()

ilAdvancedMDRecordScope::getRefId ( )

Definition at line 71 of file class.ilAdvancedMDRecordScope.php.

71 : int
72 {
73 return $this->ref_id;
74 }

References $ref_id.

◆ getScopeId()

ilAdvancedMDRecordScope::getScopeId ( )

Definition at line 61 of file class.ilAdvancedMDRecordScope.php.

61 : int
62 {
63 return $this->scope_id;
64 }

References $scope_id.

◆ read()

ilAdvancedMDRecordScope::read ( )
protected

Definition at line 116 of file class.ilAdvancedMDRecordScope.php.

116 : void
117 {
118 if (!$this->scope_id) {
119 return;
120 }
121 $query = 'SELECT * FROM adv_md_record_scope ' .
122 'WHERE scope_id = ' . $this->db->quote($this->scope_id, 'integer');
123 $res = $this->db->query($query);
124 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
125 $this->record_id = (int) $row->record_id;
126 $this->ref_id = (int) $row->ref_id;
127 }
128 }
$res
Definition: ltiservices.php:69

References $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilAdvancedMDRecordScope::save ( )

Definition at line 76 of file class.ilAdvancedMDRecordScope.php.

76 : void
77 {
78 // create
79 $this->scope_id = $this->db->nextId('adv_md_record_scope');
80 $query = 'INSERT INTO adv_md_record_scope (scope_id, record_id, ref_id) ' .
81 'VALUES ( ' .
82 $this->db->quote($this->scope_id, 'integer') . ', ' .
83 $this->db->quote($this->record_id, 'integer') . ', ' .
84 $this->db->quote($this->ref_id, 'integer') .
85 ')';
86 $this->db->manipulate($query);
87 }

◆ setRecordId()

ilAdvancedMDRecordScope::setRecordId ( int  $a_record_id)

Definition at line 46 of file class.ilAdvancedMDRecordScope.php.

46 : void
47 {
48 $this->record_id = $a_record_id;
49 }

◆ setRefId()

ilAdvancedMDRecordScope::setRefId ( int  $a_ref_id)

Definition at line 66 of file class.ilAdvancedMDRecordScope.php.

66 : void
67 {
68 $this->ref_id = $a_ref_id;
69 }

◆ setScopeId()

ilAdvancedMDRecordScope::setScopeId ( int  $a_scope_id)

Definition at line 56 of file class.ilAdvancedMDRecordScope.php.

56 : void
57 {
58 $this->scope_id = $a_scope_id;
59 }

◆ update()

ilAdvancedMDRecordScope::update ( )

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

89 : void
90 {
91 $this->logger->debug('Update entry.');
92 // update (update of record ids not supported)
93 $query = 'UPDATE adv_md_record_scope ' .
94 'SET ref_id = ' . $this->db->quote($this->ref_id, 'integer') . ' ' .
95 'WHERE scope_id = ' . $this->db->quote($this->scope_id, 'integer');
96 $this->db->manipulate($query);
97 }

References ILIAS\Repository\logger().

+ Here is the call graph for this function:

Field Documentation

◆ $db

ilDBInterface ilAdvancedMDRecordScope::$db
protected

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

Referenced by deleteByRecordId().

◆ $logger

ilLogger ilAdvancedMDRecordScope::$logger
protected

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

◆ $record_id

int ilAdvancedMDRecordScope::$record_id
private

Definition at line 28 of file class.ilAdvancedMDRecordScope.php.

Referenced by getRecordId().

◆ $ref_id

int ilAdvancedMDRecordScope::$ref_id
private

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

Referenced by getRefId().

◆ $scope_id

int ilAdvancedMDRecordScope::$scope_id
private

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

Referenced by getScopeId().


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