Permalink
Browse files

imported pristine mobile vendor sources

  • Loading branch information...
mjollnir committed Feb 26, 2011
0 parents commit f75f2158f01cc570ef7be43db39c5185f1977bbd
Showing with 4,712 additions and 0 deletions.
  1. +12 −0 config/mobile.php
  2. +24 −0 controllers/m.php
  3. +157 −0 controllers/mobile.php
  4. +351 −0 controllers/mobile/reports.php
  5. +29 −0 helpers/mobile_geocoder.php
  6. +94 −0 hooks/mobile.php
  7. +179 −0 i18n/en_US/mobile_report.php
  8. +2,563 −0 libraries/GoogleMapAPI.php
  9. +25 −0 readme.txt
  10. +70 −0 views/css/jquery.treeview.css
  11. +348 −0 views/css/styles.css
  12. BIN views/images/arrow-down.gif
  13. BIN views/images/arrow-up.gif
  14. BIN views/images/file.gif
  15. BIN views/images/folder-closed.gif
  16. BIN views/images/folder.gif
  17. BIN views/images/minus.gif
  18. BIN views/images/plus.gif
  19. BIN views/images/submit-incident.jpg
  20. BIN views/images/treeview-black-line.gif
  21. BIN views/images/treeview-black.gif
  22. BIN views/images/treeview-default-line.gif
  23. BIN views/images/treeview-default.gif
  24. BIN views/images/treeview-famfamfam-line.gif
  25. BIN views/images/treeview-famfamfam.gif
  26. BIN views/images/treeview-gray-line.gif
  27. BIN views/images/treeview-gray.gif
  28. BIN views/images/treeview-red-line.gif
  29. BIN views/images/treeview-red.gif
  30. +145 −0 views/js/expand.js
  31. +19 −0 views/js/jquery.js
  32. +251 −0 views/js/jquery.treeview.js
  33. +8 −0 views/mobile/footer.php
  34. +41 −0 views/mobile/header.php
  35. +3 −0 views/mobile/layout.php
  36. +74 −0 views/mobile/main.php
  37. +40 −0 views/mobile/reports.php
  38. +110 −0 views/mobile/reports_submit.php
  39. +27 −0 views/mobile/reports_submit_js.php
  40. +40 −0 views/mobile/reports_view.php
  41. +18 −0 views/mobile/reports_view_js.php
  42. +84 −0 views/pagination/mobile.php
@@ -0,0 +1,12 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+
+/**
+* MOBILE CONFIGURATION
+*/
+
+/**
+ * Set single marker radius
+ * Values from 1 to 10
+ * Default: 4
+ */
+$config['items_per_page'] = "10";
@@ -0,0 +1,24 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+/**
+ * Mobile Controller
+ * Redirects to website.com/mobile
+ *
+ * PHP version 5
+ * LICENSE: This source file is subject to LGPL license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.gnu.org/copyleft/lesser.html
+ * @author Ushahidi Team <team@ushahidi.com>
+ * @package Ushahidi - http://source.ushahididev.com
+ * @module M Controller
+ * @copyright Ushahidi - http://www.ushahidi.com
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
+*
+*/
+
+class M_Controller extends Controller {
+
+ public function __construct()
+ {
+ url::redirect("mobile");
+ }
+}
@@ -0,0 +1,157 @@
+<?php defined('SYSPATH') or die('No direct script access.');
+/**
+ * Mobile Controller
+ *
+ * PHP version 5
+ * LICENSE: This source file is subject to LGPL license
+ * that is available through the world-wide-web at the following URI:
+ * http://www.gnu.org/copyleft/lesser.html
+ * @author Ushahidi Team <team@ushahidi.com>
+ * @package Ushahidi - http://source.ushahididev.com
+ * @module Mobile Controller
+ * @copyright Ushahidi - http://www.ushahidi.com
+ * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License (LGPL)
+*
+*/
+
+class Mobile_Controller extends Template_Controller {
+
+ public $auto_render = TRUE;
+ public $mobile = TRUE;
+
+ // Cacheable Controller
+ public $is_cachable = TRUE;
+
+ // Main template
+ public $template = 'mobile/layout';
+
+ // Table Prefix
+ protected $table_prefix;
+
+ public function __construct()
+ {
+ parent::__construct();
+
+ // Set Table Prefix
+ $this->table_prefix = Kohana::config('database.default.table_prefix');
+
+ // Load Header & Footer
+ $this->template->header = new View('mobile/header');
+ $this->template->footer = new View('mobile/footer');
+
+ $this->template->header->site_name = Kohana::config('settings.site_name');
+ $this->template->header->site_tagline = Kohana::config('settings.site_tagline');
+
+ plugin::add_javascript('mobile/views/js/jquery');
+ plugin::add_javascript('mobile/views/js/jquery.treeview');
+ plugin::add_javascript('mobile/views/js/expand');
+ plugin::add_stylesheet('mobile/views/css/styles');
+ plugin::add_stylesheet('mobile/views/css/jquery.treeview');
+
+ $this->template->header->show_map = FALSE;
+ $this->template->header->js = "";
+ $this->template->header->breadcrumbs = "";
+
+ // Google Analytics
+ $google_analytics = Kohana::config('settings.google_analytics');
+ $this->template->footer->google_analytics = $this->_google_analytics($google_analytics);
+ }
+
+ public function index()
+ {
+ $this->template->content = new View('mobile/main');
+
+ // Get 10 Most Recent Reports
+ $this->template->content->incidents = ORM::factory('incident')
+ ->where('incident_active', '1')
+ ->limit('10')
+ ->orderby('incident_date', 'desc')
+ ->with('location')
+ ->find_all();
+
+ // Get all active top level categories
+ $parent_categories = array();
+ foreach (ORM::factory('category')
+ ->where('category_visible', '1')
+ ->where('parent_id', '0')
+ ->orderby('category_title')
+ ->find_all() as $category)
+ {
+ // Get The Children
+ $children = array();
+ foreach ($category->children as $child)
+ {
+ $children[$child->id] = array(
+ $child->category_title,
+ $child->category_color,
+ $child->category_image,
+ $this->_category_count($child->id)
+ );
+ }
+
+ // Put it all together
+ $parent_categories[$category->id] = array(
+ $category->category_title,
+ $category->category_color,
+ $category->category_image,
+ $this->_category_count($category->id),
+ $children
+ );
+
+ if ($category->category_trusted)
+ { // Get Trusted Category Count
+ $trusted = ORM::factory("incident")
+ ->join("incident_category","incident.id","incident_category.incident_id")
+ ->where("category_id",$category->id);
+ if ( ! $trusted->count_all())
+ {
+ unset($parent_categories[$category->id]);
+ }
+ }
+ }
+ $this->template->content->categories = $parent_categories;
+
+ // Get RSS News Feeds
+ $this->template->content->feeds = ORM::factory('feed_item')
+ ->limit('10')
+ ->orderby('item_date', 'desc')
+ ->find_all();
+ }
+
+ private function _category_count($category_id = false)
+ {
+ if ($category_id)
+ {
+ return ORM::factory('incident_category')
+ ->join('incident', 'incident_category.incident_id', 'incident.id')
+ ->where('category_id', $category_id)
+ ->where('incident_active', '1')
+ ->count_all();
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ /*
+ * Google Analytics
+ * @param text mixed Input google analytics web property ID.
+ * @return mixed Return google analytics HTML code.
+ */
+ private function _google_analytics($google_analytics = false)
+ {
+ $html = "";
+ if (!empty($google_analytics)) {
+ $html = "<script type=\"text/javascript\">
+ var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");
+ document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));
+ </script>
+ <script type=\"text/javascript\">
+ var pageTracker = _gat._getTracker(\"" . $google_analytics . "\");
+ pageTracker._trackPageview();
+ </script>";
+ }
+ return $html;
+ }
+}
Oops, something went wrong.

0 comments on commit f75f215

Please sign in to comment.