ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilDataCollectionField Class Reference

Class ilDataCollectionField. More...

+ Inheritance diagram for ilDataCollectionField:
+ Collaboration diagram for ilDataCollectionField:

Public Member Functions

 __construct ($a_id=0)
 Constructor public. More...
 
 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...
 
 setPropertyvalue ($a_value, $a_id)
 Set Property Value. More...
 
 isUnique ()
 
 setUnique ($unique)
 
 getPropertyvalues ()
 Get Property Values. More...
 
 setVisible ($visible)
 setVisible More...
 
 setFilterable ($filterable)
 setFilterable More...
 
 getDatatype ()
 
 getLength ()
 
 getTextArea ()
 
 getLearningProgress ()
 
 getDatatypeTitle ()
 
 getStorageLocation ()
 
 isVisible ()
 
 isFilterable ()
 
 isEditable ()
 isEditable More...
 
 setEditable ($editable)
 
 getExportable ()
 
 toArray ()
 
 isStandardField ()
 
 doRead ()
 Read field. More...
 
 buildFromDBRecord ($rec)
 
 doCreate ()
 Create new field. More...
 
 doUpdate ()
 Update field. More...
 
 getFilterable ()
 
 doDelete ()
 
 getOrder ()
 
 setOrder ($order)
 
 getFieldRef ()
 
 getFieldReflist ()
 
 isNRef ()
 
 getProperties ()
 Get all properties of a field. More...
 
 setProperties ($data)
 
 setLocked ($locked)
 
 getLocked ()
 
 checkValidity ($value, $record_id=null)
 
 cloneStructure ($original_id)
 
 cloneProperties ($originalField)
 
 setExportable ($exportable)
 

Static Public Member Functions

static _getTitleValidChars ($a_as_regex=true)
 All valid chars for filed titles. More...
 
static _getFieldIdByTitle ($title, $table_id)
 

Data Fields

const PROPERTYID_LENGTH = 1
 
const PROPERTYID_REGEX = 2
 
const PROPERTYID_REFERENCE = 3
 
const PROPERTYID_REFERENCELIST = 11
 
const PROPERTYID_URL = 4
 LINK OR EMAIL! More...
 
const PROPERTYID_TEXTAREA = 5
 
const PROPERTYID_REFERENCE_LINK = 6
 
const PROPERTYID_WIDTH = 7
 
const PROPERTYID_HEIGHT = 8
 
const PROPERTYID_LEARNING_PROGRESS = 9
 
const PROPERTYID_ILIAS_REFERENCE_LINK = 10
 
const PROPERTYID_N_REFERENCE = 11
 
const VIEW_VIEW = 1
 
const EDIT_VIEW = 2
 
const FILTER_VIEW = 3
 
const EXPORTABLE_VIEW = 4
 

Protected Member Functions

 updateProperties ()
 Update properties of this field in Database. More...
 
 updateVisibility ()
 
 updateFilterability ()
 
 updateEditability ()
 
 updateExportability ()
 

Protected Attributes

 $id
 
 $table_id
 
 $title
 
 $description
 
 $datatypeId
 
 $required
 
 $order
 
 $unique
 
 $visible
 
 $editable
 
 $filterable
 
 $locked
 
 $property = array()
 
 $exportable
 
 $datatype
 

Private Member Functions

 loadDatatype ()
 
 loadVisibility ()
 
 loadFilterability ()
 
 loadViewDefinition ($view)
 loadViewDefinition More...
 
 loadEditability ()
 
 loadExportability ()
 
 updateViewDefinition ($view)
 updateViewDefinition More...
 
 deleteViewDefinition ($view)
 
 loadProperties ()
 Get all properties of a field. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilDataCollectionField::__construct (   $a_id = 0)

Constructor public.

Parameters
integerfiel_id

Definition at line 125 of file class.ilDataCollectionField.php.

References doRead().

126  {
127  if($a_id != 0)
128  {
129  $this->id = $a_id;
130  $this->doRead();
131  }
132  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _getFieldIdByTitle()

static ilDataCollectionField::_getFieldIdByTitle (   $title,
  $table_id 
)
static
Parameters
$titleTitle of the field
$table_idID of table where the field belongs to
Returns
int

Definition at line 158 of file class.ilDataCollectionField.php.

References $id, $result, $table_id, and $title.

Referenced by ilObjDataCollection\cloneStructure().

158  {
159  global $ilDB;
160  $result = $ilDB->query('SELECT id FROM il_dcl_field WHERE title = ' . $ilDB->quote($title, 'text') . ' AND table_id = ' . $ilDB->quote($table_id, 'integer'));
161  $id = 0;
162  while($rec = $ilDB->fetchAssoc($result)) {
163  $id = $rec['id'];
164  }
165  return $id;
166  }
$result
+ Here is the caller graph for this function:

◆ _getTitleValidChars()

static ilDataCollectionField::_getTitleValidChars (   $a_as_regex = true)
static

All valid chars for filed titles.

Parameters
bool$a_as_regex
Returns
string

Definition at line 141 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionFieldEditGUI\initForm().

142  {
143  if( $a_as_regex )
144  {
145  return '/^[a-zA-Z\d \/\-.,äöüÄÖÜàéèÀÉÈç¢]*$/i';
146  }
147  else
148  {
149  return 'A-Z a-z 0-9 /-.,';
150  }
151  }
+ Here is the caller graph for this function:

◆ buildFromDBRecord()

ilDataCollectionField::buildFromDBRecord (   $rec)

Definition at line 611 of file class.ilDataCollectionField.php.

References setDatatypeId(), setDescription(), setId(), setLocked(), setRequired(), setTableId(), setTitle(), and setUnique().

612  {
613  $this->setId($rec["id"]);
614  $this->setTableId($rec["table_id"]);
615  $this->setTitle($rec["title"]);
616  $this->setDescription($rec["description"]);
617  $this->setDatatypeId($rec["datatype_id"]);
618  $this->setRequired($rec["required"]);
619  $this->setUnique($rec["is_unique"]);
620  $this->setLocked($rec["is_locked"]);
621  }
setRequired($a_required)
Set Required.
setDatatypeId($a_id)
Set datatype id.
setDescription($a_desc)
Set description.
+ Here is the call graph for this function:

◆ checkValidity()

ilDataCollectionField::checkValidity (   $value,
  $record_id = null 
)

Definition at line 940 of file class.ilDataCollectionField.php.

References ilDataCollectionDatatype\checkValidity(), getDatatypeId(), ilObjMediaObject\getMimeType(), getPropertyvalues(), ilDataCollectionCache\getTableCache(), getTableId(), ilDataCollectionDatatype\INPUTFORMAT_DATETIME, ilDataCollectionDatatype\INPUTFORMAT_MOB, ilDataCollectionDatatype\INPUTFORMAT_TEXT, isUnique(), ilDataCollectionInputException\LENGTH_EXCEPTION, ilDataCollectionInputException\NOT_IMAGE, ilDataCollectionInputException\NOT_URL, PROPERTYID_LENGTH, PROPERTYID_REGEX, PROPERTYID_URL, ilDataCollectionInputException\REGEX_EXCEPTION, ilStr\strLen(), ilDataCollectionInputException\TYPE_EXCEPTION, and ilDataCollectionInputException\UNIQUE_EXCEPTION.

941  {
942  //Don't check empty values
943  if($value == NULL)
944  {
945  return true;
946  }
947 
948 
950  {
952  }
953 
954  $properties = $this->getPropertyvalues();
958 
959  include_once 'Services/Utilities/classes/class.ilStr.php';
961  {
962  $regex = $properties[$regex_id];
963  if(substr($regex,0,1) != "/")
964  $regex = "/".$regex;
965  if(substr($regex, -1) != "/")
966  $regex .= "/";
967  if($properties[$length] < ilStr::strLen($value) && is_numeric($properties[$length]))
969  if(!($properties[$regex_id] == NULL || @preg_match($regex, $value)))
971  //email or url
972  if($properties[$url] && !(preg_match('~(^(news|(ht|f)tp(s?)\://){1}\S+)~i', $value) || preg_match("/^[a-z0-9!#$%&'*+=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i", $value)))
974  }
975 
976 
977  if($this->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB AND $value['name'])
978  {
979  $arrMimeType = explode('/', ilObjMediaObject::getMimeType($value['name']));
980 
981  if($arrMimeType[0] != "image") {
983  }
984  }
985 
986 
987  if($this->isUnique() && $record_id === null)
988  {
990 
991  foreach($table->getRecords() as $record)
992  {
993  if($record->getRecordFieldValue($this->getId()) == $value && ($record->getId() != $record_id || $record_id == 0))
995 
996  //for text it has to be case insensitive.
998  {
999  if(strtolower($record->getRecordFieldValue($this->getId())) == strtolower($value) && ($record->getId() != $record_id || $record_id == 0))
1000  {
1002  }
1003 
1004  }
1005 
1007  {
1008  $datestring = $value["date"]." ".$value["time"];//["y"]."-".$value["date"]['m']."-".$value["date"]['d']." 00:00:00";
1009 
1010  if($record->getRecordFieldValue($this->getId()) == $datestring && ($record->getId() != $record_id || $record_id == 0))
1011  {
1013  }
1014  }
1015  }
1016  }
1017 
1018  return true;
1019  }
static strLen($a_string)
Definition: class.ilStr.php:79
static checkValidity($type_id, $value)
now only distinguishes between number and text values
static getMimeType($a_file)
get mime type for file
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:

◆ cloneProperties()

ilDataCollectionField::cloneProperties (   $originalField)
Parameters
$originalFieldilDataCollectionField

Definition at line 1045 of file class.ilDataCollectionField.php.

References $id, getId(), ilDataCollectionDatatype\INPUTFORMAT_REFERENCE, and PROPERTYID_REFERENCE.

Referenced by cloneStructure().

1045  {
1046  $orgProps = $originalField->getProperties();
1047  if($orgProps == NULL)
1048  return;
1049  foreach($orgProps as $id => $value){
1050  $fieldprop_obj = new ilDataCollectionFieldProp();
1051  $fieldprop_obj->setDatatypePropertyId($id);
1052  $fieldprop_obj->setFieldId($this->getId());
1053  // If reference field, we must reset the referenced field, otherwise it will point to the old ID
1055  $value = null;
1056  }
1057  $fieldprop_obj->setValue($value);
1058  $fieldprop_obj->doCreate();
1059  }
1060  }
Class ilDataCollectionFieldProp.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cloneStructure()

ilDataCollectionField::cloneStructure (   $original_id)

Definition at line 1024 of file class.ilDataCollectionField.php.

References cloneProperties(), doCreate(), ilDataCollectionCache\getFieldCache(), setDatatypeId(), setDescription(), setEditable(), setExportable(), setFilterable(), setLocked(), setOrder(), setRequired(), setTitle(), setUnique(), and setVisible().

1025  {
1026  $original = ilDataCollectionCache::getFieldCache($original_id);
1027  $this->setTitle($original->getTitle());
1028  $this->setDatatypeId($original->getDatatypeId());
1029  $this->setDescription($original->getDescription());
1030  $this->setEditable($original->isEditable());
1031  $this->setLocked($original->getLocked());
1032  $this->setFilterable($original->isFilterable());
1033  $this->setVisible($original->isVisible());
1034  $this->setOrder($original->getOrder());
1035  $this->setRequired($original->getRequired());
1036  $this->setUnique($original->isUnique());
1037  $this->setExportable($original->getExportable());
1038  $this->doCreate();
1039  $this->cloneProperties($original);
1040  }
setRequired($a_required)
Set Required.
setDatatypeId($a_id)
Set datatype id.
setFilterable($filterable)
setFilterable
setDescription($a_desc)
Set description.
+ Here is the call graph for this function:

◆ deleteViewDefinition()

ilDataCollectionField::deleteViewDefinition (   $view)
private

Definition at line 794 of file class.ilDataCollectionField.php.

References $query, getId(), and getTableId().

Referenced by doDelete().

795  {
796  global $ilDB;
797 
798  $query = "DELETE def FROM il_dcl_viewdefinition def INNER JOIN il_dcl_view ON il_dcl_view.type = "
799  .$ilDB->quote($view, "integer")." AND il_dcl_view.table_id = "
800  .$ilDB->quote($this->getTableId(), "integer")." WHERE def.view_id = il_dcl_view.id AND def.field = "
801  .$ilDB->quote($this->getId(), "text");
802 
803  $ilDB->manipulate($query);
804  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doCreate()

ilDataCollectionField::doCreate ( )

Create new field.

Definition at line 626 of file class.ilDataCollectionField.php.

References $id, $query, ilDataCollectionTable\_tableExists(), getDatatypeId(), getDescription(), getId(), getLocked(), getRequired(), getTableId(), getTitle(), isUnique(), setId(), setLocked(), updateEditability(), updateExportability(), updateFilterability(), and updateVisibility().

Referenced by cloneStructure().

627  {
628  global $ilDB;
629  $this->getLocked() == NULL?$this->setLocked(false):true;
630 
632  throw new ilException("The field does not have a related table!");
633 
634  $id = $ilDB->nextId("il_dcl_field");
635  $this->setId($id);
636  $query = "INSERT INTO il_dcl_field (".
637  "id".
638  ", table_id".
639  ", datatype_id".
640  ", title".
641  ", description".
642  ", required".
643  ", is_unique".
644  ", is_locked".
645  " ) VALUES (".
646  $ilDB->quote($this->getId(), "integer")
647  .",".$ilDB->quote($this->getTableId(), "integer")
648  .",".$ilDB->quote($this->getDatatypeId(), "integer")
649  .",".$ilDB->quote($this->getTitle(), "text")
650  .",".$ilDB->quote($this->getDescription(), "text")
651  .",".$ilDB->quote($this->getRequired(), "integer")
652  .",".$ilDB->quote($this->isUnique(), "integer")
653  .",".$ilDB->quote($this->getLocked()?1:0, "integer")
654  .")";
655  $ilDB->manipulate($query);
656 
657  $this->updateVisibility();
658  $this->updateFilterability();
659  $this->updateEditability();
660  $this->updateExportability();
661  }
Base class for ILIAS Exception handling.
getRequired()
Get Required Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doDelete()

ilDataCollectionField::doDelete ( )

Definition at line 809 of file class.ilDataCollectionField.php.

References $query, deleteViewDefinition(), and getId().

810  {
811  global $ilDB;
812 
813  // delete viewdefinitions.
814  $this->deleteViewDefinition(self::VIEW_VIEW);
815  $this->deleteViewDefinition(self::FILTER_VIEW);
816  $this->deleteViewDefinition(self::EDIT_VIEW);
817  $this->deleteViewDefinition(self::EXPORTABLE_VIEW);
818 
819  $query = "DELETE FROM il_dcl_field_prop WHERE field_id = ".$ilDB->quote($this->getId(), "text");
820  $ilDB->manipulate($query);
821 
822  $query = "DELETE FROM il_dcl_field WHERE id = ".$ilDB->quote($this->getId(), "text");
823  $ilDB->manipulate($query);
824 
825  }
+ Here is the call graph for this function:

◆ doRead()

ilDataCollectionField::doRead ( )

Read field.

Definition at line 589 of file class.ilDataCollectionField.php.

References $query, getId(), loadProperties(), setDatatypeId(), setDescription(), setLocked(), setRequired(), setTableId(), setTitle(), and setUnique().

Referenced by __construct().

590  {
591  global $ilDB;
592 
593  //THEN 1 ELSE 0 END AS has_options FROM il_dcl_field f WHERE id = ".$ilDB->quote($this->getId(),"integer");
594  $query = "SELECT * FROM il_dcl_field WHERE id = ".$ilDB->quote($this->getId(),"integer");
595  $set = $ilDB->query($query);
596  $rec = $ilDB->fetchAssoc($set);
597 
598  $this->setTableId($rec["table_id"]);
599  $this->setTitle($rec["title"]);
600  $this->setDescription($rec["description"]);
601  $this->setDatatypeId($rec["datatype_id"]);
602  $this->setRequired($rec["required"]);
603  $this->setUnique($rec["is_unique"]);
604  $this->setLocked($rec["is_locked"]);
605  $this->loadProperties();
606  }
setRequired($a_required)
Set Required.
setDatatypeId($a_id)
Set datatype id.
loadProperties()
Get all properties of a field.
setDescription($a_desc)
Set description.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ doUpdate()

ilDataCollectionField::doUpdate ( )

Update field.

Definition at line 666 of file class.ilDataCollectionField.php.

References getDatatypeId(), getDescription(), getId(), getLocked(), getRequired(), getTableId(), getTitle(), isUnique(), updateEditability(), updateExportability(), updateFilterability(), updateProperties(), and updateVisibility().

667  {
668  global $ilDB;
669 
670  $ilDB->update("il_dcl_field", array(
671  "table_id" => array("integer", $this->getTableId()),
672  "datatype_id" => array("text", $this->getDatatypeId()),
673  "title" => array("text", $this->getTitle()),
674  "description" => array("text", $this->getDescription()),
675  "required" => array("integer",$this->getRequired()),
676  "is_unique" => array("integer",$this->isUnique()),
677  "is_locked" => array("integer",$this->getLocked()?1:0),
678  ), array(
679  "id" => array("integer", $this->getId())
680  ));
681  $this->updateVisibility();
682  $this->updateFilterability();
683  $this->updateEditability();
684  $this->updateExportability();
685  $this->updateProperties();
686  }
updateProperties()
Update properties of this field in Database.
getRequired()
Get Required Required.
+ Here is the call graph for this function:

◆ getDatatype()

ilDataCollectionField::getDatatype ( )

Definition at line 369 of file class.ilDataCollectionField.php.

References $datatype, and loadDatatype().

+ Here is the call graph for this function:

◆ getDatatypeId()

ilDataCollectionField::getDatatypeId ( )

Get datatype_id.

Returns
int

Definition at line 269 of file class.ilDataCollectionField.php.

References $datatypeId, ilDataCollectionStandardField\_getDatatypeForId(), getId(), and isStandardField().

Referenced by ilDataCollectionDatatype\addFilterInputFieldToTable(), checkValidity(), doCreate(), doUpdate(), ilDataCollectionFieldListTableGUI\fillRow(), ilDataCollectionDatatype\getInputField(), and ilDataCollectionDatatype\passThroughFilter().

270  {
271  if($this->isStandardField())
272  {
274  }
275  return $this->datatypeId;
276  }
static _getDatatypeForId($id)
gives you the datatype id of a specified standard field.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDatatypeTitle()

ilDataCollectionField::getDatatypeTitle ( )

Definition at line 410 of file class.ilDataCollectionField.php.

References loadDatatype().

Referenced by ilDataCollectionFieldListTableGUI\fillRow().

411  {
412  $this->loadDatatype();
413 
414  return $this->datatype->getTitle();
415  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDescription()

ilDataCollectionField::getDescription ( )

Get description.

Returns
string

Definition at line 247 of file class.ilDataCollectionField.php.

Referenced by doCreate(), doUpdate(), ilDataCollectionFieldListTableGUI\fillRow(), and ilDataCollectionDatatype\getInputField().

248  {
249  return $this->desc;
250  }
+ Here is the caller graph for this function:

◆ getExportable()

ilDataCollectionField::getExportable ( )

Definition at line 543 of file class.ilDataCollectionField.php.

References $exportable, and loadExportability().

Referenced by ilDataCollectionFieldListTableGUI\fillRow(), and updateViewDefinition().

543  {
544  if(!isset($this->exportable))
545  $this->loadExportability();
546  return $this->exportable;
547  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldRef()

ilDataCollectionField::getFieldRef ( )

Definition at line 851 of file class.ilDataCollectionField.php.

References $id, and getPropertyvalues().

Referenced by ilDataCollectionDatatype\addFilterInputFieldToTable(), and ilDataCollectionFieldListTableGUI\fillRow().

852  {
853  $props = $this->getPropertyvalues();
854  $id = self::PROPERTYID_REFERENCE;
855 
856  return $props[$id];
857  }
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getFieldReflist()

ilDataCollectionField::getFieldReflist ( )

Definition at line 862 of file class.ilDataCollectionField.php.

References $id, and getPropertyvalues().

863  {
864  $props = $this->getPropertyvalues();
865  $id = self::PROPERTYID_REFERENCELIST;
866 
867  return $props[$id];
868  }
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:

◆ getFilterable()

ilDataCollectionField::getFilterable ( )
Returns
bool returns the same as isFilterable.

Definition at line 706 of file class.ilDataCollectionField.php.

References isFilterable().

707  {
708  return $this->isFilterable();
709  }
+ Here is the call graph for this function:

◆ getId()

◆ getLearningProgress()

ilDataCollectionField::getLearningProgress ( )
Returns
bool

Definition at line 400 of file class.ilDataCollectionField.php.

References getPropertyvalues().

400  {
401  $props = $this->getPropertyvalues();
402  $p = self::PROPERTYID_LEARNING_PROGRESS;
403 
404  return $props[$p];
405  }
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:

◆ getLength()

ilDataCollectionField::getLength ( )

Definition at line 379 of file class.ilDataCollectionField.php.

References getPropertyvalues().

Referenced by ilDataCollectionDatatype\getInputField().

380  {
381  $props = $this->getPropertyvalues();
382  $l = self::PROPERTYID_LENGTH;
383 
384  return $props[$l];
385  }
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLocked()

ilDataCollectionField::getLocked ( )
Returns
boolean

Definition at line 932 of file class.ilDataCollectionField.php.

References $locked.

Referenced by doCreate(), doUpdate(), and ilDataCollectionFieldListTableGUI\fillRow().

933  {
934  return $this->locked;
935  }
+ Here is the caller graph for this function:

◆ getOrder()

ilDataCollectionField::getOrder ( )

Definition at line 830 of file class.ilDataCollectionField.php.

References $order, and loadVisibility().

Referenced by updateViewDefinition().

831  {
832  if(!isset($this->order))
833  {
834  $this->loadVisibility();
835  }
836 
837  return !$this->order?0:$this->order;
838  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProperties()

ilDataCollectionField::getProperties ( )

Get all properties of a field.

Returns
array

Definition at line 909 of file class.ilDataCollectionField.php.

References $property, and loadProperties().

Referenced by getTextArea(), and ilDataCollectionDatatype\passThroughFilter().

910  {
911  if($this->property == null)
912  $this->loadProperties();
913 
914  return $this->property;
915  }
loadProperties()
Get all properties of a field.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPropertyvalues()

ilDataCollectionField::getPropertyvalues ( )

Get Property Values.

Parameters
int$a_id
Returns
array

Definition at line 331 of file class.ilDataCollectionField.php.

References $property, and loadProperties().

Referenced by checkValidity(), getFieldRef(), getFieldReflist(), getLearningProgress(), getLength(), and isNRef().

332  {
333  if($this->property == null)
334  $this->loadProperties();
335  return $this->property;
336  }
loadProperties()
Get all properties of a field.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getRequired()

ilDataCollectionField::getRequired ( )

Get Required Required.

Returns
boolean

Definition at line 293 of file class.ilDataCollectionField.php.

References $required.

Referenced by doCreate(), doUpdate(), and ilDataCollectionFieldListTableGUI\fillRow().

+ Here is the caller graph for this function:

◆ getStorageLocation()

ilDataCollectionField::getStorageLocation ( )

Definition at line 420 of file class.ilDataCollectionField.php.

References loadDatatype().

421  {
422  $this->loadDatatype();
423 
424  return $this->datatype->getStorageLocation();
425  }
+ Here is the call graph for this function:

◆ getTableId()

ilDataCollectionField::getTableId ( )

Get table id.

Returns
int

Definition at line 204 of file class.ilDataCollectionField.php.

References $table_id.

Referenced by checkValidity(), deleteViewDefinition(), doCreate(), doUpdate(), and updateViewDefinition().

+ Here is the caller graph for this function:

◆ getTextArea()

ilDataCollectionField::getTextArea ( )
Returns
bool

Definition at line 390 of file class.ilDataCollectionField.php.

References $t, and getProperties().

Referenced by ilDataCollectionDatatype\getInputField().

390  {
391  $props = $this->getProperties();
392  $t = self::PROPERTYID_TEXTAREA;
393 
394  return $props[$t];
395  }
getProperties()
Get all properties of a field.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getTitle()

ilDataCollectionField::getTitle ( )

Get title.

Returns
string

Definition at line 227 of file class.ilDataCollectionField.php.

References $title.

Referenced by ilDataCollectionDatatype\addFilterInputFieldToTable(), doCreate(), doUpdate(), ilDataCollectionFieldListTableGUI\fillRow(), and ilDataCollectionDatatype\getInputField().

228  {
229  return $this->title;
230  }
+ Here is the caller graph for this function:

◆ isEditable()

ilDataCollectionField::isEditable ( )

isEditable

Returns
int

Definition at line 525 of file class.ilDataCollectionField.php.

References $editable, and loadEditability().

Referenced by updateViewDefinition().

526  {
527  if(!isset($this->editable))
528  {
529  $this->loadEditability();
530  }
531 
532  return $this->editable;
533  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFilterable()

ilDataCollectionField::isFilterable ( )

Definition at line 465 of file class.ilDataCollectionField.php.

References $filterable, and loadFilterability().

Referenced by ilDataCollectionFieldListTableGUI\fillRow(), getFilterable(), and updateViewDefinition().

466  {
467  if(!isset($this->filterable))
468  {
469  $this->loadFilterability();
470  }
471 
472  return $this->filterable;
473  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isNRef()

ilDataCollectionField::isNRef ( )
Returns
bool returns true iff this is a reference field AND the reference field has multiple input possibilities.

Definition at line 873 of file class.ilDataCollectionField.php.

References $id, and getPropertyvalues().

Referenced by ilDataCollectionDatatype\getInputField().

874  {
875  $props = $this->getPropertyvalues();
876  $id = self::PROPERTYID_N_REFERENCE;
877  return $props[$id];
878  }
getPropertyvalues()
Get Property Values.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isStandardField()

ilDataCollectionField::isStandardField ( )

Definition at line 581 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionFieldListTableGUI\fillRow(), and getDatatypeId().

582  {
583  return false;
584  }
+ Here is the caller graph for this function:

◆ isUnique()

ilDataCollectionField::isUnique ( )

Definition at line 312 of file class.ilDataCollectionField.php.

References $unique.

Referenced by checkValidity(), doCreate(), doUpdate(), and ilDataCollectionFieldListTableGUI\fillRow().

313  {
314  return $this->unique;
315  }
+ Here is the caller graph for this function:

◆ isVisible()

ilDataCollectionField::isVisible ( )

Definition at line 441 of file class.ilDataCollectionField.php.

References $visible, and loadVisibility().

Referenced by ilDataCollectionFieldListTableGUI\fillRow(), and updateViewDefinition().

442  {
443  if(!isset($this->visible))
444  {
445  $this->loadVisibility();
446  }
447 
448  return $this->visible;
449  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadDatatype()

ilDataCollectionField::loadDatatype ( )
private

Definition at line 430 of file class.ilDataCollectionField.php.

Referenced by getDatatype(), getDatatypeTitle(), and getStorageLocation().

431  {
432  if($this->datatype == NULL)
433  {
434  $this->datatype = new ilDataCollectionDatatype($this->datatypeId);
435  }
436  }
Class ilDataCollectionDatatype.
+ Here is the caller graph for this function:

◆ loadEditability()

ilDataCollectionField::loadEditability ( )
private

Definition at line 551 of file class.ilDataCollectionField.php.

References loadViewDefinition().

Referenced by isEditable().

552  {
553  if($this->editable == NULL)
554  {
555  $this->loadViewDefinition(self::EDIT_VIEW);
556  }
557  }
loadViewDefinition($view)
loadViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadExportability()

ilDataCollectionField::loadExportability ( )
private

Definition at line 562 of file class.ilDataCollectionField.php.

References loadViewDefinition().

Referenced by getExportable().

563  {
564  if($this->exportable == NULL)
565  {
566  $this->loadViewDefinition(self::EXPORTABLE_VIEW);
567  }
568  }
loadViewDefinition($view)
loadViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadFilterability()

ilDataCollectionField::loadFilterability ( )
private

Definition at line 478 of file class.ilDataCollectionField.php.

References loadViewDefinition().

Referenced by isFilterable().

479  {
480  if($this->filterable == NULL)
481  {
482  $this->loadViewDefinition(self::FILTER_VIEW);
483  }
484  }
loadViewDefinition($view)
loadViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadProperties()

ilDataCollectionField::loadProperties ( )
private

Get all properties of a field.

Returns
array

Definition at line 885 of file class.ilDataCollectionField.php.

References $query, getId(), and setPropertyvalue().

Referenced by doRead(), getProperties(), and getPropertyvalues().

886  {
887  global $ilDB;
888 
889  $query = "SELECT datatype_prop_id,
890  title,
891  value
892  FROM il_dcl_field_prop fp
893  LEFT JOIN il_dcl_datatype_prop AS p ON p.id = fp.datatype_prop_id
894  WHERE fp.field_id = ".$ilDB->quote($this->getId(),"integer");
895 
896  $set = $ilDB->query($query);
897 
898  while($rec = $ilDB->fetchAssoc($set))
899  {
900  $this->setPropertyvalue($rec['value'],$rec['datatype_prop_id']);
901  }
902  }
setPropertyvalue($a_value, $a_id)
Set Property Value.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadViewDefinition()

ilDataCollectionField::loadViewDefinition (   $view)
private

loadViewDefinition

Parameters
$viewint use VIEW_VIEW or EDIT_VIEW

Definition at line 491 of file class.ilDataCollectionField.php.

References $query.

Referenced by loadEditability(), loadExportability(), loadFilterability(), and loadVisibility().

492  {
493  global $ilDB;
494  $query = " SELECT view.table_id, def.field_order, def.is_set FROM il_dcl_viewdefinition def
495  INNER JOIN il_dcl_view view ON view.id = def.view_id AND view.type = ".$ilDB->quote($view, "integer")."
496  WHERE def.field LIKE '".$this->id."' AND view.table_id = ".$ilDB->quote($this->table_id, "integer");
497  $set = $ilDB->query($query);
498  $rec = $ilDB->fetchAssoc($set);
499  $prop = $rec['is_set'];
500 
501  switch($view)
502  {
503  case self::VIEW_VIEW:
504  $this->visible = $prop;
505  break;
506  case self::EDIT_VIEW:
507  $this->editable = $prop;
508  break;
509  case self::FILTER_VIEW:
510  $this->filterable = $prop;
511  break;
512  case self::EXPORTABLE_VIEW:
513  $this->exportable = $prop;
514  break;
515  }
516 
517  if(!$this->order)
518  $this->order = $rec['field_order'];
519  }
+ Here is the caller graph for this function:

◆ loadVisibility()

ilDataCollectionField::loadVisibility ( )
private

Definition at line 454 of file class.ilDataCollectionField.php.

References loadViewDefinition().

Referenced by getOrder(), and isVisible().

455  {
456  if($this->visible == NULL)
457  {
458  $this->loadViewDefinition(self::VIEW_VIEW);
459  }
460  }
loadViewDefinition($view)
loadViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDatatypeId()

ilDataCollectionField::setDatatypeId (   $a_id)

Set datatype id.

Parameters
int$a_id

Definition at line 257 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

258  {
259  //unset the cached datatype.
260  $this->datatype = NULL;
261  $this->datatypeId = $a_id;
262  }
+ Here is the caller graph for this function:

◆ setDescription()

ilDataCollectionField::setDescription (   $a_desc)

Set description.

Parameters
string$a_desc

Definition at line 237 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

238  {
239  $this->desc = $a_desc;
240  }
+ Here is the caller graph for this function:

◆ setEditable()

ilDataCollectionField::setEditable (   $editable)

Definition at line 538 of file class.ilDataCollectionField.php.

References $editable.

Referenced by cloneStructure().

539  {
540  $this->editable = $editable;
541  }
+ Here is the caller graph for this function:

◆ setExportable()

ilDataCollectionField::setExportable (   $exportable)
Parameters
boolean$exportable

Definition at line 1065 of file class.ilDataCollectionField.php.

References $exportable.

Referenced by cloneStructure().

1066  {
1067  $this->exportable = $exportable;
1068  }
+ Here is the caller graph for this function:

◆ setFilterable()

ilDataCollectionField::setFilterable (   $filterable)

setFilterable

Parameters
$filterablebool

Definition at line 356 of file class.ilDataCollectionField.php.

References $filterable, and setOrder().

Referenced by cloneStructure().

357  {
358  if($filterable == true && $this->order === NULL)
359  {
360  $this->setOrder(0);
361  }
362 
363  $this->filterable = $filterable;
364  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setId()

ilDataCollectionField::setId (   $a_id)

Set field id.

Parameters
int$a_id

Definition at line 174 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), and doCreate().

175  {
176  $this->id = $a_id;
177  }
+ Here is the caller graph for this function:

◆ setLocked()

ilDataCollectionField::setLocked (   $locked)
Parameters
boolean$locked

Definition at line 924 of file class.ilDataCollectionField.php.

References $locked.

Referenced by buildFromDBRecord(), cloneStructure(), doCreate(), and doRead().

925  {
926  $this->locked = $locked;
927  }
+ Here is the caller graph for this function:

◆ setOrder()

ilDataCollectionField::setOrder (   $order)

Definition at line 843 of file class.ilDataCollectionField.php.

References $order.

Referenced by cloneStructure(), setFilterable(), and setVisible().

844  {
845  $this->order = $order;
846  }
+ Here is the caller graph for this function:

◆ setProperties()

ilDataCollectionField::setProperties (   $data)

Definition at line 917 of file class.ilDataCollectionField.php.

References $data.

917  {
918  $this->property = $data;
919  }
while($lm_rec=$ilDB->fetchAssoc($lm_set)) $data

◆ setPropertyvalue()

ilDataCollectionField::setPropertyvalue (   $a_value,
  $a_id 
)

Set Property Value.

Parameters
string$a_value
int$a_id

Definition at line 304 of file class.ilDataCollectionField.php.

Referenced by loadProperties().

305  {
306  $this->property[$a_id] = $a_value;
307  }
+ Here is the caller graph for this function:

◆ setRequired()

ilDataCollectionField::setRequired (   $a_required)

Set Required.

Parameters
boolean$a_requiredRequired

Definition at line 283 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

284  {
285  $this->required = $a_required;
286  }
+ Here is the caller graph for this function:

◆ setTableId()

ilDataCollectionField::setTableId (   $a_id)

Set table id.

Parameters
int$a_id

Definition at line 194 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), and doRead().

195  {
196  $this->table_id = $a_id;
197  }
+ Here is the caller graph for this function:

◆ setTitle()

ilDataCollectionField::setTitle (   $a_title)

Set title.

Parameters
string$a_title

Definition at line 214 of file class.ilDataCollectionField.php.

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

215  {
216  //title cannot begin with _ as this is saved for other purposes. make __ instead.
217  if(substr($a_title,0,1) == "_" && substr($a_title, 0, 2) != "__")
218  $a_title = "_".$a_title;
219  $this->title = $a_title;
220  }
+ Here is the caller graph for this function:

◆ setUnique()

ilDataCollectionField::setUnique (   $unique)

Definition at line 320 of file class.ilDataCollectionField.php.

References $unique.

Referenced by buildFromDBRecord(), cloneStructure(), and doRead().

321  {
322  $this->unique = $unique ? 1 : 0;
323  }
+ Here is the caller graph for this function:

◆ setVisible()

ilDataCollectionField::setVisible (   $visible)

setVisible

Parameters
$visiblebool

Definition at line 342 of file class.ilDataCollectionField.php.

References $visible, and setOrder().

Referenced by cloneStructure().

343  {
344  if($visible == true && $this->order === NULL)
345  {
346  $this->setOrder(0);
347  }
348 
349  $this->visible = $visible;
350  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ toArray()

ilDataCollectionField::toArray ( )

Definition at line 573 of file class.ilDataCollectionField.php.

574  {
575  return (array) $this;
576  }

◆ updateEditability()

ilDataCollectionField::updateEditability ( )
protected

Definition at line 727 of file class.ilDataCollectionField.php.

References updateViewDefinition().

Referenced by doCreate(), and doUpdate().

727  {
728  $this->updateViewDefinition(self::EDIT_VIEW);
729  }
updateViewDefinition($view)
updateViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateExportability()

ilDataCollectionField::updateExportability ( )
protected

Definition at line 731 of file class.ilDataCollectionField.php.

References updateViewDefinition().

Referenced by doCreate(), ilDataCollectionStandardField\doUpdate(), and doUpdate().

731  {
732  $this->updateViewDefinition(self::EXPORTABLE_VIEW);
733  }
updateViewDefinition($view)
updateViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFilterability()

ilDataCollectionField::updateFilterability ( )
protected

Definition at line 722 of file class.ilDataCollectionField.php.

References updateViewDefinition().

Referenced by doCreate(), ilDataCollectionStandardField\doUpdate(), and doUpdate().

723  {
724  $this->updateViewDefinition(self::FILTER_VIEW);
725  }
updateViewDefinition($view)
updateViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateProperties()

ilDataCollectionField::updateProperties ( )
protected

Update properties of this field in Database.

Definition at line 691 of file class.ilDataCollectionField.php.

References getId().

Referenced by doUpdate().

691  {
692  global $ilDB;
693  foreach ($this->property as $key => $value) {
694  $ilDB->update('il_dcl_field_prop', array(
695  'value' => array('integer', $value),
696  ), array(
697  'field_id' => array('integer', $this->getId()),
698  'datatype_prop_id' => array('integer', $key),
699  ));
700  }
701  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateViewDefinition()

ilDataCollectionField::updateViewDefinition (   $view)
private

updateViewDefinition

Parameters
$viewint use constant VIEW_VIEW or EDIT_VIEW

Definition at line 739 of file class.ilDataCollectionField.php.

References $query, getExportable(), getId(), getOrder(), getTableId(), isEditable(), isFilterable(), and isVisible().

Referenced by updateEditability(), updateExportability(), updateFilterability(), and updateVisibility().

740  {
741  global $ilDB;
742 
743  switch($view)
744  {
745  case self::EDIT_VIEW:
746  $set = $this->isEditable();
747  break;
748  case self::VIEW_VIEW:
749  $set = $this->isVisible();
750  if($set && $this->order === NULL)
751  $this->order = 0;
752  break;
753  case self::FILTER_VIEW:
754  $set = $this->isFilterable();
755  if($set && $this->order === NULL)
756  $this->order = 0;
757  break;
758  case self::EXPORTABLE_VIEW:
759  $set = $this->getExportable();
760  if($set && $this->order === NULL)
761  $this->order = 0;
762  break;
763  }
764 
765  if(!$set)
766  $set = 0;
767  else
768  $set = 1;
769 
770  if(!isset($this->order))
771  $this->order = 0;
772 
773  $query = "DELETE def FROM il_dcl_viewdefinition def INNER JOIN il_dcl_view ON il_dcl_view.type = "
774  .$ilDB->quote($view, "integer")." AND il_dcl_view.table_id = "
775  .$ilDB->quote($this->getTableId(), "integer")." WHERE def.view_id = il_dcl_view.id AND def.field = "
776  .$ilDB->quote($this->getId(), "text");
777 
778  $ilDB->manipulate($query);
779 
780  $query = "INSERT INTO il_dcl_viewdefinition (view_id, field, field_order, is_set) SELECT id, "
781  .$ilDB->quote($this->getId(), "text").", "
782  .$ilDB->quote($this->getOrder(), "integer").", "
783  .$ilDB->quote($set, "integer")." FROM il_dcl_view WHERE il_dcl_view.type = "
784  .$ilDB->quote($view, "integer")." AND il_dcl_view.table_id = "
785  .$ilDB->quote($this->getTableId(), "integer");
786 
787  $ilDB->manipulate($query);
788  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateVisibility()

ilDataCollectionField::updateVisibility ( )
protected

Definition at line 714 of file class.ilDataCollectionField.php.

References updateViewDefinition().

Referenced by doCreate(), ilDataCollectionStandardField\doUpdate(), and doUpdate().

715  {
716  $this->updateViewDefinition(self::VIEW_VIEW);
717  }
updateViewDefinition($view)
updateViewDefinition
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $datatype

ilDataCollectionField::$datatype
protected

Definition at line 94 of file class.ilDataCollectionField.php.

Referenced by getDatatype().

◆ $datatypeId

ilDataCollectionField::$datatypeId
protected

Definition at line 44 of file class.ilDataCollectionField.php.

Referenced by getDatatypeId().

◆ $description

ilDataCollectionField::$description
protected

Definition at line 39 of file class.ilDataCollectionField.php.

◆ $editable

ilDataCollectionField::$editable
protected

Definition at line 69 of file class.ilDataCollectionField.php.

Referenced by isEditable(), and setEditable().

◆ $exportable

ilDataCollectionField::$exportable
protected

Definition at line 89 of file class.ilDataCollectionField.php.

Referenced by getExportable(), and setExportable().

◆ $filterable

ilDataCollectionField::$filterable
protected

Definition at line 74 of file class.ilDataCollectionField.php.

Referenced by isFilterable(), and setFilterable().

◆ $id

◆ $locked

ilDataCollectionField::$locked
protected

Definition at line 79 of file class.ilDataCollectionField.php.

Referenced by getLocked(), and setLocked().

◆ $order

ilDataCollectionField::$order
protected

Definition at line 54 of file class.ilDataCollectionField.php.

Referenced by getOrder(), and setOrder().

◆ $property

ilDataCollectionField::$property = array()
protected

Definition at line 84 of file class.ilDataCollectionField.php.

Referenced by getProperties(), and getPropertyvalues().

◆ $required

ilDataCollectionField::$required
protected

Definition at line 49 of file class.ilDataCollectionField.php.

Referenced by getRequired().

◆ $table_id

ilDataCollectionField::$table_id
protected

◆ $title

ilDataCollectionField::$title
protected

Definition at line 34 of file class.ilDataCollectionField.php.

Referenced by _getFieldIdByTitle(), and getTitle().

◆ $unique

ilDataCollectionField::$unique
protected

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

Referenced by isUnique(), and setUnique().

◆ $visible

ilDataCollectionField::$visible
protected

Definition at line 64 of file class.ilDataCollectionField.php.

Referenced by isVisible(), and setVisible().

◆ EDIT_VIEW

const ilDataCollectionField::EDIT_VIEW = 2

Definition at line 115 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionTable\doCreate().

◆ EXPORTABLE_VIEW

const ilDataCollectionField::EXPORTABLE_VIEW = 4

Definition at line 117 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionTable\doCreate().

◆ FILTER_VIEW

const ilDataCollectionField::FILTER_VIEW = 3

Definition at line 116 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionTable\doCreate().

◆ PROPERTYID_HEIGHT

const ilDataCollectionField::PROPERTYID_HEIGHT = 8

◆ PROPERTYID_ILIAS_REFERENCE_LINK

const ilDataCollectionField::PROPERTYID_ILIAS_REFERENCE_LINK = 10

◆ PROPERTYID_LEARNING_PROGRESS

const ilDataCollectionField::PROPERTYID_LEARNING_PROGRESS = 9

Definition at line 108 of file class.ilDataCollectionField.php.

◆ PROPERTYID_LENGTH

const ilDataCollectionField::PROPERTYID_LENGTH = 1

◆ PROPERTYID_N_REFERENCE

const ilDataCollectionField::PROPERTYID_N_REFERENCE = 11

◆ PROPERTYID_REFERENCE

const ilDataCollectionField::PROPERTYID_REFERENCE = 3

◆ PROPERTYID_REFERENCE_LINK

const ilDataCollectionField::PROPERTYID_REFERENCE_LINK = 6

◆ PROPERTYID_REFERENCELIST

const ilDataCollectionField::PROPERTYID_REFERENCELIST = 11

◆ PROPERTYID_REGEX

const ilDataCollectionField::PROPERTYID_REGEX = 2

Definition at line 97 of file class.ilDataCollectionField.php.

Referenced by checkValidity().

◆ PROPERTYID_TEXTAREA

const ilDataCollectionField::PROPERTYID_TEXTAREA = 5

◆ PROPERTYID_URL

const ilDataCollectionField::PROPERTYID_URL = 4

LINK OR EMAIL!

Definition at line 103 of file class.ilDataCollectionField.php.

Referenced by checkValidity(), and ilDataCollectionDatatype\parseHTML().

◆ PROPERTYID_WIDTH

const ilDataCollectionField::PROPERTYID_WIDTH = 7

◆ VIEW_VIEW

const ilDataCollectionField::VIEW_VIEW = 1

Definition at line 114 of file class.ilDataCollectionField.php.

Referenced by ilDataCollectionTable\doCreate().


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