1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14:
15:
16: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
17:
18: 19: 20: 21: 22: 23:
24: class cApiMetaTagCollection extends ItemCollection {
25:
26: 27: 28:
29: public function __construct() {
30: global $cfg;
31: parent::__construct($cfg['tab']['meta_tag'], 'idmetatag');
32: $this->_setItemClass('cApiMetaTag');
33:
34:
35: $this->_setJoinPartner('cApiArticleLanguageCollection');
36: $this->_setJoinPartner('cApiMetaTypeCollection');
37: }
38:
39: 40: 41: 42: 43: 44: 45: 46:
47: public function create($iIdArtLang, $iIdMetaType, $sMetaValue) {
48: $oItem = $this->createNewItem();
49:
50: $oItem->set('idartlang', $iIdArtLang, false);
51: $oItem->set('idmetatype', $iIdMetaType, false);
52: $oItem->set('metavalue', $sMetaValue, false);
53: $oItem->store();
54:
55: return $oItem;
56: }
57:
58: 59: 60: 61: 62: 63: 64:
65: public function fetchByArtLangAndMetaType($iIdArtLang, $iIdMetaType) {
66: $this->select('idartlang=' . (int) $iIdArtLang . ' AND idmetatype=' . (int) $iIdMetaType);
67: return $this->next();
68: }
69:
70: }
71:
72: 73: 74: 75: 76: 77:
78: class cApiMetaTag extends Item {
79:
80: 81: 82: 83: 84:
85: public function __construct($mId = false) {
86: global $cfg;
87: parent::__construct($cfg['tab']['meta_tag'], 'idmetatag');
88: $this->setFilters(array(), array());
89: if ($mId !== false) {
90: $this->loadByPrimaryKey($mId);
91: }
92: }
93:
94: 95: 96: 97: 98: 99:
100: public function updateMetaValue($sMetaValue) {
101: $this->set('metavalue', $sMetaValue, false);
102: return $this->store();
103: }
104:
105: 106: 107: 108: 109: 110: 111:
112: public function setField($name, $value, $bSafe = true) {
113: switch ($name) {
114: case 'idartlang':
115: $value = (int) $value;
116: break;
117: case 'idmetatype':
118: $value = (int) $value;
119: break;
120: }
121:
122: return parent::setField($name, $value, $bSafe);
123: }
124:
125: }
126: