Example #1
0
 public function getViews()
 {
     $EditableFields = array();
     $EditableJS = array();
     foreach ($this->getFields() as $field) {
         if ($field['editable']) {
             $OBjField = new Field($field['dataType'], $field['name'], $field['varname'], array('path' => "admin_" . strtolower($this->entityName)));
             $EditableFields[] = $OBjField->getHTML();
             $EditableJS[] = $OBjField->getJS();
         }
     }
     $files = array();
     $path = dirname(__FILE__) . "/Resources/views/" . $this->type;
     foreach (glob($path . "/*.twig") as $filename) {
         $body = "{# Generated by Tigreboite\\FunkylabBundle " . date("Y-m-d h:i:s") . " #}\n";
         $body .= file_get_contents($filename);
         $body = str_replace('%admin_entity_path%', "admin_" . strtolower($this->entityName), $body);
         $body = str_replace('%admin_entity_name%', UCFirst(strtolower($this->entityName)), $body);
         $body = str_replace('%editable_fields%', implode("\n", $EditableFields), $body);
         $body = str_replace('%javascript%', implode("\n", $EditableJS), $body);
         $files[basename($filename)] = $body;
     }
     return $files;
 }