Changeset 346
- Timestamp:
- 03/25/08 12:38:24 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 1 added
- 6 removed
- 9 modified
-
controllers/images_controller.php (modified) (2 diffs)
-
controllers/newsletters_controller.php (modified) (3 diffs)
-
controllers/vclassrooms_controller.php (modified) (3 diffs)
-
models/vclassroom.php (modified) (1 diff)
-
views/catforums/admin_add.ctp (deleted)
-
views/catforums/index.ctp (deleted)
-
views/entries/edit.ctp (deleted)
-
views/entries/index.ctp (deleted)
-
views/events/admin_edit.ctp (modified) (2 diffs)
-
views/images/admin_listview.ctp (modified) (1 diff)
-
views/newsletters/admin_add.ctp (modified) (1 diff)
-
views/newsletters/admin_edit.ctp (added)
-
views/tests/chk.ctp (modified) (1 diff)
-
views/vclassrooms/index.ctp (deleted)
-
views/vclassrooms/join.ctp (deleted)
-
views/vclassrooms/show.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/images_controller.php
r292 r346 183 183 } 184 184 185 /*** DELETE **/186 public function admin_delete()187 {185 /*** DELETE **/ 186 public function admin_delete() 187 { 188 188 $file = $this->Image->field("Image.file", array("Image.id"=>$this->data['Image']['id'])); 189 189 … … 194 194 unlink("../webroot/img/imgusers/thumbs/" . $file); 195 195 $this->redirect($this->data['Image']['return']); 196 }196 } 197 197 198 protected function createThumb($file)199 {198 protected function createThumb($file) 199 { 200 200 $imgfile = "../webroot/img/imgusers/" . $file; // system path 201 201 -
trunk/app/controllers/newsletters_controller.php
r328 r346 108 108 } 109 109 110 private function sendNewsletter($newsletter_id)110 private function _sendNewsletter($newsletter_id) 111 111 { 112 112 $conditions = array("Newsletter.status" => 1, "Newsletter.id" => $newsletter_id); … … 153 153 154 154 if (!empty($this->data['Newsletter'])) 155 { 155 { 156 156 $this->Sanitize = new Sanitize; 157 157 158 $this->Sanitize->paranoid($this->data["Newsletter"]["title"]); 159 160 $this->Sanitize->html($this->data["Newsletter"]["body"]); 161 162 $this->data["Newsletter"]['user_id'] = $this->Auth->user('id'); 163 164 $this->Newsletter->create(); 158 $this->Sanitize->paranoid($this->data['Newsletter']['title']); 159 160 $this->Sanitize->html($this->data['Newsletter']['body']); 165 161 166 162 if ($this->Newsletter->save($this->data['Newsletter'])) 167 { 168 $this->msgFlash('Newsletter saved', '/admin/newsletter/listing'); 163 { 164 if ( $this->data['Newsletter']['end'] == 1 ) 165 { 166 $this->msgFlash('Newsletter saved', '/admin/newsletters/listing'); 167 } 168 else 169 { 170 $this->msgFlash('Newsletter saved', '/admin/newsletters/edit/'.$this->data['Newsletter']['id']); 171 } 169 172 } 170 173 else … … 172 175 $this->flash('Database error!', '/news/listing'); 173 176 } 177 } 178 else 179 { 180 $this->data = $this->Newsletter->read(null, $newsletter_id); 174 181 } 175 182 } -
trunk/app/controllers/vclassrooms_controller.php
r328 r346 3 3 * Karamelo eLearning Platform 4 4 * Manuel Montoya 2002-2008 5 * GPLv3 manuel<a t>mononeurona<punto>org5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 … … 13 13 14 14 public $components = array('Edublog'); 15 15 16 public function beforeFilter() 17 { 18 $this->Auth->allow(array('show', 'jointoclass')); 19 parent::beforeFilter(); 20 } 16 21 public function isAuthorized() 17 22 { … … 70 75 } 71 76 72 //Check if the user already exist in the classroom 73 protected function chkMember($vclassroom_id) 74 { 75 $already_member = false; 76 77 $conditions = array('"Vclassroom"."id"'=>$vclassroom_id); 78 79 $data = $this->Vclassroom->find($conditions); 80 81 foreach ($data['User'] as $user) 82 { 83 if ($user['id'] == $this->Auth->user('id')) 84 { 85 $already_member = true; // yes, is already member 86 } 87 } 88 89 return $already_member; 90 } 91 92 93 /*** 94 == ADMIN METHODS 95 ***/ 77 /*** == ADMIN METHODS === ***/ 96 78 97 79 public function admin_listing() -
trunk/app/models/vclassroom.php
r340 r346 63 63 ) 64 64 ); 65 //Check if the user already exist in the classroom 66 protected function chkMember($vclassroom_id) 67 { 68 $already_member = false; 69 70 $conditions = array('"Vclassroom"."id"'=>$vclassroom_id); 71 72 $data = $this->find($conditions); 73 74 foreach ($data['User'] as $user) 75 { 76 if ($user['id'] == $this->Auth->user('id')) 77 { 78 $already_member = true; // yes, is already member 79 } 80 } 81 return $already_member; 82 } 65 83 66 84 public $validate = array( -
trunk/app/views/events/admin_edit.ctp
r314 r346 16 16 <table style="margin:0 auto 0 auto;"> 17 17 <tr><td> 18 <?php echo $html->formTag('/admin/entries/edit/','post'); ?> 19 <?php echo $html->hiddenTag('Entry/user_id', $othAuth->user('id')) ?> 20 <?php echo $html->hiddenTag('Entry/id') ?> 18 <?php echo $html->formTag('Event'); ?> 19 <?php echo $html->hiddenTag('Event.id') ?> 21 20 22 <?php echo $form->labelTag( 'E ntry/title', 'Title' );?><br />23 <?php echo $html->input('E ntry/title', array("size" => 40, "maxlength" => 50, "class"=>"formas")); ?>24 <?php echo $html->tagErrorMsg('E ntry/title', 'Title is required.'); ?>21 <?php echo $form->labelTag( 'Event.title', 'Title' );?><br /> 22 <?php echo $html->input('Event.title', array("size" => 40, "maxlength" => 50, "class"=>"formas")); ?> 23 <?php echo $html->tagErrorMsg('Event.title', 'Title is required.'); ?> 25 24 </td> 26 25 <td> 27 <?php echo $form->labelTag('E ntry/subject_id', 'Subject:' );?>28 <?php echo $html->selectTag('E ntry/subject_id', $subjects); ?>26 <?php echo $form->labelTag('Event.subject_id', 'Subject:' );?> 27 <?php echo $html->selectTag('Event.subject_id', $subjects); ?> 29 28 </td> 30 29 <td> … … 34 33 <tr> 35 34 <td colspan="3"> 36 <?php echo $form->labelTag( 'E ntry/Body', 'Body:' );?><br />37 <?php echo $html->textarea('E ntry/body', array("class"=>"formas", "cols"=>80, "rows"=>45)) ?>38 <?php echo $fck->load('E ntry/body', 'Karamelo'); ?>39 <?php echo $html->tagErrorMsg('E ntry/body', 'Body is required.'); ?>35 <?php echo $form->labelTag( 'Event.Body', 'Body:' );?><br /> 36 <?php echo $html->textarea('Event.body', array("class"=>"formas", "cols"=>80, "rows"=>45)) ?> 37 <?php echo $fck->load('Event.body', 'Karamelo'); ?> 38 <?php echo $html->tagErrorMsg('Event.body', 'Body is required.'); ?> 40 39 </td></tr> 41 40 <tr> 42 41 <td> 43 <?php echo $form->labelTag( 'E ntry/status', 'Published:' );?><br />44 <?php echo $html->checkbox('E ntry/status', null, array("value" => 1)); ?>42 <?php echo $form->labelTag( 'Event.status', 'Published:' );?><br /> 43 <?php echo $html->checkbox('Event.status', null, array("value" => 1)); ?> 45 44 </td> 46 45 <td> 47 <?php echo $form->labelTag( 'E ntry/discution', 'Comments allowed:' );?><br />48 <?php echo $html->checkbox('E ntry/discution', null, array("value" => 1)); ?>46 <?php echo $form->labelTag( 'Event.discution', 'Comments allowed:' );?><br /> 47 <?php echo $html->checkbox('Event.discution', null, array("value" => 1)); ?> 49 48 </td> 50 49 <td> 51 <?php echo $form->labelTag( 'E ntry/end', 'Finish edition:' );?><br />52 <?php echo $html->checkbox('E ntry/end', null, array("value" => 1)); ?>50 <?php echo $form->labelTag( 'Event.end', 'Finish edition:' );?><br /> 51 <?php echo $html->checkbox('Event.end', null, array("value" => 1)); ?> 53 52 </td> 54 53 </tr> 55 54 <tr> 56 55 <td colspan="3"> 57 <?php echo $html->submit('Save') ?> 58 </form> 56 <?php echo $form->end('Save'); ?> 59 57 </td> 60 58 </tr> -
trunk/app/views/images/admin_listview.ctp
r268 r346 42 42 <br /> 43 43 <?php 44 if ( $ othAuth->user('id')== $val['Image']['user_id'] )44 if ( $cU['User']['id'] == $val['Image']['user_id'] ) 45 45 { 46 echo $html->formTag('/admin/images/delete/'.$val['Image']['id'], 'post');47 echo $ html->hiddenTag('Image/return', '/admin/images/listing');48 echo $html->submit('Delete');49 echo "</form>";46 echo $form->create('Image', array('action'=>'admin_delete')); 47 echo $form->hidden('Image.return', array('value'=>'/admin/images/listing')); 48 echo $form->hidden('Image.id', array('value'=>$val['Image']['id'])); 49 echo $form->end('Delete'); 50 50 } 51 51 ?> -
trunk/app/views/newsletters/admin_add.ctp
r277 r346 1 <?php echo $javascript->link('myfunctions'); ?> 2 <?php echo $javascript->link('fckeditor/fckeditor'); ?> 1 <?php 2 echo $javascript->link('myfunctions'); 3 echo $javascript->link('fckeditor/fckeditor'); 3 4 4 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 5 <?php echo $html->addCrumb('Entries', '/admin/newsletters/listing'); ?> 6 <?php echo $html->getCrumbs(' / '); ?> 7 <?php echo $html->formTag('/admin/newsletters/add/','post'); ?> 5 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 6 echo $html->addCrumb('Entries', '/admin/newsletters/listing'); 7 echo $html->getCrumbs(' / '); 8 9 echo $form->create('Newsletter'); 10 ?> 8 11 9 12 <fieldset> 10 <legend>New n </legend>13 <legend>New newsletter</legend> 11 14 12 15 <table style="margin:0 auto 0 auto;"> 13 <tr> <td>14 15 <?php echo $form->labelTag('Newsletter/title', 'Title:' );?><br />16 <?php echo $html->input('Newsletter/title', array("size" => 50, "maxlength" => 50)); ?>17 <?php echo $html->tagErrorMsg('Newsletter/title', 'Title is required.');?>16 <tr> 17 <td> 18 <?php 19 echo $form->input('Newsletter.title', array("size" => 50, "maxlength" => 50)); 20 ?> 18 21 </td> 19 22 <td> 20 <?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) ?></p> 23 <?php 24 echo $html->link($html->image('admin/myimages.jpg', array("alt"=>"My Images", "title"=>"My Images")), 25 '#', 26 array("onclick"=>"javascript:window.open('/admin/images/listing/set', 'blank', 'toolbar=no, scrollbars=yes,width=700,height=500')"), null, false); ?></p> 21 27 </td> 22 28 </tr> 23 29 <tr><td colspan="2"> 24 <?php echo $form->labelTag( 'Newsletter/Body', 'Body:' );?><br /> 25 <?php echo $html->textarea('Newsletter/body', array("class"=>"formas", "cols"=>60, "rows"=>17)); ?> 26 <?php echo $fck->load('Newsletter/body', 'Karamelo'); ?> 27 <?php echo $html->tagErrorMsg('Newsletter/body', 'Body is required.'); ?> 30 <?php 31 echo $form->label('Newsletter.Body', 'Text:'); 32 echo $form->textarea('Newsletter.body', array("cols"=>60, "rows"=>17)); 33 echo $fck->load('NewsletterBody', 'Karamelo'); 34 ?> 28 35 </td> 29 36 </tr> 30 37 <tr> 31 38 <td> 32 <?php echo $form->labelTag( 'Newsletter/status', 'Published:' );?> 33 <?php echo $html->checkbox('Newsletter/status', null, array("value"=>1)); ?> 39 <?php 40 echo $form->label('Newsletter.status', 'Published:'); 41 echo $form->checkbox('Newsletter.status', null, array('value'=>1)); 42 ?> 34 43 </td> 35 44 <td> 36 <?php echo $form->labelTag( 'Newsletter/end', 'Finish edition:' );?><br /> 37 <?php echo $html->checkbox('Newsletter/end', null, array("value" => 1)); ?> 45 <?php 46 echo $form->label('Newsletter.end', 'Finish edition:' ); 47 echo $form->checkbox('Newsletter.end', array('value' => 1)); 48 ?> 38 49 </td> 39 50 </tr> 40 <tr><td colspan="2"> 41 <?php echo $ html->submit('Save'); ?>51 <tr><td colspan="2"></fieldset> 52 <?php echo $form->end('Save'); ?> 42 53 </td></tr> 43 54 </table> 44 </fieldset>45 </form> -
trunk/app/views/tests/chk.ctp
r264 r346 4 4 //die(print_r($data)); 5 5 6 if ( $othAuth->sessionValid() )6 if ( isset( $cU['User']['id'] ) ) 7 7 { 8 8 echo '<h1>'. $data['Test']['title'] . '</h1>'; 9 9 echo '<p>'. $data['Test']['description'] . '</p>'; 10 10 11 echo $ html->formTag('/tests/chk/','post', array("onsubmit"=>"return validateNew()"));12 echo $ html->hidden('Test/id', array("value"=>$data['Test']['id']));11 echo $form->create('/tests/chk/','post', array("onsubmit"=>"return validateNew()")); 12 echo $form->hidden('Test.id', array("value"=>$data['Test']['id'])); 13 13 14 14 foreach ($data['Question'] as $val) -
trunk/app/views/vclassrooms/show.ctp
r256 r346 13 13 echo $data['Ecourse']['description'] . "</p>"; 14 14 15 if ( $othAuth->user('group_id') ) // a student is login in so, show "Join" button15 if ( isset( $cU['User']['id'] ) ) // a student is login in so, show "Join" button 16 16 { 17 17 echo $ajax->form(); … … 23 23 echo $html->input('Vclassroom/code', array("size" => 6, "maxlength"=>6)); 24 24 25 echo $ajax->submit('Join to this class '. $othAuth->user('username'), array("url" => "/vclassrooms/jointoclass/",25 echo $ajax->submit('Join to this class '.$cU['User']['username'], array("url" => "/vclassrooms/jointoclass/", 26 26 "update"=>"updater", 27 27 "loading" => "Element.show('charging');Element.hide('updater')",
