Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.74 KB | None | 0 0
  1. $limite = "9";
  2.  
  3. $result_fotos = $conexao->prepare("SELECT * FROM estabelecimentos WHERE slug = :slug ");
  4. $result_fotos->bindValue(':slug', $_GET['slug'], PDO::PARAM_STR);
  5. $result_fotos->execute();
  6. $row_fotos = $result_fotos->fetch(PDO::FETCH_OBJ);
  7.  
  8. $result_limite = $conexao->prepare("SELECT * FROM estabelecimentos_anexos WHERE id_mae = :id_mae AND seccao = :seccao ");
  9. $result_limite->bindParam(':id_mae', $row_fotos->id, PDO::PARAM_INT);
  10. $result_limite->bindValue(':seccao', 'fotos', PDO::PARAM_STR);
  11. $result_limite->execute();
  12. $row_limite = $result_limite->fetch(PDO::FETCH_ASSOC);
  13.  
  14. $result_anex_fotos = $conexao->prepare("SELECT * FROM estabelecimentos_anexos WHERE id_mae = :id_mae AND seccao = :seccao LIMIT 9");
  15. $result_anex_fotos->bindParam(':id_mae', $row_fotos->id, PDO::PARAM_INT);
  16. $result_anex_fotos->bindValue(':seccao', 'fotos', PDO::PARAM_STR);
  17. $result_anex_fotos->execute();
  18. $fotos_perfil = $result_anex_fotos->fetchAll(PDO::FETCH_OBJ);
  19.  
  20. $fotos_maior_valida = $result_limite->rowCount() - $result_anex_fotos->rowCount();
  21.  
  22. foreach ($fotos_perfil as $row_anex_fotos) {
  23.  
  24. $fotos .= '
  25.  
  26. <div style="margin:0px 0px 0px -5px;">
  27. <div style="margin-left:5px; float:left">
  28. <a href=""><img width="50" height="50" style"border-radius:10px;" src="https://www.sabeonde.pt/gtm/php/timthumb.php?src=gtm/anexos/fotos/'.$row_anex_fotos->id_anexo.'.'.$row_anex_fotos->tipo.'" alt="'.$row_anex_fotos->titulo.'&h=114&w=114&a=c" /></a>
  29. </div>
  30. </div>
  31.  
  32. ';
  33. }
  34.  
  35. if($result_anex_fotos->rowCount() == 9 ){
  36.  
  37. $fotos_maior = '
  38.  
  39. <div style="float: left;" ng-click="fotos()" ng-controller="ModalFotos" class="caixa_limite">+'.$fotos_maior_valida.'</div>
  40.  
  41. ';
  42.  
  43. }
  44.  
  45.  
  46. $return = '
  47.  
  48. <div class="card">
  49. <div class="item item-text-wrap">
  50. <h2 style="margin:0px 0px 10px 0px;">Fotos</h2>
  51. '.$fotos.'
  52. '.$fotos_maior.'
  53. <div style="float: left; margin:0px 0px 20px 5px;" class="caixa_limite"><i style="font-size: xx-large;" class="ion-camera"></i></div>
  54. </div>
  55. </div>
  56.  
  57. ';
  58.  
  59. echo json_encode($return);
  60.  
  61. .controller('VerFotosEstabelecimento', function($scope, $http, $stateParams) {
  62. $http.get("https://www.sabeonde.pt/api/api_ver_fotos_estabelecimento.php?slug="+$stateParams.EstabelecimentoSlug).success(function (data) {
  63. $scope.ver_fotos_estabelecimento = data;
  64. });
  65. })
  66.  
  67. .controller('ModalFotos', function($scope, $ionicModal, $timeout) {
  68.  
  69. // Create the login modal that we will use later
  70. $ionicModal.fromTemplateUrl('templates/fotos-modal.html', {
  71. scope: $scope
  72. }).then(function(modal) {
  73. $scope.modal = modal;
  74. });
  75.  
  76. // Triggered in the login modal to close it
  77. $scope.closeLogin = function() {
  78. $scope.modal.hide();
  79. };
  80.  
  81. // Open the login modal
  82. $scope.fotos = function() {
  83. $scope.modal.show();
  84. console.log();
  85. };
  86.  
  87. })
  88.  
  89. app.controller("AppController", function($scope) {
  90. $scope.olaMundo = function(msg){
  91. alert(msg);
  92. };
  93. });
  94.  
  95. echo "<script>" +
  96. "var $scopeApp = angular.element('[ng-controller='AppController']').scope();" +
  97. "$scopeApp.olaMundo('Caba não mundão!!!');" +
  98. "</script>";
  99.  
  100. echo "<script>" +
  101. "var $scopeApp = angular.element('[ng-controller='ModalFotos']').scope();" +
  102. "$scopeApp.fotos();" +
  103. "</script>";
  104.  
  105. if($result_anex_fotos->rowCount() == 9 ){
  106. $fotos_maior = '
  107. <div style="float: left;" ng-click="fotos()" ng-controller="ModalFotos" class="caixa_limite">+'.$fotos_maior_valida.'</div>
  108. <script>
  109. var $scopeApp = angular.element("[ng-controller=' + "'" + ModalFotos + "'" + ']").scope();
  110. $scopeApp.fotos();
  111. </script>;
  112. ';
  113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement