Пример #1
0
 /**
  * delete object and all related data	
  *
  * @access	public
  * @return	boolean	true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     //put here your module specific stuff
     // delete feed block
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType($this->getType());
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Block/classes/class.ilExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "feed") {
             $fb = new ilExternalFeedBlock($c_block["id"]);
             $fb->delete();
             include_once "./Services/Block/classes/class.ilBlockSetting.php";
             ilBlockSetting::_deleteSettingsOfBlock($c_block["id"], "feed");
         }
     }
     //ilBlockSetting::_lookupSide($type, $user_id, $c_block["id"]);
     return true;
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     //echo $a_entity;
     //var_dump($a_rec);
     switch ($a_entity) {
         case "feed":
             include_once "./Modules/ExternalFeed/classes/class.ilObjExternalFeed.php";
             if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjExternalFeed();
                 $newObj->setType("feed");
                 $newObj->create(true);
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Url"]);
             $newObj->update();
             $this->current_obj = $newObj;
             $a_mapping->addMapping("Modules/ExternalFeed", "feed", $a_rec["Id"], $newObj->getId());
             // create the feed block
             include_once "./Services/Block/classes/class.ilExternalFeedBlock.php";
             $fb = new ilExternalFeedBlock();
             $fb->setTitle($a_rec["Title"]);
             $fb->setFeedUrl($a_rec["Url"]);
             $fb->setContextObjId($newObj->getId());
             $fb->setContextObjType("feed");
             $fb->create();
             break;
     }
 }