ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilCmiXapiLrsTypeList Class Reference
+ Collaboration diagram for ilCmiXapiLrsTypeList:

Static Public Member Functions

static getTypesData (bool $a_extended=false, ?int $a_availability=null)
 Get basic data array of all types (without field definitions) More...
 
static countUntrashedUsages (int $a_type_id)
 Count the number of untrashed usages of a type. More...
 
static getTypeOptions (?int $a_availability=null)
 Get array of options for selecting the type. More...
 
static getTypesStruct ()
 
static getCountTypesForCreate ()
 

Detailed Description

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

Member Function Documentation

◆ countUntrashedUsages()

static ilCmiXapiLrsTypeList::countUntrashedUsages ( int  $a_type_id)
static

Count the number of untrashed usages of a type.

Definition at line 62 of file class.ilCmiXapiLrsTypeList.php.

62 : int
63 {
64 global $ilDB;
65
66 $query = "
67 SELECT COUNT(*) untrashed
68 FROM cmix_settings s
69 INNER JOIN object_reference r
70 ON r.obj_id = s.obj_id
71 AND r.deleted IS NULL
72 WHERE s.lrs_type_id = %s
73 ";
74
75 $res = $ilDB->queryF($query, ['integer'], [$a_type_id]);
76 $row = $ilDB->fetchObject($res);
77 return (int) $row->untrashed;
78 }
$res
Definition: ltiservices.php:69

References $ilDB, and $res.

Referenced by getTypesData().

+ Here is the caller graph for this function:

◆ getCountTypesForCreate()

static ilCmiXapiLrsTypeList::getCountTypesForCreate ( )
static

Definition at line 138 of file class.ilCmiXapiLrsTypeList.php.

138 : int
139 {
140 global $ilDB;
141 $query = "SELECT COUNT(*) counter FROM " . ilCmiXapiLrsType::getDbTableName() . "
142 WHERE availability = " . $ilDB->quote(ilCmiXapiLrsType::AVAILABILITY_CREATE, 'integer');
143 $res = $ilDB->query($query);
144 $row = $ilDB->fetchObject($res);
145 return (int) $row->counter;
146 }

References $ilDB, $res, ilCmiXapiLrsType\AVAILABILITY_CREATE, and ilCmiXapiLrsType\getDbTableName().

+ Here is the call graph for this function:

◆ getTypeOptions()

static ilCmiXapiLrsTypeList::getTypeOptions ( ?int  $a_availability = null)
static

Get array of options for selecting the type.

Parameters
int | null$a_availabilityrequired availability or null
Returns
array id => title

Definition at line 85 of file class.ilCmiXapiLrsTypeList.php.

85 : array
86 {
87 global $ilDB;
88
89 $query = "SELECT * FROM " . ilCmiXapiLrsType::getDbTableName();
90 if (isset($a_availability)) {
91 $query .= " WHERE availability=" . $ilDB->quote($a_availability, 'integer');
92 }
93 $res = $ilDB->query($query);
94
95 $options = array();
96 while ($row = $ilDB->fetchObject($res)) {
97 $options[$row->type_id] = $row->title;
98 }
99 return $options;
100 }

References $ilDB, $res, and ilCmiXapiLrsType\getDbTableName().

+ Here is the call graph for this function:

◆ getTypesData()

static ilCmiXapiLrsTypeList::getTypesData ( bool  $a_extended = false,
?int  $a_availability = null 
)
static

Get basic data array of all types (without field definitions)

Parameters
booleanget extended data ('usages')
mixedrequired availability or null
Returns
array array of assoc data arrays

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

36 : array
37 {
38 global $ilDB;
39
40 $query = "SELECT * FROM " . ilCmiXapiLrsType::getDbTableName();
41 if (isset($a_availability)) {
42 $query .= " WHERE availability=" . $ilDB->quote($a_availability, 'integer');
43 }
44 $query .= " ORDER BY title";
45 $res = $ilDB->query($query);
46
47 $data = array();
48 while ($row = $ilDB->fetchAssoc($res)) {
49 $row['lrs_type_id'] = $row['type_id']; // indeed it is an lrs-type-id
50
51 if ($a_extended) {
52 $row['usages'] = self::countUntrashedUsages((int) $row['lrs_type_id']);
53 }
54 $data[] = $row;
55 }
56 return $data;
57 }
static countUntrashedUsages(int $a_type_id)
Count the number of untrashed usages of a type.

References $data, $ilDB, $res, countUntrashedUsages(), and ilCmiXapiLrsType\getDbTableName().

Referenced by ilObjCmiXapiGUI\initCreateForm(), and ilObjCmiXapiAdministrationGUI\showLrsTypesListCmd().

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

◆ getTypesStruct()

static ilCmiXapiLrsTypeList::getTypesStruct ( )
static
Returns
array<string, mixed[]>

Definition at line 105 of file class.ilCmiXapiLrsTypeList.php.

105 : array
106 {
107 return array(
108 'type_name' => array('type' => 'text', 'maxlength' => 32)
109 ,
110 'title' => array('type' => 'text', 'maxlength' => 255)
111 ,
112 'description' => array('type' => 'text', 'maxlength' => 4000)
113 ,
114 'availability' => array('type' => 'a_integer', 'maxlength' => 1, 'options' => array(2, 1, 0))
115 //AVAILABILITY_CREATE,AVAILABILITY_EXISTING,AVAILABILITY_NONE
116 // , 'lrs' => array('type'=>'headline')
117 ,
118 'lrs_type_id' => array('type' => 'a_integer', 'maxlength' => 1, 'options' => array(0))
119 ,
120 'lrs_endpoint' => array('type' => 'text', 'maxlength' => 64, 'required' => true)
121 ,
122 'lrs_key' => array('type' => 'text', 'maxlength' => 64, 'required' => true)
123 ,
124 'lrs_secret' => array('type' => 'text', 'maxlength' => 64, 'required' => true)
125 ,
126 'external_lrs' => array('type' => 'bool')
127 ,
128 'privacy_ident' => array('type' => 'a_integer', 'maxlength' => 1, 'options' => array(0, 1, 2, 3))
129 ,
130 'privacy_name' => array('type' => 'a_integer', 'maxlength' => 1, 'options' => array(0, 1, 2, 3))
131 ,
132 'privacy_comment_default' => array('type' => 'text', 'maxlength' => 2000)
133 ,
134 'remarks' => array('type' => 'text', 'maxlength' => 4000)
135 );
136 }

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