ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilTestSkillQuestionAssignmentsGUI Class Reference
+ Collaboration diagram for ilTestSkillQuestionAssignmentsGUI:

Public Member Functions

 __construct (ilCtrl $ctrl, ilTemplate $tpl, ilLanguage $lng, ilDB $db, ilObjTest $testOBJ)
 executeCommand ()

Data Fields

const CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'
const CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'
const CMD_SHOW_SKILL_SELECT = 'showSkillSelection'
const CMD_ADD_SKILL_QUEST_ASSIGN = 'addSkillQuestionAssignment'
const CMD_REMOVE_SKILL_QUEST_ASSIGN = 'removeSkillQuestionAssignment'

Private Member Functions

 addSkillQuestionAssignmentCmd ()
 removeSkillQuestionAssignmentCmd ()
 showSkillSelectionCmd ()
 saveSkillPointsCmd ()
 showSkillQuestionAssignmentsCmd ()
 buildTableGUI ()
 buildSkillQuestionAssignmentList ()
 buildSkillSelectorGUI ()
 isTestQuestion ($questionId)

Private Attributes

 $ctrl
 $tpl
 $lng
 $db
 $testOBJ

Detailed Description

Definition at line 14 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Constructor & Destructor Documentation

ilTestSkillQuestionAssignmentsGUI::__construct ( ilCtrl  $ctrl,
ilTemplate  $tpl,
ilLanguage  $lng,
ilDB  $db,
ilObjTest  $testOBJ 
)

Definition at line 46 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References $ctrl, $db, $lng, $testOBJ, and $tpl.

{
$this->ctrl = $ctrl;
$this->tpl = $tpl;
$this->lng = $lng;
$this->db = $db;
$this->testOBJ = $testOBJ;
}

Member Function Documentation

ilTestSkillQuestionAssignmentsGUI::addSkillQuestionAssignmentCmd ( )
private

Definition at line 62 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References $_GET, ilTestSkillQuestionAssignment\DEFAULT_COMPETENCE_POINTS, and isTestQuestion().

{
$questionId = (int)$_GET['question_id'];
$skillParameter = explode(':',$_GET['selected_skill']);
$skillBaseId = (int)$skillParameter[0];
$skillTrefId = (int)$skillParameter[1];
if( $this->isTestQuestion($questionId) && $skillBaseId )
{
require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
$assignment = new ilTestSkillQuestionAssignment($this->db);
$assignment->setTestId($this->testOBJ->getTestId());
$assignment->setQuestionId($questionId);
$assignment->setSkillBaseId($skillBaseId);
$assignment->setSkillTrefId($skillTrefId);
if( !$assignment->dbRecordExists() )
{
$assignment->saveToDb();
}
}
$this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentsGUI::buildSkillQuestionAssignmentList ( )
private

Definition at line 187 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by showSkillQuestionAssignmentsCmd().

{
require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignmentList.php';
$assignmentList = new ilTestSkillQuestionAssignmentList($this->db);
$assignmentList->setTestId($this->testOBJ->getTestId());
return $assignmentList;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentsGUI::buildSkillSelectorGUI ( )
private

Definition at line 196 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by showSkillSelectionCmd().

{
require_once 'Services/Skill/classes/class.ilSkillSelectorGUI.php';
$skillSelectorGUI = new ilSkillSelectorGUI(
$this, self::CMD_SHOW_SKILL_SELECT, $this, self::CMD_ADD_SKILL_QUEST_ASSIGN
);
return $skillSelectorGUI;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentsGUI::buildTableGUI ( )
private

Definition at line 179 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by showSkillQuestionAssignmentsCmd().

{
require_once 'Modules/Test/classes/tables/class.ilTestSkillQuestionAssignmentsTableGUI.php';
$table = new ilTestSkillQuestionAssignmentsTableGUI($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS, $this->ctrl, $this->lng);
return $table;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentsGUI::executeCommand ( )

Definition at line 55 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References $cmd.

{
$cmd = $this->ctrl->getCmd(self::CMD_SHOW_SKILL_QUEST_ASSIGNS) . 'Cmd';
$this->$cmd();
}
ilTestSkillQuestionAssignmentsGUI::isTestQuestion (   $questionId)
private

Definition at line 207 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by addSkillQuestionAssignmentCmd(), removeSkillQuestionAssignmentCmd(), and saveSkillPointsCmd().

{
foreach($this->testOBJ->getTestQuestions() as $question)
{
if( $question['question_id'] == $questionId )
{
return true;
}
}
return false;
}

+ Here is the caller graph for this function:

ilTestSkillQuestionAssignmentsGUI::removeSkillQuestionAssignmentCmd ( )
private

Definition at line 91 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References $_GET, and isTestQuestion().

{
$questionId = (int)$_GET['question_id'];
$skillBaseId = (int)$_GET['skill_base_id'];
$skillTrefId = (int)$_GET['skill_tref_id'];
if( $this->isTestQuestion($questionId) && $skillBaseId )
{
require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
$assignment = new ilTestSkillQuestionAssignment($this->db);
$assignment->setTestId($this->testOBJ->getTestId());
$assignment->setQuestionId($questionId);
$assignment->setSkillBaseId($skillBaseId);
$assignment->setSkillTrefId($skillTrefId);
if( $assignment->dbRecordExists() )
{
$assignment->deleteFromDb();
}
}
$this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentsGUI::saveSkillPointsCmd ( )
private

Definition at line 128 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References $_POST, $success, isTestQuestion(), and ilUtil\sendSuccess().

{
if( is_array($_POST['quantifiers']) )
{
require_once 'Modules/Test/classes/class.ilTestSkillQuestionAssignment.php';
$success = false;
foreach($_POST['quantifiers'] as $assignmentKey => $quantifier)
{
$assignmentKey = explode(':',$assignmentKey);
$skillBaseId = (int)$assignmentKey[0];
$skillTrefId = (int)$assignmentKey[1];
$questionId = (int)$assignmentKey[2];
if( $this->isTestQuestion($questionId) && (int)$quantifier > 0 )
{
$assignment = new ilTestSkillQuestionAssignment($this->db);
$assignment->setTestId($this->testOBJ->getTestId());
$assignment->setQuestionId($questionId);
$assignment->setSkillBaseId($skillBaseId);
$assignment->setSkillTrefId($skillTrefId);
if( $assignment->dbRecordExists() )
{
$assignment->setSkillPoints((int)$quantifier);
$assignment->saveToDb();
}
}
}
}
ilUtil::sendSuccess($this->lng->txt('tst_msg_skl_qst_assign_points_saved'), true);
$this->ctrl->redirect($this, self::CMD_SHOW_SKILL_QUEST_ASSIGNS);
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentsGUI::showSkillQuestionAssignmentsCmd ( )
private

Definition at line 165 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References buildSkillQuestionAssignmentList(), and buildTableGUI().

{
$table = $this->buildTableGUI();
$assignmentList = $this->buildSkillQuestionAssignmentList();
$assignmentList->loadFromDb();
$assignmentList->loadAdditionalSkillData();
$table->setSkillQuestionAssignmentList($assignmentList);
$table->setData($this->testOBJ->getTestQuestions());
$this->tpl->setContent($this->ctrl->getHTML($table));
}

+ Here is the call graph for this function:

ilTestSkillQuestionAssignmentsGUI::showSkillSelectionCmd ( )
private

Definition at line 116 of file class.ilTestSkillQuestionAssignmentsGUI.php.

References buildSkillSelectorGUI().

{
$skillSelectorGUI = $this->buildSkillSelectorGUI();
if( !$skillSelectorGUI->handleCommand() )
{
$this->ctrl->saveParameter($this, 'question_id');
$this->tpl->setContent($this->ctrl->getHTML($skillSelectorGUI));
}
}

+ Here is the call graph for this function:

Field Documentation

ilTestSkillQuestionAssignmentsGUI::$ctrl
private

Definition at line 24 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

ilTestSkillQuestionAssignmentsGUI::$db
private

Definition at line 39 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

ilTestSkillQuestionAssignmentsGUI::$lng
private

Definition at line 34 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

ilTestSkillQuestionAssignmentsGUI::$testOBJ
private

Definition at line 44 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

ilTestSkillQuestionAssignmentsGUI::$tpl
private

Definition at line 29 of file class.ilTestSkillQuestionAssignmentsGUI.php.

Referenced by __construct().

const ilTestSkillQuestionAssignmentsGUI::CMD_ADD_SKILL_QUEST_ASSIGN = 'addSkillQuestionAssignment'

Definition at line 19 of file class.ilTestSkillQuestionAssignmentsGUI.php.

const ilTestSkillQuestionAssignmentsGUI::CMD_REMOVE_SKILL_QUEST_ASSIGN = 'removeSkillQuestionAssignment'
const ilTestSkillQuestionAssignmentsGUI::CMD_SAVE_SKILL_POINTS = 'saveSkillPoints'
const ilTestSkillQuestionAssignmentsGUI::CMD_SHOW_SKILL_QUEST_ASSIGNS = 'showSkillQuestionAssignments'
const ilTestSkillQuestionAssignmentsGUI::CMD_SHOW_SKILL_SELECT = 'showSkillSelection'

The documentation for this class was generated from the following file: