<?php

class nmGen
{
   var $main_file;
   var $app_data;

   function __construct()
   {
   }

   function loadData($arq, $data) {
      $this->main_file = $arq;
      $this->app_data = $data;
   }
   function appendPHPToFile($file, $code) {
      fwrite($file, "<?php \n");
      fwrite($file, $code);
      fwrite($file, "\n ?>");
   }
   function appendJSToFile($file, $code) {
      fwrite($file, "<script>");
      fwrite($file, $code);
      fwrite($file, "</script>");
   }
   function appendCSSToFile($file, $code) {
      fwrite($file, "<style>");
      fwrite($file, $code);
      fwrite($file, "</style>");
   }
   function appendToFile($file, $code) {
      fwrite($file, "\n");
      fwrite($file, $code);
      fwrite($file, "\n");
   }

   function appendToMainFile($code) {
      $this->appendToFile($this->main_file, $code);
   }
   function appendPHPToMainFile($code) {
      $this->appendPHPToFile($this->main_file, $code);
   }
   function appendJSToMainFile($code) {
      $this->appendJSToFile($this->main_file, $code);
   }
   function appendCSSToMainFile($code) {
      $this->appendCSSToFile($this->main_file, $code);
   }
   function arrayToNotation($arr_in) {
      $indexes_list = '';
      foreach ( $arr_in as $k=> $v) {
         $indexes_list .= '[';
         $indexes_list .= "'".$key."' => ";
         if (!is_array($v)) {
            $indexes_list .=  "'".$val."',";
         } else {
            $indexes_list .= $this->arrayToNotation($val);
         }
         $indexes_list .= '],';
      }
      return $indexes_list;
   }



}

?>
