Ejemplo n.º 1
0
 public function get_index()
 {
     $safeName = \app\inc\Model::toAscii($_REQUEST['name'], array(), "_");
     if (is_numeric($safeName[0])) {
         $safeName = "_" . $safeName;
     }
     $srid = $_REQUEST['srid'] ?: "4326";
     $file = $_REQUEST['file'];
     $key = Connection::$param["postgisschema"] . "." . $safeName . ".rast";
     // Create new table
     $table = new Table($safeName);
     $res = $table->createAsRasterTable($srid);
     // Set bitmapsource
     $join = new Table("settings.geometry_columns_join");
     $json = '{"data":{"bitmapsource":"' . $file . '","_key_":"' . $key . '"}}';
     $data = (array) json_decode(urldecode($json));
     $join->updateRecord($data, "_key_");
     if ($res["success"]) {
         $response['success'] = true;
         $response['message'] = "Layer <b>{$safeName}</b> is created";
     } else {
         $response['success'] = false;
         $response['message'] = "Some thing went wrong. Check the log.";
         Session::createLog(array($res['message']), $_REQUEST['file']);
     }
     return Response::json($response);
 }
Ejemplo n.º 2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     foreach (range(1, 25) as $index) {
         $table = new Table();
         $table->number_of_seats = 6;
         $table->table_name = 'Table ' . $index;
         $table->room_id = 1;
         $table->table_type_id = 2;
         $table->width = 6;
         $table->length = 6;
         $table->save();
     }
 }
Ejemplo n.º 3
0
 public function get_index()
 {
     $dir = App::$param['path'] . "app/tmp/" . Connection::$param["postgisdb"] . "/__bitmaps";
     $safeName = \app\inc\Model::toAscii($_REQUEST['name'], array(), "_");
     if (is_numeric($safeName[0])) {
         $safeName = "_" . $safeName;
     }
     $srid = $_REQUEST['srid'] ?: "4326";
     $cmd = "raster2pgsql " . "-s " . $srid . " -I -C -M -d " . $dir . "/" . $_REQUEST['file'] . " -F" . " -t 100x100 " . Connection::$param["postgisschema"] . "." . $safeName . " | PGPASSWORD="******"postgispw"] . " psql " . Connection::$param["postgisdb"] . " -U " . Connection::$param["postgisuser"] . " -h " . Connection::$param["postgishost"] . " -p " . Connection::$param["postgisport"];
     exec($cmd . ' 2>&1', $out);
     $err = false;
     // This is a HACK. raster2pgsql doesn't return the error to stdout or stderr.
     if (!isset($out[0])) {
         $out[0] = "ERROR: Unable to read raster file";
     }
     foreach ($out as $line) {
         if (strpos($line, 'ERROR') !== false) {
             $err = true;
             break;
         }
     }
     if (!$err) {
         $response['success'] = true;
         $response['cmd'] = $cmd;
         $response['message'] = "Raster layer <b>{$safeName}</b> is created";
         $key = Connection::$param["postgisschema"] . "." . $safeName . ".rast";
         $class = new \app\models\Classification($key);
         $arr = $class->getAll();
         if (empty($arr['data'])) {
             $class->insert();
             $class->update("0", \app\models\Classification::createClass("POLYGON"));
         }
         if ($_REQUEST['displayfile']) {
             $join = new Table("settings.geometry_columns_join");
             $json = '{"data":{"bitmapsource":"' . $_REQUEST['file'] . '","_key_":"' . $key . '"}}';
             $data = (array) json_decode(urldecode($json));
             $join->updateRecord($data, "_key_");
         }
     } else {
         $response['success'] = false;
         $response['message'] = "Some thing went wrong. Check the log.";
         Session::createLog($out, $_REQUEST['file']);
     }
     $response['cmd'] = $cmd;
     return Response::json($response);
 }
Ejemplo n.º 4
0
 public function destroy($tableId)
 {
     $table = Table::find($tableId)->delete();
     if (!$table) {
         return $this->responseNotFound(['Table Id not found']);
     }
     return $this->responseOk($table);
 }
Ejemplo n.º 5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $guestChunks = Guest::all()->chunk(6, true);
     foreach ($guestChunks as $index => $chunk) {
         $table = Table::find($index + 1);
         foreach ($chunk as $guest) {
             $table->seatGuest($guest);
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Show Setting Page
  *
  * @Get("table/{table_name}/settings", as="setting.show")
  */
 public function settings($table)
 {
     $type_options = ['text' => 'Text', 'password' => 'Password', 'number' => 'Number', 'radio' => 'Radio', 'checkbox' => 'Checkbox', 'select' => 'Select', 'range' => 'Range', 'content_editor' => 'Content Editor', 'belongs_to' => 'Belongs To', 'has_one' => 'Has One'];
     if (!Schema::hasTable($table)) {
         Flash::error('Specified table not found.');
         return view('tables.settings');
     }
     $columns_count = count(Schema::getColumnListing($table));
     if ($columns_count != TableRow::where('table_name', $table)->count()) {
         Table::where('table_name', $table)->first()->initialRows();
     }
     $columns = TableRow::where('table_name', $table)->get();
     return view('tables.settings', compact('columns', 'table', 'type_options'));
 }
Ejemplo n.º 7
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \App\Models\Table::create(['name' => 'table 1', 'slug' => 'table-1', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table 2', 'slug' => 'table-2', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table 3', 'slug' => 'table-3', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table 4', 'slug' => 'table-4', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table 5', 'slug' => 'table-5', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table vip-1', 'slug' => 'table-vip-1', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table vip-2', 'slug' => 'table-vip-2', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table o-1', 'slug' => 'table-o-1', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table o-2', 'slug' => 'table-o-2', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table o-3', 'slug' => 'table-o-3', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table b-1', 'slug' => 'table-b-1', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table b-2', 'slug' => 'table-b-2', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table b-3', 'slug' => 'table-b-3', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table b-4', 'slug' => 'table-b-4', 'status' => 'available']);
     \App\Models\Table::create(['name' => 'table b-5', 'slug' => 'table-b-5', 'status' => 'available']);
 }
Ejemplo n.º 8
0
 private function storeWizard($data)
 {
     // First we replace unicode escape sequence
     //$data = preg_replace_callback('/\\\\u([0-9a-f]{4})/i', 'replace_unicode_escape_sequence', $data);
     $tableObj = new Table("settings.geometry_columns_join");
     $obj = new \stdClass();
     $obj->classwizard = $data;
     $obj->_key_ = $this->layer;
     $tableObj->updateRecord($obj, "_key_");
     if (!$tableObj->PDOerror) {
         $response = true;
     } else {
         $response = false;
     }
     return $response;
 }
Ejemplo n.º 9
0
 /**
  * Bootstrap any necessary services.
  *
  * @return void
  */
 public function boot()
 {
     Table::observe(new TableObserver());
     User::observe(new UserObserver());
     Invitation::observe(new InvitationsObserver());
 }
Ejemplo n.º 10
0
 public function seatGuest(Request $request, $eventId, $tableId)
 {
     $guest = Guest::find(Input::get('guest_id'));
     if ($guest->table_id) {
         return $this->respondExistingRelationship('Guest is already seated at ' . $guest->table->table_name);
     }
     $table = Table::find($tableId);
     if ($table->seatGuest($guest)) {
         return $this->prepareResponse('success', $guest->getName() . ' now seated at ' . $table->table_name);
     } else {
         return $this->prepareResponse('error', $table->table_name . ' is full');
     }
 }
Ejemplo n.º 11
0
 function __construct()
 {
     parent::__construct("settings.geometry_columns_view");
 }
Ejemplo n.º 12
0
 public function updateRoles($data)
 {
     $data = (array) $data;
     $table = new Table("settings.geometry_columns_join");
     $role = (array) json_decode($this->getValueFromKey($data['_key_'], "roles"));
     $role[$data['subuser']] = $data['roles'];
     $roles['roles'] = json_encode($role);
     $roles['_key_'] = $data['_key_'];
     $res = $table->updateRecord(json_decode(json_encode($roles)), "_key_");
     if ($res['success'] == true) {
         $response['success'] = true;
         $response['message'] = "Roles updates";
     } else {
         $response['success'] = false;
         $response['message'] = $res['message'];
         $response['code'] = 403;
     }
     return $response;
 }
Ejemplo n.º 13
0
 /**
  * Get table's needle
  *
  */
 protected function getNeedle($table)
 {
     return Table::where('table_name', $table)->select('needle')->first()->needle;
 }
Ejemplo n.º 14
0
 public function crudRetrieveOneByCond($cond, &$retContainer)
 {
     return Table::retrieveOneByCond(new Users(), $cond, $retContainer);
 }
Ejemplo n.º 15
0
 /**
  * Make the table occupied
  *
  * @param $tableId
  * @return mixed
  */
 private function makeTableAvailable($tableId)
 {
     $table = Table::where('id', $tableId)->update(['status' => Table::AVAILABLE]);
     return $table;
 }
Ejemplo n.º 16
0
 public function getTableNameAttribute()
 {
     return Table::where('id', '=', $this->table_id)->first()->table_name;
 }
Ejemplo n.º 17
0
 /**
  * Delete crud
  *
  * @Get("crud/{id}/delete", as="crud.delete")
  */
 public function delete($id)
 {
     Table::destroy($id);
     Flash::success('CRUD deleted successfully.');
     return redirect()->route('index')->withInput();
 }
Ejemplo n.º 18
0
 public function deleteProject(Application $application)
 {
     Table::where(['applications' => ['$in' => [$application->_id]]])->delete();
     $application->delete();
     return $this->response->json();
 }