Changeset 358
- Timestamp:
- 04/01/08 15:19:30 (9 months ago)
- Location:
- trunk/app
- Files:
-
- 6 modified
-
controllers/comments_controller.php (modified) (2 diffs)
-
controllers/podcasts_controller.php (modified) (7 diffs)
-
controllers/tests_controller.php (modified) (3 diffs)
-
views/comments/admin_listing.ctp (modified) (1 diff)
-
views/podcasts/admin_add.ctp (modified) (1 diff)
-
views/tests/admin_questions.ctp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/comments_controller.php
r339 r358 78 78 } 79 79 80 /** 81 ===== ADMIN METHODS -=========== 82 **/ 80 /** ===== ADMIN METHODS ====== **/ 83 81 84 82 public function admin_listing() … … 121 119 public function admin_delete($id) 122 120 { 123 if ($this->Comment->del($id))121 if ($this->Comment->del($id)) 124 122 { 125 123 $this->msgFlash('Comment deleted', '/admin/comments/listing'); -
trunk/app/controllers/podcasts_controller.php
r349 r358 50 50 51 51 $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit)); 52 } 52 } 53 53 54 public function rss($username) 54 55 { … … 94 95 } 95 96 96 /*********** 97 ====ADMIN METHODS==== 98 ***/ 99 100 public function admin_listing() 101 { 97 /****** ====ADMIN METHODS==== ***/ 98 99 public function admin_listing() 100 { 102 101 $this->pageTitle = $this->Auth->user('username') . '\'s Podcasts'; 103 102 … … 110 109 111 110 $this->set('data', $this->Podcast->findAll($conditions, $fields, $order, $limit, null, 1)); 112 }113 114 public function admin_add()115 {111 } 112 113 public function admin_add() 114 { 116 115 117 116 $this->layout = 'admin'; 117 118 $this->set('subjects', Set::combine($this->Podcast->Subject->find('all', array('order' => 'title')), "{n}.Subject.id","{n}.Subject.title")); 118 119 119 120 if (!empty($this->data["Podcast"]) && is_uploaded_file($this->data['Podcast']['file']['tmp_name'])) … … 164 165 if ( $podfile_size > $maxfilesize) 165 166 { 166 $ErrMsg = "<h1>ERROR</h1> The image is too big.<br>";167 $ErrMsg .= "<p>Bigger than 10.0 MB <br><br>";168 $ErrMsg .= "The current size: " . $podfile_size ."</p>\n";167 $ErrMsg = "<h1>ERROR</h1> The image is too big.<br>"; 168 $ErrMsg .= "<p>Bigger than 10.0 MB <br><br>"; 169 $ErrMsg .= "The current size: " . $podfile_size ."</p>\n"; 169 170 170 171 /** delete uploaded file */ … … 179 180 $order = "Podcast.id DESC"; 180 181 181 $current_id = $this->Podcast->field($field, $conditions, $order);182 183 $next_id = ($current_id + 1);182 $current_id = $this->Podcast->field($field, $conditions, $order); 183 184 $next_id = ($current_id + 1); 184 185 185 186 $extension = $this->get_extension($podfile_name); … … 230 231 if ($this->Podcast->save($this->data)) 231 232 { 232 $this-> flash('Your podcast has been saved.','/podcasts/listing');233 $this->msgFlash('Your podcast has been saved.','/podcasts/listing'); 233 234 } 234 235 … … 239 240 } 240 241 242 public function admin_edit($podcast_id=null) 243 { 244 $this->set('subjects', Set::combine($this->Podcast->Subject->find('all',array('order'=>'title')),'{n}.Subject.id','{n}.Subject.title')); 245 } 246 public function admin_delete($podcast_id) 247 { 248 if ( $this->Podcast->delete( $podcast_id )) 249 { 250 $this->msgFlash('Podcast removed', '/admin/podcast/listing'); 251 } 252 } 241 253 } 242 254 ?> -
trunk/app/controllers/tests_controller.php
r328 r358 3 3 * Karamaelo E-Learning Platform 4 4 * Chipotle Software 2002-2008 5 * GPLv3 manuel<a t>mononeurona<dot>org5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 6 */ 7 7 //File: /app/controllers/tests_controller.php … … 14 14 15 15 public $components = array('Edublog'); 16 16 17 public function beforeFilter() 18 { 19 $this->Auth->allow(array('view', 'display')); 20 parent::beforeFilter(); 21 } 22 17 23 public function isAuthorized() 18 { var_dump($this->params);24 { 19 25 if (isset( $this->params[Configure::read('Routing.admin')] )) 20 26 { 21 27 if ($this->Auth->user('group_id') == 1 || $this->Auth->user('group_id') == 2 ) // admin and teachers 22 28 { 23 return true;29 return true; 24 30 } 25 else 31 else 26 32 { 27 33 return false; … … 30 36 return false; // go away !! 31 37 } 32 38 33 39 public function display($username, $user_id) 34 40 { -
trunk/app/views/comments/admin_listing.ctp
r269 r358 1 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Comments', '/admin/comments/listing'); 4 echo $html->getCrumbs(' / '); 5 ?> 6 7 <div class="title_section"> Comments on your Blog </div> 8 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Comments', '/admin/comments/listing'); 4 echo $html->getCrumbs(' / '); 5 6 echo $html->div('title_section', 'Comments on your Blog'); 9 7 10 8 foreach ($data as $val) 11 9 { 12 echo '<div style="border:1px dotted gray;padding:4px;margin:2px">'; 13 echo $html->link($val['Entry']['title'], '/users/entry/'. $othAuth->user('username') . '/'.$val['Entry']['id']) . '<br />'; 14 echo $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 15 echo '<p>'.$val['Comment']['comment'] . '</p>'; 16 echo '<p>'. $gags->sendEdit($val['Comment']['id'], 'comments') . ' '. $gags->confirmDel($val['Comment']['id'], 'comments') .'</p>'; 17 echo '</div>'; 10 $tmp = $html->link($val['Entry']['title'], '/users/entry/'. $cU['User']['username'] . '/'.$val['Entry']['id']) . '<br />'; 11 $tmp .= $val['Comment']['created'].' <b>'.$val['Comment']['username'].' wrote:</b><br />'; 12 $tmp .= $html->para(null, $val['Comment']['comment']); 13 $tmp .= $gags->confirmDel($val['Comment']['id'], 'Comment'); 14 echo $html->div(null, $tmp); 18 15 } 19 16 ?> -
trunk/app/views/podcasts/admin_add.ctp
r272 r358 1 <?php echo $javascript->link('myfunctions'); ?>2 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>3 <?php echo $html->addCrumb('Podcasts', '/admin/podcasts/listing'); ?> 4 <?php echo $html->getCrumbs(' / '); ?> 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Podcasts', '/admin/podcasts/listing'); 4 echo $html->getCrumbs(' / '); 5 5 6 <div class="title_section">Add new podcast</div> 6 echo $html->div('title_section', 'Add new podcast'); 7 7 8 <div class="spaced"> 9 10 <?php echo $html->formTag('/admin/podcasts/add/','post', array("enctype"=>"multipart/form-data") ); ?> 8 echo $form->create('Podcast', array("enctype"=>"multipart/form-data") ); 9 ?> 11 10 12 11 <fieldset> 13 12 <legend>New podcast</legend> 14 <p>15 <?php echo $form->labelTag( 'Podcast/file', 'MP3 File:' );?><br />16 <?php echo $html->file('Podcast/file'); ?>17 <?php echo $html->tagErrorMsg('Podcast/file', 'Title is required.'); ?>13 14 <?php 15 echo $form->label('Podcast.file', 'MP3 File:'); 16 echo $form->file('Podcast.file'); 18 17 19 <?php echo $html->hiddenTag('Podcast/user_id', $othAuth->user('id')) ?> 20 </p> 21 <p> 22 <?php echo $form->labelTag( 'Podcast/status', 'Publish:' );?><br /> 23 <?php echo $html->checkbox('Podcast/status', null, array("onclick" => "showhide()")); ?> 24 <br /><br /></p> 18 echo $form->label('Podcast/status', 'Publish:'); 19 echo $form->checkbox('Podcast.status', array('value'=>1, 'onclick' => 'showhide()')); 25 20 26 <p>27 <?php echo $form->labelTag( 'Podcast/created', 'Created:' );?>28 <br />29 <?php21 echo $form->label('Podcast.created', 'Created:' ); 22 echo $form->day('Podcast.created', date("d"), null, false); 23 echo $form->month('Podcast.created', date("m"), null, false); 24 echo $form->year('Podcast.created', 1920, 2017, date("Y"), null, false); 30 25 31 echo $html->dayOptionTag('Podcast/created', null, date("d"), null, null, false); 32 33 echo $html->monthOptionTag('Podcast/created', null, date("m"), null, null, false); 34 35 echo $html->yearOptionTag('Podcast/created', null, 1920, 2017, date("Y"), null, null, false); 36 37 echo $form->labelTag( 'Podcast/subject_id', 'Subject:' ); 38 echo "<br />"; 39 40 echo $html->selectTag('Podcast/subject_id', $subjects, null, null, null, false); 26 echo $form->label( 'Podcast.subject_id', 'Subject:' ) .'<br />'; 27 echo $form->select('Podcast.subject_id', $subjects, null, null, null, false); 28 29 30 echo $form->input('Podcast.title', array("size" => 25, "maxlength" => 50)); 31 32 echo $form->label('Podcast.description', 'Description:'); 33 echo $form->textarea('Podcast.description', array("rows"=>10, "cols"=>40)) . '</fieldset>'; 34 35 echo $form->secure(); 36 echo $form->end('Upload'); 41 37 ?> 42 43 <br /><br />44 </p>45 <p>46 <?php echo $form->labelTag('Podcast/title', 'Title:' );?><br />47 <?php echo $html->input('Podcast/title', array("size" => 25, "maxlength" => 50, "class"=>"formas")); ?>48 <br /><br />49 </p>50 <p>51 <?php echo $form->labelTag('Podcast/description', 'Description:' );?><br />52 <?php echo $html->textarea('Podcast/description', array("rows"=>10, "cols"=>40)) ?>53 </p>54 <br />55 <?php echo $html->submit('Upload'); ?>56 </fieldset>57 </form>58 </div> -
trunk/app/views/tests/admin_questions.ctp
r264 r358 1 <?php 2 //die(print_r($data)); 3 if ( isset($javascript) ): 4 echo $html->charsetTag('UTF-8'); 5 echo $javascript->link('prototype'); 6 echo $javascript->link('scriptaculous.js?load=effects'); 7 endif; 1 <?php 2 echo $html->addCrumb('Control Tools', '/admin/entries/start'); 3 echo $html->addCrumb('Tests', '/admin/tests/listing'); 4 echo $html->getCrumbs(' / '); 5 6 echo $html->div('title_section', 'Tests'); 8 7 ?> 9 10 <?php echo $html->addCrumb('Control Tools', '/admin/entries/start'); ?>11 <?php echo $html->addCrumb('Tests', '/admin/tests/listing'); ?>12 <?php echo $html->getCrumbs(' / '); ?>13 14 <div class="title_section">Tests</div>15 8 <div id="loading" style="display: none;"> 16 9 <?php echo $html->image("static/loading.gif", array("alt"=>"Loading")); ?> 17 10 </div> 18 11 <?php 19 echo '<p><a href="/admin/tests/edit/'.$data['Test']['id'].'">Edit</a> ';12 echo $html->para(null, $html->link('Edit', '/admin/tests/edit/'.$data['Test']['id'])) . ' '; 20 13 echo $data['Test']['title'] . " " . $data['Test']['description']; 21 14 echo " ". count($data["Question"]) . " questions"; 15 16 echo $html->para(null, $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false)); 22 17 ?> 23 <p> 24 <?php echo $html->link($html->image('actions/new.png', array("alt"=>"Add new question", "title"=>"Add new question")), '#', array("onclick"=>"hU()"), false, false); ?> 25 </p> 26 18 <!-- Ajax form beggin --> 27 19 <div id="addquestion" style="display:none"> 28 29 <?php echo $ajax->form(null,'post'); ?> 30 <?php echo $html->hiddenTag('Question/test_id', $data['Test']['id']); ?> 20 <?php 21 echo $ajax->form(null,'post'); 22 echo $form->hidden('Question.test_id', array('value'=>$data['Test']['id'])); 23 ?> 31 24 <fieldset> 32 25 <legend>New question</legend> 26 <?php 27 echo $html->div('required', $form->input('Question.question', array("size" => 40, "maxlength" => 120))); 28 echo $html->div('required', $form->input('Question.hint', array("size" => 40, "maxlength" => 120))); 29 echo $html->div('required', $form->label('Question.explanation', 'Explanation:') . $form->textarea('Question.explanation', array("cols" => 50, "rows" => 5))); 33 30 34 <div class="required"> 35 <?php echo $form->labelTag( 'Question/question', 'Question' ); ?> 36 <?php echo $html->input('Question/question', array("size" => 40, "maxlength" => 120)); ?> 37 <?php echo $html->tagErrorMsg('Question/question', 'Question is required.'); ?> 38 </div> 39 <div class="required"> 40 <?php echo $form->labelTag( 'Question/hint', 'Hint:' ); ?> 41 <?php echo $html->input('Question/hint', array("size" => 40, "maxlength" => 120)); ?> 42 <?php echo $html->tagErrorMsg('Question/hint', 'Hint is required.'); ?> 43 </div> 31 $tmp = $form->label('Question.worth', 'Worth:'); 32 $tmp .= $form->select('Question.worth', array(1, 2, 3, 4, 5, 6,7, 8, 9, 10), null, null, false, false); 33 echo $html->div('required', $tmp); 44 34 45 <div class="required"> 46 <?php 47 echo $form->labelTag('Question/explanation', 'Explanation:' ); 48 echo $html->textarea('Question/explanation', array("cols" => 50, "rows" => 5)); 49 echo $html->tagErrorMsg('Question/explanation', 'explanation is required.'); 50 ?> 51 </div> 52 <div class="required"> 53 <?php 54 echo $form->labelTag('Question/worth', 'Worth:' ); 55 56 $temp = array(1, 2, 3, 4, 5, 6,7, 8, 9, 10); 57 58 echo $html->selectTag('Question/worth', $temp, null, null, false, false); 59 ?> 60 </div> 61 <div> 62 <?php 63 echo $ajax->submit('Add', array("url" => "/admin/questions/add", 35 echo $ajax->submit('Add', array("url" => "/admin/questions/add", 64 36 "update"=>"questions", 65 37 "loading" => "Element.hide('questions');Element.hide('addquestion');Element.show('loading')", … … 71 43 </form> 72 44 </div> 45 <!-- Ajax form ends --> 73 46 <?php 74 47 echo '<div id="questions">'; … … 78 51 $answers = count($val["Answer"]); 79 52 80 echo '<div style="padding:5px;border:1px dotted gray;margin: 4px;">';81 echo '<div class="butonright">' . $gags->sendEdit($val['id'], 'questions') . '</div>';82 echo '<div class="butonright">' . $gags->confirmDel($val['id'], 'questions') . '</div>';53 echo '<div style="padding:5px;border:1px dotted gray;margin:auto;">'; 54 echo $html->div('butonright', $gags->sendEdit($val['id'], 'Question')); 55 echo $html->div('butonright', $gags->confirmDel($val['id'], 'Question')); 83 56 echo "Question: " . $val["question"] . "<br />"; 84 57 echo "Hint: " . $val["hint"] . "<br />";
