/** * Create one element * * @param type $node */ private function _generateElement($node) { if (!$node->isAllow()) { return; } $cssClasses = array(); $cssActive = ''; if ($node->isActive()) { $cssActive = 'class="active"'; } if (!is_null($node->getClass())) { $cssClasses[] = $node->getClass(); } $class = count($cssClasses) > 0 ? " class='" . implode(',', $cssClasses) . "'" : ''; $id = !is_null($node->getId()) ? " id='" . $node->getId() . "'" : ''; $target = !is_null($node->getTarget()) ? " target='" . $node->getTarget() . "'" : ''; $this->html .= "\t\t" . '<li ' . $cssActive . '>' . PHP_EOL; if (!$node->hasChilds()) { $this->html .= "\t\t\t" . '<a href="' . $node->getUrl() . '" ' . $target . ' class="nav-header" ><span' . $class . '></span> ' . $this->_translate($node->getName()) . "</a>" . PHP_EOL; } //generate childs if ($node->hasChilds()) { //$this->html .= "\t\t<div class='dropdown'>" . PHP_EOL; $this->html .= '<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">' . $this->_translate($node->getName()) . ' <span class="caret"></span></a>' . PHP_EOL; $this->html .= "\t\t<ul class=\"dropdown-menu\">" . PHP_EOL; $this->_generateChilds($node->getChilds()); $this->html .= "\t\t</ul>" . PHP_EOL; //$this->html .= "\t\t</div>" . PHP_EOL; } $this->html .= "\t\t</li>" . PHP_EOL; }
/** * Creates an single user-information array for a given user. A user will be marked * as disabled, if the permission check fails on this user. * * @param type $user * @param type $permission * @return type */ private static function createJSONUserInfo($user, $permission = null, $priority = null) { $disabled = false; if ($permission != null && $permission instanceof \humhub\libs\BasePermission) { $disabled = !$user->getPermissionManager()->can($permission); } else { if ($permission != null) { $disabled = $permission; } } $priority = $priority == null ? 0 : $priority; $userInfo = []; $userInfo['id'] = $user->id; $userInfo['guid'] = $user->guid; $userInfo['disabled'] = $disabled; $userInfo['displayName'] = Html::encode($user->displayName); $userInfo['image'] = $user->getProfileImage()->getUrl(); $userInfo['priority'] = $priority; $userInfo['link'] = $user->getUrl(); return $userInfo; }
/** * Create one element * * @param type $node */ private function _generateElement($node) { $cssClasses = array(); if ($node->isActive()) { $cssClasses[] = 'active'; } if (!is_null($node->getClass())) { $cssClasses[] = $node->getClass(); } $class = count($cssClasses) > 0 ? " class='" . implode(',', $cssClasses) . "'" : ''; $id = !is_null($node->getId()) ? " id='" . $node->getId() . "'" : ''; $target = !is_null($node->getTarget()) ? " target='" . $node->getTarget() . "'" : ''; $this->html .= "\t\t<li{$class} {$id}>" . PHP_EOL; $this->html .= "\t\t\t<a title='" . $this->_translate($node->getName()) . "' href='" . $node->getUrl() . "' {$target}>" . $this->_translate($node->getName()) . "</a>" . PHP_EOL; //generate childs if ($node->hasChilds()) { $this->html .= "\t\t<div class='dropdown'>" . PHP_EOL; $this->html .= "\t\t<ul>" . PHP_EOL; $this->_generateChilds($node->getChilds()); $this->html .= "\t\t</ul>" . PHP_EOL; $this->html .= "\t\t</div>" . PHP_EOL; } $this->html .= "\t\t</li>" . PHP_EOL; }
/** * @deprecated * @param type $apiEndpoint * @param type $contentType * @param type $payload * @param type $responseContentType * @param type $responsePayload * @return type */ protected function invokeRpcAndDeserializeResponse($apiEndpoint, $contentType, $responseContentType, &$deserializedPayload) { // // Create responsePayload variable to pass by reference to // HttpsRpc::invoke. // $responsePayload = null; // // Log request // self::log(\Psr\Log\LogLevel::DEBUG, "ApiRequest::invokeRpcAndDeserializeResponse [" . "endpoint=\"{endpoint}\", " . "contentType=\"{contentType}\", " . "responseContentType=\"{responseContentType}\"" . "]", array('endpoint' => $apiEndpoint != null ? $apiEndpoint->getUrl() : 'null', 'contentType' => $contentType, 'responseContentType' => $responseContentType)); // // // $responseCode = HttpsRpc::invoke($apiEndpoint->getUrl(), $contentType, $this, $responseContentType, $deserializedPayload); return $responseCode; }
/** * Returns the public path of an asset. * * Absolute paths (i.e. http://...) are returned unmodified. * * @param string $path A public path * @param string $packageName The name of the asset package to use * * @return string A public path which takes into account the base path and URL path */ public function getAssetUrl($path, $packageName = null) { return $this->assetsHelper->getUrl($path, $packageName); }