Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 15893 | Rev 15895 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 15893 Rev 15894
Línea 90... Línea 90...
90
                        $isJson = strpos($raw, 'json');
90
                        $isJson = strpos($raw, 'json');
91
                    }
91
                    }
92
                }
92
                }
93
            }
93
            }
Línea 94... Línea 94...
94
 
94
 
95
            if ($isJson) {
95
            //if ($isJson) {
96
                $startDate = $this->params()->fromQuery('startDate');
96
            $startDate = $this->params()->fromQuery('startDate');
97
                if (empty($startDate)) {
97
            if (empty($startDate)) {
98
                    $startDate = date('Y-m-d');
98
                $startDate = date('Y-m-d');
Línea 99... Línea 99...
99
                }
99
            }
100
 
100
 
101
                $endDate = $this->params()->fromQuery('endDate');
101
            $endDate = $this->params()->fromQuery('endDate');
102
                if (empty($endDate)) {
102
            if (empty($endDate)) {
Línea 103... Línea 103...
103
                    $endDate = date('Y-m-d');
103
                $endDate = date('Y-m-d');
104
                }
104
            }
Línea 105... Línea 105...
105
 
105
 
106
                $startDate = '2023-01-01';
106
            $startDate = '2023-01-01';
Línea 107... Línea 107...
107
                $endDate = '2023-05-15';
107
            $endDate = '2023-05-15';
-
 
108
 
-
 
109
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
-
 
110
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
111
 
-
 
112
            if (!$dtStartDate || !$dtEndDate) {
108
 
113
                $startDate = date('Y-m-d');
109
                $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
114
                $endDate = date('Y-m-d');
110
                $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
111
 
-
 
112
                if (!$dtStartDate || !$dtEndDate) {
-
 
113
                    $startDate = date('Y-m-d');
-
 
114
                    $endDate = date('Y-m-d');
-
 
115
                } else {
-
 
116
 
115
            } else {
-
 
116
 
Línea 117... Línea 117...
117
                    if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
117
                if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
118
                        $startDate = date('Y-m-d');
118
                    $startDate = date('Y-m-d');
Línea 119... Línea 119...
119
                        $endDate = date('Y-m-d');
119
                    $endDate = date('Y-m-d');
120
                    }
120
                }
121
                }
121
            }
122
 
122
 
123
                $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
123
            $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
124
                $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
124
            $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
125
 
125
 
126
                $total = count($dailyProgress);
126
            $total = count($dailyProgress);
127
                $data = [
127
            $data = [
128
                    'labels'             => [],
128
                'labels'             => [],
129
                    'dailyProgress' => [],
129
                'dailyProgress' => [],
130
                ];
130
            ];
131
 
131
 
132
                $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
132
            $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
133
 
133
 
134
                do {
134
            do {
135
                    $date = $dt->format('Y-m-d');
135
                $date = $dt->format('Y-m-d');
136
                    $label = $dt->format('d/m/Y');
136
                $label = $dt->format('d/m/Y');
137
                    array_push($data['labels'], $label);
137
                array_push($data['labels'], $label);
138
                } while ($date < $endDate);
138
            } while ($date < $endDate);
139
 
139
 
140
 
140
 
141
                return new JsonModel([
141
            return new JsonModel([
142
                    'success' => true,
142
                'success' => true,
143
                    'data' => $data
143
                'data' => $data
144
                ]);
144
            ]);
145
            } else {
145
            // } else {
146
                $this->layout()->setTemplate('layout/layout-backend');
146
            //     $this->layout()->setTemplate('layout/layout-backend');