Resource.class.php 629 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. /**
  3. * Define a resource.
  4. *
  5. * @author valentin carruesco
  6. *
  7. * @category Core
  8. *
  9. * @license copyright
  10. */
  11. class Resource extends Entity
  12. {
  13. public $id,$label,$type,$content,$sketch,$sort;
  14. protected $fields =
  15. array(
  16. 'id' => 'key',
  17. 'label' => 'string',
  18. 'sort' => 'int',
  19. 'type' => 'string',
  20. 'content' => 'longstring',
  21. 'sketch' => 'int',
  22. );
  23. public function remove()
  24. {
  25. self::deleteById($this->id);
  26. if ($this->type == 'image' && file_exists(SKETCH_PATH.$this->content)) {
  27. unlink(SKETCH_PATH.$this->content);
  28. }
  29. }
  30. }