Example #1
0
 public function cities($values)
 {
     $ds = \reasg\ui_datasource::createDataset('cities');
     $cities = ['pr' => ['ag' => 'Aguadilla', 'ad' => 'Aguada', 'an' => 'Añasco', 'ar' => 'Arecibo', 'is' => 'Isabela', 'mc' => 'Moca', 'mg' => 'Mayagüez', 'sb' => 'Sabana Grande', 'sb' => 'San German', 'sj' => 'San Juan', 'ho' => 'Hormigeros', 'ya' => 'Yauco', 'po' => 'Ponce', 'ri' => 'Rincon', 'by' => 'Bayamon', 'hu' => 'Humacao', 'ut' => 'Utuado'], 'fl' => ['or' => 'Orlando', 'mi' => 'Miami', 'tp' => 'Tampa', 'kw' => 'Key West', 'js' => 'Jacksonville', 'th' => 'Tallahassee', 'fd' => 'Fort Lauderdale'], 'ny' => ['nyc' => 'New York City', 'bf' => 'Buffalo', 'bn' => 'Bronx', 'ab' => 'Albany', 'sy' => 'Syracuse', 'ro' => 'Rochester'], 'vi' => ['ri' => 'Richmond', 'vb' => 'Virginia Beach', 'nf' => 'Norfolk', 'wi' => 'Williamsburg', 'qa' => 'Quantico']];
     //this event may receive an optional "q" parameter with a state
     $k = isset($values['q']) ? $values['q'] : 'pr';
     if (!array_key_exists($k, $cities)) {
         $k = 'pr';
     }
     $ds->items['options'] = $cities[$k];
     $this->controller->sendDataSet($ds);
 }
Example #2
0
 public function create($values)
 {
     $page = \reasg\ui_views::createDefaultView();
     $recordView = \reasg\ui_template::create("record.view");
     $recordView->set("record_title", "New Employee Record");
     $page->body->write($recordView);
     $ds = \reasg\ui_datasource::createDataset('student_record');
     //Settings items individually
     $ds->items['std_sn'] = '812150001';
     $ds->items['std_name'] = 'Joe Cuevas Garcia';
     $ds->items['std_ssn'] = ['123', '45', '6789'];
     $ds->items['std_dob'] = '09/22/1998';
     $ds->items['std_sex'] = 'm';
     $ds->items['languages'] = ['sp', 'en'];
     //bind this ds to fields in a view with
     //the same name as this ds
     $ds->bindToView();
     //reasg_dev_dump($recordView);
 }
Example #3
0
 public function sendDataset($data)
 {
     global $app_state;
     $dsn = 'ds_' . uniqid();
     if (is_object($data) && is_a($data, '\\reasg\\ui_datasource')) {
         $ds = $data;
     } else {
         $ds = \reasg\ui_datasource::createDataset($dsn);
         if (is_array($data)) {
             $ds->setItems($data);
         }
     }
     $this->header('Content-Type', 'text/json');
     $this->write($ds);
     if ($app_state['commited']) {
         return;
     }
     return $this;
 }
Example #4
0
 public function ds_schools($values)
 {
     $dataset = \reasg\ui_datasource::dataset();
     // we use the special entry 'row_attr' to set a row's attributes
     // the 'css' elements sets a rows class attribute
     $dataset->append('1', ['id' => '1', 'school_name' => 'Jose de Diego', 'town' => 'ag', 'type' => 'sc', 'date_created' => '5/14/2015']);
     $dataset->append('2', ['id' => '2', 'school_name' => 'Betances', 'town' => 'ag', 'type' => 'sc', 'date_created' => '6/15/2015']);
     $dataset->append('3', ['id' => '3', 'school_name' => 'John B Waston', 'town' => 'mc', 'type' => 'sc', 'date_created' => '7/16/2015']);
     $dataset->send();
 }