getBrowserInfo can return type of layout (classic/phone/tablet)
This commit is contained in:
parent
709bf20deb
commit
bf9313dd87
@ -51,6 +51,7 @@ For translators:
|
||||
- Update language files.
|
||||
|
||||
For developers:
|
||||
- New: getBrowserInfo can return type of layout (classic/phone/tablet)
|
||||
- New: Add hook "searchAgendaFrom".
|
||||
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||
- New: Add country iso code on 3 chars into table of countries.
|
||||
|
||||
@ -59,7 +59,7 @@ print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("BrowserOS").'</td><td
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("Version").'</td><td colspan="2">'.$tmp['browserversion'].'</td></tr>'."\n";
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("Smartphone").' ?</td><td colspan="2">'.$tmp['phone'].'</td></tr>'."\n";
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("Layout").' (phone/tablet/classic)</td><td colspan="2">'.$tmp['layout'].'</td></tr>'."\n";
|
||||
$var=!$var;
|
||||
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("IPAddress").'</td><td colspan="2">'.$_SERVER['REMOTE_ADDR'].'</td></tr>'."\n";
|
||||
$var=!$var;
|
||||
|
||||
1248
htdocs/core/class/MobileDetect.class.php
Normal file
1248
htdocs/core/class/MobileDetect.class.php
Normal file
File diff suppressed because one or more lines are too long
@ -120,11 +120,11 @@ function getEntity($element=false, $shared=false)
|
||||
/**
|
||||
* Return information about user browser
|
||||
*
|
||||
* @return array Array of information ('browsername'=>,'browseros'=>,'phone'=>,'browserversion'=>)
|
||||
* @return array Array of information ('browsername'=>,'browseros'=>,'browserversion'=>,'layout'=>(classic|phone|tablet))
|
||||
*/
|
||||
function getBrowserInfo()
|
||||
{
|
||||
$name='unknown'; $version=''; $os='unknown'; $phone='';
|
||||
$name='unknown'; $version=''; $os='unknown'; $phone=''; $tablet='';
|
||||
|
||||
// If phone/smartphone, we set phone os name.
|
||||
if (preg_match('/android/i',$_SERVER["HTTP_USER_AGENT"])) { $os=$phone='android'; }
|
||||
@ -156,7 +156,12 @@ function getBrowserInfo()
|
||||
$firefox=0;
|
||||
if (in_array($name,array('firefox','iceweasel'))) $firefox=1;
|
||||
|
||||
return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'phone'=>$phone, 'browserfirefox'=>$firefox);
|
||||
include_once DOL_DOCUMENT_ROOT.'/core/class/MobileDetect.class.php';
|
||||
$detectmobile=new MobileDetect();
|
||||
$phone=$detectmobile->isMobile();
|
||||
$tablet=$detectmobile->isTablet();
|
||||
|
||||
return array('browsername'=>$name, 'browserversion'=>$version, 'browseros'=>$os, 'browserfirefox'=>$firefox, 'layout'=> ($tablet?'tablet':($phone?'phone':'classic')), 'phone'=>$phone, 'tablet'=>$tablet);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -209,10 +209,12 @@ register_shutdown_function('dol_shutdown');
|
||||
if (isset($_SERVER["HTTP_USER_AGENT"]))
|
||||
{
|
||||
$tmp=getBrowserInfo();
|
||||
$conf->browser->phone=$tmp['phone'];
|
||||
$conf->browser->name=$tmp['browsername'];
|
||||
$conf->browser->os=$tmp['browseros'];
|
||||
$conf->browser->version=$tmp['browserversion'];
|
||||
$conf->browser->layout=$tmp['layout'];
|
||||
$conf->browser->phone=$tmp['phone']; // deprecated, use layout
|
||||
$conf->browser->tablet=$tmp['tablet']; // deprecated, use layout
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -460,25 +460,25 @@ div.fichecenter {
|
||||
clear: both; /* This is to have div fichecenter that are true rectangles */
|
||||
}
|
||||
div.fichethirdleft {
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "float: ".$left.";\n"; } ?>
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "width: 35%;\n"; } ?>
|
||||
<?php if (! empty($conf->dol_optimize_smallscreen)) { print "padding-bottom: 6px;\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 35%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px;\n"; } ?>
|
||||
}
|
||||
div.fichetwothirdright {
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "float: ".$right.";\n"; } ?>
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "width: 65%;\n"; } ?>
|
||||
<?php if (! empty($conf->dol_optimize_smallscreen)) { print "padding-bottom: 6px\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 65%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout == 'phone') { print "padding-bottom: 6px\n"; } ?>
|
||||
}
|
||||
div.fichehalfleft {
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "float: ".$left.";\n"; } ?>
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$left.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
}
|
||||
div.fichehalfright {
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "float: ".$right.";\n"; } ?>
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "width: 50%;\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "float: ".$right.";\n"; } ?>
|
||||
<?php if ($conf->browser->layout != 'phone') { print "width: 50%;\n"; } ?>
|
||||
}
|
||||
div.ficheaddleft {
|
||||
<?php if (empty($conf->dol_optimize_smallscreen)) { print "padding-".$left.": 16px;\n"; }
|
||||
<?php if ($conf->browser->layout != 'phone') { print "padding-".$left.": 16px;\n"; }
|
||||
else print "margin-top: 10px;\n"; ?>
|
||||
}
|
||||
.containercenter {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user