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

ilinc/classes/class.ilObjiLincCourse.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2005 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.ilObject.php";
00035 
00036 class ilObjiLincCourse extends ilObject
00037 {
00044         function ilObjiLincCourse($a_id = 0,$a_call_by_reference = true)
00045         {
00046                 $this->type = "icrs";
00047                 $this->ilObject($a_id,$a_call_by_reference);
00048         }
00049         
00054         function read()
00055         {
00056                 parent::read();
00057                 
00058                 // TODO: fetching default role should be done in rbacadmin
00059                 $q = "SELECT * FROM ilinc_data ".
00060                          "WHERE obj_id='".$this->id."'";
00061                 $r = $this->ilias->db->query($q);
00062 
00063                 if ($r->numRows() > 0)
00064                 {
00065                         $data = $r->fetchRow(DB_FETCHMODE_OBJECT);
00066 
00067                         // fill member vars in one shot
00068                         $this->ilinc_id = $data->course_id;
00069                 }
00070                 else
00071                 {
00072                          $this->ilias->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $this->ilias->FATAL);
00073                 }
00074         }
00075 
00082         function update()
00083         {
00084                 if (!parent::update())
00085                 {                       
00086                         return false;
00087                 }
00088 
00089                 // put here object specific stuff
00090                 
00091                 return true;
00092         }
00093         
00101         function ilClone($a_parent_ref)
00102         {               
00103                 global $rbacadmin;
00104 
00105                 // always call parent clone function first!!
00106                 $new_ref_id = parent::ilClone($a_parent_ref);
00107                 
00108                 // get object instance of cloned object
00109                 //$newObj =& $this->ilias->obj_factory->getInstanceByRefId($new_ref_id);
00110 
00111                 // create a local role folder & default roles
00112                 //$roles = $newObj->initDefaultRoles();
00113 
00114                 // ...finally assign role to creator of object
00115                 //$rbacadmin->assignUser($roles[0], $newObj->getOwner(), "n");          
00116 
00117                 // always destroy objects in clone method because clone() is recursive and creates instances for each object in subtree!
00118                 //unset($newObj);
00119 
00120                 // ... and finally always return new reference ID!!
00121                 return $new_ref_id;
00122         }
00123 
00130         function delete()
00131         {               
00132                 // always call parent delete function first!!
00133                 if (!parent::delete())
00134                 {
00135                         return false;
00136                 }
00137                 
00138                 //put here your module specific stuff
00139                 $q = "DELETE FROM ilinc_data WHERE course_id='".$this->ilinc_id."'";
00140                 $this->ilias->db->query($q);
00141                 
00142                 include_once "class.ilnetucateXMLAPI.php";
00143                 $ilinc = new ilnetucateXMLAPI();
00144                 $ilinc->removeCourse($this->ilinc_id);
00145                 $response = $ilinc->sendRequest();
00146                 
00147                 return true;
00148         }
00149         
00150         function saveID($a_icrs_id)
00151         {
00152                 $q = "INSERT INTO ilinc_data (obj_id,type,course_id,class_id) VALUES (".$this->id.",'icrs','".$a_icrs_id."',null)";
00153                 $this->ilias->db->query($q);
00154         }
00155         
00165         function initDefaultRoles()
00166         {
00167                 global $rbacadmin;
00168                 
00169                 // create a local role folder
00170                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00171 
00172                 // create moderator role and assign role to rolefolder...
00173                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00174                 //$roles[] = $roleObj->getId();
00175 
00176                 //unset($rfoldObj);
00177                 //unset($roleObj);
00178 
00179                 return $roles ? $roles : array();
00180         }
00181 
00195         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00196         {
00197                 return true;
00198         }
00199 } // END class.ilObjiLincCourse
00200 ?>

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