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: /**
25: * Constructor function
26: */
27: public function __construct() {
28: global $cfg;
29: parent::__construct($cfg['tab']['art_spec'], 'idartspec');
30: $this->_setItemClass('cApiArticleSpecification');
31: }
32:
33: /**
34: * Returns all article specifications by client and language.
35: *
36: * @param int $client
37: * @param int $lang
38: * @param string $orderby [optional]
39: * Order statement, like "artspec ASC"
40: * @return array
41: */
42: public function fetchByClientLang($client, $lang, $orderBy = '') {
43: $this->select("client=" . (int) $client . " AND lang=" . (int) $lang, '', $this->escape($orderBy));
44: $entries = array();
45: while (($entry = $this->next()) !== false) {
46: $entries[] = clone $entry;
47: }
48: return $entries;
49: }
50:
51: }
52:
53: /**
54: * Article specification item
55: *
56: * @package Core
57: * @subpackage GenericDB_Model
58: */
59: class cApiArticleSpecification extends Item {
60:
61: /**
62: * Constructor function
63: *
64: * @param mixed $mId [optional]
65: * Specifies the ID of item to load
66: */
67: public function __construct($mId = false) {
68: global $cfg;
69: parent::__construct($cfg['tab']['art_spec'], 'idartspec');
70: $this->setFilters(array(), array());
71: if ($mId !== false) {
72: $this->loadByPrimaryKey($mId);
73: }
74: }
75:
76: }
77: