120 return '/^[^<>\\\\":]*$/i';
136 $ilDB = $DIC[
'ilDB'];
138 'SELECT id FROM il_dcl_field WHERE title = ' .
$ilDB->quote(
$title,
'text') .
' AND table_id = ' 179 $this->table_id = $a_id;
202 if (substr($a_title, 0, 1) ==
"_" && substr($a_title, 0, 2) !=
"__") {
203 $a_title =
"_" . $a_title;
205 $this->title = $a_title;
227 $this->description = $a_desc;
250 $this->datatype = null;
251 $this->datatypeId = $a_id;
277 $this->required = $a_required;
306 $this->unique =
$unique ? 1 : 0;
328 return $this->datatype->getTitle();
345 return $this->datatype->getStorageLocation();
354 if ($this->datatype == null) {
366 $this->exportable = $tablefield_setting->isExportable();
367 $this->order = $tablefield_setting->getFieldOrder();
376 if (!isset($this->exportable)) {
389 if ($this->exportable == null) {
400 return (array) $this;
419 $ilDB = $DIC[
'ilDB'];
422 $query =
"SELECT * FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
424 $rec =
$ilDB->fetchAssoc($set);
445 $this->
setId($rec[
"id"]);
462 $ilDB = $DIC[
'ilDB'];
466 throw new ilException(
"The field does not have a related table!");
469 $id =
$ilDB->nextId(
"il_dcl_field");
471 $query =
"INSERT INTO il_dcl_field (" .
"id" .
", table_id" .
", datatype_id" .
", title" .
", description" .
", required" .
", is_unique" 472 .
", is_locked" .
" ) VALUES (" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
$ilDB->quote($this->
getTableId(),
"integer") .
"," 490 $tableview->createFieldSetting($this->
id);
501 $ilDB = $DIC[
'ilDB'];
510 "datatype_id" => array(
518 "description" => array(
526 "is_unique" => array(
530 "is_locked" => array(
552 foreach ($this->
property as $prop) {
565 $tablefield_setting->setExportable($this->exportable);
566 $tablefield_setting->setFieldOrder($this->order);
567 $tablefield_setting->store();
577 $ilDB = $DIC[
'ilDB'];
582 $query =
"DELETE FROM il_dcl_field_prop WHERE field_id = " .
$ilDB->quote($this->
getId(),
"text");
585 $query =
"DELETE FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"text");
589 $field_setting->delete();
605 if ($this->order == null) {
659 return ($instance !== null) ? $instance->getValue() : null;
674 $value = $this->
property[
$key];
693 $this->
property[
$key]->setValue($value);
703 return $this->
property[
$key];
759 if ($value == null) {
765 foreach (
$table->getRecords() as $record) {
766 if ($this->
normalizeValue($record->getRecordFieldValue($this->getId())) == $this->
normalizeValue($value) && ($record->getId() != $record_id || $record_id == 0)) {
783 if (is_string($value)) {
784 $value = trim(preg_replace(
"/\\s+/uism",
" ", $value));
799 $this->
setTitle($original->getTitle());
802 $this->
setLocked($original->getLocked());
803 $this->
setOrder($original->getOrder());
832 if (count($orgProps) == 0) {
835 foreach ($orgProps as $prop_name) {
837 $fieldprop_obj->setFieldId($this->
getId());
838 $fieldprop_obj->setName($prop_name);
847 $fieldprop_obj->setValue($value);
848 $fieldprop_obj->create();
882 $ilDB = $DIC[
'ilDB'];
886 $select_str =
"sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
888 =
"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 = " 889 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
890 $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)";
892 $sql_obj->setSelectStatement($select_str);
893 $sql_obj->setJoinStatement($join_str);
894 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction}");
989 foreach ($titles as $k =>
$title) {
994 $import_fields[$k] = $this;
1010 $value = $form->
getInput($representation->getPropertyInputFieldId($property));
1013 if (!empty($value) || ($this->
getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
1031 'field_id' => $this->
getId(),
1040 foreach ($properties as $prop) {
1076 $ilConfirmationGUI->addHiddenItem(
'confirmed', 1);
1077 $ilConfirmationGUI->addHiddenItem(
'field_id', $form->
getInput(
'field_id'));
1078 $ilConfirmationGUI->addHiddenItem(
'title', $form->
getInput(
'title'));
1079 $ilConfirmationGUI->addHiddenItem(
'description', $form->
getInput(
'description'));
1080 $ilConfirmationGUI->addHiddenItem(
'datatype', $form->
getInput(
'datatype'));
1081 $ilConfirmationGUI->addHiddenItem(
'required', $form->
getInput(
'required'));
1082 $ilConfirmationGUI->addHiddenItem(
'unique', $form->
getInput(
'unique'));
1083 $ilConfirmationGUI->setConfirm($DIC->language()->txt(
'dcl_update_field'),
'update');
1084 $ilConfirmationGUI->setCancel($DIC->language()->txt(
'cancel'),
'edit');
1086 return $ilConfirmationGUI;
checkValidity($value, $record_id=null)
Check if input is valid.
Class ilDclBaseFieldModel.
static setCloneOf($old, $new, $type)
static getInstance($table_id, $field)
const PROP_REFERENCE_LINK
setDescription($a_desc)
Set description.
checkTitlesForImport(array &$titles, array &$import_fields)
getConfirmationGUI(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI if isConfirmationRequired returns true
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)
static getFieldRepresentationInstance(ilDclBaseFieldModel $field)
Returns FieldRepresentation from BaseFieldModel.
isConfirmationRequired(ilPropertyFormGUI $form)
called by ilDclFieldEditGUI when updating field properties if you overwrite this method, remember to also overwrite getConfirmationGUI
Class ilDclFieldProperty.
const PROP_SUPPORTED_FILE_TYPES
doDelete()
Remove field and properties.
storePropertiesFromForm(ilPropertyFormGUI $form)
called when saving the 'edit field' form
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)
fillPropertiesForm(ilPropertyFormGUI &$form)
called to fill the 'edit field' form
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
const PROP_TEXT_SELECTION_OPTIONS
loadExportability()
Load exportability.
const PROP_LINK_DETAIL_PAGE_TEXT
loadProperties()
Get all properties of a field.
if(isset($_POST['submit'])) $form
setRequired($a_required)
Set Required.
static _tableExists($table_id)
hasProperty($key)
Checks if a certain property for a field is set.
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.
setCell($a_row, $a_col, $a_value, $a_datatype=null)
Set cell value.
fillHeaderExcel(ilExcel $worksheet, &$row, &$col)
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.
doCreate()
Create new field.
static getRecordFieldCache($record, $field)
getProperty($key)
Returns a certain property of a field.
const PROP_DATE_SELECTION_OPTIONS
getValidFieldProperties()
Returns all valid properties for a field-type.
$storage_location_override
const PROP_DATE_SELECTION_TYPE
if(empty($password)) $table
setExportable($exportable)
setTitle($a_title)
Set title.
getStorageLocationOverride()
const PROP_ILIAS_REFERENCE_LINK
checkValidityFromForm(ilPropertyFormGUI &$form, $record_id=null)
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.
Confirmation screen class.
static isUtf8($a_str)
Check whether string is utf-8.
const PROP_TEXT_SELECTION_TYPE