예제 #1
0
 /**
  * @name viewAction
  *
  * This method is used to display the detail log info
  *
  *  @author Deepthi
  *  @version 1.0
  */
 public function viewAction()
 {
     $activitylog_model = new Default_Model_Activitylog();
     $logmanager_model = new Default_Model_Logmanager();
     $menu_model = new Default_Model_Menu();
     //Pop up layout
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $perPage = PERPAGE;
     $this->view->managemodule = 0;
     if ($this->getRequest()) {
         $id = $this->_request->getParam('id');
         $viewLinkArray = array('101', '102');
         // menu with view links
         $logManagarRecord = $logmanager_model->getLogManagerDataByID($id);
         $menuId = $logManagarRecord[0]['menuId'];
         $action = $logManagarRecord[0]['user_action'];
         switch ($action) {
             case 1:
                 $userAction = 'add';
                 break;
             case 2:
                 $userAction = 'edit';
                 break;
             default:
                 $userAction = '';
                 break;
         }
         $url = $menu_model->getMenusDataById($menuId);
         $modurl = ltrim($url[0]['url'], '/');
         if (isset($logManagarRecord[0]['log_details']) && !empty($logManagarRecord[0]['log_details'])) {
             $logdetails = '{"testjson":[' . $logManagarRecord[0]['log_details'] . ']}';
             $logarr = @get_object_vars(json_decode($logdetails));
             if (!empty($logarr)) {
                 $userArray = array();
                 $logarr['testjson'] = array_reverse($logarr['testjson']);
                 $this->logJsonCount = count($logarr['testjson']);
                 foreach ($logarr['testjson'] as $key => $curr) {
                     $currArray = @get_object_vars($curr);
                     $this->modArray[$key]['userid'] = $currArray['userid'];
                     if ($menuId != '142') {
                         if (in_array($menuId, $viewLinkArray)) {
                             $this->modArray[$key]['recordid'] = isset($currArray['recordid']) ? DOMAIN . $modurl . '/view/id/' . $currArray['recordid'] : '0';
                         } else {
                             $this->modArray[$key]['recordid'] = isset($currArray['recordid']) ? DOMAIN . $modurl . '/edit/id/' . $currArray['recordid'] : '0';
                         }
                     } else {
                         $this->view->managemodule = 1;
                         $this->modArray[$key]['recordid'] = $currArray['childrecordid'];
                     }
                     $this->modArray[$key]['date'] = $currArray['date'];
                     if (!in_array($currArray['userid'], $userArray)) {
                         array_push($userArray, $currArray['userid']);
                     }
                 }
                 $this->userNameArray = $activitylog_model->getuserNamesByIds($userArray);
                 if ($menuId != '61' && $menuId != '65') {
                     $this->view->viewrRecordFlag = true;
                 } else {
                     $this->view->viewrRecordFlag = false;
                 }
                 $this->view->mainArray = $this->modArray;
                 $this->view->userNameArray = $this->userNameArray;
                 $this->view->totalJsonCount = $this->logJsonCount;
                 $this->view->pageNo = 1;
                 $this->view->perPage = $perPage;
             } else {
                 $this->view->message = "No records found";
                 exit;
             }
         }
     }
 }