ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilDclFileuploadFieldModel.php
Go to the documentation of this file.
1 <?php
2 
10 {
11 
20  public function getRecordQuerySortObject($direction = "asc", $sort_by_status = false)
21  {
22  global $DIC;
23  $ilDB = $DIC['ilDB'];
24  $join_str
25  = "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 = "
26  . $ilDB->quote($this->getId(), 'integer') . ") ";
27  $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) ";
28  $join_str .= "LEFT JOIN object_data AS sort_object_data_{$this->getId()} ON (sort_object_data_{$this->getId()}.obj_id = sort_stloc_{$this->getId()}.value) ";
29  $select_str = " sort_object_data_{$this->getId()}.title AS field_{$this->getId()},";
30 
31  $sql_obj = new ilDclRecordQueryObject();
32  $sql_obj->setSelectStatement($select_str);
33  $sql_obj->setJoinStatement($join_str);
34  $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction);
35 
36  return $sql_obj;
37  }
38 
39 
47  public function getRecordQueryFilterObject($filter_value = "", ilDclBaseFieldModel $sort_field = null)
48  {
49  global $DIC;
50  $ilDB = $DIC['ilDB'];
51 
52  $join_str
53  = "INNER JOIN il_dcl_record_field AS filter_record_field_{$this->getId()} ON (filter_record_field_{$this->getId()}.record_id = record.id AND filter_record_field_{$this->getId()}.field_id = "
54  . $ilDB->quote($this->getId(), 'integer') . ") ";
55  $join_str .= "INNER JOIN il_dcl_stloc{$this->getStorageLocation()}_value AS filter_stloc_{$this->getId()} ON (filter_stloc_{$this->getId()}.record_field_id = filter_record_field_{$this->getId()}.id) ";
56  $join_str .= "INNER JOIN object_data AS filter_object_data_{$this->getId()} ON (filter_object_data_{$this->getId()}.obj_id = filter_stloc_{$this->getId()}.value AND filter_object_data_{$this->getId()}.title LIKE "
57  . $ilDB->quote("%$filter_value%", 'text') . ") ";
58 
59  $sql_obj = new ilDclRecordQueryObject();
60  $sql_obj->setJoinStatement($join_str);
61 
62  return $sql_obj;
63  }
64 
65 
71  public function getSupportedExtensions()
72  {
74  return "*";
75  }
76 
78 
79  return $this->parseSupportedExtensions($file_types);
80  }
81 
82 
88  protected function parseSupportedExtensions($input_value)
89  {
90  $supported_extensions = explode(",", $input_value);
91 
92  $trim_function = function ($value) {
93  return trim(trim(strtolower($value)), ".");
94  };
95 
96  return array_map($trim_function, $supported_extensions);
97  }
98 
99 
107  public function checkValidity($value, $record_id = null)
108  {
109  //Don't check empty values
110  if ($value == null || $value['size'] == 0) {
111  return true;
112  }
113 
114  if ($this->isUnique()) {
115  $title = $value['name'];
117  foreach ($table->getRecords() as $record) {
118  if ($this->normalizeValue($record->getRecordFieldExportValue($this->getId())) == $this->normalizeValue($title) && ($record->getId() != $record_id || $record_id == 0)) {
120  }
121  }
122  }
123 
124  return true;
125  }
126 
127 
131  public function getValidFieldProperties()
132  {
134  }
135 
136 
140  public function allowFilterInListView()
141  {
142  return false;
143  }
144 }
Class ilDclBaseFieldModel.
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
Class ilDclRecordQueryObject.
global $DIC
Definition: saml.php:7
Class ilDclBaseFieldModel.
static getTableCache($table_id=0)
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
hasProperty($key)
Checks if a certain property for a field is set.
getProperty($key)
Returns a certain property of a field.
global $ilDB
getSupportedExtensions()
Returns supported file-extensions.
if(empty($password)) $table
Definition: pwgen.php:24
Class ilDclBooleanFieldModel.