You are here

function hosting_get_profiles in Hosting 5

Same name and namespace in other branches
  1. 6.2 package/hosting_package.module \hosting_get_profiles()
  2. 7.4 package/hosting_package.module \hosting_get_profiles()
  3. 7.3 package/hosting_package.module \hosting_get_profiles()
2 calls to hosting_get_profiles()
hosting_site_validate in site/hosting_site.module
_hosting_site_form_profile in site/hosting_site.module
generate hosting site node form element 'profile'

File

package/hosting_package.module, line 92

Code

function hosting_get_profiles($platform = NULL) {
  $profiles = array();
  if (!is_null($platform)) {
    $instances = hosting_package_instances_load(array(
      'rid' => $platform,
      'package_type' => 'profile',
      'n.status' => 1,
    ));
    foreach ($instances as $iid => $instance) {
      $profiles[$instance->package_id] = $instance->title;
    }
  }
  else {
    $result = db_query("SELECT n.nid, n.title FROM {node} n LEFT JOIN {hosting_package} p ON n.vid = p.vid WHERE p.package_type = 'profile'");
    while ($profile = db_fetch_object($result)) {
      $profiles[$profile->nid] = $profile->title;
    }
  }
  return $profiles;
}