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: * @author Frederic Schneider
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 int Is equivalent to idarea or idnavm
42: * @param $idPlugin int Plugin Id
43: * @param $type string 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: * @var string Error storage
72: */
73: protected $_sError;
74:
75: /**
76: * Constructor Function
77: *
78: * @param mixed $id Specifies the id of item to load
79: */
80: public function __construct($id = false) {
81: global $cfg;
82: parent::__construct($cfg['tab']['plugins_rel'], 'idpluginrelation');
83: $this->_sError = '';
84: if ($id !== false) {
85: $this->loadByPrimaryKey($id);
86: }
87: }
88:
89: }
90: