19 declare(strict_types=1);
40 $this->
logger = $DIC->logger()->wsrv();
53 public function read(): void
55 $this->
logger->debug(
'Begin read');
59 $trees = $dir_reader->getDirectoryTrees();
60 $this->
logger->debug(print_r($trees,
true));
62 foreach ($trees->getLinkIds() as $tree_id) {
64 $result = $dir_reader->getDirectoryTree($tree_id);
65 $this->
storeTree($tree_id, $result->getResult());
71 protected function storeTree($tree_id, $a_nodes): void
79 $data->setServerId($this->server_id);
80 $data->setMid($this->mid);
81 $data->setCmsId($cms_tree->rootID);
82 $data->setTreeId($tree_id);
83 $data->setTitle($cms_tree->directoryTitle);
84 $data->setTerm($cms_tree->term);
87 $tree->insertRootNode($tree_id,
$data->getObjId());
88 $tree->setRootId(
$data->getObjId());
91 foreach ((array) $cms_tree->nodes as $node) {
94 $data->setServerId($this->server_id);
95 $data->setMid($this->mid);
96 $data->setCmsId($node->id);
97 $data->setTreeId($tree_id);
98 $data->setTitle($node->title);
99 $data->setTerm($node->term);
103 if ($node->parent->id) {
110 $tree->insertNode(
$data->getObjId(), $parent_id);
read()
Read trees from ecs.
static treeExists(int $a_server_id, int $a_mid, int $a_tree_id)
static lookupObjId(int $a_server_id, int $a_mid, int $a_tree_id, string $cms_id)
Presentation of ecs uril (http://...campusconnect/courselinks)
__construct(int $server_id, int $mid)
Constructor.
static getInstanceByServerId(int $a_server_id)
Get singleton instance per server.
Reads and store cms tree in database.
storeTree($tree_id, $a_nodes)