12345678910111213141516171819202122232425262728293031323334 |
- <?php
- /**
- * Define a part.
- * @author Idleman
- * @category Plugin
- * @license copyright
- */
- class Part extends Entity{
- public $id,$label,$price,$link,$brand,$state;
- protected $TABLE_NAME = 'hackpoint_part';
- public $fields =
- array(
- 'id' => 'key',
- 'label' => 'string',
- 'price' => 'float',
- 'link' => 'longstring',
- 'state' => 'string',
- 'brand' => 'string'
- );
- public $links = array(
- );
- public function picture(){
- $folder = File::dir().'hackpoint'.SLASH.'part'.SLASH.$this->id;
- if(!file_exists($folder)) mkdir($folder,0755,true);
- $picture = $folder.SLASH.'cover.jpg';
- if(!file_exists($picture)){
- copy(__DIR__.SLASH.'img'.SLASH.'default-part.png',$picture);
- }
- return 'action.php?action=hackpoint_download_file&file='.base64_encode('part'.SLASH.$this->id.SLASH.'cover.jpg');
- }
- }
- ?>
|