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

ilinc/classes/class.ilObjiLincClassroomGUI.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 
00034 require_once "./classes/class.ilObjectGUI.php";
00035 
00036 class ilObjiLincClassroomGUI extends ilObjectGUI
00037 {
00042         function ilObjiLincClassroomGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output = true)
00043         {
00044                 $this->type = "icla";
00045                 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,$a_prepare_output);
00046                 
00047                 //$this->ctrl =& $ilCtrl;
00048                 $this->ctrl->saveParameter($this,'ref_id');
00049         }
00050         
00051         function createObject()
00052         {
00053                 global $rbacsystem;
00054 
00055                 $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
00056 
00057                 /*if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
00058                 {
00059                         $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00060                 }
00061                 else*/
00062                 {
00063                         // fill in saved values in case of error
00064                         $data = array();
00065                         $data["fields"] = array();
00066                         $data["fields"]["title"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["title"],true);
00067                         $data["fields"]["desc"] = ilUtil::stripSlashes($_SESSION["error_post_vars"]["Fobject"]["desc"]);
00068                         $data["fields"]["homepage"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["homepage"],true);
00069                         $data["fields"]["download"] = ilUtil::prepareFormOutput($_SESSION["error_post_vars"]["Fobject"]["download"],true);
00070 
00071                         $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icrs_edit.html","ilinc");
00072                         
00073                         $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
00074                         $this->tpl->setVariable("TITLE", $data["fields"]["title"]);
00075                         $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
00076                         $this->tpl->setVariable("DESC", $data["fields"]["desc"]);
00077                         $this->tpl->setVariable("TXT_HOMEPAGE_URL", $this->lng->txt("homepage_url"));
00078                         $this->tpl->setVariable("HOMEPAGE_URL", $data["fields"]["homepage"]);
00079                         $this->tpl->setVariable("TXT_DOWNLOAD_RESOURCES_URL", $this->lng->txt("download_resources_url"));
00080                         $this->tpl->setVariable("DOWNLOAD_RESOURCES_URL", $data["fields"]["download"]);
00081                         $this->tpl->setVariable("TXT_NOT_YET", $this->lng->txt("not_implemented_yet"));
00082 
00083                         $this->tpl->setVariable("FORMACTION", $this->getFormAction("save","adm_object.php?cmd=gateway&ref_id=".
00084                                                                                                                                            $_GET["ref_id"]."&new_type=".$new_type));
00085                         $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($new_type."_new"));
00086                         $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00087                         $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($new_type."_add"));
00088                         $this->tpl->setVariable("CMD_SUBMIT", "save");
00089                         $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00090                         $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00091                 }
00092         }
00093 
00098         function saveObject()
00099         {
00100                 global $rbacadmin;
00101                 
00102                 include_once "class.ilObjiLincClassroom.php";
00103                 $icrs_id = ilObjiLincClassroom::_lookupiCourseId($_GET['ref_id']);
00104                 
00105                 include "class.ilnetucateXMLAPI.php";
00106                 $ilinc = new ilnetucateXMLAPI();
00107                 $ilinc->addClass($_POST['Fobject'],$icrs_id);
00108                 $response = $ilinc->sendRequest('addClass');
00109                 
00110                 if ($response->isError())
00111                 {
00112                         $this->ilErr->raiseError($response->getErrorMsg(),$this->ilErr->MESSAGE);
00113                 }
00114 
00115                 // create and insert forum in objecttree
00116                 $iClaObj = parent::saveObject();
00117                 
00118                 $iClaObj->saveID($response->getFirstID(),$icrs_id);
00119 
00120                 // always send a message
00121                 sendInfo($response->getResultMsg(),true);
00122                 
00123                 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00124         }
00125         
00126         function joinObject()
00127         {
00128                 // check if user is registered at iLinc server
00129                 if (!$this->object->isRegisteredAtiLincServer($this->ilias->account))
00130                 {
00131                         // check if user is already added to ilinc server
00132                         //if (!$this->object->findUser($this->ilias->account))
00133                         //{
00134                                 // add user first to iLinc servr
00135                                 $ilinc_user_id = $this->object->addUser($this->ilias->account);
00136                         //}
00137                 }
00138 
00139                 // check if user is already member of icourse
00140                 if (!$this->object->isMember($this->ilias->account->getiLincID(),$this->ilinc_course_id))
00141                 {
00142                         // then assign membership to icourse
00143                                 $this->object->registerUser($this->ilias->account,$this->object->ilinc_course_id,"True");
00144                 }
00145 
00146 
00147                 // join class
00148                 $url = $this->object->joinClass($this->ilias->account,$this->object->ilinc_id);
00149                 ilUtil::redirect(trim($url));
00150         }
00151         
00157         function getTabs(&$tabs_gui)
00158         {
00159                 // tabs are defined manually here. The autogeneration via objects.xml will be deprecated in future
00160                 // for usage examples see ilObjGroupGUI or ilObjSystemFolderGUI
00161         }
00162 } // END class.ilObjiLincClassroomGUI
00163 ?>

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1