getMessage(). "\n."; $options['print'] = TRUE; } // If print option supplied then print directly to the screen if (isset($options['print'])) { if (sizeof($variables) > 0) { $message = str_replace(array_keys($variables), $variables, $message); } print $severity_string . ' (' . strtoupper($type) . '): ' . $message . "\n"; } } /** * Display messages to tripal administrators. This can be used instead of * drupal_set_message when you want to target tripal administrators. * * @param $message * The message to be displayed to the tripal administrators * @param $importance * The level of importance for this message. In the future this will be used to allow * administrators to filter some of these messages. It can be one of the following: * - TRIPAL_CRITICAL: Critical conditions. * - TRIPAL_ERROR: Error conditions. * - TRIPAL_WARNING: Warning conditions. * - TRIPAL_NOTICE: Normal but significant conditions. * - TRIPAL_INFO: (default) Informational messages. * - TRIPAL_DEBUG: Debug-level messages. * @param $options * Any options to apply to the current message. Supported options include: * - return_html: return HTML instead of setting a drupal message. This can be * used to place a tripal message in a particular place in the page. * The default is FALSE. */ function tripal_set_message($message, $importance = TRIPAL_INFO, $options = array()) { global $user; // Only show the message to the administrator user (uid=1) // thus if the current user is not the administrator then return nothing if (!user_access('administer tripal')) { return ''; } // set defaults $options['return_html'] = (isset($options['return_html'])) ? $options['return_html'] : FALSE; // Get human-readable severity string $importance_string = ''; switch ($importance) { case TRIPAL_CRITICAL: $importance_string = 'CRITICAL'; break; case TRIPAL_ERROR: $importance_string = 'ERROR'; break; case TRIPAL_WARNING: $importance_string = 'WARNING'; break; case TRIPAL_NOTICE: $importance_string = 'NOTICE'; break; case TRIPAL_INFO: $importance_string = 'INFO'; break; case TRIPAL_DEBUG: $importance_string = 'DEBUG'; break; } // Mark-up the Message $full_message = '
'; // Handle whether to return the HTML & let the caller deal with it // or to use drupal_set_message to put it near the top of the page & let the theme deal with it if ($options['return_html']) { return ' '; } else { drupal_set_message($full_message, 'tripal-site-admin-only'); } }