当前位置: 首页>>代码示例>>PHP>>正文


PHP AJXP_XMLWriter::renderAjxpNode方法代码示例

本文整理汇总了PHP中AJXP_XMLWriter::renderAjxpNode方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::renderAjxpNode方法的具体用法?PHP AJXP_XMLWriter::renderAjxpNode怎么用?PHP AJXP_XMLWriter::renderAjxpNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AJXP_XMLWriter的用法示例。


在下文中一共展示了AJXP_XMLWriter::renderAjxpNode方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeBookmarks

 /**
  * List all bookmmarks as XML
  * @static
  * @param $allBookmarks
  * @param bool $print
  * @param string $format legacy|node_list
  * @return string
  */
 public static function writeBookmarks($allBookmarks, $print = true, $format = "legacy")
 {
     $driver = false;
     if ($format == "node_list") {
         $driver = ConfService::loadRepositoryDriver();
         if (!is_a($driver, "AjxpWrapperProvider")) {
             $driver = false;
         }
     }
     $buffer = "";
     foreach ($allBookmarks as $bookmark) {
         $path = "";
         $title = "";
         if (is_array($bookmark)) {
             $path = $bookmark["PATH"];
             $title = $bookmark["TITLE"];
         } else {
             if (is_string($bookmark)) {
                 $path = $bookmark;
                 $title = basename($bookmark);
             }
         }
         if ($format == "node_list") {
             if ($driver) {
                 $node = new AJXP_Node($driver->getResourceUrl($path));
                 $buffer .= AJXP_XMLWriter::renderAjxpNode($node, true, false);
             } else {
                 $buffer .= AJXP_XMLWriter::renderNode($path, $title, false, array('icon' => "mime_empty.png"), true, false);
             }
         } else {
             $buffer .= "<bookmark path=\"" . AJXP_Utils::xmlEntities($path, true) . "\" title=\"" . AJXP_Utils::xmlEntities($title, true) . "\"/>";
         }
     }
     if ($print) {
         print $buffer;
         return null;
     } else {
         return $buffer;
     }
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:48,代码来源:class.AJXP_XMLWriter.php

示例2: applyAction


//.........这里部分代码省略.........
            We create this object search because it'll allow us to fetch the number of results we want at once.
            We just have to set some parameters, the query type and the size of the result set.
         */
         $search = new Elastica\Search($this->client);
         $search->addIndex($this->currentIndex)->addType($this->currentType);
         $maxResults = $this->getFilteredOption("MAX_RESULTS");
         if (isset($httpVars['limit'])) {
             $maxResults = intval($httpVars['limit']);
         }
         $searchOptions = array(\Elastica\Search::OPTION_SEARCH_TYPE => \Elastica\Search::OPTION_SEARCH_TYPE_QUERY_THEN_FETCH, \Elastica\Search::OPTION_SIZE => $maxResults);
         $this->logDebug(__FUNCTION__, "Executing query: ", $textQuery);
         $fullQuery = new Elastica\Query();
         $fullQuery->setQuery($fieldQuery);
         $qb = new Elastica\QueryBuilder();
         $fullQuery = new Elastica\Query();
         $fullQuery->setQuery($qb->query()->filtered($fieldQuery, $qb->filter()->bool()->addMust(new Elastica\Filter\Term(array("ajxp_scope" => "shared")))));
         $result = $search->search($fullQuery, $searchOptions);
         $this->logDebug(__FUNCTION__, "Search finished. ");
         $hits = $result->getResults();
         AJXP_XMLWriter::header();
         foreach ($hits as $hit) {
             $source = $hit->getSource();
             if ($source["serialized_metadata"] != null) {
                 $meta = unserialize(base64_decode($source["serialized_metadata"]));
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($source["node_url"]), $meta);
             } else {
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($source["node_url"]), array());
                 $tmpNode->loadNodeInfo();
             }
             if (!file_exists($tmpNode->getUrl())) {
                 $this->currentType->deleteById($hit->getId());
                 continue;
             }
             $tmpNode->search_score = sprintf("%0.2f", $hit->getScore());
             AJXP_XMLWriter::renderAjxpNode($tmpNode);
         }
         AJXP_XMLWriter::close();
     } else {
         if ($actionName == "search_by_keyword") {
             $scope = "user";
             try {
                 $this->loadIndex($repoId, false);
             } catch (Exception $ex) {
                 throw new Exception($messages["index.lucene.7"]);
             }
             $sParts = array();
             $searchField = $httpVars["field"];
             if ($scope == "user") {
                 if (AuthService::usersEnabled() && AuthService::getLoggedUser() == null) {
                     throw new Exception("Cannot find current user");
                 }
                 $sParts[] = "ajxp_scope:user";
                 $sParts[] = "ajxp_user:" . AuthService::getLoggedUser()->getId();
             } else {
                 $sParts[] = "ajxp_scope:shared";
             }
             $query = implode(" AND ", $sParts);
             $this->logDebug("Query : {$query}");
             $fieldQuery = new Elastica\Query\QueryString();
             $fields = array($searchField);
             $fieldQuery->setQuery($searchField == "ajxp_node" ? "yes" : "true");
             $fieldQuery->setFields($fields);
             $fieldQuery->setAllowLeadingWildcard(false);
             $fieldQuery->setFuzzyMinSim(0.8);
             $search = new Elastica\Search($this->client);
             $search->addIndex($this->currentIndex)->addType($this->currentType);
             $maxResults = $this->getFilteredOption("MAX_RESULTS");
             if (isset($httpVars['limit'])) {
                 $maxResults = intval($httpVars['limit']);
             }
             $searchOptions = array(\Elastica\Search::OPTION_SEARCH_TYPE => \Elastica\Search::OPTION_SEARCH_TYPE_QUERY_THEN_FETCH, \Elastica\Search::OPTION_SIZE => $maxResults);
             // ADD SCOPE FILTER
             $term = new Elastica\Filter\Term();
             $term->setTerm("ajxp_scope", "user");
             $qb = new Elastica\QueryBuilder();
             $fullQuery = new Elastica\Query();
             $fullQuery->setQuery($qb->query()->filtered($fieldQuery, $qb->filter()->bool()->addMust(new Elastica\Filter\Term(array("ajxp_scope" => "user")))->addMust(new Elastica\Filter\Term(array("user" => AuthService::getLoggedUser()->getId())))));
             $result = $search->search($fullQuery, $searchOptions);
             $this->logDebug(__FUNCTION__, "Search finished. ");
             $hits = $result->getResults();
             AJXP_XMLWriter::header();
             foreach ($hits as $hit) {
                 if ($hit->serialized_metadata != null) {
                     $meta = unserialize(base64_decode($hit->serialized_metadata));
                     $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), $meta);
                 } else {
                     $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), array());
                     $tmpNode->loadNodeInfo();
                 }
                 if (!file_exists($tmpNode->getUrl())) {
                     $this->currentType->deleteById($hit->id);
                     continue;
                 }
                 $tmpNode->search_score = sprintf("%0.2f", $hit->score);
                 AJXP_XMLWriter::renderAjxpNode($tmpNode);
             }
             AJXP_XMLWriter::close();
         }
     }
 }
开发者ID:floffel03,项目名称:pydio-core,代码行数:101,代码来源:class.AjxpElasticSearch.php

示例3: listSharesAsNodes

 /**
  * @param $rootPath
  * @param bool|string $currentUser if true, currently logged user. if false all users. If string, user ID.
  * @param string $parentRepositoryId
  * @param null $cursor
  * @param bool $xmlPrint
  * @return AJXP_Node[]
  */
 public function listSharesAsNodes($rootPath, $currentUser = true, $parentRepositoryId = "", $cursor = null, $xmlPrint = false)
 {
     $shares = $this->listShares($currentUser, $parentRepositoryId, $cursor);
     $nodes = array();
     $parent = ConfService::getRepositoryById($parentRepositoryId);
     foreach ($shares as $hash => $shareData) {
         $icon = "folder";
         $meta = array("icon" => $icon, "openicon" => $icon, "ajxp_mime" => "repository_editable");
         $shareType = $shareData["SHARE_TYPE"];
         $meta["share_type"] = $shareType;
         $meta["ajxp_shared"] = true;
         if (!is_object($shareData["REPOSITORY"])) {
             $repoId = $shareData["REPOSITORY"];
             $repoObject = ConfService::getRepositoryById($repoId);
             if ($repoObject == null) {
                 $meta["text"] = "Invalid link";
                 continue;
             }
             $meta["text"] = $repoObject->getDisplay();
             $permissions = $this->getRightsManager()->computeSharedRepositoryAccessRights($repoId, true, null);
             $regularUsers = count(array_filter($permissions, function ($a) {
                 return !isset($a["HIDDEN"]) || $a["HIDDEN"] == false;
             })) > 0;
             $hiddenUsers = count(array_filter($permissions, function ($a) {
                 return isset($a["HIDDEN"]) && $a["HIDDEN"] == true;
             })) > 0;
             if ($regularUsers && $hiddenUsers) {
                 $meta["share_type_readable"] = "Public Link & Internal Users";
             } elseif ($regularUsers) {
                 $meta["share_type_readable"] = "Internal Users";
             } else {
                 if ($hiddenUsers) {
                     $meta["share_type_readable"] = "Public Link";
                 } else {
                     $meta["share_type_readable"] = $repoObject->hasContentFilter() ? "Public Link" : ($shareType == "repository" ? "Internal Users" : "Public Link");
                     if (isset($shareData["LEGACY_REPO_OR_MINI"])) {
                         $meta["share_type_readable"] = "Internal Only";
                     }
                 }
             }
             $meta["share_data"] = $shareType == "repository" ? 'Shared as workspace: ' . $repoObject->getDisplay() : $this->getPublicAccessManager()->buildPublicLink($hash);
             $meta["shared_element_hash"] = $hash;
             $meta["owner"] = $repoObject->getOwner();
             $meta["shared_element_parent_repository"] = $repoObject->getParentId();
             if (!empty($parent)) {
                 $parentPath = $parent->getOption("PATH", false, $meta["owner"]);
                 $meta["shared_element_parent_repository_label"] = $parent->getDisplay();
             } else {
                 $crtParent = ConfService::getRepositoryById($repoObject->getParentId());
                 if (!empty($crtParent)) {
                     $parentPath = $crtParent->getOption("PATH", false, $meta["owner"]);
                     $meta["shared_element_parent_repository_label"] = $crtParent->getDisplay();
                 } else {
                     $meta["shared_element_parent_repository_label"] = $repoObject->getParentId();
                 }
             }
             if ($repoObject->hasContentFilter()) {
                 $meta["ajxp_shared_minisite"] = "file";
                 $meta["icon"] = "mime_empty.png";
                 $meta["original_path"] = array_pop(array_keys($repoObject->getContentFilter()->filters));
             } else {
                 $meta["ajxp_shared_minisite"] = "public";
                 $meta["icon"] = "folder.png";
                 $meta["original_path"] = $repoObject->getOption("PATH");
             }
             if (!empty($parentPath) && strpos($meta["original_path"], $parentPath) === 0) {
                 $meta["original_path"] = substr($meta["original_path"], strlen($parentPath));
             }
         } else {
             if (is_a($shareData["REPOSITORY"], "Repository") && !empty($shareData["FILE_PATH"])) {
                 $meta["owner"] = $shareData["OWNER_ID"];
                 $meta["share_type_readable"] = "Publiclet (legacy)";
                 $meta["text"] = basename($shareData["FILE_PATH"]);
                 $meta["icon"] = "mime_empty.png";
                 $meta["share_data"] = $meta["copy_url"] = $this->getPublicAccessManager()->buildPublicLink($hash);
                 $meta["share_link"] = true;
                 $meta["shared_element_hash"] = $hash;
                 $meta["ajxp_shared_publiclet"] = $hash;
             } else {
                 continue;
             }
         }
         if ($xmlPrint) {
             AJXP_XMLWriter::renderAjxpNode(new AJXP_Node($rootPath . "/" . $hash, $meta));
         } else {
             $nodes[] = new AJXP_Node($rootPath . "/" . $hash, $meta);
         }
     }
     return $nodes;
 }
开发者ID:Nanomani,项目名称:pydio-core,代码行数:98,代码来源:class.ShareCenter.php

示例4: switchAction


//.........这里部分代码省略.........
                 $limitPerPage = $this->repository->getOption("PAGINATION_NUMBER");
                 if (!isset($limitPerPage) || intval($limitPerPage) == 0) {
                     $limitPerPage = 200;
                 }
             }
             $countFiles = $this->countFiles($path, !$lsOptions["f"]);
             if (isset($crt_nodes)) {
                 $crt_nodes += $countFiles;
             }
             if (isset($threshold) && isset($limitPerPage) && $countFiles > $threshold) {
                 if (isset($uniqueFile)) {
                     $originalLimitPerPage = $limitPerPage;
                     $offset = $limitPerPage = 0;
                 } else {
                     $offset = 0;
                     $crtPage = 1;
                     if (isset($page)) {
                         $offset = (intval($page) - 1) * $limitPerPage;
                         $crtPage = $page;
                     }
                     $totalPages = floor($countFiles / $limitPerPage) + 1;
                 }
             } else {
                 $offset = $limitPerPage = 0;
             }
             $metaData = array();
             if (RecycleBinManager::recycleEnabled() && $dir == "") {
                 $metaData["repo_has_recycle"] = "true";
             }
             $parentAjxpNode = new AJXP_Node($nonPatchedPath, $metaData);
             $parentAjxpNode->loadNodeInfo(false, true, $lsOptions["l"] ? "all" : "minimal");
             AJXP_Controller::applyHook("node.read", array(&$parentAjxpNode));
             if (AJXP_XMLWriter::$headerSent == "tree") {
                 AJXP_XMLWriter::renderAjxpNode($parentAjxpNode, false);
             } else {
                 AJXP_XMLWriter::renderAjxpHeaderNode($parentAjxpNode);
             }
             if (isset($totalPages) && isset($crtPage)) {
                 $remoteOptions = null;
                 if ($this->getFilteredOption("REMOTE_SORTING")) {
                     $remoteOptions = array("remote_order" => "true", "currentOrderCol" => isset($orderField) ? $orderField : "ajxp_label", "currentOrderDir" => isset($orderDirection) ? $orderDirection : "asc");
                 }
                 AJXP_XMLWriter::renderPaginationData($countFiles, $crtPage, $totalPages, $this->countFiles($path, TRUE), $remoteOptions);
                 if (!$lsOptions["f"]) {
                     AJXP_XMLWriter::close();
                     exit(1);
                 }
             }
             $cursor = 0;
             $handle = opendir($path);
             if (!$handle) {
                 throw new AJXP_Exception("Cannot open dir " . $nonPatchedPath);
             }
             closedir($handle);
             $fullList = array("d" => array(), "z" => array(), "f" => array());
             if (isset($orderField) && isset($orderDirection) && $orderField == "ajxp_label" && $orderDirection == "desc") {
                 $nodes = scandir($path, 1);
             } else {
                 $nodes = scandir($path);
             }
             if (!empty($this->driverConf["SCANDIR_RESULT_SORTFONC"])) {
                 usort($nodes, $this->driverConf["SCANDIR_RESULT_SORTFONC"]);
             }
             if (isset($orderField) && isset($orderDirection) && $orderField != "ajxp_label") {
                 $toSort = array();
                 foreach ($nodes as $node) {
开发者ID:biggtfish,项目名称:cms,代码行数:67,代码来源:class.fsAccessDriver.php

示例5: applyAction


//.........这里部分代码省略.........
             if ($hit->serialized_metadata != null) {
                 $meta = unserialize(base64_decode($hit->serialized_metadata));
                 if (isset($meta["ajxp_modiftime"])) {
                     $meta["ajxp_relativetime"] = $meta["ajxp_description"] = $messages[4] . " " . AJXP_Utils::relativeDate($meta["ajxp_modiftime"], $messages);
                 }
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), $meta);
             } else {
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), array());
                 $tmpNode->loadNodeInfo();
             }
             if ($tmpNode->getRepositoryId() != $repoId) {
                 $this->logDebug(__CLASS__, "Strange case, search retrieves a node from wrong repository!");
                 $index->delete($hit->id);
                 $commitIndex = true;
                 continue;
             }
             if (!file_exists($tmpNode->getUrl())) {
                 $index->delete($hit->id);
                 $commitIndex = true;
                 continue;
             }
             if (!is_readable($tmpNode->getUrl())) {
                 continue;
             }
             $basename = basename($tmpNode->getPath());
             $isLeaf = $tmpNode->isLeaf();
             if (!$this->accessDriver->filterNodeName($tmpNode->getPath(), $basename, $isLeaf, array("d" => true, "f" => true))) {
                 continue;
             }
             $tmpNode->search_score = sprintf("%0.2f", $hit->score);
             if (isset($returnNodes)) {
                 $returnNodes[] = $tmpNode;
             } else {
                 AJXP_XMLWriter::renderAjxpNode($tmpNode);
             }
             $cursor++;
             if (isset($limit) && $cursor > $limit) {
                 break;
             }
         }
         if (!isset($returnNodes)) {
             AJXP_XMLWriter::close();
         }
         if ($commitIndex) {
             $index->commit();
         }
     } else {
         if ($actionName == "search_by_keyword") {
             require_once "Zend/Search/Lucene.php";
             $scope = "user";
             try {
                 $index = $this->loadIndex($repoId, false);
             } catch (Exception $ex) {
                 AJXP_XMLWriter::header();
                 if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
                     AJXP_Controller::applyActionInBackground($repoId, "index", array());
                     AJXP_XMLWriter::triggerBgAction("check_index_status", array("repository_id" => $repoId), sprintf($messages["index.lucene.8"], "/"), true, 2);
                 }
                 AJXP_XMLWriter::sendMessage($messages["index.lucene.7"], null);
                 AJXP_XMLWriter::close();
                 return null;
             }
             $sParts = array();
             $searchField = $httpVars["field"];
             if ($searchField == "ajxp_node") {
                 $sParts[] = "{$searchField}:yes";
开发者ID:thermalpaste,项目名称:pydio-core,代码行数:67,代码来源:class.AjxpLuceneIndexer.php

示例6: loadUserAlerts


//.........这里部分代码省略.........
     }
     // Recompute children notifs
     $format = $httpVars["format"];
     $skipContainingTags = isset($httpVars["skip_container_tags"]);
     $mess = ConfService::getMessages();
     if (!$skipContainingTags) {
         if ($format == "html") {
             echo "<h2>" . $mess["notification_center.3"] . "</h2>";
             echo "<ul class='notification_list'>";
         } else {
             AJXP_XMLWriter::header();
         }
     }
     $parentRepository = ConfService::getRepositoryById($repositoryFilter);
     $parentRoot = $parentRepository->getOption("PATH");
     $cumulated = array();
     foreach ($res as $notification) {
         if ($format == "html") {
             echo "<li>";
             echo $notification->getDescriptionLong(true);
             echo "</li>";
         } else {
             $node = $notification->getNode();
             $path = $node->getPath();
             $nodeRepo = $node->getRepository();
             if ($nodeRepo != null && $nodeRepo->hasParent() && $nodeRepo->getParentId() == $repositoryFilter) {
                 $currentRoot = $nodeRepo->getOption("PATH");
                 $contentFilter = $nodeRepo->getContentFilter();
                 if (isset($contentFilter)) {
                     $nodePath = $contentFilter->filterExternalPath($node->getPath());
                     if ($nodePath == "/") {
                         $k = array_keys($contentFilter->filters);
                         $nodePath = $k[0];
                     }
                 } else {
                     $nodePath = $node->getPath();
                 }
                 $relative = rtrim(substr($currentRoot, strlen($parentRoot)), "/") . rtrim($nodePath, "/");
                 $parentNodeURL = $node->getScheme() . "://" . $repositoryFilter . $relative;
                 $this->logDebug("action.share", "Recompute alert to " . $parentNodeURL);
                 $node = new AJXP_Node($parentNodeURL);
             }
             if (isset($cumulated[$path])) {
                 $cumulated[$path]->event_occurence++;
                 continue;
             }
             try {
                 $node->loadNodeInfo();
             } catch (Exception $e) {
                 if ($notification->alert_id) {
                     $this->eventStore->dismissAlertById($notification->alert_id);
                 }
                 continue;
             }
             $node->event_is_alert = true;
             $node->event_description = ucfirst($notification->getDescriptionBlock()) . " " . $mess["notification.tpl.block.user_link"] . " " . $notification->getAuthorLabel();
             $node->event_description_long = $notification->getDescriptionLong(true);
             $node->event_date = SystemTextEncoding::fromUTF8(AJXP_Utils::relativeDate($notification->getDate(), $mess));
             $node->event_type = "alert";
             $node->alert_id = $notification->alert_id;
             if ($node->getRepository() != null) {
                 $node->repository_id = '' . $node->getRepository()->getId();
                 if ($node->repository_id != $repositoryFilter && $node->getRepository()->getDisplay() != null) {
                     $node->event_repository_label = "[" . $node->getRepository()->getDisplay() . "]";
                 }
             } else {
                 $node->event_repository_label = "[N/A]";
             }
             $node->event_author = $notification->getAuthor();
             $node->event_occurence = 1;
             $cumulated[$path] = $node;
         }
     }
     $index = 1;
     foreach ($cumulated as $nodeToSend) {
         $nodeOcc = $nodeToSend->event_occurence > 1 ? "(" . $nodeToSend->event_occurence . ")" : "";
         if (isset($httpVars["merge_description"]) && $httpVars["merge_description"] == "true") {
             if (isset($httpVars["description_as_label"]) && $httpVars["description_as_label"] == "true") {
                 $nodeToSend->setLabel($nodeToSend->event_description . " " . $nodeOcc . " " . $nodeToSend->event_date);
             } else {
                 $nodeToSend->setLabel(basename($nodeToSend->getPath()) . " " . $nodeOcc . " " . " <small class='notif_desc'>" . $nodeToSend->event_description . " " . $nodeToSend->event_date . "</small>");
             }
         } else {
             $nodeToSend->setLabel(basename($nodeToSend->getPath()) . $nodeOcc);
         }
         // Replace PATH
         $nodeToSend->real_path = $path;
         //$url = parse_url($nodeToSend->getUrl());
         //$nodeToSend->setUrl($url["scheme"]."://".$url["host"]."/alert_".$index);
         $index++;
         AJXP_XMLWriter::renderAjxpNode($nodeToSend);
     }
     if (!$skipContainingTags) {
         if ($format == "html") {
             echo "</ul>";
         } else {
             AJXP_XMLWriter::close();
         }
     }
 }
开发者ID:projectesIF,项目名称:Ateneu,代码行数:101,代码来源:class.AJXP_NotificationCenter.php

示例7: listSharesAsNodes

 /**
  * @param $rootPath
  * @param bool $currentUser
  * @param string $parentRepositoryId
  * @param null $cursor
  * @param bool $xmlPrint
  * @return AJXP_Node[]
  */
 public function listSharesAsNodes($rootPath, $currentUser = true, $parentRepositoryId = "", $cursor = null, $xmlPrint = false)
 {
     $shares = $this->listShares($currentUser, $parentRepositoryId, $cursor);
     $nodes = array();
     foreach ($shares as $hash => $shareData) {
         $icon = "hdd_external_mount.png";
         $meta = array("icon" => $icon, "openicon" => $icon, "ajxp_mime" => "repository_editable");
         $shareType = $shareData["SHARE_TYPE"];
         $meta["share_type"] = $shareType;
         $meta["ajxp_shared"] = true;
         if (!is_object($shareData["REPOSITORY"])) {
             $repoId = $shareData["REPOSITORY"];
             $repoObject = ConfService::getRepositoryById($repoId);
             if ($repoObject == null) {
                 $meta["text"] = "Invalid link";
                 continue;
             }
             $meta["text"] = $repoObject->getDisplay();
             $meta["share_type_readable"] = $repoObject->hasContentFilter() ? "Publiclet" : ($shareType == "repository" ? "Workspace" : "Minisite");
             if (isset($shareData["LEGACY_REPO_OR_MINI"])) {
                 $meta["share_type_readable"] = "Repository or Minisite (legacy)";
             }
             $meta["share_data"] = $shareType == "repository" ? 'Shared as workspace: ' . $repoObject->getDisplay() : $this->buildPublicletLink($hash);
             $meta["shared_element_hash"] = $hash;
             $meta["owner"] = $repoObject->getOwner();
             if ($shareType != "repository") {
                 $meta["copy_url"] = $this->buildPublicletLink($hash);
             }
             $meta["shared_element_parent_repository"] = $repoObject->getParentId();
             $parent = ConfService::getRepositoryById($repoObject->getParentId());
             if (!empty($parent)) {
                 $meta["shared_element_parent_repository_label"] = $parent->getDisplay();
             } else {
                 $meta["shared_element_parent_repository_label"] = $repoObject->getParentId();
             }
             if ($shareType != "repository") {
                 if ($repoObject->hasContentFilter()) {
                     $meta["ajxp_shared_minisite"] = "file";
                     $meta["icon"] = "mime_empty.png";
                 } else {
                     $meta["ajxp_shared_minisite"] = "public";
                     $meta["icon"] = "folder.png";
                 }
                 $meta["icon"] = $repoObject->hasContentFilter() ? "mime_empty.png" : "folder.png";
             }
         } else {
             if (is_a($shareData["REPOSITORY"], "Repository") && !empty($shareData["FILE_PATH"])) {
                 $meta["owner"] = $shareData["OWNER_ID"];
                 $meta["share_type_readable"] = "Publiclet (legacy)";
                 $meta["text"] = basename($shareData["FILE_PATH"]);
                 $meta["icon"] = "mime_empty.png";
                 $meta["share_data"] = $meta["copy_url"] = $this->buildPublicletLink($hash);
                 $meta["share_link"] = true;
                 $meta["shared_element_hash"] = $hash;
                 $meta["ajxp_shared_publiclet"] = $hash;
             } else {
                 continue;
             }
         }
         if ($xmlPrint) {
             AJXP_XMLWriter::renderAjxpNode(new AJXP_Node($rootPath . "/" . $hash, $meta));
         } else {
             $nodes[] = new AJXP_Node($rootPath . "/" . $hash, $meta);
         }
     }
     return $nodes;
 }
开发者ID:saydulk,项目名称:pydio-core,代码行数:75,代码来源:class.ShareCenter.php

示例8: loadUserAlerts

 public function loadUserAlerts($actionName, $httpVars, $fileVars)
 {
     if (!$this->eventStore) {
         return;
     }
     $u = AuthService::getLoggedUser();
     $userId = $u->getId();
     $repositoryFilter = null;
     if (isset($httpVars["repository_id"]) && $u->mergedRole->canRead($httpVars["repository_id"])) {
         $repositoryFilter = $httpVars["repository_id"];
     }
     $res = $this->eventStore->loadAlerts($userId, $repositoryFilter);
     if ($repositoryFilter == null) {
         $repositoryFilter = ConfService::getRepository()->getId();
     }
     if (!count($res)) {
         return;
     }
     $format = $httpVars["format"];
     $skipContainingTags = isset($httpVars["skip_container_tags"]);
     $mess = ConfService::getMessages();
     if (!$skipContainingTags) {
         if ($format == "html") {
             echo "<h2>" . $mess["notification_center.3"] . "</h2>";
             echo "<ul class='notification_list'>";
         } else {
             AJXP_XMLWriter::header();
         }
     }
     $cumulated = array();
     foreach ($res as $notification) {
         if ($format == "html") {
             echo "<li>";
             echo $notification->getDescriptionLong(true);
             echo "</li>";
         } else {
             $node = $notification->getNode();
             $path = $node->getPath();
             if (isset($cumulated[$path])) {
                 $cumulated[$path]->event_occurence++;
                 continue;
             }
             try {
                 $node->loadNodeInfo();
             } catch (Exception $e) {
                 continue;
             }
             $node->event_is_alert = true;
             $node->event_description = ucfirst($notification->getDescriptionBlock()) . " " . $mess["notification.tpl.block.user_link"] . " " . $notification->getAuthor();
             $node->event_description_long = $notification->getDescriptionLong(true);
             $node->event_date = AJXP_Utils::relativeDate($notification->getDate(), $mess);
             $node->event_type = "alert";
             $node->alert_id = $notification->alert_id;
             if ($node->getRepository() != null) {
                 $node->repository_id = '' . $node->getRepository()->getId();
                 if ($node->repository_id != $repositoryFilter && $node->getRepository()->getDisplay() != null) {
                     $node->event_repository_label = "[" . $node->getRepository()->getDisplay() . "]";
                 }
             } else {
                 $node->event_repository_label = "[N/A]";
             }
             $node->event_author = $notification->getAuthor();
             $node->event_occurence = 1;
             $cumulated[$path] = $node;
         }
     }
     $index = 1;
     foreach ($cumulated as $nodeToSend) {
         if ($nodeToSend->event_occurence > 1) {
             $nodeToSend->setLabel(basename($nodeToSend->getPath()) . " (" . $nodeToSend->event_occurence . ")");
         } else {
             $nodeToSend->setLabel(basename($nodeToSend->getPath()));
         }
         // Replace PATH
         $nodeToSend->real_path = $path;
         $url = parse_url($nodeToSend->getUrl());
         $nodeToSend->setUrl($url["scheme"] . "://" . $url["host"] . "/alert_" . $index);
         $index++;
         AJXP_XMLWriter::renderAjxpNode($nodeToSend);
     }
     if (!$skipContainingTags) {
         if ($format == "html") {
             echo "</ul>";
         } else {
             AJXP_XMLWriter::close();
         }
     }
 }
开发者ID:biggtfish,项目名称:cms,代码行数:88,代码来源:class.AJXP_NotificationCenter.php

示例9: applyAction

 public function applyAction($actionName, $httpVars, $fileVars)
 {
     $messages = ConfService::getMessages();
     if ($actionName == "search") {
         require_once "Zend/Search/Lucene.php";
         if ($this->isIndexLocked(ConfService::getRepository()->getId())) {
             throw new Exception($messages["index.lucene.6"]);
         }
         try {
             $index = $this->loadIndex(ConfService::getRepository()->getId(), false);
         } catch (Exception $ex) {
             $this->applyAction("index", array(), array());
             throw new Exception($messages["index.lucene.7"]);
         }
         if ((isset($this->metaFields) || $this->indexContent) && isset($httpVars["fields"])) {
             $sParts = array();
             foreach (explode(",", $httpVars["fields"]) as $searchField) {
                 if ($searchField == "filename") {
                     $sParts[] = "basename:" . $httpVars["query"];
                 } else {
                     if (in_array($searchField, $this->metaFields)) {
                         $sParts[] = "ajxp_meta_" . $searchField . ":" . $httpVars["query"];
                     } else {
                         if ($searchField == "ajxp_document_content") {
                             $sParts[] = "title:" . $httpVars["query"];
                             $sParts[] = "body:" . $httpVars["query"];
                             $sParts[] = "keywords:" . $httpVars["query"];
                         }
                     }
                 }
             }
             $query = implode(" OR ", $sParts);
             AJXP_Logger::debug("Query : {$query}");
         } else {
             $index->setDefaultSearchField("basename");
             $query = $httpVars["query"];
         }
         $hits = $index->find($query);
         $commitIndex = false;
         AJXP_XMLWriter::header();
         foreach ($hits as $hit) {
             $meta = array();
             //$isDir = false; // TO BE STORED IN INDEX
             //$meta["icon"] = AJXP_Utils::mimetype(SystemTextEncoding::fromUTF8($hit->node_url), "image", $isDir);
             if ($hit->serialized_metadata != null) {
                 $meta = unserialize(base64_decode($hit->serialized_metadata));
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), $meta);
             } else {
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($hit->node_url), array());
                 $tmpNode->loadNodeInfo();
             }
             if (!file_exists($tmpNode->getUrl())) {
                 $index->delete($hit->id);
                 $commitIndex = true;
                 continue;
             }
             $tmpNode->search_score = sprintf("%0.2f", $hit->score);
             AJXP_XMLWriter::renderAjxpNode($tmpNode);
         }
         AJXP_XMLWriter::close();
         if ($commitIndex) {
             $index->commit();
         }
     } else {
         if ($actionName == "index") {
             $dir = AJXP_Utils::decodeSecureMagic($httpVars["dir"]);
             if (empty($dir)) {
                 $dir = "/";
             }
             $repo = ConfService::getRepository();
             if ($this->isIndexLocked($repo->getId())) {
                 throw new Exception($messages["index.lucene.6"]);
             }
             $accessType = $repo->getAccessType();
             $accessPlug = AJXP_PluginsService::getInstance()->getPluginByTypeName("access", $accessType);
             $stData = $accessPlug->detectStreamWrapper(true);
             $repoId = $repo->getId();
             $url = $stData["protocol"] . "://" . $repoId . $dir;
             if (isset($httpVars["verbose"]) && $httpVars["verbose"] == "true") {
                 $this->verboseIndexation = true;
             }
             if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
                 AJXP_Controller::applyActionInBackground($repoId, "index", $httpVars);
                 AJXP_XMLWriter::header();
                 AJXP_XMLWriter::triggerBgAction("check_lock", array(), sprintf($messages["index.lucene.8"], $dir), true, 2);
                 AJXP_XMLWriter::close();
                 return;
             }
             $this->lockIndex($repoId);
             // GIVE BACK THE HAND TO USER
             session_write_close();
             $this->currentIndex = $this->loadIndex($repoId);
             $this->recursiveIndexation($url);
             if (ConfService::currentContextIsCommandLine() && $this->verboseIndexation) {
                 print "Optimizing\n";
             }
             $this->currentIndex->optimize();
             if (ConfService::currentContextIsCommandLine() && $this->verboseIndexation) {
                 print "Commiting Index\n";
             }
//.........这里部分代码省略.........
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:101,代码来源:class.AjxpLuceneIndexer.php

示例10: applyAction

 public function applyAction($actionName, $httpVars, $fileVars)
 {
     $messages = ConfService::getMessages();
     $repoId = ConfService::getRepository()->getId();
     if ($actionName == "search") {
         // TMP
         if (strpos($httpVars["query"], "keyword:") === 0) {
             $parts = explode(":", $httpVars["query"]);
             $this->applyAction("search_by_keyword", array("field" => $parts[1]), array());
             return;
         }
         if ($this->isIndexLocked($repoId)) {
             throw new Exception($messages["index.lucene.6"]);
         }
         try {
             $this->loadIndex($repoId, false);
         } catch (Exception $ex) {
             $this->applyAction("index", array(), array());
             throw new Exception($messages["index.lucene.7"]);
         }
         /*
         
         if ((isSet($this->metaFields) || $this->indexContent) && isSet($httpVars["fields"])) {
              $sParts = array();
              foreach (explode(",",$httpVars["fields"]) as $searchField) {
                  if ($searchField == "filename") {
                      $sParts[] = "basename:".$httpVars["query"];
                  } else if (in_array($searchField, $this->metaFields)) {
                      $sParts[] = "ajxp_meta_".$searchField.":".$httpVars["query"];
                  } else if ($searchField == "ajxp_document_content") {
                      $sParts[] = "title:".$httpVars["query"];
                      $sParts[] = "body:".$httpVars["query"];
                      $sParts[] = "keywords:".$httpVars["query"];
                  }
              }
              $query = implode(" OR ", $sParts);
              $query = "ajxp_scope:shared AND ($query)";
              $this->logDebug("Query : $query");
         } else {
         */
         $this->currentIndex->open();
         $query = $httpVars["query"];
         $fieldQuery = new Elastica\Query\Field();
         //}
         //$this->setDefaultAnalyzer();
         if ($query == "*") {
             $fieldQuery->setField("ajxp_node");
             $fieldQuery->setQueryString("yes");
         } else {
             $fieldQuery->setField("basename");
             $fieldQuery->setQueryString($query);
         }
         /*
            We create this object search because it'll allow us to fetch the number of results we want at once.
            We just have to set some parameters, the query type and the size of the result set.
         */
         $search = new Elastica\Search($this->client);
         $search->addIndex($this->currentIndex)->addType($this->currentType);
         $maxResults = $this->getFilteredOption("MAX_RESULTS");
         $searchOptions = array(\Elastica\Search::OPTION_SEARCH_TYPE => \Elastica\Search::OPTION_SEARCH_TYPE_QUERY_THEN_FETCH, \Elastica\Search::OPTION_SIZE => $maxResults);
         $result = $search->search($fieldQuery, $searchOptions);
         $total_hits = $result->getTotalHits();
         $hits = $result->getResults();
         AJXP_XMLWriter::header();
         for ($i = 0, $count = count($hits); $i < $count; $i++) {
             $hit = $hits[$i];
             $source = $hit->getSource();
             if ($source["serialized_metadata"] != null) {
                 $meta = unserialize(base64_decode($source["serialized_metadata"]));
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($source["node_url"]), $meta);
             } else {
                 $tmpNode = new AJXP_Node(SystemTextEncoding::fromUTF8($source["node_url"]), array());
                 $tmpNode->loadNodeInfo();
             }
             if (!file_exists($tmpNode->getUrl())) {
                 $this->currentType->deleteById($hit->getId());
                 continue;
             }
             $tmpNode->search_score = sprintf("%0.2f", $hit->getScore());
             AJXP_XMLWriter::renderAjxpNode($tmpNode);
         }
         AJXP_XMLWriter::close();
         $this->currentIndex->close();
     } else {
         if ($actionName == "search_by_keyword") {
             /*    require_once("Zend/Search/Lucene.php");
                         $scope = "user";
             
                         if ($this->isIndexLocked(ConfService::getRepository()->getId())) {
                             throw new Exception($messages["index.lucene.6"]);
                         }
                         try {
                             $this->currentInd =  $this->loadIndex(ConfService::getRepository()->getId(), false);
                         } catch (Exception $ex) {
                             $this->applyAction("index", array(), array());
                             throw new Exception($messages["index.lucene.7"]);
                         }
                         $sParts = array();
                         $searchField = $httpVars["field"];
                         if ($searchField == "ajxp_node") {
//.........这里部分代码省略.........
开发者ID:rmxcc,项目名称:pydio-core,代码行数:101,代码来源:class.AjxpElasticSearch.php


注:本文中的AJXP_XMLWriter::renderAjxpNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。