1: <?php
2: /**
3: * This file contains Plugin Manager Relations recipient class.
4: *
5: * @package Plugin
6: * @subpackage PluginManager
7: * @version SVN Revision $Rev:$
8: *
9: * @author Frederic Schneider
10: * @copyright four for business AG <www.4fb.de>
11: * @license http://www.contenido.org/license/LIZENZ.txt
12: * @link http://www.4fb.de
13: * @link http://www.contenido.org
14: */
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: /**
19: * Plugin Manager Relations recipient class.
20: *
21: * @package Plugin
22: * @subpackage PluginManager
23: *
24: */
25: class PimPluginRelationsCollection extends ItemCollection {
26:
27: /**
28: * Constructor Function
29: *
30: * @param none
31: */
32: public function __construct() {
33: global $cfg;
34: parent::__construct($cfg['tab']['plugins_rel'], 'idpluginrelation');
35: $this->_setItemClass('PimPluginRelations');
36: }
37:
38: /**
39: * Create a new plugin
40: *
41: * @param $idItem Is equivalent to idarea or idnavm
42: * @param $idPlugin Plugin Id
43: * @param $type Relation to tables *_area and *_nav_main
44: */
45: public function create($idItem, $idPlugin, $type) {
46:
47: // security checks
48: $idItem = cSecurity::toInteger($idItem);
49: $idPlugin = cSecurity::toInteger($idPlugin);
50: $type = cSecurity::escapeString($type);
51:
52: // create a new entry
53: $item = parent::createNewItem();
54: $item->set('iditem', $idItem);
55: $item->set('idplugin', $idPlugin);
56: $item->set('type', $type);
57:
58: $item->store();
59:
60: return $item;
61: }
62:
63: }
64:
65: /**
66: * Single Plugin Manager Relations Item
67: */
68: class PimPluginRelations extends Item {
69:
70: /**
71: *
72: * @var string Error storage
73: * @access private
74: */
75: protected $_sError;
76:
77: /**
78: * Constructor Function
79: *
80: * @param $id mixed Specifies the id of item to load
81: */
82: public function __construct($id = false) {
83: global $cfg;
84: parent::__construct($cfg['tab']['plugins_rel'], 'idpluginrelation');
85: $this->_sError = '';
86: if ($id !== false) {
87: $this->loadByPrimaryKey($id);
88: }
89: }
90:
91: }
92: