public function showIndex()
 {
     $page = $this->node;
     $tree = Collector::get('root');
     $subTree = Tree::getSubTree($tree, $page);
     $blocks = null;
     if ($subTree) {
         foreach ($subTree->children as $node) {
             if ($node->slug != 'blocks') {
                 continue;
             }
             $blocks = $node->children;
             break;
         }
     }
     foreach ($blocks as $index => $block) {
         $blocks[$block->slug] = $block;
         unset($blocks[$index]);
     }
     if (isset($blocks['reporting'])) {
         $blocks['reporting']->children = $blocks['reporting']->children->reverse();
     }
     $news = News::active()->byCatalog(Collector::get('idNewsCatalog'))->byCategories(Collector::get('idInvestorRelationsCategory'))->desc()->get();
     $offices = Office::with('city')->active()->legal()->get();
     $officesMap = Office::getMap($offices);
     return View::make('investor.index', compact('page', 'blocks', 'news', 'officesMap'));
 }
 public function doFilter()
 {
     if (!Request::ajax()) {
         App::abort(404);
     }
     $offices = Cache::tags('offices')->rememberForever('map_offices_filter_' . md5(json_encode(Input::all())) . '_' . App::getLocale(), function () {
         return Office::with('city')->active()->filter(Input::all())->orderBy('id_city', 'asc')->get();
     });
     $officesMap = Office::getMap($offices);
     $officesPopupsHtml = '';
     $officesListHtml = '';
     foreach ($officesMap as $officeMap) {
         $officesPopupsHtml .= View::make('partials.popups.office_info', compact('officeMap'))->render();
         $officesListHtml .= View::make('map.partials.list_item', compact('officeMap'))->render();
     }
     return Response::json(array('status' => true, 'offices' => json_encode($officesMap), 'html' => $officesPopupsHtml, 'html_list' => $officesListHtml));
 }