本文整理汇总了PHP中AJXP_XMLWriter::renderNode方法的典型用法代码示例。如果您正苦于以下问题:PHP AJXP_XMLWriter::renderNode方法的具体用法?PHP AJXP_XMLWriter::renderNode怎么用?PHP AJXP_XMLWriter::renderNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AJXP_XMLWriter
的用法示例。
在下文中一共展示了AJXP_XMLWriter::renderNode方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderHeaderNode
function renderHeaderNode($nodeName, $nodeLabel, $isLeaf, $metaData = array())
{
header('Content-Type: text/xml; charset=UTF-8');
header('Cache-Control: no-cache');
print '<?xml version="1.0" encoding="UTF-8"?>';
AJXP_XMLWriter::renderNode($nodeName, $nodeLabel, $isLeaf, $metaData, false);
}
示例2: 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;
}
}
示例3: applyActions
public function applyActions($actionName, $httpVars, $fileVars)
{
$git = new VersionControl_Git($this->repoBase);
switch ($actionName) {
case "git_history":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$file = ltrim($file, "/");
$res = $this->gitHistory($git, $file);
AJXP_XMLWriter::header();
$ic = AJXP_Utils::mimetype($file, "image", false);
$index = count($res);
$mess = ConfService::getMessages();
foreach ($res as &$commit) {
unset($commit["DETAILS"]);
$commit["icon"] = $ic;
$commit["index"] = $index;
$commit["EVENT"] = $mess["meta.git." . $commit["EVENT"]];
$index--;
AJXP_XMLWriter::renderNode("/" . $commit["ID"], basename($commit["FILE"]), true, $commit);
}
AJXP_XMLWriter::close();
break;
break;
case "git_revertfile":
$originalFile = AJXP_Utils::decodeSecureMagic($httpVars["original_file"]);
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
$outputStream = fopen($this->repoBase . $originalFile, "w");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
$this->commitChanges();
AJXP_XMLWriter::header();
AJXP_XMLWriter::reloadDataNode();
AJXP_XMLWriter::close();
break;
case "git_getfile":
$file = AJXP_Utils::decodeSecureMagic($httpVars["file"]);
$commitId = $httpVars["commit_id"];
$attach = $httpVars["attach"];
$command = $git->getCommand("cat-file");
$command->setOption("s", true);
$command->addArgument($commitId . ":" . $file);
$size = $command->execute();
$command = $git->getCommand("show");
$command->addArgument($commitId . ":" . $file);
$commandLine = $command->createCommandString();
if ($attach == "inline") {
$fileExt = substr(strrchr(basename($file), '.'), 1);
if (empty($fileExt)) {
$fileMime = "application/octet-stream";
} else {
$regex = "/^([\\w\\+\\-\\.\\/]+)\\s+(\\w+\\s)*({$fileExt}\\s)/i";
$lines = file(AJXP_INSTALL_PATH . "/" . AJXP_PLUGINS_FOLDER . "/editor.browser/resources/other/mime.types");
foreach ($lines as $line) {
if (substr($line, 0, 1) == '#') {
continue;
}
// skip comments
$line = rtrim($line) . " ";
if (!preg_match($regex, $line, $matches)) {
continue;
}
// no match to the extension
$fileMime = $matches[1];
}
}
if (empty($fileMime)) {
$fileMime = "application/octet-stream";
}
HTMLWriter::generateInlineHeaders(basename($file), $size, $fileMime);
} else {
HTMLWriter::generateAttachmentsHeader(basename($file), $size, false, false);
}
$outputStream = fopen("php://output", "a");
$this->executeCommandInStreams($git, $commandLine, $outputStream);
fclose($outputStream);
break;
break;
default:
break;
}
}
示例4: listRepositories
function listRepositories()
{
$repos = ConfService::getRepositoriesList();
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/><column messageId="ajxp_shared.9" attributeName="repo_accesses" sortType="String"/></columns>');
$repoArray = array();
$childRepos = array();
$loggedUser = AuthService::getLoggedUser();
$users = AuthService::listUsers();
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
continue;
}
if (is_numeric($repoIndex)) {
$repoIndex = "" . $repoIndex;
}
$name = AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
$repoArray[$name] = $repoIndex;
}
// Sort the list now by name
ksort($repoArray);
// Append child repositories
$sortedArray = array();
foreach ($repoArray as $name => $repoIndex) {
$sortedArray[$name] = $repoIndex;
if (isset($childRepos[$repoIndex]) && is_array($childRepos[$repoIndex])) {
foreach ($childRepos[$repoIndex] as $childData) {
$sortedArray[$childData["name"]] = $childData["index"];
}
}
}
foreach ($sortedArray as $name => $repoIndex) {
$repoObject =& $repos[$repoIndex];
$repoAccesses = array();
foreach ($users as $userId => $userObject) {
if (!$userObject->hasParent()) {
continue;
}
if ($userObject->canWrite($repoIndex)) {
$repoAccesses[] = $userId . " (rw)";
} else {
if ($userObject->canRead($repoIndex)) {
$repoAccesses[] = $userId . " (r)";
}
}
}
$metaData = array("repository_id" => $repoIndex, "accessType" => $repoObject->getAccessType(), "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "repo_accesses" => implode(", ", $repoAccesses), "ajxp_mime" => "shared_repository");
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例5: listTasks
public function listTasks($nodeName, $baseDir)
{
$mess = ConfService::getMessages();
AJXP_XMLWriter::renderHeaderNode("/{$baseDir}/{$nodeName}", "Scheduler", false, array("icon" => "scheduler/ICON_SIZE/player_time.png"));
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist" switchDisplayMode="list" template_name="action.scheduler_list">
<column messageId="action.scheduler.12" attributeName="ajxp_label" sortType="String"/>
<column messageId="action.scheduler.2" attributeName="schedule" sortType="String"/>
<column messageId="action.scheduler.1" attributeName="action_name" sortType="String"/>
<column messageId="action.scheduler.4s" attributeName="repository_id" sortType="String"/>
<column messageId="action.scheduler.17" attributeName="user_id" sortType="String"/>
<column messageId="action.scheduler.3" attributeName="NEXT_EXECUTION" sortType="String"/>
<column messageId="action.scheduler.14" attributeName="LAST_EXECUTION" sortType="String"/>
<column messageId="action.scheduler.13" attributeName="STATUS" sortType="String"/>
</columns>');
$tasks = AJXP_Utils::loadSerialFile($this->getDbFile(), false, "json");
foreach ($tasks as $task) {
$timeArray = $this->getTimeArray($task["schedule"]);
$res = $this->getNextExecutionTimeForScript(time(), $timeArray);
$task["NEXT_EXECUTION"] = date($mess["date_format"], $res);
$task["PARAMS"] = implode(", ", $task["PARAMS"]);
$task["icon"] = "scheduler/ICON_SIZE/task.png";
$task["ajxp_mime"] = "scheduler_task";
$sFile = AJXP_CACHE_DIR . "/cmd_outputs/task_" . $task["task_id"] . ".status";
if (is_file($sFile)) {
$s = $this->getTaskStatus($task["task_id"]);
$task["STATUS"] = implode(":", $s);
$task["LAST_EXECUTION"] = date($mess["date_format"], filemtime($sFile));
} else {
$task["STATUS"] = "n/a";
$task["LAST_EXECUTION"] = "n/a";
}
AJXP_XMLWriter::renderNode("/admin/scheduler/" . $task["task_id"], isset($task["label"]) ? $task["label"] : "Action " . $task["action_name"], true, $task);
}
AJXP_XMLWriter::close();
}
示例6: listLayers
function listLayers($nodeList, $xPath, $replaceCallback = null)
{
foreach ($nodeList as $key => $node) {
$name = $xPath->evaluate("Name", $node)->item(0)->nodeValue;
$title = $xPath->evaluate("Title", $node)->item(0)->nodeValue;
$srs = $xPath->evaluate("SRS", $node)->item(0)->nodeValue;
$metaData = array("icon" => "wms_images/mimes/ICON_SIZE/domtreeviewer.png", "parentname" => "/", "name" => $name, "title" => $title, "ajxp_mime" => "wms_layer", "srs" => $srs, "wms_url" => $this->repository->getOption("HOST"));
$style = $xPath->query("Style/Name", $node)->item(0)->nodeValue;
$metaData["style"] = $style;
$keys = array();
$keywordList = $xPath->query("KeywordList/Keyword", $node);
if ($keywordList->length) {
foreach ($keywordList as $keyword) {
$keys[] = $keyword->nodeValue;
}
}
$metaData["keywords"] = implode(",", $keys);
$metaData["queryable"] = $node->attributes->item(0)->value == "1" ? "True" : "False";
$bBoxAttributes = array();
try {
$bBoxAttributes = $xPath->query("LatLonBoundingBox", $node)->item(0)->attributes;
$attributes = $xPath->query("BoundingBox", $node)->item(0)->attributes;
if (isset($attributes)) {
$bBoxAttributes = $attributes;
}
} catch (Exception $e) {
}
foreach ($bBoxAttributes as $domAttr) {
$metaData["bbox_" . $domAttr->name] = $domAttr->value;
}
if ($replaceCallback != null) {
$metaData = call_user_func($replaceCallback, $key, $metaData);
}
AJXP_XMLWriter::renderNode("/" . $metaData["name"], $title, true, $metaData);
}
}
示例7: listHooks
public function listHooks($dir, $root = NULL, $hash = null, $returnNodes = false)
{
$jsonContent = json_decode(file_get_contents(AJXP_Utils::getHooksFile()), true);
$config = '<columns switchDisplayMode="full" template_name="hooks.list">
<column messageId="ajxp_conf.17" attributeName="ajxp_label" sortType="String" defaultWidth="20%"/>
<column messageId="ajxp_conf.18" attributeName="description" sortType="String" defaultWidth="20%"/>
<column messageId="ajxp_conf.19" attributeName="triggers" sortType="String" defaultWidth="25%"/>
<column messageId="ajxp_conf.20" attributeName="listeners" sortType="String" defaultWidth="25%"/>
<column messageId="ajxp_conf.21" attributeName="sample" sortType="String" defaultWidth="10%"/>
</columns>';
if (!$returnNodes) {
AJXP_XMLWriter::sendFilesListComponentConfig($config);
}
$allNodes = array();
foreach ($jsonContent as $hookName => $hookData) {
$metadata = array("icon" => "preferences_plugin.png", "description" => $hookData["DESCRIPTION"], "sample" => $hookData["PARAMETER_SAMPLE"]);
$trigs = array();
foreach ($hookData["TRIGGERS"] as $trigger) {
$trigs[] = "<span>" . $trigger["FILE"] . " (" . $trigger["LINE"] . ")</span>";
}
$metadata["triggers"] = implode("<br/>", $trigs);
$listeners = array();
foreach ($hookData["LISTENERS"] as $listener) {
$listeners[] = "<span>Plugin " . $listener["PLUGIN_ID"] . ", in method " . $listener["METHOD"] . "</span>";
}
$metadata["listeners"] = implode("<br/>", $listeners);
$nodeKey = "/{$root}/hooks/{$hookName}/{$hookName}";
if (in_array($nodeKey, $this->currentBookmarks)) {
$metadata = array_merge($metadata, array("ajxp_bookmarked" => "true", "overlay_icon" => "bookmark.png"));
}
$xml = AJXP_XMLWriter::renderNode($nodeKey, $hookName, true, $metadata, true, false);
if ($returnNodes) {
$allNodes[$nodeKey] = $xml;
} else {
print $xml;
}
}
return $allNodes;
}
示例8: switchAction
//.........这里部分代码省略.........
if (AJXP_Utils::isBrowsableArchive($nodeName)) {
if ($lsOptions["f"] && $lsOptions["z"]) {
// See archives as files
$nodeType = "f";
} else {
$nodeType = "z";
}
} else {
$nodeType = "f";
}
}
if ($offset > 0 && $cursor < $offset) {
$cursor++;
continue;
}
if ($limitPerPage > 0 && $cursor - $offset >= $limitPerPage) {
break;
}
$metaData = array();
$currentFile = $path . "/" . $nodeName;
$metaData["is_file"] = $isLeaf ? "1" : "0";
$metaData["filename"] = AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($dir . "/" . $nodeName));
$metaData["icon"] = AJXP_Utils::mimetype($nodeName, "image", !$isLeaf);
if ($metaData["icon"] == "folder.png") {
$metaData["openicon"] = "folder_open.png";
}
if (!is_file($currentFile) || AJXP_Utils::isBrowsableArchive($nodeName)) {
$link = SystemTextEncoding::toUTF8(SERVER_ACCESS . "?get_action=ls&options=dz&dir=" . $dir . "/" . $nodeName);
$link = urlencode($link);
$metaData["src"] = $link;
}
if ($lsOptions["l"]) {
$metaData["file_group"] = @filegroup($currentFile) || "unknown";
$metaData["file_owner"] = @fileowner($currentFile) || "unknown";
$fPerms = @fileperms($currentFile);
if ($fPerms !== false) {
$fPerms = substr(decoct($fPerms), $isLeaf ? 2 : 1);
} else {
$fPerms = '0000';
}
$metaData["file_perms"] = $fPerms;
$metaData["mimestring"] = AJXP_Utils::mimetype($currentFile, "type", !$isLeaf);
$datemodif = $this->date_modif($currentFile);
$metaData["ajxp_modiftime"] = $datemodif ? $datemodif : "0";
$metaData["bytesize"] = 0;
if ($isLeaf) {
$metaData["bytesize"] = filesize($currentFile);
}
$metaData["filesize"] = AJXP_Utils::roundSize($metaData["bytesize"]);
if (AJXP_Utils::isBrowsableArchive($nodeName)) {
$metaData["ajxp_mime"] = "ajxp_browsable_archive";
}
$realFile = null;
// A reference to the real file.
AJXP_Controller::applyHook("ls.metadata", array($currentFile, &$metaData, $this->wrapperClassName, &$realFile));
}
$attributes = "";
foreach ($metaData as $key => $value) {
$attributes .= "{$key}=\"{$value}\" ";
}
$renderNodeData = array(AJXP_Utils::xmlEntities($dir . "/" . $nodeName, true), AJXP_Utils::xmlEntities($nodeName, true), $isLeaf, $metaData);
$fullList[$nodeType][$nodeName] = $renderNodeData;
$cursor++;
}
foreach ($fullList as $key => $list) {
uksort($list, 'strnatcasecmp');
$fullList[$key] = $list;
}
$allNodes = array_merge($fullList["d"], $fullList["z"], $fullList["f"]);
array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["d"]);
array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["z"]);
array_map(array("AJXP_XMLWriter", "renderNodeArray"), $fullList["f"]);
// ADD RECYCLE BIN TO THE LIST
if ($dir == "" && RecycleBinManager::recycleEnabled()) {
$recycleBinOption = RecycleBinManager::getRelativeRecycle();
if (file_exists($this->urlBase . $recycleBinOption)) {
$recycleIcon = $this->countFiles($this->urlBase . $recycleBinOption, false, true) > 0 ? "trashcan_full.png" : "trashcan.png";
AJXP_XMLWriter::renderNode($recycleBinOption, AJXP_Utils::xmlEntities($mess[122]), false, array("ajxp_modiftime" => $this->date_modif($this->urlBase . $recycleBinOption), "mimestring" => AJXP_Utils::xmlEntities($mess[122]), "icon" => "{$recycleIcon}", "filesize" => "-", "ajxp_mime" => "ajxp_recycle"));
}
}
AJXP_Logger::debug("LS Time : " . intval((microtime() - $startTime) * 1000) . "ms");
AJXP_XMLWriter::close();
return;
break;
}
$xmlBuffer = "";
if (isset($logMessage) || isset($errorMessage)) {
$xmlBuffer .= AJXP_XMLWriter::sendMessage(isset($logMessage) ? $logMessage : null, isset($errorMessage) ? $errorMessage : null, false);
}
if ($reloadContextNode) {
if (!isset($pendingSelection)) {
$pendingSelection = "";
}
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode("", $pendingSelection, false);
}
if (isset($reloadDataNode)) {
$xmlBuffer .= AJXP_XMLWriter::reloadDataNode($reloadDataNode, "", false);
}
return $xmlBuffer;
}
示例9: listSharedFiles
function listSharedFiles()
{
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist" template_name="ajxp_conf.shared">
<column messageId="ajxp_shared.4" attributeName="ajxp_label" sortType="String" defaultWidth="30%"/>
<column messageId="ajxp_shared.27" attributeName="owner" sortType="String" defaultWidth="10%"/>
<column messageId="ajxp_shared.17" attributeName="download_url" sortType="String" defaultWidth="40%"/>
<column messageId="ajxp_shared.6" attributeName="password" sortType="String" defaultWidth="4%"/>
<column messageId="ajxp_shared.7" attributeName="expiration" sortType="String" defaultWidth="4%"/>
<column messageId="ajxp_shared.20" attributeName="expired" sortType="String" defaultWidth="4%"/>
<column messageId="ajxp_shared.14" attributeName="integrity" sortType="String" defaultWidth="4%" hidden="true"/>
</columns>');
$dlFolder = ConfService::getCoreConf("PUBLIC_DOWNLOAD_FOLDER");
if (!is_dir($dlFolder)) {
return;
}
$files = glob($dlFolder . "/*.php");
if ($files === false) {
return;
}
$mess = ConfService::getMessages();
$loggedUser = AuthService::getLoggedUser();
$userId = $loggedUser->getId();
$dlURL = ConfService::getCoreConf("PUBLIC_DOWNLOAD_URL");
if ($dlURL != "") {
$downloadBase = rtrim($dlURL, "/");
} else {
$fullUrl = AJXP_Utils::detectServerURL() . dirname($_SERVER['REQUEST_URI']);
$downloadBase = str_replace("\\", "/", $fullUrl . rtrim(str_replace(AJXP_INSTALL_PATH, "", $dlFolder), "/"));
}
foreach ($files as $file) {
$publicletData = $this->loadPublicletData($file);
AJXP_XMLWriter::renderNode(str_replace(".php", "", basename($file)), "" . SystemTextEncoding::toUTF8($publicletData["REPOSITORY"]->getDisplay()) . ":/" . SystemTextEncoding::toUTF8($publicletData["FILE_PATH"]), true, array("icon" => "html.png", "password" => $publicletData["PASSWORD"] != "" ? $publicletData["PASSWORD"] : "-", "expiration" => $publicletData["EXPIRE_TIME"] != 0 ? date($mess["date_format"], $publicletData["EXPIRE_TIME"]) : "-", "expired" => $publicletData["EXPIRE_TIME"] != 0 ? $publicletData["EXPIRE_TIME"] < time() ? $mess["ajxp_shared.21"] : $mess["ajxp_shared.22"] : "-", "integrity" => !$publicletData["SECURITY_MODIFIED"] ? $mess["ajxp_shared.15"] : $mess["ajxp_shared.16"], "download_url" => $downloadBase . "/" . basename($file), "owner" => isset($publicletData["OWNER_ID"]) ? $publicletData["OWNER_ID"] : "-", "ajxp_mime" => "shared_file"));
}
}
示例10: listRepositories
public function listRepositories()
{
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="user_dash.9" attributeName="parent_label" sortType="String"/><column messageId="user_dash.9" attributeName="repo_accesses" sortType="String"/></columns>');
$repoArray = array();
$loggedUser = AuthService::getLoggedUser();
$count = 0;
$repos = ConfService::listRepositoriesWithCriteria(array("owner_user_id" => $loggedUser->getId()), $count);
$searchAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS", "conf");
$displayAll = ConfService::getCoreConf("CROSSUSERS_ALLGROUPS_DISPLAY", "conf");
if ($searchAll || $displayAll) {
$baseGroup = "/";
} else {
$baseGroup = AuthService::filterBaseGroup("/");
}
AuthService::setGroupFiltering(false);
$users = AuthService::listUsers($baseGroup);
$minisites = $this->listSharedFiles("minisites");
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
if (!$repoObject->hasOwner() || $repoObject->getOwner() != $loggedUser->getId()) {
continue;
}
if (is_numeric($repoIndex)) {
$repoIndex = "" . $repoIndex;
}
$name = (isset($minisites[$repoIndex]) ? "[Minisite] " : "") . AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
$repoArray[$name] = $repoIndex;
}
// Sort the list now by name
ksort($repoArray);
foreach ($repoArray as $name => $repoIndex) {
$repoObject =& $repos[$repoIndex];
$repoAccesses = array();
foreach ($users as $userId => $userObject) {
if ($userObject->getId() == $loggedUser->getId()) {
continue;
}
$label = $userObject->personalRole->filterParameterValue("core.conf", "USER_DISPLAY_NAME", AJXP_REPO_SCOPE_ALL, $userId);
if (empty($label)) {
$label = $userId;
}
$acl = $userObject->mergedRole->getAcl($repoObject->getId());
if (!empty($acl)) {
$repoAccesses[] = $label . " (" . $acl . ")";
}
}
$parent = $repoObject->getParentId();
$parentRepo =& $repos[$parent];
$parentLabel = $this->metaIcon("folder-open") . $parentRepo->getDisplay();
$repoPath = $repoObject->getOption("PATH");
$parentPath = $parentRepo->getOption("PATH");
$parentLabel .= " (" . str_replace($parentPath, "", $repoPath) . ")";
$metaData = array("repository_id" => $repoIndex, "icon" => "document_open_remote.png", "openicon" => "document_open_remote.png", "parentname" => "/repositories", "parent_label" => $parentLabel, "repo_accesses" => count($repoAccesses) ? $this->metaIcon("share-sign") . implode(", ", $repoAccesses) : "", "ajxp_mime" => "shared_repository");
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例11: xmlListLogFiles
/**
* List available log files in XML
*
* @param String [optional] $nodeName
* @param String [optional] $year
* @param String [optional] $month
*/
public function xmlListLogFiles($nodeName = "file", $year = null, $month = null, $rootPath = "/logs", $print = true)
{
$xml_strings = array();
switch ($this->sqlDriver["driver"]) {
case "sqlite":
case "sqlite3":
$yFunc = "strftime('%Y', [logdate])";
$mFunc = "strftime('%m', [logdate])";
$dFunc = "date([logdate])";
break;
case "mysql":
$yFunc = "YEAR([logdate])";
$mFunc = "MONTH([logdate])";
$dFunc = "DATE([logdate])";
break;
case "postgre":
$yFunc = "EXTRACT(YEAR FROM [logdate])";
$mFunc = "EXTRACT(MONTH FROM [logdate])";
$dFunc = "DATE([logdate])";
break;
default:
echo "ERROR!, DB driver " + $this->sqlDriver["driver"] + " not supported yet in __FUNCTION__";
exit(1);
}
try {
if ($month != null) {
// Get days
//cal_days_in_month(CAL_GREGORIAN, $month, $year)
$start_time = mktime(0, 0, 0, $month, 1, $year);
$end_time = mktime(0, 0, 0, $month + 1, 1, $year);
$q = 'SELECT
DISTINCT ' . $dFunc . ' AS logdate
FROM [ajxp_log]
WHERE [logdate] >= %t AND [logdate] < %t';
$result = dibi::query($q, $start_time, $end_time);
foreach ($result as $r) {
$log_time = strtotime($r['logdate']);
$fullYear = date('Y', $log_time);
$fullMonth = date('F', $log_time);
$logM = date('m', $log_time);
$date = $r['logdate'];
if (is_a($date, "DibiDateTime")) {
$date = $date->format("Y-m-d");
}
$path = "{$rootPath}/{$fullYear}/{$logM}/{$date}";
$metadata = array("icon" => "toggle_log.png", "date" => $date, "ajxp_mime" => "datagrid", "grid_datasource" => "get_action=ls&dir=" . urlencode($path), "grid_header_title" => "Application Logs for {$date}", "grid_actions" => "refresh,copy_as_text");
$xml_strings[$date] = AJXP_XMLWriter::renderNode($path, $date, true, $metadata, true, false);
}
} else {
if ($year != null) {
// Get months
$year_start_time = mktime(0, 0, 0, 1, 1, $year);
$year_end_time = mktime(0, 0, 0, 1, 1, $year + 1);
$q = 'SELECT
DISTINCT ' . $yFunc . ' AS year,
' . $mFunc . ' AS month
FROM [ajxp_log]
WHERE [logdate] >= %t AND [logdate] < %t';
$result = dibi::query($q, $year_start_time, $year_end_time);
foreach ($result as $r) {
/* We always recreate a unix timestamp while looping because it provides us with a uniform way to format the date.
* The month returned by the database will not be zero-padded and causes problems down the track when DateTime zero pads things */
$month_time = mktime(0, 0, 0, $r['month'], 1, $r['year']);
$fullYear = date('Y', $month_time);
$fullMonth = date('F', $month_time);
$logMDisplay = date('F', $month_time);
$logM = date('m', $month_time);
$xml_strings[$r['month']] = $this->formatXmlLogList($nodeName, 'x-office-calendar.png', $logM, $logMDisplay, $logMDisplay, "{$rootPath}/{$fullYear}/{$logM}");
//"<$nodeName icon=\"x-office-calendar.png\" date=\"$fullMonth\" display=\"$logM\" text=\"$fullMonth\" is_file=\"0\" filename=\"/logs/$fullYear/$fullMonth\"/>";
}
} else {
// Append Analytics Node
$xml_strings['0000'] = AJXP_XMLWriter::renderNode($rootPath . "/all_analytics", "Analytics Dashboard", true, array("icon" => "graphs_viewer/ICON_SIZE/analytics.png", "ajxp_mime" => "ajxp_graphs"), true, false);
// Get years
$q = 'SELECT
DISTINCT ' . $yFunc . ' AS year
FROM [ajxp_log]';
$result = dibi::query($q);
foreach ($result as $r) {
$year_time = mktime(0, 0, 0, 1, 1, $r['year']);
$fullYear = $r['year'];
$xml_strings[$r['year']] = $this->formatXmlLogList($nodeName, 'x-office-calendar.png', $fullYear, $fullYear, $fullYear, "{$rootPath}/{$fullYear}");
//"<$nodeName icon=\"x-office-calendar.png\" date=\"$fullYear\" display=\"$fullYear\" text=\"$fullYear\" is_file=\"0\" filename=\"/logs/$fullYear\"/>";
}
}
}
} catch (DibiException $e) {
echo get_class($e), ': ', $e->getMessage(), "\n";
exit(1);
}
if ($print) {
foreach ($xml_strings as $s) {
print $s;
//.........这里部分代码省略.........
示例12: listRepositories
function listRepositories()
{
$repos = ConfService::getRepositoriesList();
AJXP_XMLWriter::sendFilesListComponentConfig('<columns switchGridMode="filelist"><column messageId="ajxp_conf.8" attributeName="ajxp_label" sortType="String"/><column messageId="ajxp_conf.9" attributeName="accessType" sortType="String"/></columns>');
$repoArray = array();
foreach ($repos as $repoIndex => $repoObject) {
if ($repoObject->getAccessType() == "ajxp_conf") {
continue;
}
$name = AJXP_Utils::xmlEntities(SystemTextEncoding::toUTF8($repoObject->getDisplay()));
$repoArray[$name] = $repoIndex;
}
// Sort the list now by name
ksort($repoArray);
foreach ($repoArray as $name => $repoIndex) {
$repoObject =& $repos[$repoIndex];
$metaData = array("repository_id" => $repoIndex, "accessType" => $repoObject->getAccessType(), "icon" => "folder_red.png", "openicon" => "folder_red.png", "parentname" => "/repositories", "ajxp_mime" => "repository" . ($repoObject->isWriteable() ? "_editable" : ""));
AJXP_XMLWriter::renderNode("/repositories/{$repoIndex}", $name, true, $metaData);
}
}
示例13: renderAjxpNode
/**
* @static
* @param AJXP_Node $ajxpNode
* @param bool $close
* @return void
*/
static function renderAjxpNode($ajxpNode, $close = true)
{
AJXP_XMLWriter::renderNode($ajxpNode->getPath(), $ajxpNode->getLabel(), $ajxpNode->isLeaf(), $ajxpNode->metadata, $close);
}