/** * Gets the whole log of the current Innowork item. * * @access public * @return array */ public function getLog() { $result = array(); $dataAccess = $this->container->getCurrentDomain()->getDataAccess(); $log_query = $dataAccess->execute('SELECT username,eventtime' . ' FROM innowork_core_itemslog' . ' WHERE itemtype=' . $dataAccess->formatText($this->itemType) . ' AND itemid=' . $this->itemId); while (!$log_query->eof) { $country = new \Innomatic\Locale\LocaleCountry($this->container->getCurrentUser()->getCountry()); $date_array = $country->getDateArrayFromSafeTimestamp($log_query->getFields('eventtime')); $result[] = $country->formatShortArrayDate($date_array) . ' ' . $country->FormatArrayTime($date_array) . ' ' . $log_query->getFields('username'); $log_query->moveNext(); } $log_query->free(); return $result; }
/** * Disables the component to the given domain. * * @param string $domainid Identifier name of the domain * @param array $params Parameters in the component definition * @access public * @return bool True when the component has been successfully disabled from the domain */ public function disable($domainid, $params) { $result = false; $override = self::OVERRIDE_NONE; if (isset($params['override'])) { switch ($params['override']) { case self::OVERRIDE_DOMAIN: case self::OVERRIDE_GLOBAL: $override = $params['override']; break; } } if ($this->getIsDomain() or isset($params['override']) and $params['override'] == self::OVERRIDE_DOMAIN) { if ($this->applicationsComponentsRegister->checkRegisterComponent($this->getType(), $this->name, $domainid, $this->appname, $override) != false) { if ($this->applicationsComponentsRegister->checkRegisterComponent($this->getType(), $this->name, $domainid, $this->appname, $override, true) == false) { if (strlen($domainid)) { // Start domain $this->container->startDomain(\Innomatic\Domain\Domain::getTenantNameById($domainid)); // Set the domain dataaccess for the component $this->domainda = $this->container->getCurrentDomain()->getDataAccess(); } $result = $this->doDisableDomainAction($domainid, $params); $this->applicationsComponentsRegister->unregisterComponent($this->appname, $this->getType(), $this->name, $domainid, $override); if (strlen($domainid)) { // Stop domain $this->container->stopDomain(); } } else { $result = $this->applicationsComponentsRegister->unregisterComponent($this->appname, $this->getType(), $this->name, $domainid, $override); } } } else { $result = true; } return $result; }
/** * Launches a panel in the domain desktop. * * If the panel name is one "main" then * no real panel is launched, a domain desktop layout file is included. * * Domain desktop layout files are stored in the folder * core/classes/innomatic/desktop/layout/domain. * * @param string $resource Panel name. */ public function executeDomain($resource) { // Check if this is the default page and if the user is allowed to access the dashboard if (substr($resource, -1, 1) == '/') { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); $node_id = $perm->getNodeIdFromFileName('dashboard'); if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) != \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $resource = $resource . 'dashboard'; } } if (substr($resource, -1, 1) != '/') { // Must exit if the user called a page for which he isn't enabled // if (!isset($perm)) { $perm = new \Innomatic\Desktop\Auth\DesktopPanelAuthorizator($this->container->getCurrentDomain()->getDataAccess(), $this->container->getCurrentUser()->getGroup()); } $desktopPanel = basename($resource); if ($this->container->getState() == \Innomatic\Core\InnomaticContainer::STATE_DEBUG) { $dump = \Innomatic\Debug\InnomaticDump::instance('\\Innomatic\\Debug\\InnomaticDump'); $dump->desktopApplication = $desktopPanel; $dump->sessionId = $this->session->getId(); } switch ($desktopPanel) { case 'index': break; default: $node_id = $perm->getNodeIdFromFileName($desktopPanel); if ($node_id) { if ($perm->check($node_id, \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODETYPE_PAGE) == \Innomatic\Desktop\Auth\DesktopPanelAuthorizator::NODE_NOTENABLED) { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } else { $adloc = new \Innomatic\Locale\LocaleCatalog('innomatic::authentication', $this->container->getCurrentUser()->getLanguage()); $this->container->abort($adloc->getStr('nopageauth')); } } if (is_dir($resource . '-panel')) { $panelHome = $resource . '-panel/'; $panelName = basename($resource); $controllerClassName = ucfirst($panelName) . 'PanelController'; // Checks if view file and definition exist if (!(include_once $panelHome . $controllerClassName . '.php')) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_FILE); } if (!class_exists($controllerClassName, true)) { throw new \Innomatic\Wui\WuiException(\Innomatic\Wui\WuiException::MISSING_CONTROLLER_CLASS); } $controller = new $controllerClassName(\Innomatic\Core\InnomaticContainer::MODE_DOMAIN, $panelName); $this->container->setPanelController($controller); } else { switch ($desktopPanel) { case 'menu': include 'innomatic/desktop/layout/domain/' . $desktopPanel . '.php'; break; default: include $resource . '.php'; } } } else { if (strlen($this->session->get('INNOMATIC_AUTH_USER'))) { \Innomatic\Webapp\WebAppContainer::instance('\\Innomatic\\Webapp\\WebAppContainer')->getProcessor()->getResponse()->addHeader('P3P', 'CP="CUR ADM OUR NOR STA NID"'); include 'innomatic/desktop/layout/domain/index.php'; } } }
public function &search($searchKeys, $userId = '', $globalSearch = false, $trashcan = false, $limit = 0, $offset = 0, $restrictToPermission = InnoworkItem::SEARCH_RESTRICT_NONE) { $result = array(); $goon = true; $to_be_cached = false; if (!is_array($searchKeys) and !strlen($searchKeys) and !$trashcan and !$limit and !$offset and $restrictToPermission == InnoworkItem::SEARCH_RESTRICT_NONE) { $cached_item = new \Innomatic\Datatransfer\Cache\CachedItem($this->mrRootDb, 'innowork-core', 'itemtypesearch-' . $this->mItemType . strtolower(str_replace(' ', '', $this->mSearchOrderBy)), $this->container->getCurrentDomain()->domaindata['id'], $this->container->getCurrentUser()->getUserId()); $cache_content = $cached_item->Retrieve(); if ($cache_content != false) { $goon = false; $to_be_cached = false; $result = unserialize($cache_content); } else { $to_be_cached = true; } } // Check if the search keys to be returned are valid keys // if (is_array($searchKeys)) { while (list($key, ) = each($searchKeys)) { if (!isset($this->mKeys[$key])) { unset($searchKeys[$key]); } } reset($searchKeys); if (!count($searchKeys)) { $goon = false; } } if ($goon) { // Check if we should use the current user id // if (!strlen($userId)) { $userId = $this->container->getCurrentUser()->getUserId(); } $result = array(); // Call the search method // $search_result = $this->doSearch($searchKeys, $userId, $globalSearch, $trashcan, $limit, $offset); if (strlen($this->mParentType) > 0 && strlen($this->mParentIdField) > 0) { $tmp_innoworkcore = InnoworkCore::instance('\\Innowork\\Core\\InnoworkCore', $this->mrRootDb, $this->mrDomainDA); $summaries = $tmp_innoworkcore->getSummaries(); $parentTable = $summaries[$this->mParentType]['table']; } // Check if the user has enough permissions for each row in the result set, // and add the ones with enough permissions // if (is_array($search_result) and count($search_result)) { while (list($id, $val) = each($search_result)) { // Get the item ACL or the item parent ACL if supported if (strlen($this->mParentType) > 0 && strlen($this->mParentIdField) > 0) { $aclItemId = $val[$this->mParentIdField]; $aclItemType = $this->mParentType; $aclItemOwnerId = ''; if (strlen($parentTable)) { $parentOwnerQuery = $this->mrDomainDA->execute("SELECT ownerid FROM {$parentTable} WHERE id={$aclItemId}"); if ($parentOwnerQuery->getNumberRows() > 0) { $aclItemOwnerId = $parentOwnerQuery->getFields('ownerid'); } } $aclNoAcl = false; } else { $aclItemId = $id; $aclItemType = $this->mItemType; $aclItemOwnerId = $val['ownerid']; $aclNoAcl = $this->mNoAcl; } $tmp_acl = new InnoworkAcl($this->mrRootDb, $this->mrDomainDA, $aclItemType, $aclItemId); if ($aclNoAcl == true or $aclItemOwnerId == $this->container->getCurrentUser()->getUserId() or $tmp_acl->checkPermission('', $userId) >= InnoworkAcl::PERMS_SEARCH) { $restrict = false; switch ($restrictToPermission) { case InnoworkItem::SEARCH_RESTRICT_TO_OWNER: if ($aclItemOwnerId != $this->container->getCurrentUser()->getUserId()) { $restrict = true; } break; case InnoworkItem::SEARCH_RESTRICT_TO_RESPONSIBLE: $restrict = true; if ($aclItemOwnerId == $this->container->getCurrentUser()->getUserId() or $tmp_acl->checkPermission('', $userId) == InnoworkAcl::PERMS_RESPONSIBLE) { $restrict = false; } break; case InnoworkItem::SEARCH_RESTRICT_TO_PARTICIPANT: if ($aclItemOwnerId == $this->container->getCurrentUser()->getUserId() or $tmp_acl->checkPermission('', $userId) >= InnoworkAcl::PERMS_ALL) { $restrict = true; } break; case InnoworkItem::SEARCH_RESTRICT_NONE: default: break; } if (!$restrict) { $result[$id] = $val; $result[$id]['_acl']['type'] = $tmp_acl->GetType(); } } } } } if ($to_be_cached) { $cached_item->store(serialize($result)); } return $result; }