project management, project management software, collaboration software - Copper Project  
 
FORUMS
"People actually use it, that makes my life easier!" Multimediums
 
   
Register  ::  Log in  ::  Search 

Post new topic | Reply to topic
 
 how do i begin a custom module?, in Customization
 
scollins
 
PostPosted: Wed Aug 08, 2007 9:31 pm    Post subject: how do i begin a custom module? Reply with quote
Joined: 21 Feb 2007
Posts: 43
Location: Nashville, TN
Where to start? What are the non-negotiables of creating a custom module?

i'm interested in making a stripped-down version of the springboard, and i anticipate no database changes at all. i'd like to make a copy of the springboard, and start deleting lines of code. But how do i give this new module a new name, assign it an icon, and integrate it into Copper? Any bits of information are appreciated- thanks!
 
Ben
 
PostPosted: Thu Aug 09, 2007 5:38 am    Post subject: Reply with quote
Joined: 13 Mar 2003
Posts: 645

Hi Shannon,

Realistically you'd want intermediate PHP skills to implement a new module, but someone might like to chime in here with modules they've created?
 
scollins
 
PostPosted: Thu Aug 09, 2007 6:33 pm    Post subject: Reply with quote
Joined: 21 Feb 2007
Posts: 43
Location: Nashville, TN
Thanks Ben. i'm ready to go with nearly intermediate PHP skills. i guess i'm trying to avoid exploring the code to figure a couple things out- most importantly how a module is defined within Copper, so that i might define a new one that it would recognize.
 
Apophenian
 
PostPosted: Mon Nov 10, 2008 7:29 am    Post subject: Reply with quote
Joined: 10 Nov 2008
Posts: 4

I have started work on a module, and found it not too bad - mainly due to a nice clean architecture (thanks guys!).

I don't have time to go too in depth, but here is how I got started.

1. Under system/modules, create a directory that will contain your module code
2. Create a file in here called index.php
3. in this file create a class that extends the Module class eg:

Code:

<?php
class mod_mymodule extends Module
{
    ...
}
?>


4. Create your constructor method and populate it with some defaults

Code:

<?php
function mod_mymodule()
    {
        $this->ModuleName   = 'Module name';
        $this->ModuleID     = 'A nice ID';
        $this->RequireLogin = 1;
        $this->Public       = 1;
        parent::Module();
    }
?>


5. Put in a main method - this is where your module determines what method to call based on the 'action' request parameter

Code:

function main()
{
    switch (RequestAll('action'))
    {
        case 'view' : $this->ViewSomething(); break;
        default     : $this->ViewSomething();
    }
}


6. From here is where you can start reading data from the database and putting it into your templates, but I haven't got time right now, so will have to post some more later...
 
  Page 1 of 1





Tour | Sign-up | Demo & Free Trial | Buzz | FAQs | Forums | Blog | Contact
© Copyright Element Software 2001-2008 
Element Software - Creators of Copper Project Management Software