public function _index($url) { new Protect(); if (!empty($url[0])) { if (Question::exists($url[0])) { if ($url[1] === 'answer') { if (!empty(Input::post())) { $content = Input::post()['content']; $id = $url[0]; Question::postAnswer($content, $id); echo 'Posted'; } else { echo ' Post Answer <form method="post" action=""> <input type="text" placeholder="Answer" name="content"> <input type="submit" value="submit"> </form> '; } } else { self::init('QuestionsModel', 'questions', $url); Question::countQuestionViews($url[0]); } } else { echo 'Question not found'; } } else { self::init('QuestionsListModel', 'questionsList', $url); } }
<a href="meetings/report/<?php echo $meeting->id; ?> " class="btn">ดูรายงาน</a><br /><br /> <?php } ?> <?php if (mysql_to_unix($meeting->close_date) > time()) { ?> <?php $question = new Question(); $question->where('meeting_id', $meeting->id); $question->where('(user_id = ' . $this->session->userdata('id') . ' or r_id = ' . $this->session->userdata('id') . ')'); $question->get(); if (!$question->exists()) { ?> <a href="questions/form/<?php echo $meeting->id; ?> " class="btn">ลงทะเบียน</a> <?php } ?> <?php } ?> </td> </tr> <?php }
<?php include '../../inc/init.inc'; if (isset($id) && is_numeric($id) && Question::exists($id)) { $res->question = Question::find($id); $res->responses = Question::find('all', array('conditions' => array('question_id' => $id), 'order' => 'created_at asc')); $res->useTemplate("Liste des Questions"); } else { echo "La question n'existe pas"; }