Inheritance diagram for ilForumImportParser:
Collaboration diagram for ilForumImportParser:Public Member Functions | |
| ilForumImportParser ($a_xml_file, $a_parent_id) | |
| Constructor. | |
| getParent () | |
| __pushParentId ($a_id) | |
| __popParentId () | |
| __getParentId () | |
| setHandlers ($a_xml_parser) | |
| set event handler should be overwritten by inherited class private | |
| startParsing () | |
| start the parser | |
| handlerBeginTag ($a_xml_parser, $a_name, $a_attribs) | |
| handler for begin of element | |
| handlerEndTag ($a_xml_parser, $a_name) | |
| handler for end of element | |
| handlerCharacterData ($a_xml_parser, $a_data) | |
| handler for character data | |
| __createNew ($a_id) | |
| __addThread () | |
| __addPost () | |
| __initForumObject () | |
| __addTopic () | |
| __addModerator ($id) | |
Data Fields | |
| $parent | |
| $counter | |
Definition at line 35 of file class.ilForumImportParser.php.
| ilForumImportParser::__addModerator | ( | $ | id | ) |
Definition at line 355 of file class.ilForumImportParser.php.
References $id, $rbacadmin, and ilObjUser::updateActiveRoles().
Referenced by __addTopic(), and handlerBeginTag().
{
global $rbacadmin;
$rbacadmin->assignUser($this->roles[0],$id, "n");
ilObjUser::updateActiveRoles($id);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForumImportParser::__addPost | ( | ) |
Definition at line 304 of file class.ilForumImportParser.php.
References __getParentId(), and __pushParentId().
Referenced by handlerEndTag().
{
$this->forum_obj->setImportName($this->post["login"]);
$this->forum_obj->setWhereCondition("top_frm_fk = ".$this->forum->getId());
$topic = $this->forum_obj->getOneTopic();
$post = $this->forum_obj->getPostById($this->__getParentId());
#$post = $this->forum_obj->getPostById($this->parent[count($this->parent)-1]);
/* $this->parent[] = (int) $this->forum_obj->generatePost($topic["top_pk"],$post["pos_thr_fk"],$this->post["author"],
$this->post["message"],$this->parent[count($this->parent)-1],
0,$this->post["title"],date("Y-m-d H:i:s",$this->post["c_time"]));*/
$this->__pushParentId((int) $this->forum_obj->generatePost($topic["top_pk"],$post["pos_thr_fk"],$this->post["author"],
$this->post["message"],$this->parent[count($this->parent)-1],
0,$this->post["title"],date("Y-m-d H:i:s",$this->post["c_time"])));
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForumImportParser::__addThread | ( | ) |
Definition at line 282 of file class.ilForumImportParser.php.
References __initForumObject(), and __pushParentId().
Referenced by handlerEndTag().
{
$this->__initForumObject();
$this->forum_obj->setImportName($this->thread["login"]);
$this->forum_obj->setWhereCondition("top_frm_fk = ".$this->forum->getId());
$topic = $this->forum_obj->getOneTopic();
// GENERATE IT AND 'INCREMENT' parent variable
/* $this->parent[] = (int) $this->forum_obj->generateThread($topic["top_pk"],$this->thread["author"],
$this->thread["title"],
$this->post["message"],0,date("Y-m-d H:i:s",$this->thread["c_time"]));*/
$this->__pushParentId((int) $this->forum_obj->generateThread($topic["top_pk"],$this->thread["author"],
$this->thread["title"],
$this->post["message"],0,date("Y-m-d H:i:s",$this->thread["c_time"])));
$this->forum_obj->setDbTable("frm_data");
$this->forum_obj->setWhereCondition("top_pk = ".$topic["top_pk"]);
$this->forum_obj->updateVisits($topic["top_pk"]);
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForumImportParser::__addTopic | ( | ) |
Definition at line 332 of file class.ilForumImportParser.php.
References $_SESSION, $query, __addModerator(), and ilUtil::prepareDBString().
Referenced by handlerEndTag().
{
global $ilDB;
$query = "INSERT INTO frm_data VALUES('0','".
$this->forum->getId()."','".
ilUtil::prepareDBString($this->forum->getTitle())."','".
ilUtil::prepareDBString($this->forum->getDescription())."','".
"0','0','".
"','".$this->roles[0]."','".
date("Y:m:d H:i:s")."','".
"0','".
date("Y:m:d H:i:s")."','".
"0','".
$_SESSION["AccountId"]."')";
$ilDB->query($query);
// TO ENSURE THERE IS MINIMUM ONE MODERATOR
$this->__addModerator($_SESSION["AccountId"]);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForumImportParser::__createNew | ( | $ | a_id | ) |
Definition at line 258 of file class.ilForumImportParser.php.
References getParent().
Referenced by handlerBeginTag().
{
include_once "classes/class.ilObjForum.php";
$this->forum =& new ilObjForum();
$this->forum->setImportId($a_id);
$this->forum->setTitle("empty");
$this->forum->create();
$this->forum->createReference();
$this->forum->putInTree($this->getParent());
// INIT DEFAULT PERMISSIONS
$this->forum->setPermissions($this->forum->getRefId());
// INIT DEFAULT MODERATOR ROLE
$this->roles = $this->forum->initDefaultRoles();
$this->ref_id = $this->forum->getRefId();
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:| ilForumImportParser::__getParentId | ( | ) |
Definition at line 76 of file class.ilForumImportParser.php.
Referenced by __addPost().
{
return $this->parent[count($this->parent) - 1];
}
Here is the caller graph for this function:| ilForumImportParser::__initForumObject | ( | ) |
Definition at line 322 of file class.ilForumImportParser.php.
Referenced by __addThread().
{
include_once "classes/class.ilForum.php";
$this->forum_obj =& new ilForum();
$this->forum_obj->setForumRefId($this->ref_id);
return true;
}
Here is the caller graph for this function:| ilForumImportParser::__popParentId | ( | ) |
Definition at line 70 of file class.ilForumImportParser.php.
Referenced by handlerEndTag().
{
array_pop($this->parent);
return true;
}
Here is the caller graph for this function:| ilForumImportParser::__pushParentId | ( | $ | a_id | ) |
Definition at line 66 of file class.ilForumImportParser.php.
Referenced by __addPost(), __addThread(), and handlerBeginTag().
{
$this->parent[] = $a_id;
}
Here is the caller graph for this function:| ilForumImportParser::getParent | ( | ) |
Definition at line 61 of file class.ilForumImportParser.php.
Referenced by __createNew().
{
return $this->parent;
}
Here is the caller graph for this function:| ilForumImportParser::handlerBeginTag | ( | $ | a_xml_parser, | |
| $ | a_name, | |||
| $ | a_attribs | |||
| ) |
handler for begin of element
Definition at line 109 of file class.ilForumImportParser.php.
References $ilErr, __addModerator(), __createNew(), __pushParentId(), and ilObjUser::_getImportedUserId().
{
global $ilErr;
switch($a_name)
{
// FORUM DATA
case "forum":
if($a_attribs["exportVersion"] < EXPORT_VERSION)
{
$ilErr->raiseError("!!! This export Version isn't supported, update your ILIAS 2 installation"
,$ilErr->WARNING);
}
$this->__createNew($a_attribs["id"]);
// FINALLY SET FIRST PARENT
$this->parent = array(0);
break;
case "title":
case "description":
$this->cdata = '';
break;
case "moderator":
if($mod = ilObjUser::_getImportedUserId($a_attribs["id"]))
{
$this->__addModerator($mod);
}
// THREAD DATA
case "thread":
// EMPTY DATA ARRAY
$this->thread = array();
$this->thread_start = true;
$this->__pushParentId(0);
#this->parent = array(0);
break;
case "threadAuthor":
$this->thread["author"] = ilObjUser::_getImportedUserId($a_attribs["id"]);
$this->thread["login"] = $a_attribs["login"];
break;
// POST DATA
case "posting":
// EMPTY DATA ARRAY
$this->post = array();
break;
case "postingAuthor":
$this->post["author"] = ilObjUser::_getImportedUserId($a_attribs["id"]);
$this->post["login"] = $a_attribs["login"];
break;
}
}
Here is the call graph for this function:| ilForumImportParser::handlerCharacterData | ( | $ | a_xml_parser, | |
| $ | a_data | |||
| ) |
handler for character data
Definition at line 242 of file class.ilForumImportParser.php.
{
// i don't know why this is necessary, but
// the parser seems to convert ">" to ">" and "<" to "<"
// in character data, but we don't want that, because it's the
// way we mask user html in our content, so we convert back...
$a_data = str_replace("<","<",$a_data);
$a_data = str_replace(">",">",$a_data);
if(!empty($a_data))
{
$this->cdata .= $a_data;
}
}
| ilForumImportParser::handlerEndTag | ( | $ | a_xml_parser, | |
| $ | a_name | |||
| ) |
handler for end of element
Definition at line 170 of file class.ilForumImportParser.php.
References __addPost(), __addThread(), __addTopic(), and __popParentId().
{
switch($a_name)
{
// FORUM DATA
case "title":
$this->forum->setTitle($this->cdata);
$this->forum->update();
break;
case "description":
$this->forum->setDescription($this->cdata);
$this->forum->update();
// DATA COMPLETE UPDATE 'Topic_data'
$this->__addTopic();
break;
// THREAD DATA
case "thread":
$this->__popParentId();
#unset($this->parent[count($this->parent)-1]);
break;
case "threadTitle":
$this->thread["title"] = $this->cdata;
break;
case "threadCreationDate":
$this->thread["c_time"] = $this->cdata;
break;
// POST DATA
case "posting":
$this->__popParentId();
#unset($this->parent[count($this->parent)-1]);
break;
case "postingTitle":
$this->post["title"] = $this->cdata;
break;
case "postingCreationDate":
$this->post["c_time"] = $this->cdata;
break;
case "message":
$this->post["message"] = $this->cdata;
// ALL DATA COMPLETE, INSERT NODE HERE
if($this->thread_start)
{
$this->__addThread();
$this->thread_start = false;
}
else
{
$this->__addPost();
}
break;
case "forum":
break;
}
$this->cdata = '';
}
Here is the call graph for this function:| ilForumImportParser::ilForumImportParser | ( | $ | a_xml_file, | |
| $ | a_parent_id | |||
| ) |
Constructor.
| string | $a_xml_file xml file |
public
Definition at line 48 of file class.ilForumImportParser.php.
References ilSaxParser::ilSaxParser().
{
define('EXPORT_VERSION',4);
parent::ilSaxParser($a_xml_file);
// SET MEMBER VARIABLES
$this->parent = $a_parent_id;
$this->counter = 0;
}
Here is the call graph for this function:| ilForumImportParser::setHandlers | ( | $ | a_xml_parser | ) |
set event handler should be overwritten by inherited class private
Reimplemented from ilSaxParser.
Definition at line 87 of file class.ilForumImportParser.php.
{
xml_set_object($a_xml_parser,$this);
xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
}
| ilForumImportParser::startParsing | ( | ) |
start the parser
Reimplemented from ilSaxParser.
Definition at line 97 of file class.ilForumImportParser.php.
{
// SET FIRST PARENT
parent::startParsing();
return true;
}
| ilForumImportParser::$counter |
Definition at line 38 of file class.ilForumImportParser.php.
| ilForumImportParser::$parent |
Definition at line 37 of file class.ilForumImportParser.php.
1.7.1