Cheetah
ChCRSSDb.php
Go to the documentation of this file.
1 <?php
2 
8 require_once( CH_DIRECTORY_PATH_CLASSES . 'ChWsbDb.php' );
9 
10 class ChCRSSDb extends ChWsbDb
11 {
12  var $_oConfig;
13 
14  /*
15  * Constructor.
16  */
17  function __construct(&$oConfig)
18  {
19  parent::__construct();
20 
21  $this->_oConfig = $oConfig;
22  }
23 
24  function insertProfileRSS($_iProfileID, $sNewUrl, $sNewDesc, $iQuantity)
25  {
26  if ($sNewUrl != '' && $sNewDesc != '') {
27  $sStatus = (getParam('crss_AutoApprove_RSS') == 'on') ? 'active' : 'passive';
28 
29  $sRSSSQL = "
30  INSERT INTO `ch_crss_main` SET
31  `ProfileID`='{$_iProfileID}',
32  `RSSUrl`='{$sNewUrl}',
33  `Quantity`='{$iQuantity}',
34  `Description`='{$sNewDesc}',
35  `Status`='{$sStatus}'
36  ";
37  return $this->query($sRSSSQL);
38  }
39  }
40 
41  function updateProfileRSS($_iProfileID, $sNewUrl, $iOldID)
42  {
43  if ($iOldID != '' && $sNewUrl != '') {
44  $sStatus = (getParam('crss_AutoApprove_RSS') == 'on') ? 'active' : 'passive';
45 
46  $sRSSSQL = "
47  UPDATE `ch_crss_main` SET
48  `RSSUrl`='{$sNewUrl}',
49  `Status`='{$sStatus}'
50  WHERE
51  `ProfileID`='{$_iProfileID}' AND `ID`='{$iOldID}'
52  ";
53  return $this->query($sRSSSQL);
54  }
55  }
56 
57  function deleteProfileRSS($_iProfileID, $iOldID)
58  {
59  if ($iOldID != '') {
60  $sRSSSQL = "
61  DELETE FROM `ch_crss_main`
62  WHERE `ProfileID`='{$_iProfileID}' AND `ID`='{$iOldID}'
63  ";
64  return $this->query($sRSSSQL);
65  }
66  }
67 
68  function getProfileRSS($_iProfileID)
69  {
70  $sMemberRSSSQL = "SELECT * FROM `ch_crss_main` WHERE `ProfileID`='{$_iProfileID}'";
71 
72  $aRSSInfos = array();
73 
74  $aRSSInfo = $this->getFirstRow($sMemberRSSSQL);
75  while($aRSSInfo) {
76  $aRSSInfos[] = $aRSSInfo;
77  $aRSSInfo = $this->getNextRow();
78  }
79 
80  return $aRSSInfos;
81  }
82 
83  function getActiveProfileRSS($_iProfileID)
84  {
85  $sMemberRSSSQL = "SELECT * FROM `ch_crss_main` WHERE `ProfileID`='{$_iProfileID}' AND `Status`='active'";
86 
87  $aRSSInfos = array();
88 
89  $aRSSInfo = $this->getFirstRow($sMemberRSSSQL);
90  while($aRSSInfo) {
91  $aRSSInfos[] = $aRSSInfo;
92  $aRSSInfo = $this->getNextRow();
93  }
94 
95  return $aRSSInfos;
96  }
97 }
ChWsbDb\getParam
getParam($sName, $bCache=true)
Definition: ChWsbDb.php:454
ChCRSSDb\deleteProfileRSS
deleteProfileRSS($_iProfileID, $iOldID)
Definition: ChCRSSDb.php:57
ChCRSSDb\getActiveProfileRSS
getActiveProfileRSS($_iProfileID)
Definition: ChCRSSDb.php:83
php
$sMemberRSSSQL
$sMemberRSSSQL
Definition: get_rss_feed.php:11
ChWsbDb\getFirstRow
getFirstRow($sQuery, $aBindings=[], $iFetchStyle=PDO::FETCH_ASSOC)
Definition: ChWsbDb.php:284
ChCRSSDb\getProfileRSS
getProfileRSS($_iProfileID)
Definition: ChCRSSDb.php:68
ChCRSSDb\__construct
__construct(&$oConfig)
Definition: ChCRSSDb.php:17
ChCRSSDb\updateProfileRSS
updateProfileRSS($_iProfileID, $sNewUrl, $iOldID)
Definition: ChCRSSDb.php:41
ChWsbDb\query
query($sQuery, $aBindings=[])
Definition: ChWsbDb.php:386
ChWsbDb\getNextRow
getNextRow()
Definition: ChWsbDb.php:309
ChCRSSDb
Definition: ChCRSSDb.php:11
ChCRSSDb\insertProfileRSS
insertProfileRSS($_iProfileID, $sNewUrl, $sNewDesc, $iQuantity)
Definition: ChCRSSDb.php:24
ChWsbDb
Definition: ChWsbDb.php:13
ChCRSSDb\$_oConfig
$_oConfig
Definition: ChCRSSDb.php:12
$sStatus
$sStatus
Definition: actions.inc.php:11