i want to develop a system in fuel cms in which i will have a form having a lot of fields in admin ,will add the values in the form and save in database ....it will have lat and long which will be automaticall shown or added to the their relevant fields when admin enters the location name...then save it in database ,will have save edit view etc and then on front end i want to show maps based on these records .I am new totally in fuel and codeignitor .i have read many tutorials but not succeeded enough ,in articles and authors module there are form fields but how they are created and saved in db no info is there a new user cant easily understand it..so please help me in doing all this........thanks in advance
Comments
'user_guide',
'flash_news',
'locations',
);
$config['dashboards'] = array('flash_news','locations');
Unable to locate the file: location_model.php
Exception: Class property locations does not exist in ..............www\new\fuel\modules\fuel\libraries\Fuel.php but i have put Fuel_locations in libraries where its giving the error and no map on front end and no listing etc
And it sounds like you add the "locations" module to the $config['modules_allowed'] and installed the database tables.
You should remove the lines from your my_fuel_module files that you added because those are automatically handled in the fuel/modules/locations/config/locations_fuel_modules.php file.
Those steps should be all you need to get that module to work. Does it still not work after you remove those lines in your my_fuel_modules file? And if so what URI are you seeing the error and what is the error?
<?php fuel_set_var('page_title', 'Map: My Website'); ?>
My Website
A long, long, time ago, in a galaxy far, far away...
Markers will show on the bottom 2 zoom levels even though the markers would normally cluster.
#map { height: 400px; }
<?php
$result = mysql_query("SELECT city,latitude,longitude FROM locations");
while($row = mysql_fetch_array($result)){
$data[] = array(
$row['latitude'],
$row['longitude'],
$row['city']
);
}
// print_r($data);
//$num_rows = mysql_num_rows($result);
// echo "$num_rows Rows\n";
?>
//onload(initmap(););
//alert('testing');
var tiles = L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
maxZoom: 18,
attribution: '© OpenStreetMap contributors, Points © 2012 LINZ'
}),
latlng = L.latLng(33.6667, 73.1667);
var map = L.map('map', {center: latlng, zoom: 4, layers: [tiles]});
var test = <?php echo json_encode($data); ?>;
//alert(test);
//alert(addressPoints);
var markers = L.markerClusterGroup({ disableClusteringAtZoom: 17 });
for (var i = 0; i < test.length; i++) {
var a = test[i];
var title = a[2];
var marker = L.marker(L.latLng(a[0], a[1]), {
title: title });
marker.bindPopup(title);
markers.addLayer(marker);
}
map.addLayer(markers);
and i am successful
now i want to add something more in the admin form
1-want to remove state from form
2-add location field in which by typing the location name, it populate the lat and longt automatically and then i can save it
3-want to add this form to be access from frontend by any user so he can add his location and remaining all details but after adding it should be un published bydefault in admin,,thats is admin have to publish it
4-i am doing clustring in maps and it will have round about 1 million records specific to the locations of only one country ...clustering will be based on provinces and then cities of province
i need your guide lines in this regard....i have made the base now and need your support in this regard i love the fuel cms.......its great
i am sorry if you don't get my English
i am very greatful to your help
http://docs.getfuelcms.com/modules/simple
http://docs.getfuelcms.com/modules/tutorial
Basically, it looks at the table's fields and automatically creates the form. There is an associated model found at fuel/modules/locations/models/locations_model.php which has a "form_fields" method. This returns an array of Form_builder parameters:
http://docs.getfuelcms.com/libraries/form_builder
Form_builder is used to generate the forms in the admin. To remove certain fields, you can either remove the columns in the locations database table or do something like the following in the forms_fields method which will remove them from the form:
... unset($fields['city']); return $fields; ...
function on_before_save($values)
{
$CI =& get_instance();
$CI->load->helper('google');
if (!empty($values['address']))
{
$address = self::full_address($values);
$geo = google_geolocate($values, 'location');
if (!empty($geo['latitude']) AND empty($values['latitude']))
{
$values['latitude'] = $geo['latitude'];
}
if (!empty($geo['latitude']) AND empty($values['longitude']))
{
$values['longitude'] = $geo['longitude'];
}
}
return $values;
}
but its not populating lat and longt ....any help plz???
@gui123, from what i see, this function is actually populating datas before saving to database by getting geolocation using $geo = google_geolocate($values, 'location');
Maybe you can do a print_r($geo); and print_r($values); exit; before return $values to see which part causing the missing lat and long.
[latitude] => [longitude] => [published] => yes ) .It means the lat and longt fields have nothing if i dont enter values ...and when i enter values it shows that lat and longt...That means i was wrong its not doing geo coding...
it means the the $geo = google_geolocate($values, 'location'); is not working ( whch actually will return you the latitude and longtitude )
Maybe you can double check with print_r($geo);exit;
i suspect there will be another $values['location'] or $values['address'] need to have values. check if there are such keys in the $values array and any values associate with them, google_geolocate($values, 'location') will most probably fail too if none of them exist.
http://maps.googleapis.com/maps/api/geocode/json?address=".$address."&sensor=false