示例#1
0
 function getViewVars()
 {
     $cosasParaver = parent::getViewVars();
     $agents['agents'] = $this->Agent->find('list');
     $agentAux = $this->Agent->find('all', array('contain' => array('IdentificationType')));
     foreach ($agentAux as $au) {
         //debug(json_encode($au));
         $au['Agent']['identification_name'] = $au['IdentificationType']['name'];
         $agents['agentJsonData'][$au['Agent']['id']] = json_encode($au['Agent']);
     }
     return $cosasParaver + $agents;
 }
示例#2
0
 public function getViewVars()
 {
     parent::getViewVars();
     // Get Spouses
     $spouses = array();
     if (!empty($this->data['Vehicle']['Customer']['CustomerNatural']['id'])) {
         $spouses = ClassRegistry::init('Spouse')->find('all', array('conditions' => array('customer_natural_id' => $this->data['Vehicle']['Customer']['CustomerNatural']['id']), 'recursive' => -1));
     }
     $finalSpouses = array();
     foreach ($spouses as $sp) {
         $finalSpouses[$sp['Spouse']['id']] = array('text' => $sp['Spouse']['name'], 'json' => json_encode($sp['Spouse']));
     }
     // Get Representatives
     $representatives = array();
     if (!empty($this->data['Vehicle']['Customer']['id'])) {
         $representatives = ClassRegistry::init('Representative')->find('all', array('conditions' => array('customer_id' => $this->data['Vehicle']['Customer']['id']), 'recursive' => -1));
     }
     $finalRepresentatives = array();
     foreach ($representatives as $rp) {
         $finalRepresentatives[$rp['Representative']['id']] = array('text' => $rp['Representative']['name'], 'json' => json_encode($rp['Representative']));
     }
     return array('spouses' => $finalSpouses, 'representatives' => $finalRepresentatives);
 }