You are here

function hosting_get_profiles in Hostmaster (Aegir) 6

3 calls to hosting_get_profiles()
hosting_platform_load in modules/hosting/platform/hosting_platform.module
Implementation of hook_load().
hosting_site_available_options in modules/hosting/site/hosting_site.form.inc
Pass in a site node and return an array of valid options for it's fields.
hosting_site_form in modules/hosting/site/hosting_site.form.inc
Implements hook_form().

File

modules/hosting/package/hosting_package.module, line 120

Code

function hosting_get_profiles($platform = NULL, $field = 'title') {
  $profiles = array();
  if (!is_null($platform)) {
    $instances = hosting_package_instances_load(array(
      'i.rid' => $platform,
      'p.package_type' => 'profile',
      'n.status' => 1,
    ));
    foreach ($instances as $iid => $instance) {
      $profiles[$instance->package_id] = $instance->{$field};
    }
  }
  else {
    $instances = hosting_package_instances_load(array(
      'p.package_type' => 'profile',
      'n.status' => 1,
      'r.type' => 'platform',
    ));
    foreach ($instances as $iid => $instance) {
      $profiles[$instance->package_id] = $instance->{$field};
    }
  }
  return $profiles;
}