Project.php 646 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. class Project extends DBObject {
  3. public $Category;
  4. public $Images;
  5. public function __construct($id=0) {
  6. parent::__construct("projects", "id", $id);
  7. $this->Category=new ProjectCategory($this->ProjectCategoryId);
  8. $idList=explode(",", $this->ProjectImages);
  9. $this->Images=array();
  10. foreach ($idList as $id)
  11. $this->Images[]=new Image($id);
  12. }
  13. public function Save(){
  14. $images=array();
  15. foreach ($this->Images as $img)
  16. $images[]=$img->ImageId;
  17. $this->ProjectImages=implode(",", $images);
  18. parent::Save();
  19. }
  20. public function GetIcon(){
  21. return new Image($this->ProjectIcon);
  22. }
  23. }