38         $this->tree = $DIC->repositoryTree();
    39         $ilDB = $DIC->database();
    41         $this->obj_id = $a_obj_id;
    49         return self::$instances[$a_obj_id] ?? (self::$instances[$a_obj_id] = 
new self($a_obj_id));
    62         $inherited = clone $this;
    67             $inherited->setSortMode($effective_settings->getSortMode());
    68             $inherited->setSortNewItemsOrder($effective_settings->getSortNewItemsOrder());
    69             $inherited->setSortNewItemsPosition($effective_settings->getSortNewItemsPosition());
    79         if (!$a_container_obj_id) {
    88             $parent_settings = self::getInstanceByObjId($parent_obj_id);
    93             return $parent_settings;
    98             $parent_settings = self::getInstanceByObjId($parent_obj_id);
    99             return $parent_settings;
   110         $ilDB = $DIC->database();
   112         $query = 
"SELECT sort_mode FROM container_sorting_set " .
   113             "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" ";
   117             return (
int) $row->sort_mode;
   126         $ilDB = $DIC->database();
   129         $query = 
"SELECT sort_mode FROM container_sorting_set " .
   130             "WHERE obj_id = " . 
$ilDB->quote($a_obj_id, 
'integer') . 
" ";
   135                 return (
int) $row->sort_mode;
   138         return self::lookupSortModeFromParentContainer($a_obj_id);
   143         $settings = self::getInstanceByObjId($a_obj_id);
   144         $inherited_settings = $settings->getInheritedSettings($a_obj_id);
   145         return $inherited_settings->getSortMode();
   154         $ilDB = $DIC->database();
   156         $query = 
"SELECT sort_mode,sort_direction,new_items_position,new_items_order " .
   157             "FROM container_sorting_set " .
   158             "WHERE obj_id = " . 
$ilDB->quote($a_old_id, 
'integer') . 
" ";
   161             $query = 
"DELETE FROM container_sorting_set " .
   162                 "WHERE obj_id = " . 
$ilDB->quote($a_new_id) . 
" ";
   163             $ilDB->manipulate($query);
   165             $query = 
"INSERT INTO container_sorting_set  " .
   166                 "(obj_id,sort_mode, sort_direction, new_items_position, new_items_order) " .
   168                 $ilDB->quote($a_new_id, 
'integer') . 
", " .
   169                 $ilDB->quote($row[
"sort_mode"], 
'integer') . 
", " .
   170                 $ilDB->quote($row[
"sort_direction"], 
'integer') . 
', ' .
   171                 $ilDB->quote($row[
"new_items_position"], 
'integer') . 
', ' .
   172                 $ilDB->quote($row[
"new_items_order"], 
'integer') . 
' ' .
   174             $ilDB->manipulate($query);
   180         return $this->sort_mode ?: 0;
   203         $this->sort_mode = $a_mode;
   208         $this->sort_direction = $a_direction;
   213         $this->new_items_position = $a_position;
   218         $this->new_items_order = $a_order;
   225         $query = 
"DELETE FROM container_sorting_set " .
   226             "WHERE obj_id = " . 
$ilDB->quote($this->obj_id, 
'integer');
   227         $ilDB->manipulate($query);
   236         $query = 
"INSERT INTO container_sorting_set " .
   237             "(obj_id,sort_mode, sort_direction, new_items_position, new_items_order) " .
   239             $this->db->
quote($this->obj_id, 
'integer') . 
", " .
   240             $this->db->quote($this->sort_mode, 
'integer') . 
", " .
   241             $this->db->quote($this->sort_direction, 
'integer') . 
', ' .
   242             $this->db->quote($this->new_items_position, 
'integer') . 
', ' .
   243             $this->db->quote($this->new_items_order, 
'integer') . 
' ' .
   245         $ilDB->manipulate($query);
   248     public function delete(): 
void   252         $query = 
'DELETE FROM container_sorting_set WHERE obj_id = ' . 
$ilDB->quote($this->obj_id, 
'integer');
   253         $ilDB->query($query);
   256     protected function read(): void
   258         if (!$this->obj_id) {
   262         $query = 
"SELECT * FROM container_sorting_set " .
   263             "WHERE obj_id = " . $this->db->quote($this->obj_id, 
'integer') . 
" ";
   265         $res = $this->db->query($query);
   267             $this->sort_mode = (
int) $row->sort_mode;
   268             $this->sort_direction = (
int) $row->sort_direction;
   269             $this->new_items_position = (
int) $row->new_items_position;
   270             $this->new_items_order = (
int) $row->new_items_order;
   282         $lng = $DIC->language();
   284         $lng->loadLanguageModule(
'crs');
   285         switch ($a_sort_mode) {
   287                 return $lng->txt(
'crs_sort_activation');
   290                 return $lng->txt(
'crs_sort_manual');
   293                 return $lng->txt(
'crs_sort_title');
   296                 return $lng->txt(
'sorting_creation_header');
   308         $settings = self::getInstanceByObjId($obj_id);
   311         switch ($settings->getSortMode()) {
   314                 switch ($settings->getSortNewItemsOrder()) {
   316                         $order = 
'Activation';
   351                     'type' => 
'Activation'   369         $settings = self::getInstanceByObjId($obj_id);
   371         switch ($attibs[
'type'] ?? 
'') {
   386         switch ($attibs[
'direction'] ?? 
'') {
   395         switch ($attibs[
'position'] ?? 
"") {
   404         switch ($attibs[
'order'] ?? 
"") {
 
setSortNewItemsOrder(int $a_order)
 
const SORT_NEW_ITEMS_POSITION_TOP
 
loadEffectiveSettings()
Load inherited settings. 
 
static _getAllReferences(int $id)
get all reference ids for object ID 
 
setSortNewItemsPosition(int $a_position)
 
quote($value, string $type)
 
static _importContainerSortingSettings(array $attibs, int $obj_id)
sorting import for all container objects 
 
static _readSortMode(int $a_obj_id)
 
static _lookupObjId(int $ref_id)
 
__construct(int $a_obj_id=0)
 
static _lookupSortMode(int $a_obj_id)
 
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
 
static _exportContainerSortingSettings(ilXmlWriter $xml, int $obj_id)
sorting XML-export for all container objects 
 
checkForParentType(int $a_ref_id, string $a_type, bool $a_exclude_source_check=false)
Check for parent type e.g check if a folder (ref_id 3) is in a parent course obj => checkForParentTyp...
 
const SORT_NEW_ITEMS_POSITION_BOTTOM
 
const SORT_NEW_ITEMS_ORDER_CREATION
 
setSortDirection(int $a_direction)
 
getInheritedSettings(int $a_container_obj_id)
 
const SORT_NEW_ITEMS_ORDER_ACTIVATION
 
getSortNewItemsPosition()
 
const SORT_DIRECTION_DESC
 
static lookupSortModeFromParentContainer(int $a_obj_id)
 
static _cloneSettings(int $a_old_id, int $a_new_id)
 
static sortModeToString(int $a_sort_mode)
Get string representation of sort mode. 
 
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content) 
 
const SORT_NEW_ITEMS_ORDER_TITLE
 
static getInstanceByObjId(int $a_obj_id)