/**
  * zeigt die Radiobuttons an
  */
 function show()
 {
     foreach ($this->OBJECTS as $text => $wert) {
         if (!$this->isHorizontal()) {
             $text = $text . "<br>";
         }
         $selected = $wert == $this->SELECTED_VALUE;
         $rdb = new Radiobutton($this->NAME, $text, $wert, $selected, true);
         $rdb->show();
     }
 }
Exemplo n.º 2
0
    function drawEpaonnistuneet($tyyppi, &$joukkue)
    {
        $tekijat =& $joukkue->epaonnisrankut;
        $this->p('Ep&auml;onnistuneet rangaistuslaukaukset');
        if (count($tekijat) > 0) {
            ?>

  <table>
    <tr>
      <th>
      <?php 
            $this->p('nro');
            ?>
      </th>

      <th>
      <?php 
            $this->p('aika');
            ?>
      </th>
      <th>
      <?php 
            $this->p('tekij&auml;');
            ?>
      </th>
      <th>
      <?php 
            $this->p('av/yv/tasa');
            ?>
      </th>
      <th>
      <?php 
            $this->p('Siirretyn rangaistuksen aikana');
            ?>
      <br>
      <?php 
            $this->p('tyhj&auml;maali');
            ?>
      </th>

    </tr>
    <?php 
            $tyypit = array('no' => $this->tm->getText('Normaali'), 'yv' => $this->tm->getText('Ylivoima'), 'av' => $this->tm->getText('Alivoima'));
            $i = 1;
            foreach ($tekijat as $k => $v) {
                print '<tr> <td>';
                print $i;
                print ' </td>  <td>';
                $cb = new Input($tyyppi . 'ertapahtumisaika' . $i, $v['tapahtumisaika'], 'text', 5);
                $cb->draw();
                print ' </td>  <td>';
                $kotim = $this->toiminto->tiedot['kotimaalit'];
                $cs = new Select($joukkue->select, $tyyppi . 'ertekija' . $i, $v['tekija']);
                $cs->draw();
                ?>
      </td>
      <td>
<?php 
                $cs = new Radiobutton($tyypit, $tyyppi . 'ertyyppi' . $i, $v['tyyppi']);
                //$cs = new Input('tyyppi'.$i,$v['tyyppi'],'text',8);
                $cs->LINEBREAK = '<br>';
                $cs->draw();
                ?>
      </td>

      <td>
<?php 
                $s = (isset($v['tyhjamaali']) and $v['tyhjamaali'] == 't');
                $cs = new Checkbox($tyyppi . "tyhjamaali{$i}", 't', 'Tyhj&auml; maali', $s);
                $cs->draw();
                ?>
<br>
<?php 
                $s = (isset($v['siirrangaikana']) and $v['siirrangaikana'] == 't');
                $cs = new Checkbox($tyyppi . "siirrangaikana{$i}", 't', 'siirretyn rangaistuksen aikana', $s);
                $cs->draw();
                ?>
      </td>
      </tr>
<?php 
                $i++;
            }
            print '</table>';
        } else {
            print '<br>';
            $this->p('Ei merkint&ouml;j&auml;.');
        }
        print '<br>';
    }
Exemplo n.º 3
0
 public function actionResult($id)
 {
     if (Yii::$app->user->can('surveyResult')) {
         $model = $this->findModel($id);
         $dataProvider = [];
         $questions = Question::getAllQuestionBySurveyId($id);
         foreach ($questions as $row) {
             $result['id'] = $row['id'];
             $result['question'] = Question::getQuestionContentByQuestionId($row['id']);
             if (TextBox::checkIsTextBoxByQuestionId($row['id'])) {
                 $result['type'] = 0;
                 $result['results'] = TextResponse::getResponsesByQuestionId($row['id']);
                 array_push($dataProvider, $result);
                 continue;
             }
             if (Checkbutton::checkIsCheckBoxByQuestionId($row['id'])) {
                 $result['type'] = 1;
                 $result['results'] = Checkbutton::getOptionsStatisticsByQuestionId($row['id']);
                 array_push($dataProvider, $result);
                 continue;
             }
             if (Radiobutton::checkIsRadioButtonByQuestionId($row['id'])) {
                 $result['type'] = 2;
                 $result['results'] = Radiobutton::getOptionsStatisticsByQuestionId($row['id']);
                 array_push($dataProvider, $result);
                 continue;
             }
         }
         return $this->render('result', ['model' => $model, 'dataProvider' => $dataProvider, 'doneCount' => SurveyHasParticipant::getDoneCountBySurveyId($id)]);
     } else {
         if (Yii::$app->user->isGuest) {
             Yii::$app->user->loginRequired();
         } else {
             throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
         }
     }
 }