예제 #1
0
파일: User.php 프로젝트: reytuty/facil
 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
0
 /**
  * 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
0
파일: Page.php 프로젝트: reytuty/facil
 /**
  * @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
0
 /**
  * @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
0
파일: Client.php 프로젝트: reytuty/facil
 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
0
파일: Attribute.php 프로젝트: reytuty/facil
 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
0
파일: File.php 프로젝트: reytuty/facil
 /**
  * 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
0
파일: Category.php 프로젝트: reytuty/facil
 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
0
 /**
  *
  * @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
0
파일: Image.php 프로젝트: reytuty/facil
 /**
  * /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
0
파일: FacilFile.php 프로젝트: reytuty/facil
 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
0
 /**
  * 
  * 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
0
 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
0
 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
0
 public function setActive($int)
 {
     $this->active = DataHandler::forceInt($int);
 }
예제 #16
0
 public function select($typeOfReturn = NULL, $id = NULL, $active = NULL, $name = NULL, $url = NULL, $author = NULL, $order_type = DbInterface::ORDER_ASC, $quant_limit = NULL, $quant_started = NULL)
 {
     $typeOfReturn = $typeOfReturn === NULL ? NULL : $typeOfReturn;
     $order_type = parent::verifyOrderType($order_type);
     //echo "login[".$login."] - password[".$password."]";
     $arrayFilter = array();
     $query = "SELECT * FROM `image` WHERE 1";
     if ($id !== NULL) {
         $query .= " AND `id` = '" . DataHandler::forceInt($id) . "'";
     }
     if ($active !== NULL) {
         $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
     }
     if ($name !== NULL) {
         $query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
     }
     if ($url !== NULL) {
         $query .= " AND `url` = '" . DataHandler::forceString($url) . "'";
     }
     if ($author !== NULL) {
         $query .= " AND `author` = '" . DataHandler::forceString($author) . "'";
     }
     //limite
     $query .= parent::limit($quant_limit, $quant_started);
     $query .= " ORDER BY `order` {$order_type} ";
     //executa a query
     $ReturnDataVO = parent::query($query);
     //verifica se conseguiu ocorreu tudo certo
     if ($ReturnDataVO->success) {
         switch ($typeOfReturn) {
             case DbInterface::RETURN_ARRAY:
                 $ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_ARRAY);
                 break;
             case DbInterface::RETURN_VO:
                 $ReturnDataVO->fetchAllVO($this);
                 break;
             case DbInterface::RETURN_STD_OBJECT:
             default:
                 //retornar tudo em objeto
                 $ReturnDataVO->fetchAll(ReturnDataVO::TYPE_FETCH_OBJECT);
                 break;
         }
         return $ReturnDataVO;
     } else {
         return $ReturnDataVO;
     }
 }
예제 #17
0
 private function addFilter(&$query, $id, $active, $table, $table_id, $user_id, $title, $description, $date, $symble_date, $order_type)
 {
     if ($id > 0) {
         $query .= " AND id = '" . DataHandler::forceInt($id) . "'";
     }
     if ($active !== NULL) {
         $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
     }
     if ($table !== NULL) {
         $query .= " AND `table` = '" . DataHandler::forceString($table) . "'";
     }
     if ($table_id > 0) {
         $query .= " AND `table_id` = '" . DataHandler::forceInt($table_id) . "'";
     }
     if ($user_id > 0) {
         $query .= " AND `user_id` = '" . DataHandler::forceInt($user_id) . "'";
     }
     if ($title !== NULL) {
         $query .= " AND `title` = '" . DataHandler::forceString($title) . "'";
     }
     if ($description !== NULL) {
         $query .= " AND `description` = '" . DataHandler::forceString($description) . "'";
     }
     if ($date !== NULL) {
         $symble_date = parent::compareSimble($symble_date);
         $date = parent::dateHandlerScape($date);
         $query .= " AND `date` {$symble_date} {$date} ";
     }
     //adiciona a ordenação na query
     $orderBy = "";
     if ($order_type != NULL) {
         $order_type = parent::verifyOrderType($order_type);
         $orderBy .= ", `order` " . $order_type;
     }
     if ($orderBy != NULL) {
         $query .= " ORDER BY " . $orderBy;
     }
     $query .= "ORDER BY date DESC";
 }
예제 #18
0
파일: Category.php 프로젝트: reytuty/facil
 public function commit()
 {
     //iniciando o retorno padrao
     $HttpReturnResult = new HttpResult();
     $CategoryVO = new CategoryVO();
     if (!isset($_POST["category_id"]) || $_POST["category_id"] == NULL) {
         $_POST["category_id"] = 2;
     }
     $_POST["active"] = 1;
     $CategoryVO->setFetchArray($_POST);
     $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
     if ($id > 0) {
         $CategoryVO->setId($id);
     }
     $ResultValidate = $CategoryVO->validate();
     $resultPage = new DefaultPage();
     //Debug::print_r($ResultValidate); exit();
     if ($ResultValidate->success) {
         $ReturnResult = $CategoryVO->commit();
         //Debug::print_r($ReturnResult);exit();
         if ($ReturnResult->success) {
             Navigation::redirect("backend/category/show");
         } else {
             $resultPage->returnResult = $ReturnResult;
         }
     } else {
         $resultPage->returnResult = $ResultValidate;
     }
     $HttpReturnResult->setHttpContentResult($resultPage);
     return $HttpReturnResult;
 }
예제 #19
0
 /**
  * @param $user_type_id (int)
  * @return void
  */
 public function setUserTypeId($user_type_id)
 {
     if ($user_type_id !== NULL) {
         $this->user_type_id = DataHandler::forceInt($user_type_id);
     }
 }
예제 #20
0
파일: Client.php 프로젝트: reytuty/facil
 /**
  * 
  * Usar: backend/client/delete_image/id.N/type.TYPE/
  */
 public function deleteImage()
 {
     $ReturnResultVO = new ReturnResultVO();
     $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
     $product_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "product_id"));
     $galleryType = $this->getGalleryType();
     if ($id > 0) {
         $LinkDAO = new LinkDAO();
         $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId($galleryType, $id);
         $ReturnResultVO->success = $ReturnDataVO->success;
         //n√£o est√° tratando o tipo de erro
     } else {
         $ReturnResultVO->addMessage(Translation::text("id?"));
     }
     $this->updatePdf($product_id);
     Navigation::redirect("backend/client/gallery/type.{$galleryType}/id.{$product_id}/#listview");
     exit;
 }
예제 #21
0
 private function addFilter(&$query, $id, $active, $category_id, $name, $slug, $order_type)
 {
     if ($id !== NULL) {
         $query .= " AND id = '" . DataHandler::forceInt($id) . "'";
     }
     if ($active !== NULL) {
         $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
     }
     if ($category_id !== NULL) {
         $query .= " AND `category_id` = '" . DataHandler::forceInt($category_id) . "'";
     }
     if ($name !== NULL) {
         $query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
     }
     if ($slug !== NULL) {
         $query .= " AND `slug` = '" . DataHandler::forceString($slug) . "'";
     }
     //adiciona a ordenação na query
     $orderBy = "";
     if ($order_type != NULL) {
         $order_type = parent::verifyOrderType($order_type);
         $orderBy .= " `order` " . $order_type;
     }
     if ($orderBy != NULL) {
         $query .= " ORDER BY " . $orderBy;
     }
 }
예제 #22
0
 private function addFilter(&$query, $id, $active, $name, $language_code, $code)
 {
     if ($id !== NULL) {
         $query .= " AND id = '" . DataHandler::forceInt($id) . "'";
     }
     if ($active !== NULL) {
         $query .= " AND `active` = '" . DataHandler::forceInt($active) . "'";
     }
     if ($language_code !== NULL) {
         $query .= " AND `language_code` = '" . DataHandler::forceString($language_code) . "'";
     }
     if ($code !== NULL) {
         $query .= " AND `code` = '" . DataHandler::forceString($code) . "'";
     }
     if ($name !== NULL) {
         $query .= " AND `name` = '" . DataHandler::forceString($name) . "'";
     }
 }
예제 #23
0
 /**
  * @param $int (int)
  * @return void
  */
 public function setInt($int)
 {
     if ($int !== NULL) {
         $this->int = DataHandler::forceInt($int);
     }
 }
예제 #24
0
 private function consultValues()
 {
     $ProductModelQuadroDAO = ProductModelQuadroDAO::getInstance();
     $this->MaterialDAO = MaterialDAO::getInstance();
     $this->ColorDAO = ColorDAO::getInstance();
     $this->StyleDAO = StyleDAO::getInstance();
     $this->FormatDAO = FormatDAO::getInstance();
     $this->ThemeDAO = ThemeDAO::getInstance();
     $this->CompositionDAO = CompositionDAO::getInstance();
     $this->TechniqueDAO = TechniqueDAO::getInstance();
     $this->TypeDAO = TypeDAO::getInstance();
     //fazendo o que precisa fazer para ter os dados do menu
     $this->arrayMaterial = $this->MaterialDAO->select(MaterialDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayMaterial);
     $this->arrayColor = $this->ColorDAO->select(ColorDAO::RETURN_VO, NULL, 1);
     // $this->addTotal($this->arrayColor);
     //Debug::print_r($this->arrayColor);
     //busca as imagens
     if ($this->arrayColor->success) {
         $tempVO = array();
         foreach ($this->arrayColor->result as $ColorVO) {
             $tempStdColor = $ColorVO->toStdClass();
             //primeira letra maiuscula
             $tempStdColor->name = ucfirst($tempStdColor->name);
             $tempVO[] = $tempStdColor;
             //Debug::print_r($tempVO);
         }
         $this->arrayColor->result = $tempVO;
     }
     $this->arrayStyle = $this->StyleDAO->select(StyleDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayStyle);
     $this->arrayFormat = $this->FormatDAO->select(FormatDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayFormat);
     $this->arrayTheme = $this->ThemeDAO->select(ThemeDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayTheme);
     $this->arrayComposition = $this->CompositionDAO->select(CompositionDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayComposition);
     $this->arrayTechnique = $this->TechniqueDAO->select(TechniqueDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayTechnique);
     $this->arrayType = $this->TypeDAO->select(TypeDAO::RETURN_VO, NULL, 1);
     $this->addTotal($this->arrayType);
     //define a base da url
     $this->url_final = Config::getRootPath("quadros/filter");
     $this->arrayBreadCrumb = array();
     if ($this->arrayVariable != NULL) {
         $temp_array = array_splice($this->arrayRestFolder, 2, count($this->arrayRestFolder) - 1);
         //Debug::print_r($temp_array);
         //exit();
         if ($this->arrayRestFolder[1] == "filter") {
             $this->url_final .= "/" . implode("/", $temp_array);
             //tirando a página da url final
             $this->url_final = preg_replace("/\\/pag\\.[0-9]+?/", "", $this->url_final);
         }
         $array_relacao_variavel_resultado = array();
         $array_relacao_variavel_resultado["search"] = "requestSearch";
         $array_relacao_variavel_resultado["material"] = "requestMaterial";
         $array_relacao_variavel_resultado["color"] = "requestColor";
         $array_relacao_variavel_resultado["style"] = "requestStyle";
         $array_relacao_variavel_resultado["format"] = "requestFormat";
         $array_relacao_variavel_resultado["theme"] = "requestTheme";
         $array_relacao_variavel_resultado["composition"] = "requestComposition";
         $array_relacao_variavel_resultado["technique"] = "requestTechnique";
         $array_relacao_variavel_resultado["type"] = "requestType";
         $array_relacao_variavel_resultado["promocoes"] = "requestPromocao";
         foreach ($this->arrayVariable as $variable => $value) {
             if ($variable == "search" && DataHandler::forceString($value) != NULL) {
                 $this->requestResumeSearch = DataHandler::forceString(urldecode($value));
                 if (strlen($this->requestResumeSearch) > 10) {
                     $this->requestResumeSearch = substr($this->requestResumeSearch, 0, 10) . "...";
                 }
             }
             if (DataHandler::forceInt($value) > 0) {
                 if (isset($array_relacao_variavel_resultado[$variable]) && $array_relacao_variavel_resultado[$variable] != null) {
                     $this->{$array_relacao_variavel_resultado}[$variable] = DataHandler::forceInt(trim($value));
                 }
             } else {
                 //se não nenhum desses itens segnifica q é sujeira por isso não grava na url
                 continue;
             }
             //popula o bread crumb de maneira incompleta pois seria esforço a toa procurar o título aqui
             $this->arrayBreadCrumb[] = new BreadCrumbInfoVO("", $variable, $value);
             //concatena as veriaveis ja enviadas para fazer a base do link
             //$this->url_final .= "/".$variable.".".$value;
         }
     }
 }
예제 #25
0
 /**
  * @return void da echo de string
  */
 public function link()
 {
     $LinkDAO = LinkDAO::getInstance();
     if (FALSE) {
         $LinkDAO = new LinkDAO();
     }
     $ReturnResultVO = new ReturnResultVO();
     $ReturnResultVO->success = TRUE;
     //enviar por post:
     //category_id
     //array_content_id
     if (DataHandler::getValueByArrayIndex($_POST, "category_id") && DataHandler::getValueByArrayIndex($_POST, "array_content_id")) {
         $category_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($_POST, "category_id"));
         //talvez não seja array
         $array_content_id = DataHandler::getValueByArrayIndex($_POST, "array_content_id");
         $table = DataHandler::getValueByArrayIndex($_POST, "table");
         $linked_table = DataHandler::getValueByArrayIndex($_POST, "linked_table");
         if (!is_array($array_content_id)) {
             $array_content_id = explode(",", $array_content_id);
         }
         if (is_array($array_content_id)) {
             $contador = 0;
             foreach ($array_content_id as $content_id) {
                 //inicia a linkVO se existir
                 $ReturnDataVO = $LinkDAO->select(LinkDAO::RETURN_VO, $table, $category_id, $linked_table, $content_id, 1);
                 if (FALSE) {
                     $ReturnDataVO = new ReturnDataVO();
                 }
                 if ($ReturnDataVO->success) {
                     $arrayResults = $ReturnDataVO->result;
                     if ($ReturnDataVO->count_total > 0) {
                         //pega só o primeiro, mas se tiver mais do que 1 poderia dar um warning
                         if ($ReturnDataVO->count_total > 1) {
                             //warning, deveria ter só 1
                         }
                         $LinkVO = $arrayResults[0];
                         //para ajuda do aptana
                         if (FALSE) {
                             $LinkVO = new LinkVO();
                         }
                         $LinkVO->setOrder($contador);
                         $ReturnDataVO = $LinkDAO->update($LinkVO->getId(), $LinkVO->getActive(), $LinkVO->getTable(), $LinkVO->getTableId(), $LinkVO->getLinkedTable(), $LinkVO->getLinkedTableId(), $LinkVO->getOrder());
                         if (!$ReturnDataVO->success) {
                             $ReturnResultVO->success = FALSE;
                             $ReturnResultVO->addMessage("erro ao atualizar o item de id:" . $LinkVO->getLinkedTableId());
                         }
                         $contador++;
                     }
                 }
             }
             //end foreach
         } else {
             $ReturnResultVO->success = FALSE;
             $ReturnResultVO->addMessage("Enviar content_id por POST em array");
         }
         //end if array
     } else {
         $ReturnResultVO->success = FALSE;
         $ReturnResultVO->addMessage("Enviar por POST category_id e array_content_id.");
     }
     //end if foi enviado posts
     if ($ReturnResultVO->success) {
         $ReturnResultVO->addMessage("Ordem definida com sucesso.");
     }
     echo $ReturnResultVO->toJson();
     exit;
 }
예제 #26
0
 /**
  * @param $state_id (int)
  * @return void
  */
 public function setStateId($state_id)
 {
     if ($state_id !== NULL) {
         $this->state_id = DataHandler::forceInt($state_id);
     }
 }
예제 #27
0
 /**
  * @param $order
  * 
  */
 public function setOrder($order)
 {
     $this->order = DataHandler::forceInt($order);
 }
예제 #28
0
파일: Equipe.php 프로젝트: reytuty/facil
 /**
  * 
  * Usar: backend/product/delete_file/id.N/type.TYPE/
  */
 public function deleteFile()
 {
     $ReturnResultVO = new ReturnResultVO();
     $id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "id"));
     $product_id = DataHandler::forceInt(DataHandler::getValueByArrayIndex($this->arrayVariable, "product_id"));
     if ($id > 0) {
         $LinkDAO = new LinkDAO();
         $ReturnDataVO = $LinkDAO->deleteAllFromLinkedTableAndLinkedTableId("file", $id);
         $ReturnResultVO->success = $ReturnDataVO->success;
         //n√£o est√° tratando o tipo de erro
     } else {
         $ReturnResultVO->addMessage(Translation::text("id?"));
     }
     Navigation::redirect("backend/product/file/id.{$product_id}/");
     //echo $ReturnResultVO->toJson();
     exit;
 }
예제 #29
0
 /**
  * para adicionar ou atualizar parametros a uma tabela
  * 
  * @param $type
  * @param $value
  * @param $t_id
  * @param $active
  * @return void
  */
 public function addParamethers($type = NULL, $value = NULL, $t_id = "insert", $active = NULL)
 {
     //se passar o t_id indica que está editando um parametro já existente
     //criando a array a ser inserida - usado como se fosse um mini VO
     $this->startParametherDAO();
     $ParametherVO = $this->ParametherDAO->getItemParametherVO();
     $ParametherVO->setStatus($t_id == "insert" || $t_id == NULL ? ParametherDAO::STATUS_INSERT : ParametherDAO::STATUS_UPDATE);
     $ParametherVO->setType($type);
     $ParametherVO->setValueByType($ParametherVO->getType(), $value);
     $ParametherVO->setTableId($this->id);
     $ParametherVO->setTable($this->__table);
     $ParametherVO->setActive($active);
     //verifica se deve c a array de parameter
     if ($this->id > 0) {
         //se já tem id é pq é um dado já cadastrado
         $this->getParamethers();
     }
     //se não tem, então vai adicionar só os terms novos
     if (!count($this->__arrayParamethers) > 0) {
         //iniciando a array para demonstrar que já buscou ou tentou buscar
         $this->__arrayParamethers = array();
     }
     $t_id = DataHandler::forceInt($t_id);
     if ($t_id > 0) {
         $ParametherVO->setId($t_id);
     }
     $this->updateParamether($ParametherVO);
     //else {
     //push/
     //echo "<li>adicionando".var_dump($ParametherVO)."</li>";
     //$this->__arrayParamethers[] = $ParametherVO;
     //}
     //s vai realmente adicionar quando for chamado o metodo cadastrar()
 }
예제 #30
0
 private function addFilter(&$query, $id, $active, $name, $title, $hat, $description, $content, $author, $template_url, $slug, $key_words, $date, $date_symbol, $date_in, $date_in_symbol, $date_out, $date_out_symbol, $order_type)
 {
     if ($id !== NULL) {
         $query .= " AND `content`.id = '" . DataHandler::forceInt($id) . "'";
     }
     if ($active !== NULL) {
         $query .= " AND `content`.active = '" . DataHandler::forceInt($active) . "'";
     }
     if ($name !== NULL) {
         $query .= " AND `content`.name = '" . DataHandler::forceString($name) . "'";
     }
     if ($title !== NULL) {
         $query .= " AND `content`.title = '" . DataHandler::forceString($title) . "'";
     }
     if ($hat !== NULL) {
         $query .= " AND `content`.hat = '" . DataHandler::forceString($hat) . "'";
     }
     if ($description !== NULL) {
         $query .= " AND `content`.description = '" . DataHandler::forceString($description) . "'";
     }
     if ($content !== NULL) {
         $query .= " AND `content`.content = '" . DataHandler::forceString($content) . "'";
     }
     if ($author !== NULL) {
         $query .= " AND `content`.author = '" . DataHandler::forceString($author) . "'";
     }
     if ($template_url !== NULL) {
         $query .= " AND `content`.template_url = '" . DataHandler::removeSpecialCharacters($template_url) . "'";
     }
     if ($slug !== NULL) {
         $query .= " AND `content`.slug = '" . DataHandler::removeSpecialCharacters($slug) . "'";
     }
     if ($key_words !== NULL) {
         $query .= " AND `content`.key_words = '" . DataHandler::removeSpecialCharacters($key_words) . "'";
     }
     if ($date !== NULL) {
         $date_symbol = parent::compareSimble($date_symbol);
         $date = parent::dateHandlerScape($date);
         $query .= " AND `date` {$date_symbol} {$date} ";
     }
     if ($date_in !== NULL) {
         $date_in_symbol = parent::compareSimble($date_in_symbol);
         $date_in = parent::dateHandlerScape($date_in);
         $query .= " AND `date_in` {$date_in_symbol} {$date_in} ";
     }
     if ($date_out !== NULL) {
         $date_out_symbol = parent::compareSimble($date_out_symbol);
         $date_out = parent::dateHandlerScape($date_out);
         $query .= " AND `date_out` {$date_out_symbol} {$date_out} ";
     }
     //adiciona a ordenação na query
     $orderBy = "";
     if ($order_type != NULL) {
         $order_type = parent::verifyOrderType($order_type);
         $orderBy .= ", `order` " . $order_type;
     }
     if ($orderBy != NULL) {
         $query .= " ORDER BY " . $orderBy;
     }
 }