ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilSurveySkillDeterminationGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
14 {
18  protected $ctrl;
19 
23  protected $tpl;
24 
28  protected $toolbar;
29 
33  protected $lng;
34 
40  public function __construct(ilObjSurvey $a_survey)
41  {
42  global $DIC;
43 
44  $this->ctrl = $DIC->ctrl();
45  $this->tpl = $DIC["tpl"];
46  $this->toolbar = $DIC->toolbar();
47  $this->lng = $DIC->language();
48  $this->survey = $a_survey;
49  }
50 
54  public function executeCommand()
55  {
57 
58  $cmd = $ilCtrl->getCmd("listSkillChanges");
59 
60  //$ilCtrl->saveParameter($this, array("sk_id", "tref_id"));
61 
62  if (in_array($cmd, array("listSkillChanges", "writeAndAddSkills"))) {
63  $this->$cmd();
64  }
65  }
66 
70  public function listSkillChanges()
71  {
72  $tpl = $this->tpl;
73  $ilToolbar = $this->toolbar;
74  $lng = $this->lng;
76 
77  if ($this->survey->get360Mode()) {
78  $apps = $this->survey->getAppraiseesData();
79  } else { // Mode self evaluation, No Appraisee and Rater involved.
80  $apps = $this->survey->getSurveyParticipants();
81  }
82  $ctpl = new ilTemplate("tpl.svy_skill_list_changes.html", true, true, "Modules/Survey");
83  foreach ($apps as $app) {
84  $changes_table = new ilSurveySkillChangesTableGUI(
85  $this,
86  "listSkillChanges",
87  $this->survey,
88  $app
89  );
90 
91  $ctpl->setCurrentBlock("appraisee");
92  $ctpl->setVariable("LASTNAME", $app["lastname"]);
93  $ctpl->setVariable("FIRSTNAME", $app["firstname"]);
94 
95  $ctpl->setVariable("CHANGES_TABLE", $changes_table->getHTML());
96 
97  $ctpl->parseCurrentBlock();
98  }
99 
100  $tpl->setContent($ctpl->get());
101  }
102 
109  public function writeAndAddSkills()
110  {
111  $lng = $this->lng;
113  return;
114  $sskill = new ilSurveySkill($this->survey);
115  $apps = $this->survey->getAppraiseesData();
116  $ctpl = new ilTemplate("tpl.svy_skill_list_changes.html", true, true, "Modules/Survey");
117  foreach ($apps as $app) {
118  $new_levels = $sskill->determineSkillLevelsForAppraisee($app["user_id"]);
119  foreach ($new_levels as $nl) {
120  if ($nl["new_level_id"] > 0) {
122  $nl["new_level_id"],
123  $app["user_id"],
124  $this->survey->getRefId(),
125  $nl["tref_id"],
127  );
128 
129  if ($nl["tref_id"] > 0) {
130  ilPersonalSkill::addPersonalSkill($app["user_id"], $nl["tref_id"]);
131  } else {
132  ilPersonalSkill::addPersonalSkill($app["user_id"], $nl["base_skill_id"]);
133  }
134  }
135  }
136  }
137  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
138  $ilCtrl->redirect($this, "listSkillChanges");
139  }
140 }
$app
Definition: cli.php:38
Class ilObjSurvey.
TableGUI class for survey skill changes.
global $ilCtrl
Definition: ilias.php:18
Skill/Competence handling in surveys.
static addPersonalSkill($a_user_id, $a_skill_node_id)
Add personal skill.
__construct(ilObjSurvey $a_survey)
Constructor.
writeAndAddSkills()
Write skills and add them to user&#39;s competence records.
$DIC
Definition: xapitoken.php:46
static writeUserSkillLevelStatus( $a_level_id, $a_user_id, $a_trigger_ref_id, $a_tref_id=0, $a_status=ilBasicSkill::ACHIEVED, $a_force=false, $a_self_eval=false, $a_unique_identifier="")
Write skill level status.
Survey skill determination GUI class.