ILIAS  Release_4_2_x_branch Revision 61807
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilConditionHandlerInterface.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 
16 {
17  var $ctrl = null;
18 
19  var $lng;
20  var $tpl;
21  var $tree;
22 
23  var $ch_obj;
30 
32 
42  public function ilConditionHandlerInterface($gui_obj,$a_ref_id = null)
43  {
44  global $lng,$tpl,$tree,$ilCtrl;
45 
46  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
47 
48  $this->ch_obj =& new ilConditionHandler();
49 
50  $this->ctrl =& $ilCtrl;
51  $this->gui_obj =& $gui_obj;
52  $this->lng =& $lng;
53  $this->lng->loadLanguageModule('rbac');
54  $this->tpl =& $tpl;
55  $this->tree =& $tree;
56 
57  if($a_ref_id)
58  {
59  $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
60  }
61  else
62  {
63  $this->target_obj =& $this->gui_obj->object;
64  }
65 
66  // this only works for ilObject derived objects (other objects
67  // should call set() methods manually
68  if (is_object($this->target_obj))
69  {
70  $this->setTargetId($this->target_obj->getId());
71  $this->setTargetRefId($this->target_obj->getRefId());
72  $this->setTargetType($this->target_obj->getType());
73  $this->setTargetTitle($this->target_obj->getTitle());
74  }
75  }
76 
77  function setBackButtons($a_btn_arr)
78  {
79  $_SESSION['precon_btn'] = $a_btn_arr;
80  }
81  function getBackButtons()
82  {
83  return $_SESSION['precon_btn'] ? $_SESSION['precon_btn'] : array();
84  }
85 
86  public function executeCommand()
87  {
88  global $ilErr, $ilAccess, $lng;
89 
90  if(!$ilAccess->checkAccess('write','',$this->getTargetRefId()))
91  {
92  $ilErr->raiseError($lng->txt('permission_denied'),$ilErr->WARNING);
93  }
94 
95  $next_class = $this->ctrl->getNextClass($this);
96  $cmd = $this->ctrl->getCmd();
97 
98  switch ($next_class)
99  {
100  default:
101  if (empty($cmd))
102  {
103  $cmd = "view";
104  }
105  $this->$cmd();
106  break;
107  }
108  }
109 
110  function setAutomaticValidation($a_status)
111  {
112  $this->automatic_validation = $a_status;
113  }
115  {
117  }
118 
119 
123  function setTargetId($a_target_id)
124  {
125  $this->target_id = $a_target_id;
126  }
127 
131  function getTargetId()
132  {
133  return $this->target_id;
134  }
135 
139  function setTargetRefId($a_target_ref_id)
140  {
141  $this->target_ref_id = $a_target_ref_id;
142  }
143 
147  function getTargetRefId()
148  {
149  return $this->target_ref_id;
150  }
151 
155  function setTargetType($a_target_type)
156  {
157  $this->target_type = $a_target_type;
158  }
159 
163  function getTargetType()
164  {
165  return $this->target_type;
166  }
167 
171  function setTargetTitle($a_target_title)
172  {
173  $this->target_title = $a_target_title;
174  }
175 
180  public function isTargetReferenced()
181  {
182  return $this->getTargetRefId() ? true : false;
183  }
184 
188  function getTargetTitle()
189  {
190  return $this->target_title;
191  }
192 
193  function chi_init(&$chi_target_obj,$a_ref_id = null)
194  {
195  echo 'deprecated';
196 
197  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
198 
199  $this->ch_obj =& new ilConditionHandler();
200 
201  if($a_ref_id)
202  {
203  $this->target_obj =& ilObjectFactory::getInstanceByRefId($a_ref_id);
204  }
205  else
206  {
207  $this->target_obj =& $this->object;
208  }
209 
210  return true;
211  }
212 
217  protected function listConditions()
218  {
219  global $ilToolbar;
220 
221  $ilToolbar->addButton($this->lng->txt('add_condition'),$this->ctrl->getLinkTarget($this,'selector'));
222 
223  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.list_conditions.html','Services/AccessControl');
224 
226  $this->getTargetRefId(),
227  $this->getTargetId(),
228  $this->getTargetType()
229  );
230  if(count($optional_conditions))
231  {
232  if(!$_REQUEST["list_mode"])
233  {
234  $_REQUEST["list_mode"] = "subset";
235  }
236  }
237  else if(!$_REQUEST["list_mode"])
238  {
239  $_REQUEST["list_mode"] = "all";
240  }
241  $form = $this->showObligatoryForm($optional_conditions);
242  $this->tpl->setVariable('TABLE_SETTINGS',$form->getHTML());
243 
244  include_once './Services/AccessControl/classes/class.ilConditionHandlerTableGUI.php';
245  $table = new ilConditionHandlerTableGUI($this,'listConditions', ($_REQUEST["list_mode"] != "all"));
246  $table->setConditions(
248  $this->getTargetRefId(),
249  $this->getTargetId(),
250  $this->getTargetType()
251  )
252  );
253 
254  $this->tpl->setVariable('TABLE_CONDITIONS',$table->getHTML());
255  $this->tpl->setContent($table->getHTML());
256  }
257 
261  protected function saveObligatorySettings()
262  {
263  $form = $this->showObligatoryForm();
264  if($form->checkInput())
265  {
266  $old_mode = $form->getInput("old_list_mode");
267  switch($form->getInput("list_mode"))
268  {
269  case "all":
270  if($old_mode != "all")
271  {
272  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
274  $this->getTargetRefId(),
275  $this->getTargetId(),
276  $this->getTargetType()
277  );
278  if(sizeof($optional_conditions) > 1)
279  {
280  // Set all optional conditions to obligatory
281  foreach($optional_conditions as $item)
282  {
283  ilConditionHandler::updateObligatory($item["condition_id"], true);
284  }
285  }
286  }
287  break;
288 
289  case "subset":
290  $num_req = $form->getInput('required');
291  if($old_mode != "subset")
292  {
294  $this->getTargetRefId(),
295  $this->getTargetId(),
296  $this->getTargetType()
297  );
298  foreach($all_conditions as $item)
299  {
300  ilConditionHandler::updateObligatory($item["condition_id"], false);
301  }
302  $num_req = 1;
303  }
305  $this->getTargetRefId(),
306  $this->getTargetId(),
307  $num_req
308  );
309  break;
310  }
311 
312  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
313  $this->ctrl->redirect($this,'listConditions');
314  }
315 
316  $form->setValuesByPost();
317  ilUtil::sendFailure($this->lng->txt('err_check_input'));
318  $this->tpl->setContent($form->getHTML());
319  }
320 
324  protected function saveObligatoryList()
325  {
327  $this->getTargetRefId(),
328  $this->getTargetId(),
329  $this->getTargetType()
330  );
331 
332  if($_POST["obl"] && sizeof($_POST["obl"]) > sizeof($all_conditions)-2)
333  {
334  ilUtil::sendFailure($this->lng->txt("rbac_precondition_minimum_optional"), true);
335  $this->ctrl->redirect($this,'listConditions');
336  }
337 
338  foreach($all_conditions as $item)
339  {
340  $status = false;
341  if($_POST["obl"] && in_array($item["condition_id"], $_POST["obl"]))
342  {
343  $status = true;
344  }
345  ilConditionHandler::updateObligatory($item["condition_id"], $status);
346  }
347 
348  // re-calculate
350  $this->getTargetRefId(),
351  $this->getTargetId(),
352  $this->getTargetType(),
353  true
354  );
355 
356  ilUtil::sendSuccess($this->lng->txt('settings_saved'),true);
357  $this->ctrl->redirect($this,'listConditions');
358  }
359 
364  protected function showObligatoryForm($opt = array())
365  {
366  if(!$opt)
367  {
369  $this->getTargetRefId(),
370  $this->getTargetId(),
371  $this->getTargetType()
372  );
373  }
374 
376 
377  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
378  $form = new ilPropertyFormGUI();
379  $form->setFormAction($this->ctrl->getFormAction($this),'listConditions');
380  $form->setTitle($this->lng->txt('precondition_obligatory_settings'));
381  $form->addCommandButton('saveObligatorySettings', $this->lng->txt('save'));
382 
383  $mode = new ilRadioGroupInputGUI($this->lng->txt("rbac_precondition_mode"), "list_mode");
384  $form->addItem($mode);
385  $mode->setValue($_REQUEST["list_mode"]);
386 
387  $mall = new ilRadioOption($this->lng->txt("rbac_precondition_mode_all"), "all");
388  $mall->setInfo($this->lng->txt("rbac_precondition_mode_all_info"));
389  $mode->addOption($mall);
390 
391  $msubset = new ilRadioOption($this->lng->txt("rbac_precondition_mode_subset"), "subset");
392  $msubset->setInfo($this->lng->txt("rbac_precondition_mode_subset_info"));
393  $mode->addOption($msubset);
394 
395  $obl = new ilNumberInputGUI($this->lng->txt('precondition_num_obligatory'), 'required');
396  $obl->setInfo($this->lng->txt('precondition_num_optional_info'));
397  if(count($opt))
398  {
400  $this->getTargetRefId(),
401  $this->getTargetId(),
402  $this->getTargetType()
403  );
404  $min = count($all) - count($opt) + 1;
405  $max = count($all) - 1;
406  }
407  else
408  {
409  $obligatory = $min = $max = 1;
410  }
411  $obl->setValue($obligatory);
412  $obl->setRequired(true);
413  $obl->setSize(1);
414  $obl->setMinValue($min);
415  $obl->setMaxValue($max);
416  $msubset->addSubItem($obl);
417 
418  $old_mode = new ilHiddenInputGUI("old_list_mode");
419  $old_mode->setValue($_REQUEST["list_mode"]);
420  $form->addItem($old_mode);
421 
422  return $form;
423  }
424 
425 
426  function edit()
427  {
428  global $ilObjDataCache;
429 
430  if(!$_GET['condition_id'])
431  {
432  ilUtil::sendFailure("Missing id: condition_id");
433  $this->listConditions();
434  return false;
435  }
436  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
437 
438  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_edit_condition.html');
439  $this->ctrl->setParameter($this,'condition_id',(int) $_GET['condition_id']);
440 
441  $this->initFormCondition($condition['trigger_ref_id'],(int) $_GET['condition_id'],'edit');
442  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
443  }
444 
445  function updateCondition()
446  {
447  global $ilObjDataCache;
448 
449  if(!$_GET['condition_id'])
450  {
451  ilUtil::sendFailure("Missing id: condition_id");
452  $this->listConditions();
453  return false;
454  }
455 
456  // Update condition
457  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
458  $condition_handler = new ilConditionHandler();
459 
460  $condition = ilConditionHandler::_getCondition((int) $_GET['condition_id']);
461  $condition_handler->setOperator($_POST['operator']);
462  $condition_handler->setObligatory((int) $_POST['obligatory']);
463  $condition_handler->setTargetRefId($this->getTargetRefId());
464  $condition_handler->setValue('');
465  switch($this->getTargetType())
466  {
467  case 'st':
468  $condition_handler->setReferenceHandlingType($_POST['ref_handling']);
469  break;
470 
471  default:
472  $condition_handler->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
473  break;
474  }
475  $condition_handler->updateCondition($condition['id']);
476 
477  // Update relevant sco's
478  if($condition['trigger_type'] == 'sahs')
479  {
480  include_once 'Services/Tracking/classes/class.ilLPCollections.php';
481  $lp_collection = new ilLPCollections($condition['trigger_obj_id']);
482  $lp_collection->deleteAll();
483 
484  $items = is_array($_POST['item_ids']) ? $_POST['item_ids'] : array();
485  foreach($items as $item_id)
486  {
487  $lp_collection->add($item_id);
488  }
489 
490  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
491  ilLPStatusWrapper::_refreshStatus($condition['trigger_obj_id']);
492  }
493 
494  ilUtil::sendSuccess($this->lng->txt('settings_saved'));
495  $this->ctrl->redirect($this,'listConditions');
496  }
497 
498  function askDelete()
499  {
500  if(!count($_POST['conditions']))
501  {
502  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
503  $this->listConditions();
504  return false;
505  }
506 
507  // display confirmation message
508  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
509  $cgui = new ilConfirmationGUI();
510  $cgui->setFormAction($this->ctrl->getFormAction($this));
511  $cgui->setHeaderText($this->lng->txt("condition_delete_sure"));
512  $cgui->setCancel($this->lng->txt("cancel"), "listConditions");
513  $cgui->setConfirm($this->lng->txt("delete"), "delete");
514 
515  // list objects that should be deleted
516  foreach($_POST['conditions'] as $condition_id)
517  {
518  $condition = ilConditionHandler::_getCondition($condition_id);
519  $title = ilObject::_lookupTitle($condition['trigger_obj_id']);
520  $cgui->addItem("conditions[]", $condition_id, $title);
521  }
522 
523  $this->tpl->setContent($cgui->getHTML());
524  }
525 
526 
527  function delete()
528  {
529  if(!count($_POST['conditions']))
530  {
531  ilUtil::sendFailure($this->lng->txt('no_condition_selected'));
532  $this->listConditions();
533  return true;
534  }
535 
536  foreach($_POST['conditions'] as $condition_id)
537  {
538  $this->ch_obj->deleteCondition($condition_id);
539  }
540  ilUtil::sendSuccess($this->lng->txt('condition_deleted'),true);
541  $this->ctrl->redirect($this,'listConditions');
542 
543  return true;
544  }
545 
546  function selector()
547  {
548  global $tree;
549 
550  include_once ("./Services/AccessControl/classes/class.ilConditionSelector.php");
551 
552  $this->tpl->addBlockFile('ADM_CONTENT', "adm_content", "tpl.condition_selector.html");
553 
554  ilUtil::sendInfo($this->lng->txt("condition_select_object"));
555 
556  $exp = new ilConditionSelector($this->ctrl->getLinkTarget($this,'copySelector'));
557  $exp->setExpand($_GET["condition_selector_expand"] ? $_GET["condition_selector_expand"] : $this->tree->readRootId());
558  $exp->setExpandTarget($this->ctrl->getLinkTarget($this,'selector'));
559  $exp->setTargetGet("ref_id");
560  $exp->setRefId($this->getTargetRefId());
561 
562  if($this->getTargetRefId())
563  {
564  $path = $tree->getPathId($this->getTargetRefId());
565  array_pop($path);
566  $exp->setForceOpenPath($path);
567  }
568 
569  $exp->addFilter('crs');
570  $exp->addFilter('tst');
571  $exp->addFilter('sahs');
572  $exp->addFilter('svy');
573 
574  $exp->setSelectableTypes($this->ch_obj->getTriggerTypes());
575  $exp->setControlClass($this);
576  // build html-output
577  $exp->setOutput(0);
578 
579  $this->tpl->setCurrentBlock("adm_content");
580  $this->tpl->setVariable("EXPLORER",$exp->getOutput());
581  $this->tpl->parseCurrentBlock();
582  }
583 
584  function add()
585  {
586  global $ilObjDataCache;
587 
588  if(!$_GET['source_id'])
589  {
590  ilUtil::sendFailure("Missing id: condition_id");
591  $this->selector();
592  return false;
593  }
594 
595  $this->initFormCondition((int) $_GET['source_id'],0,'add');
596  $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.condition_handler_add.html');
597  $this->tpl->setVariable('CONDITION_TABLE',$this->form->getHTML());
598  }
599 
600 
604  function assign()
605  {
606  if(!isset($_GET['source_id']))
607  {
608  echo "class.ilConditionHandlerInterface: no source_id given";
609 
610  return false;
611  }
612  if(!$_POST['operator'])
613  {
614  ilUtil::sendFailure($this->lng->txt('err_check_input'));
615  $this->add();
616  return false;
617  }
618 
619  $this->ch_obj->setTargetRefId($this->getTargetRefId());
620  $this->ch_obj->setTargetObjId($this->getTargetId());
621  $this->ch_obj->setTargetType($this->getTargetType());
622 
623  switch($this->getTargetType())
624  {
625  case 'st':
626  $this->ch_obj->setReferenceHandlingType($_POST['ref_handling']);
627  break;
628 
629  default:
630  $this->ch_obj->setReferenceHandlingType(ilConditionHandler::UNIQUE_CONDITIONS);
631  break;
632  }
633  // this has to be changed, if non referenced trigger are implemted
634  if(!$trigger_obj =& ilObjectFactory::getInstanceByRefId((int) $_GET['source_id'],false))
635  {
636  echo 'ilConditionHandler: Trigger object does not exist';
637  }
638  $this->ch_obj->setTriggerRefId($trigger_obj->getRefId());
639  $this->ch_obj->setTriggerObjId($trigger_obj->getId());
640  $this->ch_obj->setTriggerType($trigger_obj->getType());
641  $this->ch_obj->setOperator($_POST['operator']);
642  $this->ch_obj->setObligatory((int) $_POST['obligatory']);
643  $this->ch_obj->setValue('');
644 
645  // Save assigned sco's
646  if($this->ch_obj->getTriggerType() == 'sahs')
647  {
648  include_once 'Services/Tracking/classes/class.ilLPCollections.php';
649  $lp_collection = new ilLPCollections($this->ch_obj->getTriggerObjId());
650  $lp_collection->deleteAll();
651 
652  $items = is_array($_POST['item_ids']) ? $_POST['item_ids'] : array();
653  foreach($items as $item_id)
654  {
655  $lp_collection->add($item_id);
656  }
657  }
658 
659  $this->ch_obj->enableAutomaticValidation($this->getAutomaticValidation());
660  if(!$this->ch_obj->storeCondition())
661  {
662  ilUtil::sendFailure($this->ch_obj->getErrorMessage(),true);
663  }
664  else
665  {
666  ilUtil::sendSuccess($this->lng->txt('added_new_condition'),true);
667  }
668 
669  $this->ctrl->redirect($this,'listConditions');
670 
671  return true;
672  }
673 
674  function chi_update()
675  {
676  #if(in_array('',$_POST['operator']))
677  #{
678  # ilUtil::sendInfo($this->lng->txt('select_one_operator'));
679 
680  # return false;
681  #}
682  foreach($this->__getConditionsOfTarget() as $condition)
683  {
684  $this->ch_obj->setOperator($_POST['operator'][$condition["id"]]);
685  $this->ch_obj->setValue($_POST['value'][$condition["id"]]);
686  $this->ch_obj->updateCondition($condition['id']);
687 
688  }
689  ilUtil::sendSuccess($this->lng->txt('conditions_updated'));
690 
691  $this->ctrl->returnToParent($this);
692 
693  return true;
694  }
696  {
697  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
698 
699  foreach(ilConditionHandler::_getConditionsOfTarget($this->getTargetRefId(),$this->getTargetId(), $this->getTargetType()) as $condition)
700  {
701  if($condition['operator'] == 'not_member')
702  {
703  continue;
704  }
705  else
706  {
707  $cond[] = $condition;
708  }
709  }
710  return $cond ? $cond : array();
711  }
712 
713  function __showButtons()
714  {
715  if(!$this->getBackButtons())
716  {
717  return false;
718  }
719 
720  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
721  foreach($this->getBackButtons() as $name => $link)
722  {
723  $this->tpl->setCurrentBlock("btn_cell");
724  $this->tpl->setVariable("BTN_LINK",$link);
725  $this->tpl->setVariable("BTN_TXT",$this->lng->txt($name));
726  $this->tpl->parseCurrentBlock();
727  }
728  }
729 
737  private function initFormCondition($a_source_id,$a_condition_id = 0,$a_mode = 'add')
738  {
739  $trigger_obj_id = ilObject::_lookupObjId($a_source_id);
740  $trigger_type = ilObject::_lookupType($trigger_obj_id);
741 
742  $condition = ilConditionHandler::_getCondition($a_condition_id);
743 
744  if(is_object($this->form))
745  {
746  return true;
747  }
748  include_once('Services/Form/classes/class.ilPropertyFormGUI.php');
749  $this->form = new ilPropertyFormGUI();
750  $this->ctrl->setParameter($this,'source_id',$a_source_id);
751  $this->form->setFormAction($this->ctrl->getFormAction($this));
752 
753  $info_source = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_source"));
754  $info_source->setValue(ilObject::_lookupTitle(ilObject::_lookupObjId($a_source_id)));
755  $this->form->addItem($info_source);
756 
757  $info_target = new ilNonEditableValueGUI($this->lng->txt("rbac_precondition_target"));
758  $info_target->setValue($this->getTargetTitle());
759  $this->form->addItem($info_target);
760 
761  /* moved to list
762  $obl = new ilCheckboxInputGUI($this->lng->txt('precondition_obligatory'), 'obligatory');
763  $obl->setInfo($this->lng->txt('precondition_obligatory_info'));
764  $obl->setValue(1);
765  if($a_condition_id)
766  {
767  $obl->setChecked($condition['obligatory']);
768  }
769  else
770  {
771  $obl->setChecked(true);
772  }
773  $this->form->addItem($obl);
774  */
775  $obl = new ilHiddenInputGUI('obligatory');
776  if($a_condition_id)
777  {
778  $obl->setValue($condition['obligatory']);
779  }
780  else
781  {
782  $obl->setValue(1);
783  }
784  $this->form->addItem($obl);
785 
786  $sel = new ilSelectInputGUI($this->lng->txt('condition'),'operator');
787  include_once "./Services/AccessControl/classes/class.ilConditionHandler.php";
788  $ch_obj = new ilConditionHandler();
789  if($a_mode == 'add')
790  {
791  $operators[0] = $this->lng->txt('select_one');
792  }
793  foreach($ch_obj->getOperatorsByTargetType($trigger_type) as $operator)
794  {
795  $operators[$operator] = $this->lng->txt('condition_'.$operator);
796  }
797  $sel->setValue(isset($condition['operator']) ? $condition['operator'] : 0);
798  $sel->setOptions($operators);
799  $sel->setRequired(true);
800  $this->form->addItem($sel);
801 
803  {
804  $rad_opt = new ilRadioGroupInputGUI($this->lng->txt('cond_ref_handling'),'ref_handling');
805  $rad_opt->setValue(isset($condition['ref_handling']) ? $condition['ref_handling'] : ilConditionHandler::SHARED_CONDITIONS);
806 
807  $opt2 = new ilRadioOption($this->lng->txt('cond_ref_shared'),ilConditionHandler::SHARED_CONDITIONS);
808  $rad_opt->addOption($opt2);
809 
810  $opt1 = new ilRadioOption($this->lng->txt('cond_ref_unique'),ilConditionHandler::UNIQUE_CONDITIONS);
811  $rad_opt->addOption($opt1);
812 
813  $this->form->addItem($rad_opt);
814  }
815 
816  // Additional settings for SCO's
817  if($trigger_type == 'sahs')
818  {
819  $this->lng->loadLanguageModule('trac');
820  include_once 'Services/Tracking/classes/class.ilLPCollections.php';
821  $lp_collections = new ilLPCollections($trigger_obj_id);
822 
823  $cus = new ilCustomInputGUI($this->lng->txt('trac_sahs_relevant_items'),'item_ids[]');
824  $cus->setRequired(true);
825 
826  $tpl = new ilTemplate('tpl.condition_handler_sco_row.html',true,true);
827  $counter = 0;
828 
829  foreach(ilLPCollections::_getPossibleSAHSItems($trigger_obj_id) as $item_id => $sahs_item)
830  {
831  $tpl->setCurrentBlock("sco_row");
832  $tpl->setVariable('SCO_ID',$item_id);
833  $tpl->setVariable('SCO_TITLE',$sahs_item['title']);
834  $tpl->setVariable('CHECKED',$lp_collections->isAssigned($item_id) ? 'checked="checked"' : '');
835  $tpl->parseCurrentBlock();
836  $counter++;
837  }
838  $tpl->setVariable('INFO_SEL',$this->lng->txt('trac_lp_determination_info_sco'));
839  $cus->setHTML($tpl->get());
840  $this->form->addItem($cus);
841  }
842  switch($a_mode)
843  {
844  case 'edit':
845  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.gif'));
846  $this->form->setTitle($this->lng->txt('precondition'));
847  $this->form->addCommandButton('updateCondition',$this->lng->txt('save'));
848  $this->form->addCommandButton('listConditions',$this->lng->txt('cancel'));
849  break;
850 
851 
852  case 'add':
853  $this->form->setTitleIcon(ilUtil::getImagePath('icon_'.$this->getTargetType().'.gif'));
854  $this->form->setTitle($this->lng->txt('add_condition'));
855  $this->form->addCommandButton('assign',$this->lng->txt('save'));
856  $this->form->addCommandButton('selector',$this->lng->txt('back'));
857  break;
858  }
859  return true;
860  }
861 }
862 ?>