0) { $this->_loadAndFillObject($src['ID'], self::TABLE_NAME, $src); } else { $this->_loadByRow($src, $stripSlashes); } } elseif (intval($src)) { $sql = "SELECT * FROM " . self::TABLE_NAME . " WHERE ID = :id"; $query = $con->prepare($sql); $query->bindParam(":id", $src); try { $query->execute(); $it = $query->fetchAll(PDO::FETCH_ASSOC); Utils::FillObjectFromRow($this, $it[0]); } catch (Exception $exc) { $exc->getMessage(); } } } public static function Count($filter = null) { return parent::_count(self::TABLE_NAME, $filter); } public static function LoadDataTable($searchQuery = "", $searchArray = array(), $columnName = array(), $columnSortOrder = array(), $start = 0, $offset = 0) { return parent::_loadDataTable(self::TABLE_NAME, $searchQuery, $searchArray, $columnName, $columnSortOrder, $start, $offset); } public function LoadByNews($id_news = 0, $cancellato = 0) { global $con; if (intval($cancellato) >= 0) $where .= ($where == "" ? "" : " AND ") . "CANCELLATO = :cancellato"; if (intval($id_news) >= 0) $where .= ($where == "" ? "" : " AND ") . "ID_NEWS = :id_news"; $sql = "SELECT * FROM " . self::TABLE_NAME; if ($where != "") $sql .= " WHERE $where "; $query = $con->prepare($sql); if (intval($cancellato) >= 0) $query->bindParam(":CANCELLATO", intval($cancellato)); if (intval($id_categoria) >= 0) $query->bindParam(":ID_NEWS", intval($id_news)); try { $query->execute(); $it = $query->fetchAll(PDO::FETCH_ASSOC); } catch (Exception $exc) { $it['esito'] = -999; $it['descrizioneErrore'] = $exc->getMessage(); } return $it; } public function Save() { global $con; // 1,2,3,4 $sql = "CALL " . self::SP_ . " (?,?,?,?)"; $query = $con->prepare($sql); $query->bindParam(1, $this->ID); $query->bindParam(2, $this->ID_NEWS); $query->bindParam(3, $this->FILEPATH); $query->bindParam(4, $this->CANCELLATO); try { $it = parent::_Save($query); } catch (Exception $exc) { $it['descrizioneErrore'] = $exc->getMessage(); } return $it; } public function Delete() { return parent::_Delete(self::TABLE_NAME, "ID = " . $this->ID); } /** * Elimina l'oggetto corrente dal database e restituisce TRUE se ha successo * * @return bool Risultato booleano dell'operazione */ public function LogicalDelete() { return parent::_LogicalDelete(self::TABLE_NAME, "ID = " . $this->ID); } /** * Funzione per la visualizzazione dei logs * @param type $record * @param type $campo */ public function Parse(&$record, $campo = "") { $props = get_class_vars(get_class($this)); switch ($campo) { default: array_push($record, array("Campo" => $campo, "Valore" => $this->$campo)); break; } } }