<?php
/**
 * The contact view file of my module of ZDOO.
 *
 * @copyright   Copyright 2009-2018 青岛易软天创网络科技有限公司(QingDao Nature Easy Soft Network Technology Co,LTD, www.cnezsoft.com)
 * @license     ZPL (http://zpl.pub/page/zplv12.html)
 * @author      Gang Liu <liugang@cnezsoft.com>
 * @package     my
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include './header.html.php';?>
<?php js::set('type', 'contact')?>
<div id='menuActions'>
  <?php commonModel::printLink('usercontact', 'create', '', "<i class='icon icon-plus'></i> " . $lang->usercontact->create, "class='btn btn-primary' data-toggle='modal'");?>
</div>
<div class='main-table' data-ride='table'>
  <table class='table' id='contactList'>
    <thead>
      <tr class='text-center'>
        <th class='w-60px'><?php echo $lang->usercontact->id;?></th>
        <th class='w-200px text-left'><?php echo $lang->usercontact->name;?></th>
        <th class='text-left'><?php echo $lang->usercontact->member;?></th>
        <th class='w-100px'><?php echo $lang->usercontact->account;?></th>
        <th class='w-80px'><?php echo $lang->actions;?></th>
      </tr>
    </thead>
    <?php foreach($contacts as $contact):?>
    <tr class='text-center'>
      <td><?php echo $contact->id;?></td>
      <td class='text-left'><?php echo $contact->name;?></td>
      <td class='text-left'><?php foreach($contact->member as $member) echo zget($users, $member) . ' ';?></td>
      <td><?php echo zget($users, $contact->account);?></td>
      <td class='actions'>
        <?php
        $canEdit   = $this->loadModel('usercontact')->isClickable($contact, 'edit');
        $canDelete = $this->loadModel('usercontact')->isClickable($contact, 'delete');

        if($canEdit)   echo html::a($this->createLink('usercontact', 'edit', "contactID=$contact->id"), $lang->edit, "data-toggle='modal'");
        if($canDelete) echo html::a($this->createLink('usercontact', 'delete', "contactID=$contact->id"), $lang->delete, "class='deleter'");
        ?>
      </td>
    </tr>
    <?php endforeach;?>
  </table>
</div>
<?php include '../../common/view/footer.html.php';?>
