ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilContainerSortingSettings Class Reference
+ Collaboration diagram for ilContainerSortingSettings:

Public Member Functions

 __construct ($a_obj_id=0)
 Constructor.
 getSortMode ()
 get sort mode
 getSortDirection ()
 Get sort direction.
 getSortNewItemsPosition ()
 GET new item position.
 getSortNewItemsOrder ()
 GET new item order.
 setSortMode ($a_mode)
 set sort mode
 setSortDirection ($a_direction)
 Set sort direction.
 setSortNewItemsPosition ($a_position)
 SET new item position.
 setSortNewItemsOrder ($a_order)
 SET new item order.
 update ()
 Update.
 save ()
 save settings
 delete ()
 Delete setting.

Static Public Member Functions

static getInstanceByObjId ($a_obj_id)
 Get singleton instance.
static _readSortMode ($a_obj_id)
static _lookupSortMode ($a_obj_id)
 lookup sort mode
static lookupSortModeFromParentContainer ($a_obj_id)
 Lookup sort mode from parent container.
static _cloneSettings ($a_old_id, $a_new_id)
 Clone settings.
static sortModeToString ($a_sort_mode)
 get String representation of sort mode
static _exportContainerSortingSettings (ilXmlWriter $xml, $obj_id)
 sorting XML-export for all container objects
static _importContainerSortingSettings ($attibs, $obj_id)
 sorting import for all container objects

Protected Member Functions

 read ()
 read settings

Protected Attributes

 $obj_id
 $sort_mode = ilContainer::SORT_TITLE
 $sort_direction = ilContainer::SORT_DIRECTION_ASC
 $new_items_position = ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM
 $new_items_order = ilContainer::SORT_NEW_ITEMS_ORDER_TITLE
 $db

Static Private Attributes

static $instances = array()

Detailed Description

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

Constructor & Destructor Documentation

ilContainerSortingSettings::__construct (   $a_obj_id = 0)

Constructor.

public

Parameters

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

References $ilDB, and read().

{
global $ilDB;
$this->obj_id = $a_obj_id;
$this->db = $ilDB;
$this->read();
}

+ Here is the call graph for this function:

Member Function Documentation

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 170 of file class.ilContainerSortingSettings.php.

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

{
global $ilDB;
$query = "SELECT sort_mode FROM container_sorting_set ".
"WHERE obj_id = ".$ilDB->quote($a_old_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow())
{
$query = "DELETE FROM container_sorting_set ".
"WHERE obj_id = ".$ilDB->quote($a_new_id)." ";
$ilDB->manipulate($query);
$query = "INSERT INTO container_sorting_set ".
"(obj_id,sort_mode, sort_direction, new_items_position, new_items_order) ".
"VALUES( ".
$ilDB->quote($a_new_id ,'integer').", ".
$ilDB->quote($row[0] ,'integer').", ".
$ilDB->quote($row[1],'integer').', '.
$ilDB->quote($row[2],'integer').', '.
$ilDB->quote($row[3],'integer').' '.
")";
$ilDB->manipulate($query);
}
return true;
}
static ilContainerSortingSettings::_exportContainerSortingSettings ( ilXmlWriter  $xml,
  $obj_id 
)
static

sorting XML-export for all container objects

Parameters
ilXmlWriter$xml
$obj_id

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

References $obj_id, getInstanceByObjId(), ilContainer\SORT_ACTIVATION, ilContainer\SORT_CREATION, ilContainer\SORT_DIRECTION_ASC, ilContainer\SORT_INHERIT, ilContainer\SORT_MANUAL, ilContainer\SORT_NEW_ITEMS_ORDER_ACTIVATION, ilContainer\SORT_NEW_ITEMS_ORDER_CREATION, ilContainer\SORT_NEW_ITEMS_ORDER_TITLE, ilContainer\SORT_NEW_ITEMS_POSITION_BOTTOM, ilContainer\SORT_TITLE, and ilXmlWriter\xmlElement().

Referenced by ilCategoryXmlWriter\export(), ilGroupXMLWriter\start(), ilCourseXMLWriter\start(), and ilFolderXmlWriter\write().

{
$attr = array();
switch($settings->getSortMode())
{
switch($settings->getSortNewItemsOrder())
{
$order = 'Activation';
break;
$order = 'Creation';
break;
$order = 'Title';
break;
}
$attr = array(
'direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC",
'position' => $settings->getSortNewItemsPosition() == ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM ? "Bottom" : "Top",
'order' => $order,
'type' => 'Manual'
);
break;
$attr = array(
'direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC",
'type' => 'Creation'
);
break;
$attr = array(
'direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC",
'type' => 'Title'
);
break;
$attr = array(
'direction' => $settings->getSortDirection() == ilContainer::SORT_DIRECTION_ASC ? "ASC" : "DESC",
'type' => 'Activation'
);
break;
$attr = array(
'type' => 'Inherit'
);
}
$xml->xmlElement('Sort', $attr);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilContainerSortingSettings::_importContainerSortingSettings (   $attibs,
  $obj_id 
)
static

sorting import for all container objects

Parameters
$attibsarray (type, direction, position, order)
$obj_id

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

References $obj_id, getInstanceByObjId(), ilContainer\SORT_ACTIVATION, ilContainer\SORT_CREATION, ilContainer\SORT_DIRECTION_ASC, ilContainer\SORT_DIRECTION_DESC, ilContainer\SORT_MANUAL, ilContainer\SORT_NEW_ITEMS_ORDER_ACTIVATION, ilContainer\SORT_NEW_ITEMS_ORDER_CREATION, ilContainer\SORT_NEW_ITEMS_ORDER_TITLE, ilContainer\SORT_NEW_ITEMS_POSITION_BOTTOM, ilContainer\SORT_NEW_ITEMS_POSITION_TOP, and ilContainer\SORT_TITLE.

Referenced by ilGroupXMLParser\__initContainerSorting(), ilFolderXmlParser\handlerBeginTag(), ilCourseXMLParser\handlerBeginTag(), and ilCategoryXmlParser\handlerBeginTag().

{
switch($attibs['type'])
{
case 'Manual':
$settings->setSortMode(ilContainer::SORT_MANUAL);
break;
case 'Creation':
$settings->setSortMode(ilContainer::SORT_CREATION);
break;
case 'Title':
$settings->setSortMode(ilContainer::SORT_TITLE);
break;
case 'Activation':
$settings->setSortMode(ilContainer::SORT_ACTIVATION);
break;
}
switch($attibs['direction'])
{
case 'ASC':
$settings->setSortDirection(ilContainer::SORT_DIRECTION_ASC);
break;
case 'DESC':
$settings->setSortDirection(ilContainer::SORT_DIRECTION_DESC);
break;
}
switch($attibs['position'])
{
case "Top":
$settings->setSortNewItemsPosition(ilContainer::SORT_NEW_ITEMS_POSITION_TOP);
break;
case "Bottom":
$settings->setSortNewItemsPosition(ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM);
break;
}
switch($attibs['order'])
{
case 'Creation':
$settings->setSortNewItemsOrder(ilContainer::SORT_NEW_ITEMS_ORDER_CREATION);
break;
case 'Title':
$settings->setSortNewItemsOrder(ilContainer::SORT_NEW_ITEMS_ORDER_TITLE);
break;
case 'Activation':
$settings->setSortNewItemsOrder(ilContainer::SORT_NEW_ITEMS_ORDER_ACTIVATION);
}
$settings->update();
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilContainerSortingSettings::_lookupSortMode (   $a_obj_id)
static

lookup sort mode

public

Parameters
intobj_id

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

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, lookupSortModeFromParentContainer(), and ilContainer\SORT_INHERIT.

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

{
global $tree, $ilDB, $objDefinition;
// Try to read from table
$query = "SELECT * FROM container_sorting_set ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
if($row->sort_mode != ilContainer::SORT_INHERIT)
{
return $row->sort_mode;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilContainerSortingSettings::_readSortMode (   $a_obj_id)
static

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

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

Referenced by lookupSortModeFromParentContainer().

{
global $ilDB;
$query = "SELECT * FROM container_sorting_set ".
"WHERE obj_id = ".$ilDB->quote($a_obj_id ,'integer')." ";
$res = $ilDB->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
return $row->sort_mode;
}
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::delete ( )

Delete setting.

Returns

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

References $ilDB, and $query.

{
global $ilDB;
$query = 'DELETE FROM container_sorting_set WHERE obj_id = '.$ilDB->quote($this->obj_id,'integer');
$ilDB->query($query);
}
static ilContainerSortingSettings::getInstanceByObjId (   $a_obj_id)
static

Get singleton instance.

Parameters
type$a_obj_id
Returns
ilContainerSortingSettings

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

Referenced by _exportContainerSortingSettings(), _importContainerSortingSettings(), ilCourseXMLParser\handlerBeginTag(), and ilContainerSorting\read().

{
if(self::$instances[$a_obj_id])
{
return self::$instances[$a_obj_id];
}
return self::$instances[$a_obj_id] = new self($a_obj_id);
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::getSortDirection ( )

Get sort direction.

Returns
type

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

References ilContainer\SORT_DIRECTION_ASC.

Referenced by ilContainerGUI\initSortingDirectionForm().

{
return $this->sort_direction ? $this->sort_direction : ilContainer::SORT_DIRECTION_ASC;
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::getSortMode ( )

get sort mode

public

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

{
return $this->sort_mode ? $this->sort_mode : 0;
}
ilContainerSortingSettings::getSortNewItemsOrder ( )

GET new item order.

Returns
int position

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

References $new_items_order.

Referenced by ilContainerGUI\initManualSortingOptionForm().

+ Here is the caller graph for this function:

ilContainerSortingSettings::getSortNewItemsPosition ( )

GET new item position.

Returns
int position

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

References $new_items_position.

Referenced by ilContainerGUI\initManualSortingOptionForm().

+ Here is the caller graph for this function:

static ilContainerSortingSettings::lookupSortModeFromParentContainer (   $a_obj_id)
static

Lookup sort mode from parent container.

Parameters
object$a_obj_id
Returns

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

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

Referenced by _lookupSortMode(), and ilContainerGUI\initSortingForm().

{
global $tree, $ilDB, $objDefinition;
if(!$objDefinition->isContainer(ilObject::_lookupType($a_obj_id)))
{
}
$ref_ids = ilObject::_getAllReferences($a_obj_id);
$ref_id = current($ref_ids);
if($cont_ref_id = $tree->checkForParentType($ref_id,'grp'))
{
$a_obj_id = ilObject::_lookupObjId($cont_ref_id);
{
return $sort_mode;
}
}
if($cont_ref_id = $tree->checkForParentType($ref_id,'crs'))
{
$a_obj_id = ilObject::_lookupObjId($cont_ref_id);
{
return $sort_mode;
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilContainerSortingSettings::read ( )
protected

read settings

private

Parameters

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

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

Referenced by __construct().

{
if(!$this->obj_id)
{
return TRUE;
}
$query = "SELECT * FROM container_sorting_set ".
"WHERE obj_id = ".$this->db->quote($this->obj_id ,'integer')." ";
$res = $this->db->query($query);
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$this->sort_mode = $row->sort_mode;
$this->sort_direction = $row->sort_direction;
$this->new_items_position = $row->new_items_position;
$this->new_items_order = $row->new_items_order;
return TRUE;
}
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::save ( )

save settings

public

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

References $ilDB, $query, and $res.

Referenced by update().

{
global $ilDB;
$query = "INSERT INTO container_sorting_set ".
"(obj_id,sort_mode, sort_direction, new_items_position, new_items_order) ".
"VALUES ( ".
$this->db->quote($this->obj_id ,'integer').", ".
$this->db->quote($this->sort_mode ,'integer').", ".
$this->db->quote($this->sort_direction,'integer').', '.
$this->db->quote($this->new_items_position,'integer').', '.
$this->db->quote($this->new_items_order,'integer').' '.
")";
$res = $ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::setSortDirection (   $a_direction)

Set sort direction.

Parameters
type$a_direction

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

{
$this->sort_direction = (int) $a_direction;
}
ilContainerSortingSettings::setSortMode (   $a_mode)

set sort mode

public

Parameters
intMODE_TITLE | MODE_MANUAL | MODE_ACTIVATION

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

Referenced by ilObjFolderGUI\afterSave(), ilObjCategoryGUI\afterSave(), ilContainer\cloneObject(), ilObjGroupGUI\saveObject(), ilObjLinkResourceGUI\saveSettings(), and ilContainerGUI\saveSortingSettings().

{
$this->sort_mode = (int) $a_mode;
}

+ Here is the caller graph for this function:

ilContainerSortingSettings::setSortNewItemsOrder (   $a_order)

SET new item order.

Parameters
int$a_order

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

{
$this->new_items_order = (int)$a_order;
}
ilContainerSortingSettings::setSortNewItemsPosition (   $a_position)

SET new item position.

Parameters
int$a_position

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

{
$this->new_items_position = (int)$a_position;
}
static ilContainerSortingSettings::sortModeToString (   $a_sort_mode)
static

get String representation of sort mode

Parameters
int$a_sort_mode
Returns

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

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

{
global $lng;
$lng->loadLanguageModule('crs');
switch($a_sort_mode)
{
return $lng->txt('crs_sort_activation');
return $lng->txt('crs_sort_manual');
return $lng->txt('crs_sort_title');
return $lng->txt('sorting_creation_header');
}
return '';
}
ilContainerSortingSettings::update ( )

Update.

public

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

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

{
global $ilDB;
$query = "DELETE FROM container_sorting_set ".
"WHERE obj_id = ".$ilDB->quote($this->obj_id,'integer');
$res = $ilDB->manipulate($query);
$this->save();
}

+ Here is the call graph for this function:

Field Documentation

ilContainerSortingSettings::$db
protected

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

ilContainerSortingSettings::$instances = array()
staticprivate

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

ilContainerSortingSettings::$new_items_order = ilContainer::SORT_NEW_ITEMS_ORDER_TITLE
protected

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

Referenced by getSortNewItemsOrder().

ilContainerSortingSettings::$new_items_position = ilContainer::SORT_NEW_ITEMS_POSITION_BOTTOM
protected

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

Referenced by getSortNewItemsPosition().

ilContainerSortingSettings::$obj_id
protected
ilContainerSortingSettings::$sort_direction = ilContainer::SORT_DIRECTION_ASC
protected

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

ilContainerSortingSettings::$sort_mode = ilContainer::SORT_TITLE
protected

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