panels_views.install File Reference

(1.1.2.9 2008/07/13 22:42:31 sdboyer)

Go to the source code of this file.

Functions

 panels_views_install ()
 panels_views_uninstall ()
 panels_views_update_5100 ()


Function Documentation

panels_views_install (  ) 

Implementation of hook_install().

Definition at line 8 of file panels_views.install.

References panels_views_pane_fields().

00008                                 {
00009   // This is a poor man's schema implementation ala Drupal 6.
00010 
00011   // The documentation says this shouldn't be necessary but sometimes the
00012   // .module file is not actually loaded at this time, so we have to load it.
00013   if (!function_exists('panels_views_pane_fields')) {
00014     require_once drupal_get_path('module', 'panels_views') . '/panels_views.module';
00015   }
00016 
00017   $fields = panels_views_pane_fields();
00018   $sql = "";
00019   foreach ($fields as $field => $data) {
00020     if ($sql) {
00021       $sql .= ', ';
00022     }
00023     // offset is a reserved word in postgres, needs to be quoted
00024     if ($field == "offset" && $GLOBALS['db_type'] == 'pgsql') {
00025       $field = '"offset"';
00026     }
00027     $sql .= $field . ' ' . $data['definition'];
00028   }
00029   db_query("CREATE TABLE {panels_views} ($sql) /*!40100 DEFAULT CHARACTER SET utf8 */");
00030 }

Here is the call graph for this function:

panels_views_uninstall (  ) 

Implementation of hook_uninstall().

Definition at line 54 of file panels_views.install.

00054                                   {
00055   db_query("DROP TABLE IF EXISTS {panels_views}");
00056 }

panels_views_update_5100 (  ) 

Add columns for custom "more" text.

Definition at line 35 of file panels_views.install.

00035                                     {
00036   $ret = array();
00037   switch ($GLOBALS['db_type']) {
00038     case 'mysql':
00039     case 'mysqli':
00040       $ret[] = update_sql("ALTER TABLE {panels_views} ADD more_text varchar(255) AFTER more_link");
00041       $ret[] = update_sql("ALTER TABLE {panels_views} ADD allow_more_text integer AFTER allow_more_link");
00042       break;
00043     case 'pgsql':
00044       db_add_column($ret, 'panels_views', 'more_text', 'varchar(255)', array());
00045       db_add_column($ret, 'panels_views', 'allow_more_text', 'integer', array());
00046       break;
00047   }
00048   return $ret;
00049 }


Generated on Sun Sep 5 05:00:20 2010 for Panels 2 by  doxygen 1.5.6