ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCourseObjectivesGUI Class Reference

class ilobjcourseobjectivesgui More...

+ Inheritance diagram for ilCourseObjectivesGUI:
+ Collaboration diagram for ilCourseObjectivesGUI:

Public Member Functions

 __construct ($a_course_id)
 Constructor. More...
 
 executeCommand ()
 execute command More...
 
 getSettings ()
 Get settings. More...
 
 askDeleteObjective ()
 
 deleteObjectives ()
 
 __initCourseObject ()
 
 __initObjectivesObject ($a_id=0)
 
 __initLMObject ($a_objective_id=0)
 
 __initQuestionObject ($a_objective_id=0)
 
 setSubTabs ($a_active="")
 set sub tabs More...
 
 create ()
 create objective More...
 

Data Fields

const MODE_UNDEFINED = 0
 
const MODE_CREATE = 1
 
const MODE_UPDATE = 2
 
 $ctrl
 
 $ilias
 
 $ilErr
 
 $lng
 
 $tpl
 
 $course_obj
 
 $course_id
 

Protected Member Functions

 listObjectives ()
 list objectives More...
 
 saveSorting ()
 save position More...
 
 questionOverview ()
 question overiew More...
 
 saveQuestionOverview ()
 update question overview More...
 
 edit ()
 edit objective More...
 
 save ()
 save More...
 
 materialAssignment ()
 material assignment More...
 
 updateMaterialAssignment ()
 update material assignment More...
 
 selfAssessmentAssignment ()
 self assessment assignemnt More...
 
 updateSelfAssessmentAssignment ()
 update self assessment assignment More...
 
 selfAssessmentLimits ()
 self assessment limits More...
 
 updateSelfAssessmentLimits ()
 update self assessment limits More...
 
 finalTestAssignment ()
 final test assignment More...
 
 isRandomTestType ($a_tst_type=0)
 
 showRandomTestAssignment (ilPropertyFormGUI $form=null)
 
 initFormRandom ()
 show random test More...
 
 saveRandom ()
 Save random test settings. More...
 
 updateFinalTestAssignment ()
 update self assessment assignment More...
 
 finalSeparatedTestAssignment (ilPropertyFormGUI $form=null)
 Show test assignment form. More...
 
 finalTestLimits ()
 self assessment limits More...
 
 updateFinalTestLimits ()
 update self assessment limits More...
 
 initFormLimits ($a_mode)
 init limit form More...
 
 initFormTitle ($a_mode, $a_step_number)
 init form title More...
 
 initWizard ($a_step_number)
 init wizard More...
 

Protected Attributes

 $settings
 
 $test_type = 0
 

Private Attributes

 $logger = null
 

Detailed Description

class ilobjcourseobjectivesgui

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 36 of file class.ilCourseObjectivesGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilCourseObjectivesGUI::__construct (   $a_course_id)

Constructor.

Parameters
int$a_course_id

Definition at line 66 of file class.ilCourseObjectivesGUI.php.

References $GLOBALS, $ilCtrl, $ilErr, $ilias, $lng, $tpl, __initCourseObject(), array, ilLOSettings\getInstanceByObjId(), and settings().

67  {
68  include_once './Modules/Course/classes/class.ilCourseObjective.php';
69 
70  global $ilCtrl,$lng,$ilErr,$ilias,$tpl,$tree,$ilTabs;
71 
72  $this->ctrl = $ilCtrl;
73  $this->ctrl->saveParameter($this, array("ref_id"));
74 
75  $this->logger = $GLOBALS['DIC']->logger()->crs();
76  $this->ilErr = $ilErr;
77  $this->lng = $lng;
78  $this->lng->loadLanguageModule('crs');
79  $this->tpl = $tpl;
80  $this->tree = $tree;
81  $this->tabs_gui = $ilTabs;
82 
83  $this->course_id = $a_course_id;
84  $this->__initCourseObject();
85 
86  // begin-patch lok
87  $this->settings = ilLOSettings::getInstanceByObjId($this->course_obj->getId());
88  // end-patch lok
89  }
static getInstanceByObjId($a_obj_id)
get singleton instance
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
global $ilCtrl
Definition: ilias.php:18
Create styles array
The data for the language used.
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ __initCourseObject()

ilCourseObjectivesGUI::__initCourseObject ( )

Definition at line 374 of file class.ilCourseObjectivesGUI.php.

References exit, and ilObjectFactory\getInstanceByRefId().

Referenced by __construct().

375  {
376  if (!$this->course_obj =&ilObjectFactory::getInstanceByRefId($this->course_id, false)) {
377  $this->ilErr->raiseError("ilCourseObjectivesGUI: cannot create course object", $this->ilErr->MESSAGE);
378  exit;
379  }
380  return true;
381  }
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ __initLMObject()

ilCourseObjectivesGUI::__initLMObject (   $a_objective_id = 0)

Definition at line 388 of file class.ilCourseObjectivesGUI.php.

Referenced by updateMaterialAssignment().

389  {
390  include_once './Modules/Course/classes/class.ilCourseObjectiveMaterials.php';
391  $this->objectives_lm_obj = new ilCourseObjectiveMaterials($a_objective_id);
392 
393  return true;
394  }
class ilCourseObjectiveMaterials
+ Here is the caller graph for this function:

◆ __initObjectivesObject()

ilCourseObjectivesGUI::__initObjectivesObject (   $a_id = 0)

Definition at line 383 of file class.ilCourseObjectivesGUI.php.

Referenced by askDeleteObjective(), and deleteObjectives().

384  {
385  return $this->objectives_obj = new ilCourseObjective($this->course_obj, $a_id);
386  }
class ilcourseobjective
+ Here is the caller graph for this function:

◆ __initQuestionObject()

ilCourseObjectivesGUI::__initQuestionObject (   $a_objective_id = 0)
Parameters
type$a_objective_id
Returns
ilCourseObjectiveQuestion

Definition at line 402 of file class.ilCourseObjectivesGUI.php.

Referenced by create(), edit(), finalTestAssignment(), finalTestLimits(), materialAssignment(), saveRandom(), selfAssessmentAssignment(), selfAssessmentLimits(), showRandomTestAssignment(), updateFinalTestAssignment(), updateFinalTestLimits(), updateSelfAssessmentAssignment(), and updateSelfAssessmentLimits().

403  {
404  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
405  $this->objectives_qst_obj = new ilCourseObjectiveQuestion($a_objective_id);
406 
407  return $this->objectives_qst_obj;
408  }
class ilcourseobjectiveQuestion
+ Here is the caller graph for this function:

◆ askDeleteObjective()

ilCourseObjectivesGUI::askDeleteObjective ( )

Definition at line 178 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $_SESSION, $counter, $tbl, $tpl, __initObjectivesObject(), array, ilUtil\getImagePath(), listObjectives(), ilUtil\sendFailure(), ilUtil\sendQuestion(), and ilUtil\switchColor().

179  {
180  global $rbacsystem;
181 
182  // MINIMUM ACCESS LEVEL = 'write'
183  if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
184  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
185  }
186  if (!count($_POST['objective'])) {
187  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
188  $this->listObjectives();
189 
190  return true;
191  }
192 
193  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.crs_objectives.html", 'Modules/Course');
194 
195  ilUtil::sendQuestion($this->lng->txt('crs_delete_objectve_sure'));
196 
197  $tpl = new ilTemplate("tpl.table.html", true, true);
198  $tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.crs_objectives_delete_row.html", 'Modules/Course');
199 
200  $counter = 0;
201  foreach ($_POST['objective'] as $objective_id) {
202  $objective_obj = $this->__initObjectivesObject($objective_id);
203 
204  $tpl->setCurrentBlock("tbl_content");
205  $tpl->setVariable("ROWCOL", ilUtil::switchColor(++$counter, "tblrow2", "tblrow1"));
206  $tpl->setVariable("TITLE", $objective_obj->getTitle());
207  $tpl->setVariable("DESCRIPTION", $objective_obj->getDescription());
208  $tpl->parseCurrentBlock();
209  }
210 
211  $tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
212 
213  // Show action row
214  $tpl->setCurrentBlock("tbl_action_btn");
215  $tpl->setVariable("BTN_NAME", 'deleteObjectives');
216  $tpl->setVariable("BTN_VALUE", $this->lng->txt('delete'));
217  $tpl->parseCurrentBlock();
218 
219  $tpl->setCurrentBlock("tbl_action_btn");
220  $tpl->setVariable("BTN_NAME", 'listObjectives');
221  $tpl->setVariable("BTN_VALUE", $this->lng->txt('cancel'));
222  $tpl->parseCurrentBlock();
223 
224  $tpl->setCurrentBlock("tbl_action_row");
225  $tpl->setVariable("COLUMN_COUNTS", 1);
226  $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath('arrow_downright.svg'));
227  $tpl->parseCurrentBlock();
228 
229 
230  // create table
231  $tbl = new ilTableGUI();
232  $tbl->setStyle('table', 'std');
233 
234  // title & header columns
235  $tbl->setTitle($this->lng->txt("crs_objectives"), "", $this->lng->txt("crs_objectives"));
236 
237  $tbl->setHeaderNames(array($this->lng->txt("title")));
238  $tbl->setHeaderVars(
239  array("title"),
240  array("ref_id" => $this->course_obj->getRefId(),
241  "cmdClass" => "ilcourseobjectivesgui",
242  "cmdNode" => $_GET["cmdNode"])
243  );
244  $tbl->setColumnWidth(array("50%"));
245 
246  $tbl->setLimit($_GET["limit"]);
247  $tbl->setOffset($_GET["offset"]);
248  $tbl->setMaxCount(count($_POST['objective']));
249 
250  // footer
251  $tbl->disable("footer");
252  $tbl->disable('sort');
253 
254  // render table
255  $tbl->setTemplate($tpl);
256  $tbl->render();
257 
258  $this->tpl->setVariable("OBJECTIVES_TABLE", $tpl->get());
259 
260 
261  // Save marked objectives
262  $_SESSION['crs_delete_objectives'] = $_POST['objective'];
263 
264  return true;
265  }
$_SESSION["AccountId"]
$_GET["client_id"]
$tbl
Definition: example_048.php:81
Class ilTableGUI.
$counter
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
special template class to simplify handling of ITX/PEAR
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendQuestion($a_info="", $a_keep=false)
Send Question to Screen.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static switchColor($a_num, $a_css1, $a_css2)
switches style sheets for each even $a_num (used for changing colors of different result rows) ...
$_POST["username"]
+ Here is the call graph for this function:

◆ create()

ilCourseObjectivesGUI::create ( )

create objective

public

Parameters

Definition at line 461 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_SESSION, $GLOBALS, $tpl, __initQuestionObject(), initFormTitle(), initWizard(), and setSubTabs().

Referenced by save().

462  {
463  global $tpl;
464 
465  $this->setSubTabs("create_obj");
466 
467  $_SESSION['objective_mode'] = self::MODE_CREATE;
468 
469  $this->ctrl->saveParameter($this, 'objective_id');
470 
471  if (!is_object($this->objective)) {
472  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
473  }
474  $this->__initQuestionObject((int) $_GET['objective_id']);
475  $this->initWizard(1);
476 
477  $this->initFormTitle('create', 1);
478  $GLOBALS['tpl']->setContent($this->form->getHtml());
479  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
480  #$tpl->setContent($w_tpl->get());
481  }
initFormTitle($a_mode, $a_step_number)
init form title
$_SESSION["AccountId"]
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ deleteObjectives()

ilCourseObjectivesGUI::deleteObjectives ( )

Definition at line 267 of file class.ilCourseObjectivesGUI.php.

References $_SESSION, __initObjectivesObject(), listObjectives(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

268  {
269  global $rbacsystem;
270 
271  // MINIMUM ACCESS LEVEL = 'write'
272  if (!$rbacsystem->checkAccess("write", $this->course_obj->getRefId())) {
273  $this->ilias->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
274  }
275  if (!count($_SESSION['crs_delete_objectives'])) {
276  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'));
277  $this->listObjectives();
278 
279  return true;
280  }
281 
282  foreach ($_SESSION['crs_delete_objectives'] as $objective_id) {
283  $objective_obj =&$this->__initObjectivesObject($objective_id);
284  $objective_obj->delete();
285  }
286 
287  ilUtil::sendSuccess($this->lng->txt('crs_objectives_deleted'));
288  $this->listObjectives();
289 
290  return true;
291  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_SESSION["AccountId"]
redirection script todo: (a better solution should control the processing via a xml file) ...
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ edit()

ilCourseObjectivesGUI::edit ( )
protected

edit objective

protected

Returns

Definition at line 489 of file class.ilCourseObjectivesGUI.php.

References $_SESSION, $GLOBALS, $tpl, __initQuestionObject(), initFormTitle(), initWizard(), ilUtil\sendFailure(), and setSubTabs().

Referenced by save().

490  {
491  global $tpl;
492 
493  $_SESSION['objective_mode'] = self::MODE_UPDATE;
494 
495  $this->setSubTabs("edit_obj");
496 
497  $this->ctrl->setParameter($this, 'objective_id', (int) $_REQUEST['objective_id']);
498 
499  if (!$_REQUEST['objective_id']) {
500  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
501  $this->ctrl->redirect($this, 'listObjectives');
502  }
503 
504  if (!is_object($this->objective)) {
505  $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
506  }
507 
508  $this->__initQuestionObject((int) $_REQUEST['objective_id']);
509  $this->initWizard(1);
510  $this->initFormTitle('create', 1);
511  $GLOBALS['tpl']->setContent($this->form->getHtml());
512  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
513  #$tpl->setContent($w_tpl->get());
514  }
initFormTitle($a_mode, $a_step_number)
init form title
$_SESSION["AccountId"]
initWizard($a_step_number)
init wizard
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilCourseObjectivesGUI::executeCommand ( )

execute command

Definition at line 94 of file class.ilCourseObjectivesGUI.php.

95  {
96  global $ilTabs;
97 
98  $ilTabs->setTabActive('crs_objectives');
99 
100  $cmd = $this->ctrl->getCmd();
101 
102 
103  if (!$cmd = $this->ctrl->getCmd()) {
104  $cmd = "list";
105  }
106 
107  $this->$cmd();
108  }

◆ finalSeparatedTestAssignment()

ilCourseObjectivesGUI::finalSeparatedTestAssignment ( ilPropertyFormGUI  $form = null)
protected

Show test assignment form.

Parameters
ilPropertyFormGUI$form

Definition at line 1189 of file class.ilCourseObjectivesGUI.php.

References $_GET, $form, $GLOBALS, $ilErr, initWizard(), and ilUtil\sendFailure().

1190  {
1191  global $ilAccess, $ilErr;
1192 
1193  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1194  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1195  }
1196  if (!$_GET['objective_id']) {
1197  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1198  $this->ctrl->returnToParent($this);
1199  }
1200  $this->ctrl->saveParameter($this, 'objective_id');
1201  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1202 
1203  $this->initWizard(6);
1204  $form = $this->initFormTestAssignment();
1205  $GLOBALS['tpl']->setContent($form->getHtml());
1206  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ finalTestAssignment()

ilCourseObjectivesGUI::finalTestAssignment ( )
protected

final test assignment

protected

Parameters

Definition at line 871 of file class.ilCourseObjectivesGUI.php.

References $_GET, $GLOBALS, $ilErr, $table, $tpl, __initQuestionObject(), ilCourseObjectiveQuestion\_getAssignableTests(), initWizard(), isRandomTestType(), ilUtil\sendFailure(), setSubTabs(), showRandomTestAssignment(), ilCourseObjectiveQuestion\TYPE_FINAL_TEST, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by updateMaterialAssignment(), and updateSelfAssessmentAssignment().

872  {
873  global $ilAccess,$ilErr,$tpl;
874 
875  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
876  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
877  }
878  if (!$_GET['objective_id']) {
879  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
880  $this->ctrl->redirect($this, 'listObjectives');
881  }
882 
883  $this->setSubTabs("final_test_assign");
884 
885  $this->ctrl->saveParameter($this, 'objective_id');
886  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
887 
888  // begin-patch lok
889  $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_QUALIFIED);
890  $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_QUALIFIED;
892  return $this->showRandomTestAssignment();
893  }
894  // end-patch lok
895 
896  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
898  $this,
899  $this->course_obj,
900  (int) $_GET['objective_id'],
902  );
903 
904  $table->setTitle(
905  $this->lng->txt('crs_objective_wiz_final'),
906  '',
907  $this->lng->txt('crs_objective')
908  );
909  $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
910 
911  $this->__initQuestionObject((int) $_GET['objective_id']);
912  $this->initWizard(5);
913  $GLOBALS['tpl']->setContent($table->getHTML());
914  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
915  #$tpl->setContent($w_tpl->get());
916  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
showRandomTestAssignment(ilPropertyFormGUI $form=null)
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(empty($password)) $table
Definition: pwgen.php:24
TableGUI for question assignments of course objectives.
static _getAssignableTests($a_container_ref_id)
Get assignable tests.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ finalTestLimits()

ilCourseObjectivesGUI::finalTestLimits ( )
protected

self assessment limits

protected

Parameters

Definition at line 1215 of file class.ilCourseObjectivesGUI.php.

References $_GET, $GLOBALS, $ilErr, $tpl, __initQuestionObject(), initFormLimits(), initWizard(), ilUtil\sendFailure(), and setSubTabs().

Referenced by updateFinalTestAssignment(), and updateFinalTestLimits().

1216  {
1217  global $ilAccess,$ilErr,$tpl;
1218 
1219  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1220  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1221  }
1222  if (!$_GET['objective_id']) {
1223  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1224  $this->ctrl->returnToParent($this);
1225  }
1226 
1227  $this->setSubTabs("final_test_limits");
1228 
1229  $this->ctrl->saveParameter($this, 'objective_id');
1230  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1231 
1232  $this->__initQuestionObject((int) $_GET['objective_id']);
1233  $this->initWizard(6);
1234 
1235  $this->initFormLimits('final');
1236  $GLOBALS['tpl']->setContent($this->form->getHtml());
1237 
1238  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
1239  #$tpl->setContent($w_tpl->get());
1240  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
initFormLimits($a_mode)
init limit form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getSettings()

ilCourseObjectivesGUI::getSettings ( )

Get settings.

Returns
ilLOSettings

Definition at line 115 of file class.ilCourseObjectivesGUI.php.

References $settings.

Referenced by initFormRandom(), initWizard(), isRandomTestType(), saveRandom(), and updateMaterialAssignment().

+ Here is the caller graph for this function:

◆ initFormLimits()

ilCourseObjectivesGUI::initFormLimits (   $a_mode)
protected

init limit form

protected

Parameters
stringmode selfAssessment or final
Returns

Definition at line 1290 of file class.ilCourseObjectivesGUI.php.

References $GLOBALS, $req, $test, $tpl, ilObject\_lookupDescription(), ilObject\_lookupTitle(), ilUtil\getTypeIconPath(), and ilCustomInputGUI\setHtml().

Referenced by finalTestLimits(), and selfAssessmentLimits().

1291  {
1292  if (!is_object($this->form)) {
1293  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1294  $this->form = new ilPropertyFormGUI();
1295  }
1296  $this->form->setFormAction($this->ctrl->getFormAction($this));
1297  $this->form->setTableWidth('100%');
1298  //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1299 
1300  switch ($a_mode) {
1301  case 'selfAssessment':
1302  $this->form->setTitle($this->lng->txt('crs_objective_wiz_self_limit'));
1303  $this->form->addCommandButton('updateSelfAssessmentLimits', $this->lng->txt('crs_wiz_next'));
1304  $this->form->addCommandButton('selfAssessmentAssignment', $this->lng->txt('crs_wiz_back'));
1305 
1306  $tests = $this->objectives_qst_obj->getSelfAssessmentTests();
1307  $max_points = $this->objectives_qst_obj->getSelfAssessmentPoints();
1308 
1309  break;
1310 
1311  case 'final':
1312  $this->form->setTitle($this->lng->txt('crs_objective_wiz_final_limit'));
1313  $this->form->addCommandButton('updateFinalTestLimits', $this->lng->txt('crs_wiz_next'));
1314  $this->form->addCommandButton('finalTestAssignment', $this->lng->txt('crs_wiz_back'));
1315 
1316  $tests = $this->objectives_qst_obj->getFinalTests();
1317  $max_points = $this->objectives_qst_obj->getFinalTestPoints();
1318 
1319  break;
1320  }
1321 
1322  $over = new ilCustomInputGUI($this->lng->txt('crs_objective_qst_summary'), '');
1323 
1324  $tpl = new ilTemplate('tpl.crs_objective_qst_summary.html', true, true, 'Modules/Course');
1325 
1326 
1327  $limit = 0;
1328 
1329  foreach ($tests as $test) {
1330  $GLOBALS['ilLog']->write(__METHOD__ . ': ' . print_r($test, true));
1331 
1332  $limit = $test['limit'];
1333 
1334  foreach ($this->objectives_qst_obj->getQuestionsOfTest($test['obj_id']) as $question) {
1335  $tpl->setCurrentBlock('qst');
1336  $tpl->setVariable('QST_TITLE', $question['title']);
1337  if (strlen($question['description'])) {
1338  $tpl->setVariable('QST_DESCRIPTION', $question['description']);
1339  }
1340  $tpl->setVariable('QST_POINTS', $question['points'] . ' ' .
1341  $this->lng->txt('crs_objective_points'));
1342  $tpl->parseCurrentBlock();
1343  }
1344  $tpl->setCurrentBlock('tst');
1345  $tpl->setVariable('TST_TITLE', ilObject::_lookupTitle($test['obj_id']));
1346  if ($desc = ilObject::_lookupDescription($test['obj_id'])) {
1347  $tpl->setVariable('TST_DESC', $desc);
1348  }
1349  $tpl->setVariable('TST_TYPE_IMG', ilUtil::getTypeIconPath('tst', $test['obj_id'], 'tiny'));
1350  $tpl->setVariable('TST_ALT_IMG', $this->lng->txt('obj_tst'));
1351  $tpl->parseCurrentBlock();
1352  }
1353 
1354  $tpl->setVariable('TXT_ALL_POINTS', $this->lng->txt('crs_objective_all_points'));
1355  $tpl->setVariable('TXT_POINTS', $this->lng->txt('crs_objective_points'));
1356  $tpl->setVariable('POINTS', $max_points);
1357 
1358  $over->setHtml($tpl->get());
1359  $this->form->addItem($over);
1360 
1361  // points
1362  $req = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'limit');
1363  $req->setValue($limit);
1364  $req->setSize(3);
1365  $req->setMinValue(1);
1366  $req->setMaxValue(100);
1367  $req->setRequired(true);
1368  switch ($a_mode) {
1369  case 'selfAssessment':
1370  $req->setInfo($this->lng->txt('crs_obj_initial_req_info'));
1371  break;
1372 
1373  case 'final':
1374  $req->setInfo($this->lng->txt('crs_obj_final_req_info'));
1375  break;
1376  }
1377  $this->form->addItem($req);
1378  }
setHtml($a_html)
Set Html.
This class represents a property form user interface.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static _lookupTitle($a_id)
lookup object title
$req
Definition: getUserInfo.php:20
static getTypeIconPath($a_type, $a_obj_id, $a_size='small')
Get type icon path path Return image path for icon_xxx.pngs Or (if enabled) path to custom icon Depre...
This class represents a number property in a property form.
static _lookupDescription($a_id)
lookup object description
special template class to simplify handling of ITX/PEAR
This class represents a custom property in a property form.
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormRandom()

ilCourseObjectivesGUI::initFormRandom ( )
protected

show random test

Definition at line 962 of file class.ilCourseObjectivesGUI.php.

References $form, $GLOBALS, $list, $options, $title, ilObject\_lookupObjId(), array, ilObjectFactory\getInstanceByRefId(), getSettings(), ilLORandomTestQuestionPools\lookupLimit(), ilLORandomTestQuestionPools\lookupSequencesByType(), ilFormPropertyGUI\setRequired(), ilNumberInputGUI\setValue(), and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by saveRandom(), and showRandomTestAssignment().

963  {
964  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
965  $form = new ilPropertyFormGUI();
966  $form->setFormAction($this->ctrl->getFormAction($this));
967 
968  if ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) {
969  $form->setTitle($this->lng->txt('crs_loc_form_random_limits_it'));
970  } else {
971  $form->setTitle($this->lng->txt('crs_loc_form_random_limits_qt'));
972  }
973 
974  $form->addCommandButton('saveRandom', $this->lng->txt('save'));
975 
976  $options = new ilRadioGroupInputGUI($this->lng->txt('crs_loc_rand_assign_qpl'), 'type');
977  $options->setValue(1);
978  $options->setRequired(true);
979 
980  $ass_qpl = new ilRadioOption($this->lng->txt('crs_loc_rand_assign_qpl'), 1);
981  $options->addOption($ass_qpl);
982 
983  $qpl = new ilSelectInputGUI($this->lng->txt('crs_loc_rand_qpl'), 'qpl');
984  $qpl->setRequired(true);
985  $qpl->setMulti(true, false);
986  $qpl->setOptions($this->getRandomTestQplOptions());
987 
989  $this->course_obj->getId(),
990  (int) $_REQUEST['objective_id'],
991  ilObject::_lookupObjId($this->getSettings()->getTestByType($this->test_type)),
992  $this->test_type
993  );
994 
995  $qpl->setValue($sequences[0]);
996  $qpl->setMultiValues($sequences);
997  $ass_qpl->addSubItem($qpl);
998 
999  // points
1000  $per = new ilNumberInputGUI($this->lng->txt('crs_loc_perc'), 'per');
1001  $per->setValue(
1003  $this->course_obj->getId(),
1004  (int) $_REQUEST['objective_id'],
1005  $this->test_type
1006  )
1007  );
1008  $per->setSize(3);
1009  $per->setMinValue(1);
1010  $per->setMaxValue(100);
1011  $per->setRequired(true);
1012  $ass_qpl->addSubItem($per);
1013 
1014  $form->addItem($options);
1015  return $form;
1016  }
This class represents an option in a radio group.
setValue($a_value)
Set Value.
This class represents a selection list property in a property form.
This class represents a property form user interface.
This class represents a property in a property form.
if(isset($_POST['submit'])) $form
This class represents a number property in a property form.
static _lookupObjId($a_id)
static lookupSequencesByType($a_container_id, $a_objective_id, $a_test_id, $a_test_type)
Lookup sequence ids type $ilDB.
static lookupLimit($a_container_id, $a_objective_id, $a_test_type)
lookup limit type $ilDB
setRequired($a_required)
Set Required.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormTitle()

ilCourseObjectivesGUI::initFormTitle (   $a_mode,
  $a_step_number 
)
protected

init form title

protected

Returns

Definition at line 1387 of file class.ilCourseObjectivesGUI.php.

References $title, and ilTextAreaInputGUI\setValue().

Referenced by create(), edit(), and save().

1388  {
1389  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
1390  if ($this->form instanceof ilPropertyFormGUI) {
1391  return;
1392  }
1393 
1394  $this->form = new ilPropertyFormGUI();
1395  $this->form->setFormAction($this->ctrl->getFormAction($this));
1396  //$this->form->setTitleIcon(ilUtil::getImagePath('icon_lobj.svg'),$this->lng->txt('crs_objective'));
1397 
1398  switch ($a_mode) {
1399  case 'create':
1400  $this->form->setTitle($this->lng->txt('crs_objective_wiz_title'));
1401  $this->form->addCommandButton('save', $this->lng->txt('crs_wiz_next'));
1402  // begin-patch lok
1403  #$this->form->addCommandButton('listObjectives',$this->lng->txt('cancel'));
1404  // end-patch lok
1405  break;
1406 
1407  case 'update':
1408  break;
1409  }
1410 
1411  $title = new ilTextInputGUI($this->lng->txt('title'), 'title');
1412  $title->setValue($this->objective->getTitle());
1413  $title->setRequired(true);
1414  $title->setSize(40);
1415  $title->setMaxLength(70);
1416  $this->form->addItem($title);
1417 
1418  $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description');
1419  $desc->setValue($this->objective->getDescription());
1420  $desc->setCols(40);
1421  $desc->setRows(5);
1422  $this->form->addItem($desc);
1423  }
This class represents a property form user interface.
setValue($a_value)
Set Value.
This class represents a text property in a property form.
This class represents a text area property in a property form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initWizard()

ilCourseObjectivesGUI::initWizard (   $a_step_number)
protected

init wizard

protected

Parameters
stringmode 'create' or 'edit'
Returns

Definition at line 1433 of file class.ilCourseObjectivesGUI.php.

References $_SESSION, $GLOBALS, $info, $links, $options, $title, array, getSettings(), isRandomTestType(), ilChecklistGUI\STATUS_NO_STATUS, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

Referenced by create(), edit(), finalSeparatedTestAssignment(), finalTestAssignment(), finalTestLimits(), materialAssignment(), selfAssessmentAssignment(), selfAssessmentLimits(), and showRandomTestAssignment().

1434  {
1435  $options = array(
1436  1 => $this->lng->txt('crs_objective_wiz_title'),
1437  2 => $this->lng->txt('crs_objective_wiz_materials'),
1438  3 => $this->lng->txt('crs_objective_wiz_self'),
1439  4 => $this->lng->txt('crs_objective_wiz_self_limit'),
1440  5 => $this->lng->txt('crs_objective_wiz_final'),
1441  6 => $this->lng->txt('crs_objective_wiz_final_limit'));
1442 
1443  $info = array(
1444  1 => $this->lng->txt('crs_objective_wiz_title_info'),
1445  2 => $this->lng->txt('crs_objective_wiz_materials_info'),
1446  3 => $this->lng->txt('crs_objective_wiz_self_info'),
1447  4 => $this->lng->txt('crs_objective_wiz_self_limit_info'),
1448  5 => $this->lng->txt('crs_objective_wiz_final_info'),
1449  6 => $this->lng->txt('crs_objective_wiz_final_limit_info'));
1450 
1451  $links = array(
1452  1 => $this->ctrl->getLinkTarget($this, 'edit'),
1453  2 => $this->ctrl->getLinkTarget($this, 'materialAssignment'),
1454  3 => $this->ctrl->getLinkTarget($this, 'selfAssessmentAssignment'),
1455  4 => $this->ctrl->getLinkTarget($this, 'selfAssessmentLimits'),
1456  5 => $this->ctrl->getLinkTarget($this, 'finalTestAssignment'),
1457  6 => $this->ctrl->getLinkTarget($this, 'finalTestLimits'));
1458 
1459 
1460 
1461 
1462  // checklist gui start
1463  include_once("./Services/UIComponent/Checklist/classes/class.ilChecklistGUI.php");
1464  $check_list = new ilChecklistGUI();
1465  // checklist gui end
1466 
1467  if ($_SESSION['objective_mode'] == self::MODE_CREATE) {
1468  // checklist gui start
1469  $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1470  // checklist gui end
1471  } else {
1472  // checklist gui start
1473  $check_list->setHeading($this->lng->txt('crs_checklist_objective'));
1474  // checklist gui end
1475  }
1476 
1477  // end-patch lok
1478  $num = 0;
1479  foreach ($options as $step => $title) {
1480  // checklist gui start
1481  $item_link = "";
1482  // checklist gui end
1483 
1484  // begin-patch lok
1485  if ($step == 3 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1486  continue;
1487  }
1488  if ($step == 4 and (!$this->getSettings()->worksWithInitialTest() or $this->getSettings()->hasSeparateInitialTests())) {
1489  continue;
1490  }
1491  if ($step == 5 and $this->getSettings()->hasSeparateQualifiedTests()) {
1492  continue;
1493  }
1494  if ($step == 6 and $this->getSettings()->hasSeparateQualifiedTests()) {
1495  continue;
1496  }
1497  if ($step == 4 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_INITIAL)) {
1498  continue;
1499  }
1500  if ($step == 6 and $this->isRandomTestType(ilLOSettings::TYPE_TEST_QUALIFIED)) {
1501  continue;
1502  }
1503  $num++;
1504  // end-patch lok
1505 
1506  if ($_SESSION['objective_mode'] == self::MODE_UPDATE) {
1507  $hide_link = false;
1508  if ($step == 4 and !count($this->objectives_qst_obj->getSelfAssessmentQuestions())) {
1509  $hide_link = true;
1510  }
1511  if ($step == 6 and !count($this->objectives_qst_obj->getFinalTestQuestions())) {
1512  $hide_link = true;
1513  }
1514  // begin-patch lok
1515  if ($step == 3 and !$this->getSettings()->worksWithInitialTest()) {
1516  $hide_link = true;
1517  }
1518  if ($step == 4 and !$this->getSettings()->worksWithInitialTest()) {
1519  $hide_link = true;
1520  }
1521  if (!$hide_link) {
1522  // checklist gui start
1523  $item_link = $links[$step];
1524  // checklist gui end
1525  }
1526  }
1527 
1528  // checklist gui start
1529  $check_list->addEntry($title, $item_link, ilChecklistGUI::STATUS_NO_STATUS, ($step == $a_step_number));
1530  // checklist gui end
1531  }
1532 
1533  // checklist gui start
1534  $GLOBALS["tpl"]->setRightContent($check_list->getHTML());
1535  // checklist gui end
1536  }
$_SESSION["AccountId"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
Create styles array
The data for the language used.
$links
$info
Definition: index.php:5
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isRandomTestType()

ilCourseObjectivesGUI::isRandomTestType (   $a_tst_type = 0)
protected

Definition at line 919 of file class.ilCourseObjectivesGUI.php.

References $test_type, ilObject\_lookupObjId(), ilObjTest\_lookupRandomTest(), and getSettings().

Referenced by finalTestAssignment(), initWizard(), and selfAssessmentAssignment().

920  {
921  if (!$a_tst_type) {
922  $a_tst_type = $this->test_type;
923  }
924 
925  $tst_ref_id = $this->getSettings()->getTestByType($a_tst_type);
926  if (!$tst_ref_id) {
927  return false;
928  }
929  include_once './Modules/Test/classes/class.ilObjTest.php';
931  }
static _lookupRandomTest($a_obj_id)
Returns the fact wether the test with passed obj id is a random questions test or not...
static _lookupObjId($a_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ listObjectives()

ilCourseObjectivesGUI::listObjectives ( )
protected

list objectives

protected

Parameters

Definition at line 129 of file class.ilCourseObjectivesGUI.php.

References $_SESSION, $ilErr, $table, and ilCourseObjective\_getObjectiveIds().

Referenced by askDeleteObjective(), deleteObjectives(), and saveSorting().

130  {
131  global $ilAccess,$ilErr,$ilObjDataCache,$ilToolbar;
132 
133  $_SESSION['objective_mode'] = self::MODE_UNDEFINED;
134  if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
135  $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
136  }
137 
138  $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.crs_objectives.html', 'Modules/Course');
139 
140  $ilToolbar->addButton(
141  $this->lng->txt('crs_add_objective'),
142  $this->ctrl->getLinkTarget($this, "'create")
143  );
144 
145  include_once('./Modules/Course/classes/class.ilCourseObjectivesTableGUI.php');
146  $table = new ilCourseObjectivesTableGUI($this, $this->course_obj);
147  $table->setTitle($this->lng->txt('crs_objectives'), '', $this->lng->txt('crs_objectives'));
148  $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
149 
150  $this->tpl->setVariable('OBJECTIVES_TABLE', $table->getHTML());
151  }
$_SESSION["AccountId"]
static _getObjectiveIds($course_id, $a_activated_only=false)
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ materialAssignment()

ilCourseObjectivesGUI::materialAssignment ( )
protected

material assignment

protected

Returns

Definition at line 572 of file class.ilCourseObjectivesGUI.php.

References $_GET, $GLOBALS, $ilErr, $table, $tpl, __initQuestionObject(), ilCourseObjectiveMaterials\_getAssignableMaterials(), initWizard(), ilUtil\sendFailure(), and setSubTabs().

573  {
574  global $ilAccess,$ilErr,$tpl;
575 
576  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
577  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
578  }
579  if (!$_GET['objective_id']) {
580  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
581  $this->ctrl->redirect($this, 'listObjectives');
582  }
583 
584  $this->setSubTabs("materials");
585 
586  $this->ctrl->saveParameter($this, 'objective_id');
587 
588  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
589 
590  include_once('./Modules/Course/classes/class.ilCourseObjectiveMaterialAssignmentTableGUI.php');
591  $table = new ilCourseObjectiveMaterialAssignmentTableGUI($this, $this->course_obj, (int) $_GET['objective_id']);
592  $table->setTitle(
593  $this->lng->txt('crs_objective_wiz_materials'),
594  '',
595  $this->lng->txt('crs_objectives')
596  );
597 
598  include_once('Modules/Course/classes/class.ilCourseObjectiveMaterials.php');
599  $table->parse(ilCourseObjectiveMaterials::_getAssignableMaterials($this->course_obj->getRefId()));
600 
601  $this->__initQuestionObject((int) $_GET['objective_id']);
602  $this->initWizard(2);
603  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
604  $GLOBALS['tpl']->setContent($table->getHTML());
605  #$tpl->setContent($w_tpl->get());
606  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
TableGUI for material assignments of course objectives.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _getAssignableMaterials($a_container_id)
Get an array of course material ids that can be assigned to learning objectives No tst...
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:

◆ questionOverview()

ilCourseObjectivesGUI::questionOverview ( )
protected

question overiew

protected

Returns

Definition at line 299 of file class.ilCourseObjectivesGUI.php.

References $ilErr, $table, and ilCourseObjective\_getObjectiveIds().

Referenced by saveQuestionOverview().

300  {
301  global $ilAccess,$ilErr,$ilTabs;
302 
303  $ilTabs->setSubTabActive('crs_objective_overview_question_assignment');
304 
305  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
306  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
307  }
308 
309  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionsTableGUI.php');
310  $table = new ilCourseObjectiveQuestionsTableGUI($this, $this->course_obj);
311  $table->setTitle($this->lng->txt('crs_objectives_edit_question_assignments'), '', $this->lng->txt('crs_objectives'));
312  // begin-patch lok
313  $table->parse(ilCourseObjective::_getObjectiveIds($this->course_obj->getId(), false));
314  // end-patch lok
315 
316  $this->tpl->setContent($table->getHTML());
317  }
static _getObjectiveIds($course_id, $a_activated_only=false)
if(empty($password)) $table
Definition: pwgen.php:24
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ save()

ilCourseObjectivesGUI::save ( )
protected

save

protected

Returns

Definition at line 522 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_SESSION, $ilErr, create(), edit(), initFormTitle(), and ilUtil\sendSuccess().

523  {
524  global $ilAccess,$ilErr;
525 
526  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
527  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
528  }
529 
530  $this->ctrl->saveParameter($this, 'objective_id');
531 
532  $this->objective = new ilCourseObjective($this->course_obj, (int) $_REQUEST['objective_id']);
533  $this->initFormTitle('create', 1);
534  if ($this->form->checkInput()) {
535  $this->objective->setTitle($this->form->getInput('title'));
536  $this->objective->setDescription($this->form->getInput('description'));
537  $this->objective->setPasses(0);
538 
539  if (!$_GET['objective_id']) {
540  $objective_id = $this->objective->add();
541  ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
542  } else {
543  $this->objective->update();
544  ilUtil::sendSuccess($this->lng->txt('crs_objective_modified'), true);
545  $objective_id = $_GET['objective_id'];
546  }
547  } else {
548  if ((int) $_GET['objective_id']) {
549  $this->form->setValuesByPost();
550  return $this->edit();
551  } else {
552  $this->form->setValuesByPost();
553  return $this->create();
554  }
555  }
556 
557  if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
558  $this->ctrl->returnToParent($this);
559  }
560 
561  $this->ctrl->setParameter($this, 'objective_id', $objective_id);
562  $this->ctrl->redirect($this, 'materialAssignment');
563  return true;
564  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initFormTitle($a_mode, $a_step_number)
init form title
$_SESSION["AccountId"]
$_GET["client_id"]
class ilcourseobjective
+ Here is the call graph for this function:

◆ saveQuestionOverview()

ilCourseObjectivesGUI::saveQuestionOverview ( )
protected

update question overview

protected

Returns

Definition at line 325 of file class.ilCourseObjectivesGUI.php.

References $_POST, $error, $ilErr, ilCourseObjectiveQuestion\_updateTestLimits(), array, questionOverview(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilCourseObjectiveQuestion\TYPE_FINAL_TEST, and ilCourseObjectiveQuestion\TYPE_SELF_ASSESSMENT.

326  {
327  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
328 
329  global $ilAccess,$ilErr;
330 
331  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
332  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
333  }
334  $error = false;
335 
336  $_POST['self'] = $_POST['self'] ? $_POST['self'] : array();
337  $_POST['final'] = $_POST['final'] ? $_POST['final'] : array();
338 
339  foreach ($_POST['self'] as $objective_id => $limit) {
340  $qst = new ilCourseObjectiveQuestion($objective_id);
341  $max_points = $qst->getSelfAssessmentPoints();
342 
343  if ($limit < 0 or $limit > $max_points) {
344  ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
345  $this->questionOverview();
346  return false;
347  }
348  }
349  foreach ($_POST['final'] as $objective_id => $limit) {
350  $qst = new ilCourseObjectiveQuestion($objective_id);
351  $max_points = $qst->getFinalTestPoints();
352 
353  if ($limit < 0 or $limit > $max_points) {
354  ilUtil::sendFailure($this->lng->txt('crs_objective_limit_err'));
355  $this->questionOverview();
356  return false;
357  }
358  }
359 
360  foreach ($_POST['self'] as $objective_id => $limit) {
362  }
363 
364  foreach ($_POST['final'] as $objective_id => $limit) {
366  }
367 
368  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
369  $this->questionOverview();
370  return true;
371  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$error
Definition: Error.php:17
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static _updateTestLimits($a_objective_id, $a_status, $a_limit)
update test limits
class ilcourseobjectiveQuestion
$_POST["username"]
+ Here is the call graph for this function:

◆ saveRandom()

ilCourseObjectivesGUI::saveRandom ( )
protected

Save random test settings.

Definition at line 1076 of file class.ilCourseObjectivesGUI.php.

References $_GET, $form, __initQuestionObject(), ilObject\_lookupObjId(), array, ilLORandomTestQuestionPools\deleteForObjectiveAndTestType(), getSettings(), initFormRandom(), ilUtil\sendFailure(), ilUtil\sendSuccess(), showRandomTestAssignment(), ilCourseObjectiveQuestion\TYPE_FINAL_TEST, ilCourseObjectiveQuestion\TYPE_SELF_ASSESSMENT, ilLOSettings\TYPE_TEST_INITIAL, and ilLOSettings\TYPE_TEST_QUALIFIED.

1077  {
1078  $this->ctrl->saveParameter($this, 'objective_id');
1079  $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
1080  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
1081  $this->test_type = (int) $_REQUEST['tt'];
1082 
1083  $form = $this->initFormRandom();
1084 
1085 
1086 
1087 
1088  if ($form->checkInput()) {
1090  $this->course_obj->getId(),
1091  (int) $_REQUEST['objective_id'],
1092  $this->test_type
1093  );
1094 
1095  $qst = $this->__initQuestionObject((int) $_GET['objective_id']);
1096  $qst->deleteByTestType(
1097  ($this->test_type == ilLOSettings::TYPE_TEST_INITIAL) ?
1100  );
1101  $ref_id = $this->getSettings()->getTestByType($this->test_type);
1102  foreach (array_unique((array) $form->getInput('qpl')) as $qpl_id) {
1103  include_once './Modules/Course/classes/Objectives/class.ilLORandomTestQuestionPools.php';
1104  $rnd = new ilLORandomTestQuestionPools(
1105  $this->course_obj->getId(),
1106  (int) $_REQUEST['objective_id'],
1107  $this->test_type,
1108  $qpl_id
1109  );
1110  $rnd->setLimit($form->getInput('per'));
1111  $rnd->setTestId(ilObject::_lookupObjId($ref_id));
1112  $rnd->create();
1113  }
1114  } else {
1115  $form->setValuesByPost();
1116  ilUtil::sendFailure($this->lng->txt('err_check_input'));
1117  return $this->showRandomTestAssignment();
1118  }
1119 
1120  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1121  if ($this->test_type == ilLOSettings::TYPE_TEST_QUALIFIED) {
1122  $this->ctrl->returnToParent($this);
1123  } else {
1124  $this->ctrl->redirect($this, 'finalTestAssignment');
1125  }
1126  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
deleteForObjectiveAndTestType($a_course_id, $a_objective_id, $a_tst_type)
Delete assignment for objective id and test type.
showRandomTestAssignment(ilPropertyFormGUI $form=null)
if(isset($_POST['submit'])) $form
class ilcourseobjective
static _lookupObjId($a_id)
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:

◆ saveSorting()

ilCourseObjectivesGUI::saveSorting ( )
protected

save position

protected

Returns

Definition at line 159 of file class.ilCourseObjectivesGUI.php.

References $_POST, $counter, $ilErr, listObjectives(), and ilUtil\sendSuccess().

160  {
161  global $ilAccess,$ilErr,$ilObjDataCache;
162 
163  if (!$ilAccess->checkAccess("write", '', $this->course_obj->getRefId())) {
164  $this->ilErr->raiseError($this->lng->txt("msg_no_perm_write"), $this->ilErr->MESSAGE);
165  }
166 
167  asort($_POST['position'], SORT_NUMERIC);
168 
169  $counter = 1;
170  foreach ($_POST['position'] as $objective_id => $position) {
171  $objective = new ilCourseObjective($this->course_obj, $objective_id);
172  $objective->writePosition($counter++);
173  }
174  ilUtil::sendSuccess($this->lng->txt('crs_objective_saved_sorting'));
175  $this->listObjectives();
176  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$counter
class ilcourseobjective
$_POST["username"]
+ Here is the call graph for this function:

◆ selfAssessmentAssignment()

ilCourseObjectivesGUI::selfAssessmentAssignment ( )
protected

self assessment assignemnt

protected

Returns

Definition at line 676 of file class.ilCourseObjectivesGUI.php.

References $_GET, $GLOBALS, $ilErr, $table, $tpl, __initQuestionObject(), ilCourseObjectiveQuestion\_getAssignableTests(), initWizard(), isRandomTestType(), ilUtil\sendFailure(), setSubTabs(), showRandomTestAssignment(), ilCourseObjectiveQuestion\TYPE_SELF_ASSESSMENT, and ilLOSettings\TYPE_TEST_INITIAL.

Referenced by updateMaterialAssignment(), and updateSelfAssessmentAssignment().

677  {
678  global $ilAccess,$ilErr,$tpl;
679 
680  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
681  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
682  }
683  if (!$_GET['objective_id']) {
684  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
685  $this->ctrl->redirect($this, 'listObjectives');
686  }
687 
688  $this->setSubTabs("self_ass_assign");
689 
690  $this->ctrl->saveParameter($this, 'objective_id');
691 
692  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
693 
694  // begin-patch lok
695  $this->ctrl->setParameter($this, 'tt', ilLOSettings::TYPE_TEST_INITIAL);
696  $this->test_type = $_REQUEST['tt'] = ilLOSettings::TYPE_TEST_INITIAL;
698  return $this->showRandomTestAssignment();
699  }
700  // end-patch lok
701 
702  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestionAssignmentTableGUI.php');
704  $this,
705  $this->course_obj,
706  (int) $_GET['objective_id'],
708  );
709  $table->setTitle(
710  $this->lng->txt('crs_objective_wiz_self'),
711  '',
712  $this->lng->txt('crs_objective')
713  );
714  $table->parse(ilCourseObjectiveQuestion::_getAssignableTests($this->course_obj->getRefId()));
715 
716  $this->__initQuestionObject((int) $_GET['objective_id']);
717  $this->initWizard(3);
718  $GLOBALS['tpl']->setContent($table->getHTML());
719  #$w_tpl->setVariable('WIZ_CONTENT',$table->getHTML());
720  #$tpl->setContent($w_tpl->get());
721  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
showRandomTestAssignment(ilPropertyFormGUI $form=null)
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if(empty($password)) $table
Definition: pwgen.php:24
TableGUI for question assignments of course objectives.
static _getAssignableTests($a_container_ref_id)
Get assignable tests.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ selfAssessmentLimits()

ilCourseObjectivesGUI::selfAssessmentLimits ( )
protected

self assessment limits

protected

Parameters

Definition at line 800 of file class.ilCourseObjectivesGUI.php.

References $_GET, $GLOBALS, $ilErr, $tpl, __initQuestionObject(), initFormLimits(), initWizard(), ilUtil\sendFailure(), and setSubTabs().

Referenced by updateSelfAssessmentAssignment(), and updateSelfAssessmentLimits().

801  {
802  global $ilAccess,$ilErr,$tpl;
803 
804  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
805  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
806  }
807  if (!$_GET['objective_id']) {
808  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
809  $this->ctrl->redirect($this, 'listObjectives');
810  }
811 
812  $this->setSubTabs("self_ass_limits");
813 
814  $this->ctrl->saveParameter($this, 'objective_id');
815  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
816 
817  $this->__initQuestionObject((int) $_GET['objective_id']);
818  $this->initWizard(4);
819 
820  $this->initFormLimits('selfAssessment');
821  $GLOBALS['tpl']->setContent($this->form->getHtml());
822  #$w_tpl->setVariable('WIZ_CONTENT',$this->form->getHtml());
823  #$tpl->setContent($w_tpl->get());
824  }
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
initFormLimits($a_mode)
init limit form
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilCourseObjectivesGUI::setSubTabs (   $a_active = "")

set sub tabs

Definition at line 414 of file class.ilCourseObjectivesGUI.php.

References ilCourseObjectiveQuestion\_hasTests(), and array.

Referenced by create(), edit(), finalTestAssignment(), finalTestLimits(), materialAssignment(), selfAssessmentAssignment(), selfAssessmentLimits(), and showRandomTestAssignment().

415  {
416  global $ilTabs, $ilHelp;
417 
418  if ($a_active != "") {
419  $ilHelp->setScreenIdComponent("crs");
420  $ilHelp->setScreenId("crs_objective");
421  $ilHelp->setSubScreenId($a_active);
422  }
423 
424 
425  // begin-patch lok
426  // no subtabs here
427  return true;
428  // end-patch lok
429 
430 
431  $ilTabs->addSubTabTarget(
432  "crs_objective_overview_objectives",
433  $this->ctrl->getLinkTarget($this, "listObjectives"),
434  array("listObjectives", "moveObjectiveUp", "moveObjectiveDown", "listAssignedLM"),
435  array(),
436  '',
437  true
438  );
439  include_once('./Modules/Course/classes/class.ilCourseObjectiveQuestion.php');
440 
441  if (ilCourseObjectiveQuestion::_hasTests($this->course_obj->getId())) {
442  $ilTabs->addSubTabTarget(
443  "crs_objective_overview_question_assignment",
444  $this->ctrl->getLinkTarget($this, "questionOverview"),
445  "editQuestionAssignment",
446  array(),
447  '',
448  false
449  );
450  }
451  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showRandomTestAssignment()

ilCourseObjectivesGUI::showRandomTestAssignment ( ilPropertyFormGUI  $form = null)
protected
Parameters
ilPropertyFormGUI$form

Definition at line 937 of file class.ilCourseObjectivesGUI.php.

References $_GET, $form, $GLOBALS, __initQuestionObject(), initFormRandom(), initWizard(), and setSubTabs().

Referenced by finalTestAssignment(), saveRandom(), and selfAssessmentAssignment().

938  {
939  $this->ctrl->saveParameter($this, 'objective_id');
940  $this->ctrl->setParameter($this, 'tt', (int) $_REQUEST['tt']);
941  $this->objective = new ilCourseObjective($this->course_obj, (int) $_GET['objective_id']);
942  $this->test_type = (int) $_REQUEST['tt'];
943 
944 
945  $this->setSubTabs("rand_test_assign");
946 
947  if (!$form instanceof ilPropertyFormGUI) {
948  $form = $this->initFormRandom();
949  }
950 
951  $this->__initQuestionObject((int) $_GET['objective_id']);
952  $this->initWizard(5);
953  $GLOBALS['tpl']->setContent($form->getHTML());
954  #$w_tpl->setVariable('WIZ_CONTENT',$form->getHTML());
955 
956  #$GLOBALS['tpl']->setContent($w_tpl->get());
957  }
This class represents a property form user interface.
initWizard($a_step_number)
init wizard
$_GET["client_id"]
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
class ilcourseobjective
setSubTabs($a_active="")
set sub tabs
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateFinalTestAssignment()

ilCourseObjectivesGUI::updateFinalTestAssignment ( )
protected

update self assessment assignment

protected

Parameters

Definition at line 1135 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $id, $ilErr, __initQuestionObject(), array, finalTestLimits(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilCourseObjectiveQuestion\TYPE_FINAL_TEST.

1136  {
1137  global $ilAccess,$ilErr,$ilObjDataCache;
1138 
1139  $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
1140 
1141 
1142  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1143  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1144  }
1145  if (!$_GET['objective_id']) {
1146  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1147  $this->ctrl->redirect($this, 'listObjectives');
1148  }
1149 
1150  $this->__initQuestionObject((int) $_GET['objective_id']);
1151 
1152  // Delete unchecked
1153  foreach ($this->objectives_qst_obj->getFinalTestQuestions() as $question) {
1154  $id = $question['ref_id'] . '_' . $question['question_id'];
1155  if (!in_array($id, $checked_questions)) {
1156  $this->objectives_qst_obj->delete($question['qst_ass_id']);
1157  }
1158  }
1159  // Add checked
1160  foreach ($checked_questions as $question_id) {
1161  list($test_ref_id, $qst_id) = explode('_', $question_id);
1162  $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
1163 
1164  if ($this->objectives_qst_obj->isFinalTestQuestion($qst_id)) {
1165  continue;
1166  }
1167 
1168  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1169  $this->objectives_qst_obj->setTestRefId($test_ref_id);
1170  $this->objectives_qst_obj->setTestObjId($test_obj_id);
1171  $this->objectives_qst_obj->setQuestionId($qst_id);
1172  $this->objectives_qst_obj->add();
1173  }
1174 
1175  // TODO: not nice
1176  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
1177  $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
1178  // not required due to percentages
1179  //$this->questions->updateLimits();
1180 
1181  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
1182  $this->finalTestLimits();
1183  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
finalTestLimits()
self assessment limits
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
class ilcourseobjectiveQuestion
$_POST["username"]
+ Here is the call graph for this function:

◆ updateFinalTestLimits()

ilCourseObjectivesGUI::updateFinalTestLimits ( )
protected

update self assessment limits

protected

Parameters

Definition at line 1249 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $_SESSION, $ilErr, $test, __initQuestionObject(), finalTestLimits(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilCourseObjectiveQuestion\TYPE_FINAL_TEST.

1250  {
1251  global $ilAccess,$ilErr,$ilObjDataCache;
1252 
1253  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
1254  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
1255  }
1256  if (!$_GET['objective_id']) {
1257  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
1258  $this->ctrl->redirect($this, 'listObjectives');
1259  }
1260 
1261  $this->__initQuestionObject((int) $_GET['objective_id']);
1262 
1263  if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
1264  ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
1265  $this->finalTestLimits();
1266  return false;
1267  }
1268 
1269  foreach ($this->objectives_qst_obj->getFinalTests() as $test) {
1270  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_FINAL_TEST);
1271  $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
1272  $this->objectives_qst_obj->updateTest($test['test_objective_id']);
1273  }
1274 
1275  if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
1276  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1277  } else {
1278  ilUtil::sendSuccess($this->lng->txt('crs_added_objective'), true);
1279  }
1280  $this->ctrl->returnToParent($this);
1281  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_SESSION["AccountId"]
$_GET["client_id"]
finalTestLimits()
self assessment limits
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

◆ updateMaterialAssignment()

ilCourseObjectivesGUI::updateMaterialAssignment ( )
protected

update material assignment

protected

Parameters

Definition at line 615 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $_SESSION, $ilErr, $type, __initLMObject(), ilLMObject\_lookupType(), finalTestAssignment(), getSettings(), selfAssessmentAssignment(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

616  {
617  global $ilAccess,$ilErr,$ilObjDataCache;
618 
619  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
620  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
621  }
622  if (!$_GET['objective_id']) {
623  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
624  $this->ctrl->redirect($this, 'listObjectives');
625  }
626 
627  $this->__initLMObject((int) $_GET['objective_id']);
628  $this->objectives_lm_obj->deleteAll();
629 
630  if (is_array($_POST['materials'])) {
631  foreach ($_POST['materials'] as $node_id) {
632  $obj_id = $ilObjDataCache->lookupObjId($node_id);
633  $type = $ilObjDataCache->lookupType($obj_id);
634 
635  $this->objectives_lm_obj->setLMRefId($node_id);
636  $this->objectives_lm_obj->setLMObjId($obj_id);
637  $this->objectives_lm_obj->setType($type);
638  $this->objectives_lm_obj->add();
639  }
640  }
641  if (is_array($_POST['chapters'])) {
642  foreach ($_POST['chapters'] as $chapter) {
643  include_once('./Modules/LearningModule/classes/class.ilLMObject.php');
644 
645  list($ref_id, $chapter_id) = explode('_', $chapter);
646 
647  $this->objectives_lm_obj->setLMRefId($ref_id);
648  $this->objectives_lm_obj->setLMObjId($chapter_id);
649  $this->objectives_lm_obj->setType(ilLMObject::_lookupType($chapter_id));
650  $this->objectives_lm_obj->add();
651  }
652  }
653  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
654 
655 
656  if ($_SESSION['objective_mode'] != self::MODE_CREATE) {
657  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'), true);
658  $this->ctrl->returnToParent($this);
659  }
660 
661  // begin-patch lok
662  if ($this->getSettings()->worksWithInitialTest()) {
663  $this->selfAssessmentAssignment();
664  } else {
665  $this->finalTestAssignment();
666  }
667  // end-patch lok
668  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
selfAssessmentAssignment()
self assessment assignemnt
static _lookupType($a_obj_id, $a_lm_id=0)
Lookup type.
$_SESSION["AccountId"]
$type
$_GET["client_id"]
finalTestAssignment()
final test assignment
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
+ Here is the call graph for this function:

◆ updateSelfAssessmentAssignment()

ilCourseObjectivesGUI::updateSelfAssessmentAssignment ( )
protected

update self assessment assignment

protected

Parameters

Definition at line 730 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $_SESSION, $id, $ilErr, __initQuestionObject(), array, finalTestAssignment(), selfAssessmentAssignment(), selfAssessmentLimits(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilCourseObjectiveQuestion\TYPE_SELF_ASSESSMENT.

731  {
732  global $ilAccess,$ilErr,$ilObjDataCache;
733 
734  $checked_questions = $_POST['questions'] ? $_POST['questions'] : array();
735 
736 
737  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
738  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
739  }
740  if (!$_GET['objective_id']) {
741  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
742  $this->ctrl->redirect($this, 'listObjectives');
743  }
744 
745  $this->__initQuestionObject((int) $_GET['objective_id']);
746 
747  // Delete unchecked
748  foreach ($this->objectives_qst_obj->getSelfAssessmentQuestions() as $question) {
749  $id = $question['ref_id'] . '_' . $question['question_id'];
750  if (!in_array($id, $checked_questions)) {
751  $this->objectives_qst_obj->delete($question['qst_ass_id']);
752  }
753  }
754  // Add checked
755  foreach ($checked_questions as $question_id) {
756  list($test_ref_id, $qst_id) = explode('_', $question_id);
757  $test_obj_id = $ilObjDataCache->lookupObjId($test_ref_id);
758 
759  if ($this->objectives_qst_obj->isSelfAssessmentQuestion($qst_id)) {
760  continue;
761  }
762  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
763  $this->objectives_qst_obj->setTestRefId($test_ref_id);
764  $this->objectives_qst_obj->setTestObjId($test_obj_id);
765  $this->objectives_qst_obj->setQuestionId($qst_id);
766  $this->objectives_qst_obj->add();
767  }
768 
769  // TODO: not nice
770  include_once './Modules/Course/classes/class.ilCourseObjectiveQuestion.php';
771  $this->questions = new ilCourseObjectiveQuestion((int) $_GET['objective_id']);
772  // not required due to percentages
773  //$this->questions->updateLimits();
774 
775  if ($checked_questions) {
776  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
777  $this->selfAssessmentLimits();
778  return true;
779  } else {
780  switch ($_SESSION['objective_mode']) {
781  case self::MODE_CREATE:
782  $this->finalTestAssignment();
783  return true;
784 
785  case self::MODE_UPDATE:
786  $this->selfAssessmentAssignment();
787  ilUtil::sendSuccess($this->lng->txt('crs_objectives_assigned_lm'));
788  return true;
789  }
790  }
791  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
selfAssessmentAssignment()
self assessment assignemnt
$_SESSION["AccountId"]
$_GET["client_id"]
if(!array_key_exists('StateId', $_REQUEST)) $id
finalTestAssignment()
final test assignment
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
class ilcourseobjectiveQuestion
$_POST["username"]
selfAssessmentLimits()
self assessment limits
+ Here is the call graph for this function:

◆ updateSelfAssessmentLimits()

ilCourseObjectivesGUI::updateSelfAssessmentLimits ( )
protected

update self assessment limits

protected

Parameters

Definition at line 833 of file class.ilCourseObjectivesGUI.php.

References $_GET, $_POST, $ilErr, $test, __initQuestionObject(), selfAssessmentLimits(), ilUtil\sendFailure(), ilUtil\sendSuccess(), and ilCourseObjectiveQuestion\TYPE_SELF_ASSESSMENT.

834  {
835  global $ilAccess,$ilErr,$ilObjDataCache;
836 
837  if (!$ilAccess->checkAccess('write', '', $this->course_obj->getRefId())) {
838  $ilErr->raiseError($this->lng->txt('permission_denied'), $ilErr->WARNING);
839  }
840  if (!$_GET['objective_id']) {
841  ilUtil::sendFailure($this->lng->txt('crs_no_objective_selected'), true);
842  $this->ctrl->redirect($this, 'listObjectives');
843  }
844 
845  $this->__initQuestionObject((int) $_GET['objective_id']);
846 
847  if ((int) $_POST['limit'] < 1 or (int) $_POST['limit'] > 100) {
848  ilUtil::sendFailure($this->lng->txt('crs_objective_err_limit'));
849  $this->selfAssessmentLimits();
850  return false;
851  }
852 
853  foreach ($this->objectives_qst_obj->getSelfAssessmentTests() as $test) {
854  $this->objectives_qst_obj->setTestStatus(ilCourseObjectiveQuestion::TYPE_SELF_ASSESSMENT);
855  $this->objectives_qst_obj->setTestSuggestedLimit((int) $_POST['limit']);
856  $this->objectives_qst_obj->updateTest($test['test_objective_id']);
857  }
858 
859  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
860  $this->ctrl->returnToParent($this);
861  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_GET["client_id"]
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$_POST["username"]
selfAssessmentLimits()
self assessment limits
$test
Definition: Utf8Test.php:84
+ Here is the call graph for this function:

Field Documentation

◆ $course_id

ilCourseObjectivesGUI::$course_id

Definition at line 50 of file class.ilCourseObjectivesGUI.php.

◆ $course_obj

ilCourseObjectivesGUI::$course_obj

Definition at line 49 of file class.ilCourseObjectivesGUI.php.

◆ $ctrl

ilCourseObjectivesGUI::$ctrl

Definition at line 43 of file class.ilCourseObjectivesGUI.php.

◆ $ilErr

◆ $ilias

ilCourseObjectivesGUI::$ilias

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

Referenced by __construct().

◆ $lng

ilCourseObjectivesGUI::$lng

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

Referenced by __construct().

◆ $logger

ilCourseObjectivesGUI::$logger = null
private

Definition at line 60 of file class.ilCourseObjectivesGUI.php.

◆ $settings

ilCourseObjectivesGUI::$settings
protected

Definition at line 53 of file class.ilCourseObjectivesGUI.php.

Referenced by getSettings().

◆ $test_type

ilCourseObjectivesGUI::$test_type = 0
protected

Definition at line 54 of file class.ilCourseObjectivesGUI.php.

Referenced by isRandomTestType().

◆ $tpl

◆ MODE_CREATE

const ilCourseObjectivesGUI::MODE_CREATE = 1

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

◆ MODE_UNDEFINED

const ilCourseObjectivesGUI::MODE_UNDEFINED = 0

◆ MODE_UPDATE

const ilCourseObjectivesGUI::MODE_UPDATE = 2

Definition at line 40 of file class.ilCourseObjectivesGUI.php.


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