/**
  * leaveComposite
  *
  * @param KVDthes_Term $node
  * @return true
  */
 public function leaveComposite(KVDthes_Term $node)
 {
     $this->visitation[$node->getId()]['right'] = ++$this->count;
     if ($this->visitation[$node->getId()]['depth'] != $this->depth--) {
         throw new Exception('Depth should be equal');
     }
     return true;
 }
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     if ($node->hasRelations(KVDthes_Relation::REL_NT)) {
         $this->currItem = new KVDthes_DojoDatastoreComposite($node->getId(), $node->getQualifiedTerm(), $this->depth, $node->getType()->getId());
     } else {
         $this->currItem = new KVDthes_DojoDatastoreTerm($node->getId(), $node->getQualifiedTerm(), $this->depth, $node->getType()->getId());
     }
     $this->result->addItem($this->currItem);
     return true;
 }
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     $this->result .= $this->pad() . "<li>\n";
     $this->depth++;
     $this->result .= $this->pad() . '<p><a href="javascript:loadDetail(' . $node->getId() . ');">' . $node->getQualifiedTerm() . "</a></p>\n";
     $this->depth--;
     return true;
 }
 /**
  * visit 
  * 
  * @param KVDthes_Term $node 
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     $this->result .= $this->pad() . "<li>\n";
     $this->depth++;
     $this->result .= $this->pad() . '<p><a href="' . $this->ro->gen($this->termRoute, array($this->termIdParameter => $node->getId())) . '">' . $node->getTerm() . "</a></p>\n";
     $this->depth--;
     return true;
 }
Exemplo n.º 5
0
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     $this->term = $this->dom->createElement('term');
     $this->term->appendChild($this->createTermId($node->getId()));
     $this->term->appendChild($this->createTermName($node->getTerm()));
     $this->term->appendChild($this->createTermType($node->getType()->getId()));
     $this->term->appendChild($this->createTermLanguage('nl-BE'));
     return true;
 }
Exemplo n.º 6
0
 /**
  * insertRelations
  *
  * @param   KVDthes_Term $term
  * @return  void
  */
 private function insertRelations(KVDthes_Term $term)
 {
     $sql = sprintf('INSERT INTO %s.relation ( thesaurus_id, id_from, relation_type, id_to) VALUES ( %s, ?, ?, ?)', $this->parameters['schema'], $this->parameters['thesaurus_id']);
     if (count($term->getRelations()) > 0) {
         $stmt = $this->conn->prepare($sql);
         $stmt->bindValue(1, $term->getId(), PDO::PARAM_INT);
         foreach ($term->getRelations() as $rel) {
             $stmt->bindValue(2, $rel->getType(), PDO::PARAM_STR);
             $stmt->bindValue(3, $rel->getTerm()->getId(), PDO::PARAM_INT);
             $stmt->execute();
         }
     }
 }
Exemplo n.º 7
0
 /**
  * findNodeForTerm
  *
  * @param   KVDthes_Term $termObj
  * @return  DOMNode
  */
 private function findNodeForTerm(KVDthes_Term $termObj)
 {
     $list = $this->xp->query('/Zthes/term[termId="' . $termObj->getId() . '"]');
     if ($list->length == 0) {
         throw new RuntimeException('Unable to find term node with id ' . $termObj->getId() . '!');
     }
     return $list->item(0);
 }
 /**
  * visit
  *
  * @param KVDthes_Term $node
  * @return void
  */
 public function visit(KVDthes_Term $node)
 {
     $this->from = $node->getId();
     return true;
 }
 /**
  * visitRelation
  *
  * @param KVDthes_Relation $rel
  * @return boolean
  */
 public function visitRelation(KVDthes_Relation $rel)
 {
     $this->result .= $this->currItem->getId() . ' -> ' . $rel->getTerm()->getId() . ";\n";
     return true;
 }
Exemplo n.º 10
0
 public function testGetId()
 {
     $this->assertEquals(507, $this->object->getId());
 }