| [ Index ] |
PHP Cross Reference of Drupal 6 (yi-drupal) |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * @file callbacks.inc 4 * Minor menu callbacks for Panels helpers. 5 */ 6 7 /** 8 * A central administrative page for Panels. 9 */ 10 function panels_admin_page() { 11 return theme('panels_dashboard'); 12 } 13 14 function panels_dashboard_final_blocks(&$vars) { 15 // Add in links for missing modules that we still want to mention: 16 if (empty($vars['links']['page_manager'])) { 17 $vars['links']['page_manager'] = array( 18 'weight' => -100, 19 'title' => t('Panel page'), 20 'description' => '<em>' . t('You must activate the page manager module for this functionality.') . '</em>', 21 ); 22 } 23 if (empty($vars['links']['panels_mini'])) { 24 $vars['links']['panels_mini'] = array( 25 'title' => t('Mini panel'), 26 'description' => '<em>' . t('You must activate the Mini panels module for this functionality.') . '</em>', 27 ); 28 } 29 if (empty($vars['links']['panels_node'])) { 30 $vars['links']['panels_mini'] = array( 31 'title' => t('Panel node'), 32 'description' => '<em>' . t('You must activate the panel node module for this functionality.') . '</em>', 33 ); 34 } 35 } 36 37 /** 38 * Implementation of hook_panels_dashboard_blocks(). 39 * 40 * Adds page information to the Panels dashboard. 41 */ 42 function panels_panels_dashboard_blocks(&$vars) { 43 $vars['links']['panels_layout'] = array( 44 'title' => l(t('Custom layout'), 'admin/build/panels/layouts/add'), 45 'description' => t('Custom layouts can add more, site-specific layouts that you can use in your panels.'), 46 ); 47 48 // Load all mini panels and their displays. 49 ctools_include('export'); 50 $items = ctools_export_crud_load_all('panels_layout'); 51 $count = 0; 52 $rows = array(); 53 54 foreach ($items as $item) { 55 $rows[] = array( 56 check_plain($item->admin_title), 57 array( 58 'data' => l(t('Edit'), "admin/build/panels/layouts/list/$item->name/edit"), 59 'class' => 'links', 60 ), 61 ); 62 63 // Only show 10. 64 if (++$count >= 10) { 65 break; 66 } 67 } 68 69 if ($rows) { 70 $content = theme('table', array(), $rows, array('class' => 'panels-manage')); 71 } 72 else { 73 $content = '<p>' . t('There are no custom layouts.') . '</p>'; 74 } 75 76 $vars['blocks']['panels_layout'] = array( 77 'title' => t('Manage custom layouts'), 78 'link' => l(t('Go to list'), 'admin/build/panels/layouts'), 79 'content' => $content, 80 'class' => 'dashboard-layouts', 81 'section' => 'right', 82 ); 83 } 84 85 function template_preprocess_panels_dashboard(&$vars) { 86 ctools_add_css('panels-dashboard', 'panels'); 87 ctools_include('plugins'); 88 89 $vars['image_path'] = ctools_image_path('', 'panels'); 90 91 $vars['links'] = array(); 92 $vars['blocks'] = array(); 93 94 foreach (module_implements('panels_dashboard_blocks') as $module) { 95 $function = $module . '_panels_dashboard_blocks'; 96 $function($vars); 97 } 98 99 // Add in any default links for modules that are not active 100 panels_dashboard_final_blocks($vars); 101 102 // If page manager module is enabled, add a very low eight block to 103 // list the page wizards. 104 if (module_exists('page_manager')) { 105 $vars['blocks']['wizards'] = array( 106 'weight' => -101, 107 'section' => 'right', 108 'title' => t('Page wizards'), 109 'content' => '', 110 'class' => 'dashboard-wizards', 111 ); 112 113 ctools_include('page-wizard'); 114 $plugins = page_manager_get_page_wizards(); 115 uasort($plugins, 'ctools_plugin_sort'); 116 117 foreach ($plugins as $id => $plugin) { 118 if (isset($plugin['type']) && $plugin['type'] == 'panels') { 119 $link = array( 120 'title' => l($plugin['title'], 'admin/build/pages/wizard/' . $id), 121 'description' => $plugin['description'], 122 ); 123 124 $vars['blocks']['wizards']['content'] .= theme('panels_dashboard_link', $link); 125 } 126 } 127 128 } 129 130 uasort($vars['links'], 'ctools_plugin_sort'); 131 132 $vars['blocks']['links'] = array( 133 'weight' => -100, 134 'section' => 'left', 135 'title' => t('Create new') . '...', 136 'content' => '', 137 'class' => 'dashboard-create', 138 ); 139 140 // Turn the links into a block 141 foreach ($vars['links'] as $link) { 142 $vars['blocks']['links']['content'] .= theme('panels_dashboard_link', $link); 143 } 144 145 uasort($vars['blocks'], 'ctools_plugin_sort'); 146 147 $vars['left'] = ''; 148 $vars['right'] = ''; 149 150 // Render all the blocks 151 foreach ($vars['blocks'] as $block) { 152 $section = !empty($block['section']) ? $block['section'] : 'left'; 153 $vars[$section] .= theme('panels_dashboard_block', $block); 154 } 155 } 156 157 function panels_admin_settings_page() { 158 $form = array(); 159 if (module_exists('page_manager')) { 160 foreach (page_manager_get_tasks() as $task) { 161 if ($function = ctools_plugin_get_function($task, 'admin settings')) { 162 $function($form); 163 } 164 } 165 } 166 167 ctools_include('content'); 168 foreach (ctools_get_content_types() as $content) { 169 if ($function = ctools_plugin_get_function($content, 'admin settings')) { 170 $function($form); 171 } 172 } 173 174 if (empty($form)) { 175 return array('#value' => t('There are currently no settings to change, but additional plugins or modules may provide them in the future.')); 176 } 177 178 return system_settings_form($form); 179 } 180 181 /** 182 * Settings for panel contexts created by the page manager. 183 */ 184 function panels_admin_panel_context_page() { 185 ctools_include('common', 'panels'); 186 return drupal_get_form('panels_common_settings', 'panels_page'); 187 } 188
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Jul 9 18:01:44 2012 | Cross-referenced by PHPXref 0.7 |