var app = angular.module("pagingtable",['bw.paging']); app.controller('activityTableCtrl', function($scope, $http, $interval, $location, $timeout, $rootScope) { $scope.currentPage = 1; $scope.totalItems = 0; $scope.pa = 10; $scope.counter = '0'; var paused; $scope.pageSize = 10; $scope.searchText = ''; $scope.izla = 'write product name'; getData(); $scope.menu = function(id) { location.href = id; }; $scope.nn = false; var bosh = "0"; $scope.vr = bosh; var timer; $scope.counter = "1745069917"; var updateCounter = function() { $scope.counter++; timer = $timeout(updateCounter, 1000); var tugash = $scope.counter; if(bosh < tugash){ $scope.form_data = {}; $scope.clasga = 'show ius'; $scope.nn = true; $scope.bloq = {'overflow': 'hidden'}; } else { $scope.clasga = ''; $scope.nn = false; $scope.bloq = ''; } }; updateCounter(); $scope.pinForm = function(){ $http({ method:"POST", url:"/ajax/json/index.php?e=ping", data:{'id':$scope.pa} }).success(function(data){ console.log(data); if(data.ping == '1'){ location.href = location.href; $scope.vr = data.time; $scope.clasga = ''; $scope.nn = false; $scope.bloq = ''; } }); };function getData() { $http.get('/ajax/json/err.php?page=' + $scope.currentPage + '&size=' + $scope.pageSize + '&url=' + $scope.mc + '&search=' + $scope.searchText + '&im=' + $scope.im) .success(function(data) { $scope.title = data.title; $scope.korzinka = data.korzinka; $scope.activity = []; $scope.totalItems = data.totalCount; $scope.startItem = ($scope.currentPage - 1) * $scope.pageSize + 1; $scope.endItem = $scope.currentPage * $scope.pageSize; if ($scope.endItem > $scope.totalCount) {$scope.endItem = $scope.totalCount;} angular.forEach(data.Biodata, function(temp){ $scope.activity.push(temp); }); }); } $scope.menu = function(id){ location.href = id; }; $scope.countdown = function() { paused = $timeout(function() { $scope.counter--; if($scope.counter <= '0'){ $scope.qa = 'Повторная отправка'; }else{ $scope.qa = 'Секун: ' + $scope.counter; $scope.see = $scope.counter; } $scope.countdown(); }, 1000); }; $scope.counter; $scope.countdown(); $scope.qayta = function(t){ $http({ method:"POST", url:"/ajax/json/err.php?e=edit", data:{'login':t} }).success(function(data){ location.replace('/reg'); }); }; $scope.tikla = function(t, user){ $http({ method:"POST", url:"/ajax/json/err.php?e=tikla", data:{'login':t, 'id':user} }).success(function(data){ location.replace('/pass'); }); }; $scope.pageChanged = function(text, page, pageSize, total) { $scope.currentPage = page; getData(); } $scope.pageSizeChanged = function() { $scope.currentPage = 1; getData(); } $scope.searchTextChanged = function() { $scope.currentPage = 1; getData(); } $scope.openModal = function(){ var modal_popup = angular.element('#crudmodal'); modal_popup.modal('show'); }; $scope.closeModal = function(){ var modal_popup = angular.element('#crudmodal'); modal_popup.modal('hide'); }; });