/** * 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); } } } } }
function main_trashcan($eventData) { global $gPage_content, $innowork_core, $gLocale, $gWui, $gPage_status, $gPage_title; $summaries = $innowork_core->GetSummaries(); require_once 'innowork/core/InnoworkKnowledgeBase.php'; $innowork_kb = new InnoworkKnowledgeBase(\Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getDataAccess(), \Innomatic\Core\InnomaticContainer::instance('\\Innomatic\\Core\\InnomaticContainer')->getCurrentDomain()->getDataAccess()); $global_search = $innowork_kb->GlobalSearch('', '', true); $xml_def = ''; /* echo '<pre>'; print_r( $global_search ); echo '</pre>'; */ if ($global_search['founditems']) { require_once 'innomatic/wui/dispatch/WuiEventsCall.php'; $xml_def = ' <vertgroup><name>trashcan</name> <children> <innoworksearch><name>searchresult</name> <args> <searchresult type="array">' . WuiXml::encode($global_search['result']) . '</searchresult> <summaries type="array">' . WuiXml::encode($summaries) . '</summaries> <trashcan>true</trashcan> </args> </innoworksearch> <horizbar/> <button><name>emptytrashcan</name> <args> <label type="encoded">' . urlencode($gLocale->getStr('empty_trashcan.button')) . '</label> <themeimage>buttonok</themeimage> <dangeraction>true</dangeraction> <horiz>true</horiz> <frame>false</frame> <needconfirm>true</needconfirm> <confirmmessage type="encoded">' . urlencode($gLocale->getStr('empty_trashcan.confirm')) . '</confirmmessage> <action type="encoded">' . urlencode(WuiEventsCall::buildEventsCallString('', array(array('view', 'trashcan'), array('action', 'empty_trashcan')))) . '</action> </args> </button> </children> </vertgroup>'; } $gPage_status = sprintf($gLocale->getStr('found_items.status'), $global_search['founditems']); $gPage_content = new WuiXml('page', array('definition' => $xml_def)); $gPage_title = $gLocale->getStr('trashcan.title'); }
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; }