<?php 
/**
 * The action results view of product module of ZDOO.
 *
 * @copyright   Copyright 2009-2016 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     商业软件，非开源软件
 * @author      Xiying Guan <guanxiying@xirangit.com>
 * @package     product 
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../../common/view/header.html.php';?>
<div id='mainTitle' class='clearfix'>
  <div class='btn-toolbar pull-left'>
    <?php if(!isonlybody()):?>
    <?php $adminActionLink = $this->createLink('product', 'adminAction', "productID={$product->id}");?>
    <?php echo html::a($adminActionLink, '<i class="icon icon-back icon-sm"></i> ' . $lang->goback, "class='btn btn-back'");?>
    <div class="divider"></div>
    <?php endif;?>
    <div class="page-title">
      <span class="text"><?php echo $lang->product->adminresult;?></span>
    </div>
  </div>
  <div class='btn-toolbar pull-right'>
    <?php commonModel::printLink('product', 'createresult', "actionID={$action->id}", '<i class="icon-plus"></i> ' . $lang->product->action->createResult, "class='btn btn-primary' data-toggle='modal'");?>
  </div>
</div>
<div class='main-table' data-ride='table'>
  <table class='table table-form table-hover'>
    <thead>
      <tr class='text-center'>
        <th class='w-160px'><?php echo $lang->product->field->field;?></th>
        <th class='text-left'><?php echo $lang->product->action->conditions;?></th>
        <th class='w-200px'> <?php echo $lang->product->action->results;?></th>
        <th class='w-100px'><?php echo $lang->actions;?></th>
      </tr>
    </thead>
    <tbody>
      <?php foreach($action->results as $key => $result):?>
      <tr class='text-center'>
        <td><?php echo $result->field;?></td>
        <td class='text-left'>
          <?php foreach($result->conditions as $condition):?>
          <?php echo $lang->order->logicalOperators[$condition->logicalOperator];?>
          <?php echo $fields[$condition->field];?>
          <?php echo $lang->order->operaterList[$condition->operator];?>
          <?php echo $condition->param;?>
          <?php endforeach;?>
        </td>
        <td><?php echo $result->result;?></td>
        <td>
          <?php
          echo html::a($this->createLink('product', 'editresult', "actionID={$action->id}&resultID=$key"), $lang->edit, "data-toggle='modal'");
          echo html::a($this->createLink('product', 'deleteresult', "actionID={$action->id}&resultID=$key"), $lang->delete, "class='deleter'");
          ?>
        </td>
      </tr>
      <?php endforeach;?>
    </tbody>
  </table>
</div>
<?php include '../../../common/view/footer.html.php';?>
