uid.inc

Go to the documentation of this file.
00001 <?php
00002 // $Id: uid.inc,v 1.1.2.2 2008/05/27 20:21:12 sdboyer Exp $
00003 
00004 
00005 /**
00006  * @file arguments/uid.inc
00007  *
00008  * Plugin to provide an argument handler for a user id
00009  */
00010 function panels_uid_panels_arguments() {
00011   $args['uid'] = array(
00012     'title' => t("User ID"),
00013     // keyword to use for %substitution
00014     'keyword' => 'user',
00015     'description' => t('Creates a user object from the argument.'),
00016     'context' => 'panels_uid_context',
00017     'settings form' => 'panels_uid_settings_form',
00018     'settings form submit' => 'panels_uid_settings_form_submit',
00019     'displays' => 'panels_uid_displays',
00020     'choose display' => 'panels_uid_choose_display',
00021   );
00022   return $args;
00023 }
00024 
00025 /**
00026  * Discover if this argument gives us the user we crave.
00027  */
00028 function panels_uid_context($arg = NULL, $conf = NULL, $empty = FALSE) {
00029   // If unset it wants a generic, unfilled context.
00030   if ($empty) {
00031     return panels_context_create_empty('user');
00032   }
00033 
00034   if (!is_numeric($arg)) {
00035     return FALSE;
00036   }
00037 
00038   $user = user_load(array('uid' => $arg));
00039   if (!$user) {
00040     return FALSE;
00041   }
00042 
00043   return panels_context_create('user', $user);
00044 }
00045 
00046 /**
00047  * Settings form for the argument
00048  */
00049 function panels_uid_settings_form($conf) {
00050   // Doing different displays based upon role is hard because roles are not
00051   // 1:1 like type/vocabulary are for node and term.
00052 }
00053 
00054 /**
00055  * There appears to be a bit of a bug with the way we're handling forms; it causes
00056  * 'checkboxes' to get invalid values added to them when empty. This takes care
00057  * of that.
00058  */
00059 function panels_uid_settings_form_submit(&$values) {
00060 }
00061 
00062 /**
00063  * What additional displays does this argument provide?
00064  */
00065 function panels_uid_displays($conf, $id) {
00066   return array();
00067 }
00068 
00069 /**
00070  * Based upon the settings and the context, choose which display to use.
00071  */
00072 function panels_uid_choose_display($conf, $context) {
00073 }

Generated on Thu Jul 29 05:00:14 2010 for Panels 2 by  doxygen 1.5.6