Advertisement
citstudio

cakePHP Treeview Controllers

Jul 16th, 2014
383
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.93 KB | None | 0 0
  1. <?php
  2. App::uses('Controller', 'Controller');
  3. class AppController extends Controller {
  4.  
  5.   public function beforeFilter() {
  6.     parent::beforeFilter();
  7.     Controller::loadModel('Histories');
  8.     $histories = $this->Histories->__getAll();
  9.     $root = array();
  10.     foreach ($histories as $key => $value) {
  11.       $child = array();
  12.       foreach ($value["ChildPage"] as $cKey => $cVal) {
  13.         array_push($child, array(
  14.             "company" => $cVal["company"]
  15.             , "industry" => $cVal["industry"]
  16.             , "period_from" => $cVal["period_from"]
  17.             , "period_to" => $cVal["period_to"]
  18.             , "occupation" => $cVal["occupation"]
  19.             , "concentration" => $cVal["concentration"]
  20.             , "jobDescription" => $cVal["jobDescription"]
  21.         ));
  22.       }
  23.       array_push($root, array("Types" => $value["Histories"]["types"], "Values" => $child));
  24.     }
  25.     $this->set('resumes', $root);
  26.   }
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement