Page 1 of 1

Including other modules functionality into mine

Posted: Thu Nov 09, 2006 3:43 pm
by ortegaj
There is no need to reinvent the wheel so how can I include some functionality of other modules into mine?

My module needs to browse the server for images (sometimes to upload them) and I first try the fckeditor and try to remove all toolbar buttons except for IMG.  Then I realized that there are 2 file managers with no wysiwyg stuff so that is perfect.

How can I insert a button in my module to get a file, upload it if necessary and return  the abs path or relative path  of the selected file?

I could do my own functions for that but since both file managers are great and have a nice GUI I wish to use them.

J

Re: Including other modules functionality into mine

Posted: Thu Nov 09, 2006 4:02 pm
by cyberman
If you need help to create a module skeleton module or module maker are good starting points.
ortegaj wrote: How can I insert a button in my module to get a file, upload it if necessary and return  the abs path or relative path  of the selected file?
Hmm, sound like Uploads module ...

If you wanna use functions from another module you can "include" it with a function like

Code: Select all

	function GetDependencies()
	{
		return array();

Re: Including other modules functionality into mine

Posted: Thu Nov 09, 2006 4:07 pm
by calguy1000
you can do a:

Code: Select all

$module = $this->GetModuleInstance('ModuleName');
then call any method in that module.

Re: Including other modules functionality into mine

Posted: Mon Nov 13, 2006 6:29 pm
by ortegaj
On the CMSMS site I found this:

Code: Select all

global $gCms;

  if( !isset( $gCms->modules['FileManager'] ) || !isset( $gCms->modules['FileManager']['object'] ) )
    {
       return;
    }
  $themoduleiwant = $gCms->modules['FileManager']['object'];
  //$themoduleiwant->DoThis($somedata);
  //$themoduleiwant->DoThat($somemoredata);
but it says  for modules with frontend.



I also tried  this as  posted in this topic

Code: Select all

$module = $this->GetModuleInstance('FileManager');
then call any method in that module.
but I cant figure out how to make the module show its  admin panel. 

FileManager  (not the buli-in)  does not appear to have any methods



All I want is to be able to place aa button (done) in my EDIT XXXXX  page so one of the fields  is populated with the filename (of theimage) of the selected image (or thumbnail) that was displayed on a popup windows with all images of one dir.  This functionality i habve made in other apps but there is no use into converting that into cmsms if that's already done.



Once I can use other modules I can manage all those things but right now I can't use any module.

If you could be more specific with a short example...