getAvailableDeviceTypeNames() public static method

Returns names of all available device types
public static getAvailableDeviceTypeNames ( ) : array
return array
コード例 #1
0
ファイル: GetType.php プロジェクト: piwik/piwik
 public function configureView(ViewDataTable $view)
 {
     $unknownTypeCount = 1;
     $view->requestConfig->filter_limit = $unknownTypeCount + count(DeviceParser::getAvailableDeviceTypeNames());
     $view->config->show_search = false;
     $view->config->show_exclude_low_population = false;
     $view->config->addTranslation('label', Piwik::translate("DevicesDetection_dataTableLabelTypes"));
 }
コード例 #2
0
ファイル: API.php プロジェクト: FluentDevelopment/piwik
 /**
  * Gets datatable displaying number of visits by device type (eg. desktop, smartphone, tablet)
  * @param int $idSite
  * @param string $period
  * @param string $date
  * @param bool|string $segment
  * @return DataTable
  */
 public function getType($idSite, $period, $date, $segment = false)
 {
     $dataTable = $this->getDataTable('DevicesDetection_types', $idSite, $period, $date, $segment);
     // ensure all device types are in the list
     $this->ensureDefaultRowsInTable($dataTable);
     $mapping = DeviceParserAbstract::getAvailableDeviceTypeNames();
     $dataTable->filter('AddSegmentByLabelMapping', array('deviceType', $mapping));
     $dataTable->filter('ColumnCallbackAddMetadata', array('label', 'logo', __NAMESPACE__ . '\\getDeviceTypeLogo'));
     $dataTable->filter('ColumnCallbackReplace', array('label', __NAMESPACE__ . '\\getDeviceTypeLabel'));
     return $dataTable;
 }
コード例 #3
0
 protected function getRawMetadataDeviceType()
 {
     $deviceTypeList = implode(", ", DeviceParser::getAvailableDeviceTypeNames());
     $deviceTypeLabelToCode = function ($type) use($deviceTypeList) {
         $index = array_search(strtolower(trim(urldecode($type))), DeviceParser::getAvailableDeviceTypeNames());
         if ($index === false) {
             throw new Exception("deviceType segment must be one of: {$deviceTypeList}");
         }
         return $index;
     };
     return array('DevicesDetection_DevicesDetection', 'DevicesDetection_DeviceType', 'DevicesDetection', 'getType', 'DevicesDetection_DeviceType', 'deviceType', 'log_visit.config_device_type', $deviceTypeList, $deviceTypeLabelToCode);
 }
コード例 #4
0
ファイル: DeviceType.php プロジェクト: piwik/piwik
 protected function configureSegments()
 {
     $deviceTypes = DeviceParser::getAvailableDeviceTypeNames();
     $deviceTypeList = implode(", ", $deviceTypes);
     $segment = new Segment();
     $segment->setCategory('General_Visit');
     $segment->setSegment('deviceType');
     $segment->setName('DevicesDetection_DeviceType');
     $segment->setAcceptedValues($deviceTypeList);
     $segment->setSqlFilter(function ($type) use($deviceTypeList, $deviceTypes) {
         $index = array_search(strtolower(trim(urldecode($type))), $deviceTypes);
         if ($index === false) {
             throw new Exception("deviceType segment must be one of: {$deviceTypeList}");
         }
         return $index;
     });
     $this->addSegment($segment);
 }
コード例 #5
0
 public function testGetAvailableDeviceTypeNames()
 {
     $available = DeviceParserAbstract::getAvailableDeviceTypeNames();
     $this->assertGreaterThan(5, count($available));
     $this->assertContains('desktop', $available);
 }