public function actionIndex()
 {
     $html_model = new Html();
     //            if($link = $html_model->getLink('230','TK5001','01'))
     //                echo $link;
     //            else
     //                echo 'not found ';
     $request = Yii::$app->request;
     $ps = $request->get('ps');
     $kode = $request->get('kode');
     $kelas = $request->get('kelas');
     \Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     if (!isset($ps) || !isset($kode) || !isset($kelas)) {
         \Yii::$app->response->statusCode = 400;
         $response["error"] = 'Request tidak sesuai format';
     } else {
         $response = $html_model->getData($ps, $kode, $kelas);
     }
     return $response;
 }
예제 #2
0
 /**
  * Renders a list of radio toggle buttons.
  * @see http://getbootstrap.com/javascript/#buttons-checkbox-radio
  *
  * A radio button toggle list is like a checkbox toggle button list, except that it only allows single selection.
  * The selection of the radio buttons is taken from the value of the model attribute.
  * @param array $items the data item used to generate the radio buttons.
  * The array values are the labels, while the array keys are the corresponding radio values.
  * Note that the labels will NOT be HTML-encoded, while the values will.
  * @param array $options options (name => config) for the radio button list. The following options are specially handled:
  *
  * - unselect: string, the value that should be submitted when none of the radio buttons is selected.
  *   By setting this option, a hidden input will be generated. If you do not want any hidden input,
  *   you should explicitly set this option as null.
  * - separator: string, the HTML code that separates items.
  * - item: callable, a callback that can be used to customize the generation of the HTML code
  *   corresponding to a single item in $items. The signature of this callback must be:
  *
  * ~~~
  * function ($index, $label, $name, $checked, $value)
  * ~~~
  *
  * where $index is the zero-based index of the radio button in the whole list; $label
  * is the label for the radio button; and $name, $value and $checked represent the name,
  * value and the checked status of the radio button input.
  * @return static the field object itself
  */
 public function radioToggleList($items, $options = [])
 {
     if (!isset($options['template'])) {
         $this->template = $this->inlineRadioListTemplate;
     } else {
         $this->template = $options['template'];
         unset($options['template']);
     }
     if (!isset($options['class'])) {
         $options['class'] = 'btn-group';
     }
     $options['data-toggle'] = 'buttons';
     if (!isset($options['itemOptions'])) {
         $options['itemOptions'] = ['labelOptions' => ['class' => 'btn btn-default']];
     }
     if (!isset($options['item'])) {
         $options['item'] = function ($index, $label, $name, $checked, $value) use($options) {
             $labelOptions = ArrayHelper::getValue($options, 'itemOptions.labelOptions');
             if ($checked) {
                 Html::addCssClass($labelOptions, 'active');
             }
             return Html::radio($name, $checked, ['label' => $label, 'labelOptions' => $labelOptions, 'value' => $value]);
         };
     }
     parent::checkboxList($items, $options);
     return $this;
 }