mcramer
2012-08-30 31f6ceb52bc4422c8a9a0ed8c6b167b3089bb6a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/**
 * clients_template_plugin plugin
 * 
 * @author Marius Cramer <m.cramer@pixcept.de> pixcept KG
 * @author (original tools.inc.php) Till Brehm, projektfarm Gmbh
 * @author (original tools.inc.php) Oliver Vogel www.muv.com
 */
 
class clients_template_plugin {
 
    var $plugin_name        = 'clients_template_plugin';
    var $class_name         = 'clients_template_plugin';
    
 
    /*
            This function is called when the plugin is loaded
    */
    function onLoad() {
        global $app;
        //Register for the events        
        $app->plugin->registerEvent('client:client:on_after_insert','clients_template_plugin','apply_client_templates');
        $app->plugin->registerEvent('client:client:on_after_update','clients_template_plugin','apply_client_templates');
        $app->plugin->registerEvent('client:reseller:on_after_insert','clients_template_plugin','apply_client_templates');
        $app->plugin->registerEvent('client:reseller:on_after_update','clients_template_plugin','apply_client_templates');
    }
    
    function apply_client_templates($event_name, $page_form) {
        global $app;
        
        $app->uses('client_templates');
        $app->client_templates->apply_client_templates($page_form->id, $page_form->dataRecord);
    }
}