<?php
/**
 * The importtask view file of project 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      Tingting Dai <daitingting@xirangit.com>
 * @package     project
 * @version     $Id$
 * @link        http://www.zdoo.com
 */
?>
<?php include '../../common/view/header.html.php';?>
<div class='main-row'>
  <div class='panel panel-block'>
    <div class='panel-heading'>
      <strong><?php echo $lang->importIcon . $lang->project->importTask;?></strong>
      <div class='panel-actions'>
        <div class='input-group'>
          <?php $projects = array(0 => $lang->project->fromproject) + $projects;?>
          <span class='input-group-addon'><strong><?php echo $lang->project->selectProject;?></strong></span>
          <?php  echo html::select('fromproject', $projects, $fromProject, "onchange='reload($projectID, this.value)' class='form-control chosen'");?>
        </div>
      </div>
    </div>
    <form id='ajaxForm' class='main-table' data-ride='table' method='post' target='hiddenwin'>
      <table class='table'>
        <thead>
          <tr class='text-center'>
            <th class='text-left w-90px'>
              <?php if($tasks2Imported):?>
              <div class='checkbox-primary check-all' title='<?php echo $this->lang->selectAll;?>'><label></label></div>
              <?php endif;?>
              <?php echo $lang->task->id;?>
            </th>
            <th class='w-200px'><?php echo $lang->project->name ?></th>
            <th class='w-pri'><?php echo $lang->task->lblPri;?></th>
            <th><?php echo $lang->task->name;?></th>
            <th class='w-80px'><?php echo $lang->task->assignedTo;?></th>
            <th class='w-90px'><?php echo $lang->task->consumedAB . $lang->task->lblHour;?></th>
            <th class='w-110px'><?php echo $lang->task->left . $lang->task->lblHour;?></th>
            <th class='w-100px'><?php echo $lang->task->deadline;?></th>
            <th class='w-90px'><?php echo $lang->task->status;?></th>
          </tr>
        </thead>
        <tbody>
          <?php foreach($tasks2Imported as $task):?>
          <?php $class = $task->assignedTo == $app->user->account ? 'style=color:red' : '';?>
          <tr class='text-center'>
            <td class='text-left'>
              <div class='checkbox-primary'><input type='checkbox' name='tasks[]' value="<?php echo $task->id;?>" id="tasks<?php echo $task->id;?>">
                <label for="tasks<?php echo $task->id;?>"></label>
              </div>
              <?php if(!commonModel::printLink('task', 'view', "task=$task->id", sprintf('%03d', $task->id))) printf('%03d', $task->id);?>
            </td>
            <td><?php echo $projects[$task->project];?></td>
            <td><span class='active label-pri label-pri-<?php echo $task->pri; ?>'><?php echo $lang->task->priList[$task->pri];?></span></td>
            <td class='text-left nobr'><?php if(!commonModel::printLink('task', 'view', "task=$task->id", $task->name)) echo $task->name;?></td>
            <td <?php echo $class;?>><?php if(isset($users[$task->assignedTo])) echo $users[$task->assignedTo];?></td>
            <td><?php echo $task->consumed;?></td>
            <td><?php echo $task->left;?></td>
            <td><?php echo formatTime($task->deadline, DT_DATE1);?></td>
            <td><?php echo zget($lang->task->statusList, $task->status);?></td>
          </tr>
          <?php endforeach;?>
        </tbody>
      </table>
      <?php if($tasks2Imported):?>
      <div class='table-footer'>
        <div class='checkbox-primary check-all'><label><?php echo $lang->selectAll?></label></div>
        <div class='table-actions btn-toolbar'>
          <?php echo html::submitButton($lang->project->importTask, 'btn') . html::hidden('referer', $this->server->http_referer);?>
        </div>
        <div class='table-statistic'></div>
      </div>
      <?php else:?>
      <div class='table-footer text-center'><?php echo html::backButton();?></div>
      <?php endif;?>
    </form>
  </div>
</div>
<?php include '../../common/view/footer.html.php';?>
