Proyectos de Subversion LeadersLinked - Backend

Rev

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

Rev 15850 Rev 15856
Línea 72... Línea 72...
72
        $currentUser = $currentUserPlugin->getUser();
72
        $currentUser = $currentUserPlugin->getUser();
73
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
73
        $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
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
        //if ($request->isGet()) {
77
        if ($request->isGet()) {
78
        $headers  = $request->getHeaders();
78
            $headers  = $request->getHeaders();
Línea 79... Línea 79...
79
        $isJson = false;
79
            $isJson = false;
80
 
80
 
Línea 81... Línea 81...
81
        if ($headers->has('Accept')) {
81
            if ($headers->has('Accept')) {
Línea 82... Línea 82...
82
            $accept = $headers->get('Accept');
82
                $accept = $headers->get('Accept');
83
 
83
 
Línea 84... Línea 84...
84
            $prioritized = $accept->getPrioritized();
84
                $prioritized = $accept->getPrioritized();
85
 
85
 
-
 
86
                foreach ($prioritized as $key => $value) {
86
            foreach ($prioritized as $key => $value) {
87
                    $raw = trim($value->getRaw());
87
                $raw = trim($value->getRaw());
88
 
88
 
-
 
Línea 89... Línea 89...
89
                if (!$isJson) {
89
                    if (!$isJson) {
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)) {
Línea 98... Línea 98...
98
            $startDate = date('Y-m-d');
98
                    $startDate = date('Y-m-d');
99
        }
99
                }
Línea 100... Línea 100...
100
 
100
 
101
        $endDate = $this->params()->fromQuery('endDate');
101
                $endDate = $this->params()->fromQuery('endDate');
Línea 102... Línea 102...
102
        if (empty($endDate)) {
102
                if (empty($endDate)) {
103
            $endDate = date('Y-m-d');
103
                    $endDate = date('Y-m-d');
104
        }
104
                }
105
 
105
 
106
        $startDateA = '2023-01-01';
106
                $startDateA = '2023-01-01';
107
        $endDateB = '2023-05-15';
107
                $endDateB = '2023-05-15';
108
 
108
 
109
        $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
109
                $dtStartDate = \DateTime::createFromFormat('Y-n-d', $startDate);
110
        $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
110
                $dtEndDate = \DateTime::createFromFormat('Y-n-d', $endDate);
111
 
111
 
Línea 112... Línea 112...
112
        if (!$dtStartDate || !$dtEndDate) {
112
                if (!$dtStartDate || !$dtEndDate) {
113
            $startDate = date('Y-m-d');
113
                    $startDate = date('Y-m-d');
Línea 114... Línea 114...
114
            $endDate = date('Y-m-d');
114
                    $endDate = date('Y-m-d');
115
        } else {
115
                } else {
116
 
116
 
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');
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, $startDateA, $endDateB);
124
                $dailyProgress = $contactProgressRecordMapper->fetchAllDataByDateRange($currentUser->id, $startDateA, $endDateB);
125
 
125
 
126
        $total = count($dailyProgress);
126
                $total = count($dailyProgress);
127
        $data = [
127
                $data = [
128
            'dailyProgress' => $dailyProgress,
128
                    'dailyProgress' => $dailyProgress,
129
            'total' => $total
129
                    'total' => $total
130
        ];
130
                ];
-
 
131
 
131
 
132
 
132
 
133
                return new JsonModel([