From 805b61328629813aad77c2e0f935e31cb381e500 Mon Sep 17 00:00:00 2001 From: Antonio Gallo Date: Wed, 14 Dec 2011 15:59:54 +0000 Subject: added the first view files of the mobile version --- .../Application/Controllers/BaseController.php | 4 +- h-source/Application/Hooks/BeforeChecks.php | 8 ++- h-source/Application/Include/version.php | 33 ++++++++++- h-source/Application/Views/Mobile/Home/left.php | 36 +++++++++++ h-source/Application/Views/Mobile/Home/left_es.php | 33 +++++++++++ h-source/Application/Views/Mobile/Home/left_fr.php | 32 ++++++++++ h-source/Application/Views/Mobile/Home/left_it.php | 32 ++++++++++ h-source/Application/Views/Mobile/footer.php | 40 +++++++++++++ h-source/Application/Views/Mobile/header.php | 69 ++++++++++++++++++++++ h-source/Application/Views/Mobile/right.php | 21 +++++++ 10 files changed, 304 insertions(+), 4 deletions(-) create mode 100644 h-source/Application/Views/Mobile/Home/left.php create mode 100644 h-source/Application/Views/Mobile/Home/left_es.php create mode 100644 h-source/Application/Views/Mobile/Home/left_fr.php create mode 100644 h-source/Application/Views/Mobile/Home/left_it.php create mode 100644 h-source/Application/Views/Mobile/footer.php create mode 100644 h-source/Application/Views/Mobile/header.php create mode 100644 h-source/Application/Views/Mobile/right.php diff --git a/h-source/Application/Controllers/BaseController.php b/h-source/Application/Controllers/BaseController.php index 756316a..260d6dc 100644 --- a/h-source/Application/Controllers/BaseController.php +++ b/h-source/Application/Controllers/BaseController.php @@ -102,7 +102,9 @@ class BaseController extends Controller //set desktop or mobile version Version::set(); //subfolder of the Views folder where to look for view files - Params::$viewSubfolder = "Desktop"; + Params::$viewSubfolder = Version::getViewSubfolder(); + + $data['tm'] = $this->_topMenuClasses; diff --git a/h-source/Application/Hooks/BeforeChecks.php b/h-source/Application/Hooks/BeforeChecks.php index 03ee247..01ca8c5 100644 --- a/h-source/Application/Hooks/BeforeChecks.php +++ b/h-source/Application/Hooks/BeforeChecks.php @@ -13,4 +13,10 @@ if (!defined('EG')) die('Direct access not allowed!'); Params::$htmlentititiesCharset = "UTF-8"; -Params::$allowedSanitizeFunc .= ",sanitizeString,sanitizeAlphanum"; \ No newline at end of file +Params::$allowedSanitizeFunc .= ",sanitizeString,sanitizeAlphanum"; + + +if (Version::get() === 'mobile') +{ + Route::$allowed = Version::$mobileAllowed; +} \ No newline at end of file diff --git a/h-source/Application/Include/version.php b/h-source/Application/Include/version.php index 49afa96..d0e3928 100644 --- a/h-source/Application/Include/version.php +++ b/h-source/Application/Include/version.php @@ -24,11 +24,40 @@ if (!defined('EG')) die('Direct access not allowed!'); class Version { - public static function is() + public static $mobileAllowed = array( + 'home,index', + ); + + //get the subfolder of the Views folder where to look for the view files + public static function getViewSubfolder() + { + $type = self::get(); + + if ($type === 'mobile') + { + return 'Mobile'; + } + return 'Desktop'; + } + + //get the type of version: desktop or mobile + public static function get() { - return false; + if (isset($_COOKIE['version'])) + { + if (strcmp($_COOKIE['version'],'mobile') === 0) + { + return 'mobile'; + } + else if (strcmp($_COOKIE['version'],'desktop') === 0) + { + return 'desktop'; + } + } + return 'desktop'; } + //set the version public static function set() { if (isset($_GET['version'])) diff --git a/h-source/Application/Views/Mobile/Home/left.php b/h-source/Application/Views/Mobile/Home/left.php new file mode 100644 index 0000000..ea43b56 --- /dev/null +++ b/h-source/Application/Views/Mobile/Home/left.php @@ -0,0 +1,36 @@ + + +. +?> + +
+ +
+ Home +
+ + + +

it works!!

+ +

modify the file Application/Views/Home/left.php in order to change the english version of your homepage

+ +

modify the file Application/Include/languages.php in order to add new languages

+
diff --git a/h-source/Application/Views/Mobile/Home/left_es.php b/h-source/Application/Views/Mobile/Home/left_es.php new file mode 100644 index 0000000..3350599 --- /dev/null +++ b/h-source/Application/Views/Mobile/Home/left_es.php @@ -0,0 +1,33 @@ + + +. +?> + +
+ +
+ Home +
+ + + + + +
diff --git a/h-source/Application/Views/Mobile/Home/left_fr.php b/h-source/Application/Views/Mobile/Home/left_fr.php new file mode 100644 index 0000000..c69674d --- /dev/null +++ b/h-source/Application/Views/Mobile/Home/left_fr.php @@ -0,0 +1,32 @@ + + +. +?> + +
+ +
+ Home +
+ + + + +
diff --git a/h-source/Application/Views/Mobile/Home/left_it.php b/h-source/Application/Views/Mobile/Home/left_it.php new file mode 100644 index 0000000..c69674d --- /dev/null +++ b/h-source/Application/Views/Mobile/Home/left_it.php @@ -0,0 +1,32 @@ + + +. +?> + +
+ +
+ Home +
+ + + + +
diff --git a/h-source/Application/Views/Mobile/footer.php b/h-source/Application/Views/Mobile/footer.php new file mode 100644 index 0000000..c49ad4b --- /dev/null +++ b/h-source/Application/Views/Mobile/footer.php @@ -0,0 +1,40 @@ + + +. +?> + +
+ + + + + +
+ + + + + diff --git a/h-source/Application/Views/Mobile/header.php b/h-source/Application/Views/Mobile/header.php new file mode 100644 index 0000000..474ff4a --- /dev/null +++ b/h-source/Application/Views/Mobile/header.php @@ -0,0 +1,69 @@ + + + +. +?> +'inserted','update'=>'updated'); +$currPos = $querySanitized ? $this->controller."/".$this->action : 'home/index'; +?> + + + <?php echo $title;?> + + + + + + + + + + + + + + + + + + + + + +
+
+ +
diff --git a/h-source/Application/Views/Mobile/right.php b/h-source/Application/Views/Mobile/right.php new file mode 100644 index 0000000..47e9af9 --- /dev/null +++ b/h-source/Application/Views/Mobile/right.php @@ -0,0 +1,21 @@ + + +. +?> \ No newline at end of file -- cgit v1.2.3