Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 64 additions & 29 deletions components/ILIAS/Skill/Personal/class.ilPersonalSkillsGUI.php
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,8 @@ public function getSkillHTML(
int $a_top_skill_id,
int $a_user_id = 0,
bool $a_edit = false,
int $a_tref_id = 0
int $a_tref_id = 0,
bool $is_gap_mode = false
): string {
$main_tpl = $this->tpl;

Expand All @@ -500,7 +501,7 @@ public function getSkillHTML(
);
$skill_html = "";
if (!$uip->replaced()) {
$skill_html = $this->renderSkillHTML($a_top_skill_id, $a_user_id, $a_edit, $a_tref_id);
$skill_html = $this->renderSkillHTML($a_top_skill_id, $a_user_id, $a_edit, $a_tref_id, $is_gap_mode);
}
$skill_html = $uip->getHTML($skill_html);
$main_tpl->addJavaScript("assets/js/SkillEntries.js");
Expand All @@ -512,7 +513,8 @@ public function renderSkillHTML(
int $a_top_skill_id,
int $a_user_id = 0,
bool $a_edit = false,
int $a_tref_id = 0
int $a_tref_id = 0,
bool $is_gap_mode = false
): string {
$ilCtrl = $this->ctrl;
$ilUser = $this->user;
Expand Down Expand Up @@ -728,12 +730,12 @@ public function renderSkillHTML(
if ($this->use_materials) {
$actions[] = $this->ui_fac->button()->shy(
$lng->txt('skmg_assign_materials'),
$ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "assignMaterials")
$ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", ($is_gap_mode ? "assignMaterialsGap" : "assignMaterials"))
);
}
$actions[] = $this->ui_fac->button()->shy(
$lng->txt('skmg_self_evaluation'),
$ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", "selfEvaluation")
$ilCtrl->getLinkTargetByClass("ilpersonalskillsgui", ($is_gap_mode ? "selfEvaluationGap" : "selfEvaluation"))
);
$sub = $sub->withActions($this->ui_fac->dropdown()->standard($actions)->withLabel($lng->txt("actions")));
}
Expand Down Expand Up @@ -898,10 +900,15 @@ public function removeSkills(): void
// Materials assignments
//

public function assignMaterialsGap(): void
{
$this->assignMaterials(true);
}

/**
* Assign materials to skill levels
*/
public function assignMaterials(): void
public function assignMaterials(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$lng = $this->lng;
Expand All @@ -911,7 +918,8 @@ public function assignMaterials(): void

$cmd = ($this->requested_list_mode == self::LIST_SELECTED || empty($this->user_profiles))
? "render"
: "listAssignedProfile";
: ($is_gap_mode ? "listProfileForGap" : "listAssignedProfile");
$ilTabs->clearTargets();
$ilTabs->setBackTarget(
$lng->txt("back"),
$ilCtrl->getLinkTarget($this, $cmd)
Expand Down Expand Up @@ -954,7 +962,7 @@ public function assignMaterials(): void
$ilToolbar->addInputItem($si, true);
$ilToolbar->addFormButton(
$lng->txt("select"),
"assignMaterials"
($is_gap_mode ? "assignMaterialsGap" : "assignMaterials")
);

$ilToolbar->setFormAction($ilCtrl->getFormAction($this));
Expand All @@ -963,17 +971,23 @@ public function assignMaterials(): void
$table = $this->table_manager->getAssignMaterialsTable(
$this->requested_skill_id,
$this->requested_tref_id,
$cur_basic_skill_id
$cur_basic_skill_id,
$is_gap_mode
)->getComponent();

$tpl->setContent($this->ui_ren->render($table));
}


public function assignMaterialGap(): void
{
$this->assignMaterial(true);
}

/**
* Assign materials to skill level
*/
public function assignMaterial(): void
public function assignMaterial(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$ilUser = $this->user;
Expand All @@ -994,7 +1008,7 @@ public function assignMaterial(): void
$message = $ui->renderer()->render($mbox);
}

if ($this->requested_table_assign_materials_action === "assignMaterials"
if (in_array($this->requested_table_assign_materials_action, ["assignMaterialsGap", "assignMaterials"])
&& !empty($this->requested_table_assign_materials_level_ids)) {
$ilCtrl->setParameter($this, "level_id", $this->requested_table_assign_materials_level_ids[0]);
}
Expand All @@ -1003,13 +1017,13 @@ public function assignMaterial(): void
$ilCtrl->saveParameter($this, "tref_id");
$ilCtrl->saveParameter($this, "basic_skill_id");

$ilTabs->clearTargets();
$ilTabs->setBackTarget(
$lng->txt("back"),
$ilCtrl->getLinkTarget($this, "assignMaterials")
$ilCtrl->getLinkTarget($this, ($is_gap_mode ? "assignMaterialsGap" : "assignMaterials"))
);


$exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, "assignMaterial", $this, "");
$exp = new ilWorkspaceExplorerGUI($ilUser->getId(), $this, ($is_gap_mode ? "assignMaterialGap" : "assignMaterial"), $this, "");
$exp->setTypeWhiteList(array("blog", "wsrt", "wfld", "file", "tstv", "excv"));
$exp->setSelectableTypes(array("file", "tstv", "excv"));
$exp->setSelectMode("wsp_ids", true);
Expand All @@ -1025,7 +1039,7 @@ public function assignMaterial(): void
$tb = new ilToolbarGUI();
$tb->addFormButton(
$lng->txt("select"),
"selectMaterial"
($is_gap_mode ? "selectMaterialGap" : "selectMaterial")
);
$tb->setFormAction($ilCtrl->getFormAction($this));
$tb->setOpenFormTag(true);
Expand All @@ -1038,7 +1052,12 @@ public function assignMaterial(): void
$tpl->setContent($message . $mtpl->get());
}

public function selectMaterial(): void
public function selectMaterialGap(): void
{
$this->selectMaterial(true);
}

public function selectMaterial(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$ilUser = $this->user;
Expand All @@ -1064,16 +1083,21 @@ public function selectMaterial(): void
$ilCtrl->saveParameter($this, "tref_id");
$ilCtrl->saveParameter($this, "basic_skill_id");

$ilCtrl->redirect($this, "assignMaterials");
$ilCtrl->redirect($this, ($is_gap_mode ? "assignMaterialsGap" : "assignMaterials"));
}

public function removeMaterial(): void
public function removeMaterialGap(): void
{
$this->removeMaterial(true);
}

public function removeMaterial(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$ilUser = $this->user;
$lng = $this->lng;

if ($this->requested_table_assign_materials_action === "removeMaterial"
if (in_array($this->requested_table_assign_materials_action, ["removeMaterialGap", "removeMaterial"])
&& !empty($this->requested_table_assign_materials_level_ids)
&& $this->requested_table_assign_materials_wsp_id !== 0) {
$this->assigned_material_manager->removeAssignedMaterial(
Expand All @@ -1084,15 +1108,20 @@ public function removeMaterial(): void
);
$this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
}
$ilCtrl->redirect($this, "assignMaterials");
$ilCtrl->redirect($this, ($is_gap_mode ? "assignMaterialsGap" : "assignMaterials"));
}


//
// Self evaluation
//

public function selfEvaluation(): void
public function selfEvaluationGap(): void
{
$this->selfEvaluation(true);
}

public function selfEvaluation(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$lng = $this->lng;
Expand All @@ -1102,7 +1131,8 @@ public function selfEvaluation(): void

$cmd = ($this->requested_list_mode == self::LIST_SELECTED || empty($this->user_profiles))
? "render"
: "listAssignedProfile";
: ($is_gap_mode ? "listProfileForGap" : "listAssignedProfile");
$ilTabs->clearTargets();
$ilTabs->setBackTarget(
$lng->txt("back"),
$ilCtrl->getLinkTarget($this, $cmd)
Expand Down Expand Up @@ -1146,17 +1176,17 @@ public function selfEvaluation(): void
$ilToolbar->addInputItem($si, true);
$ilToolbar->addFormButton(
$lng->txt("select"),
"selfEvaluation"
($is_gap_mode ? "selfEvaluationGap" : "selfEvaluation")
);

$ilToolbar->setFormAction($ilCtrl->getFormAction($this));
}

$form = $this->getSelfEvaluationForm($cur_basic_skill_id);
$form = $this->getSelfEvaluationForm($cur_basic_skill_id, $is_gap_mode);
$tpl->setContent($this->ui_ren->render($form));
}

protected function getSelfEvaluationForm(int $cur_basic_skill_id): Form
protected function getSelfEvaluationForm(int $cur_basic_skill_id, bool $is_gap_mode = false): Form
{
$top_skill_id = $this->requested_skill_id;
$tref_id = $this->requested_tref_id;
Expand Down Expand Up @@ -1188,11 +1218,16 @@ protected function getSelfEvaluationForm(int $cur_basic_skill_id): Form
$section_title
);

$form_action = $this->ctrl->getFormAction($this, "saveSelfEvaluation");
$form_action = $this->ctrl->getFormAction($this, ($is_gap_mode ? "saveSelfEvaluationGap" : "saveSelfEvaluation"));
return $this->ui_fac->input()->container()->form()->standard($form_action, ["section" => $section]);
}

public function saveSelfEvaluation(): void
public function saveSelfEvaluationGap(): void
{
$this->saveSelfEvaluation(true);
}

public function saveSelfEvaluation(bool $is_gap_mode = false): void
{
$ilCtrl = $this->ctrl;
$ilUser = $this->user;
Expand All @@ -1202,7 +1237,7 @@ public function saveSelfEvaluation(): void
$form = $this->getSelfEvaluationForm($this->requested_basic_skill_id);
$ilCtrl->clearParameterByClass("ilpersonalskillsgui", "basic_skill_id");
$cmd = ($this->requested_list_mode == self::LIST_SELECTED || empty($this->user_profiles))
? "render" : "listAssignedProfile";
? "render" : ($is_gap_mode ? "listProfileForGap" : "listAssignedProfile");

if ($this->request->getMethod() === "POST") {
$form = $form->withRequest($this->request);
Expand Down Expand Up @@ -1471,7 +1506,7 @@ public function getGapAnalysisHTML(int $a_user_id = 0, ?array $a_skills = null):
}
}
$bc_skills[] = $s;
$html .= $this->getSkillHTML($s->getBaseSkillId(), $user_id, false, $s->getTrefId());
$html .= $this->getSkillHTML($s->getBaseSkillId(), $user_id, true, $s->getTrefId(), true);
}

if ($not_all_self_evaluated) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class AssignMaterialsTable
protected int $tref_id = 0;
protected int $basic_skill_id = 0;

public function __construct(int $top_skill_id, int $tref_id, int $basic_skill_id)
public function __construct(int $top_skill_id, int $tref_id, int $basic_skill_id, protected bool $is_gap_mode = false)
{
global $DIC;

Expand Down Expand Up @@ -114,7 +114,7 @@ protected function getActions(): array
$uri_assign = $this->df->uri(
ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
"ilpersonalskillsgui",
"assignMaterial"
($this->is_gap_mode ? "assignMaterialGap" : "assignMaterial")
)
);
$url_builder_assign = new UI\URLBuilder($uri_assign);
Expand All @@ -128,7 +128,7 @@ protected function getActions(): array
$actions = [
"assign" => $this->ui_fac->table()->action()->single(
$this->lng->txt("skmg_assign_materials"),
$url_builder_assign->withParameter($action_parameter_token_assign, "assignMaterials"),
$url_builder_assign->withParameter($action_parameter_token_assign, ($this->is_gap_mode ? "assignMaterialsGap" : "assignMaterials")),
$row_id_token_assign
)
];
Expand All @@ -143,7 +143,7 @@ protected function getActions(): array
$uri_remove = $this->df->uri(
ILIAS_HTTP_PATH . "/" . $this->ctrl->getLinkTargetByClass(
"ilpersonalskillsgui",
"removeMaterial"
($this->is_gap_mode ? "removeMaterialGap" : "removeMaterial")
)
);
$url_builder_remove = new UI\URLBuilder($uri_remove);
Expand All @@ -159,7 +159,7 @@ protected function getActions(): array
$actions["remove_" . $material->getLevelId() . "_" . $material->getWorkspaceId()] =
$this->ui_fac->table()->action()->single(
$this->lng->txt("skmg_remove") . " '" . \ilObject::_lookupTitle($obj_id) . "'",
$url_builder_remove->withParameter($action_parameter_token_remove, "removeMaterial"),
$url_builder_remove->withParameter($action_parameter_token_remove, ($this->is_gap_mode ? "removeMaterialGap" : "removeMaterial")),
$row_id_token_remove
);
}
Expand Down
5 changes: 3 additions & 2 deletions components/ILIAS/Skill/Table/classes/class.TableManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,9 @@ public function getProfileUserAssignmentTable(
public function getAssignMaterialsTable(
int $top_skill_id,
int $tref_id,
int $basic_skill_id
int $basic_skill_id,
bool $is_gap_mode = false
): AssignMaterialsTable {
return new AssignMaterialsTable($top_skill_id, $tref_id, $basic_skill_id);
return new AssignMaterialsTable($top_skill_id, $tref_id, $basic_skill_id, $is_gap_mode);
}
}
Loading