Esempio n. 1
0
 /**
  * Initializes the list from database
  */
 function init()
 {
     $db = SqlHandler::getInstance();
     //XXX use SqlObject loading
     $q = 'SELECT * FROM tblCategories WHERE categoryType=' . $this->type . ' ';
     if ($this->owner) {
         $q .= 'AND ownerId=' . $this->owner;
     }
     $list = $db->getArray($q);
     foreach ($list as $row) {
         $cat = new CategoryItem($this->type);
         $cat->setId($row['categoryId']);
         $cat->setTitle($row['categoryName']);
         $cat->setOwner($row['ownerId']);
         $cat->setPermissions($row['permissions']);
         $cat->setCreator($row['creatorId']);
         $cat->TimeCreated = new Timestamp($row['timeCreated']);
         $this->addItem($cat);
     }
 }