Changeset 345
- Timestamp:
- 03/13/10 11:14:02 (23 months ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
controllers/shares_controller.php (modified) (2 diffs)
-
views/shares/admin_listing.ctp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/controllers/shares_controller.php
r329 r345 33 33 endif; 34 34 35 $fields = array('id', 'title', 'description', 'created', 'lenght', 'user_id', 'filename'); 36 $order = 'id DESC'; 37 $limit = 12; 35 $params = array( 36 'conditions' => $conditions, 37 'fields' => array('id', 'title', 'description', 'created', 'lenght', 'user_id', 'filename'), 38 'order' => 'id DESC', 39 'limit' => 12 40 ); 38 41 39 42 $this->set('data', $this->Share->find('all', $params)); 40 43 } 41 44 42 public function show($user_id, $id) 45 /** 46 * @param mixed Null or string $username 47 * @param mixed Null or integer $entry_id 48 * @access public 49 * @return void 50 */ 51 public function show($user_id, $share_id) 43 52 { 44 53 $this->layout = $this->Edublog->layout($user_id); 45 54 $this->set('blog', $this->Edublog->blog($user_id)); 46 55 $this->pageTitle = 'Share'; 47 $params = array('conditions' => array('Share.id'=>$ id, 'Share.status'=>1),56 $params = array('conditions' => array('Share.id'=>$share_id, 'Share.status'=>1), 48 57 'fields' => array('id', 'title', 'description', 'created', 'filename', 'length', 'size', 'duration')); 49 $this->set('data', $this->Share->find(' all',$params));58 $this->set('data', $this->Share->find('first',$params)); 50 59 } 51 60 52 61 /** 53 * 54 * 62 * @param mixed Null or string $username 63 * @param mixed Null or integer $entry_id 64 * @access public 65 * @return void 55 66 */ 56 public function all($username= null, $entry_id=null)67 public function all($username=Null, $entry_id=Null) 57 68 { 58 69 $this->pageTitle = $username . '\'s Share'; … … 81 92 } 82 93 83 /****==== ADMIN METHODS ====**/ 84 public function admin_listing() 85 { 86 $this->layout = 'admin'; 87 $this->pageTitle = $this->Auth->user('username') . '\'s Shares'; 88 89 $params = array('conditions' => array('Share.user_id'=>$this->Auth->user('id')), 90 'fields' => array('id', 'file', 'created', 'public', 'description'), 91 'order' => 'Share.id DESC', 92 'limit' => 20); 93 94 $this->set('data', $this->Share->find('all', $params)); 94 /****==== ADMIN METHODS ====**/ 95 public function admin_listing() 96 { 97 $this->layout = 'admin'; 98 $this->pageTitle = $this->Auth->user('username') . '\'s Shares'; 99 $this->paginate['limit'] = 20; 100 $this->paginate['fields'] = array('Share.id', 'Share.file', 'Share.description', 'Share.public', 'Share.created'); 101 $this->paginate['conditions'] = array('Share.user_id'=>$this->Auth->user('id')); 102 $this->paginate['order'] = 'Share.id DESC'; 103 $data = $this->paginate('Share'); 104 $this->set(compact('data')); 95 105 } 96 106 -
trunk/views/shares/admin_listing.ctp
r273 r345 1 1 <?php 2 2 echo $html->div('title_section', $session->read('Auth.User.username').' shared files'); 3 echo $html->link($html->image('admin/new.gif', array('alt'=>'Add new share', 'title'=>'Add new share')), '#', array("onclick"=>"hU()"), false, false);3 echo $html->link($html->image('admin/new.gif', array('alt'=>'Add new share', 'title'=>'Add new share')), '#', array("onclick"=>"hU()"), False, False); 4 4 $session->flash(); 5 5 ?> 6 7 6 <div id="addshare" style="display:none"> 8 7 <?php echo $form->create('Share', array("enctype"=>"multipart/form-data") ); ?> … … 21 20 22 21 <?php 23 //die(print_r($data)); 24 25 $th = array ('Download', 'File', 'Size Kb', 'Description', 'Public', 'Delete'); 22 $th = array ('Download', 'File', 'Size Kb', 'Description', 'Uploaded', 'Public', 'Delete'); 26 23 echo $html->tableHeaders($th); 27 24 foreach ($data as $val): 28 $st = ($val['Share']['public'] == 1) ? 'Public': 'No public';29 $size = filesize('../webroot/files/userfiles/'.$val['Share']['file']);30 $sizemb = round(($size/1024),2);31 $tr = array (25 $st = ($val['Share']['public'] == 1) ? 'Public': 'No public'; 26 $size = filesize('../webroot/files/userfiles/'.$val['Share']['file']); 27 $sizemb = round(($size/1024),2); 28 $tr = array ( 32 29 $html->link( 33 30 $html->image('static/button_download.gif', array('alt'=>"Download file", 'alt'=>"Download file")), … … 36 33 False, 37 34 False), 38 $val['Share']['file'], 39 $sizemb, 40 $val['Share']['description'], 41 $html->link($st, '/admin/shares/change/'.$val['Share']['id'].'/'.$val['Share']['public']), 42 $gags->confirmDel($val['Share']['id'], 'shares') 43 ); 35 $val['Share']['file'], 36 $sizemb, 37 $val['Share']['description'], 38 '<span style="font-size:7pt;">'.$val['Share']['created'].'</span>', 39 $html->link($st, '/admin/shares/change/'.$val['Share']['id'].'/'.$val['Share']['public']), 40 $gags->confirmDel($val['Share']['id'], 'shares') 41 ); 44 42 45 43 echo $html->tableCells($tr, array('class'=>"altRow", "onmouseover"=>"this.className='highlight'", "onmouseout"=>"this.className='altRow'"), … … 48 46 ?> 49 47 </table> 50 48 <?php 49 echo $html->div(null,null, array('style'=>'font-size:9pt;width:400px;margin:15px auto;')); 50 echo $html->div(null,$paginator->prev('« '.__('Previous', true),null,null,array('class'=>'disabled')), 51 array('style'=>'width:100px;float:left')); 52 echo $html->div(null,$paginator->next(__('Next', true).' »', null, null, array('class' => 'disabled')), 53 array('style'=>'width:100px;float:right')); 54 echo $html->div(null,$paginator->counter(), array('style'=>'width:200px;float:center')); 55 echo '</div>'; 56 ?> 51 57 <script type="text/javascript"> 52 58 <!-- … … 64 70 --> 65 71 </script> 66 67
Note: See TracChangeset
for help on using the changeset viewer.
