Ejemplo n.º 1
0
 /**
  * Permanently removes trashed items.
  *
  * @access public
  * @return void
  */
 public function emptyTrashcan()
 {
     require_once 'innowork/core/InnoworkKnowledgeBase.php';
     $innowork_kb = new InnoworkKnowledgeBase($this->mrRootDb, $this->mrDomainDA);
     $global_search = $innowork_kb->globalSearch('', '', true);
     if ($global_search['founditems']) {
         $summaries = $this->getSummaries();
         foreach ($global_search['result'] as $type => $search_items) {
             $class_name = $summaries[$type]['classname'];
             foreach ($search_items as $item) {
                 // Checks if the class exists.
                 if (!class_exists($class_name)) {
                     continue;
                 }
                 $tmp_class = new $class_name($this->mrRootDb, $this->mrDomainDA, $item['id']);
                 if (is_object($tmp_class)) {
                     // Removes the trashed item.
                     $tmp_class->remove();
                     unset($tmp_class);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 public function getRelatedItems()
 {
     $result = array('result' => array(), 'founditems' => 0);
     if ($this->mItemId) {
         $search_keys = array();
         while (list(, $field) = each($this->mRelatedItemsFields)) {
             $search_keys[$field] = $this->mItemId;
         }
         reset($this->mRelatedItemsFields);
         require_once 'innowork/core/InnoworkKnowledgeBase.php';
         $innowork_kb = new InnoworkKnowledgeBase($this->mrRootDb, $this->mrDomainDA);
         $result = $innowork_kb->globalSearch($search_keys, '');
     }
     return $result;
 }