Go to the documentation of this file.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 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
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
00058
00059
00060
00061
00062 {
00063
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
00116 $iClaObj = parent::saveObject();
00117
00118 $iClaObj->saveID($response->getFirstID(),$icrs_id);
00119
00120
00121 sendInfo($response->getResultMsg(),true);
00122
00123 ilUtil::redirect($this->getReturnLocation("save",$this->ctrl->getLinkTarget($this,"")));
00124 }
00125
00126 function joinObject()
00127 {
00128
00129 if (!$this->object->isRegisteredAtiLincServer($this->ilias->account))
00130 {
00131
00132
00133
00134
00135 $ilinc_user_id = $this->object->addUser($this->ilias->account);
00136
00137 }
00138
00139
00140 if (!$this->object->isMember($this->ilias->account->getiLincID(),$this->ilinc_course_id))
00141 {
00142
00143 $this->object->registerUser($this->ilias->account,$this->object->ilinc_course_id,"True");
00144 }
00145
00146
00147
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
00160
00161 }
00162 }
00163 ?>