summaryrefslogblamecommitdiffstats
path: root/app/view/issue.php
blob: 9fc4a427b8ed38e9b5b0ad5f5a21a001eba7d36d (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                         
                               























































                                                                                        












































                                                                                                                 
                                                                                                 















                                                                                                           













































                                                                                                                              
<?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 "model/issue.php";
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>

                            <hr />

                            <?php foreach ($i->getMesgs_ordByDatetime() as $rm) { ?>
                                <div class="panel panel-default">
                                    <div class="panel-body">
                                        <?php if ($rm->objtype == "mesg") { ?>
                                            <div class="row">
                                                <div class="col-xs-1">
                                                    <?=\datalsts\objHeadCircle($rm->getAuthor(), 40)?>
                                                </div>

                                                <div class="col-xs-11">
                                                    <strong>
                                                        <?=$rm->getAuthor()->getDisplayName()?>
                                                        <!--
                                                        <span class="glyphicon glyphicon-edit"></span>
                                                        <span class="glyphicon glyphicon-inbox"></span>
                                                        -->
                                                    </strong>

                                                    <small><?=$rm->created?></small>
                                                    <br />
                                                    <?=$rm->renderMesg()?>

                                                    <?php if ($rm->getAttachment()) { ?>
                                                        <br />
                                                        <br />

                                                        <a href="<?=$rm->getAttachment()?>" class="btn btn-info">
                                                            <span class="glyphicon glyphicon-save"></span>
                                                            <?=$rm->attachment?>
                                                        </a>
                                                    <?php } ?>
                                                </div>
                                            </div>
                                        <?php } else { ?>
                                            <?=\datalsts\objHeadCircle($rm->getAuthor(), 25)?>
                                            <?=$rm->renderMesg()?>
                                            <small><?=$rm->created?></small>
                                        <?php } ?>
                                    </div>
                                </div>
                            <?php } ?>

                            <form method="post" action="<?=ap()?>" enctype="multipart/form-data">
                                <?=\formctrl\formname( "iss-mesg-add" )?>
                                <?=\formctrl\hidden( "issue", $i->guid )?>
                                <?=\formctrl\textarea( "New message", "mesg", 5 )?>

                                <div class="btn-group pull-right">
                                    <button type="submit" name="input[postMesg]" class="btn btn-primary">
                                        <span class="glyphicon glyphicon-envelope"></span> Post message
                                    </button>

                                    <button type="submit" name="input[closeIssue]" class="btn btn-success">
                                        <span class="glyphicon glyphicon-ok"></span> Close issue
                                    </button>
                                </div>

                                <?=\formctrl\file( "Attachment", "attachment" )?>
                            </form>
                        </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 } ?>