It works like so:
I've created a views style plugin, that outputs the views result nodes as layar compatible JSON hotspots (you map which fields go to which layar field in the style settings).
It creates a views filter of "Filter out nodes not within the layar requests proximity filter", this filter uses the location information on nodes (from the location module) to decide which nodes to filter out.
And it also creates a content type of "layar" which is a content type that has a listbox of the all the view displays in the drupal site. The user can create a layar and select which views displays will be used in the layar response. When the content item of layar is viewed it displays a link at the top showing the user what link to use in the layar interface.
The module is complete and working, there are some things i would like to work on in the future such as:
1. Live preview does not work correctly, at the moment i just output text telling the developer to test the view within layars testbed.
2. I do not support altitude as the location module does not include altitude information (although it may be possible through an extension module).
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | layar.tar_.gz | 11.39 KB | callum |
| #10 | layar.tar_.gz | 12.05 KB | callum |
| #8 | layar.tar_.gz | 10.75 KB | callum |
| #7 | layar.tar_.gz | 10.75 KB | callum |
| #1 | layar.tar_.gz | 10.76 KB | callum |
Comments
Comment #1
callum commentedThe module so far. Capable of building a basic layar application, features like OAUTH and altitude .etc still to come.
I've written a small step by step guide in the README.txt that produces a very basic layar application from a base drupal installation.
Comment #2
avpadernoHello, and thanks for applying for a CVS account. I am adding the review tags, and some volunteers will review the code, pointing out what it needs to be changed.
What do you mean by ?
Comment #3
callum commentedHotspots are objects that the layar app places in it's 3d map. They just contain some location information and some meta information like atitle, description, image .etc The view style plugin takes the node results from a view and encodes them into hotspot objects.
To better explain how the module fits in with layar, The flow of the layar app goes like this:
1. The mobile app loads a publishers "layer" (that is set up on the layar website) and sends it's current location to the layar server. Which then makes a request to the "POI" (points of interest) url defined in the layer settings on the layar website. This URL is supplied by my module (http://img687.imageshack.us/img687/5167/screenshotmylayartestsi.png).
2. When recieving the request the module takes the nid of the layar content item in the url and loads it. All the views that were selected in the listbox in the node are executed to make an array of hotspots (http://img697.imageshack.us/img697/5167/screenshotmylayartestsi.png). I provide views style plugin to make hotspot objects from the result nodes and a filter to remove results that were not within the requests range.
3. Once the views have been executed. All the hotspots are packaged up into a layar response and returned to the layar servers.
4. Which is sent to the client phone and displayed in the 3d augmented reality map.
The benefit of using views to build the hotspots is that you don't need to modify the current dataset, in the layar style plugin settings you simply map what each field in the hotspot object maps to what field in the node. here's a screenshot of the mapping interface http://img806.imageshack.us/img806/9051/screenshoteditviewlayar.png
if your unfamiliar with layar you should check it out at http://www.layar.com/ and to test it apply for an account at http://publishing.layar.com. Well worth a look if you own a iphone or android smartphone.
Comment #4
avpadernoThank you for your reply.
Comment #5
avpadernoWhat is the purpose of calling
ob_start(), andob_end_clean()?There is a Drupal function that can be called to load files containing PHP code.
The code should use
t()-placeholders, and generate URLs usingurl().l()should never be used togethert(), as reported in the documentation fort().json_encode()is only defined in PHP5, but Drupal 6 is compatible with PHP4. If the module require a function present in PHP5, then it should declare its dependency from PHP5. The function is only found on PHP 5.2.0 or higher; for other versions of PHP, the module should check if the function is present. There is then a Drupal function that can be used instead ofjson_encode().filter_input(), which is present only on versions of PHP higher or equal to 5.2.0.Comment #6
callum commentedAwesome, just saw your message. Just about to leave work for home though! I should have you changes sorted by tomorrow afternoon.
Cheers.
Cal
Comment #7
callum commentedI've made some changes.
1. I know load the definition as a file. Im not sure which function you said could load a file containing php code, but i've used file_get_contents() instead of buffers.
2.
Everything is now done in the t() function:
3. Changed the php requirement to 5.2 until i get round to using the old libs.
4. changed the php requirement to 5.2 until i get round to using the old libs.
Comment #8
callum commentedSorry, made a mistake, that was a slightly old tar of the module, here is the the latest (the only difference is one defines php 5.2 the other doesn't).
Comment #9
avpadernomodule_load_include().layar_getpointsofinterest()should be renamedlayar_get_points_of_interest(), orlayar_points_of_interest().Where is the function
earth_distance_sql()defined?Strings used in the user interface should be translated.
It's square meters, not meters squared.
Comment #10
callum commented1. Done.
2. Done.
3. Done.
4. That's defined in the location_search module which comes bundled with location. I've added adjusted the methods doxygen comment to include a @see stating where it is from.
5. Done.
6. I've gone through and i believe to have done them. And i've added the doxygen comments to all of my functions and methods and file statements to my files. I've also installed the coder module and and done a scan of my module and it comes up with no issues under the most detailed mode (i'm aware this doesn't get everything). The only thing that may be an issue is the naming of my views classes, the naming conventions used in the views api documentation and the drupal coding standard document is different (views uses underscores, drupal coding standards camelCase). I've left them as underscores.
7. Done.
Comment #11
avpadernoComment #12
avpadernoStrings used in the user interface are translated.
Comment #13
callum commentedTitles of form objects are now enclosed in t() tags.
Comment #14
avpadernoComment #15
avpadernoThank you for your contribution! I am going to update your account.
These are some recommended readings to help with excellent maintainership:
You can find more contributors chatting on the IRC #drupal-contribute channel. So, come hang out and stay involved.
Thank you, also, for your patience with the review process.
Anyone is welcome to participate in the review process. Please consider reviewing other projects that are pending review. I encourage you to learn more about that process and join the group of reviewers.
I thank all the dedicated reviewers as well.
Comment #18
avpaderno