Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2359006
ReleephBranchSearchEngine.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ReleephBranchSearchEngine.php
View Options
<?php
final
class
ReleephBranchSearchEngine
extends
PhabricatorApplicationSearchEngine
{
private
$product
;
public
function
getResultTypeDescription
()
{
return
pht
(
'Releeph Branches'
);
}
public
function
setProduct
(
ReleephProject
$product
)
{
$this
->
product
=
$product
;
return
$this
;
}
public
function
getProduct
()
{
return
$this
->
product
;
}
public
function
buildSavedQueryFromRequest
(
AphrontRequest
$request
)
{
$saved
=
new
PhabricatorSavedQuery
();
$saved
->
setParameter
(
'active'
,
$request
->
getStr
(
'active'
));
return
$saved
;
}
public
function
buildQueryFromSavedQuery
(
PhabricatorSavedQuery
$saved
)
{
$query
=
id
(
new
ReleephBranchQuery
())
->
needCutPointCommits
(
true
)
->
withProductPHIDs
(
array
(
$this
->
getProduct
()->
getPHID
()));
$active
=
$saved
->
getParameter
(
'active'
);
$value
=
idx
(
$this
->
getActiveValues
(),
$active
);
if
(
$value
!==
null
)
{
$query
->
withStatus
(
$value
);
}
return
$query
;
}
public
function
buildSearchForm
(
AphrontFormView
$form
,
PhabricatorSavedQuery
$saved_query
)
{
$form
->
appendChild
(
id
(
new
AphrontFormSelectControl
())
->
setName
(
'active'
)
->
setLabel
(
pht
(
'Show Branches'
))
->
setValue
(
$saved_query
->
getParameter
(
'active'
))
->
setOptions
(
$this
->
getActiveOptions
()));
}
protected
function
getURI
(
$path
)
{
return
'/releeph/product/'
.
$this
->
getProduct
()->
getID
().
'/'
.
$path
;
}
public
function
getBuiltinQueryNames
()
{
$names
=
array
(
'open'
=>
pht
(
'Open'
),
'all'
=>
pht
(
'All'
),
);
return
$names
;
}
public
function
buildSavedQueryFromBuiltin
(
$query_key
)
{
$query
=
$this
->
newSavedQuery
();
$query
->
setQueryKey
(
$query_key
);
switch
(
$query_key
)
{
case
'open'
:
return
$query
->
setParameter
(
'active'
,
'open'
);
case
'all'
:
return
$query
;
}
return
parent
::
buildSavedQueryFromBuiltin
(
$query_key
);
}
private
function
getActiveOptions
()
{
return
array
(
'open'
=>
pht
(
'Open Branches'
),
'all'
=>
pht
(
'Open and Closed Branches'
),
);
}
private
function
getActiveValues
()
{
return
array
(
'open'
=>
ReleephBranchQuery
::
STATUS_OPEN
,
'all'
=>
ReleephBranchQuery
::
STATUS_ALL
,
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Sep 16, 3:08 PM (2 d)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
378767
Default Alt Text
ReleephBranchSearchEngine.php (2 KB)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment