Changeset 370
- Timestamp:
- 04/06/08 13:50:06 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 6 modified
-
config/core.php (modified) (1 diff)
-
config/sql/karamelo_postgres.sql (modified) (3 diffs)
-
controllers/vclassrooms_controller.php (modified) (3 diffs)
-
models/vclassroom.php (modified) (3 diffs)
-
views/vclassrooms/admin_members.ctp (modified) (2 diffs)
-
views/vclassrooms/admin_tests.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/core.php
r363 r370 14 14 * In development mode, you need to click the flash message to continue. 15 15 */ 16 Configure::write('debug', 1);16 Configure::write('debug', 2); 17 17 /** 18 18 * Application wide charset encoding -
trunk/app/config/sql/karamelo_postgres.sql
r369 r370 87 87 INSERT INTO subjects (code, title) VALUES ('0006', 'Music'); 88 88 INSERT INTO subjects (code, title) VALUES ('0007', 'Psichology'); 89 INSERT INTO subjects (code, title) VALUES ('0008', 'Chemistry'); 90 INSERT INTO subjects (code, title) VALUES ('0009', 'Physiscs'); 91 INSERT INTO subjects (code, title) VALUES ('0010', 'Science'); 92 INSERT INTO subjects (code, title) VALUES ('0011', 'Public health'); 93 INSERT INTO subjects (code, title) VALUES ('0012', 'Biology'); 94 INSERT INTO subjects (code, title) VALUES ('0013', 'Sociology'); 95 INSERT INTO subjects (code, title) VALUES ('0014', 'Archeology'); 96 INSERT INTO subjects (code, title) VALUES ('0015', 'Spanish'); 97 INSERT INTO subjects (code, title) VALUES ('0016', 'Geography'); 98 INSERT INTO subjects (code, title) VALUES ('0017', 'Computing'); 99 INSERT INTO subjects (code, title) VALUES ('0018', 'Business Studies'); 100 INSERT INTO subjects (code, title) VALUES ('0019', 'Genre Studies'); 101 INSERT INTO subjects (code, title) VALUES ('0020', 'French'); 102 INSERT INTO subjects (code, title) VALUES ('0021', 'German'); 103 INSERT INTO subjects (code, title) VALUES ('0022', 'Health Care'); 104 INSERT INTO subjects (code, title) VALUES ('0023', 'Commerce'); 105 INSERT INTO subjects (code, title) VALUES ('0024', 'Graphic Design'); 106 INSERT INTO subjects (code, title) VALUES ('0025', 'Administration'); 107 INSERT INTO subjects (code, title) VALUES ('0026', 'Accounting'); 108 INSERT INTO subjects (code, title) VALUES ('0027', 'Classic Latin'); 109 INSERT INTO subjects (code, title) VALUES ('0028', 'Literature'); 110 INSERT INTO subjects (code, title) VALUES ('0029', 'Japanese'); 111 INSERT INTO subjects (code, title) VALUES ('0030', 'Chinese'); 112 INSERT INTO subjects (code, title) VALUES ('0031', 'Engineering'); 113 INSERT INTO subjects (code, title) VALUES ('0032', 'Sports'); 89 114 90 115 91 -- Confirms user registration table, just a support table until new user confirm his/her email … … 590 566 --HABTM 591 567 CREATE TABLE "tests_vclassrooms" ( 568 "id" serial PRIMARY KEY, 592 569 "test_id" int NOT NULL REFERENCES tests(id), 593 570 "vclassroom_id" int NOT NULL REFERENCES vclassrooms(id), 594 PRIMARY KEY("test_id", "vclassroom_id")571 UNIQUE ("test_id", "vclassroom_id") 595 572 ); 596 573 … … 674 651 status int NOT NULL DEFAULT 0 675 652 ); 653 654 -- Wiki tables beggin 655 CREATE TABLE wikis ( 656 id serial PRIMARY KEY, 657 title varchar(255) NOT NULL, 658 content text NOT NULL, 659 access smallint NOT NULL DEFAULT 0, 660 modified timestamp NOT NULL default now(), 661 user_id serial NOT NULL, 662 ip varchar(15) NOT NULL, 663 revision int(5) NOT NULL, 664 accessed datetime NOT NULL 665 ); 666 667 CREATE TABLE wiki_revisions ( 668 id serial PRIMARY KEY, 669 title varchar(255) NOT NULL, 670 content text NOT NULL, 671 access smallint NOT NULL default 0, 672 modified timestamp NOT NULL default now(), 673 user_id serial NOT NULL, 674 ip varchar(15) NOT NULL, 675 revision int(5) NOT NULL, 676 accessed date NOT NULL default now() 677 ); 678 679 CREATE TABLE settings ( 680 id serial PRIMARY KEY, 681 name varchar(50) NOT NULL UNIQUE, 682 value varchar(255) NOT NULL, 683 default varchar(255) NOT NULL, 684 description varchar(255) NOT NULL 685 ); 686 687 CREATE TABLE upload_revisions ( 688 id serial PRIMARY KEY, 689 filename varchar(250) NOT NULL, 690 location varchar(250) NOT NULL, 691 access smallint NOT NULL, 692 modified timestamp NOT NULL default now(), 693 user_id int NOT NULL REFERENCES users(id), 694 ip varchar(15) NOT NULL, 695 revision int NOT NULL 696 ); 697 698 CREATE TABLE uploads ( 699 id serial PRIMARY KEY, 700 filename varchar(255) NOT NULL UNIQUE, 701 location varchar(255) NOT NULL, 702 access smallint NOT NULL, 703 modified timestamp NOT NULL default now(), 704 user_id int NOT NULL REFERENCES users(id), 705 ip varchar(15) NOT NULL, 706 revision int NOT NULL 707 ); 708 709 -- wiki tables ends -
trunk/app/controllers/vclassrooms_controller.php
r369 r370 19 19 parent::beforeFilter(); 20 20 } 21 21 22 public function isAuthorized() 22 23 { … … 122 123 $this->set('test', $this->Vclassroom->Test->findAll(array("Test.user_id"=>$this->Auth->user('id'), "Test.status"=>1))); 123 124 } 125 126 public function admin_linktest() 127 { 128 if (!empty($this->data["TestsVclassroom"])) 129 { 130 $this->Sanitize = new Sanitize; 131 132 $this->Sanitize->clean($this->data["TestsVclassroom"]); 133 134 $this->Vclassroom->TestsVclassroom->create(); 135 136 unset($this->Vclassroom->TestsVclassroom->id); 137 138 if ( $this->Vclassroom->TestsVclassroom->save($this->data["TestsVclassroom"])) 139 { 140 141 $this->msgFlash('Test linked', '/admin/vclassrooms/tests/'.$this->data["TestsVclassroom"]["vclassroom_id"]); 142 } 143 } 144 } 124 145 // link webquest to classroom 125 146 public function admin_webquest($vclassroom_id) … … 200 221 else 201 222 { 202 echo 'Problem'; 203 } 204 } 205 } 206 207 /** 208 * 209 * args id 210 * 211 **/ 212 public function admin_edit($id = null) 213 { 223 echo 'Problem please report bug'; 224 } 225 } 226 } 227 228 public function admin_edit($vclassroom_id = null) 229 { 214 230 if (empty($this->data["Vclassroom"])) 215 231 { 216 232 $this->layout = 'admin'; 217 233 218 $this->Vclassroom->id = $id; 219 220 $this->data = $this->Vclassroom->read(); 234 $this->data = $this->Vclassroom->read(null, $vclassroom_id); 221 235 } 222 236 else -
trunk/app/models/vclassroom.php
r369 r370 16 16 array('className' => 'User', 17 17 'joinTable' => 'users_vclassrooms', 18 'foreignKey' => ' user_id',19 'associationForeignKey'=> ' vclassroom_id',18 'foreignKey' => 'vclassroom_id', 19 'associationForeignKey'=> 'user_id', 20 20 'conditions' => '', 21 'fields' => 'username, id, email, name', 21 22 'order' => '', 22 23 'limit' => '', … … 24 25 'finderQuery' => '', 25 26 'deleteQuery' => '', 26 ) 27 ); 28 29 /* 30 public $hasAndBelongsToMany = array( 27 ), 31 28 'Test' => 32 29 array('className' => 'Test', … … 40 37 'finderQuery' => '', 41 38 'deleteQuery' => '' 42 ), 39 ) 40 ); 41 /* 43 42 'Webquest' => 44 43 array('className' => 'Webquest', -
trunk/app/views/vclassrooms/admin_members.ctp
r369 r370 1 1 <?php 2 //die( debug($ users));2 //die( debug($data)); 3 3 echo '<div style="padding:4px;margin:10px auto 10px;width:700px;text-align:center;">'; 4 4 5 5 //popup window for tests 6 $t="javascript:window.open('/admin/vclassrooms/ display/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')";6 $t="javascript:window.open('/admin/vclassrooms/tests/".$data['Vclassroom']['id']."', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=400')"; 7 7 8 8 //popup window for webquest … … 36 36 echo $html->div('title_section', 'Students belonging to ' . $data['Vclassroom']['name']); 37 37 38 if ( count($ users) < 1 )38 if ( count($data['User']) < 1 ) 39 39 { 40 40 echo $html->div('divblock', 'There are no students in this classrroom yet'); 41 41 } 42 42 43 foreach ($ usersas $val)43 foreach ($data['User'] as $val) 44 44 { 45 // die(debug($val)); 45 46 echo '<div style="padding:6px 3px 28px 4px;margin:10px 0 5px 0;border:1px dotted gray;">'; 46 echo 'Name: ' . $val['User']['name'] . '<br />'; 47 echo 'Username:' . $val['User']['username'] . '<br />'; 48 echo 'Email: ' . $html->linkEmail($val['User']['email']) . '<br />'; 49 echo $html->div('butonright', $gags->confirmDel($val['User']['id'], 'vclassmembers')); 47 echo '<b>Name</b>: ' . $val['name'] . ' ' . '<b> Username</b>:' . $val['username'] . '<br />'; 48 echo 'Email: ' . $html->link($val['email'], 'mailto:'.$val['email']) . '<br />'; 49 echo $html->div('butonright', $gags->confirmDel($val['id'], 'vclassmembers')); 50 50 echo '</div>'; 51 51 } -
trunk/app/views/vclassrooms/admin_tests.ctp
r369 r370 28 28 { 29 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 ');30 $tmp .= $form->create('Vclassroom', array('action'=>'linktest')); 31 $tmp .= $form->hidden('TestsVclassroom.test_id', array('value'=>$val['Test']['id'])); 32 $tmp .= $form->hidden('TestsVclassroom.vclassroom_id', array('value'=>$data['Vclassroom']['id'])); 33 $tmp .= $form->end('Assign this test to this class'); 34 34 35 35 echo $html->div('divblock', $tmp);
