Resource.class.php 785 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. 'sketch' => 'Sketch'
  22. );
  23. public function type(){
  24. require_once(__DIR__.SLASH.'ResourceType.class.php');
  25. return ResourceType::types($this->type);
  26. }
  27. public function directory(){
  28. return File::dir().'hackpoint'.SLASH.'sketch'.SLASH.$this->sketch.SLASH.$this->id;
  29. }
  30. public function toHtml(){
  31. $type = $this->type();
  32. return $type['class']::toHtml($this);
  33. }
  34. }
  35. ?>