private function form($action, $submitted = false, $saved_data = array()) { $form = new Stickyform($action, array(), $submitted ? $this->_errors : array()); $form->default_data = array('title' => '', 'description' => ''); $form->saved_data = $saved_data; $form->posted_data = $submitted ? $this->request->post() : array(); $form->append('Title', 'title', 'text'); $form->append('Description', 'description', 'textarea', array('attributes' => array('cols' => 50, 'rows' => 5))); $form->append('Save', 'save', 'submit', array('attributes' => array('class' => 'button'))); $form->process(); $id = $this->request->param('id'); $sel_question = array(); if ($id != "") { $sel_question = Model_Flashcard::getQuestions($id); } $links = array('cancel' => Html::anchor('/flashcard/', 'or cancel'), 'click_here' => Html::anchor('/question/add/type/open', 'Click here')); $action = $this->request->action(); $course_id = Session::instance()->get('course_id'); $questions = Model_Flashcard::get_questions($course_id); $view = View::factory('flashcard/form')->bind('links', $links)->bind('form', $form)->bind('action', $action)->bind('id', $id)->bind('questions', $questions)->bind('selected_question', $sel_question); $this->content = $view; }