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

Public Member Functions

 getRecordQuerySortObject (string $direction="asc", bool $sort_by_status=false)
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 
 getValidFieldProperties ()
 
 allowFilterInListView ()
 
 getFieldRef ()
 
- Public Member Functions inherited from ilDclBaseFieldModel
 __construct (int $a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId (int $a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle (string $a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription (string $a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId (int $a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 isUnique ()
 
 setUnique (?bool $unique)
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getPresentationTitle ()
 
 getPresentationDescription ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 
 buildFromDBRecord (array $rec)
 Builds model from db record. More...
 
 doCreate ()
 
 doUpdate ()
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getViewSettings ()
 
 getViewSetting (int $tableview_id)
 
 getOrder ()
 
 setOrder (int $order)
 
 hasProperty (string $key)
 Checks if a certain property for a field is set. More...
 
 getProperty (string $key)
 
 getPropertyInstance (string $key)
 
 setProperty (string $key, $value)
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 checkValidityFromForm (ilPropertyFormGUI &$form, ?int $record_id=null)
 
 checkValidity ($value, ?int $record_id=null)
 Check if input is valid. More...
 
 cloneStructure (int $original_id)
 
 afterClone (array $records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable (bool $exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject (string $direction="asc", bool $sort_by_status=false)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getRecordQueryFilterObject ( $filter_value="", ?ilDclBaseFieldModel $sort_field=null)
 Returns a query-object for building the record-loader-sql-query. More...
 
 getSortField ()
 Returns the sort-field id. More...
 
 hasNumericSorting ()
 Set to true, when the sorting should be handled numerical. More...
 
 checkFieldCreationInput (ilPropertyFormGUI $form)
 Checks input of specific fields befor saving. More...
 
 getStorageLocationOverride ()
 
 setStorageLocationOverride (?int $storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, int &$row, int &$col)
 
 checkTitlesForImport (array &$titles, array &$import_fields)
 
 storePropertiesFromForm (ilPropertyFormGUI $form)
 called when saving the 'edit field' form More...
 
 fillPropertiesForm (ilPropertyFormGUI &$form)
 called to fill the 'edit field' form More...
 
 isConfirmationRequired (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI More...
 
 getConfirmationGUI (ilPropertyFormGUI $form)
 called by ilDclFieldEditGUI if isConfirmationRequired returns true More...
 

Data Fields

const PROP_REFERENCE = 'table_id'
 
const PROP_N_REFERENCE = 'multiple_selection'
 
- Data Fields inherited from ilDclBaseFieldModel
const PROP_LENGTH = "lenght"
 General properties. More...
 
const PROP_REGEX = "regex"
 
const PROP_REFERENCE = "table_id"
 
const PROP_URL = "url"
 
const PROP_TEXTAREA = "text_area"
 
const PROP_REFERENCE_LINK = "reference_link"
 
const PROP_WIDTH = "width"
 
const PROP_HEIGHT = "height"
 
const PROP_LEARNING_PROGRESS = "learning_progress"
 
const PROP_ILIAS_REFERENCE_LINK = "ILIAS_reference_link"
 
const PROP_N_REFERENCE = "multiple_selection"
 
const PROP_FORMULA_EXPRESSION = "expression"
 
const PROP_DISPLAY_COPY_LINK_ACTION_MENU = "display_action_menu"
 
const PROP_LINK_DETAIL_PAGE_TEXT = "link_detail_page_text"
 
const PROP_LINK_DETAIL_PAGE_MOB = "link_detail_page_mob"
 
const PROP_SUPPORTED_FILE_TYPES = "supported_file_types"
 
const PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"
 
const EDIT_VIEW = 2
 
const EXPORTABLE_VIEW = 4
 

Additional Inherited Members

- Static Public Member Functions inherited from ilDclBaseFieldModel
static _getTitleInvalidChars (bool $a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle (string $title, int $table_id)
 
- Protected Member Functions inherited from ilDclBaseFieldModel
 loadDatatype ()
 Load datatype for model. More...
 
 loadTableFieldSetting ()
 loadTableFieldSetting More...
 
 addToTableViews ()
 create ilDclTableViewFieldSettings for this field in each tableview More...
 
 updateTableFieldSetting ()
 update exportable and fieldorder More...
 
 loadProperties ()
 Get all properties of a field. More...
 
 normalizeValue (mixed $value)
 
- Protected Attributes inherited from ilDclBaseFieldModel
string $id = ""
 
int $table_id = 0
 
string $title = ""
 
string $description = ""
 
int $datatype_id = 0
 
int $order = null
 
bool $unique = false
 
array $property = []
 
bool $exportable = false
 
ilDclDatatype $datatype = null
 
int $storage_location_override = null
 With this property the datatype-storage-location can be overwritten. More...
 
ilDBInterface $db
 
ilLanguage $lng
 

Detailed Description

Definition at line 21 of file class.ilDclReferenceFieldModel.php.

Member Function Documentation

◆ allowFilterInListView()

ilDclReferenceFieldModel::allowFilterInListView ( )

Definition at line 114 of file class.ilDclReferenceFieldModel.php.

References getFieldRef(), ilDclDatatype\INPUTFORMAT_FILEUPLOAD, and ilDclDatatype\INPUTFORMAT_MOB.

114  : bool
115  {
116  //A reference-field is not filterable if the referenced field is of datatype MOB or File
117  $ref_field = $this->getFieldRef();
118 
119  return !($ref_field->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB
120  || $ref_field->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILEUPLOAD);
121  }
+ Here is the call graph for this function:

◆ getFieldRef()

◆ getRecordQueryFilterObject()

ilDclReferenceFieldModel::getRecordQueryFilterObject (   $filter_value = "",
?ilDclBaseFieldModel  $sort_field = null 
)

Definition at line 65 of file class.ilDclReferenceFieldModel.php.

References $DIC, $ilDB, ilDclBaseFieldModel\getId(), ilDclBaseFieldModel\getProperty(), and ilDclBaseFieldModel\PROP_N_REFERENCE.

69  global $DIC;
70  $ilDB = $DIC['ilDB'];
71 
73 
74  $join_str
75  = " LEFT 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 = "
76  . $ilDB->quote($this->getId(), 'integer') . ") ";
77  $join_str .= " LEFT 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) ";
78 
79  $where_str = " AND ";
80 
81  if ($filter_value == 'none') {
82  $where_str .= "("
83  . "filter_stloc_{$this->getId()}.value IS NULL "
84  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("", 'text')
85  . " OR filter_stloc_{$this->getId()}.value = " . $ilDB->quote("[]", 'text')
86  . ") ";
87  } else {
88  if ($n_ref) {
89  $where_str
90  .= " filter_stloc_{$this->getId()}.value LIKE "
91  . $ilDB->quote("%$filter_value%", 'text');
92  } else {
93  $where_str
94  .= " filter_stloc_{$this->getId()}.value = "
95  . $ilDB->quote($filter_value, 'integer');
96  }
97  }
98 
99  $sql_obj = new ilDclRecordQueryObject();
100  $sql_obj->setJoinStatement($join_str);
101  $sql_obj->setWhereStatement($where_str);
102 
103  return $sql_obj;
104  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getRecordQuerySortObject()

ilDclReferenceFieldModel::getRecordQuerySortObject ( string  $direction = "asc",
bool  $sort_by_status = false 
)

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

References $DIC, $ilDB, ilDclCache\getFieldCache(), ilDclBaseFieldModel\getId(), ilDclBaseFieldModel\getProperty(), ilDclBaseFieldModel\getTableId(), ilDclBaseFieldModel\hasProperty(), and null.

31  global $DIC;
32  $ilDB = $DIC['ilDB'];
33 
34  if (
35  $this->hasProperty(self::PROP_N_REFERENCE) ||
36  $this->getProperty(self::PROP_REFERENCE) === null ||
37  ilDclCache::getFieldCache((int) $this->getProperty(self::PROP_REFERENCE))->getTableId() === 0
38  ) {
39  return null;
40  }
41 
42  $ref_field = ilDclCache::getFieldCache((int) $this->getProperty(self::PROP_REFERENCE));
43 
44  //ATM, some referenced fields can not be sorted (Ratings, Formulas and Plugins), PR would be nice if fixeable.
45  if ($ref_field->getStorageLocation() == 0) {
46  return null;
47  }
48 
49  $select_str = "stloc_{$this->getId()}_joined.value AS field_{$this->getId()},";
50  $join_str = "LEFT JOIN il_dcl_record_field AS record_field_{$this->getId()} ON (record_field_{$this->getId()}.record_id = record.id AND record_field_{$this->getId()}.field_id = "
51  . $ilDB->quote($this->getId(), 'integer') . ") ";
52  $join_str .= "LEFT JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS stloc_{$this->getId()} ON (stloc_{$this->getId()}.record_field_id = record_field_{$this->getId()}.id) ";
53  $join_str .= "LEFT JOIN il_dcl_record_field AS record_field_{$this->getId()}_joined ON (record_field_{$this->getId()}_joined.record_id = stloc_{$this->getId()}.value AND record_field_{$this->getId()}_joined.field_id = "
54  . $ilDB->quote($ref_field->getId(), 'integer') . ") ";
55  $join_str .= "LEFT JOIN il_dcl_stloc{$ref_field->getStorageLocation()}_value AS stloc_{$this->getId()}_joined ON (stloc_{$this->getId()}_joined.record_field_id = record_field_{$this->getId()}_joined.id) ";
56 
57  $sql_obj = new ilDclRecordQueryObject();
58  $sql_obj->setSelectStatement($select_str);
59  $sql_obj->setJoinStatement($join_str);
60  $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction . ", ID ASC");
61 
62  return $sql_obj;
63  }
hasProperty(string $key)
Checks if a certain property for a field is set.
static getFieldCache(int $field_id=0)
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

◆ getValidFieldProperties()

Field Documentation

◆ PROP_N_REFERENCE

const ilDclReferenceFieldModel::PROP_N_REFERENCE = 'multiple_selection'

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

◆ PROP_REFERENCE

const ilDclReferenceFieldModel::PROP_REFERENCE = 'table_id'

Definition at line 23 of file class.ilDclReferenceFieldModel.php.


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