Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 16304 Rev 16305
Línea 74... Línea 74...
74
        $currentNetwork = $currentNetworkPlugin->getNetwork();
74
        $currentNetwork = $currentNetworkPlugin->getNetwork();
75
        $request = $this->getRequest();
75
        $request = $this->getRequest();
Línea 76... Línea 76...
76
 
76
 
77
 
77
 
78
 
78
 
Línea 79... Línea 79...
79
        //if ($request->isGet()) {
79
        if ($request->isGet()) {
80
        $headers  = $request->getHeaders();
80
            $headers  = $request->getHeaders();
Línea 81... Línea 81...
81
        $isJson = false;
81
            $isJson = false;
Línea 82... Línea 82...
82
 
82
 
83
        if ($headers->has('Accept')) {
83
            if ($headers->has('Accept')) {
Línea 84... Línea 84...
84
            $accept = $headers->get('Accept');
84
                $accept = $headers->get('Accept');
85
 
85
 
-
 
86
                $prioritized = $accept->getPrioritized();
86
            $prioritized = $accept->getPrioritized();
87
 
87
 
88
                foreach ($prioritized as $key => $value) {
88
            foreach ($prioritized as $key => $value) {
-
 
89
                $raw = trim($value->getRaw());
89
                    $raw = trim($value->getRaw());
90
 
90
 
Línea 91... Línea 91...
91
                if (!$isJson) {
91
                    if (!$isJson) {
92
                    $isJson = strpos($raw, 'json');
92
                        $isJson = strpos($raw, 'json');
93
                }
93
                    }
94
            }
94
                }
Línea 95... Línea 95...
95
        }
95
            }
96
        //Anderson
96
            //Anderson
97
        //if ($isJson) {
97
            if ($isJson) {
98
 
98
 
Línea 99... Línea 99...
99
        $startDate = $this->params()->fromQuery('startDate');
99
                $startDate = $this->params()->fromQuery('startDate');
100
        if (empty($startDate)) {
100
                if (empty($startDate)) {
Línea 101... Línea 101...
101
            $startDate = date('Y-m-d');
101
                    $startDate = date('Y-m-d');
102
        }
102
                }
Línea 103... Línea 103...
103
 
103
 
104
        $endDate = $this->params()->fromQuery('endDate');
104
                $endDate = $this->params()->fromQuery('endDate');
105
        if (empty($endDate)) {
105
                if (empty($endDate)) {
106
            $endDate = date('Y-m-d');
106
                    $endDate = date('Y-m-d');
107
        }
107
                }
108
 
108
 
109
        $startDate = '2023-01-01';
109
                $startDate = '2023-01-01';
110
        $endDate = '2023-05-16';
110
                $endDate = '2023-05-16';
111
 
111
 
112
        $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
112
                $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
Línea 113... Línea 113...
113
        $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
113
                $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
114
 
114
 
Línea 115... Línea 115...
115
        if (!$dtStartDate || !$dtEndDate) {
115
                if (!$dtStartDate || !$dtEndDate) {
116
            $startDate = date('Y-m-d');
116
                    $startDate = date('Y-m-d');
117
            $endDate = date('Y-m-d');
117
                    $endDate = date('Y-m-d');
118
        } else {
118
                } else {
119
 
119
 
120
            if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
120
                    if ($dtStartDate->getTimestamp() > $dtEndDate->getTimestamp()) {
121
                $startDate = date('Y-m-d');
121
                        $startDate = date('Y-m-d');
122
                $endDate = date('Y-m-d');
122
                        $endDate = date('Y-m-d');
123
            }
123
                    }
124
        }
124
                }
125
 
125
 
126
        $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
126
                $contactProgressRecordMapper = DiscoveryContactLogMapper::getInstance($this->adapter);
127
        $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
127
                $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDate, $endDate);
128
 
128
 
129
 
129
 
Línea 130... Línea 130...
130
        $total = count($dailyProgress);
130
                $total = count($dailyProgress);
131
        $data = [
131
                $data = [
132
            'total_by_day' => [],
132
                    'total_by_day' => [],
133
            'added_on' => [],
133
                    'added_on' => [],
134
            'total' => []
134
                    'total' => []
135
        ];
135
                ];
136
 
136
 
137
        foreach ($dailyProgress as $record) {
137
                foreach ($dailyProgress as $record) {
138
            $users = $record['user_id'];
138
                    $users = $record['user_id'];
139
            $added_on = date("d-m-Y", strtotime($record['added_on']));
139
                    $added_on = date("d-m-Y", strtotime($record['added_on']));
140
            $total = count($dailyProgress);
140
                    $total = count($dailyProgress);
141
            array_push($data['total_by_day'], $users);
141
                    array_push($data['total_by_day'], $users);
142
            array_push($data['added_on'], $added_on);
142
                    array_push($data['added_on'], $added_on);