Example #1
0
/**
 * Returns a list of the device types supporting by Moodle
 *
 * @deprecated since 2.6
 * @param boolean $incusertypes includes types specified using the devicedetectregex admin setting
 * @return array $types
 */
function get_device_type_list($incusertypes = true)
{
    debugging('get_device_type_list has been deprecated, please update your code to use core_useragent instead.', DEBUG_DEVELOPER);
    return core_useragent::get_device_type_list($incusertypes);
}
Example #2
0
    }
}
// Otherwise, show either a list of devices, or is enabledevicedetection set to no or a
// device is specified show a list of themes.
$table = new html_table();
$table->data = array();
$heading = '';
if (!empty($CFG->enabledevicedetection) && empty($device)) {
    $heading = get_string('selectdevice', 'admin');
    // Display a list of devices that a user can select a theme for.
    $strthemenotselected = get_string('themenoselected', 'admin');
    $strthemeselect = get_string('themeselect', 'admin');
    // Display the device selection screen.
    $table->id = 'admindeviceselector';
    $table->head = array(get_string('devicetype', 'admin'), get_string('currenttheme', 'admin'), get_string('info'));
    $devices = core_useragent::get_device_type_list();
    foreach ($devices as $thedevice) {
        $headingthemename = '';
        // To output the picked theme name when needed.
        $themename = core_useragent::get_device_type_theme($thedevice);
        if (!$themename && $thedevice == 'default') {
            $themename = theme_config::DEFAULT_THEME;
        }
        $themelocked = theme_is_device_locked($thedevice);
        $screenshotcell = $strthemenotselected;
        $unsetthemebutton = '';
        if ($themename) {
            // Check the theme exists.
            $themename = clean_param($themename, PARAM_THEME);
            if (empty($themename)) {
                // Likely the theme has been deleted.
Example #3
0
 public function execute()
 {
     global $DB, $CFG;
     //some variables you may want to use
     //$this->cwd - the directory where moosh command was executed
     //$this->mooshDir - moosh installation directory
     //$this->expandedOptions - commandline provided options, merged with defaults
     //$this->topDir - top Moodle directory
     //$this->arguments[0] - first argument passed
     //$options = $this->expandedOptions;
     //get curse themes
     if ($CFG->allowcoursethemes) {
         echo "Course theme overrides enabled\n";
     } else {
         echo "Course theme overrides disabled\n";
     }
     $results = $DB->get_records_sql("SELECT theme, COUNT(*) AS n  FROM {course} WHERE theme <> '' GROUP BY theme");
     if ($results) {
         echo "name\ttimes used\n";
         foreach ($results as $result) {
             echo $result->theme . "\t" . $result->n . "\n";
         }
     } else {
         echo "No theme overrides on the course level\n";
     }
     echo "\n";
     //get category themes
     if ($CFG->allowcategorythemes) {
         echo "Category theme overrides enabled\n";
     } else {
         echo "Category theme overrides disabled\n";
     }
     $results = $DB->get_records_sql("SELECT theme, COUNT(*) AS n  FROM {course_categories} WHERE theme <> '' GROUP BY theme");
     if ($results) {
         echo "name\ttimes used\n";
         foreach ($results as $result) {
             echo $result->theme . "\t" . $result->n . "\n";
         }
     } else {
         echo "No theme overrides on the category level\n";
     }
     echo "\n";
     //get user themes
     if ($CFG->allowcategorythemes) {
         echo "User theme overrides enabled\n";
     } else {
         echo "User theme overrides disabled\n";
     }
     $results = $DB->get_records_sql("SELECT theme, COUNT(*) AS n FROM {user} WHERE theme <> '' GROUP BY theme");
     if ($results) {
         echo "name\ttimes used\n";
         foreach ($results as $result) {
             echo $result->theme . "\t" . $result->n . "\n";
         }
     } else {
         echo "No theme overrides on the user level\n";
     }
     //site themes
     $devices = \core_useragent::get_device_type_list();
     echo "\nSite themes:\n";
     foreach ($devices as $device) {
         echo "{$device}: ";
         $themename = \core_useragent::get_device_type_cfg_var_name($device);
         if (isset($CFG->{$themename})) {
             echo $CFG->{$themename} . "\n";
         } else {
             echo "<not set>\n";
         }
     }
 }