Changeset 637
- Timestamp:
- 07/10/08 17:53:04 (3 months ago)
- Location:
- trunk/app
- Files:
-
- 8 modified
-
controllers/entries_controller.php (modified) (7 diffs)
-
controllers/lessons_controller.php (modified) (2 diffs)
-
controllers/users_controller.php (modified) (1 diff)
-
locale/spa/LC_MESSAGES/default.po (modified) (2 diffs)
-
views/entries/admin_listing.ctp (modified) (2 diffs)
-
views/layouts/rubyx.ctp (modified) (1 diff)
-
views/lessons/admin_listing.ctp (modified) (1 diff)
-
views/lessons/display.ctp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/controllers/entries_controller.php
r635 r637 11 11 12 12 uses('sanitize'); 13 uses('l10n'); 13 14 14 15 15 class EntriesController extends AppController { … … 126 126 $this->Entry->create(); 127 127 128 if ($this->Entry->save($this->data ["Entry"])):128 if ($this->Entry->save($this->data)): 129 129 if ( $this->data["Entry"]["end"] == 1 ): // edition ends 130 $this->msgFlash( 'Story has been added', '/admin/entries/listing');130 $this->msgFlash(__('Entry saved', true), '/admin/entries/listing'); 131 131 132 132 else: //edition continue 133 133 $id = $this->Entry->getLastInsertID(); 134 $this->msgFlash( 'Story has been added', '/admin/entries/edit/'.$id);134 $this->msgFlash(__('Entry saved', true), '/admin/entries/edit/'.$id); 135 135 endif; 136 136 endif; … … 149 149 $this->layout = 'admin'; 150 150 151 $conditions = array("Entry.user_id"=>$this->Auth->user('id')); 152 153 $fields = null; 154 155 $order = 'Entry.id DESC'; 156 157 $limit = 20; 158 159 $this->set('data', $this->Entry->findAll($conditions, $fields, $order, $limit)); 151 $this->paginate['limit'] = 10; 152 153 $this->paginate['fields'] = array('Entry.title', 'Entry.body', 'Entry.created', 'Entry.status', 'Entry.user_id', 'Entry.discution', 'Entry.subject_id', 'Entry.id', 'User.username', 'Subject.title', 'Subject.id'); 154 155 $this->paginate['conditions'] = array("Entry.user_id"=>$this->Auth->user('id')); 156 157 $data = $this->paginate('Entry'); 158 159 $this->set(compact('data')); 160 160 161 } 161 162 … … 166 167 $this->set('subjects',Set::combine($this->Entry->Subject->find('all',array('order'=>'title')),"{n}.Subject.id","{n}.Subject.title")); 167 168 168 if (empty($this->data['Entry'])) 169 { 170 $this->data = $this->Entry->read(null, $id); 171 } 172 else 173 { 169 if (empty($this->data['Entry'])): 170 $this->data = $this->Entry->read(null, $id); 171 else: 174 172 $this->Sanitize = new Sanitize; 175 173 … … 182 180 $this->redirect('/admin/entries/listing'); 183 181 else: 184 $this->msgFlash( 'Entry has been updated','/admin/entries/edit/'.$this->data['Entry']['id']);182 $this->msgFlash(__('Entry saved', true),'/admin/entries/edit/'.$this->data['Entry']['id']); 185 183 endif; 186 184 endif; 187 }185 endif; 188 186 } 189 187 // change status enabled/disabled actived … … 195 193 196 194 if ($this->Entry->save($this->data['Entry'])): 197 $this->msgFlash( 'Entry status changed', '/admin/entries/listing');195 $this->msgFlash(__('Status modified', true), '/admin/entries/listing'); 198 196 endif; 199 197 } … … 210 208 { 211 209 if ( $this->Entry->del($id)): 212 $this->msgFlash( 'The entry has been deleted.', '/admin/entries/listing');210 $this->msgFlash(__('Data deleted',true), '/admin/entries/listing'); 213 211 endif; 214 212 } -
trunk/app/controllers/lessons_controller.php
r632 r637 17 17 18 18 public $components = array('Edublog'); 19 20 public $paginate = array('limit' => 20, 'page' => 1); 19 21 20 22 public function beforeFilter() … … 45 47 public function display($username) 46 48 { 47 $user_id = $this->Lesson->User->field('id', array('User.username'=>$username));49 $user_id = $this->Lesson->User->field('id', array('User.username'=>$username)); 48 50 49 $this->pageTitle = $username .'\'s Lessons';51 $this->pageTitle = $username .'\'s Lessons'; 50 52 51 $conditions = array("Lesson.status"=>1, "Lesson.user_id"=>$user_id); 53 $this->paginate['conditions'] = array('Lesson.status'=>1, 'Lesson.user_id'=>$user_id); 54 55 $this->paginate['fields'] = array("id", "title", "created", "user_id"); 56 57 $this->paginate['order'] = array('Lesson.title' => 'DESC'); 58 59 $data = $this->paginate('Lesson'); 60 61 $this->set(compact('data')); 62 63 $this->layout = $this->Edublog->layout($user_id); 52 64 53 $fields = array("id", "title", "created", "user_id"); 54 55 $order = "Lesson.title"; 56 57 $this->set('data', $this->Lesson->findAll($conditions, $fields, $order)); 58 59 $this->layout = $this->Edublog->layout($user_id); 60 61 $this->Edublog->blog($user_id); // blogger elements 62 } 65 $this->Edublog->blog($user_id); // blogger elements 66 } 63 67 64 68 /*** === ADMIN METHODS ****/ -
trunk/app/controllers/users_controller.php
r635 r637 572 572 public function admin_backup() 573 573 { 574 $this->layout = 'admin'; 575 576 $conditions = array("User.id"=>$this->Auth->user('id')); 577 578 $this->User->unbindModel(array('hasMany' => array('Confirm'))); 579 580 $this->User->bindModel( 581 array('hasMany' => array( 582 'Image' => array( 583 'className' => 'Image' 584 ) 585 ) 586 ) 587 ); 588 589 $this->set('data', $this->User->find($conditions)); 574 575 $output_file = sprintf($DB_NAME."_%s.db", date("Ymd-hi")); 576 $DB_EXPORT_PATH =''; 577 system("pg_dump -u ".$DB_NAME." < ".AUTH_USER_FILE_PATH." > ".DB_EXPORT_PATH.$output_file); 578 $this->autoRender = false; 579 Configure::write('debug', 0); 580 header("Content-disposition: attachment; filename=".$output_file); 581 header("Content-type: application/octet-stream; name=".$output_file); 582 $result = file_get_contents(DB_EXPORT_PATH.$output_file); 583 print($result); 584 return true; 590 585 } 591 586 -
trunk/app/locale/spa/LC_MESSAGES/default.po
r635 r637 17 17 msgstr "Eliminar" 18 18 19 msgid "Date deleted" 20 msgstr "Registro eliminado" 21 19 22 msgid "Layout" 20 23 msgstr "Diseño" … … 106 109 msgid "Edit Entry" 107 110 msgstr "Editar entrada" 111 112 msgid "Entry saved" 113 msgstr "Entrada guardada" 108 114 109 115 msgid "Entry" -
trunk/app/views/entries/admin_listing.ctp
r633 r637 1 <script type="text/javascript">2 window.onload = timedMsg;3 </script>4 1 <?php 5 2 //die(debug($session->read('Auth.User.email'))); 6 7 $session->flash();8 3 9 4 echo $html->addCrumb('Control Panel', '/admin/entries/start'); … … 34 29 </table> 35 30 36 <?php 31 <?php 32 $paginator->options(array('url' => $val['User']['username'])); 37 33 38 //echo $pagination; 34 $t = $html->div(null,$paginator->prev('« '.__('Previous', true),null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 35 $t .= $html->div(null,$paginator->next(__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 36 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 37 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 39 38 ?> -
trunk/app/views/layouts/rubyx.ctp
r634 r637 55 55 <?php 56 56 57 echo ($this->action == ' blog' || $this->action == 'entry') ? '<li id="active">' : '<li>'; ?>57 echo ($this->action == 'display' || $this->action == 'entry') ? '<li id="active">' : '<li>'; ?> 58 58 <a href="/blog/<?php echo $blog['User']['username'] ?>">eduBlog<span class="tab-l"></span><span class="tab-r"></span></a></li> 59 59 -
trunk/app/views/lessons/admin_listing.ctp
r625 r637 29 29 </table> 30 30 31 <?php //echo $pagination; 31 <?php 32 $t = $html->div(null,$paginator->prev('« '.__('Previous', true),null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 33 $t .= $html->div(null,$paginator->next(__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 34 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 35 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 32 36 ?> 33 37 -
trunk/app/views/lessons/display.ctp
r559 r637 1 <h2>Lessons</h2>2 1 <?php 3 //die(print_r($data)); 2 //die(debug($blog)); 3 echo $html->div('title_section', __('Lessons', true)); 4 4 5 5 if ( count($data) < 1 ): … … 10 10 echo $html->para(null, $html->link($v['Lesson']['title'], '/lessons/view/'.$blog['User']['username'].'/'.$v['Lesson']['id'], array("class"=>"title"))); 11 11 endforeach; 12 13 $paginator->options(array('url' => $blog['User']['username'])); 14 15 $t = $html->div(null,$paginator->prev('« '.__('Previous', true),null,null,array('class'=>'disabled')),array('style'=>'width:100px;float:left')); 16 $t .= $html->div(null,$paginator->next(__('Next', true).' »', null, null, array('class' => 'disabled')),array('style'=>'width:100px;float:right')); 17 $t .= $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 18 echo $html->div(null,$t, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 12 19 ?>
