Zikula_Value_Addons
[ class tree: Zikula_Value_Addons ] [ index: Zikula_Value_Addons ] [ all elements ]

Source for file pninit.php

Documentation is available at pninit.php

  1. <?php
  2. /**
  3.  * Zikula Application Framework
  4.  *
  5.  * @copyright (c) 2002, Zikula Development Team
  6.  * @link http://www.zikula.org
  7.  * @version $Id: pninit.php 24342 2008-06-06 12:03:14Z markwest $
  8.  * @license GNU/GPL - http://www.gnu.org/copyleft/gpl.html
  9.  * @package Zikula_Value_Addons
  10.  * @subpackage HitCount
  11.  */
  12.  
  13. /**
  14.  * initialise the hitcount module
  15.  */
  16. function hitcount_init()
  17. {
  18.     // create table
  19.     if (!DBUtil::createTable('hitcount')) {
  20.         return false;
  21.     }
  22.  
  23.     // Set up module hooks
  24.  
  25.     // when a module item is displayed
  26.     if (!pnModRegisterHook('item''display''GUI''hitcount''user''display')) {
  27.         return LogUtil::registerError (_REGISTERFAILED);
  28.     }
  29.     // when a module item is created (set extrainfo to the module name ?)
  30.     if (!pnModRegisterHook('item''create''API''hitcount''admin''create')) {
  31.         return LogUtil::registerError (_REGISTERFAILED);
  32.     }
  33.     // when a module item is deleted (set extrainfo to the module name ?)
  34.     if (!pnModRegisterHook('item''delete''API''hitcount''admin''delete')) {
  35.         return LogUtil::registerError (_REGISTERFAILED);
  36.     }
  37.  
  38.     // when a whole module is removed, e.g. via the modules admin screen
  39.     // (set object ID to the module name !)
  40.     if (!pnModRegisterHook('module''remove''API''hitcount''admin''remove')) {
  41.         return LogUtil::registerError (_REGISTERFAILED);
  42.     }
  43.  
  44.     // Initialisation successful
  45.     return true;
  46. }
  47.  
  48. /**
  49.  * upgrade the hitcount module from an old version
  50.  */
  51. function hitcount_upgrade($oldversion)
  52. {
  53.     if (!DBUtil::changeTable($table)) {
  54.         return false;
  55.     }
  56.  
  57.     return true;
  58. }
  59.  
  60. /**
  61.  * delete the hitcount module
  62.  */
  63. function hitcount_delete()
  64. {
  65.     // Remove module hooks
  66.     if (!pnModUnregisterHook('item''display''GUI''hitcount''user''display')) {
  67.     }
  68.     if (!pnModUnregisterHook('item''create''API''hitcount''admin''create')) {
  69.     }
  70.     if (!pnModUnregisterHook('item''delete''API''hitcount''admin''delete')) {
  71.     }
  72.     if (!pnModUnregisterHook('module''remove''API''hitcount''admin''remove')) {
  73.     }
  74.  
  75.     if (!DBUtil::dropTable('hitcount')) {
  76.         return false;
  77.     }
  78.  
  79.     // Remove module variables
  80.     pnModDelVar('HitCount');
  81.  
  82.     // Deletion successful
  83.     return true;
  84. }

Documentation generated on Fri, 18 Jul 2008 21:53:11 +0200 by phpDocumentor 1.4.1