Blame view

common/modules/rubrication/helpers/RubricationHelper.php 1.14 KB
a8370482   Alexander Karnovsky   init project
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  <?php
  
  namespace common\modules\rubrication\helpers;
  use Yii;
  use yii\helpers\Html;
  
  class RubricationHelper {
      public static $types;
      /**
       * @inheritdoc
       * Returns labels of appropriate main-statuses
       * @return array.
       */
      static public function getStatusLabels() {
          return [
              0 => Yii::t('order', 'Invisible'),
              1 => Yii::t('order', 'Active'),
          ];
      }
  
      /**
       * @inheritdoc
       * Returns sort-interval of appropriate options and others
       * @return array.
       */
      static public function SortArray($low = 0, $high = 100) {
          return range($low, $high);
      }
  
      static public function OptionTypes() {
          if (!is_null(self::$types)) {
              return self::$types;
          }
  
          $module = \Yii::$app->getModule('rubrication');
  
          if (!is_array($module->types))
              return [];
  
          return $module->types;
  
      }
5aa7418e   Karnovsky A   Base-product#3 fu...
43
44
45
46
47
48
49
50
  
      public function checkboxList($items, $options = [])
      {
          $this->adjustLabelFor($options);
          $this->parts['{input}'] = Html::activeCheckboxList($this->model, $this->attribute, $items, $options);
  
          return $this;
      }
a8370482   Alexander Karnovsky   init project
51
  }