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

Modules/MediaCast/classes/class.ilObjMediaCast.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 
00024 require_once "./classes/class.ilObject.php";
00025 
00033 class ilObjMediaCast extends ilObject
00034 {
00035         protected $online = false;
00036         protected $publicfiles = false;
00037         
00044         function ilObjMediaCast($a_id = 0,$a_call_by_reference = true)
00045         {
00046                 $this->type = "mcst";
00047                 $this->ilObject($a_id,$a_call_by_reference);
00048         }
00049 
00055         function setOnline($a_online)
00056         {
00057                 $this->online = $a_online;
00058         }
00059 
00065         function getOnline()
00066         {
00067                 return $this->online;
00068         }
00069 
00075         function setPublicFiles($a_publicfiles)
00076         {
00077                 $this->publicfiles = $a_publicfiles;
00078         }
00079 
00085         function getPublicFiles()
00086         {
00087                 return $this->publicfiles;
00088         }
00089 
00095         function setItemsArray($a_itemsarray)
00096         {
00097                 $this->itemsarray = $a_itemsarray;
00098         }
00099 
00105         function getItemsArray()
00106         {
00107                 return $this->itemsarray;
00108         }
00109 
00113         function create()
00114         {
00115                 global $ilDB;
00116 
00117                 parent::create();
00118                 
00119                 $query = "INSERT INTO il_media_cast_data (".
00120                         " id".
00121                         ", online".
00122                         ", public_files".
00123                         " ) VALUES (".
00124                         $ilDB->quote($this->getId())
00125                         .",".$ilDB->quote($this->getOnline())
00126                         .",".$ilDB->quote($this->getPublicFiles())
00127                         .")";
00128                 $ilDB->query($query);
00129 
00130         }
00131 
00138         function update()
00139         {
00140                 global $ilDB;
00141                 
00142                 if (!parent::update())
00143                 {                       
00144                         return false;
00145                 }
00146 
00147                 // update media cast data
00148                 $query = "UPDATE il_media_cast_data SET ".
00149                         " online = ".$ilDB->quote($this->getOnline()).
00150                         ", public_files = ".$ilDB->quote($this->getPublicFiles()).
00151                         " WHERE id = ".$ilDB->quote($this->getId());
00152                 $ilDB->query($query);
00153 
00154                 return true;
00155         }
00156         
00160         function read()
00161         {
00162                 global $ilDB;
00163                 
00164                 parent::read();
00165                 $this->readItems();
00166                 
00167                 $query = "SELECT * FROM il_media_cast_data WHERE id = ".
00168                         $ilDB->quote($this->getId());
00169                 $set = $ilDB->query($query);
00170                 $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
00171 
00172                 $this->setOnline($rec["online"]);
00173                 $this->setPublicFiles($rec["public_files"]);
00174 
00175         }
00176 
00177 
00184         function delete()
00185         {
00186                 global $ilDB;
00187                 
00188                 // always call parent delete function first!!
00189                 if (!parent::delete())
00190                 {
00191                         return false;
00192                 }
00193                 
00194                 // delete all items
00195                 $med_items = $this->getItemsArray();
00196                 foreach ($med_items as $item)
00197                 {
00198                         include_once("./Services/News/classes/class.ilNewsItem.php");
00199                         $news_item = new ilNewsItem($item["id"]);
00200                         $news_item->delete();
00201                 }
00202                 
00203                 // delete record of table il_media_cast_data
00204                 $query = "DELETE FROM il_media_cast_data".
00205                         " WHERE id = ".$ilDB->quote($this->getId());
00206                 $ilDB->query($query);
00207                 
00208                 return true;
00209         }
00210 
00220         function initDefaultRoles()
00221         {
00222                 global $rbacadmin;
00223                 
00224                 // create a local role folder
00225                 //$rfoldObj = $this->createRoleFolder("Local roles","Role Folder of forum obj_no.".$this->getId());
00226 
00227                 // create moderator role and assign role to rolefolder...
00228                 //$roleObj = $rfoldObj->createRole("Moderator","Moderator of forum obj_no.".$this->getId());
00229                 //$roles[] = $roleObj->getId();
00230 
00231                 //unset($rfoldObj);
00232                 //unset($roleObj);
00233 
00234                 return $roles ? $roles : array();
00235         }
00236 
00250         function notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params = 0)
00251         {
00252                 global $tree;
00253                 
00254                 switch ($a_event)
00255                 {
00256                         case "link":
00257                                 
00258                                 //var_dump("<pre>",$a_params,"</pre>");
00259                                 //echo "Module name ".$this->getRefId()." triggered by link event. Objects linked into target object ref_id: ".$a_ref_id;
00260                                 //exit;
00261                                 break;
00262                         
00263                         case "cut":
00264                                 
00265                                 //echo "Module name ".$this->getRefId()." triggered by cut event. Objects are removed from target object ref_id: ".$a_ref_id;
00266                                 //exit;
00267                                 break;
00268                                 
00269                         case "copy":
00270                         
00271                                 //var_dump("<pre>",$a_params,"</pre>");
00272                                 //echo "Module name ".$this->getRefId()." triggered by copy event. Objects are copied into target object ref_id: ".$a_ref_id;
00273                                 //exit;
00274                                 break;
00275 
00276                         case "paste":
00277                                 
00278                                 //echo "Module name ".$this->getRefId()." triggered by paste (cut) event. Objects are pasted into target object ref_id: ".$a_ref_id;
00279                                 //exit;
00280                                 break;
00281                         
00282                         case "new":
00283                                 
00284                                 //echo "Module name ".$this->getRefId()." triggered by paste (new) event. Objects are applied to target object ref_id: ".$a_ref_id;
00285                                 //exit;
00286                                 break;
00287                 }
00288 
00289                 // At the beginning of the recursive process it avoids second call of the notify function with the same parameter
00290                 if ($a_node_id==$_GET["ref_id"])
00291                 {
00292                         $parent_obj =& $this->ilias->obj_factory->getInstanceByRefId($a_node_id);
00293                         $parent_type = $parent_obj->getType();
00294                         if($parent_type == $this->getType())
00295                         {
00296                                 $a_node_id = (int) $tree->getParentId($a_node_id);
00297                         }
00298                 }
00299                 
00300                 parent::notify($a_event,$a_ref_id,$a_parent_non_rbac_id,$a_node_id,$a_params);
00301         }
00302 
00306         function readItems()
00307         {
00308                 global $ilDB;
00309                 
00310                 //
00311                 include_once("./Services/News/classes/class.ilNewsItem.php");
00312                 $it = new ilNewsItem();
00313                 $it->setContextObjId($this->getId());
00314                 $it->setContextObjType($this->getType());
00315                 $this->itemsarray = $it->queryNewsForContext(false);
00316                 
00317                 return $this->itemsarray;
00318         }
00319         
00320         
00321 } // END class.ilObjMediaCast
00322 ?>

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