mirror of
https://we.phorge.it/source/phorge.git
synced 2024-12-02 19:52:44 +01:00
d6b882a804
Summary: Ref T6822. Test Plan: `grep` Reviewers: epriestley, #blessed_reviewers Reviewed By: epriestley, #blessed_reviewers Subscribers: hach-que, Korvin, epriestley Maniphest Tasks: T6822 Differential Revision: https://secure.phabricator.com/D11370
52 lines
1.3 KiB
PHP
52 lines
1.3 KiB
PHP
<?php
|
|
|
|
/**
|
|
* An install of a dashboard. Examples might be
|
|
* - the home page for a user
|
|
* - the profile page for a user
|
|
* - the profile page for a project
|
|
*/
|
|
final class PhabricatorDashboardInstall
|
|
extends PhabricatorDashboardDAO {
|
|
|
|
protected $installerPHID;
|
|
protected $objectPHID;
|
|
protected $applicationClass;
|
|
protected $dashboardPHID;
|
|
|
|
protected function getConfiguration() {
|
|
return array(
|
|
self::CONFIG_COLUMN_SCHEMA => array(
|
|
'applicationClass' => 'text64',
|
|
),
|
|
self::CONFIG_KEY_SCHEMA => array(
|
|
'objectPHID' => array(
|
|
'columns' => array('objectPHID', 'applicationClass'),
|
|
'unique' => true,
|
|
),
|
|
),
|
|
) + parent::getConfiguration();
|
|
}
|
|
|
|
public static function getDashboard(
|
|
PhabricatorUser $viewer,
|
|
$object_phid,
|
|
$application_class) {
|
|
|
|
$dashboard = null;
|
|
$dashboard_install = id(new PhabricatorDashboardInstall())
|
|
->loadOneWhere(
|
|
'objectPHID = %s AND applicationClass = %s',
|
|
$object_phid,
|
|
$application_class);
|
|
if ($dashboard_install) {
|
|
$dashboard = id(new PhabricatorDashboardQuery())
|
|
->setViewer($viewer)
|
|
->withPHIDs(array($dashboard_install->getDashboardPHID()))
|
|
->needPanels(true)
|
|
->executeOne();
|
|
}
|
|
|
|
return $dashboard;
|
|
}
|
|
}
|