ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilDataCollectionFormulaField.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once('./Modules/DataCollection/classes/class.ilDataCollectionRecordField.php');
6 require_once('class.ilDclStack.php');
7 require_once('class.ilDclExpressionParser.php');
8 require_once('class.ilDclTokenizer.php');
9 
19 
23  protected $expression = '';
27  protected $field_properties = array();
31  protected $parsed_value = '';
32 
33 
39  parent::__construct($record, $field);
40  $this->field_properties = $field->getProperties();
41  $this->expression = $this->field_properties[ilDataCollectionField::PROPERTYID_FORMULA_EXPRESSION];
42  }
43 
44 
48  protected function loadValue() {
49  return NULL;
50  }
51 
52 
56  public function setValue($value) {
57  unset($value);
58  }
59 
60 
64  public function doUpdate() {
65  return NULL;
66  }
67 
68 
72  public function doRead() {
73  return NULL;
74  }
75 
76 
80  public function delete() {
81  return NULL;
82  }
83 
84 
89  public function getFormInput() {
90  return $this->parse();
91  }
92 
93 
97  public function getHTML() {
98  return $this->parse();
99  }
100 
101 
105  public function getExportValue() {
106  return $this->parse();
107  }
108 
109 
113  public function getValue() {
114  return $this->parse();
115  }
116 
117 
123  protected function parse() {
124  if (!$this->parsed_value AND $this->expression) {
125  $parser = new ilDclExpressionParser($this->expression, $this->record, $this->field);
126  try {
127  $this->parsed_value = $parser->parse();
128  } catch (ilException $e) {
129  return $this->lng->txt('dcl_error_parsing_expression') . ' (' . $e->getMessage() . ')';
130  }
131  }
132 
133  return $this->parsed_value;
134  }
135 }
136 
137 ?>
Class ilDclExpressionParser.
Base class for ILIAS Exception handling.
getProperties()
Get all properties of a field.
Class ilDataCollectionRecord.
doRead()
Do nothing, value is runtime only and not stored in DB.
__construct(ilDataCollectionRecord $record, ilDataCollectionField $field)
Class ilDataCollectionField.
doUpdate()
Do nothing, value is runtime only and not stored in DB.
loadValue()
Do nothing, value is runtime only and not stored in DB.