Changeset 666 for trunk/app/controllers/questions_controller.php
- Timestamp:
- 07/22/08 17:08:42 (4 months ago)
- Files:
-
- 1 modified
-
trunk/app/controllers/questions_controller.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
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'));
