Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F99653022
AlmanacDeviceSearchEngine.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
Sun, Jan 26, 00:13
Size
1 KB
Mime Type
text/x-php
Expires
Tue, Jan 28, 00:13 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23839155
Attached To
rPH Phabricator
AlmanacDeviceSearchEngine.php
View Options
<?php
final
class
AlmanacDeviceSearchEngine
extends
PhabricatorApplicationSearchEngine
{
public
function
getResultTypeDescription
()
{
return
pht
(
'Almanac Devices'
);
}
protected
function
getApplicationClassName
()
{
return
'PhabricatorAlmanacApplication'
;
}
public
function
buildSavedQueryFromRequest
(
AphrontRequest
$request
)
{
$saved
=
new
PhabricatorSavedQuery
();
return
$saved
;
}
public
function
buildQueryFromSavedQuery
(
PhabricatorSavedQuery
$saved
)
{
$query
=
id
(
new
AlmanacDeviceQuery
());
return
$query
;
}
public
function
buildSearchForm
(
AphrontFormView
$form
,
PhabricatorSavedQuery
$saved_query
)
{}
protected
function
getURI
(
$path
)
{
return
'/almanac/device/'
.
$path
;
}
public
function
getBuiltinQueryNames
()
{
$names
=
array
(
'all'
=>
pht
(
'All Devices'
),
);
return
$names
;
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
protected
function
getRequiredHandlePHIDsForResultList
(
array
$devices
,
PhabricatorSavedQuery
$query
)
{
return
array
();
}
protected
function
renderResultList
(
array
$devices
,
PhabricatorSavedQuery
$query
,
array
$handles
)
{
assert_instances_of
(
$devices
,
'AlmanacDevice'
);
$viewer
=
$this
->
requireViewer
();
$list
=
new
PHUIObjectItemListView
();
$list
->
setUser
(
$viewer
);
foreach
(
$devices
as
$device
)
{
$item
=
id
(
new
PHUIObjectItemView
())
->
setObjectName
(
pht
(
'Device %d'
,
$device
->
getID
()))
->
setHeader
(
$device
->
getName
())
->
setHref
(
$device
->
getURI
())
->
setObject
(
$device
);
$list
->
addItem
(
$item
);
}
return
$list
;
}
}
Event Timeline
Log In to Comment