public function addFilter(&$query, $id, $active, $email, $date, $date_symbol) { if ($id !== NULL) { $query .= " AND id = '" . DataHandler::forceInt($id) . "'"; } if ($active !== NULL) { $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'"; } if ($email !== NULL) { $query .= " AND `email` = '" . DataHandler::forceString($email) . "'"; } if ($date !== NULL) { $date_symbol = parent::compareSimble($date_symbol); $date = parent::dateHandlerScape(DataHandler::convertDateToDB($date)); $query .= " AND `date` {$date_symbol} {$date} "; } }
/** * @param $date (date) * @return void */ public function setDate($date) { $this->date = DataHandler::convertDateToDB($date); }
/** * @param $id * @param $active * @param $name * @param $title * @param $hat * @param $description * @param $content * @param $author * @param $template_url * @param $slug * @param $key_words * @param $date * @param $date_in * @param $date_out * @param $order * @return ReturnDataVO */ public function update($id, $active = 0, $name = NULL, $title = NULL, $hat = NULL, $description = NULL, $content = NULL, $author = NULL, $template_url = NULL, $slug = NULL, $key_words = NULL, $date = NUL, $date_in = NULL, $date_out = NULL, $order) { $ReturnDataVO = new ReturnDataVO(); $query = "UPDATE content SET "; if ($id == NULL && $id <= 0) { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID; return $ReturnDataVO; } $comma = ""; if ($active !== NULL) { $query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'"; $comma = ", "; } if ($name !== NULL) { $query .= $comma . " `name` = '" . DataHandler::forceString($name) . "'"; $comma = ", "; } if ($title !== NULL) { $query .= $comma . " `title` = '" . DataHandler::forceString($title) . "'"; $comma = ", "; } if ($hat !== NULL) { $query .= $comma . " `hat` = '" . DataHandler::forceString($hat) . "'"; $comma = ", "; } if ($description !== NULL) { $query .= $comma . " `description` = '" . DataHandler::forceString($description) . "'"; $comma = ", "; } if ($content !== NULL) { $query .= $comma . " `content` = '" . DataHandler::forceString($content) . "'"; $comma = ", "; } if ($author !== NULL) { $query .= $comma . " `author` = '" . DataHandler::forceString($author) . "'"; $comma = ", "; } if ($template_url !== NULL) { $query .= $comma . " `template_url` = '" . DataHandler::removeSpecialCharacters($template_url) . "'"; $comma = ", "; } if ($slug !== NULL) { $query .= $comma . " `slug` = '" . DataHandler::removeSpecialCharacters($slug) . "'"; $comma = ", "; } if ($key_words !== NULL) { $query .= $comma . " `key_words` = '" . DataHandler::forceString($key_words) . "'"; $comma = ", "; } if ($date !== NULL) { $date = $date == "now()" ? "now()" : "'" . DataHandler::convertDateToDB($date) . "'"; $query .= $comma . " `date` = {$date} "; $comma = ", "; } if ($date_in !== NULL) { $query .= $comma . " `date_in` = '" . DataHandler::convertDateToDB($date_in) . "'"; $comma = ", "; } if ($date_out !== NULL) { $query .= $comma . " `date_out` = '" . DataHandler::convertDateToDB($date_out) . "'"; $comma = ", "; } if ($order !== NULL) { $query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'"; $comma = ", "; } $query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1"; if ($comma == "") { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES; //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } else { $ReturnDataVO = parent::query($query); //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } }
/** * @param $id * @param $active * @param $table * @param $table_id * @param $user_id * @param $title * @param $description * @param $date * @param $order * @return ReturnDataVO */ public function update($id = NULL, $active = NULL, $table = NULL, $table_id = NULL, $user_id = NULL, $title = NULL, $description = NULL, $date = NULL, $order = NULL) { $ReturnDataVO = new ReturnDataVO(); $query = "UPDATE comment SET "; if ($id == NULL && $id <= 0) { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID; return $ReturnDataVO; } $comma = ""; if ($active !== NULL) { $query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'"; $comma = ", "; } if ($table > 0) { $query .= $comma . " `table` = '" . DataHandler::forceString($table) . "'"; $comma = ", "; } if ($user_id > 0) { $query .= $comma . " `user_id` = '" . DataHandler::forceInt($user_id) . "'"; $comma = ", "; } if ($table_id > 0) { $query .= $comma . " `table_id` = '" . DataHandler::forceInt($table_id) . "'"; $comma = ", "; } if ($title !== NULL) { $query .= $comma . " `title` = '" . DataHandler::forceString($title) . "'"; $comma = ", "; } if ($description !== NULL) { $query .= $comma . " `description` = '" . DataHandler::forceString($description) . "'"; $comma = ", "; } if ($date !== NULL) { $query .= $comma . " `date` = '" . DataHandler::convertDateToDB($date) . "'"; $comma = ", "; } if ($order !== NULL) { $query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'"; $comma = ", "; } $query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1"; if ($comma == "") { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES; //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } else { $ReturnDataVO = parent::query($query); //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } }
/** * @param $type * @param $value * @return void */ public function setValueByType($value, $type) { //echo "vai comparar ".strtolower($type)." com :".$this->TYPE_INT; switch (strtolower($type)) { case ParametherDAO::TYPE_NUMBER: $this->number = $value; break; case ParametherDAO::TYPE_TEXT: case ParametherDAO::TYPE_JSON: $this->text = $value; break; case ParametherDAO::TYPE_INT: $this->int = $value; break; case ParametherDAO::TYPE_DATE: $this->date = DataHandler::convertDateToDB($value); break; default: $this->varchar = $value; break; } }
/** * @param date_out (datetime) */ public function setDateOut($date_out) { if ($date_out !== NULL) { $this->date_out = DataHandler::convertDateToDB($date_out); } }
/** * @param $id * @param $active * @param $name * @param $link * @param $content * @param $image_url * @param $date * @param $date_in * @param $date_out * @param $order * @return ReturnDataVO */ public function update($id, $active = 0, $name = NULL, $link = NULL, $content = NULL, $image_url = NULL, $date = NUL, $date_in = NULL, $date_out = NULL, $order) { $ReturnDataVO = new ReturnDataVO(); $query = "UPDATE highlights SET "; if ($id == NULL && $id <= 0) { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_ID; return $ReturnDataVO; } $comma = ""; if ($active !== NULL) { $query .= $comma . " `active` = '" . DataHandler::forceInt($active) . "'"; $comma = ", "; } if ($name !== NULL) { $query .= $comma . " `name` = '" . DataHandler::forceString($name) . "'"; $comma = ", "; } if ($link !== NULL) { $query .= $comma . " `link` = '" . DataHandler::forceString($link) . "'"; $comma = ", "; } if ($content !== NULL) { $query .= $comma . " `content` = '" . DataHandler::forceString($content) . "'"; $comma = ", "; } if ($image_url !== NULL) { $query .= $comma . " `image_url` = '" . DataHandler::removeSpecialCharacters($image_url) . "'"; $comma = ", "; } if ($date !== NULL) { $query .= $comma . " `date` = '" . DataHandler::convertDateToDB($date) . "'"; $comma = ", "; } if ($date_in !== NULL) { $query .= $comma . " `date_in` = '" . DataHandler::convertDateToDB($date_in) . "'"; $comma = ", "; } if ($date_out !== NULL) { $query .= $comma . " `date_out` = '" . DataHandler::convertDateToDB($date_out) . "'"; $comma = ", "; } if ($order !== NULL) { $query .= $comma . " `order` = '" . DataHandler::forceInt($order) . "'"; $comma = ", "; } $query .= "\tWHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1"; if ($comma == "") { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_UPDATE_DONOT_HAVE_UPDATES; //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } else { $ReturnDataVO = parent::query($query); //Debug::print_r($ReturnDataVO); return $ReturnDataVO; } }
/** * @param registred (date) */ public function setRegistred($registred) { $this->registred = DataHandler::convertDateToDB($registred); }
/** * @param $table * @param $table_id * @param $name * @param $type * @param $active * @param $locale * @param $varchar * @param $text * @param $number * @param $int * @param $date * @return ReturnDataVO */ public function update($id, $table, $table_id, $name = NULL, $type = ParametherDAO::TYPE_VARCHAR, $active = 1, $locale = NULL, $varchar = NULL, $text = NULL, $number = NULL, $int = NULL, $date = NULL) { $ReturnDataVO = new ReturnDataVO(); if ($id == NULL && $id <= 0) { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_ID; return $ReturnDataVO; } $query = "UPDATE `paramether` SET "; $comma = ""; if ($active !== NULL) { $query .= "{$comma} `active` = '" . DataHandler::forceInt($active) . "'"; $comma = ", "; } if ($table !== NULL) { $query .= " {$comma} `table` = '" . DataHandler::forceString($table) . "'"; $comma = " , "; } if ($table_id !== NULL) { $query .= " {$comma} `table_id` = '" . DataHandler::forceInt($table_id) . "'"; $comma = " , "; } if ($name !== NULL) { $query .= "{$comma} `name` = '" . DataHandler::forceString($name) . "'"; $comma = ", "; } if ($type !== NULL) { $query .= " {$comma} `type` = '" . DataHandler::forceString($type) . "'"; $comma = " , "; } if ($locale !== NULL) { $query .= " {$comma} `locale` = '" . DataHandler::forceString($locale) . "'"; $comma = ", "; } if ($varchar !== NULL) { $query .= " {$comma} `varchar` = '" . DataHandler::forceString($varchar) . "'"; $comma = ", "; } if ($text !== NULL) { $query .= " {$comma} `text` = '" . DataHandler::forceString($text) . "'"; $comma = ", "; } if ($number !== NULL) { $query .= " {$comma} `number` = '" . DataHandler::forceNumber($number) . "'"; $comma = ", "; } if ($int !== NULL) { $query .= " {$comma} `int` = '" . DataHandler::forceInt($int) . "'"; $comma = ", "; } if ($date !== NULL) { $query .= " {$comma} `date` = '" . DataHandler::convertDateToDB($date) . "'"; $comma = ", "; } $query .= " WHERE id = '" . DataHandler::forceInt($id) . "' LIMIT 1 "; //echo $query; if ($comma == "") { $ReturnDataVO->success = FALSE; $ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_DONOT_HAVE_UPDATES; return $ReturnDataVO; } else { $ReturnDataVO = parent::query($query); if (!$ReturnDataVO->success) { $ReturnDataVO->code_return = DbInterface::ERROR_PARAMETHER_UPDATE_COMMIT; } return $ReturnDataVO; } }
private function addFilter(&$query, $id = NULL, $address_id = NULL, $name = NULL, $last_name = NULL, $birthday = NULL, $mobile = NULL, $telephone = NULL, $email = NULL, $rg = NULL, $cpf = NULL, $company = NULL, $website = NULL, $sex = NULL, $recive_news = NULL, $registred = NULL, $user_type_id = NULL, $date = NULL, $date_symbol = ">=") { if ($id !== NULL) { $query .= " AND user.id = '" . DataHandler::forceInt($id) . "'"; } if ($name !== NULL) { $query .= " AND `name` LIKE '%" . DataHandler::forceString($name) . "%'"; } if ($last_name !== NULL) { $query .= " AND `last_name` ='" . DataHandler::forceString($last_name) . "'"; } if ($birthday !== NULL) { $query .= " AND `birthday` =" . $this->dateHandlerScape($birthday); } if ($mobile !== NULL) { $query .= " AND `mobile` ='" . DataHandler::forceString($mobile) . "'"; } if ($telephone !== NULL) { $query .= " AND `telephone` ='" . DataHandler::forceString($telephone) . "'"; } if ($email !== NULL) { $query .= " AND `email` ='" . DataHandler::forceString($email) . "'"; } if ($rg !== NULL) { $query .= " AND `rg` ='" . DataHandler::forceString($rg) . "'"; } if ($cpf !== NULL) { $query .= " AND `cpf` ='" . DataHandler::forceString($cpf) . "'"; } if ($company !== NULL) { $query .= " AND `company` ='" . DataHandler::forceString($company) . "'"; } if ($website !== NULL) { $query .= " AND `website` ='" . DataHandler::forceString($website) . "'"; } if ($sex !== NULL) { $query .= " AND `sex` ='" . DataHandler::forceInt($sex) . "'"; } if ($recive_news !== NULL) { $query .= " AND `recive_news` ='" . DataHandler::forceInt($recive_news) . "'"; } if ($registred !== NULL) { $query .= " AND `registred` =" . $this->dateHandlerScape($registred) . ""; } if ($user_type_id != NULL) { $query .= " AND `user_type_id` =" . DataHandler::forceInt($user_type_id) . ""; } if ($date !== NULL) { $date_symbol = parent::compareSimble($date_symbol); $date = parent::dateHandlerScape(DataHandler::convertDateToDB($date)); $query .= " AND `registred` {$date_symbol} {$date} "; } }
/** * @param (object) $obj_dados * @return void */ function setFetchObject($obj_dados) { $this->id = DataHandler::getValueByStdObjectIndex($obj_dados, "id"); $this->user_id = DataHandler::getValueByStdObjectIndex($obj_dados, "user_id"); $this->table_id = DataHandler::getValueByStdObjectIndex($obj_dados, "table_id"); $this->table = DataHandler::getValueByStdObjectIndex($obj_dados, "table"); $this->active = DataHandler::getValueByStdObjectIndex($obj_dados, "active"); $this->title = DataHandler::getValueByStdObjectIndex($obj_dados, "title"); $this->description = DataHandler::getValueByStdObjectIndex($obj_dados, "description"); $this->date = DataHandler::convertDateToDB(DataHandler::getValueByStdObjectIndex($obj_dados, "date")); $this->order = DataHandler::getValueByStdObjectIndex($obj_dados, "order"); }