Ejemplo n.º 1
0
 /**
  * Privide details of the relevant parts of the database schema, for use by
  * TabulateApp.
  */
 public function app_schema()
 {
     $db = new Database($this->wpdb);
     $tables = $db->get_tables();
     $out = array();
     foreach ($tables as $table) {
         if (Grants::current_user_can(Grants::CREATE, $table->get_name())) {
             $out[] = $table->get_name();
         }
     }
     return $out;
 }
Ejemplo n.º 2
0
 public function index($args)
 {
     $db = new Database($this->wpdb);
     $tables = $db->get_tables();
     $template = new Template('schema.html');
     $template->tables = $tables;
     $template->managed_tables = get_option(TABULATE_SLUG . '_managed_tables', array());
     if (isset($args['schema'])) {
         $template->schema = $db->get_table($args['schema']);
     }
     $template->types = array('varchar' => 'Text (short)', 'text' => 'Text (long)', 'int' => 'Number', 'date' => 'Date', 'fk' => 'Cross reference');
     return $template->render();
 }