123 return '/^[^<>\\\\":]*$/i';
139 $ilDB = $DIC[
'ilDB'];
140 $result =
$ilDB->query(
'SELECT id FROM il_dcl_field WHERE title = ' .
$ilDB->quote(
$title,
'text') .
' AND table_id = ' 180 $this->table_id = $a_id;
203 if (substr($a_title, 0, 1) ==
"_" && substr($a_title, 0, 2) !=
"__") {
204 $a_title =
"_" . $a_title;
206 $this->title = $a_title;
228 $this->description = $a_desc;
251 $this->datatype = null;
252 $this->datatypeId = $a_id;
278 $this->required = $a_required;
306 $this->unique =
$unique ? 1 : 0;
327 return $this->datatype->getTitle();
342 return $this->datatype->getStorageLocation();
351 if ($this->datatype == null) {
362 $this->exportable = $tablefield_setting->isExportable();
363 $this->order = $tablefield_setting->getFieldOrder();
371 if (!isset($this->exportable)) {
383 if ($this->exportable == null) {
394 return (
array) $this;
413 $ilDB = $DIC[
'ilDB'];
416 $query =
"SELECT * FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"integer");
418 $rec =
$ilDB->fetchAssoc($set);
438 $this->
setId($rec[
"id"]);
455 $ilDB = $DIC[
'ilDB'];
459 throw new ilException(
"The field does not have a related table!");
462 $id =
$ilDB->nextId(
"il_dcl_field");
464 $query =
"INSERT INTO il_dcl_field (" .
"id" .
", table_id" .
", datatype_id" .
", title" .
", description" .
", required" .
", is_unique" 465 .
", is_locked" .
" ) VALUES (" .
$ilDB->quote($this->
getId(),
"integer") .
"," .
$ilDB->quote($this->
getTableId(),
"integer") .
"," 482 $tableview->createFieldSetting($this->
id);
493 $ilDB = $DIC[
'ilDB'];
500 "datatype_id" =>
array(
508 "description" =>
array(
516 "is_unique" =>
array(
520 "is_locked" =>
array(
540 foreach ($this->property as $prop) {
553 $tablefield_setting->setExportable($this->exportable);
554 $tablefield_setting->setFieldOrder($this->order);
555 $tablefield_setting->store();
564 $ilDB = $DIC[
'ilDB'];
569 $query =
"DELETE FROM il_dcl_field_prop WHERE field_id = " .
$ilDB->quote($this->
getId(),
"text");
572 $query =
"DELETE FROM il_dcl_field WHERE id = " .
$ilDB->quote($this->
getId(),
"text");
576 $field_setting->delete();
590 if ($this->order == null) {
625 return (isset($this->property[
$key]) && $this->property[$key]->getValue() != null);
639 return ($instance !== null)? $instance->getValue() : null;
654 $value = $this->
property[
$key];
670 if (isset($this->property[
$key])) {
671 $this->
property[
$key]->setValue($value);
681 return $this->
property[
$key];
732 if ($value == null) {
738 foreach (
$table->getRecords() as $record) {
740 ($record->getId() != $record_id || $record_id == 0)) {
757 if (is_string($value)) {
758 $value = trim(preg_replace(
"/\\s+/uism",
" ", $value));
773 $this->
setTitle($original->getTitle());
776 $this->
setLocked($original->getLocked());
777 $this->
setOrder($original->getOrder());
805 if (count($orgProps) == 0) {
808 foreach ($orgProps as $prop_name) {
810 $fieldprop_obj->setFieldId($this->
getId());
811 $fieldprop_obj->setName($prop_name);
820 $fieldprop_obj->setValue($value);
821 $fieldprop_obj->create();
854 $ilDB = $DIC[
'ilDB'];
858 $select_str =
"sort_stloc_{$this->getId()}.value AS field_{$this->getId()}";
859 $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 = " 860 .
$ilDB->quote($this->
getId(),
'integer') .
") ";
861 $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)";
863 $sql_obj->setSelectStatement($select_str);
864 $sql_obj->setJoinStatement($join_str);
865 $sql_obj->setOrderStatement(
"field_{$this->getId()} {$direction}");
955 foreach ($titles as $k =>
$title) {
960 $import_fields[$k] = $this;
976 $value = $form->
getInput($representation->getPropertyInputFieldId($property));
979 if (!empty($value) || ($this->
getPropertyInstance($property) != null && $property != self::PROP_PLUGIN_HOOK_NAME)) {
997 'field_id' => $this->
getId(),
1006 foreach ($properties as $prop) {
1007 $values[
'prop_' . $prop] = $this->
getProperty($prop);
1042 $ilConfirmationGUI->addHiddenItem(
'confirmed', 1);
1043 $ilConfirmationGUI->addHiddenItem(
'field_id', $form->
getInput(
'field_id'));
1044 $ilConfirmationGUI->addHiddenItem(
'title', $form->
getInput(
'title'));
1045 $ilConfirmationGUI->addHiddenItem(
'description', $form->
getInput(
'description'));
1046 $ilConfirmationGUI->addHiddenItem(
'datatype', $form->
getInput(
'datatype'));
1047 $ilConfirmationGUI->addHiddenItem(
'required', $form->
getInput(
'required'));
1048 $ilConfirmationGUI->addHiddenItem(
'unique', $form->
getInput(
'unique'));
1049 $ilConfirmationGUI->setConfirm($DIC->language()->txt(
'dcl_update_field'),
'update');
1050 $ilConfirmationGUI->setCancel($DIC->language()->txt(
'cancel'),
'edit');
1051 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)
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.
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