112 return '/^[^<>\\\\":]*$/i';
130 'SELECT id FROM il_dcl_field WHERE title = ' .
$ilDB->quote(
$title,
'text') .
' AND table_id = '
171 $this->table_id = $a_id;
194 if (substr($a_title, 0, 1) ==
"_" && substr($a_title, 0, 2) !=
"__") {
195 $a_title =
"_" . $a_title;
197 $this->title = $a_title;
219 $this->description = $a_desc;
242 $this->datatype =
null;
243 $this->datatypeId = $a_id;
276 $this->unique =
$unique ? 1 : 0;
298 return $this->datatype->getTitle();
315 return $this->datatype->getStorageLocation();
324 if ($this->datatype ==
null) {
336 $this->exportable = $tablefield_setting->isExportable();
337 $this->order = $tablefield_setting->getFieldOrder();
346 if (!isset($this->exportable)) {
359 if ($this->exportable ==
null) {
370 return (array) $this;
392 $query =
"SELECT * FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
394 $rec =
$ilDB->fetchAssoc($set);
413 $this->
setId($rec[
"id"]);
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" .
", is_unique"
454 $tableview->createFieldSetting($this->
id);
474 "datatype_id" => array(
482 "description" => array(
486 "is_unique" => array(
508 foreach ($this->property as $prop) {
521 $tablefield_setting->setExportable($this->exportable);
522 $tablefield_setting->setFieldOrder($this->order);
523 $tablefield_setting->store();
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");
545 $field_setting->delete();
572 if ($this->order ==
null) {
611 return (isset($this->property[$key]) && $this->property[$key]->getValue() !=
null);
626 return ($instance !==
null) ? $instance->getValue() :
null;
641 $value = $this->
property[$key];
659 if (isset($this->property[$key])) {
660 $this->
property[$key]->setValue($value);
670 return $this->
property[$key];
708 if ($value ==
null) {
714 foreach ($table->getRecords() as $record) {
715 if ($this->
normalizeValue($record->getRecordFieldValue($this->getId())) == $this->normalizeValue($value) && ($record->getId() != $record_id || $record_id == 0)) {
732 if (is_string($value)) {
733 $value = trim(preg_replace(
"/\\s+/uism",
" ", $value));
748 $this->
setTitle($original->getTitle());
751 $this->
setOrder($original->getOrder());
767 foreach ($records as $rec) {
779 if (count($orgProps) == 0) {
782 foreach ($orgProps as $prop_name) {
784 $fieldprop_obj->setFieldId($this->
getId());
785 $fieldprop_obj->setName($prop_name);
794 $fieldprop_obj->setValue($value);
795 $fieldprop_obj->create();
833 $select_str =
"sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
835 =
"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 = "
836 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
837 $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)";
839 $sql_obj->setSelectStatement($select_str);
840 $sql_obj->setJoinStatement($join_str);
841 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction}");
936 foreach ($titles as $k =>
$title) {
941 $import_fields[$k] = $this;
978 'field_id' => $this->
getId(),
986 foreach ($properties as $prop) {
987 $values[
'prop_' . $prop] = $this->
getProperty($prop);
1022 $ilConfirmationGUI->addHiddenItem(
'confirmed', 1);
1023 $ilConfirmationGUI->addHiddenItem(
'field_id', $form->
getInput(
'field_id'));
1024 $ilConfirmationGUI->addHiddenItem(
'title', $form->
getInput(
'title'));
1025 $ilConfirmationGUI->addHiddenItem(
'description', $form->
getInput(
'description'));
1026 $ilConfirmationGUI->addHiddenItem(
'datatype', $form->
getInput(
'datatype'));
1027 $ilConfirmationGUI->addHiddenItem(
'unique', $form->
getInput(
'unique'));
1028 $ilConfirmationGUI->setConfirm(
$DIC->language()->txt(
'dcl_update_field'),
'update');
1029 $ilConfirmationGUI->setCancel(
$DIC->language()->txt(
'cancel'),
'edit');
1031 return $ilConfirmationGUI;
static where($where, $operator=null)
An exception for terminatinating execution or to throw for unit testing.
Confirmation screen class.
Class ilDclBaseFieldModel.
doCreate()
Create new field.
getViewSetting(int $tableview_id)
doDelete()
Remove field and properties.
fillHeaderExcel(ilExcel $worksheet, &$row, &$col)
const PROP_SUPPORTED_FILE_TYPES
const PROP_TEXT_SELECTION_OPTIONS
setExportable($exportable)
updateTableFieldSetting()
update exportable and fieldorder
setDatatypeId($a_id)
Set datatype id.
const PROP_PLUGIN_HOOK_NAME
updateProperties()
Update properties of this field in Database.
getPropertyInstance($key)
Return ActiveRecord of property.
const PROP_FORMULA_EXPRESSION
const PROP_LINK_DETAIL_PAGE_TEXT
const PROP_DATE_SELECTION_OPTIONS
getDescription()
Get description.
getStorageLocationOverride()
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
checkValidityFromForm(ilPropertyFormGUI &$form, $record_id=null)
fillPropertiesForm(ilPropertyFormGUI &$form)
called to fill the 'edit field' form
loadTableFieldSetting()
loadTableFieldSetting
setProperty($key, $value)
Set a property for a field (does not save)
const PROP_DISPLAY_COPY_LINK_ACTION_MENU
setDescription($a_desc)
Set description.
static _getTitleInvalidChars($a_as_regex=true)
All valid chars for filed titles.
loadDatatype()
Load datatype for model.
getConfirmationGUI(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI if isConfirmationRequired returns true
addToTableViews()
create ilDclTableViewFieldSettings for this field in each tableview
storePropertiesFromForm(ilPropertyFormGUI $form)
called when saving the 'edit field' form
isConfirmationRequired(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI when updating field properties if you overwrite this method,...
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
const PROP_LEARNING_PROGRESS
getValidFieldProperties()
Returns all valid properties for a field-type.
static _getFieldIdByTitle($title, $table_id)
hasProperty($key)
Checks if a certain property for a field is set.
const PROP_REFERENCE_LINK
cloneProperties(ilDclBaseFieldModel $originalField)
getProperty($key)
Returns a certain property of a field.
loadProperties()
Get all properties of a field.
const PROP_ILIAS_REFERENCE_LINK
$storage_location_override
getTableId()
Get table id.
cloneStructure($original_id)
getStorageLocation()
Get storage location for the model.
setTitle($a_title)
Set title.
const PROP_DATE_SELECTION_TYPE
loadExportability()
Load exportability.
buildFromDBRecord($rec)
Builds model from db record.
hasNumericSorting()
Set to true, when the sorting should be handled numerical.
const PROP_TEXT_SELECTION_TYPE
checkTitlesForImport(array &$titles, array &$import_fields)
const PROP_LENGTH
General properties.
getSortField()
Returns the sort-field id.
getDatatypeId()
Get datatype_id.
checkValidity($value, $record_id=null)
Check if input is valid.
setStorageLocationOverride($storage_location_override)
setTableId($a_id)
Set table id.
checkFieldCreationInput(ilPropertyFormGUI $form)
Checks input of specific fields befor saving.
setId($a_id)
Set field id.
static getDatatype($datatyp_id)
Get cached datatypes.
static getRecordFieldCache($record, $field)
static getFieldProperties($field_id)
Cache Field properties.
static getTableCache($table_id=0)
static setCloneOf($old, $new, $type)
static getFieldCache($field_id=0)
const INPUTFORMAT_REFERENCE
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
Class ilDclFieldProperty.
Class ilDclRecordQueryObject.
static _getDatatypeForId($id)
gives you the datatype id of a specified standard field.
static getInstance($table_id, $field)
Class ilDclTableViewFieldSetting.
static getAllForTableId($table_id)
static _tableExists($table_id)
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isUtf8($a_str)
Check whether string is utf-8.