// fix norm

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9073 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
aFolletete
2011-10-05 15:45:57 +00:00
parent 23c5f297ce
commit 9d063a0a67
2 changed files with 52 additions and 21 deletions
+26 -20
View File
@@ -27,6 +27,7 @@
/*
* TODO : move HTML code in template files
* TODO : phpDoc on two last methods: includeDatepicker() & bindDatepicker()
*/
class HelperCore
@@ -200,18 +201,18 @@ class HelperCore
return rtrim($html, ' ');
}
function bindDatepicker($id, $time)
public function bindDatepicker($id, $time = false)
{
if ($time)
echo '
var dateObj = new Date();
var hours = dateObj.getHours();
var mins = dateObj.getMinutes();
var secs = dateObj.getSeconds();
if (hours < 10) { hours = "0" + hours; }
if (mins < 10) { mins = "0" + mins; }
if (secs < 10) { secs = "0" + secs; }
var time = " "+hours+":"+mins+":"+secs;';
echo '
var dateObj = new Date();
var hours = dateObj.getHours();
var mins = dateObj.getMinutes();
var secs = dateObj.getSeconds();
if (hours < 10) { hours = "0" + hours; }
if (mins < 10) { mins = "0" + mins; }
if (secs < 10) { secs = "0" + secs; }
var time = " "+hours+":"+mins+":"+secs;';
echo '
$(function() {
@@ -223,18 +224,23 @@ class HelperCore
}
// id can be a identifier or an array of identifiers
function includeDatepicker($id, $time = false)
public function includeDatepicker($id, $time = false)
{
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>';
$iso = Db::getInstance()->getValue('SELECT iso_code FROM '._DB_PREFIX_.'lang WHERE `id_lang` = '.(int)Context::getContext()->language->id);
if ($iso != 'en')
echo '<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/datepicker/ui/i18n/ui.datepicker-'.$iso.'.js"></script>';
echo '<script type="text/javascript">';
if (is_array($id))
foreach ($id as $id2)
bindDatepicker($id2, $time);
else
bindDatepicker($id, $time);
if (!$iso)
$iso = 'en';
// TODO : change in order to use Media::addJqueryUi()
echo '
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/jquery-ui-1.8.10.custom.min.js"></script>
<script type="text/javascript" src="'.__PS_BASE_URI__.'js/jquery/datepicker/ui/i18n/ui.datepicker-'.$iso.'.js"></script>
<script type="text/javascript">';
if (is_array($id))
foreach ($id as $id2)
bindDatepicker($id2, $time);
else
bindDatepicker($id, $time);
echo '</script>';
}
}