Skip to content
Snippets Groups Projects
Select Git revision
  • 233aa24522727473e364afbda0e20e09dc6b34d4
  • master default
  • devel
3 results

ReglerAddress.module.php

Blame
  • ReglerAddress.module.php 6.41 KiB
    <?php
    
    #-------------------------------------------------------------------------
    # Module: ReglerAddress - Module for manaiging the control.lth.se
    #                         address database
    #
    #-------------------------------------------------------------------------
    /**
     * Your initial Class declaration. This file's name must
     * be "[class's name].module.php", or, in this case,
     * ReglerAddress.module.php
     */ 
    
    
    /**
     * ReglerAddress class
     *
     * @author Leif Andersson
     * @since 1.0
     * @version 2015-09-02
     * @modifiedby $LastChangedBy: LA $
     * @lastmodified $Date:  2021-05-28$
     * @license GPL
     **/
    class ReglerAddress extends CMSModule
    {
      
      /**
       * GetName()
       * return get_class($this); 
       * @return string class name
       */
      function GetName()  { return get_class($this); }
      
      /**
       * GetFriendlyName()
       * @return string Friendly name for the module
       */
      function GetFriendlyName() { return 'ReglerAddress'; }
    
      
      /**
       * GetVersion()
       * @return string version number (can be something like 1.4rc1)
       */
      function GetVersion()  { return '2021-05-28'; }
      
      /**
       * GetHelp()
       * @return string Help for this module
       */
      function GetHelp()   { return 'help'; }
      
      /**
       * GetAuthor()
       * @return string Author name
       */
      function GetAuthor()  { return 'Leif Andersson'; }
    
      /**
       * GetAuthorEmail()
       * @return string Authors email
       */
      function GetAuthorEmail()  {return 'leif.andersson@control.lth.se';  }
      
      /**
       * GetChangeLog()
       * @return string ChangeLog for this module
       */
      function GetChangeLog() { return $this->Lang('changelog'); }
      
      /**
       * IsPluginModule()
       * @return bool True if this module can be included in page and or template
       */
      function IsPluginModule()  { return true; }
    
      /**
       * HasAdmin()
       * @return bool True if this module has admin area
       */
      function HasAdmin()
      {
        return True;   }
    
      /**
       * GetAdminSection()
       * If your module has an Admin Panel, you can specify
       * which Admin Section (or top-level Admin Menu) it shows
       * up in. This method returns a string to specify that
       * section. Valid return values are:
       * 
       * main        - the Main menu tab.
       * content     - the Content menu
       * layout      - the Layout menu
       * usersgroups - the Users and Groups menu
       * extensions  - the Extensions menu (this is the default)
       * siteadmin   - the Site Admin menu
       * viewsite    - the View Site menu tab
       * logout      - the Logout menu tab
       *
       * Note that if you place your module in the main,
       * viewsite, or logout sections, it will show up in the
       * menus, but will not be visible in any top-level
       * section pages.
       * @return string Which admin section this module belongs to
       */
      function GetAdminSection()   { return 'content';   }
    
      /**
       * GetAdminDescription()
       * @return string Module description
       */
      function GetAdminDescription()  { return 'ReglerAddress admin'; }
    
      /**
       * VisibleToAdminUser()
       * If your module does have an Admin Panel, you
       * can control whether or not it's displayed by the boolean
       * that is returned by this method. This is primarily used
       * to hide modules from admins who lack permission to use
       * them.
       * In this case, the module will only be visible to admins
       * who have "Use ReglerAddress" permissions.
       * @return bool True if this module is shown to current user
       */
      function VisibleToAdminUser()  {
        return $this->CheckPermission('Use ReglerAddress');
      }
        
      /**
       * GetDependencies()
       * @return hash Hash of other modules this module depends on
       */
      function GetDependencies()  { return array();  }
    
      /**
       * @return string Minimum cms version this module should work on
       */
      function MinimumCMSVersion()  { return "1.0";  }
      
      /**
       * MaximumCMSVersion()
       * It can also be a major pain if you don't have time to
       * update your modules every time a new release of CMSMS comes
       * out, hence this is commented out here.
       */
      
      /*
      function MaximumCMSVersion()
      {
        return "1.5";
      }
      */
    
      /**
       * SetParameters()
       * This function enables you to 
       * 1) create mappings for your module when using "Pretty Urls".
       * 2) impose security by controlling incoming parameters
       *
       * Pretty URLS:
       * Typically, modules create internal links that have
       * big ugly strings along the lines of:
       * index.php?mact=ModName,cntnt01,actionName,0&cntnt01param1=1&cntnt01param2=2&cntnt01returnid=3
       *
       * You might prefer these to look like:
       * /ModuleFunction/2/3
       *
       * To do this, you have to register routes and map
       * your parameters in a way that the API will be able
       * to understand.
       *
       * Also note that any calls to CreateLink will need to
       * be updated to pass the pretty url parameter.
       *
       * Security:
       * By using the RestrictUnknownParams function, your module will not
       * receive any parameters other than the ones you declare here.
       * Furthermore, the parameters your module does receive will be filtered
       * according to the rules you set here.
       */ 
    
      function SetParameters() {
        $this->RegisterModulePlugin();
        $this->RestrictUnknownParams();
    
        $this->CreateParameter('fornamn','','fornamn');
        $this->SetParameterType('fornamn',CLEAN_STRING);
    
        $this->CreateParameter('efternamn','','fornamn');
        $this->SetParameterType('efternamn',CLEAN_STRING);
     
        $this->CreateParameter('foretag','','foretag');
        $this->SetParameterType('fornamn',CLEAN_STRING);
    
        $this->CreateParameter('avdelning','','avdelning');
        $this->SetParameterType('avdelning',CLEAN_STRING);
     
        $this->CreateParameter('adress','','adress');
        $this->SetParameterType('adress',CLEAN_STRING);
      }
    
      /**
       * InstallPostMessage()
       * @return string Message to be shown after installation
       */
      function InstallPostMessage()  { 
        return 'Module ReglerAddress successfully installed.';
      }
      /**
       * UninstallPostMessage()
       * @return string Message to be shown after uninstallation
       */
      function UninstallPostMessage()  {
        return 'Module ReglerAddress sucessfully uninstalled.';
      }
    
      /**
       * UninstallPreMessage()
       * @return string Message to be shown before uninstallation
       */
      function UninstallPreMessage()  { 
        return 'Confirm uninstalling ReglerAddress.'; }
      
      /**
       * Your methods here
       * 
       * This would be a good place to define some general methods for your module
       * 
       * Its a good practice to have underscore in front of your own methods
       */
      function _SetStatus($oid, $status) {
        //...
      }
    
    
    
         
    
    } //end class
    ?>