1: <?php
2: /**
3: * This file contains the article specifications collection and item class.
4: *
5: * @package Core
6: * @subpackage GenericDB_Model
7: * @author Murat Purc <murat@purc.de>
8: * @copyright four for business AG <www.4fb.de>
9: * @license http://www.contenido.org/license/LIZENZ.txt
10: * @link http://www.4fb.de
11: * @link http://www.contenido.org
12: */
13:
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15:
16: /**
17: * Article specification collection
18: *
19: * @package Core
20: * @subpackage GenericDB_Model
21: */
22: class cApiArticleSpecificationCollection extends ItemCollection {
23: /**
24: * Constructor to create an instance of this class.
25: *
26: * @throws cInvalidArgumentException
27: */
28: public function __construct() {
29: global $cfg;
30: parent::__construct($cfg['tab']['art_spec'], 'idartspec');
31: $this->_setItemClass('cApiArticleSpecification');
32: }
33:
34: /**
35: * Returns all article specifications by client and language.
36: *
37: * @param int $client
38: * @param int $lang
39: * @param string $orderBy
40: *
41: * @return array
42: *
43: * @throws cDbException
44: * @throws cException
45: */
46: public function fetchByClientLang($client, $lang, $orderBy = '') {
47: $this->select("client=" . (int) $client . " AND lang=" . (int) $lang, '', $this->escape($orderBy));
48: $entries = array();
49: while (($entry = $this->next()) !== false) {
50: $entries[] = clone $entry;
51: }
52: return $entries;
53: }
54:
55: }
56:
57: /**
58: * Article specification item
59: *
60: * @package Core
61: * @subpackage GenericDB_Model
62: */
63: class cApiArticleSpecification extends Item
64: {
65: /**
66: * Constructor to create an instance of this class.
67: *
68: * @param mixed $mId [optional]
69: * Specifies the ID of item to load
70: *
71: * @throws cDbException
72: * @throws cException
73: */
74: public function __construct($mId = false) {
75: global $cfg;
76: parent::__construct($cfg['tab']['art_spec'], 'idartspec');
77: $this->setFilters(array(), array());
78: if ($mId !== false) {
79: $this->loadByPrimaryKey($mId);
80: }
81: }
82:
83: }
84: