mirror of
https://we.phorge.it/source/phorge.git
synced 2024-11-16 11:52:40 +01:00
c3efa261f9
Summary: Ref T7950, Refactor Calendar Search, and implement Projects on events Test Plan: Verify that all queries in Calendar search still work, and that events can now have associated Projects that you can search by in Calendar Search. Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: epriestley, Korvin Maniphest Tasks: T7950 Differential Revision: https://secure.phabricator.com/D13393
39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
PHP
<?php
|
|
|
|
final class PhabricatorSearchDateControlField
|
|
extends PhabricatorSearchField {
|
|
|
|
protected function getValueExistsInRequest(AphrontRequest $request, $key) {
|
|
// The control doesn't actually submit a value with the same name as the
|
|
// key, so look for the "_d" value instead, which has the date part of the
|
|
// control value.
|
|
return $request->getExists($key.'_d');
|
|
}
|
|
|
|
protected function getValueFromRequest(AphrontRequest $request, $key) {
|
|
$value = AphrontFormDateControlValue::newFromRequest($request, $key);
|
|
$value->setOptional(true);
|
|
return $value->getDictionary();
|
|
}
|
|
|
|
protected function newControl() {
|
|
return id(new AphrontFormDateControl())
|
|
->setAllowNull(true);
|
|
}
|
|
|
|
protected function didReadValueFromSavedQuery($value) {
|
|
if (!$value) {
|
|
return null;
|
|
}
|
|
|
|
if ($value instanceof AphrontFormDateControlValue && $value->getEpoch()) {
|
|
return $value->setOptional(true);
|
|
}
|
|
|
|
$value = AphrontFormDateControlValue::newFromWild(
|
|
$this->getViewer(),
|
|
$value);
|
|
return $value->setOptional(true);
|
|
}
|
|
|
|
}
|