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


PHP AJXP_XMLWriter::renderPaginationData方法代码示例

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


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

示例1: switchAction


//.........这里部分代码省略.........
             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) {
                     if ($orderField == "filesize") {
                         $toSort[$node] = is_file($nonPatchedPath . "/" . $node) ? $this->filesystemFileSize($nonPatchedPath . "/" . $node) : 0;
                     } else {
                         if ($orderField == "ajxp_modiftime") {
                             $toSort[$node] = filemtime($nonPatchedPath . "/" . $node);
                         } else {
                             if ($orderField == "mimestring") {
                                 $toSort[$node] = pathinfo($node, PATHINFO_EXTENSION);
                             }
开发者ID:biggtfish,项目名称:cms,代码行数:67,代码来源:class.fsAccessDriver.php

示例2: listRepositories

 public function listRepositories($root, $child, $hashValue = null, $returnNodes = false)
 {
     $REPOS_PER_PAGE = 50;
     $allNodes = array();
     if ($hashValue == null) {
         $hashValue = 1;
     }
     $offset = ($hashValue - 1) * $REPOS_PER_PAGE;
     $count = null;
     // Load all repositories = normal, templates, and templates children
     $currentUserIsGroupAdmin = AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != "/";
     if ($currentUserIsGroupAdmin) {
         $repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => AJXP_FILTER_EMPTY, "groupPath" => "regexp:/^" . str_replace("/", "\\/", AuthService::getLoggedUser()->getGroupPath()) . '/', "ORDERBY" => array("KEY" => "display", "DIR" => "ASC"), "CURSOR" => array("OFFSET" => $offset, "LIMIT" => $REPOS_PER_PAGE)), $count);
     } else {
         $repos = ConfService::listRepositoriesWithCriteria(array("parent_uuid" => AJXP_FILTER_EMPTY, "ORDERBY" => array("KEY" => "display", "DIR" => "ASC"), "CURSOR" => array("OFFSET" => $offset, "LIMIT" => $REPOS_PER_PAGE)), $count);
     }
     if (!$returnNodes) {
         var_dump($count);
         AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $REPOS_PER_PAGE));
         AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.repositories">
             <column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/>
             <column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/>
             <column messageId="ajxp_conf.125" attributeName="slug" sortType="String"/>
         </columns>');
     }
     foreach ($repos as $repoIndex => $repoObject) {
         if ($repoObject->getAccessType() == "ajxp_conf" || $repoObject->getAccessType() == "ajxp_shared") {
             continue;
         }
         if (!AuthService::canAdministrate($repoObject)) {
             continue;
         }
         if (is_numeric($repoIndex)) {
             $repoIndex = "" . $repoIndex;
         }
         $icon = "hdd_external_unmount.png";
         $editable = $repoObject->isWriteable();
         if ($repoObject->isTemplate) {
             $icon = "hdd_external_mount.png";
             if (AuthService::getLoggedUser() != null && AuthService::getLoggedUser()->getGroupPath() != "/") {
                 $editable = false;
             }
         }
         $meta = array("repository_id" => $repoIndex, "accessType" => ($repoObject->isTemplate ? "Template for " : "") . $repoObject->getAccessType(), "icon" => $icon, "owner" => $repoObject->hasOwner() ? $repoObject->getOwner() : "", "openicon" => $icon, "slug" => $repoObject->getSlug(), "parentname" => "/repositories", "ajxp_mime" => "repository" . ($editable ? "_editable" : ""));
         $nodeKey = "/data/repositories/{$repoIndex}";
         if (in_array($nodeKey, $this->currentBookmarks)) {
             $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
         }
         $xml = AJXP_XMLWriter::renderNode($nodeKey, AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay())), true, $meta, true, false);
         if ($returnNodes) {
             $allNodes[$nodeKey] = $xml;
         } else {
             print $xml;
         }
         if ($repoObject->isTemplate) {
             // Now Load children for template repositories
             $children = ConfService::listRepositoriesWithCriteria(array("parent_uuid" => $repoIndex . ""), $count);
             foreach ($children as $childId => $childObject) {
                 if (!AuthService::canAdministrate($childObject)) {
                     continue;
                 }
                 if (is_numeric($childId)) {
                     $childId = "" . $childId;
                 }
                 $meta = array("repository_id" => $childId, "accessType" => $childObject->getAccessType(), "icon" => "repo_child.png", "owner" => $childObject->hasOwner() ? $childObject->getOwner() : "", "openicon" => "repo_child.png", "parentname" => "/repositories", "ajxp_mime" => "repository_editable");
                 $cNodeKey = "/data/repositories/{$childId}";
                 if (in_array($cNodeKey, $this->currentBookmarks)) {
                     $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
                 }
                 $xml = AJXP_XMLWriter::renderNode($cNodeKey, AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($childObject->getDisplay())), true, $meta, true, false);
                 if ($returnNodes) {
                     $allNodes[$cNodeKey] = $xml;
                 } else {
                     print $xml;
                 }
             }
         }
     }
 }
开发者ID:rcmarotz,项目名称:pydio-core,代码行数:79,代码来源:class.ajxp_confAccessDriver.php

示例3: switchAction


//.........这里部分代码省略.........
             if (!isset($threshold) || intval($threshold) == 0) {
                 $threshold = 500;
             }
             $limitPerPage = $this->repository->getOption("PAGINATION_NUMBER");
             if (!isset($limitPerPage) || intval($limitPerPage) == 0) {
                 $limitPerPage = 200;
             }
             $countFiles = $this->countFiles($path, !$lsOptions["f"]);
             if ($countFiles > $threshold) {
                 $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();
             $crtLabel = AJXP_Utils::xmlEntities(basename($dir), true);
             if (RecycleBinManager::recycleEnabled()) {
                 if (RecycleBinManager::currentLocationIsRecycle($dir)) {
                     $metaData["ajxp_mime"] = "ajxp_recycle";
                     $crtLabel = AJXP_Utils::xmlEntities($mess[122]);
                 } else {
                     if ($dir == "") {
                         $metaData["repo_has_recycle"] = "true";
                     }
                 }
             }
             AJXP_XMLWriter::renderHeaderNode(AJXP_Utils::xmlEntities($dir, true), $crtLabel, false, $metaData);
             if (isset($totalPages) && isset($crtPage)) {
                 AJXP_XMLWriter::renderPaginationData($countFiles, $crtPage, $totalPages);
                 if (!$lsOptions["f"]) {
                     AJXP_XMLWriter::close();
                     exit(1);
                 }
             }
             $cursor = 0;
             $handle = opendir($path);
             if (!$handle) {
                 throw new AJXP_Exception("Cannot open dir " . $path);
             }
             $fullList = array("d" => array(), "z" => array(), "f" => array());
             while (strlen($nodeName = readdir($handle)) > 0) {
                 if ($nodeName == "." || $nodeName == "..") {
                     continue;
                 }
                 $isLeaf = is_file($path . "/" . $nodeName) || AJXP_Utils::isBrowsableArchive($nodeName);
                 if (!$this->filterNodeName($path, $nodeName, $isLeaf, $lsOptions)) {
                     continue;
                 }
                 if (RecycleBinManager::recycleEnabled() && $dir == "" && "/" . $nodeName == RecycleBinManager::getRecyclePath()) {
                     continue;
                 }
                 $nodeType = "d";
                 if ($isLeaf) {
                     if (AJXP_Utils::isBrowsableArchive($nodeName)) {
                         if ($lsOptions["f"] && $lsOptions["z"]) {
                             // See archives as files
                             $nodeType = "f";
                         } else {
                             $nodeType = "z";
                         }
                     } else {
开发者ID:umbecr,项目名称:camilaframework,代码行数:67,代码来源:class.fsAccessDriver.php

示例4: listUsers

 function listUsers($root, $child, $hashValue = null)
 {
     $columns = '<columns switchGridMode="filelist" template_name="ajxp_conf.users">
     			<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
     			<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="10%"/>
     			<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
     			<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
     			</columns>';
     if (AuthService::driverSupportsAuthSchemes()) {
         $columns = '<columns switchGridMode="filelist" template_name="ajxp_conf.users">
         			<column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
         			<column messageId="ajxp_conf.115" attributeName="auth_scheme" sortType="String" defaultWidth="5%"/>
         			<column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="5%"/>
         			<column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
         			<column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
         </columns>';
     }
     AJXP_XMLWriter::sendFilesListComponentConfig($columns);
     if (!AuthService::usersEnabled()) {
         return;
     }
     $count = AuthService::authCountUsers();
     $USER_PER_PAGE = 50;
     if (empty($hashValue)) {
         $hashValue = 1;
     }
     if (AuthService::authSupportsPagination() && $count > $USER_PER_PAGE) {
         $offset = ($hashValue - 1) * $USER_PER_PAGE;
         AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $USER_PER_PAGE));
         $users = AuthService::listUsers("", $offset, $USER_PER_PAGE);
     } else {
         $users = AuthService::listUsers();
     }
     $mess = ConfService::getMessages();
     $repos = ConfService::getRepositoriesList();
     $loggedUser = AuthService::getLoggedUser();
     $userArray = array();
     foreach ($users as $userIndex => $userObject) {
         $label = $userObject->getId();
         if ($userObject->hasParent()) {
             $label = $userObject->getParent() . "000" . $label;
         }
         $userArray[$label] = $userObject;
     }
     ksort($userArray);
     foreach ($userArray as $userObject) {
         $isAdmin = $userObject->isAdmin();
         $userId = $userObject->getId();
         $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
         if ($userObject->hasParent()) {
             $icon = "user_child";
         }
         $rightsString = "";
         if ($isAdmin) {
             $rightsString = $mess["ajxp_conf.63"];
         } else {
             $r = array();
             foreach ($repos as $repoId => $repository) {
                 if ($repository->getAccessType() == "ajxp_shared") {
                     continue;
                 }
                 if (!$userObject->canRead($repoId) && !$userObject->canWrite($repoId)) {
                     continue;
                 }
                 $rs = $userObject->canRead($repoId) ? "r" : "";
                 $rs .= $userObject->canWrite($repoId) ? "w" : "";
                 $r[] = $repository->getDisplay() . " (" . $rs . ")";
             }
             $rightsString = implode(", ", $r);
         }
         $nodeLabel = $userId;
         $scheme = AuthService::getAuthScheme($userId);
         AJXP_XMLWriter::renderNode("/users/" . $userId, $nodeLabel, true, array("isAdmin" => $mess[$isAdmin ? "ajxp_conf.14" : "ajxp_conf.15"], "icon" => $icon . ".png", "auth_scheme" => $scheme != null ? $scheme : "", "rights_summary" => $rightsString, "ajxp_roles" => implode(", ", array_keys($userObject->getRoles())), "ajxp_mime" => "user" . ($userId != "guest" && $userId != $loggedUser->getId() ? "_editable" : "")));
     }
 }
开发者ID:crodriguezn,项目名称:administrator-files,代码行数:75,代码来源:class.ajxp_confAccessDriver.php

示例5: switchAction


//.........这里部分代码省略.........
                     $currentPage = 1;
                 }
                 $query = "SELECT * FROM {$tableName}";
                 $searchQuery = false;
                 if ($tableName == "ajxpmysqldriver_searchresults") {
                     if (isset($_SESSION["LAST_SQL_QUERY"])) {
                         $query = $_SESSION["LAST_SQL_QUERY"];
                         $matches = array();
                         if (preg_match("/SELECT [\\S, ]* FROM (\\S*).*/i", $query, $matches) !== false) {
                             $tableName = $matches[1];
                             $searchQuery = true;
                         } else {
                             break;
                         }
                     } else {
                         break;
                     }
                 }
                 if (isset($order_column)) {
                     $query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
                     if (!isset($_SESSION["AJXP_ORDER_DATA"])) {
                         $_SESSION["AJXP_ORDER_DATA"] = array();
                     }
                     $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName] = array("column" => $order_column, "dir" => $order_direction);
                 } else {
                     if (isset($_SESSION["AJXP_ORDER_DATA"])) {
                         if (isset($_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName])) {
                             $order_column = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["column"];
                             $order_direction = $_SESSION["AJXP_ORDER_DATA"][$this->repository->getUniqueId() . "_" . $tableName]["dir"];
                             $query .= " ORDER BY {$order_column} " . strtoupper($order_direction);
                         }
                     }
                 }
                 try {
                     $result = $this->showRecords($query, $tableName, $currentPage);
                 } catch (AJXP_Exception $ex) {
                     unset($_SESSION["LAST_SQL_QUERY"]);
                     throw $ex;
                 }
                 AJXP_XMLWriter::header();
                 $blobCols = array();
                 $columnsString = '<columns switchDisplayMode="list" switchGridMode="grid">';
                 foreach ($result["COLUMNS"] as $col) {
                     $columnsString .= "<column messageString=\"" . $col["NAME"] . "\" attributeName=\"" . $col["NAME"] . "\" field_name=\"" . $col["NAME"] . "\" field_type=\"" . $col["TYPE"] . "\" field_size=\"" . $col["LENGTH"] . "\" field_flags=\"" . $this->cleanFlagString($col["FLAGS"]) . "\" field_pk=\"" . (preg_match("/primary/", $col["FLAGS"]) ? "1" : "0") . "\" field_null=\"" . (preg_match("/not_null/", $col["FLAGS"]) ? "NOT_NULL" : "NULL") . "\" sortType=\"" . $this->sqlTypeToSortType($col["TYPE"]) . "\" field_default=\"" . $col["DEFAULT"] . "\"/>";
                     if (stristr($col["TYPE"], "blob") !== false && ($col["FLAGS"] != "" && stristr($col["FLAGS"], "binary"))) {
                         $blobCols[] = $col["NAME"];
                     }
                 }
                 $columnsString .= '</columns>';
                 AJXP_XMLWriter::sendFilesListComponentConfig($columnsString);
                 //print '<pagination total="'.$result["TOTAL_PAGES"].'" current="'.$currentPage.'" remote_order="true" currentOrderCol="'.$order_column.'" currentOrderDir="'.$order_direction.'"/>';
                 if ($result["TOTAL_PAGES"] > 1) {
                     AJXP_XMLWriter::renderPaginationData($count, $currentPage, $result["TOTAL_PAGES"]);
                 }
                 foreach ($result["ROWS"] as $arbitIndex => $row) {
                     print '<tree ';
                     $pkString = "";
                     foreach ($row as $key => $value) {
                         if (in_array($key, $blobCols)) {
                             $sizeStr = " - NULL";
                             if (strlen($value)) {
                                 $sizeStr = " - " . AJXP_Utils::roundSize(strlen($value));
                             }
                             print "{$key}=\"BLOB{$sizeStr}\" ";
                         } else {
                             $value = str_replace("\"", "", $value);
                             $value = AJXP_Utils::xmlEntities($value);
                             print $key . '="' . SystemTextEncoding::toUTF8($value) . '" ';
                             if ($result["HAS_PK"] > 0) {
                                 if (in_array($key, $result["PK_FIELDS"])) {
                                     $pkString .= $key . "__" . $value . ".";
                                 }
                             }
                         }
                     }
                     if ($result["HAS_PK"] > 0) {
                         print 'filename="record.' . $pkString . 'pk" ';
                         print 'is_file="1" ajxp_mime="pk"/>';
                     } else {
                         print 'filename="record_' . $arbitIndex . '.no_pk" ';
                         print 'is_file="1" ajxp_mime="row"/>';
                     }
                 }
                 AJXP_XMLWriter::close();
             }
             $this->closeDbLink($link);
             exit(1);
             break;
     }
     if (isset($logMessage) || isset($errorMessage)) {
         $xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
     }
     if (isset($requireAuth)) {
         $xmlBuffer .= AJXP_XMLWriter::requireAuth(false);
     }
     if (isset($reload_current_node) && $reload_current_node == "true" || isset($reload_file_list)) {
         $xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", "", false);
     }
     return $xmlBuffer;
 }
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.mysqlAccessDriver.php

示例6: applyAction

 public function applyAction($actionName, $httpVars, $fileVars)
 {
     $messages = ConfService::getMessages();
     $repoId = $this->accessDriver->repository->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 null;
         }
         require_once "Zend/Search/Lucene.php";
         try {
             $index = $this->loadIndex($repoId, false);
         } catch (Exception $ex) {
             AJXP_XMLWriter::header();
             if ($this->seemsCurrentlyIndexing($repoId, 3)) {
                 AJXP_XMLWriter::sendMessage($messages["index.lucene.11"], null);
             } else {
                 if (ConfService::backgroundActionsSupported() && !ConfService::currentContextIsCommandLine()) {
                     AJXP_Controller::applyActionInBackground($repoId, "index", array());
                     sleep(2);
                     AJXP_XMLWriter::triggerBgAction("check_index_status", array("repository_id" => $repoId), sprintf($messages["index.lucene.8"], "/"), true, 5);
                     AJXP_XMLWriter::sendMessage($messages["index.lucene.7"], null);
                 } else {
                     AJXP_XMLWriter::sendMessage($messages["index.lucene.12"], null);
                 }
             }
             AJXP_XMLWriter::close();
             return null;
         }
         $textQuery = $httpVars["query"];
         if ($this->getFilteredOption("AUTO_WILDCARD") === true && strlen($textQuery) > 0 && ctype_alnum($textQuery)) {
             if ($textQuery[0] == '"' && $textQuery[strlen($textQuery) - 1] == '"') {
                 $textQuery = substr($textQuery, 1, -1);
             } else {
                 if ($textQuery[strlen($textQuery) - 1] != "*") {
                     $textQuery .= "*";
                 }
             }
         }
         if (strpos($textQuery, ":") !== false) {
             $textQuery = str_replace("ajxp_meta_ajxp_document_content:", "body:", $textQuery);
             $textQuery = $this->filterSearchRangesKeywords($textQuery);
             $query = "ajxp_scope:shared AND ({$textQuery})";
         } else {
             if ((isset($this->metaFields) || $this->indexContent) && isset($httpVars["fields"])) {
                 $sParts = array();
                 foreach (explode(",", $httpVars["fields"]) as $searchField) {
                     if ($searchField == "filename") {
                         $sParts[] = "basename:" . $textQuery;
                     } else {
                         if ($searchField == "ajxp_document_content") {
                             $sParts[] = $textQuery;
                         } else {
                             if (in_array($searchField, $this->metaFields)) {
                                 $sParts[] = "ajxp_meta_" . $searchField . ":" . $textQuery;
                             } else {
                                 if ($searchField == "ajxp_document_content") {
                                     $sParts[] = "title:" . $textQuery;
                                     $sParts[] = "body:" . $textQuery;
                                     $sParts[] = "keywords:" . $textQuery;
                                 }
                             }
                         }
                     }
                 }
                 $query = implode(" OR ", $sParts);
                 $query = "ajxp_scope:shared AND ({$query})";
                 $this->logDebug("Query : {$query}");
             } else {
                 $index->setDefaultSearchField("basename");
                 $query = $this->filterSearchRangesKeywords($textQuery);
             }
         }
         $this->setDefaultAnalyzer();
         if ($query == "*") {
             $index->setDefaultSearchField("ajxp_node");
             $query = "yes";
             $hits = $index->find($query, "node_url", SORT_STRING);
         } else {
             $hits = $index->find($query);
         }
         $commitIndex = false;
         if (isset($httpVars['return_selection'])) {
             $returnNodes = array();
         } else {
             AJXP_XMLWriter::header();
         }
         $cursor = 0;
         if (isset($httpVars['limit'])) {
             $limit = intval($httpVars['limit']);
         }
         if (!isset($returnNodes) && !empty($limit) && count($hits) > $limit) {
             AJXP_XMLWriter::renderPaginationData(count($hits), 1, 1);
         }
         foreach ($hits as $hit) {
             // Backward compatibility
             $hit->node_url = preg_replace("#ajxp\\.[a-z_]+://#", "pydio://", $hit->node_url);
             if ($hit->serialized_metadata != null) {
//.........这里部分代码省略.........
开发者ID:rbrdevs,项目名称:pydio-core,代码行数:101,代码来源:class.AjxpLuceneIndexer.php

示例7: listUsers

 public function listUsers($root, $child, $hashValue = null, $returnNodes = false, $findNodePosition = null)
 {
     $USER_PER_PAGE = 50;
     if ($root == "users") {
         $baseGroup = "/";
     } else {
         $baseGroup = substr($root, strlen("users"));
     }
     if ($findNodePosition != null && $hashValue == null) {
         // Loop on each page to find the correct page.
         $count = AuthService::authCountUsers($baseGroup);
         $pages = ceil($count / $USER_PER_PAGE);
         for ($i = 0; $i < $pages; $i++) {
             $tests = $this->listUsers($root, $child, $i + 1, true, $findNodePosition);
             if (is_array($tests) && isset($tests["/data/" . $root . "/" . $findNodePosition])) {
                 return array("/data/" . $root . "/" . $findNodePosition => str_replace("ajxp_mime", "page_position='" . ($i + 1) . "' ajxp_mime", $tests["/data/" . $root . "/" . $findNodePosition]));
             }
         }
         return array();
     }
     $allNodes = array();
     $columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users">
                 <column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
                 <column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="10%"/>
                 <column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
                 <column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
                 </columns>';
     if (AuthService::driverSupportsAuthSchemes()) {
         $columns = '<columns switchDisplayMode="list" switchGridMode="filelist" template_name="ajxp_conf.users_authscheme">
                     <column messageId="ajxp_conf.6" attributeName="ajxp_label" sortType="String" defaultWidth="40%"/>
                     <column messageId="ajxp_conf.115" attributeName="auth_scheme" sortType="String" defaultWidth="5%"/>
                     <column messageId="ajxp_conf.7" attributeName="isAdmin" sortType="String" defaultWidth="5%"/>
                     <column messageId="ajxp_conf.70" attributeName="ajxp_roles" sortType="String" defaultWidth="15%"/>
                     <column messageId="ajxp_conf.62" attributeName="rights_summary" sortType="String" defaultWidth="15%"/>
         </columns>';
     }
     if (!$returnNodes) {
         AJXP_XMLWriter::sendFilesListComponentConfig($columns);
     }
     if (!AuthService::usersEnabled()) {
         return;
     }
     if (empty($hashValue)) {
         $hashValue = 1;
     }
     $count = AuthService::authCountUsers($baseGroup);
     if (AuthService::authSupportsPagination() && $count >= $USER_PER_PAGE) {
         $offset = ($hashValue - 1) * $USER_PER_PAGE;
         if (!$returnNodes) {
             AJXP_XMLWriter::renderPaginationData($count, $hashValue, ceil($count / $USER_PER_PAGE));
         }
         $users = AuthService::listUsers($baseGroup, "", $offset, $USER_PER_PAGE);
         if ($hashValue == 1) {
             $groups = AuthService::listChildrenGroups($baseGroup);
         } else {
             $groups = array();
         }
     } else {
         $users = AuthService::listUsers($baseGroup);
         $groups = AuthService::listChildrenGroups($baseGroup);
     }
     foreach ($groups as $groupId => $groupLabel) {
         $nodeKey = "/data/" . $root . "/" . ltrim($groupId, "/");
         $meta = array("icon" => "users-folder.png", "ajxp_mime" => "group");
         if (in_array($nodeKey, $this->currentBookmarks)) {
             $meta = array_merge($meta, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
         }
         $xml = AJXP_XMLWriter::renderNode($nodeKey, $groupLabel, false, $meta, true, false);
         if (!$returnNodes) {
             print $xml;
         } else {
             $allNodes[$nodeKey] = $xml;
         }
     }
     $mess = ConfService::getMessages();
     $repos = ConfService::getRepositoriesList("all");
     $loggedUser = AuthService::getLoggedUser();
     $userArray = array();
     foreach ($users as $userIndex => $userObject) {
         $label = $userObject->getId();
         if ($userObject->hasParent()) {
             $label = $userObject->getParent() . "000" . $label;
         } else {
             $children = ConfService::getConfStorageImpl()->getUserChildren($label);
             foreach ($children as $addChild) {
                 $userArray[$label . "000" . $addChild->getId()] = $addChild;
             }
         }
         $userArray[$label] = $userObject;
     }
     ksort($userArray);
     foreach ($userArray as $userObject) {
         $isAdmin = $userObject->isAdmin();
         $userId = $userObject->getId();
         $icon = "user" . ($userId == "guest" ? "_guest" : ($isAdmin ? "_admin" : ""));
         if ($userObject->hasParent()) {
             $icon = "user_child";
         }
         $rightsString = "";
         if ($isAdmin) {
//.........这里部分代码省略.........
开发者ID:biggtfish,项目名称:cms,代码行数:101,代码来源:class.ajxp_confAccessDriver.php


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