예제 #1
0
 public function pokazAction()
 {
     $pool = new Ankiety();
     $question = new Pytania();
     $variants = new WariantyOdpowiedzi();
     $row = $pool->find($this->_getParam('ankieta'));
     $this->view->pool = $row;
     $this->view->body = $this->view->render('/ankieta/ankietaPokaz.php');
     $this->display();
 }
 /**
  * Wyświetlenie ankiety do wypełnienia
  */
 public function pokazAction()
 {
     $pool = new Ankiety();
     $question = new Pytania();
     $answer = new Odpowiedzi();
     $variants = new WariantyOdpowiedzi();
     $filledPool = new WypelnioneAnkiety();
     $db = $question->getAdapter();
     unset($_POST['send']);
     if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
         $data = array('id_ankieta' => $this->_getParam('ankieta'));
         $idFilledPool = $filledPool->insert($data);
         foreach ($_POST as $questionId => $answerT) {
             if (is_array($answerT)) {
                 foreach ($answerT as $answerId => $value) {
                     $data = array('id_wypelniona_ankieta' => $idFilledPool, 'id_pytanie' => $questionId, 'odpowiedz' => $answerId);
                     $id = $answer->insert($data);
                 }
             } else {
                 $data = array('id_wypelniona_ankieta' => $idFilledPool, 'id_pytanie' => $questionId, 'odpowiedz' => $answerT);
                 $id = $answer->insert($data);
             }
             echo '<br>';
         }
     }
     $this->view->pool = $pool->find($this->_getParam('ankieta'));
     $temp = $question->findAllWithAnkietaId($this->_getParam('ankieta'));
     $var = array();
     foreach ($temp as $row) {
         $where = $db->quoteInto('id_pytanie = ?', $row->idPytanie);
         $order = 'kolejnosc';
         $var[$row->idPytanie] = $variants->fetchAll($where, $order);
     }
     $this->view->questions = $temp;
     $this->view->variants = $var;
     $this->view->message = 'Dziękujemy za wypełnienie ankiety';
     $this->display();
 }
 /**
  * Wy�wietla warianty odpowiedzi do danego pytania
  */
 public function odpowiedziAction()
 {
     $pool = new Ankiety();
     $question = new Pytania();
     $variants = new WariantyOdpowiedzi();
     $db = $question->getAdapter();
     $this->view->poolId = $this->_getParam('ankieta');
     $this->view->questionId = $this->_getParam('pytanie');
     $this->view->questionsVariants = array('jednokrotne', 'wielokrotne', 'otwarte');
     $this->view->pool = $pool->find($this->_getParam('ankieta'));
     $this->view->question = $question->find($this->_getParam('pytanie'));
     $where = $db->quoteInto('id_pytanie = ?', $this->_getParam('pytanie'));
     $order = 'kolejnosc';
     $this->view->variants = $variants->fetchAll($where, $order);
     $this->view->body = $this->view->render('/ankieter/ankieterOdpowiedzi.php');
     $this->display();
 }
예제 #4
0
 /**
  * Tworzony jest w locie plik exela i wysyłany jest odpowiedni nagłówek (header)
  * do przeglądarki internetowej tak że pojawia się okienko dialogowe (ie,opera, itd)
  * z zapytaniem co chcemy zrobić danym plikiem (otworzyć, zapisać)
  * 
  * Akcja dla	:http://raport/export
  * i			:http://raport/export/ankieta/#id
  */
 public function exportAction()
 {
     $post = new Zend_Filter_Input($_POST);
     $poll = new Ankiety();
     $db = $poll->getAdapter();
     $pollId = $this->_getParam('ankieta');
     if (empty($pollId)) {
         $pollId = $post->getInt('ankieta_id');
     }
     header("Content-Type: application/vnd.ms-excel");
     header("Content-Disposition: attachment; filename=ank_{$pollId}.xls");
     header("Pragma: no-cache");
     header("Expires: 0");
     echo $this->view->render('/raport/raportExport.php');
     echo plCharset($this->tabelarycznyAction($excel = 1, $id_ankieta = $pollId), UTF8_TO_ISO88592);
 }