Exemple #1
0
 function _generateReaders($m)
 {
     $ff = HTML_FlexyFramework::get();
     $ret = $this->jsHeader;
     $j = new Pman_Builder_Generator_JSON();
     $j->indent = 0;
     $j2 = new Pman_Builder_Generator_JSON(array('crlf' => '', 'tab' => ''));
     foreach ($this->tables as $this->table) {
         if ($this->modmap[strtolower($this->table)] != $m) {
             continue;
         }
         $utable = ucfirst($this->table);
         $r = $this->def['readers'][$this->table];
         foreach ($r as $k => $tab) {
             if ($tab['type'] == 'string') {
                 $r[$k] = $tab['name'];
             }
         }
         $this->readersArgs[$this->table]['xtype'] = 'JsonReader';
         $ret .= "\n{$ff->project}.Readers.{$utable} = ";
         $x = $j->encodeUnsafe($this->readersArgs[$this->table]);
         $ret .= trim(substr($x, 0, -1)) . ",\n";
         // strip of trailing ;};
         $ret .= $j->tab . "fields : [\n" . $j->tab . $j->tab;
         $ar = array();
         foreach ($r as $xr) {
             $ar[] = $j2->encodeUnsafe($xr);
         }
         $ret .= implode(",\n" . $j->tab . $j->tab, $ar);
         $ret .= "\n" . $j->tab . "]\n};\n";
     }
     return $ret;
 }
Exemple #2
0
 function readerRaw($tb)
 {
     // just ouput stuff...
     require_once 'Pman/Builder/Generator.php';
     require_once 'Pman/Builder/Generator/JSON.php';
     $x = DB_DataObject::factory('Builder');
     $basedef = $x->getDatabaseConnection()->tableInfo($tb);
     $def = Pman_Builder_Generator::tableToData($tb, $basedef);
     require_once 'Pman/Builder/Generator/JSON.php';
     $j = new Pman_Builder_Generator_JSON(array('crlf' => "\n", 'tab' => '    '));
     $j2 = new Pman_Builder_Generator_JSON(array('crlf' => '', 'tab' => ''));
     $x = 'new Roo.data.JsonReader(' . $j->encodeUnsafe($def['args']);
     $ret = trim(substr($x, 0, -1)) . ",\n";
     // strip of trailing ;};
     $ret .= $j->tab . "fields : [\n" . $j->tab . $j->tab;
     $ar = array();
     foreach ($def['readers'] as $xr) {
         $ar[] = $j2->encodeUnsafe($xr);
     }
     $ret .= implode(",\n" . $j->tab . $j->tab, $ar);
     $ret .= "\n" . $j->tab . "]\n})\n";
     return $ret;
 }