Changeset 363
- Timestamp:
- 04/02/08 15:41:18 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 1 added
- 10 modified
-
config/core.php (modified) (1 diff)
-
controllers/acquaintances_controller.php (modified) (2 diffs)
-
controllers/answers_controller.php (modified) (3 diffs)
-
controllers/questions_controller.php (modified) (2 diffs)
-
models/answer.php (modified) (1 diff)
-
models/question.php (modified) (1 diff)
-
views/answers/admin_edit.ctp (added)
-
views/questions/admin_answers.ctp (modified) (2 diffs)
-
views/questions/questions.ctp (modified) (1 diff)
-
views/tests/admin_questions.ctp (modified) (2 diffs)
-
views/users/login.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/core.php
r341 r363 75 75 * 76 76 */ 77 Configure::write('Session.save', ' database');77 Configure::write('Session.save', 'cake'); 78 78 /** 79 79 * The name of the table used to store CakePHP database sessions. -
trunk/app/controllers/acquaintances_controller.php
r339 r363 44 44 } 45 45 46 /** ADMIN METHODS***/46 /** === ADMIN METHODS === ***/ 47 47 public function admin_listing() 48 48 { … … 89 89 $this->layout = 'admin'; 90 90 91 $this->Acquaintance->id = $id; 92 93 $this->data = $this->Acquaintance->read(); 91 $this->data = $this->Acquaintance->read(null, $id); 94 92 } 95 93 else -
trunk/app/controllers/answers_controller.php
r361 r363 25 25 } 26 26 27 /*** 28 === ADMIN METHODS=== 29 ***/ 27 /*** === ADMIN METHODS=== ***/ 30 28 31 29 public function admin_add() … … 66 64 if (empty($this->data["Answer"])) 67 65 { 68 $this->Answer->id = $catfaq_id; 69 70 $this->data = $this->Answer->read(); 66 $this->data = $this->Answer->read(null, $answer_id ); 71 67 } 72 68 else … … 77 73 78 74 if ($this->Answer->save($this->data['Answer'])) 79 {80 $this->msgFlash('Answer s has been updated.','/admin/questions/listing/'.$this->data["Answers"]["question_id"]);81 }75 { 76 $this->msgFlash('Answer updated.','/admin/questions/answers/'.$this->data["Answer"]["question_id"]); 77 } 82 78 } 83 79 } -
trunk/app/controllers/questions_controller.php
r362 r363 44 44 { 45 45 $conditions = array("Question.test_id" => $this->data['Question']['test_id']); 46 $fields = array("Question.id", "Question.question", "Question.hint", "Question.worth", "Question.explanation" , "Answer.id");46 $fields = array("Question.id", "Question.question", "Question.hint", "Question.worth", "Question.explanation"); 47 47 $order = "Question.id"; 48 48 … … 53 53 else 54 54 { 55 echo "Ajax error, check with the company's computer guy...";55 echo "Ajax error, please report this bug"; 56 56 } 57 57 } -
trunk/app/models/answer.php
r284 r363 8 8 class Answer extends AppModel { 9 9 10 public $belongsTo = 'User'; 11 10 public $belongsTo = array('Question' => 11 array('className' => 'Question', 12 'conditions' => '', 13 'order' => '', 14 'foreignKey' => 'question_id' 15 ) 16 ); 17 12 18 public $validate = array( 13 19 'comment' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', -
trunk/app/models/question.php
r282 r363 8 8 class Question extends AppModel { 9 9 10 public $belongsTo = array(' User' =>11 array('className' => 'User',12 'conditions' => '',13 'order' => '',14 'foreignKey' => 'user_id'15 )16 );10 public $belongsTo = array('Test' => 11 array('className' => 'Test', 12 'conditions' => '', 13 'order' => '', 14 'foreignKey' => 'test_id' 15 ) 16 ); 17 17 18 18 public $hasMany = array('Answer' => 19 array('className'=>'Answer',20 'conditions' => null,21 'foreignKey' => 'question_id',22 'dependent' => true,23 'exclusive' => false,24 'finderQuery' => '',25 'order' => 'Answer.id ASC'26 )27 );19 array('className'=>'Answer', 20 'conditions' => null, 21 'foreignKey' => 'question_id', 22 'dependent' => true, 23 'exclusive' => false, 24 'finderQuery' => null, 25 'order' => 'Answer.id ASC' 26 ) 27 ); 28 28 29 public $validate = array('question' => VALID_NOT_EMPTY, //'/[a-z0-9\_\-]{3,}$/i', 30 'user_id' => VALID_NOT_EMPTY, 31 'explanation' => VALID_NOT_EMPTY); 29 public $validate = array('question' => VALID_NOT_EMPTY, 30 'user_id' => VALID_NOT_EMPTY, 31 'explanation' => VALID_NOT_EMPTY 32 ); 32 33 } 33 34 ?> -
trunk/app/views/questions/admin_answers.ctp
r361 r363 7 7 ?> 8 8 9 <div id="loading" style="display: none;"> 10 <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?> 11 </div> 9 <div id="loading" style="display: none;"> <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?></div> 12 10 13 <p> 14 <?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new answer", "title"=>"Add new answer")), '#', array("onclick"=>"hU()"), false, false); ?> 15 </p> 11 <?php echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new answer", "title"=>"Add new answer")), '#', array("onclick"=>"hU()"), false, false)); ?> 12 16 13 17 14 <div id="addquestion" style="display:none"> … … 38 35 foreach ($data['Answer'] as $val) 39 36 { 40 $st = ($val[ "correct"]==1) ? 'Yes' : 'No';37 $st = ($val['correct']==1) ? 'Yes' : 'No'; 41 38 $tmp = $html->div(null, $html->link('Delete', '/admin/answers/delete/'.$val['id'].'/'.$val['question_id'])); 42 39 $tmp .= $html->div(null, $html->link('Edit', '/admin/answers/edit/' .$val['id'])); 43 $tmp .= "Answer: " . $val["answer"]. "<br />";44 $tmp .= "Correct: " . $html->link($st, '/admin/answers/change d/'.$val['id'].'/'.$val['question_id']) . "<br />";40 $tmp .= "Answer: " . $val["answer"] . "<br />"; 41 $tmp .= "Correct: " . $html->link($st, '/admin/answers/change/'.$val['id'].'/'.$val['correct'] .'/'.$val['question_id']) . "<br />"; 45 42 46 43 echo $html->div('adminblock', $tmp); -
trunk/app/views/questions/questions.ctp
r362 r363 9 9 $i++; 10 10 echo '<div style="padding:5px;border:1px dotted gray;margin:auto;width:60%"><b>' . $i . '.-</b> '; 11 echo $html->div('butonright', $gags->sendEdit($val[' id'], 'Question'));12 echo $html->div('butonright', $gags->confirmDel($val[' id'], 'Question'));13 echo "Question: " . $val[ "question"] . "<br />";14 echo "Hint: " . $val[ "hint"] . "<br />";15 echo "Explanation: " . $val[ "explanation"] . "<br />";16 echo "Worth: " . $val[ "worth"] . "<br /><br />";17 echo $html->link('View answers ('.$answers.')', '/admin/questions/answers/'.$val[ "id"]);11 echo $html->div('butonright', $gags->sendEdit($val['Question']['id'], 'Question')); 12 echo $html->div('butonright', $gags->confirmDel($val['Question']['id'], 'Question')); 13 echo "Question: " . $val['Question']['question'] . "<br />"; 14 echo "Hint: " . $val['Question']['hint'] . "<br />"; 15 echo "Explanation: " . $val['Question']['explanation'] . "<br />"; 16 echo "Worth: " . $val['Question']['worth'] . "<br /><br />"; 17 echo $html->link('View answers ('.$answers.')', '/admin/questions/answers/'.$val['Question']['id']); 18 18 echo '</div>'; 19 19 } -
trunk/app/views/tests/admin_questions.ctp
r362 r363 16 16 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false)); 17 17 ?> 18 18 19 <!-- Ajax form beggin --> 19 20 <div id="addquestion" style="display:none"> 20 21 <?php 21 echo $ajax->form( null,'post');22 echo $ajax->form(); 22 23 echo $form->hidden('Question.test_id', array('value'=>$data['Test']['id'])); 23 24 ?> … … 29 30 echo $html->div('required', $form->label('Question.explanation', 'Explanation:') . $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5))); 30 31 31 $tmp = $form->label('Question.worth', 'Worth:');32 $tmp = $form->label('Question.worth', 'Worth:'); 32 33 $tmp .= $form->select('Question.worth', array(1, 2, 3, 4, 5, 6,7, 8, 9, 10), null, null, false, false); 33 34 echo $html->div('required', $tmp); -
trunk/app/views/users/login.ctp
r340 r363 2 2 <?php 3 3 echo $form->create('User', array('action' => 'login')); 4 echo $form->input('email', array('size' => 40, 'maxlength'=> 50)); 5 echo $form->label('pwd', 'Password:'); 6 echo $form->password('pwd') . '<br />'; 4 echo $form->input('email', array('size' => 40, 'maxlength'=> 50, 'between'=>':<br />')); 5 echo $form->input('pwd', array('between'=>'<br />', 'type' => 'password', 'label'=>'Password:', 'size' => 9, 'maxlength'=> 9)); 7 6 echo $form->label('remember_me', 'Remember me:'); 8 echo $form->checkbox('remember_me' );7 echo $form->checkbox('remember_me', array('value'=>1)); 9 8 echo $form->end('Login'); 10 //sujaclal11 9 ?>
