コード例 #1
0
ファイル: class.php プロジェクト: DarneoStudio/bitrix
 protected function obtainDataLocationTypes(&$cachedData)
 {
     $types = Location\Admin\TypeHelper::getTypes(LANGUAGE_ID);
     $cachedData['TYPES'] = array();
     foreach ($types as $type) {
         $type['NAME'] = $type['NAME_CURRENT'];
         unset($type['NAME_CURRENT']);
         $cachedData['TYPES'][$type['ID']] = $type;
     }
 }
コード例 #2
0
 /**
  * @deprecated
  * 
  * Use TypeHelper::getTypes() instead
  */
 public static function getTypeList()
 {
     static $types;
     if ($types == null) {
         $types = array();
         $typesWithNames = Location\Admin\TypeHelper::getTypes();
         foreach ($typesWithNames as $type) {
             $types[intval($type['ID'])] = $type['NAME_CURRENT'];
         }
     }
     return $types;
 }
コード例 #3
0
ファイル: importprocess.php プロジェクト: DarneoStudio/bitrix
 public function getStatistics($type = 'TOTAL')
 {
     if (empty($this->stat)) {
         $types = \Bitrix\Sale\Location\Admin\TypeHelper::getTypes(array('LANGUAGE_ID' => $this->getLanguageId()));
         $res = Location\LocationTable::getList(array('select' => array('CNT', 'TCODE' => 'TYPE.CODE'), 'group' => array('TYPE_ID')));
         $total = 0;
         $stat = array();
         while ($item = $res->fetch()) {
             $total += intval($item['CNT']);
             $stat[$item['TCODE']] = $item['CNT'];
         }
         foreach ($types as $code => $data) {
             $this->stat[$code] = array('NAME' => $data['NAME_CURRENT'], 'CODE' => $code, 'CNT' => isset($stat[$code]) ? intval($stat[$code]) : 0);
         }
         $this->stat['TOTAL'] = array('CNT' => $total, 'CODE' => 'TOTAL');
         $res = Location\GroupTable::getList(array('runtime' => array('CNT' => array('data_type' => 'integer', 'expression' => array('COUNT(*)'))), 'select' => array('CNT')))->fetch();
         $this->stat['GROUPS'] = array('CNT' => intval($res['CNT']), 'CODE' => 'GROUPS');
     }
     return intval($this->stat[$type]['CNT']);
 }