Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F96289147
ReleephProjectSearchEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, Dec 24, 15:11
Size
1 KB
Mime Type
text/x-php
Expires
Thu, Dec 26, 15:11 (2 d)
Engine
blob
Format
Raw Data
Handle
23144088
Attached To
rPH Phabricator
ReleephProjectSearchEngine.php
View Options
<?php
final
class
ReleephProjectSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
buildSavedQueryFromRequest
(
AphrontRequest
$request
)
{
$saved
=
new
PhabricatorSavedQuery
();
$saved
->
setParameter
(
'active'
,
$request
->
getStr
(
'active'
));
return
$saved
;
}
public
function
buildQueryFromSavedQuery
(
PhabricatorSavedQuery
$saved
)
{
$query
=
id
(
new
ReleephProjectQuery
())
->
setOrder
(
ReleephProjectQuery
::
ORDER_NAME
);
$active
=
$saved
->
getParameter
(
'active'
);
$value
=
idx
(
$this
->
getActiveValues
(),
$active
);
if
(
$value
!==
null
)
{
$query
->
withActive
(
$value
);
}
return
$query
;
}
public
function
buildSearchForm
(
AphrontFormView
$form
,
PhabricatorSavedQuery
$saved_query
)
{
$form
->
appendChild
(
id
(
new
AphrontFormSelectControl
())
->
setName
(
'active'
)
->
setLabel
(
pht
(
'Show Projects'
))
->
setValue
(
$saved_query
->
getParameter
(
'active'
))
->
setOptions
(
$this
->
getActiveOptions
()));
}
protected
function
getURI
(
$path
)
{
return
'/releeph/project/'
.
$path
;
}
public
function
getBuiltinQueryNames
()
{
$names
=
array
(
'active'
=>
pht
(
'Active'
),
'all'
=>
pht
(
'All'
),
);
return
$names
;
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'active'
:
return
$query
->
setParameter
(
'active'
,
'active'
);
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
private
function
getActiveOptions
()
{
return
array
(
'all'
=>
pht
(
'Active and Inactive Projects'
),
'active'
=>
pht
(
'Active Projects'
),
'inactive'
=>
pht
(
'Inactive Projects'
),
);
}
private
function
getActiveValues
()
{
return
array
(
'all'
=>
null
,
'active'
=>
1
,
'inactive'
=>
0
,
);
}
}
Event Timeline
Log In to Comment