ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilDclReferenceFieldModel Class Reference

Class ilDclReferenceFieldModel. More...

+ Inheritance diagram for ilDclReferenceFieldModel:
+ Collaboration diagram for ilDclReferenceFieldModel:

Public Member Functions

 getRecordQuerySortObject ($direction="asc", $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...
 
 getValidFieldProperties ()
 
 allowFilterInListView ()
 
 getFieldRef ()
 
- Public Member Functions inherited from ilDclBaseFieldModel
 __construct ($a_id=0)
 
 setId ($a_id)
 Set field id. More...
 
 getId ()
 Get field id. More...
 
 setTableId ($a_id)
 Set table id. More...
 
 getTableId ()
 Get table id. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setDescription ($a_desc)
 Set description. More...
 
 getDescription ()
 Get description. More...
 
 setDatatypeId ($a_id)
 Set datatype id. More...
 
 getDatatypeId ()
 Get datatype_id. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required Required. More...
 
 isUnique ()
 
 setUnique ($unique)
 
 getDatatype ()
 
 getDatatypeTitle ()
 
 getStorageLocation ()
 Get storage location for the model. More...
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 Read field. More...
 
 buildFromDBRecord ($rec)
 Builds model from db record. More...
 
 doCreate ()
 Create new field. More...
 
 doUpdate ()
 Update field. More...
 
 updateProperties ()
 Update properties of this field in Database. More...
 
 doDelete ()
 Remove field and properties. More...
 
 getFieldSettings ()
 
 getOrder ()
 
 setOrder ($order)
 
 hasProperty ($key)
 Checks if a certain property for a field is set. More...
 
 getProperty ($key)
 Returns a certain property of a field. More...
 
 getPropertyInstance ($key)
 Return ActiveRecord of property. More...
 
 setProperty ($key, $value)
 Set a property for a field (does not save) More...
 
 getValidFieldProperties ()
 Returns all valid properties for a field-type. More...
 
 setLocked ($locked)
 
 getLocked ()
 
 checkValidityFromForm (ilPropertyFormGUI &$form, $record_id=null)
 
 checkValidity ($value, $record_id=null)
 Check if input is valid. More...
 
 cloneStructure ($original_id)
 
 afterClone ($records)
 
 cloneProperties (ilDclBaseFieldModel $originalField)
 
 setExportable ($exportable)
 
 allowFilterInListView ()
 
 getRecordQuerySortObject ($direction="asc", $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 ($storage_location_override)
 
 fillHeaderExcel (ilExcel $worksheet, &$row, &$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"
 
const PROP_SUPPORTED_FILE_TYPES = "supported_file_types"
 
const PROP_PLUGIN_HOOK_NAME = "plugin_hook_name"
 
const PROP_TEXT_SELECTION_OPTIONS = "text_selection_options"
 
const PROP_TEXT_SELECTION_TYPE = "text_selection_type"
 
const PROP_DATE_SELECTION_OPTIONS = "date_selection_options"
 
const PROP_DATE_SELECTION_TYPE = "date_selection_type"
 
const EDIT_VIEW = 2
 
const EXPORTABLE_VIEW = 4
 

Additional Inherited Members

- Static Public Member Functions inherited from ilDclBaseFieldModel
static _getTitleInvalidChars ($a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle ($title, $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 ($value)
 
- Protected Attributes inherited from ilDclBaseFieldModel
 $id
 
 $table_id
 
 $title
 
 $description
 
 $datatypeId
 
 $required
 
 $order
 
 $unique
 
 $locked
 
 $property = array()
 
 $exportable
 
 $datatype
 
 $storage_location_override = null
 

Detailed Description

Member Function Documentation

◆ allowFilterInListView()

ilDclReferenceFieldModel::allowFilterInListView ( )
Returns
bool

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

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

100  {
101  //A reference-field is not filterable if the referenced field is of datatype MOB or File
102  $ref_field = $this->getFieldRef();
103 
104  return !($ref_field->getDatatypeId() == ilDclDatatype::INPUTFORMAT_MOB
105  || $ref_field->getDatatypeId() == ilDclDatatype::INPUTFORMAT_FILE);
106  }
+ Here is the call graph for this function:

◆ getFieldRef()

ilDclReferenceFieldModel::getFieldRef ( )

◆ getRecordQueryFilterObject()

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

Returns a query-object for building the record-loader-sql-query.

Parameters
string$filter_value
Returns
null|ilDclRecordQueryObject

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

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

60  {
61  global $DIC;
62  $ilDB = $DIC['ilDB'];
63 
65 
66  $join_str
67  = " 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 = "
68  . $ilDB->quote($this->getId(), 'integer') . ") ";
69 
70  if ($n_ref) {
71  $join_str
72  .= " 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 AND filter_stloc_{$this->getId()}.value LIKE "
73  . $ilDB->quote("%$filter_value%", 'text') . ") ";
74  } else {
75  $join_str
76  .= " 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 AND filter_stloc_{$this->getId()}.value = "
77  . $ilDB->quote($filter_value, 'integer') . ") ";
78  }
79 
80  $sql_obj = new ilDclRecordQueryObject();
81  $sql_obj->setJoinStatement($join_str);
82 
83  return $sql_obj;
84  }
Class ilDclRecordQueryObject.
global $DIC
Definition: saml.php:7
getProperty($key)
Returns a certain property of a field.
global $ilDB
+ Here is the call graph for this function:

◆ getRecordQuerySortObject()

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

Returns a query-object for building the record-loader-sql-query.

Parameters
string$direction
boolean$sort_by_statusThe specific sort object is a status field
Returns
null|ilDclRecordQueryObject

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

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

24  {
25  global $DIC;
26  $ilDB = $DIC['ilDB'];
27 
28  if ($this->hasProperty(self::PROP_N_REFERENCE)) {
29  return null;
30  }
31 
32  $ref_field = ilDclCache::getFieldCache($this->getProperty(self::PROP_REFERENCE));
33 
34  $select_str = "stloc_{$this->getId()}_joined.value AS field_{$this->getId()},";
35  $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 = "
36  . $ilDB->quote($this->getId(), 'integer') . ") ";
37  $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) ";
38  $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 = "
39  . $ilDB->quote($ref_field->getId(), 'integer') . ") ";
40  $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) ";
41 
42  $sql_obj = new ilDclRecordQueryObject();
43  $sql_obj->setSelectStatement($select_str);
44  $sql_obj->setJoinStatement($join_str);
45  $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction);
46 
47 
48  return $sql_obj;
49  }
Class ilDclRecordQueryObject.
global $DIC
Definition: saml.php:7
static getFieldCache($field_id=0)
hasProperty($key)
Checks if a certain property for a field is set.
getProperty($key)
Returns a certain property of a field.
global $ilDB
+ Here is the call graph for this function:

◆ getValidFieldProperties()

Field Documentation

◆ PROP_N_REFERENCE

const ilDclReferenceFieldModel::PROP_N_REFERENCE = 'multiple_selection'

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

◆ PROP_REFERENCE

const ilDclReferenceFieldModel::PROP_REFERENCE = 'table_id'

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


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