Add start/resume buttons or appraisee list to info screen.
222 : void {
224
226 if ($this->access_manager->canStartSurvey() &&
228 if (!$this->feature_config->usesAppraisees()) {
229 if ($anonymous_code) {
230 $info->addHiddenElement("anonymous_id", $anonymous_code);
231 }
232 $big_button = false;
233 if ($this->run_manager->hasStarted() &&
234 !$this->run_manager->hasFinished()) {
235 $big_button = array(
"resume", $this->
lng->txt(
"resume_survey"));
236 } elseif (!$this->run_manager->hasStarted()) {
237 $big_button = array(
"start", $this->
lng->txt(
"start_survey"));
238 }
239 if ($big_button) {
241 $button->setCaption($big_button[1], false);
242 $button->setCommand($big_button[0]);
243 $button->setPrimary(true);
244 $this->
toolbar->addButtonInstance($button);
245 }
246 } else {
247
248
249 $appr_ids = array();
250
251
252 if ($anonymous_code) {
254 if ($anonymous_id) {
256 }
257 }
258
259
260
263 }
264
265 if (count($appr_ids)) {
266
267 $active_appraisees = array();
268 foreach ($this->run_manager
269 ->getRunsForUser($this->
user->getId(), $anonymous_code) as $item) {
270 $active_appraisees[$item->getAppraiseeId()] = $item->getFinished();
271 }
272
273 $list = array();
274 foreach ($appr_ids as $appr_id) {
276
277 $list[$appr_id] = $this->
lng->txt(
"survey_360_appraisee_is_closed");
278 } elseif (array_key_exists($appr_id, $active_appraisees)) {
279
280 if ($active_appraisees[$appr_id]) {
281 $list[$appr_id] = $this->
lng->txt(
"already_completed_survey");
282 }
283
284 else {
285 $list[$appr_id] = array(
"resume", $this->
lng->txt(
"resume_survey"));
286 }
287 } else {
288
289 $list[$appr_id] = array(
"start", $this->
lng->txt(
"start_survey"));
290 }
291 }
292
293 $info->addSection($this->
lng->txt(
"survey_360_rate_other_appraisees"));
294
295 if (!$this->status_manager->isAppraisee()) {
297 }
298
299 foreach ($list as $appr_id => $item) {
301
302 if (!is_array($item)) {
303 $info->addProperty($appr_name, $item);
304 } else {
305 $this->
ctrl->setParameter($output_gui,
"appr_id", $appr_id);
306 $href = $this->
ctrl->getLinkTarget($output_gui, $item[0]);
307 $this->
ctrl->setParameter($output_gui,
"appr_id",
"");
308
310 $button->setCaption($item[1], false);
311 $button->setUrl($href);
312 $big_button_360 = '<div>' . $button->render() . '</div>';
313
314 $info->addProperty($appr_name, $big_button_360);
315 }
316 }
318 $this->main_tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
"survey_360_no_appraisees"));
319 }
320 }
321 }
322 }
Participants StatusManager $status_manager
mustEnterCode(string $code="")
Check if user must enter code to start (and currently is able to start)
getAppraiseesToRate(?int $a_user_id, int $a_anonymous_id=null)
getAnonymousIdByCode(string $a_code)
isAppraiseeClosed(int $a_user_id)
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is: