ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilECSTreeReader Class Reference

Reads and store cms tree in database. More...

+ Collaboration diagram for ilECSTreeReader:

Public Member Functions

 __construct ($server_id, $mid)
 Constructor.
 read ()
 Read trees from ecs.

Protected Member Functions

 storeTree ($tree_id, $a_nodes)

Private Attributes

 $server_id
 $mid

Detailed Description

Reads and store cms tree in database.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Id:
class.ilECSTreeReader.php 39161 2013-01-10 10:46:56Z smeyer

Definition at line 10 of file class.ilECSTreeReader.php.

Constructor & Destructor Documentation

ilECSTreeReader::__construct (   $server_id,
  $mid 
)

Constructor.

Parameters
<type>$server_id
<type>$mid

Definition at line 20 of file class.ilECSTreeReader.php.

References $mid, and $server_id.

{
$this->server_id = $server_id;
$this->mid = $mid;
}

Member Function Documentation

ilECSTreeReader::read ( )

Read trees from ecs.

Exceptions
ilECSConnectorException

Definition at line 33 of file class.ilECSTreeReader.php.

References $GLOBALS, $result, ilECSSetting\getInstanceByServerId(), storeTree(), and ilECSCmsData\treeExists().

{
$GLOBALS['ilLog']->write(__METHOD__.': Begin read');
try
{
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSDirectoryTreeConnector.php';
$dir_reader = new ilECSDirectoryTreeConnector(
);
$trees = $dir_reader->getDirectoryTrees();
$GLOBALS['ilLog']->write(__METHOD__.' '.print_r($trees,true));
if($trees instanceof ilECSUriList)
{
foreach((array) $trees->getLinkIds() as $tree_id)
{
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
if(!ilECSCmsData::treeExists($this->server_id, $this->mid, $tree_id))
{
$result = $dir_reader->getDirectoryTree($tree_id);
$this->storeTree($tree_id, $result->getResult());
}
}
}
}
{
throw $e;
}
}

+ Here is the call graph for this function:

ilECSTreeReader::storeTree (   $tree_id,
  $a_nodes 
)
protected

Definition at line 65 of file class.ilECSTreeReader.php.

References ilECSCmsData\lookupObjId().

Referenced by read().

{
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsData.php';
include_once './Services/WebServices/ECS/classes/Tree/class.ilECSCmsTree.php';
$tree = new ilECSCmsTree($tree_id);
$cms_tree = $a_nodes;
$data = new ilECSCmsData();
$data->setServerId($this->server_id);
$data->setMid($this->mid);
$data->setCmsId($cms_tree->rootID);
$data->setTreeId($tree_id);
$data->setTitle($node->directoryTitle);
$data->setTerm($node->term);
$data->save();
$tree->insertRootNode($tree_id, $data->getObjId());
$tree->setRootId($data->getObjId());
foreach((array) $cms_tree->nodes as $node)
{
// Add data entry
$data = new ilECSCmsData();
$data->setServerId($this->server_id);
$data->setMid($this->mid);
$data->setCmsId($node->id);
$data->setTreeId($tree_id);
$data->setTitle($node->title);
$data->setTerm($node->term);
$data->save();
// add to tree
if($node->parent->id)
{
$this->server_id,
$this->mid,
$tree_id,
(int) $node->parent->id
);
$tree->insertNode($data->getObjId(), $parent_id);
}
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

ilECSTreeReader::$mid
private

Definition at line 13 of file class.ilECSTreeReader.php.

Referenced by __construct().

ilECSTreeReader::$server_id
private

Definition at line 12 of file class.ilECSTreeReader.php.

Referenced by __construct().


The documentation for this class was generated from the following file: