1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-12-01 19:22:42 +01:00
phorge-phorge/src/applications/dashboard/storage/PhabricatorDashboardInstall.php
Bob Trahan 5f33aa5b4f Dashboards - add ability to install dashboard as home
Summary:
See title. Adds PhabricatorDashboardInstall data object which scopes installs to objectPHID + applicationClass. This is because we already have a collision for user home pages and user profiles. Assume only one dashboard per objectPHID + applicationClass though at the database level.

Fixes T5076.

Test Plan: From dashboard view, installed a dashboard - success! Went back to dashboard view and uninstalled it!

Reviewers: chad, epriestley

Reviewed By: epriestley

Subscribers: epriestley, Korvin

Maniphest Tasks: T5076

Differential Revision: https://secure.phabricator.com/D9206
2014-05-19 16:09:31 -07:00

38 lines
945 B
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;
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;
}
}