Resource.class.php 762 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Define a resource.
  4. * @author Idleman
  5. * @category Plugin
  6. * @license copyright
  7. */
  8. class Resource extends Entity{
  9. public $id,$label,$sort,$type,$content,$sketch;
  10. protected $TABLE_NAME = 'hackpoint_resource';
  11. public $fields =
  12. array(
  13. 'id' => 'key',
  14. 'label' => 'string',
  15. 'sort' => 'int',
  16. 'type' => 'string',
  17. 'content' => 'longstring',
  18. 'sketch' => 'int'
  19. );
  20. public $links = array(
  21. );
  22. public function type(){
  23. require_once(__DIR__.SLASH.'ResourceType.class.php');
  24. return ResourceType::types($this->type);
  25. }
  26. public function directory(){
  27. return File::dir().'hackpoint'.SLASH.'sketch'.SLASH.$this->sketch.SLASH.$this->id;
  28. }
  29. public function toHtml(){
  30. $type = $this->type();
  31. return $type['class']::toHtml($this);
  32. }
  33. }
  34. ?>