示例#1
0
 public function SettingWebURLPost(Request $request)
 {
     $search = $request->search;
     $replace = $request->replace;
     $layers = Layer::orderBy('orderlayer', 'asc')->get();
     $array = array();
     foreach ($layers as $key => $l) {
         $array[$key] = str_replace($search, $replace, $l->layerurl);
         DB::table('Layers')->where('id_layer', $l->id_layer)->update(['layerurl' => $array[$key]]);
     }
     return Redirect::to('settingurl');
 }
示例#2
0
 public function LayerEsriHapus($id)
 {
     $layer = Layer::find($id);
     $layer->jsonfield = null;
     $layer->save();
     return redirect('layer');
 }
示例#3
0
 /**
  * Delete icon
  * 
  * @param Layer $layer
  * @return \Illiminate\Http\JsonResponse
  */
 public function deleteIconImage(Layer $layer, $image)
 {
     $result = unlink($layer->getIconsPath() . '/' . $image);
     return response()->json(['success' => $result]);
 }
示例#4
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // Copy distributable storage folder
     if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
         shell_exec('xcopy /H /E /Y ' . public_path('storage.dist') . ' ' . public_path('storage'));
     } else {
         shell_exec('cp -R ' . public_path('storage.dist') . ' ' . public_path('storage'));
     }
     Model::unguard();
     // $this->call(UserTableSeeder::class);
     if (!DB::table('users')->count()) {
         User::create(['name' => 'Admin', 'email' => '*****@*****.**', 'password' => Hash::make('admin'), 'twitter_id' => '', 'facebook_id' => '', 'gplus_id' => '', 'avatar' => '']);
     }
     if (!DB::table('roles')->count()) {
         Role::create(['name' => 'Admin', 'content_permission' => 'NONE']);
         Role::create(['name' => 'Backoffice User', 'content_permission' => 'ROLE']);
         Role::create(['name' => 'Registered', 'content_permission' => 'NONE']);
     }
     if (!DB::table('role_user')->count()) {
         DB::table('role_user')->insert([['role_id' => 1, 'user_id' => 1]]);
     }
     if (!DB::table('permissions')->count()) {
         Permission::create(['label' => 'Backoffice', 'http' => 'GET', 'route' => 'admin']);
         Permission::create(['label' => 'Pages List', 'http' => 'GET', 'route' => 'admin/pages/list']);
         Permission::create(['label' => 'Users List', 'http' => 'GET', 'route' => 'admin/users/list']);
         Permission::create(['label' => 'Roles List', 'http' => 'GET', 'route' => 'admin/roles/list']);
         Permission::create(['label' => 'Permissions List', 'http' => 'GET', 'route' => 'admin/permissions/list']);
         Permission::create(['label' => 'Site Brand', 'http' => 'GET', 'route' => 'admin/brands/list']);
         Permission::create(['label' => 'Delete Content', 'http' => 'GET', 'route' => 'admin/contents/delete']);
         Permission::create(['label' => 'Change Content Ownership', 'http' => 'GET', 'route' => 'admin/contents/ownership']);
     }
     if (!DB::table('permission_role')->count()) {
         DB::table('permission_role')->insert([['role_id' => 3, 'permission_id' => 1, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 2, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 3, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 4, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 5, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 6, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 7, 'access' => 'DENY'], ['role_id' => 2, 'permission_id' => 8, 'access' => 'DENY']]);
     }
     if (!DB::table('brands')->count()) {
         Brand::create(['name' => 'Brand', 'slogan' => 'Brand slogan...', 'description' => 'Brand description', 'keywords' => 'keyword', 'author' => 'author', 'logo' => 'picture.png', 'active' => 1, 'css' => '', 'config' => '']);
     }
     if (!DB::table('contents')->count()) {
         Content::create(['user_id' => 1, 'lang' => 'en', 'title' => 'Demo', 'seo_slug' => 'demo', 'seo_title' => 'Demo', 'seo_description' => 'Demo', 'seo_keywords' => 'demo', 'seo_author' => 'admin', 'seo_image' => 'picture.png', 'content' => '<p>Content...<br></p>', 'publish_start' => '2015-07-01', 'role_permission' => 'NONE']);
     }
     if (!DB::table('events')->count()) {
         Event::create(['content_id' => 1, 'start' => '2015-07-1', 'end' => '2015-07-2']);
     }
     if (!DB::table('locations')->count()) {
         Location::create(['content_id' => 1, 'address' => 'Lisbon, Portugal', 'lat' => '38.7222524', 'lon' => '-9.139336599999979', 'zoom' => 5]);
     }
     if (!DB::table('pages')->count()) {
         Page::create(['name' => 'demo_notfound', 'route' => 'page/notfound', 'active' => 1]);
         Page::create(['name' => 'demo_home', 'route' => 'demo/home', 'active' => 1]);
         Page::create(['name' => 'demo_content', 'route' => '{slug}', 'active' => 1]);
         Page::create(['name' => 'demo_events', 'route' => 'demo/events', 'active' => 1]);
         Page::create(['name' => 'demo_map', 'route' => 'demo/map', 'active' => 1]);
         Page::create(['name' => 'demo_webgis', 'route' => '/', 'active' => 1]);
     }
     if (!DB::table('projections')->count()) {
         Projection::create(['srid' => '3857', 'proj4_params' => '+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext  +no_defs', 'extent' => '-20026376.39 -20048966.10 20026376.39 20048966.10']);
     }
     if (!DB::table('layers')->count()) {
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Open Street Map';
         $content->seo_slug = 'open-street-map';
         $content->role_permission = 'NONE';
         $content->save();
         Layer::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'type' => 'osm']);
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Markers';
         $content->seo_slug = 'markers';
         $content->role_permission = 'NONE';
         $content->save();
         Layer::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'type' => 'geojson', 'geojson_geomtype' => 'Point', 'geojson_attributes' => 'label', 'geojson_features' => '{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[-851576.57182518,4456806.642252369]},"properties":{"label":"Tavira"}}],"crs":{"type":"name","properties":{"name":"EPSG:3857"}}}', 'feature_info_template' => '<p>{{ item.label }}</p>', 'search' => 'label', 'ol_style_static_icon' => 'ol_style_static_icon.png', 'ol_style_static_fill_color' => '', 'ol_style_static_stroke_color' => '', 'ol_style_static_stroke_width' => '']);
         Layer::find(2)->saveGeoJSONFile();
     }
     if (!DB::table('maps')->count()) {
         $content = new Content();
         $content->user_id = 1;
         $content->lang = 'en';
         $content->title = 'Map1';
         $content->seo_slug = 'map1';
         $content->role_permission = 'NONE';
         $content->publish_start = '2015-07-01';
         $content->save();
         Map::create(['user_id' => 1, 'content_id' => $content->id, 'projection_id' => 3857, 'center' => '0 0', 'zoom' => 2]);
         // Add OSM layer
         $mapitem = new Layeritem();
         $mapitem->map_id = 1;
         $mapitem->layer_id = 1;
         $mapitem->parent_id = 0;
         $mapitem->visible = 1;
         $mapitem->baselayer = 1;
         $mapitem->displayorder = 1;
         $mapitem->save();
         // Add markers layer
         $mapitem = new Layeritem();
         $mapitem->map_id = 1;
         $mapitem->layer_id = 2;
         $mapitem->parent_id = 0;
         $mapitem->visible = 1;
         $mapitem->baselayer = 0;
         $mapitem->displayorder = 1;
         $mapitem->save();
     }
     Model::reguard();
 }
示例#5
0
 public function LayerUser()
 {
     $user = \Auth::user();
     $guest = \Auth::guest();
     $currentroleuser = $user ? $user->roles : '';
     $userid = $user ? $user->id : 0;
     $layers = Layer::join('role_layer', function ($join) {
         $join->on('Layers.id_layer', '=', 'role_layer.layer_id');
     })->where('na', '=', 'N')->where('role_layer.role_id', '=', $userid)->with('roles')->orderBy('orderlayer', 'DESC');
     /*if($guest){
     			$layers = Layer::leftjoin('role_layer',function($join) {
     	      		$join->on('Layers.id_layer', '=', 'role_layer.layer_id');
     	    	})->where('na','=','N')	
     	    	->with('roles')->orderBy('orderlayer','DESC');
     		}*/
     $sql = $layers->toSql();
     $run_layers = $layers->get();
     $array = array();
     $operationallayer = array();
     foreach ($run_layers as $klyr => $layer) {
         $optionfeature['id'] = $layer->layer;
         $optionfeature['opacity'] = $layer->option_opacity;
         $optionfeature['visible'] = $layer->option_visible;
         $optionfeature['outFields'] = ['*'];
         $optionfeature['mode'] = 1;
         $optiondynamic['id'] = $layer->layer;
         $optiondynamic['opacity'] = $layer->option_opacity;
         $optiondynamic['visible'] = $layer->option_visible;
         $optiondynamic['outFields'] = ['*'];
         $optiondynamic['imageParameters'] = '';
         $options = $layer->tipelayer == 'dynamic' ? $optiondynamic : $optionfeature;
         $operationallayer_['type'] = $layer->tipelayer;
         $operationallayer_['url'] = $layer->layerurl;
         $operationallayer_['title'] = $layer->layername;
         $operationallayer_['options'] = $options;
         $layerIds = ['layerIds' => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22]];
         $operationallayer_['identifyLayerInfos'] = $layerIds;
         $operationallayer_['roles'] = $layer->roles;
         array_push($operationallayer, $operationallayer_);
     }
     return json_encode($operationallayer);
     //return ($sql);
 }
示例#6
0
 public function postAddLayer($id, Request $request)
 {
     $project = Project::findorFail($id);
     $directory = public_path() . '/' . $project->title;
     if ($request->hasFile('audio') || $request->title == "") {
         $file = $request->file('audio');
         $file->move($directory, $file->getClientOriginalName());
         $path = $project->title . '/' . $file->getClientOriginalName();
         if (file_exists($path)) {
             $layer = new Layer();
             $layer->label = $request->label;
             $layer->path = $path;
             $layer->user_id = \Auth::user()->id;
             $layer->project_id = $project->id;
             if ($layer->save()) {
                 return \Redirect::route('view-project', $project->id)->with('message', 'New Layer is added successfully!');
             }
         }
     }
     return 'Please try again later!';
 }