<!-- BEGIN {$smarty.template} -->

{include file="delete_operation.tpl.js"}
{include file="search_projects.tpl.html"}

{if isset($STATUSMSG) && strlen($STATUSMSG)}
<div class="msg">
{$STATUSMSG}
</div>
{/if}

{if (count($projects) == 0)}
<div class="msg">
{t}No projects matching your search criteria were found.{/t}<br />
{if $perm_projects}[ <a href="add_project.php">{t}Add project{/t}</a> ]{/if}
</div>
{else}

<table class="stdtable" cellspacing="0">
  <caption><em>{t}Selected projects {/t}</em>
    [
    {if $perm_projects}<a href="add_project.php">{t}Add project{/t}</a> | {/if}
    <a href="projects_pdf.php?{$search_args}">{t}Print{/t}</a> ]
  </caption>
  <tr>
    <th> <a href="{$location}{$psort.pr}"{if $porder == $smarty.const.ORDER_PRJ_PR_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PR_DESC} class="sortdesc"{/if}>
        {t}Title{/t}</a>
    </th>
    <th> <a href="{$location}{$psort.prjstat}"{if $porder == $smarty.const.ORDER_PRJ_PRJSTATUS_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRJSTATUS_DESC} class="sortdesc"{/if}>
        {t}Status{/t}</a>
    </th>
    <th> <a href="{$location}{$psort.cpn}"{if $porder == $smarty.const.ORDER_PRJ_CUSTOMER_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_CUSTOMER_DESC} class="sortdesc"{/if}>
        {t}Customer{/t}</a>
    </th>
    <th class="number"> <a href="{$location}{$psort.prio}"{if $porder == $smarty.const.ORDER_PRJ_PRIORITY_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRIORITY_DESC} class="sortdesc"{/if}>
        {t}Prio.{/t}</a>
    </th>
    <th class="time"> <a href="{$location}{$psort.start}"{if $porder == $smarty.const.ORDER_PRJ_STARTDATE_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_STARTDATE_DESC} class="sortdesc"{/if}>
        {t}Start date{/t}</a>
    </th>
    <th class="time"> <a href="{$location}{$psort.deadline}"{if $porder == $smarty.const.ORDER_PRJ_PROJDEADLINE_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PROJDEADLINE_DESC} class="sortdesc"{/if}>
        {t}Deadline{/t}</a>
    </th>
    <th> <a href="{$location}{$psort.prjcat}"{if $porder == $smarty.const.ORDER_PRJ_PRJCAT_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_PRJCAT_DESC} class="sortdesc"{/if}>
        {t}Category{/t}</a>
    </th>
    <th class="time"> <a href="{$location}{$psort.duration}"{if $porder == $smarty.const.ORDER_PRJ_DURATION_ASC} class="sortasc"{elseif $porder == $smarty.const.ORDER_PRJ_DURATION_DESC} class="sortdesc"{/if}>
        {t}Hours{/t}</a>
    </th>
    <th> {t}Actions{/t} </th>
  </tr>
  {section name=pdetails loop=$projects}
  <tr class="{cycle values="odd,even"}">
    <td{if ((strlen($projects[pdetails].prj_title) > $smarty.const.PHPAGA_SHOWPRJTITLELENGHT))} onmouseover="return escape('{$projects[pdetails].prj_title|phpaga_popup_sanitizestr}')"{/if}>
      <a href="project.php?id={$projects[pdetails].prj_id}">{$projects[pdetails].prj_title|wash|trnc:$smarty.const.PHPAGA_SHOWPRJTITLELENGHT:"...":true}</a>
    <td> {$projects[pdetails].prjstat_title|wash} </td>
    <td> <a href="company.php?id={$projects[pdetails].cpn_id}">{$projects[pdetails].cpn_name|wash}</a> </td>
    <td class="time"> {$projects[pdetails].prj_priority|wash|default:"&nbsp;"} </td>
    <td class="time"> {$projects[pdetails].prj_startdate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
    <td{if $projects[pdetails].prj_overdue} class="overdue"{/if}> {if strlen($projects[pdetails].prj_deadline)}{$projects[pdetails].prj_deadline|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT}{else}&nbsp;{/if} </td>
    <td> {$projects[pdetails].prjcat_title|wash} </td>
    <td class="time"> {$projects[pdetails].prj_duration|phpaga_minutes2duration} </td>
    <td class="actions">
      <a href="project.php?id={$projects[pdetails].prj_id}"><img src="img/phpaga/view.png" height="16" width="16" border="0" alt="{t}View{/t}" title="{t}View{/t}"></a>
      <a href="add_operation.php?prj_id={$projects[pdetails].prj_id}"><img src="img/phpaga/task_add.png" height="16" width="16" border="0" alt="{t}Add task{/t}" title="{t}Add task{/t}"></a>
    </td>
  </tr>
  {/section}
  <tr>
    <td class="browse" colspan="5"> {$BROWSE} </td>
    <td class="desc time" colspan="3"> {t}Total duration{/t}: {$TOTALHOURS} </td>
    <td> &nbsp; </td>
  </tr>
</table>
{/if}

<!-- END {$smarty.template} -->
