summaryrefslogtreecommitdiffstats
path: root/App/Task.php
blob: 5045ae534936b029ed8675fb378e0604a668bdac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?php
namespace App;

class Task{
  private $id;
  private $title;
  private $description;
  private $user;
  private $stamp;
  private $status;
  private $status_class;
  private $changeable_statuses;

  public function __construct($dbtask){
    $this->id = $dbtask->id;
    $this->title = $dbtask->title;
    $this->description = $dbtask->description;
    $this->user = $dbtask->user;
    $this->stamp = $dbtask->stamp;
    $this->status_class = $dbtask->style_class;
    $this->status = $dbtask->level;
  }
  public function setChangeableStatuses($changeable_statuses){
    $this->changeable_statuses = $changeable_statuses;
  }

  public function printTask(){
    echo "<div class=\"well well-xs status-" . strtolower($this->status) . "\" id=\"task_nr_$this->id\">";
    $this->printInnerTask();
    echo '</div>';
  }
  public function printInnerTask(){
    ?>

      <h3>
        <span ><?=$this->title?></span>
        <div class="btn-group">
          <div class="btn-toolbar">
            <div class="btn-group">
              <a href="bootstrap-elements.html" data-target="#" class="btn btn-raised btn-<?=$this->status_class?> dropdown-toggle"
                data-toggle="dropdown">
                <?=$this->status?>
                <span class="caret"></span>
              </a>
              <ul class="dropdown-menu">
                <?php
                foreach ($this->changeable_statuses as $tl) {
                  if ($this->status != $tl->plain_text) {
                    ?>
                    <li data-toggle="modal" data-target="#statusmodal" onclick="javascript:modalFix(<?=$this->id . "," . $tl->id . ",'" . $this->title."'"?>)">
                      <span class="text-<?=$tl->style_class?>"><?=$tl->plain_text?></span>
                    </li>
                    <?php
                  }
                }
                ?>
              </ul>
            </div>
          </div>
        </div>
      </h3>
      <p class="text-primary">
        <?=$this->description?>
      </p>
      <p class="text-muted small">
        Uppdaterad <?=$this->stamp . " av " . $this->user?>
      </p>

    <?php
  }
}