Beispiel #1
0
 public function execute()
 {
     //open model
     $model = new PeopleModel();
     //retrieve all people
     $people = $model->getPeopleList();
     //return results as json object
     echo json_encode($people);
 }
 public function execute()
 {
     //grab people
     $model = new PeopleModel();
     $people = $model->getPeopleList();
     //grab deals
     $model = new DealModel();
     $deals = $model->getDealList();
     //grab notes categories
     $model = new NoteModel();
     $categories = $model->getNoteCategories();
     //construct data obj
     $data = array('people' => $people, 'deals' => $deals, 'categories' => $categories);
     //encode and return results
     echo json_encode($data);
 }
 public function execute()
 {
     //open model
     $model = new PeopleModel();
     //retrieve all people
     $people = $model->getPeopleList();
     if (count($people)) {
         foreach ($people as $index => $row) {
             $people[$index]['type'] = "person";
             $people[$index]['association_link'] = RouteHelper::_('index.php?view=people&layout=person&id=' . $row['id']);
         }
     }
     //open model
     $model = new DealModel();
     //retrieve all people
     $deals = $model->getDealList();
     if (count($deals)) {
         foreach ($deals as $index => $row) {
             $deals[$index]['type'] = 'deal';
             $deals[$index]['association_link'] = RouteHelper::_('index.php?view=deals&layout=deal&id=' . $row['id']);
         }
     }
     //open model
     $model = new CompanyModel();
     //retrieve all people
     $companies = $model->getCompanyList();
     if (count($companies)) {
         foreach ($companies as $index => $row) {
             $companies[$index]['type'] = 'company';
             $companies[$index]['association_link'] = RouteHelper::_('index.php?view=companies&layout=company&id=' . $row['id']);
         }
     }
     //merge our results to a grand object
     $results = array_merge($people, $deals, $companies);
     //return results as json object
     echo json_encode($results);
 }
Beispiel #4
0
 public static function getPeopleList()
 {
     //open model
     $model = new PeopleModel();
     //retrieve all people
     $people = $model->getPeopleList();
     $people_list = array();
     if (count($people)) {
         foreach ($people as $index => $row) {
             $people_list[$row['id']] = $row['first_name'] . ' ' . $row['last_name'];
         }
     }
     return $people_list;
 }