diff options
author | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-03-01 20:16:03 +0100 |
---|---|---|
committer | Hannes "Brolaugh" Kindströmmer <me@brolaugh.com> | 2016-03-01 20:16:03 +0100 |
commit | 0d88e39478ab71e48e309ab5191f6aeb527cc82e (patch) | |
tree | 9f3f8d107de140f07120bd7971096da72847d044 | |
parent | 455d64936e4715928e1e65b6d3b5a313e8c13f6d (diff) | |
download | tasklist-php-0d88e39478ab71e48e309ab5191f6aeb527cc82e.zip tasklist-php-0d88e39478ab71e48e309ab5191f6aeb527cc82e.tar.gz tasklist-php-0d88e39478ab71e48e309ab5191f6aeb527cc82e.tar.bz2 |
Status change options/visuals are now based on database
Signed-off-by: Hannes "Brolaugh" Kindströmmer <me@brolaugh.com>
-rw-r--r-- | App/database/Select.php | 13 | ||||
-rw-r--r-- | App/pages/dashboard.php | 23 |
2 files changed, 27 insertions, 9 deletions
diff --git a/App/database/Select.php b/App/database/Select.php index eebc585..bdc284c 100644 --- a/App/database/Select.php +++ b/App/database/Select.php @@ -54,7 +54,7 @@ class Select extends dbSetup } /** - * @return array + * @return object array */ public function getAllTasksWithStatus(){ $stmt = $this->getDb()->prepare("SELECT * FROM task_with_status"); @@ -67,4 +67,15 @@ class Select extends dbSetup $stmt->close(); return $a; } + public function getAllStatusLevels(){ + $stmt = $this->getDb()->prepare("SELECT * FROM status_level"); + $stmt->execute(); + $res = $stmt->get_result(); + $a = array(); + while($row = $res->fetch_object()){ + array_push($a, $row); + } + $stmt->close(); + return $a; + } } diff --git a/App/pages/dashboard.php b/App/pages/dashboard.php index a38e1a6..7342f74 100644 --- a/App/pages/dashboard.php +++ b/App/pages/dashboard.php @@ -68,26 +68,33 @@ <?php $s = new \App\database\Select(); $t = $s->getAllTasksWithStatus(); + $status_level = $s->getAllStatusLevels(); foreach($t as $task){ ?> <div class="well well-xs"> <h3> <span class="pull-left"><?php echo $task->title; ?></span> <div class="btn-group pull-right"> - <a href="javascript:void(0)" class="btn btn-default btn-raised"><?php echo $task->level; ?></a> - <a href="bootstrap-elements.html" data-target="#" class="btn btn-default btn-raised dropdown-toggle" + <a href="javascript:void(0)" class="btn btn-<?php echo $task->style_class;?> btn-raised"><?php echo $task->level; ?></a> + <a href="bootstrap-elements.html" data-target="#" class="btn btn-<?php echo $task->style_class;?> btn-raised dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></a> <ul class="dropdown-menu"> - <li><a href="javascript:void(0)"><span class="text-danger">PRIO #1</span></a></li> - <li><a href="javascript:void(0)"><span class="text-success">Klar</span></a></li> - <li><a href="javascript:void(0)"><span class="text-info">Under konstruktion</span></a></li> - <li class="divider"></li> - <li><a href="javascript:void(0)">Separated link</a></li> + + <?php + foreach($status_level as $tl){ + if($task->level != $tl->plain_text) { + ?> + <li><a href="<?php echo ROOT."/App/formhandler/changestatus.php?task=". $task->id . "&status=".$tl->id; ?>"><span class="text-<?php echo $tl->style_class;?>"><?php echo $tl->plain_text;?></span></a></li> + <?php + } + } + + ?> </ul> </div> </h3> <p class="text-primary"> - <?php $task->description; ?> + <?php echo $task->description; ?> </p> </div> <?php |