[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/src/applications/dashboard/storage/ -> PhabricatorDashboardInstall.php (source)

   1  <?php
   2  
   3  /**
   4   * An install of a dashboard. Examples might be
   5   * - the home page for a user
   6   * - the profile page for a user
   7   * - the profile page for a project
   8   */
   9  final class PhabricatorDashboardInstall
  10    extends PhabricatorDashboardDAO {
  11  
  12    protected $installerPHID;
  13    protected $objectPHID;
  14    protected $applicationClass;
  15    protected $dashboardPHID;
  16  
  17    public function getConfiguration() {
  18      return array(
  19        self::CONFIG_COLUMN_SCHEMA => array(
  20          'applicationClass' => 'text64',
  21        ),
  22        self::CONFIG_KEY_SCHEMA => array(
  23          'objectPHID' => array(
  24            'columns' => array('objectPHID', 'applicationClass'),
  25            'unique' => true,
  26          ),
  27        ),
  28      ) + parent::getConfiguration();
  29    }
  30  
  31    public static function getDashboard(
  32      PhabricatorUser $viewer,
  33      $object_phid,
  34      $application_class) {
  35  
  36      $dashboard = null;
  37      $dashboard_install = id(new PhabricatorDashboardInstall())
  38        ->loadOneWhere(
  39          'objectPHID = %s AND applicationClass = %s',
  40          $object_phid,
  41          $application_class);
  42      if ($dashboard_install) {
  43        $dashboard = id(new PhabricatorDashboardQuery())
  44          ->setViewer($viewer)
  45          ->withPHIDs(array($dashboard_install->getDashboardPHID()))
  46          ->needPanels(true)
  47          ->executeOne();
  48      }
  49  
  50      return $dashboard;
  51    }
  52  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1