Example #1
0
 final function addJavascript($js, $file = "")
 {
     if (empty($file)) {
         $file = \Glial\Synapse\Basic::from();
     }
     if (is_array($js)) {
         foreach ($js as $line) {
             $this->add_js($line, $file);
         }
     } else {
         $this->add_js($js, $file);
     }
 }
Example #2
0
 function admin_table()
 {
     if (IS_CLI) {
         $this->view = false;
         $this->layout_name = false;
     }
     $module = array();
     $module['picture'] = "administration/tables.png";
     $module['name'] = __("Tables");
     $module['description'] = __("Make the dictionary of field");
     if (Basic::from() !== "administration.controller.php") {
         if (true) {
             //ENVIRONEMENT
             $dir = TMP . "database/";
             if (is_dir($dir)) {
                 $dh = opendir($dir);
                 if ($dh) {
                     while (($file = readdir($dh)) !== false) {
                         if (substr($file, 0, 1) === ".") {
                             continue;
                         }
                         unlink($dir . $file);
                     }
                 }
             }
             $tables = $this->di['db']->sql(DB_DEFAULT)->getListTable();
             //debug($tables);
             foreach ($tables['table'] as $table) {
                 //echo $table . "\n";
                 $fp = fopen(TMP . "/database/" . strtolower($table) . ".table.txt", "w");
                 $description = $this->di['db']->sql(DB_DEFAULT)->getDescription($table);
                 $data = array();
                 foreach ($description as $line) {
                     $data['field'][] = $line[0];
                 }
                 $data = serialize($data);
                 fwrite($fp, $data);
                 fclose($fp);
                 unset($data);
             }
         }
     }
     return $module;
 }