Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15871 Rev 15890
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
                $startDateA = '2023-01-01';
106
            $startDate = '2023-01-01';
-
 
107
            $endDate = '2023-05-15';
-
 
108
 
-
 
109
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
-
 
110
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
-
 
111
 
Línea 107... Línea 112...
107
                $endDateB = '2023-05-15';
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');
119
                        $endDate = date('Y-m-d');
-
 
120
                    }
-
 
121
                }
-
 
122
 
-
 
123
                $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
-
 
124
                $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDateA, $endDateB);
-
 
Línea -... Línea 119...
-
 
119
                    $endDate = date('Y-m-d');
-
 
120
                }
-
 
121
            }
-
 
122
 
-
 
123
            $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
-
 
124
            $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
-
 
125
 
-
 
126
            //$total = count($dailyProgress);
-
 
127
            $data = [
-
 
128
                'labels'             => [],
-
 
129
                'dailyProgress' => [],
-
 
130
                'total' => []
-
 
131
            ];
-
 
132
 
-
 
133
            $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
-
 
134
            $count = 0;
-
 
135
            do {
-
 
136
                $count++;
-
 
137
                $date = $dt->format('Y-m-d');
-
 
138
                $label = $dt->format('d/m/Y');
-
 
139
                array_push($data['labels'], $label);
Línea 125... Línea 140...
125
 
140
 
126
                $total = count($dailyProgress);
141
                foreach ($$dailyProgress as $record) {
127
                $data = [
142
                    if ($date == $record['added_on']) {
128
                    'dailyProgress' => $dailyProgress,
143
                        $users = $record['user_id'];
129
                    'total' => $total
144
                    }
130
                ];
145
                }
131
 
146
            } while ($date < $endDate);
132
 
147
 
133
                return new JsonModel([
148
            return new JsonModel([
134
                    'success' => true,
149
                'success' => true,
135
                    'data' => $data
150
                'data' => $data
136
                ]);
151
            ]);
137
            } else {
152
            // } else {