Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 5867 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 5867 Rev 5911
Línea 61... Línea 61...
61
        $this->logger = $logger;
61
        $this->logger = $logger;
62
        $this->config = $config;
62
        $this->config = $config;
63
    }
63
    }
Línea 64... Línea 64...
64
 
64
 
-
 
65
    public function indexAction() {
65
    public function indexAction() {
66
 
66
        $request = $this->getRequest();
67
        $request = $this->getRequest();
67
        $currentUserPlugin = $this->plugin('currentUserPlugin');
68
        $currentUserPlugin = $this->plugin('currentUserPlugin');
68
        $currentCompany = $currentUserPlugin->getCompany();
69
        $currentCompany = $currentUserPlugin->getCompany();
Línea 69... Línea 70...
69
        $currentUser = $currentUserPlugin->getUser();
70
        $currentUser = $currentUserPlugin->getUser();
70
 
71
 
71
 
72
        try{
Línea 72... Línea 73...
72
        $request = $this->getRequest();
73
        $request = $this->getRequest();
Línea 88... Línea 89...
88
                    }
89
                    }
89
                }
90
                }
90
            }
91
            }
Línea 91... Línea 92...
91
 
92
 
-
 
93
            if ($isJson) {
-
 
94
                $survey_uuid = $this->params()->fromRoute('survey_id');
-
 
95
 
-
 
96
                $surveyMapper = SurveyMapper::getInstance($this->adapter);
-
 
97
                $survey = $surveyMapper->fetchOneByUuid($survey_uuid);
92
            if ($isJson) {
98
 
93
                $search = $this->params()->fromQuery('search', []);
99
                $search = $this->params()->fromQuery('search', []);
Línea 94... Línea 100...
94
                $search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
100
                $search = empty($search['value']) ? '' : filter_var($search['value'], FILTER_SANITIZE_STRING);
95
 
101
 
Línea 109... Línea 115...
109
                $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
115
                $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
110
                $paginator = $surveyTestMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
116
                $paginator = $surveyTestMapper->fetchAllDataTableByCompanyId($currentCompany->id, $search, $page, $records_x_page, $order_field, $order_direction);
Línea 111... Línea 117...
111
 
117
 
112
                $items = [];
118
                $items = [];
113
                $records = $paginator->getCurrentItems();
-
 
Línea 114... Línea 119...
114
                
119
                $records = $paginator->getCurrentItems();
-
 
120
 
-
 
121
                foreach ($records as $record) {
-
 
122
                    $params = [
-
 
123
                        'survey_id' => $survey->uuid,
Línea 115... Línea 124...
115
 
124
                        'id' => $record->uuid,
116
                foreach ($records as $record) {
125
                    ];
117
 
126
 
-
 
127
                    $item = [
-
 
128
                        'id' => $record->id,
118
                    $item = [
129
                        'first_name' => $record->first_name,
119
                        'id' => $record->id,
-
 
120
                        'first_name' => $record->first_name,
130
                        'form' => $survey->name,
121
                        'actions' => [
131
                        
122
                            'link_one' => $this->url()->fromRoute('survey/report/one', ['id' => $record->uuid]),
132
                        'actions' => [
Línea 123... Línea 133...
123
                            'link_all' => $this->url()->fromRoute('survey/report/all', ['id' => $record->uuid])
133
                            'link_delete' => $this->url()->fromRoute('survey/test/delete', ['id' => $record->uuid])
124
                        ]
134
                        ]
Línea 132... Línea 142...
132
                    'data' => [
142
                    'data' => [
133
                        'items' => $items,
143
                        'items' => $items,
134
                        'total' => $paginator->getTotalItemCount(),
144
                        'total' => $paginator->getTotalItemCount(),
135
                    ]
145
                    ]
136
                ]);
146
                ]);
137
            } else {                
147
            } else {
-
 
148
                $surveyMapper = SurveyMapper::getInstance($this->adapter);
-
 
149
                $survies = $surveyMapper->fetchAllByCompanyId($currentCompany->id);
-
 
150
                
138
                $form = new SurveyTestForm($this->adapter, $currentCompany->id);
151
                $form = new SurveyTestForm($this->adapter, $currentCompany->id);
Línea 139... Línea 152...
139
 
152
 
140
                $this->layout()->setTemplate('layout/layout-backend');
153
                $this->layout()->setTemplate('layout/layout-backend');
141
                $viewModel = new ViewModel();
154
                $viewModel = new ViewModel();
142
                $viewModel->setTemplate('leaders-linked/survey-report/index.phtml');
155
                $viewModel->setTemplate('leaders-linked/survey-test/index.phtml');
143
                $viewModel->setVariables([
156
                $viewModel->setVariables([
-
 
157
                    'form'      => $form,
144
                    'form'      => $form
158
                    'survies' => $survies
145
                ]);
159
                ]);
146
                return $viewModel;
160
                return $viewModel;
147
            }
161
            }
148
        } else {
162
        } else {
149
            return new JsonModel([
163
            return new JsonModel([
150
                'success' => false,
164
                'success' => false,
151
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
165
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
Línea 152... Línea 166...
152
            ]);
166
            ]);
-
 
167
            
-
 
168
        }
-
 
169
        } catch (\Throwable $e) {
-
 
170
            $e->getMessage();
-
 
171
            return new JsonModel([
-
 
172
                'success' => false,
-
 
173
                'data' => $e
153
            
174
            ]);
-
 
175
        }
154
        }
176
    }
155
    }
177