示例#1
0
文件: planet.php 项目: Tapac/hotscot
 public function index(array $params)
 {
     // the page of planets we are looking at
     $page = array_val($params, 'page', 1);
     // get a list of the planets (for this page)
     list($pagination, $planet_models) = get_paginated_models('planet', $page);
     $pagination['base_url'] = '/planet/';
     $planet_data = toArray($planet_models);
     $tpl_vars = array('pagination' => $pagination, 'planets' => $planet_data);
     v('page/planet/planet_list', $tpl_vars);
 }
示例#2
0
 public function index(array $params)
 {
     // the page of inhabitants we are looking at
     $page = array_val($params, 'page', 1);
     // get a list of the inhabitants (for this page)
     list($pagination, $inhabitant_models) = get_paginated_models('inhabitant', $page);
     $pagination['base_url'] = '/inhabitant/';
     $inhabitant_data = toArray($inhabitant_models);
     // add the planet for each inhabitant
     foreach ($inhabitant_data as $k => $inhabitant) {
         $inhabitant_data[$k]['planet'] = m('planet', $inhabitant['planetID'])->toArray();
     }
     $tpl_vars = array('pagination' => $pagination, 'inhabitants' => $inhabitant_data);
     v('page/inhabitant/inhabitant_list', $tpl_vars);
 }