Changeset 666 for trunk/app/controllers
- Timestamp:
- 07/22/08 17:08:42 (4 months ago)
- Location:
- trunk/app/controllers
- Files:
-
- 3 modified
-
answers_controller.php (modified) (1 diff)
-
questions_controller.php (modified) (4 diffs)
-
tests_controller.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/answers_controller.php
r540 r666 25 25 public function admin_add() 26 26 { 27 if (!empty($this->data["Answer"])) 28 { 29 //die(print_r($this->data)); 27 if (!empty($this->data["Answer"])): 30 28 31 $this->Sanitize = new Sanitize;29 $this->Sanitize = new Sanitize; 32 30 33 $this->Sanitize->clean($this->data["Answer"]);31 $this->Sanitize->clean($this->data["Answer"]); 34 32 35 $this->data["Answer"]['user_id'] = $this->Auth->user('id'); 36 37 $this->Answer->create(); 33 $this->data["Answer"]['user_id'] = $this->Auth->user('id'); 38 34 39 if ( $this->Answer->save($this->data['Answer']) ) 40 { 41 $conditions = array("Answer.question_id" => $this->data['Answer']['question_id']); 42 $fields = array("Answer.id", "Answer.answer", "Answer.correct", "Answer.question_id"); 43 $order = "Answer.id"; 44 45 $this->set('data', $this->Answer->findAll($conditions, $fields, $order)); 46 47 $this->render('questions', 'ajax'); 48 } 49 else 50 { 35 if ( $this->Answer->save($this->data) ): 36 $conditions = array("Answer.question_id" => $this->data['Answer']['question_id']); 37 $fields = array("Answer.id", "Answer.answer", "Answer.correct", "Answer.question_id"); 38 $order = "Answer.id"; 39 $this->set('data', $this->Answer->findAll($conditions, $fields, $order)); 40 $this->render('questions', 'ajax'); 41 else: 51 42 echo "Ajax error, check with the company's computer guy..."; 52 }53 }43 endif; 44 endif; 54 45 } 55 46 -
trunk/app/controllers/questions_controller.php
r575 r666 5 5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 //File: /app/controllers/qu otes_controller.php7 //File: /app/controllers/questions_controller.php 8 8 9 9 uses('Sanitize'); … … 29 29 30 30 $this->data["Question"]['user_id'] = $this->Auth->user('id'); 31 32 $this->Question->create();33 31 34 if ( $this->Question->save( $this->data ['Question']) ):32 if ( $this->Question->save( $this->data ) ): 35 33 $conditions = array('Question.test_id' => $this->data['Question']['test_id']); 36 34 $fields = array('Question.id','Question.question','Question.hint','Question.worth','Question.explanation','Question.test_id'); … … 50 48 { 51 49 $this->layout = 'admin'; 52 // adds new vote to database 53 if ( !empty($this->data["Question"]) ) 54 { 55 $this->Sanitize = new Sanitize; 50 51 if ( !empty($this->data["Question"]) ): 52 $this->Sanitize = new Sanitize; 56 53 57 $this->Sanitize->clean($this->data["Question"]);54 $this->Sanitize->clean($this->data["Question"]); 58 55 59 if ( $this->Question->save( $this->data['Question'] ) ) 60 { 61 $this->msgFlash('Question saved', '/admin/tests/questions/'.$this->data['Question']['test_id']); 62 } 63 else 64 { 65 echo "Ajax error, check with the company's computer guy..."; 66 } 67 } 68 else 69 { 56 if ( $this->Question->save( $this->data ) ): 57 $this->msgFlash(__('Question saved', true), '/admin/tests/questions/'.$this->data['Question']['test_id']); 58 else: 59 echo "Ajax error, check with the company's computer guy..."; 60 endif; 61 else: 70 62 $this->data = $this->Question->read(null, $question_id); 71 }63 endif; 72 64 } 73 65 … … 76 68 $this->layout = 'admin'; 77 69 78 $this->pageTitle = 'Questions';70 $this->pageTitle = __('Questions', true); 79 71 80 72 $conditions = array("Question.user_id"=>$this->Auth->user('id')); -
trunk/app/controllers/tests_controller.php
r578 r666 29 29 $this->Auth->allow(array('view', 'display', 'result')); 30 30 endif; 31 // L10n32 $this->L10n = new L10n();33 $this->L10n->get("en");34 35 Configure::write('Config.language', "en");36 31 } 37 32 38 33 public function display($username, $user_id) 39 34 { 40 $this->pageTitle = 'Exams';35 $this->pageTitle = __('Tests', true); 41 36 42 37 $this->layout = $this->Edublog->layout($user_id); … … 53 48 $user_id = $this->Test->field('Test.user_id', array("Test.id"=>$test_id)); 54 49 55 $this->pageTitle = 'Exam';50 $this->pageTitle = __('Test', true); 56 51 57 52 $this->layout = $this->Edublog->layout($user_id); … … 189 184 $this->layout = 'admin'; 190 185 191 $this->pageTitle = 'Tests';186 $this->pageTitle = __('Tests', true); 192 187 193 188 $conditions = array('Test.user_id'=>$this->Auth->user('id'));
