<!-- BEGIN {$smarty.template} -->
<script type="text/javascript" src="js/tasks.js"></script>
<script type="text/javascript" src="js/table.js"></script>

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

<div id="opdetails"> </div>
<div id="editopdetails">{include file="add_operation_div.tpl.html"}</div>

{if count($operations) > 0}
<div class="dcaption"><em>{t 1=$curryear}My manhours [%1]{/t}</em>&nbsp;</div>

<div class="floatcontainer">
  <div class="flleft">
    <object id="objmh1" type="image/svg+xml" data="manhours_graph.php?pe_id={$PE_ID}&amp;type={$smarty.const.PHPAGA_MANHOURS_DISPLAY_YEAR}&amp;size={$smarty.const.PHPAGA_MANHOURS_GRAPH_SMALL}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}">
      You need a browser capeable of SVG to display this image.
      You can find the Adobe SVG Viewer here:
      <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
    </object>
  </div>
  <div class="flleft">
    <object id="objmh2" type="image/svg+xml" data="manhours_graph.php?pe_id={$PE_ID}&amp;type={$smarty.const.PHPAGA_MANHOURS_DISPLAY_MONTH}&amp;size={$smarty.const.PHPAGA_MANHOURS_GRAPH_SMALL}" height="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_HEIGHT}" width="{$smarty.const.PHPAGA_MHRSGRAPH_SMALL_WIDTH}">
      You need a browser capeable of SVG to display this image.
      You can find the Adobe SVG Viewer here:
      <a href="http://www.adobe.com/svg/viewer/install/main.html">http://www.adobe.com/svg/viewer/install/main.html</a>
    </object>
  </div>
</div>
<div class="spacer"></div>
{/if}

<form action="{$smarty.const.PHPAGA_SELF}" method="get">
<table class="stdtable table-autosort table-autostripe table-stripeclass:even" cellspacing="0">
  <caption><em>{t}My projects and projects I'm a member of{/t}</em>
    {t}Status{/t}:
    <select name="prj_status" onchange="this.form.submit();">
      {html_options options=$prjstat selected=$prjstat_sel}
    </select>
  </caption>

  <thead>
    <tr>
      <th class="table-sortable:default"> {t}Title{/t} </th>
      <th class="table-sortable:default"> {t}Status{/t} </th>
      <th class="table-sortable:default"> {t}Customer{/t} </th>
      <th class="table-sortable:default"> {t}Prio.{/t} </th>
      <th class="table-sortable:date"> {t}Start date{/t} </th>
      <th class="table-sortable:date"> {t}Deadline{/t} </th>
      <th class="table-sortable:default"> {t}Category{/t} </th>
      <th class="table-sortable:numeric_colon"> {t}Hours{/t} </th>
      <th> {t}Actions{/t} </th>
    </tr>
  </thead>

  {if (count($projects) > 0)}

  {section name=pdetails loop=$projects}
  <tr>
    <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>
    <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" id="dur{$projects[pdetails].prj_id}"> {if (strlen($projects[pdetails].prj_duration) && ($projects[pdetails].prj_duration > 0))}{$projects[pdetails].prj_duration|phpaga_minutes2duration}{else}&nbsp;{/if} </td>
    <td class="actions"> <a href="add_operation.php?prj_id={$projects[pdetails].prj_id}" class="ptr" onclick="addTask({$projects[pdetails].prj_id}, 'pimg', {$current_pe_id}); return false;"><img id="pimg{$projects[pdetails].prj_id}" 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}
  {else}
  <tr>
    <td colspan="9">
      {if strlen($prjstat_sel_name)}
      {t}You have not created any projects and you are not a member of any existing project with the selected status.{/t}
      {else}
      {t}You have not created any projects and you are not a member of any existing project.{/t}
      {/if}
    </td>
  </tr>
  {/if}
</table>
</form>

{if count($operations)}
<table class="stdtable table-autosort table-autostripe table-stripeclass:even" cellspacing="0" id="lop">
  <caption><em>{t 1=$num_lastoperations}My last %1 tasks{/t}</em></caption>

  <thead>
    <tr>
      <th class="table-sortable:default"> {t}Project{/t} </th>
      <th class="table-sortable:default"> {t}Task{/t} </th>
      <th class="time table-sortable:date"> {t}Date{/t} </th>
      <th class="table-sortable:default"> {t}Category{/t} </th>
      <th class="table-sortable:numeric_colon"> {t}Hours{/t} </th>
      <th> {t}Actions{/t} </th>
    </tr>
  </thead>

  {section name=details loop=$operations}
  <tr>
    <td{if ((strlen($operations[details].prj_title) > $smarty.const.PHPAGA_SHOWPRJTITLELENGHT))} onmouseover="return escape('{$operations[details].prj_title|phpaga_popup_sanitizestr}')"{/if}>
      <a href="project.php?id={$operations[details].prj_id}">{$operations[details].prj_title|wash|trnc:$smarty.const.PHPAGA_SHOWPRJTITLELENGHT:"..."}</a>
    </td>
    <td{if ((strlen($operations[details].op_desc) > $smarty.const.PHPAGA_SHOWOPDESCLENGHT))} onmouseover="return escape('{$operations[details].op_desc|wash|phpaga_popup_sanitizestr}')"{/if}>
      {$operations[details].op_desc|wash|trnc:$smarty.const.PHPAGA_SHOWOPDESCLENGHT:"..."}
    </td>
    <td class="time"> {$operations[details].op_startdate|wash|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT} </td>
    <td> {$operations[details].opcat_title|wash} </td>
    <td class="time"> {$operations[details].op_duration_hrs} </td>
    <td class="actions"> {strip}
      <a class="ptr" onclick="viewTaskDetails({$operations[details].op_id}, 'vimg')"><img id="vimg{$operations[details].op_id}" src="img/phpaga/view.png" height="16" width="16" border="0" alt="{t}View{/t}" title="{t}View{/t}"></a>
      {if ($operations[details].op_canedit)}
      <a href="operation.php?id={$operations[details].op_id}"><img src="img/phpaga/edit.png" height="16" width="16" border="0" alt="{t}Edit{/t}" title="{t}Edit{/t}"></a>
      <a class="ptr" onclick="confirm_delete_op({$operations[details].op_id}, '{$operations[details].op_startdate|date_format:$smarty.const.PHPAGA_DATEFORMAT_SHORT}\n{t}Project{/t}: {$operations[details].prj_title}\n{t}Task{/t}: {$operations[details].op_desc|phpaga_jsmessage_sanitizestr}');"><img src="img/phpaga/delete.png" height="16" width="16" border="0" alt="{t}Delete{/t}" title="{t}Delete{/t}"></a>
      {elseif $perm_view_invoices}
      <a href="bill.php?id={$operations[details].bill_id}"><img src="img/phpaga/bill.png" height="16" width="16" border="0" alt="{t}View invoice{/t}" title="{t}View invoice{/t}"></a>
      {/if}
      {/strip}
    </td>
  </tr>
  {/section}
</table>
{/if}

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