You are here

function hostmaster_place_blocks in Hostmaster (Aegir) 7.3

Same name and namespace in other branches
  1. 7.4 hostmaster.install \hostmaster_place_blocks()

Helper function to place block.

1 call to hostmaster_place_blocks()
hostmaster_task_finalize in ./hostmaster.install

File

./hostmaster.install, line 233

Code

function hostmaster_place_blocks($theme) {
  $blocks = array(
    array(
      'module' => 'hosting',
      'delta' => 'hosting_queues',
      'theme' => $theme,
      'status' => 1,
      'weight' => -2,
      'region' => 'sidebar_first',
      'visibility' => 0,
      'pages' => '',
      'cache' => -1,
    ),
    array(
      'module' => 'system',
      'delta' => 'navigation',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'sidebar_first',
      'visibility' => 0,
      'pages' => '',
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_task_list-block',
      'theme' => $theme,
      'status' => 1,
      'weight' => -2,
      'region' => 'sidebar_first',
      'visibility' => 0,
      'pages' => '',
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_site_list-block_sites',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 1,
      'pages' => 'hosting/c/platform_*',
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_platform_list-block_1',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 1,
      'pages' => 'hosting/c/server_*',
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_site_list-block_profile',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 0,
      'pages' => '',
      //"<?php\n\$node = menu_get_object();\nif (!empty(\$node)) {\n  return \$node->package_type == 'profile';\n}\n
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_site_list-block_client',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 0,
      'pages' => '',
      //"<?php\n\$node = menu_get_object();\n\$menu_item = menu_get_item();\nif (!empty(\$node) && \$menu_item['number_parts'] == 2) {\n  return \$node->type == 'client';\n}\n
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_site_list-block_client2',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 0,
      'pages' => '',
      //"<?php\nglobal \$user;\$node = menu_get_object();\n\$menu_item = menu_get_item();\nif (!empty(\$node)) && \$menu_item['number_parts'] == 2) {\n  return \$node->type == 'client' && $user->uid != 1;\n}\n
      'cache' => -1,
    ),
    array(
      'module' => 'views',
      'delta' => 'hosting_package_list-block_1',
      'theme' => $theme,
      'status' => 1,
      'weight' => 0,
      'region' => 'content_bottom',
      'visibility' => 0,
      'pages' => '',
      //"<?php\n\$node = menu_get_object();\nif (!empty(\$node)) {\n  return \$node->type == 'package' && \$node->package_type != 'profile';\n}\n
      'cache' => -1,
    ),
  );
  $query = db_insert('block')
    ->fields(array(
    'module',
    'delta',
    'theme',
    'status',
    'weight',
    'region',
    'visibility',
    'pages',
    'cache',
  ));
  foreach ($blocks as $block) {
    $query
      ->values($block);
  }
  $query
    ->execute();
}