function system_device_detection($debug = false)
{
    platform_launch(PLATFORM_SANDBOX_SYSTEM_VENDORS_PATH . DS . PLATFORM_VENDORS_OPENDDR . DS . 'BuilderDataSource.class.php');
    platform_launch(PLATFORM_SANDBOX_SYSTEM_VENDORS_PATH . DS . PLATFORM_VENDORS_OPENDDR . DS . 'DeviceDetection.class.php');
    $device_detection = new DeviceDetection($_SERVER['HTTP_USER_AGENT']);
    $device_options = $device_detection->getAllCapabilities();
    $device_type = 'Unknown';
    if ($device_options['all']) {
        $user_agent = detect_user_agent();
        $device_type = get_device_type();
    } else {
        $device_type = $device_options['vendor'] . ' ' . $device_options['model'];
    }
    if ($debug) {
        echo "<h2>Device Info</h2>";
        echo "<h3>User Agent: " . $user_agent . "</h3>";
        echo "<pre>";
        print_r($device_options);
        echo "</pre>";
    }
    unset($device_detection);
    return $device_type;
}
示例#2
0
文件: index.php 项目: verbazend/AWFA
        $deviceurl = new moodle_url('/theme/index.php', array('device' => $thedevice, 'sesskey' => sesskey()));
        $select = new single_button($deviceurl, $strthemeselect, 'get');

        $table->data[] = array(
            $OUTPUT->heading(ucfirst($thedevice), 3),
            $screenshotcell,
            $headingthemename . $OUTPUT->render($select) . $unsetthemebutton
        );
    }
} else {
    // Either a device has been selected of $CFG->enabledevicedetection is off so display a list
    // of themes to select.
    $heading = get_string('selecttheme', 'admin', $device);
    if (empty($device)) {
        // if $CFG->enabledevicedetection is off this will return 'default'
        $device = get_device_type();
    }

    $table->id = 'adminthemeselector';
    $table->head = array(get_string('theme'), get_string('info'));

    $themes = get_plugin_list('theme');

    foreach ($themes as $themename => $themedir) {

        // Load the theme config.
        try {
            $theme = theme_config::load($themename);
        } catch (Exception $e) {
            // Bad theme, just skip it for now.
            continue;
示例#3
0
    'redirect' => array(
        'file' => 'embedded.php',
        'regions' => array(),
        'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nocourseheaderfooter'=>true),
    ),
     // The pagelayout used for reports
    'report' => array(
        'file' => 'general.php',
        'regions' => array(),
        'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
    ),
);

// Get whether to show blocks and use appropriate pagelayout
// this is necessary for block JS errors and other block problems
$thisdevice = get_device_type();
if ($thisdevice == "default" || $thisdevice == "tablet" || optional_param('mymobile_blocks', false, PARAM_BOOL)) {
    // These are layouts with blocks
    $blocklayouts = array('course', 'incourse', 'frontpage', 'mydashboard', 'mypublic');
    foreach ($blocklayouts as $layout) {
        $THEME->layouts[$layout]['regions'] = array('myblocks');
        $THEME->layouts[$layout]['defaultregion'] = 'myblocks';
    }
}

// Sets a custom render factory to use with the theme, used when working with custom renderers.
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->csspostprocess = 'mymobile_user_settings';

// Disables CSS Optimiser for MyMobile theme.
$THEME->supportscssoptimisation = false;
 /**
  * Renders theme links for switching between default and other themes.
  *
  * @return string
  */
 protected function theme_switch_links()
 {
     $actualdevice = get_device_type();
     $currentdevice = $this->page->devicetypeinuse;
     $switched = $actualdevice != $currentdevice;
     if (!$switched && $currentdevice == 'default' && $actualdevice == 'default') {
         // The user is using the a default device and hasn't switched so don't shown the switch
         // device links.
         return '';
     }
     if ($switched) {
         $linktext = get_string('switchdevicerecommended');
         $devicetype = $actualdevice;
     } else {
         $linktext = get_string('switchdevicedefault');
         $devicetype = 'default';
     }
     $linkurl = new moodle_url('/theme/switchdevice.php', array('url' => $this->page->url, 'device' => $devicetype, 'sesskey' => sesskey()));
     $content = html_writer::start_tag('div', array('id' => 'theme_switch_link'));
     $content .= html_writer::link($linkurl, $linktext);
     $content .= html_writer::end_tag('div');
     return $content;
 }
示例#5
0
function lti_get_launch_container($lti, $toolconfig) {
    if (empty($lti->launchcontainer)) {
        $lti->launchcontainer = LTI_LAUNCH_CONTAINER_DEFAULT;
    }

    if ($lti->launchcontainer == LTI_LAUNCH_CONTAINER_DEFAULT) {
        if (isset($toolconfig['launchcontainer'])) {
            $launchcontainer = $toolconfig['launchcontainer'];
        }
    } else {
        $launchcontainer = $lti->launchcontainer;
    }

    if (empty($launchcontainer) || $launchcontainer == LTI_LAUNCH_CONTAINER_DEFAULT) {
        $launchcontainer = LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS;
    }

    $devicetype = get_device_type();

    //Scrolling within the object element doesn't work on iOS or Android
    //Opening the popup window also had some issues in testing
    //For mobile devices, always take up the entire screen to ensure the best experience
    if ($devicetype === 'mobile' || $devicetype === 'tablet' ) {
        $launchcontainer = LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW;
    }

    return $launchcontainer;
}
示例#6
0
/**
 * Returns the device the user is currently using, or if the user has chosen to switch devices
 * for the current device type the type they have switched to.
 *
 * @return string The device the user is currently using or wishes to use
 */
function get_user_device_type() {
    $device = get_device_type();
    $switched = get_user_preferences('switchdevice'.$device, false);
    if ($switched != false) {
        return $switched;
    }
    return $device;
}
 function test_get_device_type() {
     // IE8 (common pattern ~1.5% of IE7/8 users have embedded IE6 agent))
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BT Openworld BB; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Hotbar 10.2.197.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)';
     $this->assertEquals('default', get_device_type());
     // Genuine IE6
     $_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; SV1; FunWebProducts; .NET CLR 1.0.3705; Media Center PC 2.8)';
     $this->assertEquals('legacy', get_device_type());
 }
示例#8
0
    }
    //Display links to surveys
    if (count($arr_sids) > 0) {
        echo '<h3>Please choose a survey to run</h3>';
        echo '<ul>';
        foreach ($arr_sids as $s) {
            echo '<li><a href="?sid=' . $s . '">' . $s . '</a></li>';
        }
        echo '</ul>';
        exit;
    } else {
        throw new Exception('No surveys found');
    }
}
$did = get_device_id();
$device_type = get_device_type($did);
$langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en';
$config = get_config($device_type, $sid, $langCode);
//Load page generator
$page = new SC_Page_Generator($sid, FOLDER_SURVEYS);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Survey preview</title>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
</head>
示例#9
0
<?php

date_default_timezone_set('Europe/London');
require_once '../-functions.php';
require_once '../toolkit/sc_survey_flow.php';
if (session_id() == '') {
    session_start();
}
$surveyID = get_survey_id();
$deviceID = get_device_id();
$device_type = get_device_type($deviceID);
$langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en';
$config = get_config($device_type, $surveyID, $langCode);
# Load rules
if ($survey = new SC_Survey_Flow($surveyID, FOLDER_SURVEYS, $langCode)) {
    //Config
    $survey->bool_store_bwd = TRUE;
    //Process answers to questions
    if (isset($_POST['sc_page_id'])) {
        // Languages
        if (isset($_POST['q_language'])) {
            $langCode = $_POST['q_language'];
            if (!is_null($langCode) && !empty($langCode)) {
                $_SESSION['wrapper']['language'] = $langCode;
            }
        }
        $next_id = $survey->go();
    } else {
        $first_id = $survey->obj_page_generator->get_first_page_id();
        SC_Survey_Flow::reset_survey($first_id);
        throw new Exception('no page id posted');
示例#10
0
}
function get_device_type()
{
    $agent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $type = 'other';
    if (strpos($agent, 'iphone') || strpos($agent, 'ipad')) {
        $type = 'ios';
    }
    if (strpos($agent, 'android')) {
        $type = 'android';
    }
    return $type;
}
$iswx = is_weixin();
$devicetype = 'android';
if (get_device_type() == 'ios') {
    $devicetype = 'ios';
}
?>
<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<title>红圈营销</title>
	<meta http-equiv="pragram" content="no-cache">
        <meta content="user-scalable=0;" name="viewport" />
        <meta name="apple-itunes-app" content="app-id=967499300" />
	<style>
		body{
			text-align: center; 
			padding:0px; 
示例#11
0
             $target_devices[] = "/dev/{$m[1]}";
         } else {
             $target_devices[] = "/dev/{$dev}";
         }
     }
 } else {
     if (preg_match("/^(.+)\\.nop\$/", $dev, $m)) {
         $target_devices[] = "/dev/{$m[1]}";
     } else {
         $target_devices[] = "/dev/{$dev}";
     }
 }
 foreach ($target_devices as $target_device) {
     $index = array_search_ex($target_device, $config['zfs']['vdevices']['vdevice'], "device");
     if ($index !== false) {
         $type = get_device_type($target_device, $a_vdevice);
         // remove spares if any
         if ($type != "spare" && !empty($a_spares)) {
             foreach ($a_spares as $spares) {
                 if (in_array($target_device, $spares) == false) {
                     continue;
                 }
                 // ok target in the array, remove spare
                 foreach ($spares as $spare_device) {
                     if (strcmp($spare_device, $target_device) == 0) {
                         continue;
                     }
                     $s_index = array_search_ex($spare_device, $config['zfs']['vdevices']['vdevice'], "device");
                     if ($s_index !== false) {
                         $new_devices = array();
                         foreach ($config['zfs']['vdevices']['vdevice'][$s_index]['device'] as $device) {