| Línea 28... |
Línea 28... |
| 28 |
use LeadersLinked\Mapper\UserProfileMapper;
|
28 |
use LeadersLinked\Mapper\UserProfileMapper;
|
| 29 |
use LeadersLinked\Mapper\ProfileVisitMapper;
|
29 |
use LeadersLinked\Mapper\ProfileVisitMapper;
|
| 30 |
use LeadersLinked\Mapper\ConnectionMapper;
|
30 |
use LeadersLinked\Mapper\ConnectionMapper;
|
| 31 |
use LeadersLinked\Model\CompanyFollower;
|
31 |
use LeadersLinked\Model\CompanyFollower;
|
| 32 |
use LeadersLinked\Mapper\CompanyMicrolearningUserProgressMapper;
|
32 |
use LeadersLinked\Mapper\CompanyMicrolearningUserProgressMapper;
|
| - |
|
33 |
use LeadersLinked\Mapper\CompanyMicrolearningUserLogMapper;
|
| - |
|
34 |
use LeadersLinked\Mapper\DailyPulseRecordMapper;
|
| - |
|
35 |
use LeadersLinked\Model\DailyPulseRecord;
|
| - |
|
36 |
use LeadersLinked\Mapper\SurveyCampaignMapper;
|
| - |
|
37 |
use LeadersLinked\Mapper\RecruitmentSelectionApplicationMapper;
|
| - |
|
38 |
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
|
| - |
|
39 |
use LeadersLinked\Mapper\PerformanceEvaluationTestMapper;
|
| Línea 33... |
Línea 40... |
| 33 |
|
40 |
|
| 34 |
|
41 |
|
| Línea 101... |
Línea 108... |
| 101 |
|
108 |
|
| 102 |
|
109 |
|
| 103 |
|
110 |
|
| 104 |
$this->layout()->setTemplate('layout/layout-backend.phtml');
|
111 |
$this->layout()->setTemplate('layout/layout-backend.phtml');
|
| 105 |
$viewModel = new ViewModel();
|
112 |
$viewModel = new ViewModel();
|
| Línea 106... |
Línea 113... |
| 106 |
/*
|
113 |
|
| 107 |
$company = $currentUserPlugin->getCompany();
|
114 |
$company = $currentUserPlugin->getCompany();
|
| - |
|
115 |
if($company) {
|
| - |
|
116 |
|
| - |
|
117 |
$companyMicrolearningUserLogMapepr = CompanyMicrolearningUserLogMapper::getInstance($this->adapter);
|
| - |
|
118 |
$end_date = $companyMicrolearningUserLogMapepr->fetchOneMaxDateActivityFromCompanyId($company->id);
|
| - |
|
119 |
if($end_date) {
|
| - |
|
120 |
|
| - |
|
121 |
|
| - |
|
122 |
$t = strtotime($end_date);
|
| - |
|
123 |
$start_date = date('Y-m-d', strtotime('-30 days', $t));
|
| - |
|
124 |
|
| - |
|
125 |
$closed_capsules_x_days = $companyMicrolearningUserLogMapepr->fetchAllCountClosedCapsulesDailyByCompanyIdAndStartDateAndEndDate($company->id, $start_date, $end_date);
|
| - |
|
126 |
$users_with_closed_capsules_x_days = $companyMicrolearningUserLogMapepr->fetchAllCountUsersWithClosedCapsulesDailyByCompanyIdAndStartDateAndEndDate($company->id, $start_date, $end_date);
|
| - |
|
127 |
|
| - |
|
128 |
|
| - |
|
129 |
} else {
|
| - |
|
130 |
$closed_capsules_x_days = [];
|
| - |
|
131 |
$users_with_closed_capsules_x_days = [];
|
| - |
|
132 |
|
| - |
|
133 |
}
|
| - |
|
134 |
|
| - |
|
135 |
$average_closed_capsules_x_days = 0;
|
| - |
|
136 |
$average_users_with_closed_capsules_x_day = 0;
|
| - |
|
137 |
|
| - |
|
138 |
|
| - |
|
139 |
$max = count($closed_capsules_x_days);
|
| - |
|
140 |
if($max) {
|
| - |
|
141 |
for($i = 0; $i < $max; $i++)
|
| - |
|
142 |
{
|
| - |
|
143 |
$average_closed_capsules_x_days += $closed_capsules_x_days[$i]['total'];
|
| - |
|
144 |
}
|
| - |
|
145 |
$average_closed_capsules_x_days = $average_closed_capsules_x_days / $max;
|
| - |
|
146 |
|
| - |
|
147 |
}
|
| - |
|
148 |
|
| - |
|
149 |
|
| - |
|
150 |
$max = count($users_with_closed_capsules_x_days);
|
| - |
|
151 |
if($max) {
|
| - |
|
152 |
for($i = 0; $i < $max; $i++)
|
| - |
|
153 |
{
|
| - |
|
154 |
$average_users_with_closed_capsules_x_day += $users_with_closed_capsules_x_days[$i]['total'];
|
| - |
|
155 |
}
|
| - |
|
156 |
$average_users_with_closed_capsules_x_day = $average_users_with_closed_capsules_x_day / $max;
|
| - |
|
157 |
|
| - |
|
158 |
}
|
| - |
|
159 |
|
| - |
|
160 |
|
| - |
|
161 |
$users_with_daily_pulse_x_days = [];
|
| - |
|
162 |
$average_users_with_daily_pulse_x_days = 0;
|
| - |
|
163 |
|
| - |
|
164 |
$dailyPulseRecordMapper = DailyPulseRecordMapper::getInstance($this->adapter);
|
| - |
|
165 |
$end_date = $dailyPulseRecordMapper->fetchOneMaxDateActivityFromCompanyId($company->id);
|
| - |
|
166 |
if($end_date) {
|
| - |
|
167 |
|
| - |
|
168 |
|
| - |
|
169 |
$t = strtotime($end_date);
|
| - |
|
170 |
$start_date = date('Y-m-d', strtotime('-30 days', $t));
|
| - |
|
171 |
|
| - |
|
172 |
$users_with_daily_pulse_x_days = $dailyPulseRecordMapper->fetchAllCountUsersWithClosedCapsulesDailyByCompanyIdAndStartDateAndEndDate($company->id, $start_date, $end_date);
|
| - |
|
173 |
$average_users_with_daily_pulse_x_days = 0;
|
| - |
|
174 |
|
| - |
|
175 |
$max = count($users_with_daily_pulse_x_days);
|
| - |
|
176 |
if($max) {
|
| - |
|
177 |
|
| - |
|
178 |
for($i = 0; $i < $max; $i++)
|
| - |
|
179 |
{
|
| - |
|
180 |
$average_users_with_daily_pulse_x_days += $users_with_daily_pulse_x_days[$i]['total'];
|
| - |
|
181 |
}
|
| - |
|
182 |
$average_users_with_daily_pulse_x_days = $average_users_with_daily_pulse_x_days / $max;
|
| - |
|
183 |
|
| - |
|
184 |
}
|
| - |
|
185 |
|
| - |
|
186 |
|
| - |
|
187 |
}
|
| - |
|
188 |
|
| - |
|
189 |
$followerMapper = CompanyFollowerMapper::getInstance($this->adapter);
|
| - |
|
190 |
$total_followers = $followerMapper->fetchCountByCompanyId($company->id);
|
| - |
|
191 |
|
| - |
|
192 |
|
| - |
|
193 |
$surveyCampaignMapper = SurveyCampaignMapper::getInstance($this->adapter);
|
| - |
|
194 |
$total_surveys = $surveyCampaignMapper->fetchCountByCompanyId($company->id);
|
| - |
|
195 |
|
| - |
|
196 |
$recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
|
| - |
|
197 |
$total_recruitment_selection_vacancies = $recruitmentSelectionVacancyMapper->fetchCountByCompanyId($company->id);
|
| Línea 108... |
Línea 198... |
| 108 |
if($company) {
|
198 |
|
| - |
|
199 |
$performanceEvaluationTestMapper = PerformanceEvaluationTestMapper::getInstance($this->adapter);
|
| - |
|
200 |
$total_performance_evaluation_tests = $performanceEvaluationTestMapper->fetchCountByCompanyId($company->id);
|
| - |
|
201 |
|
| - |
|
202 |
|
| - |
|
203 |
$viewModel->setTemplate('leaders-linked/dashboard/company.phtml');
|
| - |
|
204 |
$viewModel->setVariables([
|
| - |
|
205 |
'average_closed_capsules_x_days' => $average_closed_capsules_x_days,
|
| - |
|
206 |
'average_users_with_closed_capsules_x_day' => $average_users_with_closed_capsules_x_day,
|
| - |
|
207 |
'closed_capsules_x_days' => $closed_capsules_x_days,
|
| - |
|
208 |
'users_with_closed_capsules_x_days' => $users_with_closed_capsules_x_days,
|
| - |
|
209 |
'users_with_daily_pulse_x_days' => $users_with_daily_pulse_x_days,
|
| - |
|
210 |
'average_users_with_daily_pulse_x_days' => $average_users_with_daily_pulse_x_days,
|
| Línea 109... |
Línea 211... |
| 109 |
|
211 |
'total_followers' => $total_followers,
|
| 110 |
$companyMicrolearningUserProgressMapper = CompanyMicrolearningUserProgressMapper::getInstance($this->adapter);
|
212 |
'total_surveys' => $total_surveys,
|
| 111 |
$companyMicrolearningUserProgressMapper->fetchCountCapsulesCompletedByIdAndTopicId($user_id, $topic_id)
|
213 |
'total_recruitment_selection_vacancies' => $total_recruitment_selection_vacancies,
|
| 112 |
|
214 |
'total_performance_evaluation_tests' => $total_performance_evaluation_tests,
|
| Línea 113... |
Línea -... |
| 113 |
$viewModel->setTemplate('leaders-linked/dashboard/company.phtml');
|
- |
|
| - |
|
215 |
]);
|
| 114 |
|
216 |
|
| 115 |
} else {
|
217 |
} else {
|
| Línea 116... |
Línea 218... |
| 116 |
$viewModel->setTemplate('leaders-linked/dashboard/index.phtml');
|
218 |
$viewModel->setTemplate('leaders-linked/dashboard/index.phtml');
|
| 117 |
}
|
219 |
}
|