ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclIliasReferenceFieldModel.php
Go to the documentation of this file.
1 <?php
2 
3 require_once("./Modules/DataCollection/classes/Helpers/class.ilDclRecordQueryObject.php");
4 
12 
18  public function getRecordQuerySortObject($direction = "asc", $sort_by_status = false){
19  global $DIC;
20  $ilDB = $DIC['ilDB'];
21 
22  $join_str = "LEFT JOIN il_dcl_record_field AS sort_record_field_{$this->getId()} ON (sort_record_field_{$this->getId()}.record_id = record.id AND sort_record_field_{$this->getId()}.field_id = "
23  . $ilDB->quote($this->getId(), 'integer') . ") ";
24  $join_str .= "LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS sort_stloc_{$this->getId()} ON (sort_stloc_{$this->getId()}.record_field_id = sort_record_field_{$this->getId()}.id) ";
25  $join_str .= "LEFT JOIN object_reference AS sort_object_reference_{$this->getId()} ON (sort_object_reference_{$this->getId()}.ref_id = sort_stloc_{$this->getId()}.value AND sort_object_reference_{$this->getId()}.deleted IS NULL)";
26  $join_str .= "LEFT JOIN object_data AS sort_object_data_{$this->getId()} ON (sort_object_data_{$this->getId()}.obj_id = sort_object_reference_{$this->getId()}.obj_id)";
27 
28  if ($sort_by_status) {
29  global $DIC;
30  $ilUser = $DIC['ilUser'];
31  $join_str .= "LEFT JOIN ut_lp_marks AS ut ON (ut.obj_id = sort_object_data_{$this->getId()}.obj_id AND ut.usr_id = "
32  . $ilDB->quote($ilUser->getId(), 'integer') . ") ";
33  }
34 
35  $select_str = (! $sort_by_status) ? " sort_object_data_{$this->getId()}.title AS field_{$this->getId()}," : " ut.status AS field_{$this->getId()}";
36 
37  $sql_obj = new ilDclRecordQueryObject();
38  $sql_obj->setSelectStatement($select_str);
39  $sql_obj->setJoinStatement($join_str);
40  $sql_obj->setOrderStatement("field_{$this->getId()} ".$direction);
41 
42  return $sql_obj;
43  }
44 
45 
53  public function getRecordQueryFilterObject($filter_value = "", ilDclBaseFieldModel $sort_field = null) {
54  global $DIC;
55  $ilDB = $DIC['ilDB'];
56 
57  $join_str = "INNER JOIN il_dcl_record_field AS filter_record_field_{$this->getId()} ON (filter_record_field_{$this->getId()}.record_id = record.id AND filter_record_field_{$this->getId()}.field_id = "
58  . $ilDB->quote($this->getId(), 'integer') . ") ";
59  $join_str .= "INNER JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS filter_stloc_{$this->getId()} ON (filter_stloc_{$this->getId()}.record_field_id = filter_record_field_{$this->getId()}.id) ";
60  $join_str .= "INNER JOIN object_reference AS filter_object_reference_{$this->getId()} ON (filter_object_reference_{$this->getId()}.ref_id = filter_stloc_{$this->getId()}.value ) ";
61  $join_str .= "INNER JOIN object_data AS filter_object_data_{$this->getId()} ON (filter_object_data_{$this->getId()}.obj_id = filter_object_reference_{$this->getId()}.obj_id AND filter_object_data_{$this->getId()}.title LIKE "
62  . $ilDB->quote("%$filter_value%", 'text') . ") ";
63 
64  $sql_obj = new ilDclRecordQueryObject();
65  $sql_obj->setJoinStatement($join_str);
66 
67  return $sql_obj;
68  }
69 
73  public function getValidFieldProperties() {
75  }
76 }
Class ilDclBaseFieldModel.
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
Class ilDclRecordQueryObject.
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
global $ilDB
global $DIC