ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjSessionGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 include_once('./classes/class.ilObjectGUI.php');
25 include_once('./Modules/Session/classes/class.ilObjSession.php');
26 include_once('./Modules/Session/classes/class.ilSessionFile.php');
27 
39 {
40  public $lng;
41  public $ctrl;
42  public $tpl;
43 
44  protected $course_ref_id = 0;
45  protected $course_obj_id = 0;
46 
47  protected $files = array();
48 
56  public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
57  {
58  global $ilCtrl, $lng, $ilCtrl,$tpl;
59 
60  $this->type = "sess";
61  parent::__construct($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
62 
63  $this->lng = $lng;
64  $this->lng->loadLanguageModule("event");
65  $this->lng->loadLanguageModule('crs');
66  $this->lng->loadLanguageModule('trac');
67 
68  $this->tpl = $tpl;
69  $this->ctrl = $ilCtrl;
70  }
71 
78  public function executeCommand()
79  {
80  global $ilUser;
81 
82  $next_class = $this->ctrl->getNextClass($this);
83  $cmd = $this->ctrl->getCmd();
84 
85 
86  $this->prepareOutput();
87  switch($next_class)
88  {
89  case "ilinfoscreengui":
90  $this->checkPermission("visible");
91  $this->infoScreen(); // forwards command
92  break;
93 
94  case 'ilpermissiongui':
95  $this->tabs_gui->setTabActive('perm_settings');
96  include_once("./classes/class.ilPermissionGUI.php");
97  $perm_gui = new ilPermissionGUI($this);
98  $ret = $this->ctrl->forwardCommand($perm_gui);
99  break;
100 
101  default:
102  if(!$cmd)
103  {
104  $cmd = "infoScreen";
105  }
106  $cmd .= "Object";
107  if ($cmd != "infoScreenObject")
108  {
109  $this->checkPermission("read");
110  }
111  else
112  {
113  $this->checkPermission("visible");
114  }
115  $this->$cmd();
116 
117  break;
118  }
119  return true;
120  }
121 
129  public function registerObject()
130  {
131  global $ilUser;
132 
133  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
134  ilEventParticipants::_register($ilUser->getId(),$this->object->getId());
135 
136  ilUtil::sendInfo($this->lng->txt('event_registered'),true);
137  $this->ctrl->returnToParent($this);
138  }
139 
146  public function unregisterObject()
147  {
148  global $ilUser;
149 
150  include_once './Modules/Session/classes/class.ilEventParticipants.php';
151  ilEventParticipants::_unregister($ilUser->getId(),$this->object->getId());
152 
153  ilUtil::sendInfo($this->lng->txt('event_unregistered'),true);
154  $this->ctrl->returnToParent($this);
155  }
156 
165  public static function _goto($a_target)
166  {
167  global $ilAccess,$ilErr;
168 
169  if($ilAccess->checkAccess('visible', "", $a_target))
170  {
171  $_GET["cmd"] = "infoScreen";
172  $_GET["ref_id"] = $a_target;
173  include("repository.php");
174  exit;
175  }
176  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
177  }
178 
184  public function infoScreenObject()
185  {
186  $this->ctrl->setCmd("showSummary");
187  $this->ctrl->setCmdClass("ilinfoscreengui");
188  $this->infoScreen();
189  }
190 
198  public function infoScreen()
199  {
200  global $ilAccess, $ilUser;
201 
202  if (!$ilAccess->checkAccess("visible", "", $this->object->getRefId()))
203  {
204  $this->ilias->raiseError($this->lng->txt("msg_no_perm_read"),$this->ilias->error_obj->MESSAGE);
205  }
206 
207  $this->tabs_gui->setTabActive('info_short');
208 
209  $appointment_obj =& $this->object->getFirstAppointment();
210 
211  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
212  $info = new ilInfoScreenGUI($this);
213  $info->addSection($this->lng->txt("event_general_properties"));
214  $info->addProperty($this->lng->txt('event_title'),
215  $this->object->getTitle());
216  /*
217  if(strlen($desc = $this->object->getDescription()))
218  {
219  $info->addProperty($this->lng->txt('event_desc'),
220  nl2br($this->object->getDescription()));
221  }
222  */
223  if(strlen($location = $this->object->getLocation()))
224  {
225  $info->addProperty($this->lng->txt('event_location'),
226  nl2br($this->object->getLocation()));
227  }
228  $info->addProperty($this->lng->txt('event_date'),
229  $appointment_obj->appointmentToString());
230 
231  if($this->object->hasTutorSettings())
232  {
233  $info->addSection($this->lng->txt('event_tutor_data'));
234  if(strlen($fullname = $this->object->getName()))
235  {
236  $info->addProperty($this->lng->txt('event_lecturer'),
237  $fullname);
238  }
239  if(strlen($email = $this->object->getEmail()))
240  {
241  $info->addProperty($this->lng->txt('tutor_email'),
242  $email);
243  }
244  if(strlen($phone = $this->object->getPhone()))
245  {
246  $info->addProperty($this->lng->txt('tutor_phone'),
247  $phone);
248  }
249  }
250 
251  $details = $this->object->getDetails();
252 
253  $files = $this->object->getFiles();
254  if(strlen($details) or is_array($files))
255  {
256  $info->addSection($this->lng->txt('event_further_informations'));
257 
258  if(strlen($details))
259  {
260  $info->addProperty($this->lng->txt('event_details_workflow'),
261  nl2br($details));
262  }
263 
264  if(count($files))
265  {
266  $tpl = new ilTemplate('tpl.sess_info_file.html',true,true,'Modules/Session');
267 
268  foreach($files as $file)
269  {
270  $tpl->setCurrentBlock("files");
271  $this->ctrl->setParameter($this,'file_id',$file->getFileId());
272  $tpl->setVariable("DOWN_LINK",$this->ctrl->getLinkTarget($this,'sendfile'));
273  $tpl->setVariable("DOWN_NAME",$file->getFileName());
274  $tpl->setVariable("DOWN_INFO_TXT",$this->lng->txt('event_file_size_info'));
275  $tpl->setVariable("DOWN_SIZE",$file->getFileSize());
276  $tpl->setVariable("TXT_BYTES",$this->lng->txt('bytes'));
277  $tpl->parseCurrentBlock();
278  }
279  $info->addProperty($this->lng->txt('event_file_download'),
280  $tpl->get());
281  }
282 
283  }
284  #$info->enablePrivateNotes();
285 
286 
287  // forward the command
288  $this->ctrl->forwardCommand($info);
289 
290  }
291 
297  public function sendFileObject()
298  {
299  $file = new ilSessionFile((int) $_GET['file_id']);
300 
301  ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
302  return true;
303  }
304 
305 
313  public function createObject()
314  {
315  if(!is_object($this->object))
316  {
317  $this->object = new ilObjSession();
318  }
319 
320  $this->initForm('create');
321  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_create.html','Modules/Session');
322  $this->tpl->setVariable('EVENT_ADD_TABLE',$this->form->getHTML());
323  $this->fillCloneTemplate('DUPLICATE','sess');
324  }
325 
333  public function saveObject()
334  {
335  global $ilErr;
336 
337  $this->object = new ilObjSession();
338 
339  $this->load();
340  $this->loadRecurrenceSettings();
341  $this->initForm('create');
342 
343  $ilErr->setMessage('');
344  if(!$this->form->checkInput())
345  {
346  $ilErr->setMessage($this->lng->txt('err_check_input'));
347  }
348 
349  $this->object->validate();
350  $this->object->getFirstAppointment()->validate();
351 
352  if(strlen($ilErr->getMessage()))
353  {
354  ilUtil::sendInfo($ilErr->getMessage().$_GET['ref_id']);
355  $this->createObject();
356  return false;
357  }
358  // Create session
359  $this->object->create();
360  $this->object->createReference();
361  $this->object->putInTree($_GET["ref_id"]);
362  $this->object->setPermissions($_GET["ref_id"]);
363 
364  // create appointment
365  $this->object->getFirstAppointment()->setSessionId($this->object->getId());
366  $this->object->getFirstAppointment()->create();
367 
368  foreach($this->files as $file_obj)
369  {
370  $file_obj->setSessionId($this->object->getEventId());
371  $file_obj->create();
372  }
373  $this->createRecurringSessions();
374 
375  // call crs items for creating a new entry for the new session
376  // Otherwise the sorting of sessions is wrong.
377  // TODO find a better solution
378  include_once './Modules/Course/classes/class.ilCourseItems.php';
379  $tmp_course = ilObjectFactory::getInstanceByRefId((int) $_GET['ref_id'],false);
380  $items = new ilCourseItems($tmp_course);
381 
382 
383  ilUtil::sendInfo($this->lng->txt('event_add_new_event'),true);
384  $this->ctrl->returnToParent($this);
385  return true;
386 
387  }
388 
396  protected function createRecurringSessions()
397  {
398  global $tree;
399 
400  if(!$this->rec->getFrequenceType())
401  {
402  return true;
403  }
404  include_once('./Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php');
405  $calc = new ilCalendarRecurrenceCalculator($this->object->getFirstAppointment(),$this->rec);
406 
407  $period_start = clone $this->object->getFirstAppointment()->getStart();
408 
409 
410  $period_end = clone $this->object->getFirstAppointment()->getStart();
411  $period_end->increment(IL_CAL_YEAR,5);
412  $date_list = $calc->calculateDateList($period_start,$period_end);
413 
414  $period_diff = $this->object->getFirstAppointment()->getEnd()->get(IL_CAL_UNIX) -
415  $this->object->getFirstAppointment()->getStart()->get(IL_CAL_UNIX);
416  $parent_id = $tree->getParentId($this->object->getRefId());
417 
418  $counter = 0;
419  foreach($date_list->get() as $date)
420  {
421  if(!$counter++)
422  {
423  continue;
424  }
425 
426  $new_obj = $this->object->cloneObject($parent_id);
427  $new_obj->read();
428  $new_obj->getFirstAppointment()->setStartingTime($date->get(IL_CAL_UNIX));
429  $new_obj->getFirstAppointment()->setEndingTime($date->get(IL_CAL_UNIX) + $period_diff);
430  $new_obj->getFirstAppointment()->update();
431  $new_obj->update();
432  }
433  }
434 
435 
443  public function editObject()
444  {
445  $this->tabs_gui->setTabActive('edit_properties');
446 
447  $this->initForm('edit');
448  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_edit.html','Modules/Session');
449  $this->tpl->setVariable('EVENT_EDIT_TABLE',$this->form->getHTML());
450 
451  if(!count($this->object->getFiles()))
452  {
453  return true;
454  }
455  $rows = array();
456  foreach($this->object->getFiles() as $file)
457  {
458  $table_data['id'] = $file->getFileId();
459  $table_data['filename'] = $file->getFileName();
460  $table_data['filetype'] = $file->getFileType();
461  $table_data['filesize'] = $file->getFileSize();
462 
463  $rows[] = $table_data;
464  }
465 
466  include_once("./Modules/Session/classes/class.ilSessionFileTableGUI.php");
467  $table_gui = new ilSessionFileTableGUI($this, "edit");
468  $table_gui->setTitle($this->lng->txt("event_files"));
469  $table_gui->setData($rows);
470  $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
471  $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
472  $table_gui->setSelectAllCheckbox("file_id");
473  $this->tpl->setVariable('EVENT_FILE_TABLE',$table_gui->getHTML());
474 
475  return true;
476  }
477 
485  public function updateObject()
486  {
487  global $ilErr;
488 
489  $this->load();
490  $this->initForm('edit');
491 
492  $ilErr->setMessage('');
493  if(!$this->form->checkInput())
494  {
495  $ilErr->setMessage($this->lng->txt('err_check_input'));
496  }
497  $this->object->validate();
498  $this->object->getFirstAppointment()->validate();
499 
500  if(strlen($ilErr->getMessage()))
501  {
502  ilUtil::sendInfo($ilErr->getMessage());
503  $this->editObject();
504  return false;
505  }
506  // Update event
507  $this->object->update();
508  $this->object->getFirstAppointment()->update();
509 
510  foreach($this->files as $file_obj)
511  {
512  $file_obj->setSessionId($this->object->getEventId());
513  $file_obj->create();
514  }
515 
516  ilUtil::sendInfo($this->lng->txt('event_updated'));
517  $this->object->initFiles();
518  $this->editObject();
519  return true;
520  }
521 
529  public function confirmDeleteFilesObject()
530  {
531  $this->tabs_gui->setTabActive('edit_properties');
532 
533  if(!count($_POST['file_id']))
534  {
535  ilUtil::sendInfo($this->lng->txt('select_one'));
536  $this->editObject();
537  return false;
538  }
539 
540  include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
541  $c_gui = new ilConfirmationGUI();
542 
543  // set confirm/cancel commands
544  $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
545  $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
546  $c_gui->setCancel($this->lng->txt("cancel"), "edit");
547  $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
548 
549  // add items to delete
550  foreach($_POST["file_id"] as $file_id)
551  {
552  $file = new ilSessionFile($file_id);
553  if($file->getSessionId() != $this->object->getEventId())
554  {
555  ilUtil::sendInfo($this->lng->txt('select_one'));
556  $this->edit();
557  return false;
558  }
559  $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
560  }
561 
562  $this->tpl->setContent($c_gui->getHTML());
563  return true;
564  }
565 
573  public function deleteFilesObject()
574  {
575  if(!count($_POST['file_id']))
576  {
577  ilUtil::sendInfo($this->lng->txt('select_one'));
578  $this->editObject();
579  return false;
580  }
581  foreach($_POST['file_id'] as $id)
582  {
583  $file = new ilSessionFile($id);
584  $file->delete();
585  }
586  $this->object->initFiles();
587  $this->editObject();
588  return true;
589  }
590 
598  public function materialsObject()
599  {
600  global $tree, $objDefinition;
601 
602  $this->tabs_gui->setTabActive('crs_materials');
603 
604  include_once 'Modules/Session/classes/class.ilEventItems.php';
605  $this->event_items = new ilEventItems($this->object->getId());
606  $items = $this->event_items->getItems();
607 
608  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_materials.html','Modules/Session');
609  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
610 
611  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this,'materials'));
612  $this->tpl->setVariable("COLL_TITLE_IMG",ilUtil::getImagePath('icon_sess.gif'));
613  $this->tpl->setVariable("COLL_TITLE_IMG_ALT",$this->lng->txt('events'));
614  $this->tpl->setVariable("TABLE_TITLE",$this->lng->txt('event_assign_materials_table'));
615  $this->tpl->setVariable("TABLE_INFO",$this->lng->txt('event_assign_materials_info'));
616 
617  $this->course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
618  if(!$this->course_ref_id)
619  {
620  ilUtil::sendInfo('No course object found. Aborting');
621  return true;
622  }
623  $nodes = $tree->getSubTree($tree->getNodeData($this->course_ref_id));
624  $counter = 1;
625  foreach($nodes as $node)
626  {
627  // No side blocks here
628  if ($objDefinition->isSideBlock($node['type']) or $node['type'] == 'sess')
629  {
630  continue;
631  }
632 
633  if($node['type'] == 'rolf')
634  {
635  continue;
636  }
637  if($counter++ == 1)
638  {
639  continue;
640  }
641  $this->tpl->setCurrentBlock("material_row");
642 
643  $this->tpl->setVariable('TYPE_IMG',ilUtil::getImagePath('icon_'.$node['type'].'_s.gif'));
644  $this->tpl->setVariable('IMG_ALT',$this->lng->txt('obj_'.$node['type']));
645  $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor($counter,'tblrow1','tblrow2'));
646  $this->tpl->setVariable("CHECK_COLL",ilUtil::formCheckbox(in_array($node['ref_id'],$items) ? 1 : 0,
647  'items[]',$node['ref_id']));
648  $this->tpl->setVariable("COLL_TITLE",$node['title']);
649 
650  if(strlen($node['description']))
651  {
652  $this->tpl->setVariable("COLL_DESC",$node['description']);
653  }
654  $this->tpl->setVariable("ASSIGNED_IMG_OK",in_array($node['ref_id'],$items) ?
655  ilUtil::getImagePath('icon_ok.gif') :
656  ilUtil::getImagePath('icon_not_ok.gif'));
657  $this->tpl->setVariable("ASSIGNED_STATUS",$this->lng->txt('event_material_assigned'));
658  $this->tpl->setVariable("COLL_PATH",$this->formatPath($node['ref_id']));
659  $this->tpl->parseCurrentBlock();
660  }
661 
662  $this->tpl->setVariable("SELECT_ROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
663  $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
664  $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
665  $this->tpl->setVariable("BTN_SAVE",$this->lng->txt('save'));
666  }
667 
675  public function saveMaterialsObject()
676  {
677  include_once './Modules/Session/classes/class.ilEventItems.php';
678 
679  $this->event_items = new ilEventItems($this->object->getId());
680  $this->event_items->setItems(is_array($_POST['items']) ? $_POST['items'] : array());
681  $this->event_items->update();
682 
683  ilUtil::sendInfo($this->lng->txt('settings_saved'));
684  $this->materialsObject();
685  }
686 
692  protected function membersObject()
693  {
694  global $tree;
695 
696  $this->checkPermission('write');
697 
698  $this->tabs_gui->setTabActive('event_edit_members');
699 
700  $this->__showButton('printViewMembers',$this->lng->txt('print'),'target="_blank"');
701  $this->__showButton('attendanceList',$this->lng->txt('sess_gen_attendance_list'));
702 
703  $this->course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
704  $this->course_obj_id = ilObject::_lookupObjId($this->course_ref_id);
705  if(!$this->course_ref_id)
706  {
707  ilUtil::sendInfo('No course object found. Aborting');
708  return true;
709  }
710 
711  include_once './Modules/Course/classes/class.ilCourseParticipants.php';
712  include_once './Modules/Session/classes/class.ilEventParticipants.php';
713 
714  $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj_id);
715  $event_part = new ilEventParticipants($this->object->getId());
716 
717  $members = $members_obj->getParticipants();
718 
719  include_once('./Modules/Session/classes/class.ilSessionParticipantsTableGUI.php');
720  $table = new ilSessionParticipantsTableGUI($this);
721  $table->setTitle($this->lng->txt('event_tbl_participants'),'icon_usr.gif',$this->lng->txt('event_tbl_participants'));
722  $table->enableRegistration($this->object->enabledRegistration());
723  $table->setParticipants($members);
724  $table->parse();
725 
726  $this->tpl->setContent($table->getHTML());
727  }
728 
736  public function updateMembersObject()
737  {
738  global $tree;
739 
740  $this->checkPermission('write');
741 
742  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
743  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
744 
745  $this->course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
746  $this->course_obj_id = ilObject::_lookupObjId($this->course_ref_id);
747  if(!$this->course_ref_id)
748  {
749  ilUtil::sendInfo('No course object found. Aborting');
750  return true;
751  }
752 
753  $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
754 
755  $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj_id);
756  $event_part = new ilEventParticipants($this->object->getId());
757 
758  $visible = $_POST['visible_participants'] ? $_POST['visible_participants'] : array();
759  foreach($visible as $user)
760  {
761  $part = new ilEventParticipants($this->object->getId());
762  $part->setUserId($user);
763  $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
764  $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
765  $part->setParticipated(isset($_POST['participants'][$user]) ? true : false);
766  $part->setRegistered(ilEventParticipants::_isRegistered($user,$this->object->getId()));
767  $part->updateUser();
768  }
769  ilUtil::sendInfo($this->lng->txt('settings_saved'));
770  $this->membersObject();
771  }
772 
779  public function attendanceListObject()
780  {
781  global $tpl,$ilTabs;
782 
783  $this->checkPermission('write');
784 
785  $ilTabs->setTabActive('event_edit_members');
786 
787  $this->initAttendanceForm();
788  $tpl->setContent($this->form->getHTML());
789 
790  }
791 
798  protected function initAttendanceForm()
799  {
800  include_once('./Services/Form/classes/class.ilPropertyFormGUI.php');
801 
802  $this->form = new ilPropertyFormGUI();
803  $this->form->setFormAction($this->ctrl->getFormAction($this));
804  $this->form->setTarget('_blank');
805  $this->form->setTitle($this->lng->txt('sess_gen_attendance_list'));
806 
807  $mark = new ilCheckboxInputGUI($this->lng->txt('trac_mark'),'show_mark');
808  $mark->setOptionTitle($this->lng->txt('sess_gen_mark_title'));
809  $mark->setValue(1);
810  $this->form->addItem($mark);
811 
812  $comment = new ilCheckboxInputGUI($this->lng->txt('trac_comment'),'show_comment');
813  $comment->setOptionTitle($this->lng->txt('sess_gen_comment'));
814  $comment->setValue(1);
815  $this->form->addItem($comment);
816 
817  $signature = new ilCheckboxInputGUI($this->lng->txt('sess_signature'),'show_signature');
818  $signature->setOptionTitle($this->lng->txt('sess_gen_signature'));
819  $signature->setValue(1);
820  $this->form->addItem($signature);
821 
822  $this->form->addCommandButton('printAttendanceList',$this->lng->txt('sess_print_attendance_list'));
823 
824  }
825 
831  protected function printAttendanceListObject()
832  {
833  global $ilErr,$ilAccess,$tree;
834 
835  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
836  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
837 
838  $this->checkPermission('write');
839 
840  $this->course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
841  $this->course_obj_id = ilObject::_lookupObjId($this->course_ref_id);
842  if(!$this->course_ref_id)
843  {
844  ilUtil::sendInfo('No course object found. Aborting');
845  return true;
846  }
847 
848  $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj_id);
849  $event_app = $this->object->getFirstAppointment();
850  $event_part = new ilEventParticipants($this->object->getId());
851 
852 
853  $this->tpl = new ilTemplate('tpl.main.html',true,true);
854  // load style sheet depending on user's settings
855  $location_stylesheet = ilUtil::getStyleSheetLocation();
856  $this->tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
857 
858  $tpl = new ilTemplate('tpl.sess_attendance_list_print.html',true,true,'Modules/Session');
859 
860  $tpl->setVariable("ATTENDANCE_LIST",$this->lng->txt('sess_attendance_list'));
861  $tpl->setVariable("EVENT_NAME",$this->object->getTitle());
863  $tpl->setVariable("DATE",ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd()));
865 
866  $tpl->setVariable("TXT_NAME",$this->lng->txt('name'));
867  if($_POST['show_mark'])
868  {
869  $tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
870  }
871  if($_POST['show_comment'])
872  {
873  $tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
874  }
875  if($_POST['show_signature'])
876  {
877  $tpl->setVariable("TXT_SIGNATURE",$this->lng->txt('sess_signature'));
878  }
879 
880  $members = $members_obj->getParticipants();
881  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
882 
883  foreach($members as $user_id)
884  {
885  $user_data = $event_part->getUser($user_id);
886 
887  if($_POST['show_mark'])
888  {
889  $tpl->setVariable("MARK",$user_data['mark'] ? $user_data['mark'] : ' ');
890  }
891  if($_POST['show_comment'])
892  {
893  $tpl->setVariable("COMMENT",$user_data['comment'] ? $user_data['comment'] : ' ');
894  }
895  if($_POST['show_signature'])
896  {
897  $tpl->touchBlock('row_signature');
898  }
899 
900  $tpl->setCurrentBlock("member_row");
901  $name = ilObjUser::_lookupName($user_id);
902  $tpl->setVariable("LASTNAME",$name['lastname']);
903  $tpl->setVariable("FIRSTNAME",$name['firstname']);
904  $tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
905  $tpl->parseCurrentBlock();
906  }
907 
908  $this->tpl->setVariable("CONTENT",$tpl->get());
909  $this->tpl->setVariable("BODY_ATTRIBUTES",'onload="window.print()"');
910  $this->tpl->show();
911  exit;
912  }
913 
914 
922  public function printViewMembersObject()
923  {
924  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
925  include_once('./Modules/Course/classes/class.ilCourseParticipants.php');
926 
927  global $ilErr,$ilAccess,$tree;
928 
929  $this->course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
930  $this->course_obj_id = ilObject::_lookupObjId($this->course_ref_id);
931  if(!$this->course_ref_id)
932  {
933  ilUtil::sendInfo('No course object found. Aborting');
934  return true;
935  }
936 
937  $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj_id);
938  $event_app = $this->object->getFirstAppointment();
939  $event_part = new ilEventParticipants($this->object->getId());
940 
941 
942  $this->tpl = new ilTemplate('tpl.main.html',true,true);
943  // load style sheet depending on user's settings
944  $location_stylesheet = ilUtil::getStyleSheetLocation();
945  $this->tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
946 
947  $tpl = new ilTemplate('tpl.sess_members_print.html',true,true,'Modules/Session');
948 
949  $tpl->setVariable("EVENT",$this->lng->txt('event'));
950  $tpl->setVariable("EVENT_NAME",$this->object->getTitle());
952  $tpl->setVariable("DATE",ilDatePresentation::formatPeriod($event_app->getStart(),$event_app->getEnd()));
954  $tpl->setVariable("TXT_NAME",$this->lng->txt('name'));
955  $tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
956  $tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
957  $tpl->setVariable("TXT_PARTICIPATED",$this->lng->txt('event_tbl_participated'));
958  if($this->object->enabledRegistration())
959  {
960  $tpl->setVariable("TXT_REGISTERED",$this->lng->txt('event_tbl_registered'));
961  }
962 
963  $members = $members_obj->getParticipants();
964  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
965  foreach($members as $user_id)
966  {
967 
968  $user_data = $event_part->getUser($user_id);
969 
970  if($this->object->enabledRegistration())
971  {
972  $tpl->setCurrentBlock("reg_col");
973  $tpl->setVariable("REGISTERED",$event_part->isRegistered($user_id) ? "X" : "");
974  $tpl->parseCurrentBlock();
975  }
976  $tpl->setVariable("COMMENT",$user_data['comment']);
977 
978  $tpl->setCurrentBlock("member_row");
979  $name = ilObjUser::_lookupName($user_id);
980  $tpl->setVariable("LASTNAME",$name['lastname']);
981  $tpl->setVariable("FIRSTNAME",$name['firstname']);
982  $tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
983  $tpl->setVariable("MARK",$user_data['mark']);
984  $tpl->setVariable("PARTICIPATED",$event_part->hasParticipated($user_id) ? "X" : "");
985  $tpl->parseCurrentBlock();
986  }
987 
988  $this->tpl->setVariable("CONTENT",$tpl->get());
989  $this->tpl->setVariable("BODY_ATTRIBUTES",'onload="window.print()"');
990  $this->tpl->show();
991  exit;
992 
993  }
994 
1002  public function eventsListObject()
1003  {
1004  global $ilErr,$ilAccess, $ilUser,$tree;
1005 
1006  if(!$ilAccess->checkAccess('write','',$this->object->getRefId()))
1007  {
1008  $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
1009  }
1010 
1011  $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.sess_list.html','Modules/Session');
1012  $this->__showButton($this->ctrl->getLinkTarget($this,'exportCSV'),$this->lng->txt('event_csv_export'));
1013 
1014  include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
1015  include_once 'Modules/Session/classes/class.ilEventParticipants.php';
1016 
1017  $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
1018  $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.sess_list_row.html','Modules/Session');
1019 
1020  $members_obj = ilCourseParticipants::_getInstanceByObjId($this->object->getId());
1021  $members = $members_obj->getParticipants();
1022  $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
1023 
1024  // Table
1025  $tbl = new ilTableGUI();
1026  $tbl->setTitle($this->lng->txt("event_overview"),
1027  'icon_usr.gif',
1028  $this->lng->txt('obj_usr'));
1029  $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
1030 
1031  $course_ref_id = $tree->checkForParentType($this->object->getRefId(),'crs');
1032  $events = array();
1033  foreach($tree->getSubtree($tree->getNodeData($course_ref_id),false,'sess') as $event_id)
1034  {
1035  $tmp_event = ilObjectFactory::getInstanceByRefId($event_id,false);
1036  if(!is_object($tmp_event) or $tmp_event->getType() != 'sess')
1037  {
1038  continue;
1039  }
1040  $events[] = $tmp_event;
1041  }
1042 
1043  $headerNames = array();
1044  $headerVars = array();
1045  $colWidth = array();
1046 
1047  $headerNames[] = $this->lng->txt('name');
1048  $headerVars[] = "name";
1049  $colWidth[] = '20%';
1050 
1051  for ($i = 1; $i <= count($events); $i++)
1052  {
1053  $headerNames[] = $i;
1054  $headerVars[] = "event_".$i;
1055  $colWidth[] = 80/count($events)."%";
1056  }
1057 
1058  $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
1059  $tbl->setHeaderNames($headerNames);
1060  $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
1061  $tbl->setColumnWidth($colWidth);
1062 
1063  $tbl->setOrderColumn($_GET["sort_by"]);
1064  $tbl->setOrderDirection($_GET["sort_order"]);
1065  $tbl->setOffset($_GET["offset"]);
1066  $tbl->setLimit($ilUser->getPref("hits_per_page"));
1067  $tbl->setMaxCount(count($members));
1068  $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
1069 
1070  $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
1071  $tbl->disable('sort');
1072  $tbl->render();
1073 
1074  $counter = 0;
1075  foreach($sliced_users as $user_id)
1076  {
1077  foreach($events as $event_obj)
1078  {
1079  $this->tpl->setCurrentBlock("eventcols");
1080 
1081  $event_part = new ilEventParticipants($this->object->getId());
1082 
1083  {
1084  $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
1085  ilUtil::getImagePath('icon_ok.gif') :
1086  ilUtil::getImagePath('icon_not_ok.gif'));
1087 
1088  $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
1089  $this->lng->txt('event_participated') :
1090  $this->lng->txt('event_not_participated'));
1091  }
1092 
1093  $this->tpl->parseCurrentBlock();
1094  }
1095 
1096  $this->tpl->setCurrentBlock("tbl_content");
1097  $name = ilObjUser::_lookupName($user_id);
1098  $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1099  $this->tpl->setVariable("LASTNAME",$name['lastname']);
1100  $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
1101  $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
1102  $this->tpl->parseCurrentBlock();
1103  }
1104 
1105  $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
1106  $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
1107  $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
1108  $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
1109  $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
1110  $i = 1;
1111  foreach($events as $event_obj)
1112  {
1113  $this->tpl->setCurrentBlock("legend_loop");
1114  $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
1115  $this->tpl->setVariable("LEGEND_DIGIT", $i++);
1116  $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
1117  $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
1118  $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
1119  $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
1120  $this->tpl->parseCurrentBlock();
1121  }
1122 
1123  }
1124 
1130  protected function initForm($a_mode)
1131  {
1132  global $ilUser;
1133 
1134  if(is_object($this->form))
1135  {
1136  return true;
1137  }
1138 
1139  $this->lng->loadLanguageModule('dateplaner');
1140 
1141  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
1142 
1143  include_once('./Services/YUI/classes/class.ilYuiUtil.php');
1145 
1146  $this->form = new ilPropertyFormGUI();
1147  $this->form->setMultipart(true);
1148  $this->form->setTableWidth('60%');
1149  $this->form->setFormAction($this->ctrl->getFormAction($this));
1150 
1151  // title
1152  $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
1153  $title->setValue($this->object->getTitle());
1154  $title->setSize(50);
1155  $title->setMaxLength(70);
1156  $title->setRequired(TRUE);
1157  $this->form->addItem($title);
1158 
1159  // desc
1160  $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
1161  $desc->setValue($this->object->getLongDescription());
1162  $desc->setRows(4);
1163  $desc->setCols(50);
1164  $this->form->addItem($desc);
1165 
1166  // location
1167  $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
1168  $desc->setValue($this->object->getLocation());
1169  $desc->setRows(4);
1170  $desc->setCols(50);
1171  $this->form->addItem($desc);
1172 
1173  // registration
1174  $reg = new ilCheckboxInputGUI($this->lng->txt('event_registration'),'registration');
1175  $reg->setChecked($this->object->enabledRegistration() ? true : false);
1176  $reg->setOptionTitle($this->lng->txt('event_registration_info'));
1177  $this->form->addItem($reg);
1178 
1179  // section
1181  $section->setTitle($this->lng->txt('event_date_time'));
1182  $this->form->addItem($section);
1183 
1184  $this->tpl->addJavaScript('./Modules/Session/js/toggle_session_time.js');
1185  $full = new ilCheckboxInputGUI($this->lng->txt('sess_date_time'),'fulltime');
1186  $full->setChecked($this->object->getFirstAppointment()->enabledFulltime() ? true : false);
1187  $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
1188  $full->setAdditionalAttributes('onchange="ilToggleSessionTime(this);"');
1189  $this->form->addItem($full);
1190 
1191  // start
1192  $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
1193  $start->setMinuteStepSize(5);
1194  $start->setDate($this->object->getFirstAppointment()->getStart());
1195  $start->setShowTime(true);
1196  $full->addSubItem($start);
1197 
1198  // end
1199  $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
1200  $end->setMinuteStepSize(5);
1201  $end->setDate($this->object->getFirstAppointment()->getEnd());
1202  $end->setShowTime(true);
1203  $full->addSubItem($end);
1204 
1205  // Recurrence
1206  if($a_mode == 'create')
1207  {
1208  if(!is_object($this->rec))
1209  {
1210  include_once('./Modules/Session/classes/class.ilEventRecurrence.php');
1211  $this->rec = new ilEventRecurrence();
1212  }
1213  include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
1214  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
1215  $rec->enableUntilSelection(false);
1216  $rec->setRecurrence($this->rec);
1217  $this->form->addItem($rec);
1218  }
1219 
1220  // section
1222  $section->setTitle($this->lng->txt('event_tutor_data'));
1223  $this->form->addItem($section);
1224 
1225  $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
1226  $tutor_name->setValue($this->object->getName());
1227  $tutor_name->setSize(20);
1228  $tutor_name->setMaxLength(70);
1229  $this->form->addItem($tutor_name);
1230 
1231  $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
1232  $tutor_email->setValue($this->object->getEmail());
1233  $tutor_email->setSize(20);
1234  $tutor_email->setMaxLength(70);
1235  $this->form->addItem($tutor_email);
1236 
1237  $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
1238  $tutor_phone->setValue($this->object->getPhone());
1239  $tutor_phone->setSize(20);
1240  $tutor_phone->setMaxLength(70);
1241  $this->form->addItem($tutor_phone);
1242 
1244  $section->setTitle($this->lng->txt('event_further_informations'));
1245  $this->form->addItem($section);
1246 
1247  $file = new ilFileInputGUI($this->lng->txt('event_file').' 1','file1');
1248  $file->enableFileNameSelection('file_name1');
1249  $this->form->addItem($file);
1250 
1251  $file = new ilFileInputGUI($this->lng->txt('event_file').' 2','file2');
1252  $file->enableFileNameSelection('file_name2');
1253  $this->form->addItem($file);
1254 
1255  $file = new ilFileInputGUI($this->lng->txt('event_file').' 3','file3');
1256  $file->enableFileNameSelection('file_name3');
1257  $this->form->addItem($file);
1258 
1259  $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
1260  $details->setValue($this->object->getDetails());
1261  $details->setCols(50);
1262  $details->setRows(4);
1263  $this->form->addItem($details);
1264 
1265  switch($a_mode)
1266  {
1267  case 'create':
1268  $this->form->setTitle($this->lng->txt('event_table_create'));
1269  $this->form->setTitleIcon(ilUtil::getImagePath('icon_event.gif'));
1270 
1271  $this->form->addCommandButton('save',$this->lng->txt('event_btn_add'));
1272  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
1273 
1274  return true;
1275 
1276  case 'edit':
1277  $this->form->setTitle($this->lng->txt('event_table_update'));
1278  $this->form->setTitleIcon(ilUtil::getImagePath('icon_event.gif'));
1279 
1280  $this->form->addCommandButton('update',$this->lng->txt('save'));
1281  $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
1282 
1283  return true;
1284  }
1285  return true;
1286  }
1287 
1295  protected function load()
1296  {
1297  global $ilUser;
1298 
1299  $this->object->getFirstAppointment()->setStartingTime($this->__toUnix($_POST['start']['date'],$_POST['start']['time']));
1300  $this->object->getFirstAppointment()->setEndingTime($this->__toUnix($_POST['end']['date'],$_POST['end']['time']));
1301  $this->object->getFirstAppointment()->toggleFullTime((bool) $_POST['fulltime']);
1302 
1303  include_once('./Services/Calendar/classes/class.ilDate.php');
1304  if($this->object->getFirstAppointment()->isFullday())
1305  {
1306  $start = new ilDate($_POST['start']['date']['y'].'-'.$_POST['start']['date']['m'].'-'.$_POST['start']['date']['d'],
1307  IL_CAL_DATE);
1308  $this->object->getFirstAppointment()->setStart($start);
1309 
1310  $end = new ilDate($_POST['end']['date']['y'].'-'.$_POST['end']['date']['m'].'-'.$_POST['end']['date']['d'],
1311  IL_CAL_DATE);
1312  $this->object->getFirstAppointment()->setEnd($end);
1313  }
1314  else
1315  {
1316  $start_dt['year'] = (int) $_POST['start']['date']['y'];
1317  $start_dt['mon'] = (int) $_POST['start']['date']['m'];
1318  $start_dt['mday'] = (int) $_POST['start']['date']['d'];
1319  $start_dt['hours'] = (int) $_POST['start']['time']['h'];
1320  $start_dt['minutes'] = (int) $_POST['start']['time']['m'];
1321 
1322  $start = new ilDateTime($start_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1323  $this->object->getFirstAppointment()->setStart($start);
1324 
1325  $end_dt['year'] = (int) $_POST['end']['date']['y'];
1326  $end_dt['mon'] = (int) $_POST['end']['date']['m'];
1327  $end_dt['mday'] = (int) $_POST['end']['date']['d'];
1328  $end_dt['hours'] = (int) $_POST['end']['time']['h'];
1329  $end_dt['minutes'] = (int) $_POST['end']['time']['m'];
1330  $end = new ilDateTime($end_dt,IL_CAL_FKT_GETDATE,$ilUser->getTimeZone());
1331  $this->object->getFirstAppointment()->setEnd($end);
1332  }
1333 
1334  $counter = 1;
1335  $this->files = array();
1336 
1337  foreach($_FILES as $name => $data)
1338  {
1339  if(!strlen($data['tmp_name']))
1340  {
1341  ++$counter;
1342  continue;
1343  }
1344  $filename = strlen($_POST['file_name'.$counter]) ?
1345  $_POST['file_name'.$counter] :
1346  $data['name'];
1347 
1348  $file = new ilSessionFile();
1349  $file->setFileName($filename);
1350  $file->setFileSize($data['size']);
1351  $file->setFileType($data['type']);
1352  $file->setTemporaryName($data['tmp_name']);
1353  $file->setErrorCode($data['error']);
1354  $this->files[] = $file;
1355  ++$counter;
1356  }
1357 
1358  $this->object->setTitle(ilUtil::stripSlashes($_POST['title']));
1359  $this->object->setDescription(ilUtil::stripSlashes($_POST['desc']));
1360  $this->object->setLocation(ilUtil::stripSlashes($_POST['location']));
1361  $this->object->setName(ilUtil::stripSlashes($_POST['tutor_name']));
1362  $this->object->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
1363  $this->object->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
1364  $this->object->setDetails(ilUtil::stripSlashes($_POST['details']));
1365  $this->object->enableRegistration((int) $_POST['registration']);
1366  }
1367 
1374  protected function loadRecurrenceSettings()
1375  {
1376  include_once('./Modules/Session/classes/class.ilSessionRecurrence.php');
1377  $this->rec = new ilSessionRecurrence();
1378 
1379  switch($_POST['frequence'])
1380  {
1381  case IL_CAL_FREQ_DAILY:
1382  $this->rec->setFrequenceType($_POST['frequence']);
1383  $this->rec->setInterval((int) $_POST['count_DAILY']);
1384  break;
1385 
1386  case IL_CAL_FREQ_WEEKLY:
1387  $this->rec->setFrequenceType($_POST['frequence']);
1388  $this->rec->setInterval((int) $_POST['count_WEEKLY']);
1389  if(is_array($_POST['byday_WEEKLY']))
1390  {
1391  $this->rec->setBYDAY(ilUtil::stripSlashes(implode(',',$_POST['byday_WEEKLY'])));
1392  }
1393  break;
1394 
1395  case IL_CAL_FREQ_MONTHLY:
1396  $this->rec->setFrequenceType($_POST['frequence']);
1397  $this->rec->setInterval((int) $_POST['count_MONTHLY']);
1398  switch((int) $_POST['subtype_MONTHLY'])
1399  {
1400  case 0:
1401  // nothing to do;
1402  break;
1403 
1404  case 1:
1405  switch((int) $_POST['monthly_byday_day'])
1406  {
1407  case 8:
1408  // Weekday
1409  $this->rec->setBYSETPOS((int) $_POST['monthly_byday_num']);
1410  $this->rec->setBYDAY('MO,TU,WE,TH,FR');
1411  break;
1412 
1413  case 9:
1414  // Day of month
1415  $this->rec->setBYMONTHDAY((int) $_POST['monthly_byday_num']);
1416  break;
1417 
1418  default:
1419  $this->rec->setBYDAY((int) $_POST['monthly_byday_num'].$_POST['monthly_byday_day']);
1420  break;
1421  }
1422  break;
1423 
1424  case 2:
1425  $this->rec->setBYMONTHDAY((int) $_POST['monthly_bymonthday']);
1426  break;
1427  }
1428  break;
1429 
1430  case IL_CAL_FREQ_YEARLY:
1431  $this->rec->setFrequenceType($_POST['frequence']);
1432  $this->rec->setInterval((int) $_POST['count_YEARLY']);
1433  switch((int) $_POST['subtype_YEARLY'])
1434  {
1435  case 0:
1436  // nothing to do;
1437  break;
1438 
1439  case 1:
1440  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_byday']);
1441  $this->rec->setBYDAY((int) $_POST['yearly_byday_num'].$_POST['yearly_byday']);
1442  break;
1443 
1444  case 2:
1445  $this->rec->setBYMONTH((int) $_POST['yearly_bymonth_by_monthday']);
1446  $this->rec->setBYMONTHDAY((int) $_POST['yearly_bymonthday']);
1447  break;
1448  }
1449  break;
1450  }
1451 
1452  // UNTIL
1453  $this->rec->setFrequenceUntilCount((int) $_POST['count']);
1454  }
1455 
1456 
1464  protected function __toUnix($date,$time)
1465  {
1466  return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
1467  }
1468 
1475  protected function formatPath($a_ref_id)
1476  {
1477  global $tree;
1478 
1479  $path = $this->lng->txt('path') . ': ';
1480  $first = true;
1481  foreach($tree->getPathFull($a_ref_id,$this->course_ref_id) as $node)
1482  {
1483  if($node['ref_id'] != $a_ref_id)
1484  {
1485  if(!$first)
1486  {
1487  $path .= ' -> ';
1488  }
1489  $first = false;
1490  $path .= $node['title'];
1491  }
1492  }
1493  return $path;
1494  }
1495 
1502  public function addLocatorItems()
1503  {
1504  global $ilLocator;
1505 
1506  if (is_object($this->object))
1507  {
1508  $ilLocator->addItem($this->object->getTitle(), $this->ctrl->getLinkTarget($this, "infoScreen"), "", $_GET["ref_id"]);
1509  }
1510  }
1511 
1512 
1519  public function getTabs($tabs_gui)
1520  {
1521  global $ilAccess,$ilTabs,$tree;
1522 
1523  $parent_id = $tree->getParentId($this->object->getRefId());
1524 
1525  $tabs_gui->setBackTarget($this->lng->txt('back_to_crs_content'),'repository.php?ref_id='.$parent_id);
1526  $tabs_gui->addTarget('info_short',
1527  $this->ctrl->getLinkTarget($this,'infoScreen'));
1528 
1529  if($ilAccess->checkAccess('write','',$this->object->getRefId()))
1530  {
1531  $tabs_gui->addTarget('edit_properties',
1532  $this->ctrl->getLinkTarget($this,'edit'));
1533  $tabs_gui->addTarget('crs_materials',
1534  $this->ctrl->getLinkTarget($this,'materials'));
1535  $tabs_gui->addTarget('event_edit_members',
1536  $this->ctrl->getLinkTarget($this,'members'));
1537 
1538  }
1539  // edit permissions
1540  if ($ilAccess->checkAccess('edit_permission', "", $this->object->getRefId()))
1541  {
1542  $tabs_gui->addTarget("perm_settings",
1543  $this->ctrl->getLinkTargetByClass("ilpermissiongui", "perm"), array("perm","info","owner"), 'ilpermissiongui');
1544  }
1545 
1546  }
1547 
1548 }
1549 ?>