<?php 
/**
 * Screen clusters\index
 * @version 1.0.1
 * @package Backend\Clusters
 * 
*/
require_once 'app/class-lov-manager.php';

$list = $this->data['list'];
$navurl = $this->data['navkey'];

$lovmanager = new LovManager();
$prioritylist = $lovmanager->getLov_Priority();
$clusterstatuslist = $lovmanager->getLov_ClusterStatus();
$detectionlist = $lovmanager->getLov_DetectionProcess();

$simpleDetectionlist = array();
foreach ($detectionlist as $lc){
	$simpleDetectionlist[$lc->id] = $lc->descriptioncode;
}

$simpleprioritylist = array();
foreach ($prioritylist as $lc){
	$simpleprioritylist[$lc->id] = $lc->descriptioncode;
}

$simpleStatusList = array();
foreach ($clusterstatuslist as $lc){
	$simpleStatusList[$lc->id] = $lc->descriptioncode;
}

?>
<div class="row" >
<div class="col-lg-12" >
            <h3><?= R('page_title_manageclusters') ?></h3>
			<div class="panel" style="margin-top:20px;">
	             <div class="panel panel-default">
			         <div class="panel-body">
			           	 <div class="table-responsive" >
				            <table id="table1" class="table table-hover table-striped tablesorter">
				                <thead>
				                  <tr>
				                    <th class="header"><?= R('label_ID') ?> <i class="fa fa-sort"></i></th>
				                    <th class="header"><?= R('label_date') ?> <i class="fa fa-sort"></i></th>
				                    <th class="header"><?= R('label_creationtype') ?> <i class="fa fa-sort"></i></th>
				                    <th class="header"><?= R('label_priority') ?> <i class="fa fa-sort"></i></th>
				                    <th class="header"><?= R('label_status') ?> <i class="fa fa-sort"></i></th>
				                    <th class="header"><?= R('label_user') ?> <i class="fa fa-sort"></i></th>
  			                     	<th class="header"><?= R('label_description') ?> <i class="fa fa-sort"></i></th>
				                  </tr>
				                </thead>
				                <tbody>
				               
				                <?php 
				                
				                foreach($list as $line) { ?>
				                 <tr>
				                    <td><a href="<?= __SITEBASE ?>/clusterdetail?cid=<?= $line->id ?>&<?=$navurl ?>"><?= $line->id ?></a></td>
				                    <td><?= substr($line->creationdate,0,10) ?></td>
				                    <td><?= D($simpleDetectionlist[$line->creationtypecodeid])?></td>
				                    <td><?= D($simpleprioritylist[$line->prioritycodeid]) ?></td>
				                    <td><?= D($simpleStatusList[$line->statuscodeid]) ?></td>
				                    <td><?= $line->username ?></td>
				                    <td><?= $line->annotation ?></td>
				                 </tr>
				               <?php }?>
				                </tbody>
				             </table>
			              </div>
		              </div>
	              </div>
			</div>
	</div>
</div>