This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once '../includes/db.php'; // The mysql database connection script | |
$status = '%'; | |
if(isset($_GET['status'])){ | |
$status = $_GET['status']; | |
} | |
$query="select ID, TASK, STATUS from tasks where status like '$status' order by status,id desc"; | |
$result = $mysqli->query($query) or die($mysqli->error.__LINE__); | |
$arr = array(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Define an angular module for our app | |
var app = angular.module('myApp', []); | |
app.controller('tasksController', function($scope, $http) { | |
getTask(); // Load all available tasks | |
function getTask(){ | |
$http.post("ajax/getTask.php").success(function(data){ | |
$scope.tasks = data; | |
}); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once '../includes/db.php'; // The mysql database connection script | |
if(isset($_GET['task'])){ | |
$task = $_GET['task']; | |
$status = "0"; | |
$created = time(); | |
$query="INSERT INTO tasks(task,status,created_at) VALUES ('$task', '$status', '$created')"; | |
$result = $mysqli->query($query) or die($mysqli->error.__LINE__); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body{ | |
font-family: 'Open Sans', sans-serif; | |
} | |
a { | |
color: #E1704B; | |
transition: color 0.5s ease; | |
} | |
a:hover{ | |
cursor:pointer; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$DB_HOST = '127.0.0.1'; | |
$DB_USER = 'root'; | |
$DB_PASS = ''; | |
$DB_NAME = 'angularcode_task'; | |
$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="widget-box" id="recent-box" ng-controller="tasksController"> | |
<div class="widget-header header-color-blue"> | |
<div class="row"> | |
<div class="col-sm-6"> | |
<h4 class="bigger lighter"> | |
<i class="glyphicon glyphicon-align-justify"></i> | |
TASK MANAGER | |
</h4> | |
</div> | |
<div class="col-sm-3"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html ng-app="myApp"> | |
<head> | |
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"/> | |
<link rel="stylesheet" type="text/css" href="css/taskman.css"/> | |
<link href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,300,700" rel="stylesheet" type="text/css"> | |
</head> | |
<body ng-controller="tasksController"> | |
<div class="navbar navbar-default" id="navbar"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE DATABASE IF NOT EXISTS angularcode_task; | |
USE angularcode_task; | |
-- | |
-- Table structure for table `tasks` | |
-- | |
CREATE TABLE IF NOT EXISTS `tasks` ( | |
`id` int(11) NOT NULL AUTO_INCREMENT, | |
`task` varchar(200) NOT NULL, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include('../includes/config.php'); | |
$id = $_GET['id']; | |
$votes = $_GET['votes']; | |
$query="update posts set votes='$votes' where id='$id'"; | |
$result = $mysqli->query($query) or die($mysqli->error.__LINE__); | |
// $affected = $mysqli->affected_rows; | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var app = angular.module('myApp',[]); | |
app.controller('votingCtrl', function($scope, $http) { | |
$http.post('ajax/getPosts.php').success(function(data){ | |
$scope.posts = data; | |
}); | |
$scope.upVote = function(post){ | |
post.votes++; | |
updateVote(post.id,post.votes); | |
}; | |
$scope.downVote = function(post){ |