Beispiel #1
0
function displayData($items)
{
    jimport('joomla.html.pagination');
    $module = JModuleHelper::getModule('mod_pf_time');
    $params = new JRegistry();
    $params->loadString($module->params);
    $list_limit = (int) $params->get('list_limit');
    $show_monetary = (int) $params->get('show_monetary');
    $show_date = (int) $params->get('show_date');
    $show_author = (int) $params->get('show_author');
    $menu = new PFMenuContext();
    $app = JFactory::getApplication();
    $limitstart = (int) JRequest::getVar('limitstart', 0);
    $stotal_time = 0;
    $total_time = 0;
    $html = '
		<div class="cat-list-row">
		<ul class="list-tasks list-striped list-condensed unstyled" id="tasklist">';
    $x = 0;
    $k = 0;
    foreach ($items as $i => $item) {
        $total_time += $item->log_time;
        if ($limitstart == 0) {
            if ($i > $list_limit - 1) {
                continue;
            }
        } else {
            if ($i < $limitstart || $i >= $limitstart + $list_limit) {
                continue;
            }
        }
        $stotal_time += $item->log_time;
        $items[$i]->slug = $items[$i]->id;
        $items[$i]->project_slug = $items[$i]->project_alias ? $items[$i]->project_id . ':' . $items[$i]->project_alias : $items[$i]->project_id;
        $items[$i]->task_slug = $items[$i]->task_alias ? $items[$i]->task_id . ':' . $items[$i]->task_alias : $items[$i]->task_id;
        $items[$i]->milestone_slug = $items[$i]->milestone_alias ? $items[$i]->milestone_id . ':' . $items[$i]->milestone_alias : $items[$i]->milestone_id;
        $items[$i]->list_slug = $items[$i]->list_alias ? $items[$i]->list_id . ':' . $items[$i]->list_alias : $items[$i]->list_id;
        $exists = (int) $item->task_exists > 0;
        $html .= '
			<li id="list-item-' . $x . '" class="clearfix ">
				<div class="task-row clearfix">
					<span class="task-title">';
        if ($exists) {
            $html .= '<a class="pull-left" href="' . JRoute::_(PFtasksHelperRoute::getTaskRoute($item->task_slug, $item->project_slug, $item->milestone_slug, $item->list_slug)) . '"
						rel="popover" title="' . htmlspecialchars($item->task_title, ENT_QUOTES, "UTF-8") . '" data-content="' . htmlspecialchars($item->description, ENT_QUOTES, "UTF-8") . '">' . htmlspecialchars($item->task_title, ENT_QUOTES, 'UTF-8') . '</a>
						<span class="dropdown pull-left">';
            $menu->start(array('class' => 'btn-mini btn-link'));
            $itm_icon = 'icon-menu-2';
            $itm_txt = 'COM_PROJECTFORK_DETAILS_LABEL';
            $itm_link = '#collapse-' . $x;
            $menu->itemCollapse($itm_icon, $itm_txt, $itm_link);
            $menu->end();
            $html .= $menu->render(array('class' => 'btn-mini btn-link', 'pull' => 'left'));
            $html .= '</span>';
        } else {
            $html .= htmlspecialchars($item->task_title, ENT_QUOTES, 'UTF-8');
        }
        $html .= '</span>
					<span class="pull-right">' . JHtml::_('time.format', $item->log_time) . '</span>
				</div>
				<div id="collapse-' . $x . '" class="collapse">
					<hr />
					<small class="task-description">' . JText::_('COM_PROJECTFORK_FIELD_PROJECT_LABEL') . ':' . htmlspecialchars($item->project_title, ENT_COMPAT, 'UTF-8') . '</small>';
        if ($show_author) {
            $html .= '<span class="label user">
							<span aria-hidden="true" class="icon-user icon-white"></span>' . htmlspecialchars($item->author_name, ENT_COMPAT, 'UTF-8') . '</span>
						<input type="hidden" id="assigned' . $i . '" name="assigned[' . $item->id . ']" />';
        }
        if ($show_date) {
            $html .= '<span class="label label-success"><span aria-hidden="true" class="icon-calendar"></span>' . JHtml::_('date', $item->log_date, JText::_('DATE_FORMAT_LC4')) . '</span>';
        }
        if ($show_monetary) {
            $html .= '<span class="label label-inverse">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_RATE') . ': ' . JHtml::_('pfhtml.format.money', $item->rate) . '</span>';
            if (!$item->billable) {
                $html .= '<span class="label label-info">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_UNBILLABLE') . ': ' . JHtml::_('pfhtml.format.money', $item->billable_total) . '</span>';
            } else {
                $html .= '<span class="label label-success">' . JText::_('COM_PROJECTFORK_TIME_TRACKING_BILLABLE') . ': ' . JHtml::_('pfhtml.format.money', $item->billable_total) . '</span>';
            }
        }
        $html .= '</div>
		   </li>';
        $x++;
        $k = 1 - $k;
    }
    $html .= '<li id="list-item-' . $x++ . '" class="clearfix ">';
    $html .= '<div class="task-row clearfix">';
    if ($total_time == $stotal_time) {
        $html .= '			<span class="task-title">' . JText::_('MOD_PF_TIME_TOTAL') . '</span><span class="pull-right">' . JHtml::_('time.format', $total_time) . '</span>';
    } else {
        $html .= '			<span class="task-title">' . JText::_('MOD_PF_TIME_TOTAL') . '</span><span class="pull-right">' . JHtml::_('time.format', $stotal_time) . ' / ' . JHtml::_('time.format', $total_time) . '</span>';
    }
    $html .= '</div></li>';
    $html .= '	</ul>
	</div>';
    $pageNav = new moduleHelperPagination(count($items), $limitstart, $list_limit);
    $html .= $pageNav->getListFooter(true);
    echo $html;
    $app->close();
}
Beispiel #2
0
/**
* @package      Projectfork Timesheet Module
*
* @author       ANGEK DESIGN (Kon Angelopoulos)
* @copyright    Copyright (C) 2013 ANGEK DESIGN. All rights reserved.
* @license      http://www.gnu.org/licenses/gpl.html GNU/GPL, see LICENSE.txt
**/
defined('_JEXEC') or die;
//$show_date     	= $params->get('filter_own');
$show_monetary = $params->get('show_monetary');
$show_date = $params->get('show_date');
$show_author = $params->get('show_author');
$user = JFactory::getUser();
$uid = $user->get('id');
$menu = new PFMenuContext();
$doc = JFactory::getDocument();
$style = '.task-title > a {' . 'margin-left:10px;' . 'margin-right:10px;' . '}' . '.margin-none {' . 'margin: 0;' . '}' . '.list-striped .dropdown-menu li {' . 'background-color:transparent;' . 'padding: 0;' . 'border-bottom-width: 0;' . '}' . '.list-striped .dropdown-menu li.divider {' . 'background-color: rgba(0, 0, 0, 0.1);' . 'margin: 2px 0;' . '}' . '.label {' . 'margin-left: 3px' . '}';
$doc->addStyleDeclaration($style);
?>
	<div class="cat-list-row">
		<ul class="list-tasks list-striped list-condensed unstyled" id="tasklist">
    <?php 
$x = 0;
$k = 0;
foreach ($items as $i => $item) {
    $exists = (int) $item->task_exists > 0;
    ?>
			<li id="list-item-<?php 
    echo $x;
    ?>