Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15891 Rev 15892
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');
-
 
99
            }
-
 
100
 
-
 
101
            $endDate = $this->params()->fromQuery('endDate');
-
 
102
            if (empty($endDate)) {
-
 
103
                $endDate = date('Y-m-d');
98
                    $startDate = date('Y-m-d');
Línea -... Línea 99...
-
 
99
                }
104
            }
100
 
105
 
101
                $endDate = $this->params()->fromQuery('endDate');
-
 
102
                if (empty($endDate)) {
Línea 106... Línea 103...
106
            $startDate = '2023-01-01';
103
                    $endDate = date('Y-m-d');
107
            $endDate = '2023-05-15';
104
                }
Línea 108... Línea -...
108
 
-
 
109
            $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
105
 
110
            $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
106
                $startDateA = '2023-01-01';
111
 
-
 
Línea 112... Línea 107...
112
            if (!$dtStartDate || !$dtEndDate) {
107
                $endDateB = '2023-05-15';
113
                $startDate = date('Y-m-d');
108
 
114
                $endDate = date('Y-m-d');
109
                $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
115
            } else {
110
                $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
116
 
-
 
Línea 117... Línea -...
117
                if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
-
 
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, $startDate, $endDate);
-
 
125
 
-
 
126
            //$total = count($dailyProgress);
-
 
127
            $data = [
111
 
128
                'labels'             => [],
-
 
129
                'dailyProgress' => [],
-
 
130
                'total' => []
-
 
131
            ];
112
                if (!$dtStartDate || !$dtEndDate) {
132
 
-
 
133
            $dt = \DateTime::createFromFormat('Y-m-d', $startDate);
-
 
134
            $count = 0;
-
 
135
            do {
-
 
136
                $count++;
-
 
137
                $date = $dt->format('Y-m-d');
113
                    $startDate = date('Y-m-d');
138
                $label = $dt->format('d/m/Y');
114
                    $endDate = date('Y-m-d');
139
                array_push($data['labels'], $label);
115
                } else {
140
 
-
 
Línea -... Línea 116...
-
 
116
 
-
 
117
                    if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
-
 
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);
-
 
125
 
141
                foreach ($dailyProgress as $record) {
126
                $total = count($dailyProgress);
142
                    if ($date == $record['added_on']) {
127
                $data = [
143
                        $users = $record['user_id'];
128
                    'dailyProgress' => $dailyProgress,
144
                    }
129
                    'total' => $total
145
                }
130
                ];
146
            } while ($date < $endDate);
131
 
147
 
132
 
148
            return new JsonModel([
133
                return new JsonModel([
149
                'success' => true,
134
                    'success' => true,
150
                'data' => $data
135
                    'data' => $data
151
            ]);
136
                ]);
152
            // } else {
137
            } else {
153
            //     $this->layout()->setTemplate('layout/layout-backend');
138
                $this->layout()->setTemplate('layout/layout-backend');