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

ilinc/classes/class.ilObjiLincUserGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 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 
00024 
00035 require_once ('class.ilnetucateXMLAPI.php');
00036 require_once ('class.ilObjiLincUser.php');
00037 
00038 class ilObjiLincUserGUI
00039 {
00047         function ilObjiLincUserGUI(&$a_user_obj,&$a_usrf_ref_id)
00048         {
00049                 global $ilias, $tpl, $ilCtrl, $ilErr, $lng;
00050 
00051                 if (!isset($ilErr))
00052                 {
00053                         $ilErr = new ilErrorHandling();
00054                         $ilErr->setErrorHandling(PEAR_ERROR_CALLBACK,array($ilErr,'errorHandler'));
00055                 }
00056                 else
00057                 {
00058                         $this->ilErr =& $ilErr;
00059                 }
00060 
00061                 $this->ilias =& $ilias;
00062                 $this->tpl =& $tpl;
00063                 $this->lng =& $lng;
00064                 $this->ctrl =& $ilCtrl;
00065                 
00066                 $this->lng->loadLanguageModule('ilinc');
00067                 
00068                 $this->usrf_ref_id =& $a_usrf_ref_id;
00069                 
00070                 $this->user =& $a_user_obj;
00071                 
00072                 $this->ilinc_user = new ilObjiLincUser($a_user_obj);
00073         }
00074         
00075         function &executeCommand()
00076         {
00077                 global $rbacsystem, $ilErr;
00078 
00079                 // User folder
00080                 if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
00081                 {
00082                         $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00083                 }
00084                 // if called from local administration $this->usrf_ref_id is category id 
00085                 // Todo: this has to be fixed. Do not mix user folder id and category id
00086                 if($this->usrf_ref_id != USER_FOLDER_ID)
00087                 {
00088                         // check if user is assigned to category
00089                         if(!$rbacsystem->checkAccess('cat_administrate_users',$this->user->getTimeLimitOwner()))
00090                         {
00091                                 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00092                         }
00093                 }
00094 
00095                 $next_class = $this->ctrl->getNextClass($this);
00096 
00097                 switch($next_class)
00098                 {
00099                         default:
00100                                 $cmd = $this->ctrl->getCmd();
00101                                 
00102                                 if ($cmd == '')
00103                                 {
00104                                         $cmd = "view";
00105                                 }
00106 
00107                                 $this->$cmd();
00108                                 break;
00109                 }
00110 
00111                 return true;
00112         }
00113         
00114         function view()
00115         {
00116                 // return iLinc user account data if user already exists on iLinc server
00117                 if ($this->ilinc_user->id)
00118                 {
00119                         if (!$data = $this->ilinc_user->find($this->ilinc_user->id))
00120                         {
00121                                 $this->ilErr->raiseError($this->ilinc_user->getErrorMsg(),$this->ilErr->MESSAGE);
00122                         }
00123                         
00124                         $this->ilinc_user->setVar('akuservalue1',$data['users'][$this->ilinc_user->id]['akuservalue1']);
00125                         $this->ilinc_user->setVar('akuservalue2',$data['users'][$this->ilinc_user->id]['akuservalue2']);
00126                 }
00127         
00128                 if (!$this->ilinc_user->id)
00129                 {
00130                         $ilinc_id = $this->lng->txt("ilinc_no_account_yet");
00131                         $ilinc_login = $ilinc_id;
00132                         $ilinc_passwd = $ilinc_id;
00133                         
00134                         $submit_button_title = $this->lng->txt("ilinc_add_user");
00135                 }
00136                 else
00137                 {
00138                         $ilinc_id = $this->ilinc_user->id;
00139                         $ilinc_login = $this->ilinc_user->login;
00140                         $ilinc_passwd = $this->ilinc_user->passwd;
00141                         
00142                         $submit_button_title = $this->lng->txt("refresh");
00143                 }
00144                 
00145                 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.icrs_usr_edit.html","ilinc");
00146                 
00147                 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00148                 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("ilinc_user_settings"));
00149                 $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
00150                 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00151 
00152                 $this->tpl->setVariable("TXT_SUBMIT", $submit_button_title);
00153                 $this->tpl->setVariable("CMD_SUBMIT", "save");
00154                 
00155                 $this->tpl->setVariable("TXT_ILINC_ID", $this->lng->txt("ilinc_user_id"));
00156                 $this->tpl->setVariable("ILINC_ID", $ilinc_id);
00157                 $this->tpl->setVariable("TXT_ILINC_LOGIN", $this->lng->txt("login"));
00158                 $this->tpl->setVariable("ILINC_LOGIN", $ilinc_login);
00159                 /*
00160                 $this->tpl->setVariable("TXT_ILINC_PASSWD", $this->lng->txt("passwd"));
00161                 $this->tpl->setVariable("ILINC_PASSWD", $ilinc_passwd);
00162                 */
00163                 
00164                 $this->tpl->setVariable("TXT_ILINC_AKUSERVALUES", $this->lng->txt("ilinc_akuservalues"));
00165                 $this->tpl->setVariable("TXT_ILINC_AKUSERVALUES_DESC", $this->lng->txt("ilinc_akuservalues_desc"));
00166                 $this->tpl->setVariable("TXT_ILINC_AKUSERVALUE1", $this->lng->txt("ilinc_akuservalue1"));
00167                 $this->tpl->setVariable("ILINC_AKUSERVALUE1", $this->ilinc_user->akuservalue1);
00168                 $this->tpl->setVariable("TXT_ILINC_AKUSERVALUE2", $this->lng->txt("ilinc_akuservalue2"));
00169                 $this->tpl->setVariable("ILINC_AKUSERVALUE2", $this->ilinc_user->akuservalue2);
00170         }
00171 
00172         function cancel()
00173         {
00174                 session_unregister("saved_post");
00175 
00176                 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
00177 
00178                 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
00179                 {
00180                         $this->ctrl->redirectByClass("ilobjusergui", "view");
00181                 }
00182                 else
00183                 {
00184                         $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
00185                 }
00186         }
00187         
00188         function save()
00189         {
00190                 if (!$this->ilinc_user->id)
00191                 {
00192                         $this->ilinc_user->setVar('akuservalue1',$_POST['Fobject']['ilinc_akuservalue1']);
00193                         $this->ilinc_user->setVar('akuservalue2',$_POST['Fobject']['ilinc_akuservalue2']);
00194                         
00195                         if (!$this->ilinc_user->add())
00196                         {
00197                                 $this->ilErr->raiseError($this->ilinc_user->getErrorMsg(),$this->ilErr->MESSAGE);
00198                         }
00199 
00200                         $info_message = $this->lng->txt("ilinc_user_added");
00201                 }
00202                 else
00203                 {
00204                         $this->ilinc_user->setVar('akuservalue1',$_POST['Fobject']['ilinc_akuservalue1']);
00205                         $this->ilinc_user->setVar('akuservalue2',$_POST['Fobject']['ilinc_akuservalue2']);
00206 
00207                         if (!$this->ilinc_user->edit())
00208                         {
00209                                 $this->ilErr->raiseError($this->ilinc_user->getErrorMsg(),$this->ilErr->MESSAGE);
00210                         }
00211                         
00212                         $info_message = $this->lng->txt("ilinc_akuservalues_refreshed");
00213                 }
00214                 
00215                 ilUtil::sendInfo($info_message,true);
00216 
00217                 $this->ctrl->redirectByClass("ilobjilincusergui", "view");
00218         }
00219         
00220         // init sub tabs
00221         // not used yet
00222         function __initSubTabs($a_cmd)
00223         {
00224                 global $ilTabs;
00225 
00226                 $perm = ($a_cmd == 'perm') ? true : false;
00227                 $info = ($a_cmd == 'info') ? true : false;
00228                 $owner = ($a_cmd == 'owner') ? true : false;
00229 
00230                 $ilTabs->addSubTabTarget("permission_settings", $this->ctrl->getLinkTarget($this, "perm"),
00231                                                                  "", "", "", $perm);
00232                 $ilTabs->addSubTabTarget("info_status_info", $this->ctrl->getLinkTarget($this, "info"),
00233                                                                  "", "", "", $info);
00234                 $ilTabs->addSubTabTarget("owner", $this->ctrl->getLinkTarget($this, "owner"),
00235                                                                  "", "", "", $owner);
00236         }
00237 } // END class.ilObjiLincUserGUI
00238 ?>

Generated on Fri Dec 13 2013 17:56:49 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1