Exemple #1
0
 /**
  * createFromParams()
  * Constructor for the THINKER_Object_Table Class that gets properties from the provided values
  *
  * @access public
  * @static
  * @param $schemaName: Schema Name
  * @param $tableName: Table Name
  * @param $tableComment: Table Comment
  * @return THINKER_Object_Table Object
  */
 public static function createFromParams($schemaName, $tableName, $tableComment)
 {
     $Object = new THINKER_Object_Table();
     // Set values
     $Object->setTableSchema($schemaName);
     $Object->setTableName($tableName);
     $Object->setTableComment($tableComment);
     return $Object;
 }
Exemple #2
0
 /**
  * dsSelect()
  * Passes data back for the 'dsSelect' subsection
  *
  * @access public
  */
 public function dsSelect()
 {
     $phase = getPageVar('phase', 'str', 'GET');
     switch ($phase) {
         case 'fetchTables':
             $schemaName = getPageVar('schema', 'str', 'GET', true);
             if ($schemaName) {
                 $this->set('tables', THINKER_Object_Schema::getSchemaTableNames($schemaName));
             }
             // This is all we need for this phase -- exit
             return true;
             break;
         case 'invalidCombo':
             pushMessage('An invalid schema/table combination was selected, please try again.', 'warning');
             break;
         case 'noSchema':
             pushMessage('An invalid schema was selected, please try again.', 'warning');
             break;
         case 'proceed':
             // Grab selected schema
             $schema = getPageVar('schema', 'str', 'POST', true);
             $table = getPageVar('table', 'str', 'POST', true);
             // TODO: Verify permissions
             if ($schema && $table) {
                 // Push to session
                 $this->session->__set('PRIMARY_SCHEMA', THINKER_Object_Schema::createFromDB($schema));
                 $this->session->__set('PRIMARY_TABLE', THINKER_Object_Table::createFromDB($schema, $table));
                 // Redirect to next step
                 redirect('DataPull', 'dataSelect');
             } else {
                 redirect('DataPull', 'dsSelect', array('phase' => 'noSchema'));
             }
             break;
     }
     // Pass back the list of schemas in the current database
     $this->set('schemas', THINKER_Object_Schema::getLocalSchemata());
     return true;
 }