1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?php
- require_once(__DIR__.SLASH.'ReadmeType.class.php');
- class ArduinoType extends ReadmeType{
- public static function manifest(){
- return array(
- 'uid' => 'arduino',
- 'label' => 'Arduino',
- 'icon' => 'fas fa-code',
- 'color' => '#ffffff',
- 'background' => '#00979d',
- 'description' => 'Fichier contenant du langage arduino (proche du c++)',
- 'fromExtension' => array('ino'),
- 'toExtension' => 'ino',
- 'default' => '
- void setup()
- {
- Serial.begin(9600);
- Serial.println("Starting..");
- //pinMode(1, INPUT);
- //pinMode(2, OUTPUT);
- }
- void loop()
- {
- }',
- );
- }
- /* EDITION */
- public static function toHtml($resource,$sketch=null){
- $infos = self::manifest();
- return array(
- 'html'=>'<textarea id="content" onblur="hackpoint_resource_save_content()" class="arduino-text">'.$resource->content.'</textarea>',
- 'javascript' => "
- hackpoint_resource_mirrorify('.arduino-text',{
- mode : 'text/x-carduino',
- lineNumbers : true,
- theme : 'monokai',
- readOnly : false
- });
- "
- );
- }
- //Export vers un fichier brut
- public static function toFile($resource){
- $infos = self::manifest();
- return array(
- 'name'=> slugify($resource->label).'.'.$infos['toExtension'],
- 'content' => html_entity_decode($resource->content)
- );
- }
-
- }
- ?>
|