Example #1
0
 public function getOptionsStatisticsByQuestionId($id)
 {
     return Radiobutton::find()->where(['Question_id' => $id])->select(['content', 'count'])->orderBy(['count' => SORT_DESC])->asArray()->all();
 }
Example #2
0
    }
    ?>
            <?php 
    if ($row->temp_type == 1) {
        ?>
                <?php 
        echo $form->field($row, $field)->checkboxList(\app\models\Checkbutton::getAllOptionsByQuestionId($row->id))->label($row->content);
        ?>
            <?php 
    }
    ?>
            <?php 
    if ($row->temp_type == 2) {
        ?>
                <?php 
        echo $form->field($row, $field)->radioList(\app\models\Radiobutton::getAllOptionsByQuestionId($row->id))->label($row->content);
        ?>
            <?php 
    }
    ?>
    <?php 
}
?>

    <?php 
if (Yii::$app->user->can('surveyEdit')) {
    ?>
        <p>
            <?php 
    echo Html::a('Delete', ['delete', 'id' => $model->id, 'Administrator_id' => $model->Administrator_id], ['class' => 'btn btn-danger', 'data' => ['confirm' => 'Are you sure you want to delete this item?', 'method' => 'post']]);
    ?>