ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 = "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 = "
25 . $ilDB->quote($this->getId(), 'integer') . ") ";
26 $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) ";
27 $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) ";
28 $select_str = " sort_object_data_{$this->getId()}.title AS field_{$this->getId()},";
29
30 $sql_obj = new ilDclRecordQueryObject();
31 $sql_obj->setSelectStatement($select_str);
32 $sql_obj->setJoinStatement($join_str);
33 $sql_obj->setOrderStatement("field_{$this->getId()} " . $direction);
34
35 return $sql_obj;
36 }
37
38
45 public function getRecordQueryFilterObject($filter_value = "", ilDclBaseFieldModel $sort_field = null)
46 {
47 global $DIC;
48 $ilDB = $DIC['ilDB'];
49
50 $join_str =
51 "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 = "
52 . $ilDB->quote($this->getId(), 'integer') . ") ";
53 $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) ";
54 $join_str .=
55 "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 "
56 . $ilDB->quote("%$filter_value%", 'text') . ") ";
57
58 $sql_obj = new ilDclRecordQueryObject();
59 $sql_obj->setJoinStatement($join_str);
60
61 return $sql_obj;
62 }
63
64
70 public function getSupportedExtensions()
71 {
73 return "*";
74 }
75
77 return $this->parseSupportedExtensions($file_types);
78 }
79
80
86 protected function parseSupportedExtensions($input_value)
87 {
88 $supported_extensions = explode(",", $input_value);
89
90 $trim_function = function ($value) {
91 return trim(trim(strtolower($value)), ".");
92 };
93
94 return array_map($trim_function, $supported_extensions);
95 }
96
104 public function checkValidity($value, $record_id = null)
105 {
106 //Don't check empty values
107 if ($value == null || $value['size'] == 0) {
108 return true;
109 }
110
111 if ($this->isUnique()) {
112 $title = $value['name'];
114 foreach ($table->getRecords() as $record) {
115 if ($this->normalizeValue($record->getRecordFieldExportValue($this->getId())) == $this->normalizeValue($title) && ($record->getId() != $record_id || $record_id == 0)) {
117 }
118 }
119 }
120
121 return true;
122 }
123
124
128 public function getValidFieldProperties()
129 {
131 }
132
136 public function allowFilterInListView()
137 {
138 return false;
139 }
140}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
hasProperty($key)
Checks if a certain property for a field is set.
getProperty($key)
Returns a certain property of a field.
static getTableCache($table_id=0)
getRecordQueryFilterObject($filter_value="", ilDclBaseFieldModel $sort_field=null)
Returns a query-object for building the record-loader-sql-query.
getRecordQuerySortObject($direction="asc", $sort_by_status=false)
Returns a query-object for building the record-loader-sql-query.
getSupportedExtensions()
Returns supported file-extensions.
Class ilDclBaseFieldModel.
Class ilDclRecordQueryObject.
if(empty($password)) $table
Definition: pwgen.php:24
global $DIC
Definition: saml.php:7
global $ilDB