<?
function panel_poll_question_edit($question_id)
{ $rec_tiket=POLL()->get_tiket_by_id($question_id) ;
  if (!$rec_tiket['pkey']) { echo 'Передан некорректный ID вопроса' ; return ; }

  $arr[]='Вопрос № '.$rec_tiket['indx'] ;
  $h1=implode(' / ',$arr) ;
  $recs_answers=poll()->get_answers_by_question_id($rec_tiket['pkey']) ;

  ?><h1><?echo $h1?></h1>
  <div id="panel_filter"><form id="sky-form" class="sky-form">
         <div class="row">
             <section class="col col-9">
                 <label>Вопрос:</label>
                 <label class="input"><input type="text" name="question[obj_name]" no_autocomplete value="<?echo htmlspecialchars($rec_tiket['obj_name'])?>"></label>
             </section>
             <section class="col col-3">
                 <label>Время для ответа (секунды):</label>
                 <label class="input"><input type="text" class="questionTimeout" name="question[timeout]" value="<?echo $rec_tiket['timeout']?>"></label>
             </section>
         </div>
         <br>
         <h3>Варианты ответов:</h3>
         <table class="basic fz_small full auto left" style="text-align:left;">
              <tr><th style="width:5%;">№ ответа</th>
                  <th style="width:5%;">Правильный ответ</th>
                  <th>Текст ответа</th>
              </tr>
          <?if (_sizeof($recs_answers)) foreach($recs_answers as $rec_answer){?>
           <tr>
               <td><label class="input"><input type="text" style="width:50px;" name="answer[<?echo $rec_answer['pkey']?>][indx]" no_autocomplete value="<?echo $rec_answer['indx']?>"></label></td>
               <td style="width:5%;"><label class="checkbox">
                       <input type="hidden" name="answer[<?echo $rec_answer['pkey']?>][status]" value="0">
                       <input type="checkbox" name="answer[<?echo $rec_answer['pkey']?>][status]" value="1" <?if ($rec_answer['status']) echo 'checked'?>><i></i> Да
                   </label>
               </td>
               <td>
                  <label class="textarea"><textarea name="answer[<?echo $rec_answer['pkey']?>][obj_name]" no_autocomplete><?echo htmlspecialchars($rec_answer['obj_name'])?></textarea></label>
               </td>
          </tr>
          <?}?></table>
       <br>
       <div id="panel_buttons">
            <input type="submit" class="button v2" cmd="poll/tiket_save" tiket_id="<?echo $rec_tiket['pkey']?>" value="Сохранить измемения" validate="form">
       </div>
       </form>
       </div>
       <script type="text/javascript">
           $j(document).ready(function() {
               $j('input.questionTimeout').mask('000');
           }) ;
       </script>
       <?
       //damp_array($recs_contents) ;
}

?>
