Ejemplo n.º 1
0
 public function changeStatus($arguments)
 {
     if (!CheckAcl::can('editBugStatus')) {
         return Error::set('You are not allowed to change bug statuses.');
     }
     if (empty($_POST['id'])) {
         return Error::set('Invalid id.');
     }
     $bugs = new bugs(ConnectionFactory::get('mongo'));
     $bug = $bugs->get($_POST['id'], false);
     if (empty($bug)) {
         return Error::set('Invalid id.');
     }
     $extra = array('public', 'private', 'delete');
     $acceptable = array_merge(bugs::$status, $extra);
     if (empty($_POST['status']) || !in_array($_POST['status'], $acceptable)) {
         return Error::set('Invalid status.');
     }
     if (in_array($_POST['status'], $extra)) {
         // Altering
         switch ($_POST['status']) {
             case 'public':
                 $diff = array('public' => true);
                 break;
             case 'private':
                 $diff = array('public' => false);
                 break;
             case 'delete':
                 $diff = array('ghosted' => true);
                 break;
             default:
                 $diff = array();
                 break;
         }
     } else {
         // Standard status change.
         $diff = array('status' => array_search($_POST['status'], bugs::$status));
     }
     $bugs->alter($_POST['id'], $diff);
     $this->view['valid'] = true;
     Error::set('Status changed.', true);
     apc_delete('bugs_' . Id::create(current($bug), 'bugs'));
 }
Ejemplo n.º 2
0
if (!empty($bugs)) {
    ?>
<table class="table table-striped table-bordered table-condensed">
	<thead>
    <tr>
        <th style="width: 1%">&nbsp;</th>
        <th style="width: 5%">Category</th>
        <th style="width: 20%">Updated</th>
        <th style="width: 5%">Status</th>
        <th>Title</th>
    </tr>
    </thead>
    <tbody>
<?php 
    foreach ($bugs as $bug) {
        if (!bugs::canView($bug)) {
            continue;
        }
        ?>
    <tr>
        <td><?php 
        echo $bug['flagged'] ? '<i class="icon-exclamation-sign"></i>' : '&nbsp;';
        ?>
</td>
        <td><?php 
        echo ucwords(bugs::$category[$bug['category']]);
        ?>
</td>
        <td><?php 
        echo Date::dayFormat($bug['lastUpdate']);
        ?>