user_profile.inc

Go to the documentation of this file.
00001 <?php
00002 // $Id: user_profile.inc,v 1.1.2.3 2008/05/27 20:21:11 sdboyer Exp $
00003 
00004 
00005 /**
00006  * Callback function to supply a list of content types.
00007  */
00008 function panels_user_profile_panels_content_types() {
00009   $items['user_profile'] = array(
00010     'title' => t('User profile'),
00011     'content_types' => 'panels_admin_content_types_user_profile',
00012     'single' => TRUE,
00013     'render callback' => 'panels_content_user_profile',
00014     'title callback' => 'panels_admin_title_user_profile',
00015   );
00016   return $items;
00017 }
00018 
00019 /**
00020  * Output function for the 'node' content type. Outputs a node
00021  * based on the module and delta supplied in the configuration.
00022  */
00023 function panels_content_user_profile($conf, $panel_args, $context) {
00024   $account = isset($context->data) ? drupal_clone($context->data) : NULL;
00025   $block = new stdClass();
00026   $block->module = 'term-list';
00027 
00028   if ($account === FALSE || ($account->access == 0 && !user_access('administer users'))) {
00029     return drupal_not_found();
00030   }
00031   // Retrieve and merge all profile fields:
00032   $fields = array();
00033   foreach (module_list() as $module) {
00034     if ($data = module_invoke($module, 'user', 'view', '', $account)) {
00035       foreach ($data as $category => $items) {
00036         foreach ($items as $key => $item) {
00037           $item['class'] = "$module-". $item['class'];
00038           $fields[$category][$key] = $item;
00039         }
00040       }
00041     }
00042   }
00043 
00044   // Let modules change the returned fields - useful for personal privacy
00045   // controls. Since modules communicate changes by reference, we cannot use
00046   // module_invoke_all().
00047   foreach (module_implements('profile_alter') as $module) {
00048     $function = $module .'_profile_alter';
00049     $function($account, $fields);
00050   }
00051 
00052   $block->title = check_plain($account->name);
00053   $block->content = theme('user_profile', $account, $fields);
00054 
00055   return $block;
00056 }
00057 
00058 /**
00059  * Return all content types available.
00060  */
00061 function panels_admin_content_types_user_profile() {
00062   return array(
00063     'description' => array(
00064       'title' => t('User profile'),
00065       'icon' => 'icon_user.png',
00066       'path' => panels_get_path('content_types/user'),
00067       'description' => t('The profile of a user.'),
00068       'required context' => new panels_required_context(t('User'), 'user'),
00069       'category' => array(t('User context'), -9),
00070     ),
00071   );
00072 }
00073 
00074 /**
00075  * Display the administrative title for a panel pane in the drag & drop UI
00076  */
00077 function panels_admin_title_user_profile($conf, $context) {
00078   return t('"@s" user profile', array('@s' => $context->identifier));
00079 }
00080 

Generated on Sun Feb 5 05:00:12 2012 for Panels 2 by  doxygen 1.5.6