00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00034 include_once './Modules/Course/classes/Event/class.ilEventFile.php';
00035 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00036
00037 class ilEventAdministrationGUI
00038 {
00039 var $container_gui;
00040 var $container_obj;
00041 var $course_obj;
00042
00043 var $event_id = null;
00044
00045 var $tpl;
00046 var $ctrl;
00047 var $lng;
00048 var $tabs_gui;
00049
00054 function ilEventAdministrationGUI(&$container_gui_obj,$event_id = 0)
00055 {
00056 global $tpl,$ilCtrl,$lng,$ilObjDataCache,$ilTabs;
00057
00058 $this->tpl =& $tpl;
00059
00060 $this->ctrl =& $ilCtrl;
00061 $this->ctrl->saveParameter($this,'event_id');
00062
00063 $this->lng =& $lng;
00064 $this->lng->loadLanguageModule('crs');
00065 $this->lng->loadLanguageModule('trac');
00066 $this->tabs_gui =& $ilTabs;
00067
00068 $this->event_id = $event_id;
00069
00070 $this->container_gui =& $container_gui_obj;
00071 $this->container_obj =& $this->container_gui->object;
00072
00073
00074 $this->__initCourseObject();
00075 $this->__initEventObject();
00076 }
00077
00078 function &executeCommand()
00079 {
00080 global $ilAccess;
00081
00082 $cmd = $this->ctrl->getCmd();
00083 switch($this->ctrl->getNextClass($this))
00084 {
00085 default:
00086 if(!$cmd)
00087 {
00088 $cmd = 'addEvent';
00089 }
00090 $this->$cmd();
00091 break;
00092 }
00093 }
00094
00095 function cancel()
00096 {
00097 $this->ctrl->returnToParent($this);
00098 }
00099
00100 function register()
00101 {
00102 global $ilUser;
00103
00104 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00105 ilEventParticipants::_register($ilUser->getId(),(int) $_GET['event_id']);
00106
00107 ilUtil::sendInfo($this->lng->txt('event_registered'),true);
00108 $this->ctrl->returnToParent($this);
00109 }
00110
00111 function unregister()
00112 {
00113 global $ilUser;
00114
00115 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00116 ilEventParticipants::_unregister($ilUser->getId(),(int) $_GET['event_id']);
00117
00118 ilUtil::sendInfo($this->lng->txt('event_unregistered'),true);
00119 $this->ctrl->returnToParent($this);
00120 }
00121
00122 function printViewMembers()
00123 {
00124 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00125 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00126 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00127
00128
00129 global $ilErr,$ilAccess;
00130
00131 if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
00132 {
00133 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
00134 }
00135 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
00136 $event_obj = new ilEvent((int) $_GET['event_id']);
00137 $event_app =& $event_obj->getFirstAppointment();
00138 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00139
00140
00141 $this->tpl = new ilTemplate('tpl.main.html',true,true);
00142
00143 $location_stylesheet = ilUtil::getStyleSheetLocation();
00144 $this->tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
00145
00146 $tpl = new ilTemplate('tpl.event_members_print.html',true,true,'Modules/Course');
00147
00148 $tpl->setVariable("EVENT",$this->lng->txt('event'));
00149 $tpl->setVariable("EVENT_NAME",$event_obj->getTitle());
00150 $tpl->setVariable("DATE",ilFormat::formatUnixTime($event_app->getStartingTime(),false)." ".
00151 $event_app->formatTime());
00152 $tpl->setVariable("TXT_NAME",$this->lng->txt('name'));
00153 $tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
00154 $tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
00155 $tpl->setVariable("TXT_PARTICIPATED",$this->lng->txt('event_tbl_participated'));
00156 if($event_obj->enabledRegistration())
00157 {
00158 $tpl->setVariable("TXT_REGISTERED",$this->lng->txt('event_tbl_registered'));
00159 }
00160
00161 $members = $members_obj->getParticipants();
00162 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00163 foreach($members as $user_id)
00164 {
00165
00166 $user_data = $event_part->getUser($user_id);
00167
00168 if($event_obj->enabledRegistration())
00169 {
00170 $tpl->setCurrentBlock("reg_col");
00171 $tpl->setVariable("REGISTERED",$event_part->isRegistered($user_id) ? "X" : "");
00172 $tpl->parseCurrentBlock();
00173 }
00174 $tpl->setVariable("COMMENT",$user_data['comment']);
00175
00176 $tpl->setCurrentBlock("member_row");
00177 $name = ilObjUser::_lookupName($user_id);
00178 $tpl->setVariable("LASTNAME",$name['lastname']);
00179 $tpl->setVariable("FIRSTNAME",$name['firstname']);
00180 $tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
00181 $tpl->setVariable("MARK",$user_data['mark']);
00182 $tpl->setVariable("PARTICIPATED",$event_part->hasParticipated($user_id) ? "X" : "");
00183 $tpl->parseCurrentBlock();
00184 }
00185
00186 $this->tpl->setVariable("CONTENT",$tpl->get());
00187 $this->tpl->setVariable("BODY_ATTRIBUTES",'onload="window.print()"');
00188 $this->tpl->show();
00189 exit;
00190 }
00191
00192
00193 function editMembers()
00194 {
00195 $this->setTabs();
00196 $this->tabs_gui->setTabActive('event_edit_members');
00197
00198 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_members.html','Modules/Course');
00199 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00200
00201
00202 $this->tpl->setCurrentBlock("btn_cell");
00203 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'printViewMembers'));
00204 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('print'));
00205 $this->tpl->setVariable("BTN_TARGET",'target="_blank"');
00206 $this->tpl->parseCurrentBlock();
00207
00208 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00209 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00210 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00211
00212 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
00213 $event_obj = new ilEvent((int) $_GET['event_id']);
00214 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00215
00216 $members = $members_obj->getParticipants();
00217 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00218
00219 $this->tpl->addBlockfile("PARTICIPANTS_TABLE","participants_table", "tpl.table.html");
00220 $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.event_members_row.html','Modules/Course');
00221
00222
00223 $tbl = new ilTableGUI();
00224 $tbl->setTitle($this->lng->txt("event_tbl_participants"),
00225 'icon_usr.gif',
00226 $this->lng->txt('obj_usr'));
00227 $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
00228 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00229 $this->tpl->setVariable("COLUMN_COUNTS",6);
00230 #$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00231 #$this->tpl->setCurrentBlock("tbl_action_btn");
00232 #$this->tpl->setVariable("BTN_NAME", "updateMembers");
00233 #$this->tpl->setVariable("BTN_VALUE", $this->lng->txt("event_save_participants"));
00234 #$this->tpl->parseCurrentBlock();
00235 $this->tpl->setCurrentBlock("plain_button");
00236 $this->tpl->setVariable("PBTN_NAME",'updateMembers');
00237 $this->tpl->setVariable("PBTN_VALUE",$this->lng->txt('save'));
00238 $this->tpl->parseCurrentBlock();
00239
00240 $this->tpl->setCurrentBlock("plain_button");
00241 $this->tpl->setVariable("PBTN_NAME",'cancel');
00242 $this->tpl->setVariable("PBTN_VALUE",$this->lng->txt('cancel'));
00243 $this->tpl->parseCurrentBlock();
00244
00245 if($event_obj->enabledRegistration())
00246 {
00247 $tbl->setHeaderNames(array($this->lng->txt('name'),
00248 $this->lng->txt('trac_mark'),
00249 $this->lng->txt('trac_comment'),
00250 $this->lng->txt('event_tbl_registered'),
00251 $this->lng->txt('event_tbl_participated')));
00252 $tbl->setHeaderVars(array("name",
00253 "mark",
00254 "comment",
00255 "registered",
00256 "participated"),
00257 $this->ctrl->getParameterArray($this,'editMembers'));
00258 $tbl->setColumnWidth(array('','','','',''));
00259 }
00260 else
00261 {
00262 $tbl->setHeaderNames(array($this->lng->txt('name'),
00263 $this->lng->txt('trac_mark'),
00264 $this->lng->txt('trac_comment'),
00265 $this->lng->txt('event_tbl_participated')));
00266
00267 $tbl->setHeaderVars(array("name",
00268 "mark",
00269 "comment",
00270 "participated"),
00271 $this->ctrl->getParameterArray($this,'editMembers'));
00272
00273 $tbl->setColumnWidth(array('','','',''));
00274 }
00275
00276 $tbl->setOrderColumn($_GET["sort_by"]);
00277 $tbl->setOrderDirection($_GET["sort_order"]);
00278 $tbl->setOffset($_GET["offset"]);
00279 $tbl->setLimit($_GET["limit"]);
00280 $tbl->setMaxCount(count($members));
00281 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00282
00283 $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
00284 $tbl->disable('sort');
00285 $tbl->enable('action');
00286 $tbl->render();
00287
00288 $counter = 0;
00289 foreach($sliced_users as $user_id)
00290 {
00291 $user_data = $event_part->getUser($user_id);
00292
00293 if($event_obj->enabledRegistration())
00294 {
00295 $this->tpl->setCurrentBlock("registered_col");
00296 $this->tpl->setVariable("IMAGE_REGISTERED",$event_part->isRegistered($user_id) ?
00297 ilUtil::getImagePath('icon_ok.gif') :
00298 ilUtil::getImagePath('icon_not_ok.gif'));
00299 $this->tpl->setVariable("REGISTERED",$event_part->isRegistered($user_id) ?
00300 $this->lng->txt('event_registered') :
00301 $this->lng->txt('event_not_registered'));
00302 $this->tpl->parseCurrentBlock();
00303 }
00304
00305 $this->tpl->setCurrentBlock("tbl_content");
00306 $name = ilObjUser::_lookupName($user_id);
00307 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
00308 $this->tpl->setVariable("LASTNAME",$name['lastname']);
00309 $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
00310 $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
00311 $this->tpl->setVariable("MARK",$user_data['mark']);
00312 $this->tpl->setVariable("MARK_NAME",'mark['.$user_id.']');
00313 $this->tpl->setVariable("COMMENT_NAME",'comment['.$user_id.']');
00314 $this->tpl->setVariable("COMMENT",$user_data['comment']);
00315
00316 $this->tpl->setVariable("USER_ID",$user_id);
00317 $this->tpl->setVariable("CHECKED",$event_part->hasParticipated($user_id) ? 'checked="checked"' : '');
00318 $this->tpl->setVariable("IMAGE_PART",$event_part->hasParticipated($user_id) ?
00319 ilUtil::getImagePath('icon_ok.gif') :
00320 ilUtil::getImagePath('icon_not_ok.gif'));
00321 $this->tpl->setVariable("PART",$event_part->hasParticipated($user_id) ?
00322 $this->lng->txt('event_participated') :
00323 $this->lng->txt('event_not_participated'));
00324 $this->ctrl->setParameter($this,'user_id',$user_id);
00325 $this->tpl->setVariable("EDIT_LINK",$this->ctrl->getLinkTarget($this,'editUser'));
00326 $this->tpl->setVariable("TXT_EDIT",$this->lng->txt('edit'));
00327 $this->tpl->parseCurrentBlock();
00328 }
00329 $this->tpl->setCurrentBlock("select_row");
00330 $this->tpl->setVariable("SELECT_SPAN",$event_obj->enabledRegistration() ? 4 : 3);
00331 $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
00332 $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
00333 $this->tpl->parseCurrentBlock();
00334
00335 }
00336
00337 function updateMembers()
00338 {
00339 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
00340 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00341 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00342
00343 $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
00344
00345 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
00346
00347 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00348
00349 $members = $members_obj->getParticipants();
00350 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00351 $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
00352
00353 foreach($sliced_users as $user)
00354 {
00355 $part = new ilEventParticipants((int) $_GET['event_id']);
00356 $part->setUserId($user);
00357 $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
00358 $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
00359 $part->setParticipated(in_array($user,$_POST['participants']));
00360 $part->setRegistered(ilEventParticipants::_isRegistered($user,(int) $_GET['event_id']));
00361 $part->updateUser();
00362 }
00363 ilUtil::sendInfo($this->lng->txt('settings_saved'));
00364 $this->editMembers();
00365 }
00366
00367 function editUser()
00368 {
00369 global $ilObjDataCache;
00370
00371 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
00372 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00373
00374 $event_obj = new ilEvent((int) $_GET['event_id']);
00375 $part_obj = new ilEventParticipants((int) $_GET['event_id']);
00376
00377
00378 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00379
00380 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.event_edit_user.html','Modules/Course');
00381
00382 $this->ctrl->setParameter($this,'user_id',(int) $_GET['user_id']);
00383 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00384 $this->tpl->setVariable("USR_IMAGE",ilUtil::getImagePath('icon_usr.gif'));
00385 $this->tpl->setVariable("ALT_USER",$this->lng->txt('obj_usr'));
00386 $this->tpl->setVariable("EVENT_TITLE",$event_obj->getTitle());
00387 $this->tpl->setVariable("FULLNAME",$ilObjDataCache->lookupTitle((int) $_GET['user_id']));
00388 $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin((int) $_GET['user_id']));
00389
00390 $this->tpl->setVariable("TXT_PARTICIPANCE",$this->lng->txt('event_tbl_participated'));
00391 $this->tpl->setVariable("TXT_REGISTERED",$this->lng->txt('event_tbl_registered'));
00392 $this->tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
00393 $this->tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
00394 $this->tpl->setVariable("TXT_BTN_UPDATE",$this->lng->txt('save'));
00395 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00396
00397 $user_data = $part_obj->getUser((int) $_GET['user_id']);
00398
00399 $this->tpl->setVariable("MARK",$user_data['mark']);
00400 $this->tpl->setVariable("COMMENT",$user_data['comment']);
00401 $this->tpl->setVariable("PART_CHECKED",$user_data['participated'] ? 'checked="checked"' : '');
00402 $this->tpl->setVariable("REG_CHECKED",$user_data['registered'] ? 'checked="checked"' : '');
00403
00404 }
00405
00406 function updateUser()
00407 {
00408 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
00409 $part_obj = new ilEventParticipants((int) $_GET['event_id']);
00410
00411 $part_obj->setUserId((int) $_GET['user_id']);
00412 $part_obj->setMark(ilUtil::stripSlashes($_POST['mark']));
00413 $part_obj->setComment(ilUtil::stripSlashes($_POST['comment']));
00414 $part_obj->setRegistered($_POST['registration']);
00415 $part_obj->setParticipated($_POST['participance']);
00416 $part_obj->updateUser((int) $_GET['user_id']);
00417
00418 ilUtil::sendInfo($this->lng->txt('settings_saved'));
00419 $this->editMembers();
00420 }
00421
00422
00423 function materials()
00424 {
00425 global $tree, $objDefinition;
00426
00427 $this->setTabs();
00428 $this->tabs_gui->setTabActive('crs_materials');
00429
00430 include_once 'Modules/Course/classes/Event/class.ilEventItems.php';
00431 $this->event_items = new ilEventItems($this->event_id);
00432 $items = $this->event_items->getItems();
00433
00434 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_materials.html','Modules/Course');
00435 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00436
00437 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00438 $this->tpl->setVariable("COLL_TITLE_IMG",ilUtil::getImagePath('icon_event.gif'));
00439 $this->tpl->setVariable("COLL_TITLE_IMG_ALT",$this->lng->txt('events'));
00440 $this->tpl->setVariable("TABLE_TITLE",$this->lng->txt('event_assign_materials_table'));
00441 $this->tpl->setVariable("TABLE_INFO",$this->lng->txt('event_assign_materials_info'));
00442
00443 $nodes = $tree->getSubTree($tree->getNodeData($this->course_obj->getRefId()));
00444 $counter = 1;
00445 foreach($nodes as $node)
00446 {
00447
00448 if ($objDefinition->isSideBlock($node['type']))
00449 {
00450 continue;
00451 }
00452
00453 if($node['type'] == 'rolf')
00454 {
00455 continue;
00456 }
00457 if($counter++ == 1)
00458 {
00459 continue;
00460 }
00461 $this->tpl->setCurrentBlock("material_row");
00462 $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor($counter,'tblrow1','tblrow2'));
00463 $this->tpl->setVariable("CHECK_COLL",ilUtil::formCheckbox(in_array($node['ref_id'],$items) ? 1 : 0,
00464 'items[]',$node['ref_id']));
00465 $this->tpl->setVariable("COLL_TITLE",$node['title']);
00466
00467 if(strlen($node['description']))
00468 {
00469 $this->tpl->setVariable("COLL_DESC",$node['description']);
00470 }
00471 $this->tpl->setVariable("ASSIGNED_IMG_OK",in_array($node['ref_id'],$items) ?
00472 ilUtil::getImagePath('icon_ok.gif') :
00473 ilUtil::getImagePath('icon_not_ok.gif'));
00474 $this->tpl->setVariable("ASSIGNED_STATUS",$this->lng->txt('event_material_assigned'));
00475 $this->tpl->setVariable("COLL_PATH",$this->__formatPath($node['ref_id']));
00476 $this->tpl->parseCurrentBlock();
00477 }
00478
00479 $this->tpl->setVariable("SELECT_ROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00480 $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
00481 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
00482 $this->tpl->setVariable("BTN_SAVE",$this->lng->txt('save'));
00483
00484 }
00485
00486 function saveMaterials()
00487 {
00488 include_once 'Modules/Course/classes/Event/class.ilEventItems.php';
00489
00490 $this->event_items = new ilEventItems($this->event_id);
00491 $this->event_items->setItems(is_array($_POST['items']) ? $_POST['items'] : array());
00492 $this->event_items->update();
00493
00494 ilUtil::sendInfo($this->lng->txt('settings_saved'),true);
00495 $this->ctrl->returnToParent($this);
00496 }
00497
00498
00499
00500 function info()
00501 {
00502 $this->setTabs();
00503 $this->tabs_gui->setTabActive('info_short');
00504 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_info.html','Modules/Course');
00505
00506 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00507
00508 include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
00509 $info = new ilInfoScreenGUI($this);
00510
00511 $appointment_obj =& $this->event_obj->getFirstAppointment();
00512
00513
00514
00515 $info->addSection($this->lng->txt("event_general_properties"));
00516 $info->addProperty($this->lng->txt('event_title'),
00517 $this->event_obj->getTitle());
00518 if(strlen($desc = $this->event_obj->getDescription()))
00519 {
00520 $info->addProperty($this->lng->txt('event_desc'),
00521 nl2br($this->event_obj->getDescription()));
00522 }
00523 if(strlen($location = $this->event_obj->getLocation()))
00524 {
00525 $info->addProperty($this->lng->txt('event_location'),
00526 nl2br($this->event_obj->getLocation()));
00527 }
00528 $info->addProperty($this->lng->txt('event_date'),
00529 $appointment_obj->appointmentToString());
00530
00531 if($this->event_obj->hasTutorSettings())
00532 {
00533 $info->addSection($this->lng->txt('event_tutor_data'));
00534 if(strlen($fullname = $this->event_obj->getFullname()))
00535 {
00536 $info->addProperty($this->lng->txt('event_lecturer'),
00537 $fullname);
00538 }
00539 if(strlen($email = $this->event_obj->getEmail()))
00540 {
00541 $info->addProperty($this->lng->txt('tutor_email'),
00542 $email);
00543 }
00544 if(strlen($phone = $this->event_obj->getPhone()))
00545 {
00546 $info->addProperty($this->lng->txt('tutor_phone'),
00547 $phone);
00548 }
00549 }
00550
00551 $details = $this->event_obj->getDetails();
00552 $files = $this->event_obj->getFiles();
00553
00554 if(strlen($details) or is_array($files))
00555 {
00556 $info->addSection($this->lng->txt('event_further_informations'));
00557
00558 if(strlen($details))
00559 {
00560 $info->addProperty($this->lng->txt('event_details_workflow'),
00561 nl2br($details));
00562 }
00563
00564 if(count($files))
00565 {
00566 $tpl = new ilTemplate('tpl.event_info_file.html',true,true,'Modules/Course');
00567
00568 foreach($files as $file)
00569 {
00570 $tpl->setCurrentBlock("files");
00571 $this->ctrl->setParameter($this,'file_id',$file->getFileId());
00572 $tpl->setVariable("DOWN_LINK",$this->ctrl->getLinkTarget($this,'sendfile'));
00573 $tpl->setVariable("DOWN_NAME",$file->getFileName());
00574 $tpl->setVariable("DOWN_INFO_TXT",$this->lng->txt('event_file_size_info'));
00575 $tpl->setVariable("DOWN_SIZE",$file->getFileSize());
00576 $tpl->setVariable("TXT_BYTES",$this->lng->txt('bytes'));
00577 $tpl->parseCurrentBlock();
00578 }
00579 $info->addProperty($this->lng->txt('event_file_download'),
00580 $tpl->get());
00581 }
00582
00583 }
00584
00585 $this->tpl->setVariable("INFO_TABLE",$info->getHTML());
00586 }
00587
00588 function sendFile()
00589 {
00590 $file = new ilEventFile((int) $_GET['file_id']);
00591
00592 ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
00593 return true;
00594 }
00595
00603 public function cloneEvent()
00604 {
00605 if(!$_POST['clone_source'])
00606 {
00607 ilUtil::sendInfo($this->lng->txt('event_choose_one'));
00608 $this->addEvent();
00609 return false;
00610 }
00611 $event_obj = new ilEvent($_POST['clone_source']);
00612
00613 $new_event = new ilEvent();
00614 $new_event->setObjId($this->container_obj->getId());
00615 $new_event->setTitle($event_obj->getTitle());
00616 $new_event->setDescription($event_obj->getDescription());
00617 $new_event->setLocation($event_obj->getLocation());
00618 $new_event->setName($event_obj->getName());
00619 $new_event->setPhone($event_obj->getPhone());
00620 $new_event->setEmail($event_obj->getEmail());
00621 $new_event->setDetails($event_obj->getDetails());
00622 $new_event->enableRegistration($event_obj->enabledRegistration());
00623 $new_event->enableParticipation($event_obj->enabledParticipation());
00624 $new_event_id = $new_event->create();
00625
00626
00627 foreach($event_obj->getAppointments() as $app_obj)
00628 {
00629 $new_app = new ilEventAppointment();
00630 $new_app->setEventId($new_event->getEventId());
00631 $new_app->setStartingTime($app_obj->getStartingTime());
00632 $new_app->setEndingTime($app_obj->getEndingTime());
00633 $new_app->toggleFullTime($app_obj->enabledFullTime());
00634 $new_app->create();
00635 }
00636
00637 foreach($event_obj->getFiles() as $file_obj)
00638 {
00639 $file_obj->cloneFiles($new_event->getEventId());
00640 }
00641 ilUtil::sendInfo($this->lng->txt('event_cloned'),true);
00642 $this->ctrl->setParameter($this,'event_id',$new_event_id);
00643 $this->ctrl->redirect($this,'edit');
00644 }
00645
00651 protected function initForm($a_mode)
00652 {
00653 if(is_object($this->form))
00654 {
00655 return true;
00656 }
00657
00658 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
00659
00660 $this->form = new ilPropertyFormGUI();
00661 $this->form->setFormAction($this->ctrl->getFormAction($this));
00662
00663
00664 $title = new ilTextInputGUI($this->lng->txt('event_title'),'title');
00665 $title->setValue($this->event_obj->getTitle());
00666 $title->setSize(20);
00667 $title->setMaxLength(70);
00668 $title->setRequired(TRUE);
00669 $this->form->addItem($title);
00670
00671
00672 $desc = new ilTextAreaInputGUI($this->lng->txt('event_desc'),'desc');
00673 $desc->setValue($this->event_obj->getDescription());
00674 $desc->setRows(4);
00675 $desc->setCols(50);
00676 $this->form->addItem($desc);
00677
00678
00679 $desc = new ilTextAreaInputGUI($this->lng->txt('event_location'),'location');
00680 $desc->setValue($this->event_obj->getLocation());
00681 $desc->setRows(4);
00682 $desc->setCols(50);
00683 $this->form->addItem($desc);
00684
00685
00686 $reg = new ilCheckboxInputGUI($this->lng->txt('event_registration'),'registration');
00687 $reg->setChecked($this->event_obj->enabledRegistration() ? true : false);
00688 $reg->setOptionTitle($this->lng->txt('event_registration_info'));
00689 $this->form->addItem($reg);
00690
00691
00692 $section = new ilFormSectionHeaderGUI();
00693 $section->setTitle($this->lng->txt('event_date_time'));
00694 $this->form->addItem($section);
00695
00696
00697 $start = new ilDateTimeInputGUI($this->lng->txt('event_start_date'),'start');
00698 $start->setMinuteStepSize(5);
00699 $start->setUnixTime($this->appointment_obj->getStartingTime());
00700 $start->setShowTime(true);
00701 $this->form->addItem($start);
00702
00703
00704 $end = new ilDateTimeInputGUI($this->lng->txt('event_end_date'),'end');
00705 $end->setMinuteStepSize(5);
00706 $end->setUnixTime($this->appointment_obj->getEndingTime());
00707 $end->setShowTime(true);
00708 $this->form->addItem($end);
00709
00710 $full = new ilCheckboxInputGUI($this->lng->txt('event_fullday'),'fulltime');
00711 $full->setChecked($this->appointment_obj->enabledFulltime() ? true : false);
00712 $full->setOptionTitle($this->lng->txt('event_fulltime_info'));
00713 $this->form->addItem($full);
00714
00715
00716 $section = new ilFormSectionHeaderGUI();
00717 $section->setTitle($this->lng->txt('event_tutor_data'));
00718 $this->form->addItem($section);
00719
00720 $tutor_name = new ilTextInputGUI($this->lng->txt('tutor_name'),'tutor_name');
00721 $tutor_name->setValue($this->event_obj->getName());
00722 $tutor_name->setSize(20);
00723 $tutor_name->setMaxLength(70);
00724 $this->form->addItem($tutor_name);
00725
00726 $tutor_email = new ilTextInputGUI($this->lng->txt('tutor_email'),'tutor_email');
00727 $tutor_email->setValue($this->event_obj->getEmail());
00728 $tutor_email->setSize(20);
00729 $tutor_email->setMaxLength(70);
00730 $this->form->addItem($tutor_email);
00731
00732 $tutor_phone = new ilTextInputGUI($this->lng->txt('tutor_phone'),'tutor_phone');
00733 $tutor_phone->setValue($this->event_obj->getPhone());
00734 $tutor_phone->setSize(20);
00735 $tutor_phone->setMaxLength(70);
00736 $this->form->addItem($tutor_phone);
00737
00738 $section = new ilFormSectionHeaderGUI();
00739 $section->setTitle($this->lng->txt('event_further_informations'));
00740 $this->form->addItem($section);
00741
00742 $file = new ilFileInputGUI($this->lng->txt('event_file').' 1','file1');
00743 $file->enableFileNameSelection('file_name1');
00744 $this->form->addItem($file);
00745
00746 $file = new ilFileInputGUI($this->lng->txt('event_file').' 2','file2');
00747 $file->enableFileNameSelection('file_name2');
00748 $this->form->addItem($file);
00749
00750 $file = new ilFileInputGUI($this->lng->txt('event_file').' 3','file3');
00751 $file->enableFileNameSelection('file_name3');
00752 $this->form->addItem($file);
00753
00754 $details = new ilTextAreaInputGUI($this->lng->txt('event_details_workflow'),'details');
00755 $details->setValue($this->event_obj->getDetails());
00756 $details->setCols(50);
00757 $details->setRows(4);
00758 $this->form->addItem($details);
00759
00760 switch($a_mode)
00761 {
00762 case 'create':
00763 $this->form->setTitle($this->lng->txt('event_table_create'));
00764 $this->form->setTitleIcon(ilUtil::getImagePath('icon_event.gif'));
00765
00766 $this->form->addCommandButton('createEvent',$this->lng->txt('event_btn_add'));
00767 $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
00768
00769 return true;
00770
00771 case 'edit':
00772 $this->form->setTitle($this->lng->txt('event_table_update'));
00773 $this->form->setTitleIcon(ilUtil::getImagePath('icon_event.gif'));
00774
00775 $this->form->addCommandButton('update',$this->lng->txt('save'));
00776 $this->form->addCommandButton('cancel',$this->lng->txt('cancel'));
00777
00778 return true;
00779 }
00780
00781
00782 }
00783
00784
00785 function addEvent()
00786 {
00787 $this->tabs_gui->clearSubTabs();
00788 $this->tabs_gui->clearTargets();
00789
00790
00791 $this->initForm('create');
00792 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_create.html','Modules/Course');
00793 $this->tpl->setVariable('EVENT_ADD_TABLE',$this->form->getHTML());
00794
00795 if(!count($events = ilEvent::_getEvents($this->container_obj->getId())))
00796 {
00797 return true;
00798 }
00799 $this->tpl->setCurrentBlock('clone_event');
00800 $this->tpl->setVariable('FORMACTION',$this->ctrl->getFormAction($this));
00801 $this->tpl->setVariable("CLONE_TITLE_IMG",ilUtil::getImagePath('icon_event.gif'));
00802 $this->tpl->setVariable("CLONE_TITLE_IMG_ALT",$this->lng->txt('events'));
00803 $this->tpl->setVariable('CLONE_TITLE',$this->lng->txt('events_clone_title'));
00804 $this->tpl->setVariable('CLONE_EVENT',$this->lng->txt('event'));
00805 $this->tpl->setVariable('TXT_BTN_CLONE_EVENT',$this->lng->txt('event_clone_btn'));
00806 $this->tpl->setVariable('TXT_CLONE_CANCEL',$this->lng->txt('cancel'));
00807
00808 $options[0] = $this->lng->txt('event_select_one');
00809 foreach($events as $event_obj)
00810 {
00811 $options[$event_obj->getEventId()] = $event_obj->getTitle();
00812 }
00813 $this->tpl->setVariable('SEL_EVENT',ilUtil::formSelect(0,'clone_source',$options,false,true));
00814 }
00815
00816 function edit()
00817 {
00818 $this->setTabs();
00819 $this->tabs_gui->setTabActive('edit_properties');
00820
00821 $this->initForm('edit');
00822 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_edit.html','Modules/Course');
00823 $this->tpl->setVariable('EVENT_EDIT_TABLE',$this->form->getHTML());
00824
00825 if(!count($files = ilEventFile::_readFilesByEvent($this->event_obj->getEventId())))
00826 {
00827 return true;
00828 }
00829 $rows = array();
00830 foreach($files as $file)
00831 {
00832 $table_data['id'] = $file->getFileId();
00833 $table_data['filename'] = $file->getFileName();
00834 $table_data['filetype'] = $file->getFileType();
00835 $table_data['filesize'] = $file->getFileSize();
00836
00837 $rows[] = $table_data;
00838 }
00839
00840 include_once("./Modules/Course/classes/Event/class.ilEventFileTableGUI.php");
00841 $table_gui = new ilEventFileTableGUI($this, "edit");
00842 $table_gui->setTitle($this->lng->txt("event_files"));
00843 $table_gui->setData($rows);
00844 $table_gui->addCommandButton("cancel", $this->lng->txt("cancel"));
00845 $table_gui->addMultiCommand("confirmDeleteFiles", $this->lng->txt("delete"));
00846 $table_gui->setSelectAllCheckbox("file_id");
00847 $this->tpl->setVariable('EVENT_FILE_TABLE',$table_gui->getHTML());
00848
00849 return true;
00850 }
00851
00858 public function confirmDeleteFiles()
00859 {
00860 $this->setTabs();
00861 $this->tabs_gui->setTabActive('edit_properties');
00862
00863 if(!count($_POST['file_id']))
00864 {
00865 ilUtil::sendInfo($this->lng->txt('select_one'));
00866 $this->edit();
00867 return false;
00868 }
00869
00870 include_once("Services/Utilities/classes/class.ilConfirmationGUI.php");
00871 $c_gui = new ilConfirmationGUI();
00872
00873
00874 $c_gui->setFormAction($this->ctrl->getFormAction($this, "deleteFiles"));
00875 $c_gui->setHeaderText($this->lng->txt("info_delete_sure"));
00876 $c_gui->setCancel($this->lng->txt("cancel"), "edit");
00877 $c_gui->setConfirm($this->lng->txt("confirm"), "deleteFiles");
00878
00879
00880 foreach($_POST["file_id"] as $file_id)
00881 {
00882 $file = new ilEventFile($file_id);
00883 if($file->getEventId() != $this->event_obj->getEventId())
00884 {
00885 ilUtil::sendInfo($this->lng->txt('select_one'));
00886 $this->edit();
00887 return false;
00888 }
00889 $c_gui->addItem("file_id[]", $file_id, $file->getFileName());
00890 }
00891
00892 $this->tpl->setContent($c_gui->getHTML());
00893 }
00894
00902 public function deleteFiles()
00903 {
00904 if(!count($_POST['file_id']))
00905 {
00906 ilUtil::sendInfo($this->lng->txt('select_one'));
00907 $this->edit();
00908 return false;
00909 }
00910 foreach($_POST['file_id'] as $id)
00911 {
00912 $file = new ilEventFile($id);
00913 $file->delete();
00914 }
00915 $this->edit();
00916 return true;
00917 }
00918
00919 function update()
00920 {
00921 global $ilErr;
00922
00923 $this->__load();
00924 $this->initForm('edit');
00925
00926 $ilErr->setMessage('');
00927 if(!$this->form->checkInput())
00928 {
00929 $ilErr->setMessage($this->lng->txt('err_check_input'));
00930 }
00931 $this->event_obj->validate();
00932 $this->appointment_obj->validate();
00933
00934 if(strlen($ilErr->getMessage()))
00935 {
00936 ilUtil::sendInfo($ilErr->getMessage());
00937 $this->edit();
00938 return false;
00939 }
00940
00941 $this->event_obj->update();
00942
00943
00944 $this->appointment_obj->update();
00945
00946 foreach($this->files as $file_obj)
00947 {
00948 $file_obj->setEventId($this->event_obj->getEventId());
00949 $file_obj->create();
00950 }
00951
00952 ilUtil::sendInfo($this->lng->txt('event_updated'));
00953 $this->edit();
00954 return true;
00955 }
00956
00957 function createEvent()
00958 {
00959 global $ilErr;
00960
00961 $this->__load();
00962 $this->initForm('create');
00963
00964 $ilErr->setMessage('');
00965 if(!$this->form->checkInput())
00966 {
00967 $ilErr->setMessage($this->lng->txt('err_check_input'));
00968 }
00969
00970 $this->event_obj->validate();
00971 $this->appointment_obj->validate();
00972
00973 if(strlen($ilErr->getMessage()))
00974 {
00975 ilUtil::sendInfo($ilErr->getMessage());
00976 $this->addEvent();
00977 return false;
00978 }
00979
00980 $event_id = $this->event_obj->create();
00981
00982
00983 $this->appointment_obj->setEventId($event_id);
00984 $this->appointment_obj->create();
00985
00986 foreach($this->files as $file_obj)
00987 {
00988 $file_obj->setEventId($this->event_obj->getEventId());
00989 $file_obj->create();
00990 }
00991
00992 ilUtil::sendInfo($this->lng->txt('event_add_new_event'),true);
00993 $this->ctrl->returnToParent($this);
00994 return true;
00995 }
00996
00997 function confirmDelete()
00998 {
00999 include_once './Modules/Course/classes/Event/class.ilEvent.php';
01000
01001 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_delete.html','Modules/Course');
01002 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01003 $this->tpl->setVariable("TXT_EVENT_NAME",$this->lng->txt('title'));
01004 $this->tpl->setVariable("DELETE",$this->lng->txt('delete'));
01005 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
01006
01007
01008 $events = is_array($_POST['event_ids']) ? $_POST['event_ids'] : array($this->event_id);
01009 $_SESSION['event_del'] = $events;
01010 $counter = 0;
01011 foreach($events as $event)
01012 {
01013 $event_obj = new ilEvent($event);
01014 if(strlen($desc = $event_obj->getDescription()))
01015 {
01016 $this->tpl->setCurrentBlock("desc");
01017 $this->tpl->setVariable("DESCRIPTION",$desc);
01018 $this->tpl->parseCurrentBlock();
01019 }
01020 $this->tpl->setCurrentBlock("events");
01021 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
01022 $this->tpl->setVariable("EVENT_NAME",$event_obj->getTitle());
01023 $this->tpl->parseCurrentBlock();
01024 }
01025 ilUtil::sendInfo($this->lng->txt('event_delete_sure'));
01026 return true;
01027 }
01028
01029 function delete()
01030 {
01031 include_once './Modules/Course/classes/Event/class.ilEvent.php';
01032
01033 if(!is_array($_SESSION['event_del']))
01034 {
01035 ilUtil::sendInfo($this->lng->txt('event_none_selected'));
01036 $this->ctrl->returnToParent($this);
01037 return false;
01038 }
01039 foreach($_SESSION['event_del'] as $event_id)
01040 {
01041 ilEvent::_delete($event_id);
01042 }
01043
01044 ilUtil::sendInfo($this->lng->txt('events_deleted'),true);
01045 $this->ctrl->returnToParent($this);
01046
01047 return true;
01048 }
01049
01057 public function exportCSV()
01058 {
01059 include_once('Services/Utilities/classes/class.ilCSVWriter.php');
01060 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
01061 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
01062 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
01063
01064 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
01065 $members = $members_obj->getParticipants();
01066 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
01067
01068 $events = ilEvent::_getEvents($this->course_obj->getId());
01069
01070 $this->csv = new ilCSVWriter();
01071 $this->csv->addColumn($this->lng->txt("lastname"));
01072 $this->csv->addColumn($this->lng->txt("firstname"));
01073 $this->csv->addColumn($this->lng->txt("login"));
01074
01075 foreach($events as $event_obj)
01076 {
01077 $this->csv->addColumn($event_obj->getTitle().' ('.$event_obj->getFirstAppointment()->appointmentToString().')');
01078 }
01079
01080 $this->csv->addRow();
01081
01082 foreach($members as $user_id)
01083 {
01084 $name = ilObjUser::_lookupName($user_id);
01085
01086 $this->csv->addColumn($name['lastname']);
01087 $this->csv->addColumn($name['firstname']);
01088 $this->csv->addColumn(ilObjUser::_lookupLogin($user_id));
01089
01090 foreach($events as $event_obj)
01091 {
01092 $event_part = new ilEventParticipants((int) $event_obj->getEventId());
01093
01094 $this->csv->addColumn($event_part->hasParticipated($user_id) ?
01095 $this->lng->txt('event_participated') :
01096 $this->lng->txt('event_not_participated'));
01097 }
01098
01099 $this->csv->addRow();
01100 }
01101
01102 ilUtil::deliverData($this->csv->getCSVString(), date("Y_m_d")."_course_events.csv", "text/csv");
01103 }
01104
01112 public function eventsList()
01113 {
01114 global $ilErr,$ilAccess, $ilUser;
01115
01116 if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
01117 {
01118 $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
01119 }
01120
01121 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_list.html','Modules/Course');
01122 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
01123
01124
01125 $this->tpl->setCurrentBlock("btn_cell");
01126 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'exportCSV'));
01127 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('event_csv_export'));
01128 $this->tpl->parseCurrentBlock();
01129
01130 include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
01131 include_once 'Modules/Course/classes/Event/class.ilEvent.php';
01132 include_once 'Modules/Course/classes/Event/class.ilEventParticipants.php';
01133
01134 $this->tpl->addBlockfile("EVENTS_TABLE","events_table", "tpl.table.html");
01135 $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.event_list_row.html','Modules/Course');
01136
01137 $members_obj = ilCourseParticipants::_getInstanceByObjId($this->course_obj->getId());
01138 $members = $members_obj->getParticipants();
01139 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
01140
01141
01142 $tbl = new ilTableGUI();
01143 $tbl->setTitle($this->lng->txt("event_overview"),
01144 'icon_usr.gif',
01145 $this->lng->txt('obj_usr'));
01146 $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
01147
01148 $events = ilEvent::_getEvents($this->course_obj->getId());
01149
01150 $headerNames = array();
01151 $headerVars = array();
01152 $colWidth = array();
01153
01154 $headerNames[] = $this->lng->txt('name');
01155 $headerVars[] = "name";
01156 $colWidth[] = '20%';
01157
01158 for ($i = 1; $i <= count($events); $i++)
01159 {
01160 $headerNames[] = $i;
01161 $headerVars[] = "event_".$i;
01162 $colWidth[] = 80/count($events)."%";
01163 }
01164
01165 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01166 $tbl->setHeaderNames($headerNames);
01167 $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this,'eventsList'));
01168 $tbl->setColumnWidth($colWidth);
01169
01170 $tbl->setOrderColumn($_GET["sort_by"]);
01171 $tbl->setOrderDirection($_GET["sort_order"]);
01172 $tbl->setOffset($_GET["offset"]);
01173 $tbl->setLimit($ilUser->getPref("hits_per_page"));
01174 $tbl->setMaxCount(count($members));
01175 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
01176
01177 $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
01178 $tbl->disable('sort');
01179 $tbl->render();
01180
01181 $counter = 0;
01182 foreach($sliced_users as $user_id)
01183 {
01184 foreach($events as $event_obj)
01185 {
01186 $this->tpl->setCurrentBlock("eventcols");
01187
01188 $event_part = new ilEventParticipants((int) $event_obj->getEventId());
01189
01190 if ($event_obj->enabledParticipation())
01191 {
01192 $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ?
01193 ilUtil::getImagePath('icon_ok.gif') :
01194 ilUtil::getImagePath('icon_not_ok.gif'));
01195
01196 $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ?
01197 $this->lng->txt('event_participated') :
01198 $this->lng->txt('event_not_participated'));
01199 }
01200
01201 $this->tpl->parseCurrentBlock();
01202 }
01203
01204 $this->tpl->setCurrentBlock("tbl_content");
01205 $name = ilObjUser::_lookupName($user_id);
01206 $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
01207 $this->tpl->setVariable("LASTNAME",$name['lastname']);
01208 $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
01209 $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
01210 $this->tpl->parseCurrentBlock();
01211 }
01212
01213 $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend"));
01214 $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit"));
01215 $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event"));
01216 $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location"));
01217 $this->tpl->setVariable("HEAD_TXT_DATE_TIME",$this->lng->txt("event_date_time"));
01218 $i = 1;
01219 foreach($events as $event_obj)
01220 {
01221 $this->tpl->setCurrentBlock("legend_loop");
01222 $this->tpl->setVariable("LEGEND_CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
01223 $this->tpl->setVariable("LEGEND_DIGIT", $i++);
01224 $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle());
01225 $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription());
01226 $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation());
01227 $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString());
01228 $this->tpl->parseCurrentBlock();
01229 }
01230 }
01231
01232
01233 function __load()
01234 {
01235 $this->appointment_obj->setStartingTime($this->__toUnix($_POST['start']['date'],$_POST['start']['time']));
01236 $this->appointment_obj->setEndingTime($this->__toUnix($_POST['end']['date'],$_POST['end']['time']));
01237 $this->appointment_obj->toggleFullTime((bool) $_POST['fulltime']);
01238
01239 $counter = 1;
01240 $this->files = array();
01241 foreach($_FILES as $name => $data)
01242 {
01243 if(!strlen($data['tmp_name']))
01244 {
01245 ++$counter;
01246 continue;
01247 }
01248 $filename = strlen($_POST['file_name'.$counter]) ?
01249 $_POST['file_name'.$counter] :
01250 $data['name'];
01251
01252 $file = new ilEventFile();
01253 $file->setFileName($filename);
01254 $file->setFileSize($data['size']);
01255 $file->setFileType($data['type']);
01256 $file->setTemporaryName($data['tmp_name']);
01257 $file->setErrorCode($data['error']);
01258 $this->files[] = $file;
01259 ++$counter;
01260 }
01261
01262
01263 $this->event_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
01264 $this->event_obj->setDescription(ilUtil::stripSlashes($_POST['desc']));
01265 $this->event_obj->setLocation(ilUtil::stripSlashes($_POST['location']));
01266 #$this->event_obj->setFirstname(ilUtil::stripSlashes($_POST['tutor_firstname']));
01267 $this->event_obj->setName(ilUtil::stripSlashes($_POST['tutor_name']));
01268 #$this->event_obj->setPTitle(ilUtil::stripSlashes($_POST['tutor_title']));
01269 $this->event_obj->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
01270 $this->event_obj->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
01271 $this->event_obj->setDetails(ilUtil::stripSlashes($_POST['details']));
01272 $this->event_obj->enableRegistration((int) $_POST['registration']);
01273 #$this->event_obj->enableParticipation((int) $_POST['participance']);
01274 }
01275
01276
01277 function __initCourseObject()
01278 {
01279 global $tree;
01280
01281 if($this->container_obj->getType() == 'crs')
01282 {
01283
01284 $this->course_obj =& $this->container_obj;
01285 }
01286 else
01287 {
01288 $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),'crs');
01289 $this->course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id);
01290 }
01291 return true;
01292 }
01293
01294 function __initEventObject()
01295 {
01296 if(!is_object($this->event_obj))
01297 {
01298 $this->event_obj = new ilEvent($this->event_id);
01299 $this->event_obj->setObjId($this->container_obj->getId());
01300
01301 if(!is_object($this->appointment_obj))
01302 {
01303 $this->appointment_obj =& $this->event_obj->getFirstAppointment();
01304 }
01305 }
01306 return true;
01307 }
01308
01309 function __prepareDateSelect($a_unix_time)
01310 {
01311 return array('y' => date('Y',$a_unix_time),
01312 'm' => date('m',$a_unix_time),
01313 'd' => date('d',$a_unix_time));
01314 }
01315 function __prepareTimeSelect($a_unix_time)
01316 {
01317 return array('h' => date('G',$a_unix_time),
01318 'm' => date('i',$a_unix_time),
01319 's' => date('s',$a_unix_time));
01320 }
01321 function __toUnix($date,$time)
01322 {
01323 return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
01324 }
01325
01326 function __formatPath($a_ref_id)
01327 {
01328 global $tree;
01329
01330 $path = $this->lng->txt('path') . ': ';
01331 $first = true;
01332 foreach($tree->getPathFull($a_ref_id,$this->course_obj->getRefId()) as $node)
01333 {
01334 if($node['ref_id'] != $a_ref_id)
01335 {
01336 if(!$first)
01337 {
01338 $path .= ' -> ';
01339 }
01340 $first = false;
01341 $path .= $node['title'];
01342 }
01343 }
01344 return $path;
01345 }
01346
01353 public function getTabs($tabs_gui)
01354 {
01355 global $ilAccess,$ilTabs;
01356
01357 $tabs_gui->setBackTarget($this->lng->txt('back_to_crs_content'),$this->ctrl->getParentReturn($this));
01358 $tabs_gui->addTarget('info_short',
01359 $this->ctrl->getLinkTarget($this,'info'));
01360
01361 if($ilAccess->checkAccess('write','',$this->container_obj->getRefId()))
01362 {
01363 $tabs_gui->addTarget('edit_properties',
01364 $this->ctrl->getLinkTarget($this,'edit'));
01365 $tabs_gui->addTarget('crs_materials',
01366 $this->ctrl->getLinkTarget($this,'materials'));
01367 $tabs_gui->addTarget('event_edit_members',
01368 $this->ctrl->getLinkTarget($this,'editMembers'));
01369
01370 }
01371 }
01372
01379 private function setLocator()
01380 {
01381 global $ilLocator;
01382
01383 #$ilLocator->addItem($this->event_obj->getTitle(),$this->ctrl->getLinkTarget($this,'info'));
01384 }
01385
01393 private function setTabs()
01394 {
01395 global $ilTabs;
01396
01397 $this->tabs_gui->clearSubTabs();
01398 $this->tabs_gui->clearTargets();
01399 $this->getTabs($this->tabs_gui);
01400 }
01401
01402
01403 }
01404 ?>