ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilContainerSortingSettings Class Reference
+ Collaboration diagram for ilContainerSortingSettings:

Public Member Functions

 __construct ($a_obj_id)
 Constructor. More...
 
 _isManualSortingEnabled ($a_obj_id)
 is manual sorting enabled More...
 
 getSortMode ()
 get sort mode More...
 
 setSortMode ($a_mode)
 set sort mode More...
 
 update ()
 Update. More...
 
 save ()
 save settings More...
 
 delete ()
 Delete setting. More...
 

Static Public Member Functions

static _readSortMode ($a_obj_id)
 
static _lookupSortMode ($a_obj_id)
 lookup sort mode More...
 
static lookupSortModeFromParentContainer ($a_obj_id)
 Lookup sort mode from parent container. More...
 
static _cloneSettings ($a_old_id, $a_new_id)
 Clone settings. More...
 
static sortModeToString ($a_sort_mode)
 get String representation of sort mode More...
 

Protected Member Functions

 read ()
 read settings More...
 

Protected Attributes

 $obj_id
 
 $sort_mode
 
 $db
 

Detailed Description

Definition at line 35 of file class.ilContainerSortingSettings.php.

Constructor & Destructor Documentation

◆ __construct()

ilContainerSortingSettings::__construct (   $a_obj_id)

Constructor.

public

Parameters

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

References read().

50  {
51  global $ilDB;
52 
53  $this->obj_id = $a_obj_id;
54  $this->db = $ilDB;
55 
56  $this->read();
57  }
+ Here is the call graph for this function:

Member Function Documentation

◆ _cloneSettings()

static ilContainerSortingSettings::_cloneSettings (   $a_old_id,
  $a_new_id 
)
static

Clone settings.

public

Parameters
intorig obj_id @þaram int new obj_id

Definition at line 163 of file class.ilContainerSortingSettings.php.

References $ilLog, $query, $res, and $row.

164  {
165  global $ilLog;
166  global $ilDB;
167 
168  $query = "SELECT sort_mode FROM container_sorting_set ".
169  "WHERE obj_id = ".$ilDB->quote($a_old_id ,'integer')." ";
170  $res = $ilDB->query($query);
171  while($row = $res->fetchRow())
172  {
173  $query = "DELETE FROM container_sorting_set ".
174  "WHERE obj_id = ".$ilDB->quote($a_new_id)." ";
175  $ilDB->manipulate($query);
176 
177  $query = "INSERT INTO container_sorting_set (obj_id,sort_mode) ".
178  "VALUES( ".
179  $ilDB->quote($a_new_id ,'integer').", ".
180  $ilDB->quote($row[0] ,'integer')." ".
181  ")";
182  $ilDB->manipulate($query);
183  }
184  return true;
185  }

◆ _isManualSortingEnabled()

ilContainerSortingSettings::_isManualSortingEnabled (   $a_obj_id)

is manual sorting enabled

public

Parameters
intobj_id

Definition at line 149 of file class.ilContainerSortingSettings.php.

References ilContainer\SORT_MANUAL.

Referenced by ilContainerSorting\read().

150  {
151  return self::_lookupSortMode($a_obj_id) == ilContainer::SORT_MANUAL;
152  }
+ Here is the caller graph for this function:

◆ _lookupSortMode()

static ilContainerSortingSettings::_lookupSortMode (   $a_obj_id)
static

lookup sort mode

public

Parameters
intobj_id

Definition at line 83 of file class.ilContainerSortingSettings.php.

References $query, $res, $row, DB_FETCHMODE_OBJECT, and ilContainer\SORT_INHERIT.

Referenced by ilObjLinkResourceGUI\activateTabs(), ilContainerGUI\addStandardRow(), ilObjLinkResourceGUI\initFormSettings(), ilWebResourceLinkTableGUI\initSorting(), ilObjFolder\read(), ilContainerSorting\read(), ilObjGroup\read(), ilContainer\read(), ilLinkResourceItems\sortItems(), and ilObjLinkResource\toXML().

84  {
85  global $tree, $ilDB, $objDefinition;
86 
87  // Try to read from table
88  $query = "SELECT * FROM container_sorting_set ".
89  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
90  $res = $ilDB->query($query);
91 
92  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
93  {
94  if($row->sort_mode != ilContainer::SORT_INHERIT)
95  {
96  return $row->sort_mode;
97  }
98  }
99  return self::lookupSortModeFromParentContainer($a_obj_id);
100  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ _readSortMode()

static ilContainerSortingSettings::_readSortMode (   $a_obj_id)
static

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

References $query, $res, $row, DB_FETCHMODE_OBJECT, and ilContainer\SORT_INHERIT.

60  {
61  global $ilDB;
62 
63  $query = "SELECT * FROM container_sorting_set ".
64  "WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
65  $res = $ilDB->query($query);
66 
67  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
68  {
69  return $row->sort_mode;
70  }
72  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11

◆ delete()

ilContainerSortingSettings::delete ( )

Delete setting.

Returns

Definition at line 249 of file class.ilContainerSortingSettings.php.

References $query.

250  {
251  global $ilDB;
252 
253  $query = 'DELETE FROM container_sorting_set WHERE obj_id = '.$ilDB->quote($this->obj_id,'integer');
254  $ilDB->query($query);
255  }

◆ getSortMode()

ilContainerSortingSettings::getSortMode ( )

get sort mode

public

Definition at line 193 of file class.ilContainerSortingSettings.php.

Referenced by ilObjFolderGUI\getEditFormCustomValues().

194  {
195  return $this->sort_mode ? $this->sort_mode : 0;
196  }
+ Here is the caller graph for this function:

◆ lookupSortModeFromParentContainer()

static ilContainerSortingSettings::lookupSortModeFromParentContainer (   $a_obj_id)
static

Lookup sort mode from parent container.

Parameters
object$a_obj_id
Returns

Definition at line 107 of file class.ilContainerSortingSettings.php.

References $ref_id, $sort_mode, ilObject\_getAllReferences(), ilObject\_lookupObjId(), ilObject\_lookupType(), ilContainer\SORT_INHERIT, and ilContainer\SORT_TITLE.

Referenced by ilObjFolderGUI\initEditCustomForm(), and ilObjGroupGUI\initForm().

108  {
109  global $tree, $ilDB, $objDefinition;
110 
111  if(!$objDefinition->isContainer(ilObject::_lookupType($a_obj_id)))
112  {
114  }
115 
116  $ref_ids = ilObject::_getAllReferences($a_obj_id);
117  $ref_id = current($ref_ids);
118 
119 
120  if($cont_ref_id = $tree->checkForParentType($ref_id,'grp'))
121  {
122  $a_obj_id = ilObject::_lookupObjId($cont_ref_id);
123  $sort_mode = self::_readSortMode($a_obj_id);
125  {
126  return $sort_mode;
127  }
128  }
129  if($cont_ref_id = $tree->checkForParentType($ref_id,'crs'))
130  {
131  $a_obj_id = ilObject::_lookupObjId($cont_ref_id);
132  $sort_mode = self::_readSortMode($a_obj_id);
134  {
135  return $sort_mode;
136  }
137  }
139  }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilContainerSortingSettings::read ( )
protected

read settings

private

Parameters

Definition at line 264 of file class.ilContainerSortingSettings.php.

References $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by __construct().

265  {
266  if(!$this->obj_id)
267  {
268  return TRUE;
269  }
270 
271  $query = "SELECT * FROM container_sorting_set ".
272  "WHERE obj_id = ".$this->db->quote($this->obj_id ,'integer')." ";
273 
274  $res = $this->db->query($query);
275  while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
276  {
277  $this->sort_mode = $row->sort_mode;
278  return TRUE;
279  }
280  }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
+ Here is the caller graph for this function:

◆ save()

ilContainerSortingSettings::save ( )

save settings

public

Definition at line 233 of file class.ilContainerSortingSettings.php.

References $query, and $res.

Referenced by update().

234  {
235  global $ilDB;
236 
237  $query = "INSERT INTO container_sorting_set (obj_id,sort_mode) ".
238  "VALUES ( ".
239  $this->db->quote($this->obj_id ,'integer').", ".
240  $this->db->quote($this->sort_mode ,'integer')." ".
241  ")";
242  $res = $ilDB->manipulate($query);
243  }
+ Here is the caller graph for this function:

◆ setSortMode()

ilContainerSortingSettings::setSortMode (   $a_mode)

set sort mode

public

Parameters
intMODE_TITLE | MODE_MANUAL | MODE_ACTIVATION

Definition at line 205 of file class.ilContainerSortingSettings.php.

Referenced by ilObjFolderGUI\afterSave(), ilObjCategoryGUI\afterSave(), ilContainer\cloneObject(), ilObjGroupGUI\saveObject(), ilObjLinkResourceGUI\saveSettings(), ilObjFolderGUI\updateCustom(), ilObjRootFolderGUI\updateObject(), ilObjGroupGUI\updateObject(), and ilObjCategoryGUI\updateObject().

206  {
207  $this->sort_mode = (int) $a_mode;
208  }
+ Here is the caller graph for this function:

◆ sortModeToString()

static ilContainerSortingSettings::sortModeToString (   $a_sort_mode)
static

get String representation of sort mode

Parameters
int$a_sort_mode
Returns

Definition at line 287 of file class.ilContainerSortingSettings.php.

References $lng, ilContainer\SORT_ACTIVATION, ilContainer\SORT_MANUAL, and ilContainer\SORT_TITLE.

Referenced by ilObjFolderGUI\initEditCustomForm().

288  {
289  global $lng;
290 
291  $lng->loadLanguageModule('crs');
292  switch($a_sort_mode)
293  {
295  return $lng->txt('crs_sort_activation');
296 
298  return $lng->txt('crs_sort_manual');
299 
301  return $lng->txt('crs_sort_title');
302 
303  }
304  return '';
305  }
global $lng
Definition: privfeed.php:40
+ Here is the caller graph for this function:

◆ update()

ilContainerSortingSettings::update ( )

Update.

public

Definition at line 216 of file class.ilContainerSortingSettings.php.

References $query, $res, and save().

217  {
218  global $ilDB;
219 
220  $query = "DELETE FROM container_sorting_set ".
221  "WHERE obj_id = ".$ilDB->quote($this->obj_id,'integer');
222  $res = $ilDB->manipulate($query);
223 
224  $this->save();
225  }
+ Here is the call graph for this function:

Field Documentation

◆ $db

ilContainerSortingSettings::$db
protected

Definition at line 40 of file class.ilContainerSortingSettings.php.

◆ $obj_id

ilContainerSortingSettings::$obj_id
protected

Definition at line 37 of file class.ilContainerSortingSettings.php.

◆ $sort_mode

ilContainerSortingSettings::$sort_mode
protected

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