summaryrefslogtreecommitdiffstats
path: root/app/view/issue.php
blob: 9447e62bdb2578da40ad5b8dc931a0bcd8a28db0 (plain) (blame)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php

/*
 * SCROTT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 *
 * For more information, please refer to UNLICENSE
 */

namespace issue_v;

require_once "class/issue.class.php";

?>
<?php function userPanel(?\user $u, string $style, string $role, string $ts) : void { ?>

    <div class="<?=$style?>">
        <?php if (!$u) { ?>
            <p class="text-center">
                <span class="glyphicon glyphicon-ban-circle"></span>
                <?=$role?>
            </p>
        <?php } else { ?>
            <table>
                <tbody>
                    <tr>
                        <td><?=\datalsts\objHeadCircle($u, 30)?>&nbsp;</td>

                        <td>
                            <?=$u->getDisplayName()?>

                            <small>
                                <?=$role?>
                                <br />
                                <?=$ts?>
                            </small>
                        </td>
                    </tr>
                </tbody>
            </table>
        <?php } ?>
    </div>

<?php } ?>
<?php function issue(\issue $i) : void { ?>

    <?php $m = $i->getOPMesg(); ?>

    <div id="issueModal-<?=$i->guid?>" class="modal fade" tabindex="-1" role="dialog">
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span>
                    </button>

                    <h4 class="modal-title">
                        <span class="glyphicon glyphicon-inbox"></span>
                        <?=$i->name?>
                        <small>#<?=$i->numb?></small>
                    </h4>
                </div>

                <div class="modal-body">
                    <div class="row">
                        <div class="col-md-8">
                            <p><?=$m->renderMesg()?></p>
                        </div>

                        <div class="col-md-4">
                            <?php $closer  = $i->getCloser(); ?>
                            <?php $assigns = $i->getAssignees(); ?>
                            <?php $owner   = $i->getOwner(); ?>
                            <?php $author  = $m->getAuthor(); ?>
                            <?php $members = $i->getMembers(); ?>

                            <?php if ($closer) { ?>
                                <?=userPanel($closer, "alert alert-success", "closed", $i->closed)?>
                            <?php } ?>

                            <?php if (count($assigns) == 0) { ?>
                                <?=userPanel(NULL, "alert alert-danger", "unassigned", "")?>
                            <?php } ?>

                            <?php foreach ($assigns as $assign) { ?>
                                <?php if ($assign->signedoff != "") { ?>
                                    <?=userPanel($assign->assignee, "alert alert-success", "signed off", $assign->signedoff)?>
                                <?php } else { ?>
                                    <?=userPanel($assign->assignee, "alert alert-warning", "assigned", $assign->assigned)?>
                                <?php } ?>
                            <?php } ?>

                            <?=userPanel($owner, "alert alert-info", "opened", $i->created)?>

                            <?php if ($author->guid != $owner->guid) { ?>
                                <?=userPanel($author, "alert alert-info", "authored", $m->created)?>
                            <?php } ?>

                            <?php if (count($members) != 0) { ?>
                                <hr />
                            <?php } ?>

                            <?php foreach ($members as $m) { ?>
                                <?=userPanel($m, "well", "cc'd", "")?>
                            <?php } ?>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>

<?php } ?>