{
            $this->cdata = trim($this->cdata);
                $arrayname = strtolower($this->entity).'Array';
                $x = &$this->$arrayname;
                switch($a_name)
                {
                        case 'Forum':
                                $query_num_posts = "SELECT COUNT(pos_pk) cnt
                                                                                FROM frm_posts
                                                                        WHERE pos_top_fk = ".$ilDB->quote(
                                                                                $this->lastHandledForumId, 'integer');
                                $res_pos        = $ilDB->query($query_num_posts);
                                $data_pos       = $ilDB->fetchAssoc($res_pos);
                                $num_posts  = $data_pos['cnt'];
                                $query_num_threads = "SELECT COUNT(thr_pk) cnt
                                                                                FROM frm_threads
                                                                          WHERE thr_top_fk = ".$ilDB->quote(
                                                                                $this->lastHandledForumId, 'integer');
                                $res_thr          = $ilDB->query($query_num_threads);
                                $data_thr         = $ilDB->fetchAssoc($res_thr);
                                $num_threads  = $data_thr['cnt'];
                                $update_str       = "$this->lastHandledForumId#$this->lastHandledThreadId#$this->lastHandledPostId";
                                $ilDB->manipulateF(
                                        "UPDATE frm_data 
                                                SET top_last_post = %s,
                                                        top_num_posts = %s,
                                                        top_num_threads = %s
                                        WHERE top_frm_fk = %s",
                                        array('text', 'integer', 'integer', 'integer'),
                                        array($update_str, $num_posts, $num_threads, $this->forum_obj_id)
                                );
                                break;
                        case 'Id':
                                $x['Id'] = $this->cdata;
                                break;
                        
                        case 'ObjId':
                                $x['ObjId'] = $this->cdata;
                                break;
                        
                        case 'Title':                           
                                $x['Title'] = $this->cdata;
                                break;
                        
                        case 'Description':
                                $x['Description'] = $this->cdata;
                                break;
                        
                        case 'DefaultView':
                                $x['DefaultView'] = $this->cdata;
                                break;
                        
                        case 'Pseudonyms':
                                $x['Pseudonyms'] = $this->cdata;
                                break;
                        
                        case 'Statistics':
                                $x['Statistics'] = $this->cdata;
                                break;
                        
                        case 'PostingActivation':
                                $x['PostingActivation'] = $this->cdata;
                                break;
                        
                        case 'PresetSubject':
                                $x['PresetSubject'] = $this->cdata;
                                break;
                        
                        case 'PresetRe':
                                $x['PresetRe'] = $this->cdata;
                                break;
                        
                        case 'NotificationType':
                                $x['NotificationType'] = $this->cdata;
                                break;
                        
                        case 'ForceNotification':
                                $x['ForceNotification'] = $this->cdata;
                                break;
                        
                        case 'ToggleNotification':
                                $x['ToggleNotification'] = $this->cdata;
                                break;
                        
                        case 'LastPost':
                                $x['LastPost'] = $this->cdata;
                                break;
                        
                        case 'Moderator':
                                $x['Moderator'] = $this->cdata;
                                break;
                        
                        case 'CreateDate':
                                $x['CreateDate'] = $this->cdata;
                                break;
                        
                        case 'UpdateDate':
                                $x['UpdateDate'] = $this->cdata;
                                break;
                        
                        case 'UpdateUserId':
                                $x['UpdateUserId'] = $this->cdata;
                                break;
                        
                        case 'UserId':
                                $x['UserId'] = $this->cdata;
                                if( $this->entity == 'forum' && $this->forumArray )
                                {
                                        
                                        
                                        $this->forum->createSettings();
                                                $this->forumArray['UserId'], ''
                                        );
                                        
                                        $oldUsrId = $ilUser->getId();
                                        
                                        $ilUser->setId($forum_array['usr_id']);
                                        
                                        $this->forum->saveData( array() );
                                        
                                        $ilUser->setId($oldUsrId);
                                                $this->forumArray['UpdateUserId'], ''
                                        );
                                        
                                        
                                        $_SESSION[
"AccountId"] = $update_forum_array[
'usr_id'];
 
                                        $this->forum->setTitle($this->forumArray["Title"]);
                                        $this->forum->setDescription($this->forumArray["Description"]);
                                        $this->forum->update();
                                        
                                        
                                                        $this->forum->getId() );
                                        $newObjProp->setDefaultView(
                                                        (int) $this->forumArray['DefaultView'] );
                                        $newObjProp->setAnonymisation(
                                                        (int) $this->forumArray['Pseudonyms'] );
                                        $newObjProp->setStatisticsStatus(
                                                        (int) $this->forumArray['Statistics'] );
                                        $newObjProp->setPostActivation(
                                                        (int) $this->forumArray['PostingActivation'] );
                                        $newObjProp->setPresetSubject(
                                                        (int) $this->forumArray['PresetSubject'] );
                                        $newObjProp->setAddReSubject(
                                                        (int) $this->forumArray['PresetRe'] );
                                        $newObjProp->setNotificationType(
                                                        $this->forumArray['NotificationType'] ?
                                                        $this->forumArray['NotificationType'] : 'all_users');
                                        $newObjProp->setAdminForceNoti(
                                                        (int) $this->forumArray['ForceNotification'] );
                                        $newObjProp->setUserToggleNoti(
                                                        (int) $this->forumArray['ToggleNotification'] );
                                        $newObjProp->insert();
                                        $this->forum_obj_id = $newObjProp->getObjId();
                                        $this->mapping['frm'][$this->forumArray['Id']] = $id;
                                        $this->lastHandledForumId = $id;
                                        unset($this->forumArray);
                                }
                                
                                break;
                        case 'Thread':
                                $update_str       = "$this->lastHandledForumId#$this->lastHandledThreadId#$this->lastHandledPostId";
                                $ilDB->manipulateF(
                                        "UPDATE frm_threads
                                                SET thr_last_post = %s
                                        WHERE thr_pk = %s",
                                        array('text', 'integer'),
                                        array($update_str, $this->lastHandledThreadId)
                                );
                                break;
                        
                        case 'Subject':
                                $x['Subject'] = $this->cdata;
                                break;
                        case 'Alias':
                                $x['Alias'] = $this->cdata;
                                break;
                        case 'Sticky':
                                $x['Sticky'] = $this->cdata;
                                break;
                        case 'Closed':
                                $x['Closed'] = $this->cdata;
                                if($this->entity == 'thread' && $this->threadArray)
                                {
                                        require_once 'Modules/Forum/classes/class.ilForumTopic.php';
                                        $this->forumThread->setId($this->threadArray['Id']);
                                        $this->forumThread->setForumId( $this->lastHandledForumId );
                                        $this->forumThread->setSubject($this->threadArray['Subject']);
                                        $this->forumThread->setSticky($this->threadArray['Sticky']);
                                        $this->forumThread->setClosed($this->threadArray['Closed']);
                                        $this->forumThread->setCreateDate($this->threadArray['CreateDate']);
                                        $this->forumThread->setChangeDate($this->threadArray['UpdateDate']);
                                        $this->forumThread->setImportName($this->threadArray['ImportName']);
                                        
                                                $this->threadArray['UserId'], $this->threadArray['Alias']
                                        );
                                        $this->forumThread->setUserId($usr_data['usr_id']);
                                        $this->forumThread->setUserAlias($usr_data['usr_alias']);
                                
                                        $this->forumThread->insert();
                                        $this->mapping['thr'][$this->threadArray['Id']] = $this->forumThread->getId();
                                        $this->lastHandledThreadId = $this->forumThread->getId();
                                        unset($this->threadArray);
                                }
                                
                                break;
                        case 'Post':
                                break;
                        case 'Censorship':
                                $x['Censorship'] = $this->cdata;
                                break;
                        case 'CensorshipMessage':
                                $x['CensorshipMessage'] = $this->cdata;
                                break;
                        case 'Notification':
                                $x['Notification'] = $this->cdata;
                                break;
                        case 'ImportName':
                                $x['ImportName'] = $this->cdata;
                                break;
                        case 'Status':
                                $x['Status'] = $this->cdata;
                                break;
                        case 'Message':
                                $x['Message'] = $this->cdata;
                                break;
                        case 'Lft':
                                $x['Lft'] = $this->cdata;
                                break;
                        case 'Rgt':
                                $x['Rgt'] = $this->cdata;
                                break;
                        case 'Depth':
                                $x['Depth'] = $this->cdata;
                                break;
                        case 'ParentId':
                                $x['ParentId'] = $this->cdata;
                                if($this->entity == 'post' && $this->postArray)
                                {
                                        require_once 'Modules/Forum/classes/class.ilForumPost.php';
                                        $this->forumPost->setId($this->postArray['Id']);
                                        $this->forumPost->setCensorship($this->postArray['Censorship']);
                                        $this->forumPost->setCensorshipComment($this->postArray['CensorshipMessage']);
                                        $this->forumPost->setNotification($this->postArray['Notification']);
                                        $this->forumPost->setImportName($this->postArray['ImportName']);
                                        $this->forumPost->setStatus($this->postArray['Status']);
                                        $this->forumPost->setMessage($this->postArray['Message']);
                                        $this->forumPost->setSubject($this->postArray['Subject']);
                                        $this->forumPost->setLft($this->postArray['Lft']);
                                        $this->forumPost->setRgt($this->postArray['Rgt']);
                                        $this->forumPost->setDepth($this->postArray['Depth']);
                                        $this->forumPost->setParentId($this->postArray['ParentId']);
                                        $this->forumPost->setThread($this->forumThread);
                                        $this->forumPost->setThreadId($this->lastHandledThreadId);
                                        $this->forumPost->setForumId($this->lastHandledForumId);
                                        $this->forumPost->setCreateDate($this->postArray['CreateDate']);
                                        $this->forumPost->setChangeDate($this->postArray['UpdateDate']);
                                                $this->postArray['UserId'], $this->postArray['Alias']
                                        );
                                                $this->postArray['UpdateUserId']
                                        );
                                        $this->forumPost->setUserId($usr_data['usr_id']);
                                        $this->forumPost->setUserAlias($usr_data['usr_alias']);
                                        $this->forumPost->setUpdateUserId($update_usr_data['usr_id']);
                                        $this->forumPost->insert();
                                        if($this->mapping['pos'][$this->postArray['ParentId']])
                                        {
                                                $parentId = $this->mapping['pos'][$this->postArray['ParentId']];
                                        }
                                        else
                                        {
                                                $parentId = 0;
                                        }
                                        $postTreeNodeId = $ilDB->nextId('frm_posts_tree');
                                        $ilDB->insert('frm_posts_tree', array(
                                                'fpt_pk'                => array('integer', $postTreeNodeId),
                                                'thr_fk'                => array('integer', $this->lastHandledThreadId),
                                                'pos_fk'                => array('integer', $this->forumPost->getId()),
                                                'parent_pos'    => array('integer', $parentId),
                                                'lft'                   => array('integer', $this->postArray['Lft']),
                                                'rgt'                   => array('integer', $this->postArray['Rgt']),
                                                'depth'                 => array('integer', $this->postArray['Depth']),
                                                'fpt_date'              => array('timestamp', date('Y-m-d H:i:s'))
                                        ));
                                        $this->mapping['pos'][$this->postArray['Id']] = $this->forumPost->getId();
                                        $this->lastHandledPostId = $this->forumPost->getId();
                                        $media_objects_found = false;
                                        foreach($this->mediaObjects as $mob_attr)
                                        {
                                                if(file_exists($importfile))
                                                {
                                                        $this->forumPost->setMessage(
                                                                str_replace(
                                                                        array(
                                                                                "src=\"" . $mob_attr["label"] . "\"",
                                                                                "src=\"" . preg_replace("/(il)_[\d]+_(mob)_([\d]+)/", "$1_0_$2_$3", $mob_attr["label"]) . "\""
                                                                        ),
                                                                        "src=\"" . "il_" . IL_INST_ID . "_mob_" . $mob->getId() . "\"",
                                                                        $this->forumPost->getMessage()
                                                                )
                                                        );
                                                        $media_objects_found = true;
                                                }
                                        }
                                        
                                        if($media_objects_found)
                                        {
                                                $this->forumPost->update();
                                        }
                                        unset($this->postArray);
                                }
                                break;
                                case 'Content':
                                        $x['content'] = $this->cdata;
                                        break;
                                case 'Attachment':
                                        $filedata = 
new ilFileDataForum($this->forum->getId(), $this->lastHandledPostId);
                                        $importPath = $this->contentArray['content'];
                                        if( strlen($importPath) )
                                        {
                                                $newFilename =  preg_replace("/^\d+_\d+(_.*)/ims", $this->forum->getId()."_".$this->lastHandledPostId."$1", basename($importPath));
                                                $path = $filedata->getForumPath();
 
                                                $newPath = $path.'/'.$newFilename;
                                                @copy($importPath, $newPath);
                                        }
                                        break;
                }
                $this->cdata = '';
                return;
        }