public function dashboardAction()
 {
     $user = $this->getUser();
     $user_id = $user['user_id'];
     $this->accessRights(14);
     $dashboard_form = new DashboardForm($this->serviceLocator());
     $form = new NewsListForm($this->serviceLocator());
     $adapter = new DashboardAdapter($this->serviceLocator());
     $online = $adapter->getOnline();
     $print = $adapter->getPrint();
     $radio = $adapter->getRadio();
     $tv = $adapter->getTV();
     $present_media_value = $adapter->present_media_value();
     $previous_media_value = $adapter->previous_media_value();
     $today = date('Y-m-d H:i:s');
     $current_year = date("Y");
     $last_year = date("Y", strtotime('-1 year', strtotime($today)));
     $form->get('submit')->setAttribute('hidden', 'hidden');
     $bookmarks = $adapter->getAllBookmarked($user_id);
     return new ViewModel(array('online' => $online, 'print' => $print, 'radio' => $radio, 'tv' => $tv, 'form' => $form, 'presentMV' => $present_media_value, 'previousMV' => $previous_media_value, 'total_hits' => iterator_to_array($adapter->total_hits())[0], 'total_media_value' => iterator_to_array($adapter->total_media_value())[0], 'current_year' => $current_year, 'last_year' => $last_year, 'dashboard_form' => $dashboard_form, 'bookmarks' => $bookmarks));
 }
 public function indexAction()
 {
     $this->accessRights(43);
     $this->childModuleAccessRights(42, 'view');
     //Accept Child Module ID & it's Actions: add, edit, view, disable
     $form = new NewsListForm($this->serviceLocator());
     $form->get('submit')->setValue('Go');
     //        $adapter = new ArchiveTable($this->serviceLocator());
     //        $news = new NewsListAdapter($this->adapter);
     //        $result = array();
     $user = $this->getUser();
     $user_id = $user['user_id'];
     $request = $this->getRequest();
     $sub_kind = "";
     if ($request->isPost()) {
         $s_id = $_POST['search_by'];
         $input = $_POST['input'];
         $id = $_POST['media_outfit_id'];
         $sub_kind = $_POST['sub_kind'];
         $article_type_id = $_POST['article_type_id'];
         $from = $_POST['from'];
         $to = $_POST['to'];
         $bu_csr = $_POST['bu_csr'];
         $form->get('search_by')->setValue($s_id);
         $form->get('input')->setValue($input);
         $form->get('media_outfit_id')->setValue($id);
         $form->get('bu_csr')->setValue($bu_csr);
         if ($id == 1) {
             $form->get('sub_kind')->setValueOptions(array('8' => 'All', '1' => 'Online', '2' => 'Blog', '3' => 'International'));
         } elseif ($id == 2) {
             $form->get('sub_kind')->setValueOptions(array('9' => 'All', '4' => 'Local', '5' => 'National'));
         } elseif ($id == 3) {
             $form->get('sub_kind')->setValueOptions(array('6' => 'Radio'));
         } elseif ($id == 4) {
             $form->get('sub_kind')->setValueOptions(array('7' => 'TV'));
         }
         $form->get('sub_kind')->setValue($sub_kind);
         $form->get('article_type_id')->setValue($article_type_id);
         $form->get('from')->setValue($from);
         $form->get('to')->setValue($to);
         //            $news->createTmpTable();
         //            $result = $adapter->getOnlyArchive($s_id, $input, $sub_kind, $article_type_id, $from, $to, $bu_csr);
         //
     }
     return new ViewModel(array('form' => $form, 'user_id' => $user_id, 'sub_kind' => $sub_kind, 'access_rights' => $this->getSubModuleAccessRights(42), 'tab_menus' => $this->getTabMenu('Draft / Archive')));
 }
 public function indexAction()
 {
     $this->accessRights(14);
     $this->childModuleAccessRights(14, 'view');
     $form = new NewsListForm($this->serviceLocator());
     $adapter = new NewsListAdapter($this->serviceLocator());
     $user = $this->getUser();
     $user_role = $user['role_id'];
     $user_id = $user['user_id'];
     $result = $adapter->getAll($user_role, $user_id);
     $request = $this->getRequest();
     $user = $this->getUser();
     $user_id = $user['user_id'];
     $sub_kind = "";
     // print_r($user);
     if ($request->isPost()) {
         $s_id = $_POST['search_by'];
         $input = $_POST['input'];
         $id = $_POST['media_outfit_id'];
         $sub_kind = $_POST['sub_kind'];
         $article_type_id = $_POST['article_type_id'];
         $from = $_POST['from'];
         $to = $_POST['to'];
         $bu_csr = $_POST['bu_csr'];
         $form->get('search_by')->setValue($s_id);
         $form->get('input')->setValue($input);
         $form->get('media_outfit_id')->setValue($id);
         $form->get('bu_csr')->setValue($bu_csr);
         if ($id == 1) {
             $form->get('sub_kind')->setValueOptions(array('8' => 'All', '1' => 'Online', '2' => 'Blog', '3' => 'International'));
         } elseif ($id == 2) {
             $form->get('sub_kind')->setValueOptions(array('9' => 'All', '4' => 'Local', '5' => 'National'));
         } elseif ($id == 3) {
             $form->get('sub_kind')->setValueOptions(array('6' => 'Radio'));
         } elseif ($id == 4) {
             $form->get('sub_kind')->setValueOptions(array('7' => 'TV'));
         }
         $form->get('sub_kind')->setValue($sub_kind);
         $form->get('article_type_id')->setValue($article_type_id);
         $form->get('from')->setValue($from);
         $form->get('to')->setValue($to);
         $result = $adapter->getOnly($s_id, $input, $sub_kind, $article_type_id, $from, $to, $bu_csr);
     }
     return new ViewModel(array('news_lists' => $result, 'form' => $form, 'user_id' => $user_id, 'user_role' => $user_role, 'access_rights' => $this->getSubModuleAccessRights(14), 'sub_kind' => $sub_kind));
 }