Changeset 474
- Timestamp:
- 05/12/08 14:02:03 (7 months ago)
- Location:
- trunk/app
- Files:
-
- 6 modified
-
app_model.php (modified) (2 diffs)
-
controllers/vclassrooms_controller.php (modified) (1 diff)
-
models/vclassroom.php (modified) (1 diff)
-
views/helpers/fpdf.php (modified) (2 diffs)
-
views/layouts/pdf.ctp (modified) (1 diff)
-
views/vclassrooms/admin_export.ctp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/app/app_model.php
r339 r474 1 1 <?php 2 /** 3 * @author: Manuel Montoya 4 * Chipotle SoftwareTM 2002-2008 5 * GPLv3 6 **/ 2 7 class AppModel extends Model{ 3 8 … … 35 40 ( 36 41 array($this->assocs[$assoc]['type'] => 37 array($assoc => $this->assocs[$assoc]))); 38 } 39 } 42 array($assoc => $this->assocs[$assoc])) 43 ); 44 } 45 } 46 47 /** 48 * Unbinds all unneeded associations 49 * @author: Oth aka KrazyLegs 50 * @reference: http://othy.wordpress.com/2006/06/03/unbind-all-associations-except-some/ 51 **/ 52 53 public function unbindAll($params = array()) 54 { 55 foreach($this->__associations as $ass) // this array returns hasOne, HasMany, etc 56 { 57 if (!empty($this->{$ass})) // if hasMany assos exist, if HasOne exist, etce 58 { 59 $this->__backAssociation[$ass] = $this->{$ass}; 60 61 if ( isset($params[$ass]) ) 62 { 63 foreach ( $this->{$ass} as $model => $detail ) 64 { 65 if (!in_array($model,$params[$ass])) 66 { 67 $this->__backAssociation = array_merge($this->__backAssociation, $this->{$ass}); 68 unset($this->{$ass}[$model]); 69 } 70 } 71 } 72 else 73 { 74 $this->__backAssociation = array_merge($this->__backAssociation, $this->{$ass}); 75 $this->{$ass} = array(); 76 } 77 } 78 } 79 return true; 80 } 40 81 } 41 82 ?> -
trunk/app/controllers/vclassrooms_controller.php
r468 r474 161 161 { 162 162 $this->layout = 'pdf'; 163 $this->Vclassroom->unbindAll(); 164 $conditions = array('Vclassroom.id'=>$vclassroom_id); 165 $fields = array('Vclassroom.name', 'Vclassroom.created'); //null; 166 167 $this->set('group',$this->Vclassroom->find($conditions, $fields)); 168 163 169 $this->set('data', $this->Vclassroom->recordClass($vclassroom_id)); 164 170 } -
trunk/app/models/vclassroom.php
r471 r474 152 152 $users = array(); 153 153 $records = array(); 154 154 155 155 $data = $this->UsersVclassroom->findAll(array('UsersVclassroom.vclassroom_id'=>$vclassroom_id), array('user_id')); 156 156 157 157 //die(debug($data)); 158 158 foreach ($data as $u): 159 160 $this->User->removeBinds(); // remove innecesaries user binds 159 161 160 162 $user_id = $u['UsersVclassroom']['user_id']; 161 163 162 $conditions = array('User.id'=>$user_id);163 $fields = array('User.name', 'User.email'); //null;164 $conditions = array('User.id'=>$user_id); 165 $fields = array('User.name', 'User.email'); //null; 164 166 $records[$user_id] = $this->User->find($conditions, $fields); 165 167 -
trunk/app/views/helpers/fpdf.php
r456 r474 1 1 <?php 2 2 /** 3 * Chipotle Software TM 4 * Manuel Montoya 2002-2008 5 * GPLv3 manuel<arroba>mononeurona<punto>org 6 */ 3 7 App::import('Vendor', 'fpdf/myfpdf'); 4 8 … … 22 26 public function setData($data) 23 27 { 24 $this->pdf->Cell(0,10,$data,1,1,'L'); 25 $this->pdf->Ln(10); 28 $string = utf8_decode($data); 29 $this->pdf->Cell(0,5,$string,1,1,'L'); 30 $this->pdf->Ln(5); 26 31 } 27 32 -
trunk/app/views/layouts/pdf.ctp
r455 r474 1 1 <?php 2 header( "Content-type: application/pdf");2 header('Content-type: application/pdf; charset="utf-8"',true); 3 3 echo $content_for_layout; 4 4 ?> -
trunk/app/views/vclassrooms/admin_export.ctp
r471 r474 1 1 <?php 2 // die(debug($data));2 // die(debug($data)); 3 3 4 4 foreach ($data as $u): 5 5 6 6 $fpdf->newPage(); 7 7 8 $fpdf->setData('Student '.$u['User']['name'] . ' '.$u['User']['email']); 8 $fpdf->setData('Group: ' . $group['Vclassroom']['name'] . '. Created '.$group['Vclassroom']['created']); 9 $fpdf->setData('Student '. $u['User']['name'] . ' '.$u['User']['email']); 9 10 10 11 foreach ($u['tests'] as $te):
