By checking the value of the previous line and displaying the next line, respectively

How to check if the previous line is exit_statuscompleted, and, depending on this, whether it will be completed or expected to display the update update button or hide it in CodeIgniter. I can't think of logic to implement this, and here is my view code:

<?php } else if($USER->permissions[0] == 'all' && $row['responsibility'] == $USER->email && $row['completion_status'] == 'Pending'&& $row['sequence']-1 == 'completed') { ?>

<td style="width:10%">
  <input type="hidden" name="grievance_id" value="<?=$row['id']?>">
  <input type="hidden" name="action" value="update">

  <input type="submit" <?=($row[ 'checklist_id']=="Denied" ||$row[ 'checklist_id']=="Approved" )? "disabled='true'": "";?>name="sumit_button" value="Update" class="btn" style="float:left;background:#d8d8d8;color:#000;box-shadow:0px 0px 1x rgba(0,0,0,0.2)!important;"> &nbsp;&nbsp;

</td>
<?php }
Run codeHide result

And if the previous line exit_status is completed, then the update button will open, otherwise hide it. something like .. if ($ row ['sequence'] - 1) == 'completed' {show the else hide button}. Attached Image Image

enter image description here

+4
source share
1

- "Row" foreach

, -

, 0

if(count($rows) > 0)
{ 
    foreach($rows as $key => $row)
    {
        $prevRow = (isset($rows[($key-1)])) ?   $rows[($key-1)] :   false;

        if($USER->permissions[0] == 'all' && $row['responsibility'] == $USER->email && $row['completion_status'] == 'Pending'&& ($prevRow && $prevRow['sequence'] == 'completed'))
        {

            //your code goes here
        }


    }
}

ArrayIterator http://php.net/manual/de/class.arrayiterator.php

+1

Source: https://habr.com/ru/post/1653264/


All Articles