Changeset 54
- Timestamp:
- 08/09/07 12:55:08 (17 months ago)
- Location:
- trunk/app
- Files:
-
- 17 modified
-
config/sql/karamelo.sql (modified) (1 diff)
-
controllers/catglossaries_controller.php (modified) (2 diffs)
-
controllers/lessons_controller.php (modified) (4 diffs)
-
controllers/tests_controller.php (modified) (1 diff)
-
controllers/vclassmembers_controller.php (modified) (3 diffs)
-
controllers/vclassrooms_controller.php (modified) (5 diffs)
-
views/elements/subjects.thtml (modified) (1 diff)
-
views/elements/vclassrooms.thtml (modified) (1 diff)
-
views/galleries/admin_listing.thtml (modified) (1 diff)
-
views/lessons/admin_add.thtml (modified) (1 diff)
-
views/lessons/admin_listing.thtml (modified) (1 diff)
-
views/questions/questions.thtml (modified) (1 diff)
-
views/tests/admin_questions.thtml (modified) (3 diffs)
-
views/vclassrooms/admin_add.thtml (modified) (3 diffs)
-
views/vclassrooms/admin_edit.thtml (modified) (2 diffs)
-
views/vclassrooms/admin_listing.thtml (modified) (2 diffs)
-
views/vclassrooms/show.thtml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/config/sql/karamelo.sql
r53 r54 245 245 INSERT INTO permissions (id, name) VALUES (64, 'admin/glossaries/listing'); 246 246 --Categories Glossaries 247 INSERT INTO permissions (id, name) VALUES (65, ' catglossaries/add');248 INSERT INTO permissions (id, name) VALUES (66, ' catglossaries/edit');249 INSERT INTO permissions (id, name) VALUES (67, ' catglossaries/delete');250 INSERT INTO permissions (id, name) VALUES (68, ' catglossaries/listing');247 INSERT INTO permissions (id, name) VALUES (65, 'admin/catglossaries/add'); 248 INSERT INTO permissions (id, name) VALUES (66, 'admin/catglossaries/edit'); 249 INSERT INTO permissions (id, name) VALUES (67, 'admin/catglossaries/delete'); 250 INSERT INTO permissions (id, name) VALUES (68, 'admin/catglossaries/listing'); 251 251 --E-courses 252 252 INSERT INTO permissions (id, name) VALUES (69, 'admin/ecourses/add'); -
trunk/app/controllers/catglossaries_controller.php
r31 r54 26 26 } 27 27 28 public function listing() 28 /*** 29 === ADMIM METHODS 30 ***/ 31 public function admin_listing() 29 32 { 30 33 $this->layout = 'admin'; … … 38 41 $this->set('data', $this->Catglossary->findAll( $conditions, $fields, $order, null, null, false)); 39 42 40 }41 42 public functionadd()43 {43 } 44 45 public function admin_add() 46 { 44 47 $this->layout = 'admin'; 45 48 // adds new classroom to database 46 if (!empty($this-> params['data']))49 if (!empty($this->data)) 47 50 { 48 51 $this->Sanitize = new Sanitize; 49 52 50 $this->Sanitize->cleanArray($this-> params['data']); //Hopefully this is enough53 $this->Sanitize->cleanArray($this->data["Catglossary"]); //Hopefully this is enough 51 54 52 if ($this->Catglossary->save($this->params['data']))53 { 54 //$this->set('data', $this->Catglossaries->index());55 $this->flash('Your Category Glossary has been saved.','/catglossaries/listing');56 57 //$this->render('todo', 'ajax');58 }55 $this->Catglossary->clearUpFields(); 56 $this->Catglossary->create(); 57 58 if ($this->Catglossary->save($this->data["Catglossary"])) 59 { 60 $this->flash('Category Glossary saved.','/admin/catglossaries/listing'); 61 } 59 62 } 63 } 64 65 public function admin_edit($id=null) 66 { 67 $this->layout = 'admin'; 68 69 if ( empty( $this->data["Catglossary"] ) ) 70 { 71 $this->Catglossary->id = $id; 72 73 $this->data = $this->Catglossary->read(); 74 } 75 else 76 { 77 $this->Sanitize = new Sanitize; 78 79 $this->Sanitize->html($this->data["Catglossary"]["title"]); 80 81 $this->Sanitize->html($this->data["Catglossary"]["body"]); 82 83 if ($this->Catglossary->save($this->data["Catglossary"])) 84 { 85 $this->msgFlash('Your category has been saved!', '/admin/catglossaries/edit/'.$this->data["Catglossary"]["id"]); 86 } 87 } 88 } 89 90 public function admin_delete($id) 91 { 92 if ($this->Catglossary->del($id)) 93 { 94 $this->msgFlash('Category deleted', '/admin/catglossaries/listing'); 95 } 60 96 } 61 97 } -
trunk/app/controllers/lessons_controller.php
r31 r54 10 10 class LessonsController extends AppController 11 11 { 12 public $helpers = array('Ajax', 'Form', 'User', 'Fck' );12 public $helpers = array('Ajax', 'Form', 'User', 'Fck', 'Gags'); 13 13 14 14 public $components = array('Edublog'); … … 49 49 } 50 50 51 public function all($user_id) {52 51 public function all($user_id) 52 { 53 53 $this->LessonTitle = 'Portfolio Blog'; 54 54 … … 67 67 } 68 68 69 /*** 70 === ADMIN METHODS 71 ****/ 69 72 public function admin_listing() 70 73 { … … 85 88 86 89 87 public function ad d()90 public function admin_add() 88 91 { 89 $this->layout = 'admin';90 // adds new classroom to database91 if (!empty($this-> params['data']))92 $this->layout = 'admin'; 93 94 if (!empty($this->data["Lesson"])) 92 95 { 93 96 $this->Sanitize = new Sanitize; 94 97 95 $this->Sanitize-> cleanArray($this->params['data']); //Hopefully this is enough98 $this->Sanitize->html($this->data["Lesson"]["title"]); 96 99 97 if ($this->Lesson->save($this->params['data'])) 98 { 99 $this->redirect('/lessons/listing/'); 100 } 100 $this->Sanitize->html($this->data["Lesson"]["body"]); 101 102 $this->data["Lesson"]["user_id"] = $this->othAuth->user('id');; 103 104 if ($this->Lesson->save($this->data["Lesson"])) 105 { 106 $this->msgFlash('Lesson saved', '/admin/lessons/listing/'); 107 } 101 108 } 102 } 109 } 110 111 public function admin_edit($id=null) 112 { 113 $this->layout = 'admin'; 114 115 if ( empty( $this->data["Lesson"] ) ) 116 { 117 $this->Lesson->id = $id; 118 119 $this->data = $this->Lesson->read(); 120 } 121 else 122 { 123 $this->Sanitize = new Sanitize; 124 125 $this->Sanitize->html($this->data["Lesson"]["title"]); 126 127 $this->Sanitize->html($this->data["Lesson"]["body"]); 128 129 if ($this->Lesson->save($this->data["Lesson"])) 130 { 131 if ( $this->data["Lesson"]["end"] == 1 ) 132 { 133 $this->redirect('/admin/lessons/listing'); 134 } 135 else 136 { 137 $this->msgFlash('Your story has been saved!', '/admin/lessons/edit/'.$this->data["Lesson"]["id"]); 138 } 139 } 140 } 141 } 142 143 public function admin_delete($id) 144 { 145 if ($this->Lesson->del($id)) 146 { 147 $this->msgFlash('Lesson deleted', '/admin/lessons/listing'); 148 } 149 else 150 { 151 $this->flash('Error, call support', '/admin/lessons/listing'); 152 } 153 } 103 154 } 104 155 ?> -
trunk/app/controllers/tests_controller.php
r31 r54 11 11 public $helpers = array('Form', 'Ajax'); 12 12 13 public function index(){ 13 public function index() 14 { 14 15 15 16 $number = $this->Test->findCount(); -
trunk/app/controllers/vclassmembers_controller.php
r31 r54 1 1 <?php 2 /* 2 /** 3 3 * Karamelo E-Learning Platform 4 * Manuel Montoya 2002-200 65 * GPLmanuel<at>mononeurona.org4 * Manuel Montoya 2002-2007 5 * Chipotle Software GPLv3 manuel<at>mononeurona.org 6 6 */ 7 7 … … 27 27 } 28 28 29 public function add($user_id = null, $classroom_id = null, $student_id = null)29 public function jointoclass() 30 30 { 31 32 $this->Vclassroom = new Vclassroom; //Instantiate the model 33 34 if (empty($this->params['data'])) { 31 if (!empty($this->data["Vclassmember"])) 32 { 33 $code = $this->Vclassmember->Vclassroom->field('code', array("Vclassroom.id"=>$this->data['Vclassmember']['vclassroom_id'])); 35 34 36 $this->layout = $this->Edublog->layout($user_id); 37 $this->set('blog', $this->Edublog->blog($user_id)); 38 39 $conditions = array("id"=>$classroom_id); 40 41 $fields = array("id", "name", "invitation", "code"); 42 43 $data = $this->Vclassroom->find($conditions, $fields, null, true); 44 45 //echo $data['Vclassroom']['code']; 46 47 $check = $this->chkMember($classroom_id); 48 49 $this->set('check', $check); 50 51 $this->set('data', $data); 52 53 } 54 else // adds new classroom to database 55 { 56 $this->Sanitize = new Sanitize; 57 58 $this->Sanitize->cleanArray($this->params['data']); //Hopefully this is enough 59 60 //print_r($this->params['data']); 61 62 //die(print_r($data)); 63 64 //echo $data['Vclassroom']['code']; 65 66 if ( $this->params['data']['Vclassmember']['invitation'] == 1 ) 67 { 68 $code = $this->Vclassroom->field('code', array("Vclassroom.id"=>$this->params['data']['Vclassmember']['vclassroom_id'])); 35 if ($code != $this->data['Vclassmember']['code'] || $code == null) //code is correct 36 { 37 $this->set('msg', 'Code is incorrect'); 38 $this->render('jointoclass', 'ajax'); 39 exit(); 40 } 41 elseif($this->chkMember($this->data['Vclassmember']['vclassroom_id'])) // the studen is not member 42 { 43 $this->set('msg', 'You are already member of this class!'); 44 $this->render('jointoclass', 'ajax'); 45 exit(); 46 47 } 48 else 49 { 50 $this->data['Vclassmember']['vclassroom_id']; 69 51 70 if ($this->params['data']['Vclassmember']['code'] != $code) 71 { 72 die($this->flash('Your code is invalid', '/vclassmembers/add/'.$this->params['data']['Vclassmember']['user_id'].'/'.$this->params['data']['Vclassmember']['vclassroom_id'])); 52 $this->data['Vclassmember']['user_id'] = $this->othAuth->user('id'); 53 54 $this->Vclassmember->create(); 55 56 if ($this->Vclassmember->save($this->data['Vclassmember'])) 57 { 58 $this->set('msg', 'You have joined to this class succesfully!'); 59 $this->render('jointoclass', 'ajax'); 60 exit(); 73 61 } 74 62 } 75 76 if ($this->Vclassmember->save($this->params['data']))77 {78 $link = '/vclassrooms/show/'. $this->params['data']['Vclassmember']['user_id'] .'/'. $this->params['data']['Vclassmember']['vclassroom_id'];79 80 $this->flash('Your has been added to classroom.', $link);81 }82 63 } 83 84 64 } 65 85 66 //Check if the user already exist in the classroom 86 protected function chkMember($classroom_id) 87 { 88 $check = true; 89 90 $user_id = $this->othAuth->user('id'); 91 92 $conditions = array('"Vclassmember"."user_id"'=>$user_id, '"Vclassmember"."vclassroom_id"'=>$classroom_id); 67 protected function chkMember($vclassroom_id) 68 { 69 $conditions = array('"Vclassmember"."user_id"'=>$this->othAuth->user('id'), '"Vclassmember"."vclassroom_id"'=>$vclassroom_id); 93 70 94 71 $val = $this->Vclassmember->field('id', $conditions); 95 72 96 73 if ( $val === false) 97 { 98 $check = false; 99 } 100 101 return $check; 74 { 75 return false; 76 } 77 else 78 { 79 return true; 80 } 102 81 } 103 82 104 public function edit($id = null)83 public function admin_edit($id = null) 105 84 { 106 85 if (empty($this->data)) … … 119 98 } 120 99 121 public function delete($id)100 public function admin_delete($id) 122 101 { 123 102 // deletes task from database 124 103 $this->Vclassmember->del($id); 125 $this-> flash('Your virtual classroom has been updated.','/vclassrooms');104 $this->msgFlash('Stuent has been deleted','/admin/vclassrooms/start'); 126 105 } 127 128 106 } -
trunk/app/controllers/vclassrooms_controller.php
r31 r54 10 10 class VclassroomsController extends AppController 11 11 { 12 public $helpers = array('Ajax', 'Form', 'Fck' );12 public $helpers = array('Ajax', 'Form', 'Fck', 'Gags'); 13 13 14 14 public $components = array('Edublog'); 15 16 public function listing() 17 { 15 16 public function show($user_id, $id) 17 { 18 19 $this->pageTitle = 'Classrooms'; 20 $this->layout = $this->Edublog->layout($user_id); 21 $this->set('blog', $this->Edublog->blog($user_id)); 22 23 $conditions = array("Vclassroom.status"=>1, "Vclassroom.id"=>$id); 24 $fields = array("Vclassroom.id", "Vclassroom.name", "Vclassroom.description", "Vclassroom.subject_id", "Vclassroom.created", "Vclassroom.user_id", "Subject.title"); 25 $order = "Vclassroom.name DESC"; 26 27 $this->set('data', $this->Vclassroom->find($conditions, $fields, $order, null, null, 2, 2)); 28 } 29 30 /*** 31 == ADMIN METHODS 32 ***/ 33 public function admin_listing() 34 { 18 35 $this->layout = 'admin'; 19 36 $conditions = array("user_id"=>$this->othAuth->user('id')); … … 30 47 } 31 48 32 public function show($user_id, $id) { 33 34 $this->pageTitle = 'Classrooms'; 35 $this->layout = $this->Edublog->layout($user_id); 36 $this->set('blog', $this->Edublog->blog($user_id)); 37 38 $conditions = array("Vclassroom.status"=>1, "Vclassroom.id"=>$id); 39 $fields = array("Vclassroom.id", "Vclassroom.name", "Vclassroom.description", "Vclassroom.subject_id", "Vclassroom.created", "Vclassroom.user_id"); 40 $order = "Vclassroom.name DESC"; 41 42 $this->set('data', $this->Vclassroom->findAll($conditions, $fields, $order, null, null, 2, 2)); 43 } 44 45 public function add() { 49 public function admin_add() { 46 50 47 // adds new classroom to database 48 if (!empty($this->params['data'])) 51 if (!empty($this->data["Vclassroom"])) 49 52 { 50 53 $this->Sanitize = new Sanitize; 51 54 52 $this->Sanitize->cleanArray($this-> params['data']); //Hopefully this is enough55 $this->Sanitize->cleanArray($this->data["Vclassroom"]); //Hopefully this is enough 53 56 54 if ($this->Vclassroom->save($this-> params['data']))57 if ($this->Vclassroom->save($this->data["Vclassroom"])) 55 58 { 56 $this->redirect('/vclassrooms/listing'); 57 } 58 } else { 59 $this->redirect('/admin/vclassrooms/listing'); 60 } 61 } 62 else 63 { 59 64 $this->layout = 'admin'; 60 65 … … 69 74 $O = $this->Vclassroom->field('order', $conditions, $order); 70 75 71 $Order = $O + 1; 76 $Order = $O + 1; //patch to list 1=>1 72 77 73 78 $this->set('Order', $Order); … … 75 80 76 81 } 77 78 public function edit($id = null) 82 /** 83 * 84 * args id 85 * 86 **/ 87 public function admin_edit($id = null) 79 88 { 80 81 89 if (empty($this->data)) 82 90 { … … 93 101 else 94 102 { 95 if ($this->Vclassroom->save($this->data['Vclassroom'])) 96 { 97 $this->flash('Your virtual classroom has been updated.','/vclassrooms/listing'); 98 } 103 $this->Sanitize = new Sanitize; 104 105 $this->Sanitize->cleanArray($this->data["Vclassroom"]); //Hopefully this is enough 106 107 if ($this->Vclassroom->save($this->data['Vclassroom'])) 108 { 109 $this->msgFlash('Your virtual classroom has been updated.','/admin/vclassrooms/listing'); 110 } 99 111 } 100 112 } 101 113 102 public function delete($id)114 public function admin_delete($id) 103 115 { 104 // deletes task from database105 116 if ($this->Vclassroom->del($id)) 106 {107 $this-> redirect('/vclassrooms/listing');108 }109 else110 {111 $this->flash('Error, call support', '/ vclassrooms/listing');112 }117 { 118 $this->msgFlash('Classroom deleted','/admin/vclassrooms/listing'); 119 } 120 else 121 { 122 $this->flash('Error, call support', '/admin/vclassrooms/listing'); 123 } 113 124 } 114 125 -
trunk/app/views/elements/subjects.thtml
r45 r54 2 2 echo '<div style="text-align:center;margin:15px auto 15px auto;">'; 3 3 echo $ajax->link($html->image("static/subjects.png", array("alt"=>"Subjects", "title"=>"Subjects", "style"=>"border:1px solid #fff")), '/subjects/display', array("update" => "qn", 4 "loading"=>"Element.show('loading3');", "complete"=>"Element.hide('loading3');Effect.Appear(' updater')"),4 "loading"=>"Element.show('loading3');", "complete"=>"Element.hide('loading3');Effect.Appear('qn')"), 5 5 null, false); 6 6 echo "</div>"; -
trunk/app/views/elements/vclassrooms.thtml
r1 r54 1 1 <div class="temas">Classrooms</div> 2 <? 3 //var_dump($podcast); 4 5 foreach ($blog[0]["Vclassroom"] as $key => $val) { 6 echo '<a class="petit" href="/vclassrooms/show/'.$val['user_id'].'/'. $val['id'] . '">>'. $val['name'] . '</a><br />'; 2 <?php 3 foreach ($blog[0]["Vclassroom"] as $key => $val) 4 { 5 echo $html->link($val['name'], '/vclassrooms/show/'.$val['user_id'].'/'. $val['id'], array("class"=>"petit")) . "<br />\n"; 7 6 } 8 9 7 ?> 10 8 -
trunk/app/views/galleries/admin_listing.thtml
r18 r54 1 <script type="text/javascript"> 2 window.onload = timedMsg; 3 </script> 4 <?php $session->flash(); ?> 1 5 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 2 6 <?php echo $html->getCrumbs(' / '); ?> 3 7 4 <p><?php echo $html->link($html->image('admin/new.gif', array("alt"=>"Add new gallery", "title"=>"Add new gallery")), '/admin/galleries/add', null, false, false) ?></p>8 <p><?php echo $html->link($html->image('admin/new.gif', array("alt"=>"Add new page", "title"=>"Add new page")), '/admin/galleries/add', null, false, false) ?></p> 5 9 6 10 <table class="tbadmin"> -
trunk/app/views/lessons/admin_add.thtml
r19 r54 4 4 ?> 5 5 6 <div class="title_section">Add new Lesson</div> 7 8 <div class="spaced"> 9 10 <?php echo $html->formTag('/lessons/add/','post'); ?> 6 <?php echo $html->formTag('/admin/lessons/add/','post'); ?> 11 7 <fieldset> 12 <p> 13 <?php echo $form->labelTag( 'Lesson/title', 'Title:' );?><br /> 14 <?php echo $html->input('Lesson/title', array("size" => 50, "maxlength" => 120, "class"=>"formas")); ?> 15 <?php echo $html->tagErrorMsg('Lesson/title', 'Title is required.'); ?> 16 <br /><br /> 17 18 <p><?php echo $form->labelTag( 'Lesson/body', 'Body:' );?><br /> 19 <?php echo $html->textarea('Lesson/body', array("class"=>"formas", "cols"=>80, "rows"=>45)) ?> 20 <?php echo $fck->load('Lesson/body', 'Karamelo'); ?> 21 <?php echo $html->tagErrorMsg('Lesson/body', 'Body is required.'); ?> 22 <br /> 23 </p> 24 25 <p><?php echo $form->labelTag( 'Lesson/status', 'Published:' );?><br /> 26 <?php echo $html->checkbox('Lesson/status'); ?> 27 <br /><br /> 28 29 <p><?php echo $form->labelTag( 'Lesson/disc', 'Comments allowed to this Lesson:' );?><br /> 30 <?php echo $html->checkbox('Lesson/disc'); ?> 31 <br /><br /> 32 33 <?php echo $html->hiddenTag('Lesson/user_id', $othAuth->user('id')) ?> 34 35 36 <br /> 37 <?php echo $html->submit('Send'); ?> 8 <legend>Add Lesson</legend> 9 <table> 10 <tr><td> 11 <?php 12 echo $form->labelTag( 'Lesson/title', 'Title:' ); 13 echo $html->input('Lesson/title', array("size" => 50, "maxlength" => 120, "class"=>"formas")); 14 echo $html->tagErrorMsg('Lesson/title', 'Title is required.'); 15 ?> 16 </td> 17 <td> 18 <?php echo $html->link($html->image('admin/myimages.jpg', array("alt"=>"My Images", "title"=>"My Images")), '#', array("onclick"=>"javascript:window.open('/admin/images/listing/set', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=500')"), null, false) ?> 19 </td> 20 </tr> 21 <tr> 22 <td colspan="2"> 23 <?php 24 echo $form->labelTag( 'Lesson/body', 'Body:' ); 25 echo $html->textarea('Lesson/body', array("class"=>"formas", "cols"=>80, "rows"=>45)); 26 echo $fck->load('Lesson/body', 'Karamelo'); 27 echo $html->tagErrorMsg('Lesson/body', 'Body is required.'); 28 ?> 29 </td></tr> 30 <tr><td> 31 <?php 32 echo $form->labelTag( 'Lesson/status', 'Published:' ); 33 echo $html->checkbox('Lesson/status'); 34 ?> 35 </td><td> 36 <?php 37 echo $form->labelTag( 'Lesson/disc', 'Comments allowed to this Lesson:' ); 38 echo $html->checkbox('Lesson/disc'); 39 ?> 40 </td></tr> 41 <tr><td colspan="2"> 42 <?php echo $html->submit('Save'); ?> 43 </td></tr> 44 </table> 38 45 </fieldset> 39 46 </form>
