コード例 #1
0
 /**
  * Read
  *
  * @access private
  * 
  */
 private function read()
 {
     global $tree;
     if (!$this->obj_id) {
         $this->sorting_settings = new ilContainerSortingSettings();
         return true;
     }
     $this->sorting_settings = ilContainerSortingSettings::getInstanceByObjId($this->obj_id);
     if ($this->getSortingSettings()->getSortMode() == ilContainer::SORT_INHERIT) {
         // lookup settings of parent course
         $ref_ids = ilObject::_getAllReferences($this->obj_id);
         $ref_id = end($ref_ids);
         $crs_ref_id = $tree->checkForParentType($ref_id, 'crs');
         $crs_obj_id = ilObject::_lookupObjId($crs_ref_id);
         $crs_settings = ilContainerSortingSettings::getInstanceByObjId($crs_obj_id);
         $this->sorting_settings = clone $crs_settings;
     }
     $query = "SELECT * FROM container_sorting " . "WHERE obj_id = " . $this->db->quote($this->obj_id, 'integer') . " ORDER BY position";
     $res = $this->db->query($query);
     while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
         if ($row->parent_id) {
             $this->sorting[$row->parent_type][$row->parent_id][$row->child_id] = $row->position;
         } else {
             $this->sorting['all'][$row->child_id] = $row->position;
         }
     }
     return true;
 }