Changeset 367
- Timestamp:
- 04/04/08 00:23:34 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 4 modified
-
config/sql/karamelo_postgres.sql (modified) (1 diff)
-
controllers/vclassrooms_controller.php (modified) (4 diffs)
-
views/layouts/popup.ctp (modified) (1 diff)
-
views/vclassrooms/admin_display.ctp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/karamelo_postgres.sql
r342 r367 585 585 "title" varchar(50), 586 586 "description" text NOT NULL, 587 "status" smallint NOT NULL DEFAULT 0 CHECK (status IN (1, 0)) 587 "status" smallint NOT NULL DEFAULT 0 CHECK (status IN (1, 0)), 588 "karanet" smallint NOT NULL DEFAULT 0 588 589 ); 589 590 -
trunk/app/controllers/vclassrooms_controller.php
r365 r367 23 23 if (isset($this->params[Configure::read('Routing.admin')])) 24 24 { 25 if ($this->Auth->user('group_id') == 1 )25 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ) 26 26 { 27 return true;27 return true; // welcome 28 28 } 29 29 } … … 115 115 116 116 $this->set('data', $this->Vclassroom->find($conditions)); 117 118 $this->Vclassroom->Test->unbindModel(array('hasMany'=>array('Question', 'Result'), 'belongsTo'=>array('User'))); 119 117 120 $this->set('test', $this->Vclassroom->Test->findAll(array("Test.user_id"=>$this->Auth->user('id'), "Test.status"=>1))); 118 121 } … … 181 184 public function admin_addtest() 182 185 { 183 $this->layout = 'ajax';184 185 186 if (!empty($this->data)) 186 187 { … … 192 193 if ($this->Vclassroom->addAssoc('Test', $this->data["Test"]["id"], $this->data["Vclassroom"]["id"])) //link vclassrooms_tests 193 194 { 194 $this->set('msg', 'Test added');195 $this-> render('admin_result', 'ajax');195 196 $this->msgFlash('Test linked', '/'); 196 197 } 197 198 else -
trunk/app/views/layouts/popup.ctp
r292 r367 30 30 #footer {border:1px grey solid; margin-top:16pt;padding:4px;color:#000;background-color:#dad9d9;font-size:7pt;text-align:left;width:70%;margin-left:auto;margin-right:auto;} 31 31 .warning {color:red;font-size:10px;text-align:left;} 32 button {background-color:orange;color:#fff;border:1px solid gray;font-size: 8pt;padding:5px;}32 button {background-color:orange;color:#fff;border:1px solid gray;font-size:7pt;padding:5px;} 33 33 input {background-color:#eda2bb;color:#000;border:1px solid gray;font-size:7pt;padding:1px;} 34 .divblock{margin:5px;border:1px dotted gray;padding:4px;} 34 35 --> 35 36 </style> -
trunk/app/views/vclassrooms/admin_display.ctp
r256 r367 1 1 <?php 2 //d ebug($test);2 //die(debug($test)); 3 3 4 4 $test_assigned = array(); … … 6 6 foreach ( $test as $v) 7 7 { 8 $test_assigned[$v['Test']['id']] = $v['Test']['id'];8 $test_assigned[$v['Test']['id']] = $v['Test']['id']; // tests already linked with this classroom 9 9 } 10 10 11 echo $html->div('title_section', $data['Vclassroom']['name']); 11 12 12 echo '<h1>Group: '. $data['Vclassroom']['name'] .'</h1>';13 14 echo $ajax->div('loading', array("style"=>"display: none"));15 echo $html->image("static/loading.gif", array("alt"=>"Loading"));16 echo $ajax->divEnd('loading');17 18 echo $ajax->div('envelope');19 20 echo $ajax->divEnd('envelope');21 13 22 14 if ( count($data) < 1) … … 28 20 foreach ($test as $val) 29 21 { 30 if ( in_array($val['Test']['id'], $test_assigned) )22 if ( !in_array($val['Test']['id'], $test_assigned) ) 31 23 { 32 echo '<div style="padding:6px;margin:10px">The exam <b>'. $val['Test']['title'] . "</b> is already assigned to class <i>" . $data['Vclassroom']['name'] . '</i><br /></div>'; 24 echo $html->div(null, 25 'The exam <b>'.$val['Test']['title'].'</b> is already assigned to class <i>'.$data['Vclassroom']['name'].'</i>'); 33 26 } 34 27 else 35 28 { 36 echo '<div class="round">'; 37 echo 'Exam:' . $val['Test']['title']; 38 echo $ajax->form(); 39 echo $html->hidden('Test/id',array("value"=>$val['Test']['id'])); 40 echo $html->hidden('Vclassroom/id', array("value"=>$data['Vclassroom']['id'])); 41 echo $ajax->submit('Assign this test', array("url" => "/admin/vclassrooms/addtest", 42 "update" =>"envelope", 43 "loading" => "Element.show('charging');Element.hide('envelope')", 44 "complete" => "Element.hide('charging');Effect.Appear('envelope')" 45 )); 46 echo '</form>'; 47 echo '</div>'; 29 $tmp = 'Test:' . $val['Test']['title']; 30 $tmp .= $form->create('Vclassroom', array('action'=>'admin_addtest')); 31 $tmp .= $form->hidden('Test.id', array('value'=>$val['Test']['id'])); 32 $tmp .= $form->hidden('Vclassroom.id', array('value'=>$data['Vclassroom']['id'])); 33 $tmp .= $form->end('Assign this test'); 34 35 echo $html->div('divblock', $tmp); 48 36 } 49 37 }
