public function travelcornerAction() { $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'getuser')); // var_dump($getuser); $this->layout()->getuser = $getuser; $unity = new Utility(); $domain = WEBPATH; $newsTable = $this->getServiceLocator()->get('NewsTable'); $all_new = $newsTable->fetchAll(); $ajax = "<script type=\"text/javascript\">\n \t\t\twindow.travel_news = new Array();"; foreach ($all_new as $key => $value) { $dateview = $value->date_creat; $_title = $unity->_substr_co_nghia($value->news_name, 30); $array_time = explode('-', $dateview); if (!empty($array_time)) { $number_moth = (int) $array_time[1]; $_month = $unity->_name_moth($array_time[1]); $_today = $array_time[2]; $_year = $array_time[0]; $_string = $_month . ' ' . $_today . ' ' . $_year; } else { $number_moth = ''; $_month = ''; $_today = ''; $_year = ''; $_string = ''; } if ($value->travel_corner == 1 and $value->status == 1) { $ajax .= "travel_news.push({\n\t\t\t\t\t\tthumbnail: '" . $domain . "/uploads/" . $value->news_thumbnail . "',\n\t\t\t\t\t\ttitle: '" . $_title . "',\n\t\t\t\t\t\ttime: '" . $_string . "',\n\t\t\t\t\t\tlink: '" . $domain . "/newsview/" . $value->url_static . "'\n\t\t\t\t\t});"; } } // end for $ajax .= "</script>"; echo $ajax; die; }