本文整理汇总了PHP中DataHandler::forceInt方法的典型用法代码示例。如果您正苦于以下问题:PHP DataHandler::forceInt方法的具体用法?PHP DataHandler::forceInt怎么用?PHP DataHandler::forceInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataHandler
的用法示例。
在下文中一共展示了DataHandler::forceInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
$page = 1;
$limit_page = 21;
$quant_start = 0;
foreach ($this->arrayVariable as $variable => $value) {
if ($variable == "pag" && DataHandler::forceInt($value) > 0) {
$page = DataHandler::forceInt($value);
}
}
$quant_start = $page * $limit_page - $limit_page;
$this->UserDatailDAO = UserDetailDAO::getInstance();
if (false) {
$this->UserDatailDAO = new UserDetailDAO();
}
//iniciando o retorno padrao em http result
$returnResult = new HttpResult();
$arrayUser = array();
//fazendo o que precisa fazer para ter os dados
$ReturnDataVO = $this->UserDatailDAO->select(UserDetailDAO::RETURN_VO, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, $limit_page, $quant_start, 1);
//setando sucesso true caso tenha dado certo
$returnResult->setSuccess(count($ReturnDataVO->result) > 0);
//iniciando o resultado para o html
$retornoDaPaginaHTML = new HttpAdminGenericResult();
$retornoDaPaginaHTML->arrayVariable = $this->arrayVariable;
$retornoDaPaginaHTML->arrayUsers = $ReturnDataVO->result;
$retornoDaPaginaHTML->page = $page;
$retornoDaPaginaHTML->limit_page = $limit_page;
$retornoDaPaginaHTML->count_total = $ReturnDataVO->count_total;
//salvando o objeto de resultado de html no retorno
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
}
示例2: selectHighlights
/**
* busca todos os highlightss conforme requisições na HighlightsInfoPostVO
* @return ReturnResultVO
*/
public function selectHighlights()
{
$table = DataHandler::forceString($this->HighlightsInfoPostVO->request_table);
$table_id = DataHandler::forceInt($this->HighlightsInfoPostVO->request_table_id);
$quant_start = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_start);
$quant_limit = DataHandler::forceInt($this->HighlightsInfoPostVO->request_quant_limit);
$type_of_return = DataHandler::forceString($this->HighlightsInfoPostVO->request_type_of_return);
$locale = DataHandler::forceString($this->HighlightsInfoPostVO->request_locale);
// se nao foi passado table e table id naum da pra procurar
if ($table == NULL && $table_id < 1) {
$ReturnResultVO->success = FALSE;
$ReturnResultVO->result = $this->array_highlights;
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND");
return $ReturnResultVO;
}
//inicia a LinkDAO para fazer a consulta
$DAO = HighLightsDAO::getInstance();
//busca highlightss vinculados a tabela e tabela id passados
$ReturnDataVO = $DAO->selectByTableId($table, $table_id, $type_of_return, "highlights", $quant_limit, $quant_start);
if ($ReturnDataVO->success) {
//Debug::print_r($ReturnDataVO);exit();
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $ReturnDataVO->result;
return $ReturnResultVO;
} else {
$ReturnResultVO->success = $ReturnDataVO->success;
$ReturnResultVO->result = $this->array_highlights;
$ReturnResultVO->array_messages[] = Translation::text("LibraryLanguage::ERROR_HIGHLIGHTS_NOT_FOUND");
return $ReturnResultVO;
}
}
示例3: __construct
/**
* @param $arrayRest
* @return void
*/
public function __construct($arrayRest = NULL)
{
parent::__construct($arrayRest);
$this->sub = count($this->arrayRestFolder) > 1 ? $this->arrayRestFolder[1] : "";
$this->my_redirect = "admin/page/select";
$this->my_redirect .= "/" . $this->sub;
$this->my_action .= "/" . $this->sub;
//echo $this->sub;
switch ($this->sub) {
case "blog":
$this->category_id = 36;
break;
case "sobre":
$this->category_id = 15;
$this->my_redirect = "/admin/page/edit/sobre/id.15/";
break;
case "franquias":
$this->category_id = 42;
$this->my_redirect = "/admin/page/edit/franquias/id.21/";
//$this->total_files = 1;
break;
case "unidades":
$this->my_redirect = "/admin/unidades/select/";
//$this->total_files = 1;
break;
default:
$this->category_id = 18;
break;
}
if (DataHandler::getValueByArrayIndex($this->arrayVariable, "category_id")) {
$this->category_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "category_id"));
}
}
示例4: addComments
/**
* @param $title
* @param $description
* @param $user_id
* @param $t_id
* @param $active
* @return void
*/
public function addComments($title = NULL, $description = NULL, $user_id = NULL, $t_id = "insert", $active = NULL)
{
//se passar o p_id indica que está editando um term já existente
//criando a array a ser inserida - usado como se fosse um mini VO
$this->startCommentDAO();
$CommentVO = $this->CommentDAO->getItemVO();
$CommentVO->setStatus($t_id == "insert" || $t_id == NULL ? CommentDAO::STATUS_INSERT : CommentDAO::STATUS_UPDATE);
$CommentVO->setTitle($title);
$CommentVO->setDescription($description);
$CommentVO->setUserId($user_id);
$CommentVO->setTableId($this->id);
$CommentVO->setTable($this->__table);
$CommentVO->setActive($active);
//verifica se deve c a array de parameter
if ($this->id > 0) {
//se já tem id é pq é um dado já cadastrado
$this->getComments();
}
//se não tem, então vai adicionar só os terms novos
if (!count($this->__arrayComments) > 0) {
//iniciando a array para demonstrar que já buscou ou tentou buscar
$this->__arrayComments = array();
}
$t_id = DataHandler::forceInt($t_id);
if ($t_id > 0) {
$CommentVO->setId($t_id);
}
$this->updateComment($CommentVO);
//else {
//push/
//echo "<li>adicionando".var_dump($CommentVO)."</li>";
//$this->__arrayComments[] = $CommentVO;
//}
//s vai realmente adicionar quando for chamado o metodo cadastrar()
}
示例5: init
public function init()
{
$page = 1;
$limit_page = 21;
$quant_start = 0;
foreach ($this->arrayVariable as $variable => $value) {
if ($variable == "pag" && DataHandler::forceInt($value) > 0) {
$page = DataHandler::forceInt($value);
}
}
$quant_start = $page * $limit_page - $limit_page;
$this->UserDatailDAO = UserDetailDAO::getInstance();
if (false) {
$this->UserDatailDAO = new UserDetailDAO();
}
//iniciando o retorno padrao em http result
$returnResult = new HttpResult();
$arrayUser = array();
if (FALSE) {
$this->UserDatailDAO = new UserDetailDAO();
}
if (DataHandler::getValueByArrayIndex($this->arrayVariable, "busca")) {
//tem busca, vai tratar essa variavel
$this->arrayVariable["busca"] = str_replace("busca.", "", $this->arrayRestFolder[1]);
}
if (isset($this->arrayVariable["busca"])) {
$this->arrayVariable["busca"] = str_replace("%20", " ", $this->arrayVariable["busca"]);
}
//fazendo o que precisa fazer para ter os dados
//$ReturnDataVO = $this->UserDatailDAO->select(UserDetailDAO::RETURN_VO, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, NUll, $limit_page, $quant_start);
/*
<option value="name">Nome</option>
<option value="email" selected="selected" >Email</option>
<option value="cpf">CPF</option>
<option value="rg">RG</option>
<option value="company">Empresa</option>
<option value="telefone">Telefone</option>
*/
$name = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "name" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$mobile = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "telefone" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$telephone = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "telefone" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$email = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "email" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$rg = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "rg" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$cpf = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "cpf" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$company = DataHandler::getValueByArrayIndex($this->arrayVariable, "filtro") == "company" ? DataHandler::getValueByArrayIndex($this->arrayVariable, "busca") : NULL;
$ReturnDataVO = $this->UserDatailDAO->search(UserDetailDAO::RETURN_VO, $name, $mobile, $telephone, $email, $rg, $cpf, $company, $limit_page, $quant_start, 3);
// Debug::print_r($ReturnDataVO);
//setando sucesso true caso tenha dado certo
$returnResult->setSuccess(count($ReturnDataVO->result) > 0);
//iniciando o resultado para o html
$retornoDaPaginaHTML = new HttpAdminGenericResult();
$retornoDaPaginaHTML->arrayVariable = $this->arrayVariable;
$retornoDaPaginaHTML->arrayUsers = $ReturnDataVO->result;
$retornoDaPaginaHTML->page = $page;
$retornoDaPaginaHTML->limit_page = $limit_page;
$retornoDaPaginaHTML->count_total = $ReturnDataVO->count_total;
//salvando o objeto de resultado de html no retorno
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
}
示例6: init
public function init()
{
$page = 1;
$limit_page = 21;
$quant_start = 0;
foreach ($this->arrayVariable as $variable => $value) {
if ($variable == "pag" && DataHandler::forceInt($value) > 0) {
$page = DataHandler::forceInt($value);
}
}
$quant_start = $page * $limit_page - $limit_page;
//iniciando o retorno padrao em http result
$returnResult = new HttpResult();
$arrayTheme = array();
//fazendo o que precisa fazer para ter os dados
$ReturnDataVO = $this->DAO->select(AttributeBaseDAO::RETURN_VO, NUll, 1, NUll, NULL, $limit_page, $quant_start);
// Debug::print_r($ReturnDataVO);
//setando sucesso true caso tenha dado certo
$returnResult->setSuccess(count($ReturnDataVO->result) > 0);
//iniciando o resultado para o html
$retornoDaPaginaHTML = new HttpAdminGenericResult();
$retornoDaPaginaHTML->arrayVariable = $this->arrayVariable;
$retornoDaPaginaHTML->arrayAttributes = $ReturnDataVO->result;
$retornoDaPaginaHTML->module = $this->module;
$retornoDaPaginaHTML->page = $page;
$retornoDaPaginaHTML->limit_page = $limit_page;
$retornoDaPaginaHTML->count_total = $ReturnDataVO->count_total;
//salvando o objeto de resultado de html no retorno
$returnResult->setHttpContentResult($retornoDaPaginaHTML);
return $returnResult;
}
示例7: getZipedFiles
/**
* envie por post uma array de ids de files, só os ids
* file/get_ziped_files
*/
public function getZipedFiles()
{
if (!UserClient::getId() > 0) {
//nao tem permissao
Navigation::redirect("405");
exit;
}
$array_file_ids = DataHandler::getValueByArrayIndex($_POST, "file_id");
//Debug::print_r($_REQUEST);
$array_file_vo = array();
if (is_array($array_file_ids)) {
foreach ($array_file_ids as $id) {
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
}
} else {
//erro, não é uma array, verifica se pelo menos é 1 único id
$id = DataHandler::forceInt($array_file_ids);
if ($id > 0) {
//é um id único
$FileVO = new FileVO();
$Result = $FileVO->setId($id, TRUE);
if ($Result->success == TRUE) {
$array_file_vo[] = $FileVO;
}
} else {
//erro mesmo, esse dado é zoado, estoura excessão
throw new Exception("No ids sended", 404);
exit;
}
}
//a pasta zip precisa existir
DataHandler::createFolderIfNotExist("upload/zip/");
//verifica o nome do arquivo baseado nos ids enviados conforme regra inventada agora
$zip_name = "upload/zip/" . md5(implode("|", $array_file_ids));
DataHandler::createFolderIfNotExist($zip_name);
$zip_name = $zip_name . "/teto.zip";
if (!file_exists($zip_name)) {
//echo Debug::li($zip_name);exit();
$Zip = new ZipArchive();
$Zip->open($zip_name, ZipArchive::CREATE);
foreach ($array_file_vo as $FileVO) {
$url = $FileVO->getUrl();
$array = explode("/", $url);
$file = $array[count($array) - 1];
$Zip->addFile($url, $file);
}
$Zip->close();
}
header("Location: " . Config::getRootPath($zip_name));
exit;
}
示例8: edit
public function edit()
{
$category_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
$CategoryVO = NULL;
if ($category_id > 0) {
$CategoryVO = new CategoryVO();
$CategoryVO->setId($category_id, TRUE);
return $this->insert($CategoryVO);
}
Navigation::redirect("admin/category/select");
}
示例9: limit
/**
*
* @param (int) $quant_limite = NULL
* @param (int) $quant_inicial = NULL
* @return string
*/
public function limit($quant_limit = NULL, $quant_start = NULL)
{
//$quant_start
$quant_limit = DataHandler::forceInt($quant_limit);
$quant_limit = $quant_limit < 0 ? 0 : $quant_limit;
$quant_start = DataHandler::forceInt($quant_start);
$quant_start = $quant_start < 0 ? 0 : $quant_start;
if ($quant_limit > 0) {
return " LIMIT {$quant_start}, {$quant_limit} ";
}
return "";
}
示例10: update
/**
* /backend/image/update/id.N/
* e por post enviar descricao
* @return void da echo de string
*/
public function update()
{
$ReturnResultVO = new ReturnResultVO();
$id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
$descricao = DataHandler::forceInt(DataHandler::getValueByArrayIndex($_POST, "descricao"));
if ($id > 0) {
$ImageVO = new ImageVO();
$ReturnResultVO = $ImageVO->setId($id, TRUE);
if ($ReturnResultVO->success) {
$ImageVO->setDescription($descricao);
$ReturnResultVO = $ImageVO->commit();
}
}
echo $ReturnResultVO->toJson();
exit;
}
示例11: getFile
public function getFile()
{
//pega o id da imagem enviada na url - esse é a preferencia
$file_id = DataHandler::forceInt($this->infoPost->request_file_id);
// print_r($file_id);exit();
$url = "";
// echo Debug::li("1");
if (!$file_id > 0) {
// echo Debug::li("2");
//só considera a url se não tem id
$url = $this->infoPost->request_file_url;
}
$urlFile = $url;
// echo $url;
// echo Debug::li("3");
if ($urlFile == "") {
// echo Debug::li("4");
$FileVO = new FileVO();
$ReturnResultVO = $FileVO->setId($file_id, TRUE);
// print_r($FileVO);
if ($ReturnResultVO->success) {
// echo Debug::li("5 : ".$FileVO->getURL());
$urlFile = DataHandler::removeDobleBars($FileVO->getURL());
}
} else {
// echo Debug::li("6");
// echo $urlFile."cacacaac";
$urlFile = DataHandler::removeDobleBars(str_replace(array("..", ""), "", $urlFile));
}
// echo $urlFile;
// exit();
// echo Debug::li("7");
if ($urlFile == "" || !file_exists($urlFile)) {
// echo Debug::li("8 : ".$urlFile." nao existe, entao:".$this->defaultFile404);
// exit();
//não encontrou a filem, seta a url com a url da filem padrão
$urlFile = $this->defaultFile404;
}
// echo $urlFile;
// exit();
Navigation::redirect($urlFile);
exit;
}
示例12: cliente
/**
*
* Para acessar isso aqui seria a url: pdf_download/produto/id.N/
*/
public function cliente($id = false)
{
if ($id == FALSE) {
$id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
}
if ($id > 0) {
$ContentSiteVO = new ContentSiteVO();
$ReturnResult_vo = $ContentSiteVO->setId($id, TRUE);
if ($ReturnResult_vo->success) {
$stdProduct = $ContentSiteVO->toStdClass();
$stdProduct->array_gallery = $ContentSiteVO->getImages(NULL, "gallery", true);
$stdProduct->array_tagged = $ContentSiteVO->getImages(NULL, "tagged", true);
$html_start = "<html><body>";
$html_end = "</body></html>";
$detail_page = file_get_contents(Config::getFolderView("/PdfDownload/detail.tpl"));
$image_page = file_get_contents(Config::getFolderView("/PdfDownload/image.tpl"));
$dimension_page = file_get_contents(Config::getFolderView("/PdfDownload/dimension.tpl"));
$tpl_img_path = "view/site/";
//Config::getAsset() ;
$recover_logo = $stdProduct->hat == 1 ? '<img style=" margin-top: 4px; margin-left: 5px; " src="' . $tpl_img_path . '/PdfDownload/recover_logo.png" />' : "";
$stdProduct->description = utf8_decode($stdProduct->description);
$stdProduct->title = utf8_decode($stdProduct->title);
$stdProduct->content = utf8_decode($stdProduct->content);
$common_tpl_data = array("###IMG_TPL_PATH###", "###content###", "###title###", "###PRODUCT_URI###", "###recover_logo###");
$common_data = array($tpl_img_path, $stdProduct->content, $stdProduct->title, Config::getRootPath('produto/id.' . $stdProduct->id . '/' . $stdProduct->slug), $recover_logo);
$detail_page = str_replace($common_tpl_data, $common_data, $detail_page);
$image_page = str_replace($common_tpl_data, $common_data, $image_page);
$dimension_page = str_replace($common_tpl_data, $common_data, $dimension_page);
$detail_page = str_replace("###description###", $stdProduct->description, $detail_page);
$html = $html_start . $detail_page;
foreach ($stdProduct->array_gallery as $image) {
$w = 600;
$h = 550;
$img_url = "image/get_image/image_id." . $image->id . "/max_width.{$w}/max_height.{$h}/";
// Debug::print_r( $img_url ) ;
// $tmp = file_get_contents( $img_url ) ;
// unset( $tmp ) ;
// $new_page = str_replace( "###IMAGE_SRC###" , Config::getRootPath( "image/get_image/image_id." . $image->id . "/max_width.600/max_height.525/" ) , $image_page ) ;
// $new_page = str_replace( "###IMAGE_SRC###" , $image->url , $image_page ) ;
$img_name = preg_replace("/\\.jpg\$/", "", $image->url);
// $sys_img = $img_name . "_w{$w}_h{$h}_m_no_crop.jpg" ;
$sys_img = $img_name . "_w{$w}_h{$h}_m_cache_crop.jpg";
// Debug::print_r($sys_img ) ;
// var_dump( file_exists($sys_img) ) ;
// die;
$new_page = str_replace("###IMAGE_SRC###", $sys_img, $image_page);
// Debug::print_r( $image ) ; die;
$html .= $new_page;
// break;
}
$html .= $html_end;
// echo $html ; die;
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
//$dompdf->stream( "upload/pdf/" . $stdProduct->id . "/" . $stdProduct->slug . ".pdf") ;
$file = $stdProduct->slug . ".pdf";
$path = "upload/pdf/" . $stdProduct->id . "/";
if (!dir($path)) {
mkdir($path, 0777, true);
}
$html_file = "print.html";
$html = str_replace("src=\"", "src=\"" . Config::getRootPath(), $html);
$fp = fopen($path . $html_file, "w");
fwrite($fp, $html);
fclose($fp);
$pdfoutput = $dompdf->output();
// $filename = $output;
$fp = fopen($path . $file, "w");
fwrite($fp, $pdfoutput);
fclose($fp);
return true;
} else {
//não achou um produto com esse id
return false;
Navigation::redirect("");
}
} else {
return false;
//não mandou o id, vai pra listagem ((!?) TODO: ver se é isso mesmo)
Navigation::redirect("clientes");
}
}
示例13: addFilter
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} ";
}
}
示例14: addFilter
private function addFilter(&$query, $id, $active, $state_id, $state, $country, $alias, $street, $number)
{
if ($id !== NULL) {
$query .= " AND id = '" . DataHandler::forceInt($id) . "'";
}
if ($active !== NULL) {
$query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
}
if ($state_id !== NULL) {
$query .= " AND `state_id` = '" . DataHandler::forceInt($state_id) . "'";
}
if ($state !== NULL) {
$query .= " AND `state` = '" . DataHandler::forceString($state) . "'";
}
if ($country !== NULL) {
$query .= " AND `country` = '" . DataHandler::forceString($country) . "'";
}
if ($alias !== NULL) {
$query .= " AND `alias` = '" . DataHandler::forceString($alias) . "'";
}
if ($street !== NULL) {
$query .= " AND `street` = '" . DataHandler::forceString($street) . "'";
}
if ($number !== NULL) {
$query .= " AND `number` = '" . DataHandler::forceString($number) . "'";
}
//adiciona a ordenação na query
}
示例15: setActive
public function setActive($int)
{
$this->active = DataHandler::forceInt($int);
}