Hi there, I've been playing around with my Xmas present HP TouchPad tablet...
From the tablet I can access my desktop's localhost's test moodle sites. I got stuck in the Themes settings / Device detection regular expressions section, as I had no idea what kind of regular expression to enter for my tablet. Had to get into moodle/lib/moodlelib.php to find out that detection was based - as expected - on
$useragent = $_SERVER['HTTP_USER_AGENT'].
I then added 1 line and modified 1 line in moodle/admin/settings.php:
$useragent = $_SERVER['HTTP_USER_AGENT'];
$temp->add(new admin_setting_devicedetectregex('devicedetectregex', get_string('devicedetectregex', 'admin'), 'Your browser/device is: '.$useragent.' : '.get_string('devicedetectregex_desc', 'admin'), ''));
... which displayed the full contents of my HP TouchPad's HTTP_USER_AGENT (see attached screenshot). And I could enter the following, which worked as expected on my TouchPad
Device detection regular expressions | Regular expression | Return value |
/hp-tablet/ | tablet | |
Of course, this is only useful to admins who are displaying their moodle site on a mobile device that they wish to detect. It does not answer the problem of their users/students who will be using their site on a mobile device which is not automatically detected by the moodle core regular expressions. But it's better than nothing.
Anyhow, I suggest to Moodle HQ to add "hp-tablet" to the current $tabletregex string in appearance.php.
Joseph
PS.- I found this site useful for detection of mobile devices: Detect a mobile device with PHP in 547 bytes