Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
osticket
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
docker
osticket
Commits
ec12159e
Commit
ec12159e
authored
11 years ago
by
Jared Hancock
Browse files
Options
Downloads
Patches
Plain Diff
Show disabled help topic names in the main listing
parent
ef2b91a9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
include/class.topic.php
+39
-31
39 additions, 31 deletions
include/class.topic.php
with
39 additions
and
31 deletions
include/class.topic.php
+
39
−
31
View file @
ec12159e
...
...
@@ -83,7 +83,7 @@ class Topic {
}
static
function
getTopicName
(
$id
)
{
$names
=
static
::
getHelpTopics
();
$names
=
static
::
getHelpTopics
(
false
,
true
);
return
$names
[
$id
];
}
...
...
@@ -188,43 +188,51 @@ class Topic {
return
self
::
save
(
0
,
$vars
,
$errors
);
}
static
function
getHelpTopics
(
$publicOnly
=
false
)
{
static
function
getHelpTopics
(
$publicOnly
=
false
,
$disabled
=
false
)
{
global
$cfg
;
static
$names
;
if
(
$names
)
return
$names
;
$sql
=
'SELECT topic_id, topic_pid, ispublic, topic FROM '
.
TOPIC_TABLE
.
' WHERE isactive=1'
;
$sql
.
=
' ORDER BY '
.
(
$cfg
->
getTopicSortMode
()
==
'm'
?
'`sort`'
:
'`topic_id`'
);
$res
=
db_query
(
$sql
);
static
$topics
,
$names
;
if
(
!
$names
)
{
$sql
=
'SELECT topic_id, topic_pid, ispublic, isactive, topic FROM '
.
TOPIC_TABLE
.
' ORDER BY '
.
(
$cfg
->
getTopicSortMode
()
==
'm'
?
'`sort`'
:
'`topic_id`'
);
$res
=
db_query
(
$sql
);
// Fetch information for all topics, in declared sort order
$topics
=
array
();
while
(
list
(
$id
,
$pid
,
$pub
,
$act
,
$topic
)
=
db_fetch_row
(
$res
))
$topics
[
$id
]
=
array
(
'pid'
=>
$pid
,
'public'
=>
$pub
,
'disabled'
=>!
$act
,
'topic'
=>
$topic
);
// Resolve parent names
foreach
(
$topics
as
$id
=>
$info
)
{
$name
=
$info
[
'topic'
];
$loop
=
array
(
$id
=>
true
);
while
(
$info
[
'pid'
]
&&
(
$info
=
$topics
[
$info
[
'pid'
]]))
{
$name
=
sprintf
(
'%s / %s'
,
$info
[
'topic'
],
$name
);
if
(
isset
(
$loop
[
$info
[
'pid'
]]))
break
;
$loop
[
$info
[
'pid'
]]
=
true
;
}
$names
[
$id
]
=
$name
;
}
// Fetch information for all topics, in declared sort order
$topics
=
array
();
while
(
list
(
$id
,
$pid
,
$pub
,
$topic
)
=
db_fetch_row
(
$res
))
$topics
[
$id
]
=
array
(
'pid'
=>
$pid
,
'public'
=>
$pub
,
'topic'
=>
$topic
);
if
(
$cfg
->
getTopicSortMode
()
==
'a'
)
uasort
(
$names
,
function
(
$a
,
$b
)
{
return
strcmp
(
$a
,
$b
);
});
}
// Resolve parent names
foreach
(
$topics
as
$id
=>
$info
)
{
// Apply requested filters
$requested_names
=
array
();
foreach
(
$names
as
$id
=>
$n
)
{
$info
=
$topics
[
$id
];
if
(
$publicOnly
&&
!
$info
[
'public'
])
continue
;
$name
=
$info
[
'topic'
];
$loop
=
array
(
$id
=>
true
);
while
(
$info
[
'pid'
]
&&
(
$info
=
$topics
[
$info
[
'pid'
]]))
{
$name
=
sprintf
(
'%s / %s'
,
$info
[
'topic'
],
$name
);
if
(
isset
(
$loop
[
$info
[
'pid'
]]))
break
;
$loop
[
$info
[
'pid'
]]
=
true
;
}
$names
[
$id
]
=
$name
;
if
(
!
$disabled
&&
$info
[
'disabled'
])
continue
;
$requested_names
[
$id
]
=
$n
;
}
if
(
$cfg
->
getTopicSortMode
()
==
'a'
)
uasort
(
$names
,
function
(
$a
,
$b
)
{
return
strcmp
(
$a
,
$b
);
});
return
$names
;
return
$requested_names
;
}
function
getPublicHelpTopics
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment