Feng Forum

Other Topics => Development => : el Paquito September 20, 2011, 11:06:40 AM

: Creating a new Hook Plugin
: el Paquito September 20, 2011, 11:06:40 AM
I am creating a hook, which should create a tab when FengOffice starts (as does any module). I created several files with the following code:

The view:

:
<?php echo 'hellooo!' ?>
The Controller:

:
<?php
// QHK: Clase controlador de Helloworld
class HelloworldController extends ApplicationController {
function __construct() {
parent::__construct();
prepare_company_website_controller($this'website');
}

function index() {
$my_var 'World';
tpl_assign('world'$my_var);
}
}
?>

And the Hook, "helloworld_hooks.php"

:
<?php
Hook
::register('helloworld');

/**
 * Se llama cuando se realiza la carga de los JS
 */
function helloworld_autoload_javascripts($ignored, &$jss) {
// AƱadimos nuestro archivo JS
$jss[] = 'og/plugins/helloworld.js';
}

?>

Helloworld.js

:
Ext.onReady(function() {
// Ext.get('tabs-panel__messages-panel').setDisplayed(false);
// Ext.get('tabs-panel__mails-panel').setDisplayed(false);
// Ext.get('tabs-panel__contacts-panel').setDisplayed(false);
// Ext.get('tabs-panel__calendar-panel').setDisplayed(false);

var tp = Ext.get('tabs-panel');
var tab = new og.ContentPanel({
title: lang('helloworld'),
id: 'reporting-panel',
iconCls: 'ico-reporting-layout',
//refreshOnWorkspaceChange: true,
// defaultContent: {
// type: "url",
// data: og.getUrl('helloworld','index')
// }
});
});

It does not work load the new tab. What can happen? I have tried several ways, but the JS is loaded as the code to hide tabs if executed properly... ???
: Re: Creating a new Hook Plugin
: franponce87 November 07, 2011, 09:25:13 AM
Have you checked this  (http://www.fengoffice.com/web/wiki/doku.php/development)documentation yet? What about the Hello World example (http://www.fengoffice.com/web/wiki/doku.php/hello_world_application)?

Anyway, soon when Feng 2 is out, plugins will be easy to develop.

Best regards,
Francisco
: Re: Creating a new Hook Plugin
: timveer November 08, 2011, 02:14:52 AM
Anyway, soon when Feng 2 is out, plugins will be easy to develop.

Oh, oh, oh Francisco... your just teasing us with these comments.... Now we're all sitting on pins & needles! ;)

-t