Changeset 307
- Timestamp:
- 03/05/08 00:56:26 (10 months ago)
- Location:
- trunk/app
- Files:
-
- 10 modified
-
controllers/acquaintances_controller.php (modified) (7 diffs)
-
controllers/glossaries_controller.php (modified) (6 diffs)
-
controllers/quotes_controller.php (modified) (5 diffs)
-
controllers/users_controller.php (modified) (1 diff)
-
views/acquaintances/admin_edit.ctp (modified) (1 diff)
-
views/acquaintances/admin_listing.ctp (modified) (2 diffs)
-
views/entries/admin_edit.ctp (modified) (1 diff)
-
views/quotes/admin_edit.ctp (modified) (1 diff)
-
views/quotes/admin_listing.ctp (modified) (2 diffs)
-
views/vclassrooms/admin_edit.ctp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/acquaintances_controller.php
r302 r307 24 24 return false; // go away !! 25 25 } 26 26 27 27 public function display($username, $user_id) 28 28 { … … 36 36 37 37 $this->set('data', $this->Acquaintance->findAll($conditions)); 38 }38 } 39 39 40 40 /** ADMIN METHODS***/ … … 43 43 $this->layout = 'admin'; 44 44 45 $conditions = array("user_id" => $this-> othAuth->user('id'));45 $conditions = array("user_id" => $this->Auth->user('id')); 46 46 47 47 //$fields = array("id", "title", "description", "pubdate", "size"); … … 64 64 $this->Sanitize = new Sanitize; 65 65 66 $this->Sanitize->clean Array($this->data["Acquaintance"]);66 $this->Sanitize->clean($this->data["Acquaintance"]); 67 67 68 $this->data['Acquaintance']['user_id'] = $this-> othAuth->user('id');68 $this->data['Acquaintance']['user_id'] = $this->Auth->user('id'); 69 69 70 70 $this->Acquaintance->create(); … … 85 85 $this->Acquaintance->id = $id; 86 86 87 $this->Subject = new Subject;88 89 $this->set('subjects', $this->Subject->generateList());90 91 87 $this->data = $this->Acquaintance->read(); 92 88 } … … 95 91 $this->Sanitize = new Sanitize; 96 92 97 $this->Sanitize->clean Array($this->data["Acquaintance"]); //Hopefully this is enough93 $this->Sanitize->clean($this->data["Acquaintance"]); 98 94 99 95 if ($this->Acquaintance->save($this->data['Acquaintance'])) … … 114 110 $this->flash('Error, call support', '/admin/acquaintances/listing'); 115 111 } 116 }} 112 } 113 } 117 114 ?> -
trunk/app/controllers/glossaries_controller.php
r247 r307 3 3 * Karamelo E-Learning Platform 4 4 * Manuel Montoya 2002-2008 5 * GPL manuel<at>mononeurona.org5 * GPLv3 manuel<at>mononeurona.org 6 6 */ 7 7 … … 10 10 class GlossariesController extends AppController 11 11 { 12 public $helpers = array('Ajax', 'User', 'Fck', 'Gags');12 public $helpers = array('Ajax', 'User', 'Fck', 'Gags'); 13 13 14 14 public $components = array('Edublog'); 15 15 16 16 public function isAuthorized() 17 { 18 if ( $this->action == 'delete')19 {20 if ($this->Auth->user('group_id') == 1) 21 {17 { 18 if (isset( $this->params[Configure::read('Routing.admin')] )) 19 { 20 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ) // admin and teachers 21 { 22 22 return true; 23 } else { 24 return false; 25 } 26 } 27 28 return true; 23 } 24 } 25 return false; // go away !! 29 26 } 30 27 … … 48 45 $this->Edublog->blog($user_id); // blogger elements 49 46 } 50 51 47 52 48 /*** … … 60 56 $this->pageTitle = 'Glossary'; 61 57 62 $conditions = array("Glossary.catglossary_id"=>$catglossary_id, "Glossary.user_id"=>$this-> othAuth->user('id'));58 $conditions = array("Glossary.catglossary_id"=>$catglossary_id, "Glossary.user_id"=>$this->Auth->user('id')); 63 59 64 60 $fields = array("Glossary.id", "Glossary.item", "Glossary.definition", "Glossary.catglossary_id", "Catglossary.title"); … … 74 70 { 75 71 $this->layout = 'ajax'; 76 $this->set('catglossary_id', $catglossary_id);77 $this->render('new', 'ajax');72 $this->set('catglossary_id', $catglossary_id); 73 $this->render('new', 'ajax'); 78 74 } 79 75 … … 107 103 $this->set('catglossary_id', $catglossary_id); 108 104 109 if (!empty($this->data["Glossary"]))110 {105 if (!empty($this->data["Glossary"])) 106 { 111 107 $this->Sanitize = new Sanitize; 112 108 113 $this->Sanitize->clean Array($this->data["Glossary"]); //Hopefully this is enough109 $this->Sanitize->clean($this->data["Glossary"]); //Hopefully this is enough 114 110 115 $this->data["Glossary"]["user_id"] = $this->othAuth->user('id');111 $this->data["Glossary"]["user_id"] = $this->Auth->user('id'); 116 112 117 $this->Glossary->create();113 $this->Glossary->create(); 118 114 119 115 if ($this->Glossary->save($this->data["Glossary"])) 120 {116 { 121 117 $this->msgFlash('Item has been saved.','/admin/glossaries/listing/'.$this->data["Glossary"]["catglossary_id"]); 122 }123 118 } 124 } 119 } 120 } 125 121 126 122 public function admin_delete($id, $catglossary_id) -
trunk/app/controllers/quotes_controller.php
r247 r307 17 17 if (isset($this->params[Configure::read('Routing.admin')])) 18 18 { 19 if ($this->Auth->user('group_id') != 1) 20 { 21 return false; 22 } 23 } 24 return true; 25 } 26 19 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2) 20 { 21 return true; 22 } 23 } 24 return false; 25 } 27 26 28 27 public function admin_add() … … 32 31 $this->Sanitize = new Sanitize; 33 32 34 $this->Sanitize->clean Array($this->data); //Hopefully this is enough33 $this->Sanitize->clean($this->data); //Hopefully this is enough 35 34 36 $this->data['Quote']['user_id'] = $this-> othAuth->user('id');35 $this->data['Quote']['user_id'] = $this->Auth->user('id'); 37 36 38 37 if ( $this->Quote->save($this->data['Quote'])) … … 49 48 $this->pageTitle = 'Quotes'; 50 49 51 $conditions = array("user_id" => $this-> othAuth->user('id'));50 $conditions = array("user_id" => $this->Auth->user('id')); 52 51 $fields = array("id", "quote", "author"); 53 52 $order = "author DESC"; … … 70 69 $this->Sanitize = new Sanitize; 71 70 72 $this->Sanitize->clean Array($this->data);71 $this->Sanitize->clean($this->data); 73 72 74 73 if ($this->Quote->save($this->data)) … … 82 81 public function admin_delete($id) 83 82 { 84 // deletes task from database 85 //die($this->data['Quote']['id']); 86 $this->Quote->del($id); 87 $this->redirect('/admin/quotes/listing'); 88 exit(); 83 if ($this->Quote->del($id)) 84 { 85 $this->msgFlash('Quote deleted','/admin/quotes/listing'); 86 } 87 else 88 { 89 $this->flash('Error, call support', '/admin/quotes/listing'); 90 } 89 91 } 90 92 } -
trunk/app/controllers/users_controller.php
r292 r307 333 333 { 334 334 $this->layout = 'portal'; 335 335 336 336 $conditions = array("id"=>'>1', "id"=>"<5"); 337 337 338 338 $this->set('groups', Set::combine($this->User->Group->find('all'), "{n}.Group.id","{n}.Group.name")); 339 339 340 340 $this->Portal->statics(); // Using Portal components 341 341 } -
trunk/app/views/acquaintances/admin_edit.ctp
r256 r307 1 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 2 <?php echo $html->addCrumb('Links', '/admin/acquaintances/listing'); ?> 3 <?php echo $html->getCrumbs(' / '); ?> 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Links', '/admin/acquaintances/listing'); 4 echo $html->getCrumbs(' / '); 4 5 5 <?php echo $html->formTag('/admin/acquaintances/edit/','post'); ?> 6 7 <?php echo $html->hiddenTag('Acquaintance/id');?>6 echo $form->create('Acquaintance', array('action'=>'admin_edit')); 7 echo $form->hidden('Acquaintance.id'); 8 ?> 8 9 9 10 <fieldset> 10 11 <legend>Edit link</legend> 11 12 <?php 12 echo $form->labelTag('Acquaintance/name', 'Name:' ); 13 echo $html->input('Acquaintance/name', array("size" => 50, "maxlength" => 50)); 14 echo $html->tagErrorMsg('Acquaintance/name', 'Title is required.'); 13 echo $form->input('Acquaintance.name', array("size" => 50, "maxlength" => 50)); 14 echo $form->error('Acquaintance.name', 'Title is required.'); 15 15 ?> 16 <p> 16 17 17 <?php 18 echo $form->labelTag('Acquaintance/description', 'Description:'); 19 echo $html->textarea('Acquaintance/description', array("cols" => 40, "rows" =>4)); 20 ?> 21 </p> 22 <?php 23 echo $form->labelTag('Acquaintance/url', 'Link:' ); 24 echo $html->input('Acquaintance/url', array("size" => 65, "maxlength" => 220)); 25 echo $html->tagErrorMsg('Acquaintance/url', 'Link is required.'). '<br />'; 26 27 echo $html->submit('Save'); 18 echo $html->para(null, 19 $form->label('Acquaintance.description', 'Description:') . $form->textarea('Acquaintance.description', array("cols" => 40, "rows" =>4)) 20 ); 21 22 echo $form->input('Acquaintance.url', array("size" => 65, "maxlength" => 220)); 23 echo $form->error('Acquaintance.url', 'Link is required.'). '<br />'; 24 echo '</fieldset>'; 25 echo $form->end('Save'); 28 26 ?> 29 </fieldset>30 </form>31 -
trunk/app/views/acquaintances/admin_listing.ctp
r256 r307 4 4 ?> 5 5 6 <div class="title_section"><?php echo $ othAuth->user('username'); ?>'s Acquaintances</div>6 <div class="title_section"><?php echo $cU['User']['username']; ?>'s Acquaintances</div> 7 7 8 8 <script type="text/javascript"> … … 25 25 26 26 <div id="trh" style="margin:0;padding:0;padding-left:40px;width:80%;display:none;"> 27 <?php echo $ html->formTag('/admin/acquaintances/add/','post'); ?>27 <?php echo $form->create('Acquaintance', array('action'=>'admin_add')); ?> 28 28 <fieldset> 29 29 <legend>New Acquaintance</legend> 30 <?php echo $form->labelTag('Acquaintance/name', 'Site:'); ?><br /> 31 <?php echo $html->input('Acquaintance/name', array("size" => 30, "maxlength"=>50)); ?> 32 <?php echo $html->tagErrorMsg('Acquaintance/name', 'A name is required.'); ?> 30 <?php 31 echo $form->label('Acquaintance.name', 'Site:') . '<br />'; 32 echo $form->input('Acquaintance.name', array("size" => 30, "maxlength"=>50)); 33 echo $form->error('Acquaintance.name', 'A name is required.'); 34 ?> 33 35 <br /><br /> 34 36 <p> 35 37 <?php 36 echo $form->label Tag('Acquaintance/description', 'Description:');37 echo $ html->textarea('Acquaintance/description', array("cols" => 40, "rows" =>3));38 echo $form->label('Acquaintance.description', 'Description:'); 39 echo $form->textarea('Acquaintance.description', array("cols" => 40, "rows" =>3)); 38 40 ?> 39 41 </p> 40 42 <?php 41 echo $form->label Tag('Acquaintance/url', 'URL:') . "<br />";42 echo $ html->input('Acquaintance/url', array("size" => 60, "maxlength"=>300, "value"=>"http://"));43 echo $ html->tagErrorMsg('Acquaintance/url', 'An author is required.');43 echo $form->label('Acquaintance.url', 'URL:') . '<br />'; 44 echo $form->input('Acquaintance.url', array("size" => 60, "maxlength"=>300, "value"=>"http://")); 45 echo $form->error('Acquaintance.url', 'An author is required.'); 44 46 ?> 45 47 46 48 <div style="clear:both"></div> 47 <?php echo $html->submit('Add') ?>48 </fieldset>49 </fieldset> 50 <?php echo $form->end('Save'); ?> 49 51 </form> 50 52 51 53 </div> 52 54 <?php $session->flash(); ?> 55 53 56 <table style="width:100%"> 54 57 <?php -
trunk/app/views/entries/admin_edit.ctp
r301 r307 10 10 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 11 11 echo $html->addCrumb('Entries', '/admin/entries/listing'); 12 echo $html->getCrumbs(' / ');12 echo $html->getCrumbs(' / '); 13 13 ?> 14 14 -
trunk/app/views/quotes/admin_edit.ctp
r272 r307 1 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 2 <?php echo $html->addCrumb('Quote', '/admin/quotes/listing'); ?> 3 <?php echo $html->getCrumbs(' / '); ?> 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Quote', '/admin/quotes/listing'); 4 echo $html->getCrumbs(' / '); 4 5 5 <?php echo $html->formTag('/admin/quotes/edit/','post'); ?> 6 echo $form->create('Quote', array('url' => 'quotes/admin_edit')); 7 echo $form->hidden('Quote.id'); 8 ?> 9 <fieldset> 10 <legend>Edit quote</legend> 11 <?php 12 echo $form->input('Quote.quote', array("size" => 60, "maxlength" => 150)); 13 echo $form->error('Quote.quote', 'Title is required.'); 14 15 echo $form->input('Quote.author', array("size" => 25, "maxlength" => 70)); 16 echo $form->error('Quote.author', 'Author is required.'); 6 17 7 <?php echo $html->hiddenTag('Quote/id'); ?> 18 echo '</fieldset>'; 19 echo $form->end('Save'); 20 ?> 8 21 9 <fieldset>10 <legend>Edit new</legend>11 <?php12 echo $form->labelTag( 'Quote/quote', 'Quote:' );13 echo $html->input('Quote/quote', array("size" => 60, "maxlength" => 150));14 echo $html->tagErrorMsg('Quote/quote', 'Title is required.');15 16 echo $form->labelTag( 'Quote/quote', 'Author:' );17 echo $html->input('Quote/author', array("size" => 25, "maxlength" => 70));18 echo $html->tagErrorMsg('Quote/author', 'Author is required.');19 ?>20 21 <?php echo $html->submit('Send'); ?>22 </fieldset>23 </form>24 -
trunk/app/views/quotes/admin_listing.ctp
r272 r307 1 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?> 2 <?php echo $html->getCrumbs(' / '); ?> 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->getCrumbs(' / '); 4 ?> 3 5 4 6 <div class="title_section">Quick News</div> … … 20 22 </script> 21 23 22 <p><?php echo $html->link($html->image('admin/new.gif', array("alt"=>"Add new", "title"=>"Add new")), '#', array("onclick"=>"hU()"), false, false); ?></p> 24 <?php 25 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new", "title"=>"Add new")), '#', array("onclick"=>"hU()"), false, false)); ?> 23 26 24 27 <div id="trh" style="margin:0;padding:0;padding-left:40px;width:80%;display:none;"> 25 <?php echo $ html->formTag('/admin/quotes/add/','post'); ?>28 <?php echo $form->create('Quote', array('action'=>'admin_add')); ?> 26 29 <fieldset> 27 <legend>New quote</legend >28 <?php echo $form->labelTag('Quote/quote', 'Quote:'); ?><br />29 <?php echo $html->input('Quote/quote', array("size" => 60, "maxlength"=>130)); ?>30 <?php echo $html->tagErrorMsg('Quote/quote', 'A quote is required.'); ?>30 <legend>New quote</legend 31 <?php 32 echo $form->input('Quote.quote', array("size" => 60, "maxlength"=>130)); 33 echo $form->error('Quote.quote', 'A quote is required.'); 31 34 32 <?php echo $form->labelTag('Quote/author', 'Author:') . "<br />"; ?>33 <?php echo $html->input('Quote/author', array("size" => 60, "maxlength"=>130)); ?>34 <?php echo $html->tagErrorMsg('Quote/author', 'An author is required.');?>35 echo $form->input('Quote/author', array("size" => 60, "maxlength"=>130)); 36 echo $form->error('Quote.author', 'An author is required.'); 37 ?> 35 38 36 39 <div style="clear:both"></div> 37 <?php echo $html->submit('Add') ?>38 40 </fieldset> 39 </form>41 <?php echo $form->end('Save'); ?> 40 42 41 43 </div> -
trunk/app/views/vclassrooms/admin_edit.ctp
r256 r307 6 6 echo $html->getCrumbs(' / '); 7 7 8 echo $ html->formTag('/admin/vclassrooms/edit','post', array("onsubmit"=>"chkForm()"));9 echo $ html->hidden('Vclassroom/id');8 echo $form->create('Vclassroom',array('action'=>'admin_edit', "onsubmit"=>"chkForm()")); 9 echo $form->hidden('Vclassroom.id'); 10 10 ?> 11 11 … … 13 13 <legend>New Group</legend> 14 14 <p> 15 <?php echo $form->labelTag('Vclassroom/name', 'Name:' );?> 16 <?php echo $html->input('Vclassroom/name', array("size" => 40, "maxlength" => 60)); ?> 17 <?php echo $html->tagErrorMsg('Vclassroom/name', 'A name is required.'); ?> 15 <?php 16 echo $form->input('Vclassroom.name', array("size" => 40, "maxlength" => 60)); 17 echo $form->error('Vclassroom.name', 'A name is required.'); 18 ?> 18 19 </p><br /> 19 20 20 <label>Activate classroom:</label><br /> 21 <?php echo $html->checkbox('Vclassroom/status', null, array("value"=>1)); ?> 21 22 <?php 23 echo $form->label('Vclassroom.status', 'Status:'); 24 echo $form->checkbox('Vclassroom.status', array("value"=>1)); 25 ?> 22 26 <br /></p> 23 27 … … 38 42 ?> 39 43 40 <label>Members only by invitation:</label><br /> 41 <?php echo $html->checkbox('Vclassroom/access', null, $attr); ?> 44 45 <?php 46 echo $form->label('Vclassroom.access', 'Members only by invitation:'); 47 echo $form->checkbox('Vclassroom.access', $attr); 48 ?> 42 49 <br /><br /> 43 50 … … 45 52 46 53 <div id="invi_code" style="display:<?php echo $display; ?>;"> 47 <label>CODE:</label> 48 <?php echo $html->input('Vclassroom/secret', array("size" => 5, "maxlength" => 6)); ?> 54 <?php 55 echo $form->label('Vclassroom.secret', 'CODE:'); 56 echo $html->input('Vclassroom.secret', array("size" => 5, "maxlength" => 6)); 57 ?> 49 58 <br /><br /> 50 59 </div> 51 60 <div style="clear:both"></div> 52 <br /> 53 <?php echo $html->submit('Save'); ?> 54 </fieldset> 55 </form> 61 <br /></fieldset> 62 <?php echo $form->end('Save'); ?> 56 63 57 64 <script type="text/javascript">
