• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

course/classes/Event/class.ilEventAdministrationGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00035 include_once './course/classes/Event/class.ilEventFile.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)
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                 $this->tabs_gui->clearSubTabs();
00094                 $this->tabs_gui->clearTargets();
00095         }
00096 
00097         function cancel()
00098         {
00099                 #sendInfo($this->lng->txt('msg_cancel',true));
00100                 $this->ctrl->returnToParent($this);
00101         }
00102 
00103         function register()
00104         {
00105                 global $ilUser;
00106 
00107                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00108                 ilEventParticipants::_register($ilUser->getId(),(int) $_GET['event_id']);
00109 
00110                 sendInfo($this->lng->txt('event_registered'),true);
00111                 $this->ctrl->returnToParent($this);
00112         }
00113                 
00114         function unregister()
00115         {
00116                 global $ilUser;
00117 
00118                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00119                 ilEventParticipants::_unregister($ilUser->getId(),(int) $_GET['event_id']);
00120 
00121                 sendInfo($this->lng->txt('event_unregistered'),true);
00122                 $this->ctrl->returnToParent($this);
00123         }
00124 
00125         function printViewMembers()
00126         {
00127                 include_once 'course/classes/class.ilCourseMembers.php';
00128                 include_once 'course/classes/Event/class.ilEvent.php';
00129                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00130 
00131 
00132                 global $ilErr,$ilAccess;
00133 
00134                 if(!$ilAccess->checkAccess('write','',$this->course_obj->getRefId()))
00135                 {
00136                         $ilErr->raiseError($this->lng->txt('msg_no_perm_read'),$ilErr->MESSAGE);
00137                 }
00138                 $members_obj = new ilCourseMembers($this->course_obj);
00139                 $event_obj = new ilEvent((int) $_GET['event_id']);
00140                 $event_app =& $event_obj->getFirstAppointment();
00141                 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00142                 
00143 
00144                 $this->tpl = new ilTemplate('tpl.main.html',true,true);
00145                 // load style sheet depending on user's settings
00146                 $location_stylesheet = ilUtil::getStyleSheetLocation();
00147                 $this->tpl->setVariable("LOCATION_STYLESHEET",$location_stylesheet);
00148                 $this->tpl->setVariable("LOCATION_JAVASCRIPT",dirname($location_stylesheet));
00149 
00150 
00151                 $tpl = new ilTemplate('tpl.event_members_print.html',true,true,'course');
00152 
00153                 $tpl->setVariable("EVENT",$this->lng->txt('event'));
00154                 $tpl->setVariable("EVENT_NAME",$event_obj->getTitle());
00155                 $tpl->setVariable("DATE",ilFormat::formatUnixTime($event_app->getStartingTime(),false)." ".
00156                                                   $event_app->formatTime());
00157                 $tpl->setVariable("TXT_NAME",$this->lng->txt('name'));
00158                 $tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
00159                 $tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
00160                 $tpl->setVariable("TXT_PARTICIPATED",$this->lng->txt('event_tbl_participated'));
00161                 if($event_obj->enabledRegistration())
00162                 {
00163                         $tpl->setVariable("TXT_REGISTERED",$this->lng->txt('event_tbl_registered'));
00164                 }
00165 
00166                 $members = $members_obj->getAssignedUsers();
00167                 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00168                 foreach($members as $user_id)
00169                 {
00170                         
00171                         $user_data = $event_part->getUser($user_id);
00172 
00173                         if($event_obj->enabledRegistration())
00174                         {
00175                                 $tpl->setCurrentBlock("reg_col");
00176                                 $tpl->setVariable("REGISTERED",$event_part->isRegistered($user_id) ? "X" : "");
00177                                 $tpl->parseCurrentBlock();
00178                         }
00179                         $tpl->setVariable("COMMENT",$user_data['comment']);
00180 
00181                         $tpl->setCurrentBlock("member_row");
00182                         $name = ilObjUser::_lookupName($user_id);
00183                         $tpl->setVariable("LASTNAME",$name['lastname']);
00184                         $tpl->setVariable("FIRSTNAME",$name['firstname']);
00185                         $tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
00186                         $tpl->setVariable("MARK",$user_data['mark']);
00187                         $tpl->setVariable("PARTICIPATED",$event_part->hasParticipated($user_id) ? "X" : "");
00188                         $tpl->parseCurrentBlock();
00189                 }
00190 
00191                 $this->tpl->setVariable("CONTENT",$tpl->get());
00192                 $this->tpl->setVariable("BODY_ATTRIBUTES",'onload="window.print()"');
00193                 $this->tpl->show();
00194                 exit;
00195         }
00196                 
00197 
00198         function editMembers()
00199         {
00200                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_members.html','course');
00201                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00202 
00203                 // display button
00204                 $this->tpl->setCurrentBlock("btn_cell");
00205                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'cancel'));
00206                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00207                 $this->tpl->parseCurrentBlock();
00208 
00209                 // display print button
00210                 $this->tpl->setCurrentBlock("btn_cell");
00211                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'printViewMembers'));
00212                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('print'));
00213                 $this->tpl->setVariable("BTN_TARGET",'target="_blank"');
00214                 $this->tpl->parseCurrentBlock();
00215 
00216                 include_once 'course/classes/class.ilCourseMembers.php';
00217                 include_once 'course/classes/Event/class.ilEvent.php';
00218                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00219 
00220                 $members_obj = new ilCourseMembers($this->course_obj);
00221                 $event_obj = new ilEvent((int) $_GET['event_id']);
00222                 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00223 
00224                 $members = $members_obj->getAssignedUsers();
00225                 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00226 
00227                 $this->tpl->addBlockfile("PARTICIPANTS_TABLE","participants_table", "tpl.table.html");
00228                 $this->tpl->addBlockfile('TBL_CONTENT','tbl_content','tpl.event_members_row.html','course');
00229 
00230                 // Table 
00231                 $tbl = new ilTableGUI();
00232                 $tbl->setTitle($this->lng->txt("event_tbl_participants"),
00233                                            'icon_usr.gif',
00234                                            $this->lng->txt('obj_usr'));
00235                 $this->ctrl->setParameter($this,'offset',(int) $_GET['offset']);
00236                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00237                 $this->tpl->setVariable("COLUMN_COUNTS",6);
00238                 #$this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
00239                 #$this->tpl->setCurrentBlock("tbl_action_btn");
00240                 #$this->tpl->setVariable("BTN_NAME", "updateMembers");
00241                 #$this->tpl->setVariable("BTN_VALUE", $this->lng->txt("event_save_participants"));
00242                 #$this->tpl->parseCurrentBlock();
00243                 $this->tpl->setCurrentBlock("plain_button");
00244                 $this->tpl->setVariable("PBTN_NAME",'updateMembers');
00245                 $this->tpl->setVariable("PBTN_VALUE",$this->lng->txt('save'));
00246                 $this->tpl->parseCurrentBlock();
00247                 
00248                 $this->tpl->setCurrentBlock("plain_button");
00249                 $this->tpl->setVariable("PBTN_NAME",'cancel');
00250                 $this->tpl->setVariable("PBTN_VALUE",$this->lng->txt('cancel'));
00251                 $this->tpl->parseCurrentBlock();
00252 
00253                 if($event_obj->enabledRegistration())
00254                 {
00255                         $tbl->setHeaderNames(array($this->lng->txt('name'),
00256                                                                            $this->lng->txt('trac_mark'),
00257                                                                            $this->lng->txt('trac_comment'),
00258                                                                            $this->lng->txt('event_tbl_registered'),
00259                                                                            $this->lng->txt('event_tbl_participated')));
00260                         $tbl->setHeaderVars(array("name",
00261                                                                           "mark",
00262                                                                           "comment",
00263                                                                           "registered",
00264                                                                           "participated"),
00265                                                                 $this->ctrl->getParameterArray($this,'editMembers'));
00266                         $tbl->setColumnWidth(array('','','','',''));
00267                 }
00268                 else
00269                 {
00270                         $tbl->setHeaderNames(array($this->lng->txt('name'),
00271                                                                            $this->lng->txt('trac_mark'),
00272                                                                            $this->lng->txt('trac_comment'),
00273                                                                            $this->lng->txt('event_tbl_participated')));
00274 
00275                         $tbl->setHeaderVars(array("name",
00276                                                                           "mark",
00277                                                                           "comment",
00278                                                                           "participated"),
00279                                                                 $this->ctrl->getParameterArray($this,'editMembers'));
00280 
00281                         $tbl->setColumnWidth(array('','','',''));
00282                 }
00283 
00284                 $tbl->setOrderColumn($_GET["sort_by"]);
00285                 $tbl->setOrderDirection($_GET["sort_order"]);
00286                 $tbl->setOffset($_GET["offset"]);
00287                 $tbl->setLimit($_GET["limit"]);
00288                 $tbl->setMaxCount(count($members));
00289                 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
00290 
00291                 $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
00292                 $tbl->disable('sort');
00293                 $tbl->render();
00294 
00295                 $counter = 0;
00296                 foreach($sliced_users as $user_id)
00297                 {
00298                         $user_data = $event_part->getUser($user_id);
00299 
00300                         if($event_obj->enabledRegistration())
00301                         {
00302                                 $this->tpl->setCurrentBlock("registered_col");
00303                                 $this->tpl->setVariable("IMAGE_REGISTERED",$event_part->isRegistered($user_id) ? 
00304                                                                                 ilUtil::getImagePath('icon_ok.gif') :
00305                                                                                 ilUtil::getImagePath('icon_not_ok.gif'));
00306                                 $this->tpl->setVariable("REGISTERED",$event_part->isRegistered($user_id) ?
00307                                                                                 $this->lng->txt('event_registered') :
00308                                                                                 $this->lng->txt('event_not_registered'));
00309                                 $this->tpl->parseCurrentBlock();
00310                         }
00311 
00312                         $this->tpl->setCurrentBlock("tbl_content");
00313                         $name = ilObjUser::_lookupName($user_id);
00314                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
00315                         $this->tpl->setVariable("LASTNAME",$name['lastname']);
00316                         $this->tpl->setVariable("FIRSTNAME",$name['firstname']);
00317                         $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin($user_id));
00318                         $this->tpl->setVariable("MARK",$user_data['mark']);
00319                         $this->tpl->setVariable("MARK_NAME",'mark['.$user_id.']');
00320                         $this->tpl->setVariable("COMMENT_NAME",'comment['.$user_id.']');
00321                         $this->tpl->setVariable("COMMENT",$user_data['comment']);
00322 
00323                         $this->tpl->setVariable("USER_ID",$user_id);
00324                         $this->tpl->setVariable("CHECKED",$event_part->hasParticipated($user_id) ? 'checked="checked"' : '');
00325                         $this->tpl->setVariable("IMAGE_PART",$event_part->hasParticipated($user_id) ? 
00326                                                                         ilUtil::getImagePath('icon_ok.gif') :
00327                                                                         ilUtil::getImagePath('icon_not_ok.gif'));
00328                         $this->tpl->setVariable("PART",$event_part->hasParticipated($user_id) ?
00329                                                                         $this->lng->txt('event_participated') :
00330                                                                         $this->lng->txt('event_not_participated'));
00331                         $this->ctrl->setParameter($this,'user_id',$user_id);
00332                         $this->tpl->setVariable("EDIT_LINK",$this->ctrl->getLinkTarget($this,'editUser'));
00333                         $this->tpl->setVariable("TXT_EDIT",$this->lng->txt('edit'));
00334                         $this->tpl->parseCurrentBlock();
00335                 }
00336                 $this->tpl->setCurrentBlock("select_row");
00337                 $this->tpl->setVariable("SELECT_SPAN",$event_obj->enabledRegistration() ? 4 : 3);
00338                 $this->tpl->setVariable("ROWCLASS",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
00339                 $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
00340                 $this->tpl->parseCurrentBlock();
00341                 
00342         }
00343 
00344         function updateMembers()
00345         {
00346                 include_once 'course/classes/class.ilCourseMembers.php';
00347                 include_once 'course/classes/Event/class.ilEvent.php';
00348                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00349 
00350                 $_POST['participants'] = is_array($_POST['participants']) ? $_POST['participants'] : array();
00351 
00352                 $members_obj = new ilCourseMembers($this->course_obj);
00353                 $event_part = new ilEventParticipants((int) $_GET['event_id']);
00354 
00355                 $members = $members_obj->getAssignedUsers();
00356                 $members = ilUtil::_sortIds($members,'usr_data','lastname','usr_id');
00357                 $sliced_users = array_slice($members,$_GET['offset'],$_SESSION['tbl_limit']);
00358 
00359                 foreach($sliced_users as $user)
00360                 {
00361                         $part = new ilEventParticipants((int) $_GET['event_id']);
00362                         $part->setUserId($user);
00363                         $part->setMark(ilUtil::stripSlashes($_POST['mark'][$user]));
00364                         $part->setComment(ilUtil::stripSlashes($_POST['comment'][$user]));
00365                         $part->setParticipated(in_array($user,$_POST['participants']));
00366                         $part->setRegistered(ilEventParticipants::_isRegistered($user,(int) $_GET['event_id']));
00367                         $part->updateUser();
00368                 }
00369                 sendInfo($this->lng->txt('settings_saved'));
00370                 $this->editMembers();
00371         }
00372 
00373         function editUser()
00374         {
00375                 global $ilObjDataCache;
00376 
00377                 include_once 'course/classes/Event/class.ilEvent.php';
00378                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00379 
00380                 $event_obj = new ilEvent((int) $_GET['event_id']);
00381                 $part_obj = new ilEventParticipants((int) $_GET['event_id']);
00382 
00383 
00384                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00385 
00386                 // display button
00387                 $this->tpl->setCurrentBlock("btn_cell");
00388                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'editMembers'));
00389                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00390                 $this->tpl->parseCurrentBlock();
00391 
00392                 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.event_edit_user.html','course');
00393 
00394                 $this->ctrl->setParameter($this,'user_id',(int) $_GET['user_id']);
00395                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00396                 $this->tpl->setVariable("USR_IMAGE",ilUtil::getImagePath('icon_usr.gif'));
00397                 $this->tpl->setVariable("ALT_USER",$this->lng->txt('obj_usr'));
00398                 $this->tpl->setVariable("EVENT_TITLE",$event_obj->getTitle());
00399                 $this->tpl->setVariable("FULLNAME",$ilObjDataCache->lookupTitle((int) $_GET['user_id']));
00400                 $this->tpl->setVariable("LOGIN",ilObjUser::_lookupLogin((int) $_GET['user_id']));
00401                 
00402                 $this->tpl->setVariable("TXT_PARTICIPANCE",$this->lng->txt('event_tbl_participated'));
00403                 $this->tpl->setVariable("TXT_REGISTERED",$this->lng->txt('event_tbl_registered'));
00404                 $this->tpl->setVariable("TXT_MARK",$this->lng->txt('trac_mark'));
00405                 $this->tpl->setVariable("TXT_COMMENT",$this->lng->txt('trac_comment'));
00406                 $this->tpl->setVariable("TXT_BTN_UPDATE",$this->lng->txt('save'));
00407                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00408 
00409                 $user_data = $part_obj->getUser((int) $_GET['user_id']);
00410                 
00411                 $this->tpl->setVariable("MARK",$user_data['mark']);
00412                 $this->tpl->setVariable("COMMENT",$user_data['comment']);
00413                 $this->tpl->setVariable("PART_CHECKED",$user_data['participated'] ? 'checked="checked"' : '');
00414                 $this->tpl->setVariable("REG_CHECKED",$user_data['registered'] ? 'checked="checked"' : '');
00415                 
00416         }
00417 
00418         function updateUser()
00419         {
00420                 include_once 'course/classes/Event/class.ilEventParticipants.php';
00421                 $part_obj = new ilEventParticipants((int) $_GET['event_id']);
00422                 
00423                 $part_obj->setUserId((int) $_GET['user_id']);
00424                 $part_obj->setMark(ilUtil::stripSlashes($_POST['mark']));
00425                 $part_obj->setComment(ilUtil::stripSlashes($_POST['comment']));
00426                 $part_obj->setRegistered($_POST['registration']);
00427                 $part_obj->setParticipated($_POST['participance']);
00428                 $part_obj->updateUser((int) $_GET['user_id']);
00429 
00430                 sendInfo($this->lng->txt('settings_saved'));
00431                 $this->editMembers();
00432         }
00433 
00434 
00435         function materials()
00436         {
00437                 global $tree;
00438 
00439                 include_once 'course/classes/Event/class.ilEventItems.php';
00440                 $this->event_items = new ilEventItems($this->event_id);
00441                 $items = $this->event_items->getItems();
00442 
00443                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_materials.html','course');
00444                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00445 
00446                 // display button
00447                 $this->tpl->setCurrentBlock("btn_cell");
00448                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'cancel'));
00449                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00450                 $this->tpl->parseCurrentBlock();
00451 
00452                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00453                 $this->tpl->setVariable("COLL_TITLE_IMG",ilUtil::getImagePath('icon_event.gif'));
00454                 $this->tpl->setVariable("COLL_TITLE_IMG_ALT",$this->lng->txt('events'));
00455                 $this->tpl->setVariable("TABLE_TITLE",$this->lng->txt('event_assign_materials_table'));
00456                 $this->tpl->setVariable("TABLE_INFO",$this->lng->txt('event_assign_materials_info'));
00457 
00458                 $nodes = $tree->getSubTree($tree->getNodeData($this->course_obj->getRefId()));
00459                 $counter = 1;
00460                 foreach($nodes as $node)
00461                 {
00462                         if($node['type'] == 'rolf')
00463                         {
00464                                 continue;
00465                         }
00466                         if($counter++ == 1)
00467                         {
00468                                 continue;
00469                         }
00470                         $this->tpl->setCurrentBlock("material_row");
00471                         $this->tpl->setVariable("ROW_CLASS",ilUtil::switchColor($counter,'tblrow1','tblrow2'));
00472                         $this->tpl->setVariable("CHECK_COLL",ilUtil::formCheckbox(in_array($node['ref_id'],$items) ? 1 : 0,
00473                                                                                                                                           'items[]',$node['ref_id']));
00474                         $this->tpl->setVariable("COLL_TITLE",$node['title']);
00475 
00476                         if(strlen($node['description']))
00477                         {
00478                                 $this->tpl->setVariable("COLL_DESC",$node['description']);
00479                         }
00480                         $this->tpl->setVariable("ASSIGNED_IMG_OK",in_array($node['ref_id'],$items) ? 
00481                                                                         ilUtil::getImagePath('icon_ok.gif') :
00482                                                                         ilUtil::getImagePath('icon_not_ok.gif'));
00483                         $this->tpl->setVariable("ASSIGNED_STATUS",$this->lng->txt('event_material_assigned'));
00484                         $this->tpl->setVariable("COLL_PATH",$this->__formatPath($node['ref_id']));
00485                         $this->tpl->parseCurrentBlock();
00486                 }
00487 
00488                 $this->tpl->setVariable("SELECT_ROW",ilUtil::switchColor(++$counter,'tblrow1','tblrow2'));
00489                 $this->tpl->setVariable("SELECT_ALL",$this->lng->txt('select_all'));
00490                 $this->tpl->setVariable("IMG_ARROW",ilUtil::getImagePath('arrow_downright.gif'));
00491                 $this->tpl->setVariable("BTN_SAVE",$this->lng->txt('save'));
00492 
00493         }
00494 
00495         function saveMaterials()
00496         {
00497                 include_once 'course/classes/Event/class.ilEventItems.php';
00498                 
00499                 $this->event_items = new ilEventItems($this->event_id);
00500                 $this->event_items->setItems(is_array($_POST['items']) ? $_POST['items'] : array());
00501                 $this->event_items->update();
00502 
00503                 sendInfo($this->lng->txt('settings_saved'),true);
00504                 $this->ctrl->returnToParent($this);
00505         }
00506                 
00507                 
00508 
00509         function info()
00510         {
00511                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_info.html','course');
00512 
00513                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00514 
00515                 // display button
00516                 $this->tpl->setCurrentBlock("btn_cell");
00517                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'cancel'));
00518                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00519                 $this->tpl->parseCurrentBlock();
00520 
00521                 
00522                 include_once("classes/class.ilInfoScreenGUI.php");
00523                 $info = new ilInfoScreenGUI($this);
00524                 
00525                 $appointment_obj =& $this->event_obj->getFirstAppointment();
00526                 
00527 
00528                 // syllabus section
00529                 $info->addSection($this->lng->txt("event_general_properties"));
00530                 $info->addProperty($this->lng->txt('event_title'),
00531                                                    $this->event_obj->getTitle());
00532                 if(strlen($desc = $this->event_obj->getDescription()))
00533                 {
00534                         $info->addProperty($this->lng->txt('event_desc'),
00535                                                            nl2br($this->event_obj->getDescription()));
00536                 }
00537                 if(strlen($location = $this->event_obj->getLocation()))
00538                 {
00539                         $info->addProperty($this->lng->txt('event_location'),
00540                                                            nl2br($this->event_obj->getLocation()));
00541                 }
00542                 $info->addProperty($this->lng->txt('event_date'),
00543                                                         $appointment_obj->appointmentToString());
00544 
00545                 if($this->event_obj->hasTutorSettings())
00546                 {
00547                         $info->addSection($this->lng->txt('event_tutor_data'));
00548                         if(strlen($fullname = $this->event_obj->getFullname()))
00549                         {
00550                                 $info->addProperty($this->lng->txt('event_lecturer'),
00551                                                                    $fullname);
00552                         }
00553                         if(strlen($email = $this->event_obj->getEmail()))
00554                         {
00555                                 $info->addProperty($this->lng->txt('tutor_email'),
00556                                                                    $email);
00557                         }
00558                         if(strlen($phone = $this->event_obj->getPhone()))
00559                         {
00560                                 $info->addProperty($this->lng->txt('tutor_phone'),
00561                                                                    $phone);
00562                         }
00563                 }
00564 
00565                 $details = $this->event_obj->getDetails();
00566                 $files = $this->event_obj->getFiles();
00567 
00568                 if(strlen($details) or is_array($files))
00569                 {
00570                         $info->addSection($this->lng->txt('event_further_informations'));
00571                         
00572                         if(strlen($details))
00573                         {
00574                                 $info->addProperty($this->lng->txt('event_details_workflow'),
00575                                                                    nl2br($details));
00576                         }
00577 
00578                         if(count($files))
00579                         {
00580                                 $tpl = new ilTemplate('tpl.event_info_file.html',true,true,'course');
00581 
00582                                 foreach($files as $file)
00583                                 {
00584                                         $tpl->setCurrentBlock("files");
00585                                         $this->ctrl->setParameter($this,'file_id',$file->getFileId());
00586                                         $tpl->setVariable("DOWN_LINK",$this->ctrl->getLinkTarget($this,'sendfile'));
00587                                         $tpl->setVariable("DOWN_NAME",$file->getFileName());
00588                                         $tpl->setVariable("DOWN_INFO_TXT",$this->lng->txt('event_file_size_info'));
00589                                         $tpl->setVariable("DOWN_SIZE",$file->getFileSize());
00590                                         $tpl->setVariable("TXT_BYTES",$this->lng->txt('bytes'));
00591                                         $tpl->parseCurrentBlock();
00592                                 }
00593                                 $info->addProperty($this->lng->txt('event_file_download'),
00594                                                                    $tpl->get());
00595                         }
00596                         
00597                 }
00598                                 
00599                 $this->tpl->setVariable("INFO_TABLE",$info->getHTML());
00600         }
00601 
00602         function sendFile()
00603         {
00604                 $file = new ilEventFile((int) $_GET['file_id']);
00605                 
00606                 ilUtil::deliverFile($file->getAbsolutePath(),$file->getFileName(),$file->getFileType());
00607                 return true;
00608         }
00609 
00610         function addEvent()
00611         {
00612                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_create.html','course');
00613 
00614                 // display back button
00615                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00616                 $this->tpl->setCurrentBlock("btn_cell");
00617                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'cancel'));
00618                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00619                 $this->tpl->parseCurrentBlock();
00620 
00621                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00622                 $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('event_table_create'));
00623                 $this->tpl->setVariable("TXT_GENERAL_INFOS",$this->lng->txt('event_general_infos'));
00624                 $this->tpl->setVariable("TXT_BTN_ADD_EVENT",$this->lng->txt('event_btn_add'));
00625                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00626                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('event_title'));
00627                 $this->tpl->setVariable("TXT_DESC",$this->lng->txt('event_desc'));
00628                 $this->tpl->setVariable("TXT_LOCATION",$this->lng->txt('event_location'));
00629                 $this->tpl->setVariable("TXT_REGISTRATION_PARTICIPANCE",$this->lng->txt('event_registration_participance'));
00630                 $this->tpl->setVariable("TXT_REGISTRATION",$this->lng->txt('event_registration'));
00631                 $this->tpl->setVariable("TXT_PARTICIPANCE",$this->lng->txt('event_participation'));
00632                 $this->tpl->setVariable("REGISTRATION_INFO",$this->lng->txt('event_registration_info'));
00633                 $this->tpl->setVariable("PARTICIPATION_INFO",$this->lng->txt('event_participation_info'));
00634 
00635 
00636                 $this->tpl->setVariable("TXT_REQUIRED",$this->lng->txt('required_field'));
00637                 $this->tpl->setVariable("TXT_TUTOR_DATA",$this->lng->txt('event_tutor_data'));
00638                 #$this->tpl->setVariable("TXT_TUTOR_TITLE",$this->lng->txt('tutor_title'));
00639                 #$this->tpl->setVariable("TXT_TUTOR_FIRSTNAME",$this->lng->txt('tutor_firstname'));
00640                 $this->tpl->setVariable("TXT_TUTOR_NAME",$this->lng->txt('tutor_name'));
00641                 $this->tpl->setVariable("TXT_TUTOR_EMAIL",$this->lng->txt('tutor_email'));
00642                 $this->tpl->setVariable("TXT_TUTOR_PHONE",$this->lng->txt('tutor_phone'));
00643 
00644                 $this->tpl->setVariable("TXT_DATE_TIME",$this->lng->txt('event_date_time'));
00645                 $this->tpl->setVariable("TXT_START_DATE",$this->lng->txt('event_start_date'));
00646                 $this->tpl->setVariable("TXT_END_DATE",$this->lng->txt('event_end_date'));
00647 
00648                 $this->tpl->setVariable("TXT_TIME",$this->lng->txt('event_time'));
00649         
00650                 $this->tpl->setVariable("TXT_TUTOR_NAME",$this->lng->txt('tutor_name'));
00651                 $this->tpl->setVariable("TXT_TUTOR_EMAIL",$this->lng->txt('tutor_email'));
00652                 $this->tpl->setVariable("TXT_TUTOR_PHONE",$this->lng->txt('tutor_phone'));
00653                 $this->tpl->setVariable("TXT_START_DATE",$this->lng->txt('event_start_date'));
00654                 $this->tpl->setVariable("TXT_TIME",$this->lng->txt('event_time'));
00655                 $this->tpl->setVariable("TXT_DATE",$this->lng->txt('date'));
00656                 $this->tpl->setVariable("TXT_FULLDAY",$this->lng->txt('event_fullday'));
00657                 $this->tpl->setVariable("FULLTIME_INFO",$this->lng->txt('event_fulltime_info'));
00658 
00659                 $this->tpl->setVariable("FULL_CHECKED",$this->appointment_obj->enabledFullTime() ? 'checked="checked"' : '');
00660                 $date = $this->__prepareDateSelect($this->appointment_obj->getStartingTime());
00661                 $end_date = $this->__prepareDateSelect($this->appointment_obj->getEndingTime());
00662                 $start_time = $this->__prepareTimeSelect($this->appointment_obj->getStartingTime());
00663                 $end_time = $this->__prepareTimeSelect($this->appointment_obj->getEndingTime());
00664 
00665                 $this->tpl->setVariable("START_DATE",ilUtil::makeDateSelect('event_date',$date['y'],$date['m'],$date['d'],date('Y',time())));
00666                 $this->tpl->setVariable("START_TIME",ilUtil::makeTimeSelect('event_time_start',true,$start_time['h'],$start_time['m'],0,false));
00667                 $this->tpl->setVariable("END_DATE",
00668                                                                 ilUtil::makeDateSelect('event_end_date',$end_date['y'],$end_date['m'],$end_date['d'],date('Y',time())));
00669                 $this->tpl->setVariable("END_TIME",ilUtil::makeTimeSelect('event_time_end',true,$end_time['h'],$end_time['m'],0,false));
00670 
00671                 $this->tpl->setVariable("TITLE",$this->event_obj->getTitle());
00672                 $this->tpl->setVariable("DESC",$this->event_obj->getDescription());
00673                 $this->tpl->setVariable("LOCATION",$this->event_obj->getLocation());
00674                 $this->tpl->setVariable("REG_CHECKED",$this->event_obj->enabledRegistration() ? 'checked="checked"' : '');
00675                 $this->tpl->setVariable("PART_CHECKED",$this->event_obj->enabledParticipation() ? 'checked="checked"' : '');
00676                 #$this->tpl->setVariable("TUTOR_FIRSTNAME",$this->event_obj->getFirstname());
00677                 $this->tpl->setVariable("TUTOR_NAME",$this->event_obj->getName());
00678                 #$this->tpl->setVariable("TUTOR_TITLE",$this->event_obj->getPTitle());
00679                 $this->tpl->setVariable("TUTOR_EMAIL",$this->event_obj->getEmail());
00680                 $this->tpl->setVariable("TUTOR_PHONE",$this->event_obj->getPhone());
00681                 $this->tpl->setVariable("DETAILS",$this->event_obj->getDetails());
00682 
00683                 $this->tpl->setVariable("TXT_FURTHER_INFORMATIONS",$this->lng->txt('event_further_informations'));
00684                 $this->tpl->setVariable("TXT_FILE_NAME",$this->lng->txt('event_file_name'));
00685                 $this->tpl->setVariable("TXT_FILE",$this->lng->txt('event_file'));
00686                 $this->tpl->setVariable("FILE_HINT",$this->lng->txt('if_no_title_then_filename'));
00687                 $this->tpl->setVariable("TXT_DETAILS",$this->lng->txt('event_details_workflow'));
00688                 $this->tpl->setVariable("TXT_FILESIZE",ilUtil::getFileSizeInfo());
00689 
00690 
00691                 return true;
00692         }
00693 
00694         function edit()
00695         {
00696                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_edit.html','course');
00697 
00698                 // display back button
00699                 $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
00700                 $this->tpl->setCurrentBlock("btn_cell");
00701                 $this->tpl->setVariable("BTN_LINK",$this->ctrl->getLinkTarget($this,'cancel'));
00702                 $this->tpl->setVariable("BTN_TXT",$this->lng->txt('back'));
00703                 $this->tpl->parseCurrentBlock();
00704 
00705 
00706                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00707                 $this->tpl->setVariable("TBL_TITLE",$this->lng->txt('event_table_update'));
00708                 $this->tpl->setVariable("TXT_GENERAL_INFOS",$this->lng->txt('event_general_infos'));
00709                 $this->tpl->setVariable("TXT_BTN_UPDATE",$this->lng->txt('save'));
00710                 $this->tpl->setVariable("TXT_CANCEL",$this->lng->txt('cancel'));
00711                 $this->tpl->setVariable("TXT_TITLE",$this->lng->txt('event_title'));
00712                 $this->tpl->setVariable("TXT_DESC",$this->lng->txt('event_desc'));
00713                 $this->tpl->setVariable("TXT_LOCATION",$this->lng->txt('event_location'));
00714                 $this->tpl->setVariable("TXT_REGISTRATION_PARTICIPANCE",$this->lng->txt('event_registration_participance'));
00715                 $this->tpl->setVariable("TXT_REGISTRATION",$this->lng->txt('event_registration'));
00716                 $this->tpl->setVariable("TXT_PARTICIPANCE",$this->lng->txt('event_participation'));
00717                 $this->tpl->setVariable("REGISTRATION_INFO",$this->lng->txt('event_registration_info'));
00718                 $this->tpl->setVariable("PARTICIPATION_INFO",$this->lng->txt('event_participation_info'));
00719 
00720                 $this->tpl->setVariable("TXT_DATE_TIME",$this->lng->txt('event_date_time'));
00721                 $this->tpl->setVariable("TXT_START_DATE",$this->lng->txt('event_start_date'));
00722                 $this->tpl->setVariable("TXT_END_DATE",$this->lng->txt('event_end_date'));
00723 
00724                 $this->tpl->setVariable("TXT_REQUIRED",$this->lng->txt('required_field'));
00725                 $this->tpl->setVariable("TXT_TUTOR_DATA",$this->lng->txt('event_tutor_data'));
00726                 #$this->tpl->setVariable("TXT_TUTOR_TITLE",$this->lng->txt('tutor_title'));
00727                 #$this->tpl->setVariable("TXT_TUTOR_FIRSTNAME",$this->lng->txt('tutor_firstname'));
00728                 #$this->tpl->setVariable("TXT_TUTOR_LASTNAME",$this->lng->txt('tutor_lastname'));
00729                 $this->tpl->setVariable("TXT_TUTOR_NAME",$this->lng->txt('tutor_name'));
00730                 $this->tpl->setVariable("TXT_TUTOR_EMAIL",$this->lng->txt('tutor_email'));
00731                 $this->tpl->setVariable("TXT_TUTOR_PHONE",$this->lng->txt('tutor_phone'));
00732                 $this->tpl->setVariable("TXT_START_DATE",$this->lng->txt('event_start_date'));
00733                 $this->tpl->setVariable("TXT_TIME",$this->lng->txt('event_time'));
00734                 $this->tpl->setVariable("TXT_DATE",$this->lng->txt('date'));
00735                 $this->tpl->setVariable("TXT_FULLDAY",$this->lng->txt('event_fullday'));
00736                 $this->tpl->setVariable("FULLTIME_INFO",$this->lng->txt('event_fulltime_info'));
00737 
00738 
00739                 $this->tpl->setVariable("FULL_CHECKED",$this->appointment_obj->enabledFullTime() ? 'checked="checked"' : '');
00740                 $date = $this->__prepareDateSelect($this->appointment_obj->getStartingTime());
00741                 $end_date = $this->__prepareDateSelect($this->appointment_obj->getEndingTime());
00742                 $start_time = $this->__prepareTimeSelect($this->appointment_obj->getStartingTime());
00743                 $end_time = $this->__prepareTimeSelect($this->appointment_obj->getEndingTime());
00744 
00745                 $this->tpl->setVariable("START_DATE",ilUtil::makeDateSelect('event_date',$date['y'],$date['m'],$date['d'],date('Y',time())));
00746                 $this->tpl->setVariable("START_TIME",ilUtil::makeTimeSelect('event_time_start',true,$start_time['h'],$start_time['m'],0,false));
00747                 $this->tpl->setVariable("END_DATE",
00748                                                                 ilUtil::makeDateSelect('event_end_date',$end_date['y'],$end_date['m'],$end_date['d'],date('Y',time())));
00749                 $this->tpl->setVariable("END_TIME",ilUtil::makeTimeSelect('event_time_end',true,$end_time['h'],$end_time['m'],0,false));
00750 
00751                 $this->tpl->setVariable("TITLE",$this->event_obj->getTitle());
00752                 $this->tpl->setVariable("DESC",$this->event_obj->getDescription());
00753                 $this->tpl->setVariable("LOCATION",$this->event_obj->getLocation());
00754                 $this->tpl->setVariable("REG_CHECKED",$this->event_obj->enabledRegistration() ? 'checked="checked"' : '');
00755                 $this->tpl->setVariable("PART_CHECKED",$this->event_obj->enabledParticipation() ? 'checked="checked"' : '');
00756                 #$this->tpl->setVariable("TUTOR_FIRSTNAME",$this->event_obj->getFirstname());
00757                 #$this->tpl->setVariable("TUTOR_LASTNAME",$this->event_obj->getLastname());
00758                 #$this->tpl->setVariable("TUTOR_TITLE",$this->event_obj->getPTitle());
00759                 $this->tpl->setVariable("TUTOR_NAME",$this->event_obj->getName());
00760                 $this->tpl->setVariable("TUTOR_EMAIL",$this->event_obj->getEmail());
00761                 $this->tpl->setVariable("TUTOR_PHONE",$this->event_obj->getPhone());
00762                 $this->tpl->setVariable("DETAILS",$this->event_obj->getDetails());
00763 
00764                 $this->tpl->setVariable("TXT_FURTHER_INFORMATIONS",$this->lng->txt('event_further_informations'));
00765                 $this->tpl->setVariable("TXT_FILE_NAME",$this->lng->txt('event_file_name'));
00766                 $this->tpl->setVariable("TXT_FILE",$this->lng->txt('event_file'));
00767                 $this->tpl->setVariable("FILE_HINT",$this->lng->txt('if_no_title_then_filename'));
00768                 $this->tpl->setVariable("TXT_DETAILS",$this->lng->txt('event_details_workflow'));
00769 
00770                 foreach($file_objs =& ilEventFile::_readFilesByEvent($this->event_id) as $file_obj)
00771                 {
00772                         $this->tpl->setCurrentBlock("file");
00773                         $this->tpl->setVariable("FILE_ID",$file_obj->getFileId());
00774                         $this->tpl->setVariable("DEL_FILE",$file_obj->getFileName());
00775                         $this->tpl->setVariable("TXT_DEL_FILE",$this->lng->txt('event_delete_file'));
00776                         $this->tpl->parseCurrentBlock();
00777                 }
00778                 if(count($file_objs))
00779                 {
00780                         $this->tpl->setCurrentBlock("files");
00781                         $this->tpl->setVariable("TXT_EXISTING_FILES",$this->lng->txt('event_existing_files'));
00782                         $this->tpl->parseCurrentBlock();
00783                 }
00784 
00785                 $this->tpl->setVariable("TXT_FILESIZE",ilUtil::getFileSizeInfo());
00786 
00787                 return true;
00788         }
00789 
00790         function update()
00791         {
00792                 global $ilErr;
00793 
00794                 $this->__load();
00795 
00796                 $ilErr->setMessage('');
00797                 $this->event_obj->validate();
00798                 $this->appointment_obj->validate();
00799                 $this->file_obj->validate();
00800 
00801                 if(strlen($ilErr->getMessage()))
00802                 {
00803                         sendInfo($ilErr->getMessage());
00804                         $this->edit();
00805                         return false;
00806                 }
00807                 // Update event
00808                 $this->event_obj->update();
00809 
00810                 // create appointment
00811                 $this->appointment_obj->update();
00812 
00813                 // Create file
00814                 $this->file_obj->setEventId($this->event_obj->getEventId());
00815                 $this->file_obj->create();
00816 
00817                 // Todo delete files
00818                 if(count($_POST['del_files']))
00819                 {
00820                         foreach($this->event_obj->getFiles() as $file_obj)
00821                         {
00822                                 if(in_array($file_obj->getFileId(),$_POST['del_files']))
00823                                 {
00824                                         $file_obj->delete();
00825                                 }
00826                         }
00827                 }
00828                 // Reread file objects
00829                 $this->event_obj->readFiles();
00830 
00831                 sendInfo($this->lng->txt('event_updated'));
00832                 $this->edit();
00833                 return true;
00834         }
00835 
00836         function createEvent()
00837         {
00838                 global $ilErr;
00839 
00840                 $this->__load();
00841 
00842                 $ilErr->setMessage('');
00843                 $this->event_obj->validate();
00844                 $this->appointment_obj->validate();
00845                 $this->file_obj->validate();
00846 
00847                 if(strlen($ilErr->getMessage()))
00848                 {
00849                         sendInfo($ilErr->getMessage());
00850                         $this->addEvent();
00851                         return false;
00852                 }
00853                 // Create event
00854                 $event_id = $this->event_obj->create();
00855 
00856                 // create appointment
00857                 $this->appointment_obj->setEventId($event_id);
00858                 $this->appointment_obj->create();
00859 
00860                 // Create file
00861                 $this->file_obj->setEventId($event_id);
00862                 $this->file_obj->create();
00863 
00864                 sendInfo($this->lng->txt('event_add_new_event'),true);
00865                 $this->ctrl->returnToParent($this);
00866                 return true;
00867         }
00868 
00869         function confirmDelete()
00870         {
00871                 include_once './course/classes/Event/class.ilEvent.php';
00872 
00873                 $this->tpl->addBlockFile('ADM_CONTENT','adm_content','tpl.event_delete.html','course');
00874                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00875                 $this->tpl->setVariable("TXT_EVENT_NAME",$this->lng->txt('title'));
00876                 $this->tpl->setVariable("DELETE",$this->lng->txt('delete'));
00877                 $this->tpl->setVariable("CANCEL",$this->lng->txt('cancel'));
00878                 
00879 
00880                 $events = is_array($_POST['event_ids']) ? $_POST['event_ids'] : array($this->event_id);
00881                 $_SESSION['event_del'] = $events;
00882                 $counter = 0;
00883                 foreach($events as $event)
00884                 {
00885                         $event_obj = new ilEvent($event);
00886                         if(strlen($desc = $event_obj->getDescription()))
00887                         {
00888                                 $this->tpl->setCurrentBlock("desc");
00889                                 $this->tpl->setVariable("DESCRIPTION",$desc);
00890                                 $this->tpl->parseCurrentBlock();
00891                         }
00892                         $this->tpl->setCurrentBlock("events");
00893                         $this->tpl->setVariable("CSS_ROW",ilUtil::switchColor($counter++,'tblrow1','tblrow2'));
00894                         $this->tpl->setVariable("EVENT_NAME",$event_obj->getTitle());
00895                         $this->tpl->parseCurrentBlock();
00896                 }
00897                 sendInfo($this->lng->txt('event_delete_sure'));
00898                 return true;
00899         }
00900 
00901         function delete()
00902         {
00903                 include_once './course/classes/Event/class.ilEvent.php';
00904 
00905                 if(!is_array($_SESSION['event_del']))
00906                 {
00907                         sendInfo($this->lng->txt('event_none_selected'));
00908                         $this->ctrl->returnToParent($this);
00909                         return false;
00910                 }
00911                 foreach($_SESSION['event_del'] as $event_id)
00912                 {
00913                         ilEvent::_delete($event_id);
00914                 }
00915 
00916                 sendInfo($this->lng->txt('events_deleted'),true);
00917                 $this->ctrl->returnToParent($this);
00918 
00919                 return true;
00920         }
00921 
00922 
00923         function __load()
00924         {
00925                 $this->appointment_obj->setStartingTime($this->__toUnix($_POST['event_date'],$_POST['event_time_start']));
00926                 $this->appointment_obj->setEndingTime($this->__toUnix($_POST['event_end_date'],$_POST['event_time_end']));
00927                 $this->appointment_obj->toggleFullTime((bool) $_POST['fulltime']);
00928 
00929                 $this->file_obj = new ilEventFile();
00930                 $this->file_obj->setFileName(strlen($_POST['file_name']) ?
00931                                                            ilUtil::stripSlashes($_POST['file_name']) :
00932                                                            $_FILES['file']['name']);
00933                 $this->file_obj->setFileSize($_FILES['file']['size']);
00934                 $this->file_obj->setFileType($_FILES['file']['type']);
00935                 $this->file_obj->setTemporaryName($_FILES['file']['tmp_name']);
00936                 $this->file_obj->setErrorCode($_FILES['file']['error']);
00937                                                            
00938                 
00939 
00940                 $this->event_obj->setTitle(ilUtil::stripSlashes($_POST['title']));
00941                 $this->event_obj->setDescription(ilUtil::stripSlashes($_POST['desc']));
00942                 $this->event_obj->setLocation(ilUtil::stripSlashes($_POST['location']));
00943                 #$this->event_obj->setFirstname(ilUtil::stripSlashes($_POST['tutor_firstname']));
00944                 $this->event_obj->setName(ilUtil::stripSlashes($_POST['tutor_name']));
00945                 #$this->event_obj->setPTitle(ilUtil::stripSlashes($_POST['tutor_title']));
00946                 $this->event_obj->setEmail(ilUtil::stripSlashes($_POST['tutor_email']));
00947                 $this->event_obj->setPhone(ilUtil::stripSlashes($_POST['tutor_phone']));
00948                 $this->event_obj->setDetails(ilUtil::stripSlashes($_POST['details']));
00949                 $this->event_obj->enableRegistration((int) $_POST['registration']);
00950                 $this->event_obj->enableParticipation((int) $_POST['participance']);
00951         }
00952 
00953 
00954         function __initCourseObject()
00955         {
00956                 global $tree;
00957 
00958                 if($this->container_obj->getType() == 'crs')
00959                 {
00960                         // Container is course
00961                         $this->course_obj =& $this->container_obj;
00962                 }
00963                 else
00964                 {
00965                         $course_ref_id = $tree->checkForParentType($this->container_obj->getRefId(),'crs');
00966                         $this->course_obj =& ilObjectFactory::getInstanceByRefId($course_ref_id);
00967                 }
00968                 return true;
00969         }
00970 
00971         function __initEventObject()
00972         {
00973                 if(!is_object($this->event_obj))
00974                 {
00975                         include_once 'course/classes/Event/class.ilEvent.php';
00976 
00977                         $this->event_obj = new ilEvent($this->event_id);
00978                         $this->event_obj->setObjId($this->container_obj->getId());
00979 
00980                         if(!is_object($this->appointment_obj))
00981                         {
00982                                 $this->appointment_obj =& $this->event_obj->getFirstAppointment();
00983                         }
00984                 }
00985                 return true;
00986         }
00987 
00988         function __prepareDateSelect($a_unix_time)
00989         {
00990                 return array('y' => date('Y',$a_unix_time),
00991                                          'm' => date('m',$a_unix_time),
00992                                          'd' => date('d',$a_unix_time));
00993         }
00994         function __prepareTimeSelect($a_unix_time)
00995         {
00996                 return array('h' => date('G',$a_unix_time),
00997                                          'm' => date('i',$a_unix_time),
00998                                          's' => date('s',$a_unix_time));
00999         }
01000         function __toUnix($date,$time)
01001         {
01002                 return mktime($time['h'],$time['m'],0,$date['m'],$date['d'],$date['y']);
01003         }
01004 
01005         function __formatPath($a_ref_id)
01006         {
01007                 global $tree;
01008 
01009                 $path = $this->lng->txt('path') . ': ';
01010                 $first = true;
01011                 foreach($tree->getPathFull($a_ref_id,$this->course_obj->getRefId()) as $node)
01012                 {
01013                         if($node['ref_id'] != $a_ref_id)
01014                         {
01015                                 if(!$first)
01016                                 {
01017                                         $path .= ' -> ';
01018                                 }
01019                                 $first = false;
01020                                 $path .= $node['title'];
01021                         }
01022                 }
01023                 return $path;
01024         }
01025                         
01026 
01027 } // END class.ilCourseContentGUI
01028 ?>

Generated on Fri Dec 13 2013 13:52:10 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1