Summary: I updated the wiki too - https://secure.phabricator.com/w/projects/pebkac/ - with what I am thinking right now. Rough plan here is - next diff: - implement editors and transactions - implement "web type" for contact source - /pebkac/item/new/ will be the entry point for this - implement "actions" on a contact - probably some "polish" on the scaffolding laid out here; like "create" permissions maybs - diffs after that: - implement "twitter" type for source - implement email reply handler stuff for item and source Probs a great time to blast huge holes in all this stuff. :D Test Plan: these pages load and arc lint doesn't complain Reviewers: epriestley Reviewed By: epriestley CC: Korvin, epriestley, aran, chad Differential Revision: https://secure.phabricator.com/D7465
84 lines
1.5 KiB
PHP
84 lines
1.5 KiB
PHP
<?php
|
|
|
|
final class NuanceSourceQuery
|
|
extends NuanceQuery {
|
|
|
|
private $ids;
|
|
private $phids;
|
|
private $creatorPHIDs;
|
|
private $types;
|
|
|
|
public function withIDs(array $ids) {
|
|
$this->ids = $ids;
|
|
return $this;
|
|
}
|
|
|
|
public function withPHIDs(array $phids) {
|
|
$this->phids = $phids;
|
|
return $this;
|
|
}
|
|
|
|
public function withCreatorPHIDs(array $phids) {
|
|
$this->CreatorPHIDs = $phids;
|
|
return $this;
|
|
}
|
|
|
|
public function withTypes($types) {
|
|
$this->types = $types;
|
|
return $this;
|
|
}
|
|
|
|
|
|
public function loadPage() {
|
|
$table = new NuanceSource();
|
|
$conn_r = $table->establishConnection('r');
|
|
|
|
$data = queryfx_all(
|
|
$conn_r,
|
|
'SELECT FROM %T %Q %Q %Q',
|
|
$table->getTableName(),
|
|
$this->buildWhereClause($conn_r),
|
|
$this->buildOrderClause($conn_r),
|
|
$this->buildLimitClause($conn_r));
|
|
|
|
return $table->loadAllFromArray($data);
|
|
}
|
|
|
|
protected function buildWhereClause($conn_r) {
|
|
$where = array();
|
|
|
|
$where[] = $this->buildPagingClause($conn_r);
|
|
|
|
if ($this->creatorPHIDs) {
|
|
$where[] = qsprintf(
|
|
$conn_r,
|
|
'creatorPHID IN (%Ls)',
|
|
$this->creatorPHIDs);
|
|
}
|
|
|
|
if ($this->types) {
|
|
$where[] = qsprintf(
|
|
$conn_r,
|
|
'type IN (%Ld)',
|
|
$this->types);
|
|
}
|
|
|
|
if ($this->ids) {
|
|
$where[] = qsprintf(
|
|
$conn_r,
|
|
'id IN (%Ld)',
|
|
$this->ids);
|
|
}
|
|
|
|
if ($this->phids) {
|
|
$where[] = qsprintf(
|
|
$conn_r,
|
|
'phid IN (%Ls)',
|
|
$this->phids);
|
|
}
|
|
|
|
return $this->formatWhereClause($where);
|
|
}
|
|
|
|
}
|