4 require_once(
'./Modules/DataCollection/classes/Fields/Base/class.ilDclFieldProperty.php');
5 require_once(
'./Services/Exceptions/classes/class.ilException.php');
6 require_once(
'./Modules/DataCollection/classes/Helpers/class.ilDclCache.php');
7 require_once(
'./Modules/DataCollection/classes/Helpers/class.ilDclRecordQueryObject.php');
8 require_once(
'./Modules/DataCollection/classes/Table/class.ilDclTableFieldSetting.php');
122 return '/^[^<>\\\\":]*$/i';
137 $ilDB = $DIC[
'ilDB'];
138 $result =
$ilDB->query(
'SELECT id FROM il_dcl_field WHERE title = ' .
$ilDB->quote(
$title,
'text') .
' AND table_id = ' 175 $this->table_id = $a_id;
196 if (substr($a_title, 0, 1) ==
"_" && substr($a_title, 0, 2) !=
"__") {
197 $a_title =
"_" . $a_title;
199 $this->title = $a_title;
219 $this->description = $a_desc;
240 $this->datatype = NULL;
241 $this->datatypeId = $a_id;
265 $this->required = $a_required;
290 $this->unique =
$unique ? 1 : 0;
309 return $this->datatype->getTitle();
323 return $this->datatype->getStorageLocation();
331 if ($this->datatype == NULL) {
341 $this->exportable = $tablefield_setting->isExportable();
342 $this->order = $tablefield_setting->getFieldOrder();
349 if (! isset($this->exportable)) {
360 if ($this->exportable == NULL) {
387 $ilDB = $DIC[
'ilDB'];
390 $query =
"SELECT * FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
392 $rec =
$ilDB->fetchAssoc($set);
411 $this->
setId($rec[
"id"]);
427 $ilDB = $DIC[
'ilDB'];
431 throw new ilException(
"The field does not have a related table!");
434 $id =
$ilDB->nextId(
"il_dcl_field");
436 $query =
"INSERT INTO il_dcl_field (" .
"id" .
", table_id" .
", datatype_id" .
", title" .
", description" .
", required" .
", is_unique" 437 .
", is_locked" .
" ) VALUES (" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
$ilDB->quote($this->
getTableId(),
"integer") .
"," 455 $tableview->createFieldSetting($this->
id);
465 $ilDB = $DIC[
'ilDB'];
472 "datatype_id" =>
array(
480 "description" =>
array(
488 "is_unique" =>
array(
492 "is_locked" =>
array(
511 foreach ($this->property as $prop) {
523 $tablefield_setting->setExportable($this->exportable);
524 $tablefield_setting->setFieldOrder($this->order);
525 $tablefield_setting->store();
533 $ilDB = $DIC[
'ilDB'];
538 $query =
"DELETE FROM il_dcl_field_prop WHERE field_id = " .
$ilDB->quote($this->
getId(),
"text");
541 $query =
"DELETE FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"text");
546 $field_setting->delete();
558 if ($this->order == null) {
590 return (isset($this->property[$key]) && $this->property[$key]->getValue() != NULL);
603 return ($instance !== NULL)? $instance->getValue() : null;
617 $value = $this->
property[$key];
632 if(isset($this->property[$key])) {
633 $this->
property[$key]->setValue($value);
643 return $this->
property[$key];
689 if ($value == NULL) {
695 foreach ($table->getRecords() as $record) {
697 ($record->getId() != $record_id || $record_id == 0)) {
713 if (is_string($value)) {
714 $value = trim(preg_replace(
"/\\s+/uism",
" ", $value));
728 $this->
setTitle($original->getTitle());
731 $this->
setLocked($original->getLocked());
732 $this->
setOrder($original->getOrder());
758 if (count($orgProps) == 0) {
761 foreach ($orgProps as $prop_name) {
763 $fieldprop_obj->setFieldId($this->
getId());
764 $fieldprop_obj->setName($prop_name);
773 $fieldprop_obj->setValue($value);
774 $fieldprop_obj->create();
804 $ilDB = $DIC[
'ilDB'];
808 $select_str =
"sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
809 $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 = " 810 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
811 $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)";
813 $sql_obj->setSelectStatement($select_str);
814 $sql_obj->setJoinStatement($join_str);
815 $sql_obj->setOrderStatement(
"field_{$this->getId()} ".$direction);
897 foreach ($titles as $k =>
$title) {
902 $import_fields[$k] = $this;
Class ilDclBaseFieldModel.
static setCloneOf($old, $new, $type)
static getInstance($table_id, $field)
Base class for ILIAS Exception handling.
const PROP_REFERENCE_LINK
setDescription($a_desc)
Set description.
checkTitlesForImport(array &$titles, array &$import_fields)
static _getTitleInvalidChars($a_as_regex=true)
All valid chars for filed titles.
static getFieldProperties($field_id)
Cache Field properties.
setDatatypeId($a_id)
Set datatype id.
Class ilDclRecordQueryObject.
checkFieldCreationInput(ilPropertyFormGUI $form)
Checks input of specific fields befor saving.
static getFieldCache($field_id=0)
Class ilDclFieldProperty.
const PROP_SUPPORTED_FILE_TYPES
doDelete()
Remove field and properties.
static getAllForTableId($table_id)
loadTableFieldSetting()
loadTableFieldSetting
updateProperties()
Update properties of this field in Database.
getSortField()
Returns the sort-field id.
const PROP_PLUGIN_HOOK_NAME
cloneStructure($original_id)
getPropertyInstance($key)
Return ActiveRecord of property.
static _getFieldIdByTitle($title, $table_id)
static getTableCache($table_id=0)
getStorageLocation()
Get storage location for the model.
static where($where, $operator=null)
setProperty($key, $value)
Set a property for a field (does not save)
static _getDatatypeForId($id)
gives you the datatype id of a specified standard field.
addToTableViews()
create ilDclTableViewFieldSettings for this field in each tableview
getTableId()
Get table id.
setTableId($a_id)
Set table id.
const PROP_FORMULA_EXPRESSION
loadExportability()
Load exportability.
const PROP_LINK_DETAIL_PAGE_TEXT
loadProperties()
Get all properties of a field.
setRequired($a_required)
Set Required.
static _tableExists($table_id)
hasProperty($key)
Checks if a certain property for a field is set.
checkValidityFromForm(ilPropertyFormGUI &$form, $record_id=NULL)
setStorageLocationOverride($storage_location_override)
cloneProperties(ilDclBaseFieldModel $originalField)
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
buildFromDBRecord($rec)
Builds model from db record.
const PROP_LENGTH
General properties.
const PROP_LEARNING_PROGRESS
const PROP_DISPLAY_COPY_LINK_ACTION_MENU
getRequired()
Get Required Required.
checkValidity($value, $record_id=NULL)
Check if input is valid.
fillHeaderExcel(ilExcel $worksheet, &$row, &$col)
Create styles array
The data for the language used.
getDescription()
Get description.
loadDatatype()
Load datatype for model.
updateTableFieldSetting()
update exportable and fieldorder
const INPUTFORMAT_REFERENCE
hasNumericSorting()
Set to true, when the sorting should be handled numerical.
setCell($a_row, $a_col, $a_value)
Set cell value.
doCreate()
Create new field.
static getRecordFieldCache($record, $field)
getProperty($key)
Returns a certain property of a field.
getValidFieldProperties()
Returns all valid properties for a field-type.
$storage_location_override
setExportable($exportable)
setTitle($a_title)
Set title.
getStorageLocationOverride()
const PROP_ILIAS_REFERENCE_LINK
static getDatatype($datatyp_id)
Get cached datatypes.
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
setId($a_id)
Set field id.
getDatatypeId()
Get datatype_id.
static isUtf8($a_str)
Check whether string is utf-8.