| @@ 168-205 (lines=38) @@ | ||
| 165 | * @internal param $object |
|
| 166 | * |
|
| 167 | */ |
|
| 168 | public function updateDataType($obj, $forceQuery = false) |
|
| 169 | { |
|
| 170 | $tablename = 'efqdiralpha1_dtypes'; |
|
| 171 | $keyName = 'dtypeid'; |
|
| 172 | $excludedVars = array(); |
|
| 173 | if ($obj instanceof efqDataType) { |
|
| 174 | // Variable part of this function ends. From this line you can copy |
|
| 175 | // this function for similar object handling functions. |
|
| 176 | $obj->cleanVars(); |
|
| 177 | $cleanvars = $obj->cleanVars; |
|
| 178 | $keyValue = $obj->getVar($keyName); |
|
| 179 | } else { |
|
| 180 | return false; |
|
| 181 | } |
|
| 182 | $countVars = count($cleanvars); |
|
| 183 | $i = 1; |
|
| 184 | $strSet = ''; |
|
| 185 | $strValues = ''; |
|
| 186 | foreach ($cleanvars as $k => $v) { |
|
| 187 | if (!in_array($k, $excludedVars)) { |
|
| 188 | if ($i < $countVars and $i > 1) { |
|
| 189 | $strSet .= ', '; |
|
| 190 | } |
|
| 191 | $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 192 | } |
|
| 193 | $i++; |
|
| 194 | } |
|
| 195 | $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 196 | if ($forceQuery) { |
|
| 197 | if ($this->db->queryF($sql)) { |
|
| 198 | return true; |
|
| 199 | } |
|
| 200 | } else { |
|
| 201 | if ($this->db->query($sql)) { |
|
| 202 | return true; |
|
| 203 | } |
|
| 204 | } |
|
| 205 | ||
| 206 | return false; |
|
| 207 | } |
|
| 208 | ||
| @@ 157-194 (lines=38) @@ | ||
| 154 | * @return bool true if update is succesful, false if unsuccesful |
|
| 155 | * @internal param object $objOffer object of type listing |
|
| 156 | */ |
|
| 157 | public function update($obj, $forceQuery = false) |
|
| 158 | { |
|
| 159 | $tablename = 'efqdiralpha1_itemtypes'; |
|
| 160 | $keyName = 'typeid'; |
|
| 161 | $excludedVars = array(); |
|
| 162 | if ($obj instanceof efqItemType) { |
|
| 163 | // Variable part of this function ends. From this line you can copy |
|
| 164 | // this function for similar object handling functions. |
|
| 165 | $obj->cleanVars(); |
|
| 166 | $cleanvars = $obj->cleanVars; |
|
| 167 | $keyValue = $obj->getVar($keyName); |
|
| 168 | } else { |
|
| 169 | return false; |
|
| 170 | } |
|
| 171 | $countVars = count($cleanvars); |
|
| 172 | $i = 0; |
|
| 173 | $strSet = ''; |
|
| 174 | $strValues = ''; |
|
| 175 | foreach ($cleanvars as $k => $v) { |
|
| 176 | if (!in_array($k, $excludedVars)) { |
|
| 177 | if ($i < $countVars and $i > 0) { |
|
| 178 | $strSet .= ', '; |
|
| 179 | } |
|
| 180 | $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 181 | } |
|
| 182 | $i++; |
|
| 183 | } |
|
| 184 | $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 185 | if ($forceQuery) { |
|
| 186 | if ($this->db->queryF($sql)) { |
|
| 187 | return true; |
|
| 188 | } |
|
| 189 | } else { |
|
| 190 | if ($this->db->query($sql)) { |
|
| 191 | return true; |
|
| 192 | } |
|
| 193 | } |
|
| 194 | ||
| 195 | return false; |
|
| 196 | } |
|
| 197 | ||
| @@ 167-204 (lines=38) @@ | ||
| 164 | * @return bool true if update is succesful, false if unsuccesful |
|
| 165 | * @internal param object $objOffer object of type listing |
|
| 166 | */ |
|
| 167 | public function updateOffer($obj, $forceQuery = false) |
|
| 168 | { |
|
| 169 | $tablename = 'efqdiralpha1_subscr_offers'; |
|
| 170 | $keyName = 'offerid'; |
|
| 171 | $excludedVars = array('level', 'typename'); |
|
| 172 | if ($obj instanceof efqSubscriptionOffer) { |
|
| 173 | // Variable part of this function ends. From this line you can copy |
|
| 174 | // this function for similar object handling functions. |
|
| 175 | $obj->cleanVars(); |
|
| 176 | $cleanvars = $obj->cleanVars; |
|
| 177 | $keyValue = $obj->getVar($keyName); |
|
| 178 | } else { |
|
| 179 | return false; |
|
| 180 | } |
|
| 181 | $countVars = count($cleanvars); |
|
| 182 | $i = 1; |
|
| 183 | $strSet = ''; |
|
| 184 | $strValues = ''; |
|
| 185 | foreach ($cleanvars as $k => $v) { |
|
| 186 | if (!in_array($k, $excludedVars)) { |
|
| 187 | if ($i < $countVars and $i > 1) { |
|
| 188 | $strSet .= ', '; |
|
| 189 | } |
|
| 190 | $strSet .= $k . '=' . "'" . $v . "'"; |
|
| 191 | } |
|
| 192 | $i++; |
|
| 193 | } |
|
| 194 | $sql = sprintf('UPDATE %s SET %s WHERE %s = %u', $this->db->prefix($tablename), $strSet, $keyName, $keyValue); |
|
| 195 | if ($forceQuery) { |
|
| 196 | if ($this->db->queryF($sql)) { |
|
| 197 | return true; |
|
| 198 | } |
|
| 199 | } else { |
|
| 200 | if ($this->db->query($sql)) { |
|
| 201 | return true; |
|
| 202 | } |
|
| 203 | } |
|
| 204 | ||
| 205 | return false; |
|
| 206 | } |
|
| 207 | ||