Example #1
0
/**
 * Sub-function to collect tasks within a period
 *
 * @param Date the starting date of the period
 * @param Date the ending date of the period
 * @param array by-ref an array of links to append new items to
 * @param int the length to truncate entries by
 * @param int the company id to filter by
 * @author Andrew Eddie <*****@*****.**>
 */
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0, $minical = false)
{
    global $a, $AppUI, $w2Pconfig;
    $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, 0);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    //subtract one second so we don't have to compare the start dates for exact matches with the startPeriod which is 00:00 of a given day.
    $startPeriod->subtractSeconds(1);
    $link = array();
    $sid = 3600 * 24;
    // assemble the links for the tasks
    foreach ($tasks as $row) {
        // the link
        $link['task'] = true;
        if (!$minical) {
            $link['href'] = '?m=tasks&a=view&task_id=' . $row['task_id'];
            // the link text
            if (mb_strlen($row['task_name']) > $strMaxLen) {
                $row['short_name'] = mb_substr($row['task_name'], 0, $strMaxLen) . '...';
            } else {
                $row['short_name'] = $row['task_name'];
            }
            $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['short_name'] . ($row['task_milestone'] ? '&nbsp;' . w2PshowImage('icons/milestone.gif') : '') . '</span>';
        }
        // determine which day(s) to display the task
        $start = new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_start_date'], '%Y-%m-%d %T'));
        $end = $row['task_end_date'] ? new w2p_Utilities_Date($AppUI->formatTZAwareTime($row['task_end_date'], '%Y-%m-%d %T')) : null;
        // First we test if the Tasks Starts and Ends are on the same day, if so we don't need to go any further.
        if ($start->after($startPeriod) && ($end && $end->after($startPeriod) && $end->before($endPeriod) && !$start->dateDiff($end))) {
            if ($minical) {
                $temp = array('task' => true);
            } else {
                $temp = $link;
                if ($a != 'day_view') {
                    $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, true, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip();
                    $temp['text'] .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
                }
            }
            $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
        } else {
            // If they aren't, we will now need to see if the Tasks Start date is between the requested period
            if ($start->after($startPeriod) && $start->before($endPeriod)) {
                if ($minical) {
                    $temp = array('task' => true);
                } else {
                    $temp = $link;
                    if ($a != 'day_view') {
                        $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], true, false, $tasks), true) . w2PshowImage('block-start-16.png') . $start->format($tf) . ' ' . $temp['text'] . w2PendTip();
                        $temp['text'] .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;date=' . $AppUI->formatTZAwareTime($row['task_start_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
                    }
                }
                $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
            }
            // And now the Tasks End date is checked if it is between the requested period too.
            if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
                if ($minical) {
                    $temp = array('task' => true);
                } else {
                    $temp = $link;
                    if ($a != 'day_view') {
                        $temp['text'] = w2PtoolTip($row['task_name'], getTaskTooltip($row['task_id'], false, true, $tasks), true) . ' ' . $temp['text'] . ' ' . $end->format($tf) . w2PshowImage('block-end-16.png') . w2PendTip();
                        $temp['text'] .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $row['task_id'] . '&amp;tab=1&amp;date=' . $AppUI->formatTZAwareTime($row['task_end_date'], '%Y%m%d') . '">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a>';
                    }
                }
                $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
            }
        }
    }
}
Example #2
0
    if ($row["assigned_email"]) {
        $s .= $CR . "<a href=\"mailto:" . $row["assigned_email"] . "\">" . $row['assigned_fullname'] . "</a>";
    } else {
        $s .= $CR . $row['assigned_fullname'];
    }
    $s .= $CR . "</td>";
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ist[@$row["item_status"]]) . '</td>';
    $s .= $CR . '<td align="center" nowrap>' . $AppUI->_($ipr[@$row["item_priority"]]) . '</td>';
    //Lets retrieve the updated date
    //	$sql = "SELECT MAX(status_date) status_date FROM helpdesk_item_status WHERE status_item_id =".$row['item_id'];
    //	$sdrow = db_loadList( $sql );
    //	$dateu = new CDate( $sdrow[0]['status_date'] );
    $dateu = new CDate($row['item_updated']);
    $s .= $CR . '<td align="center" nowrap>' . @$dateu->format($format) . '</td>';
    if ($row['project_id']) {
        $s .= $CR . '<td align="center" style="background-color: #' . $row['project_color_identifier'] . ';" nowrap><a href="./index.php?m=projects&a=view&project_id=' . $row['project_id'] . '" style="color: ' . bestColor(@$row["project_color_identifier"]) . ';">' . $row['project_name'] . '</a></td>';
    } else {
        $s .= $CR . '<td align="center">-</td>';
    }
    $s .= $CR . '</tr></form>';
}
print "{$s}\n";
// Pagination
$pages = 0;
if ($total_results > $items_per_page) {
    $pages_per_side = $HELPDESK_CONFIG['pages_per_side'];
    $pages = ceil($total_results / $items_per_page) - 1;
    if ($page < $pages_per_side) {
        $start = 0;
    } else {
        $start = $page - $pages_per_side;
    </tr>

<?php 
$none = true;
foreach ($projects as $row) {
    // We dont check the percent_completed == 100 because some projects
    // were being categorized as completed because not all the tasks
    // have been created (for new projects)
    if ($proFilter == -1 || $row['project_status'] == $proFilter || $proFilter == -2 && $row['project_status'] != 3 || $proFilter == -3 && $row['project_active'] != 0) {
        $project->project_id = $row['project_id'];
        $none = false;
        $start_date = intval($row['project_start_date']) ? new w2p_Utilities_Date($row['project_start_date']) : null;
        $end_date = intval($row['project_end_date']) ? new w2p_Utilities_Date($row['project_end_date']) : null;
        $actual_end_date = intval($row['project_actual_end_date']) ? new w2p_Utilities_Date($row['project_actual_end_date']) : null;
        $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
        $s = '<tr><td width="65" align="right" style="border: outset #eeeeee 1px;background-color:#' . $row['project_color_identifier'] . '"><font color="' . bestColor($row['project_color_identifier']) . '">' . sprintf('%.1f%%', $row['project_percent_complete']) . '</font></td>';
        $s .= '<td align="center">';
        if ($row['project_priority'] < 0) {
            $s .= '<img src="' . w2PfindImage('icons/priority-' . -$row['project_priority'] . '.gif') . '" width="13" height="16" alt="">';
        } elseif ($row['project_priority'] > 0) {
            $s .= '<img src="' . w2PfindImage('icons/priority+' . $row['project_priority'] . '.gif') . '"  width="13" height="16" alt="">';
        }
        $s .= '</td><td width="40%"><a href="?m=projects&a=view&project_id=' . $row['project_id'] . '" ><span title="' . (nl2br(htmlspecialchars($row['project_description'])) ? htmlspecialchars($row['project_name'], ENT_QUOTES) . '::' . nl2br(htmlspecialchars($row['project_description'])) : '') . '" >' . htmlspecialchars($row['project_name'], ENT_QUOTES) . '</span></a></td>';
        $s .= '<td width="30%"><a href="?m=companies&a=view&company_id=' . $row['project_company'] . '" ><span title="' . (nl2br(htmlspecialchars($row['company_description'])) ? htmlspecialchars($row['company_name'], ENT_QUOTES) . '::' . nl2br(htmlspecialchars($row['company_description'])) : '') . '" >' . htmlspecialchars($row['company_name'], ENT_QUOTES) . '</span></a></td>';
        $s .= '<td nowrap="nowrap" align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td>';
        $s .= '<td nowrap="nowrap" align="right">' . $project->getTotalProjectHours() . $AppUI->_('h') . '</td>';
        $s .= '<td nowrap="nowrap" align="center" nowrap="nowrap" style="background-color:' . $priority[$row['project_priority']]['color'] . '">';
        $s .= $end_date ? $end_date->format($df) : '-';
        $s .= '</td><td nowrap="nowrap" align="center">';
        $s .= $actual_end_date ? '<a href="?m=tasks&a=view&task_id=' . $row['critical_task'] . '">' : '';
        $s .= $actual_end_date ? '<span ' . $style . '>' . $actual_end_date->format($df) . '</span>' : '-';
Example #4
0
<form name="frmDelete" action="./index.php?m=projects" method="post">
	<input type="hidden" name="dosql" value="do_project_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="project_id" value="<?php 
echo $project_id;
?>
" />
</form>

<tr>
	<td style="border: outset #d1d1cd 1px;background-color:#<?php 
echo $obj->project_color_identifier;
?>
" colspan="2">
	<?php 
echo '<font color="' . bestColor($obj->project_color_identifier) . '"><strong>' . $obj->project_name . '<strong></font>';
?>
	</td>
</tr>

<tr>
	<td width="50%" valign="top">
		<strong><?php 
echo $AppUI->_('Details');
?>
</strong>
		<table cellspacing="1" cellpadding="2" border="0" width="100%">
		<tr>
			<td align="right" nowrap><?php 
echo $AppUI->_('Company');
?>
Example #5
0
/**
* Sub-function to collect tasks within a period
*
* @param Date the starting date of the period
* @param Date the ending date of the period
* @param array by-ref an array of links to append new items to
* @param int the length to truncate entries by
* @param int the company id to filter by
* @author Andrew Eddie <*****@*****.**>
*/
function getTaskLinks($startPeriod, $endPeriod, &$links, $strMaxLen, $company_id = 0)
{
    global $a, $AppUI, $dPconfig;
    $tasks = CTask::getTasksForPeriod($startPeriod, $endPeriod, $company_id, $AppUI->user_id, true);
    $durnTypes = dPgetSysVal('TaskDurationType');
    $link = array();
    $sid = 3600 * 24;
    // assemble the links for the tasks
    foreach ($tasks as $row) {
        // the link
        $link['href'] = "?m=tasks&a=view&task_id=" . $row['task_id'];
        $link['alt'] = $row['project_name'] . ":\n" . $row['task_name'];
        // the link text
        if (strlen($row['task_name']) > $strMaxLen) {
            $row['task_name'] = substr($row['task_name'], 0, $strMaxLen) . '...';
        }
        $link['text'] = '<span style="color:' . bestColor($row['color']) . ';background-color:#' . $row['color'] . '">' . $row['task_name'] . '</span>';
        // determine which day(s) to display the task
        $start = new CDate($row['task_start_date']);
        $end = $row['task_end_date'] ? new CDate($row['task_end_date']) : null;
        $durn = $row['task_duration'];
        $durnType = $row['task_duration_type'];
        if (($start->after($startPeriod) || $start->equals($startPeriod)) && ($start->before($endPeriod) || $start->equals($endPeriod))) {
            $temp = $link;
            $temp['alt'] = "START [" . $row['task_duration'] . ' ' . $AppUI->_($durnTypes[$row['task_duration_type']]) . "]\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] = dPshowImage(dPfindImage('block-start-16.png')) . $temp['text'];
            }
            $links[$start->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        if ($end && $end->after($startPeriod) && $end->before($endPeriod) && $start->before($end)) {
            $temp = $link;
            $temp['alt'] = "FINISH\n" . $link['alt'];
            if ($a != 'day_view') {
                $temp['text'] .= dPshowImage(dPfindImage('block-end-16.png'));
            }
            $links[$end->format(FMT_TIMESTAMP_DATE)][] = $temp;
        }
        // convert duration to days
        if ($durnType < 24.0) {
            if ($durn > $dPconfig['daily_working_hours']) {
                $durn /= $dPconfig['daily_working_hours'];
            } else {
                $durn = 0.0;
            }
        } else {
            $durn *= $durnType / 24.0;
        }
        // fill in between start and finish based on duration
        // notes:
        // start date is not in a future month, must be this or past month
        // start date is counted as one days work
        // business days are not taken into account
        $target = $start;
        $target->addSeconds($durn * $sid);
        if (Date::compare($target, $startPeriod) < 0) {
            continue;
        }
        if (Date::compare($start, $startPeriod) > 0) {
            $temp = $start;
            $temp->addSeconds($sid);
        } else {
            $temp = $startPeriod;
        }
        // Optimised for speed, AJD.
        while (Date::compare($endPeriod, $temp) > 0 && Date::compare($target, $temp) > 0 && ($end == null || $temp->before($end))) {
            $links[$temp->format(FMT_TIMESTAMP_DATE)][] = $link;
            $temp->addSeconds($sid);
        }
    }
}
Example #6
0
<form name="frmDelete" action="./index.php?m=projects" method="post">
	<input type="hidden" name="dosql" value="do_project_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="project_id" value="<?php 
echo $project_id;
?>
" />
</form>

<tr>
	<td style="border: outset #d1d1cd 1px;background-color:#<?php 
echo $obj->project_color_identifier;
?>
" colspan="2">
	<?php 
echo '<span style="color:' . bestColor($obj->project_color_identifier) . '; font-weight:bold">' . $obj->project_name . '</span>';
?>
	</td>
</tr>

<tr>
	<td width="50%" valign="top">
		<strong><?php 
echo $AppUI->_('Details');
?>
</strong>
		<table cellspacing="1" cellpadding="2" border="0" width="100%">
		<tr>
			<td align="right" nowrap><?php 
echo $AppUI->_('Company');
?>
function showtask(&$a, $level = 0, $is_opened = true, $today_view = false, $hideOpenCloseLink = false, $allowRepeat = false)
{
    global $AppUI, $done, $query_string, $durnTypes, $userAlloc, $showEditCheckbox;
    global $tasks_opened, $tasks_closed, $user_id;
    $tasks_closed = $tasks_closed ? $tasks_closed : array();
    $tasks_opened = $tasks_opened ? $tasks_opened : array();
    $done = $done ? $done : array();
    $now = new CDate();
    $df = $AppUI->getPref('SHDATEFORMAT');
    $df .= ' ' . $AppUI->getPref('TIMEFORMAT');
    $show_all_assignees = dPgetConfig('show_all_task_assignees', false);
    if (!isset($done[$a['task_id']])) {
        $done[$a['task_id']] = 1;
    } else {
        if (!$allowRepeat) {
            //by default, we shouldn't allow repeat displays of the same task
            return;
        }
    }
    $task_obj = new CTask();
    $task_obj->peek($a['task_id']);
    if (!$task_obj->canAccess($user_id ? $user_id : $AppUI->user_id)) {
        //don't show tasks that we can't access
        return;
    }
    if ($is_opened) {
        openClosedTask($a);
    } else {
        closeOpenedTask($a);
    }
    $start_date = intval($a['task_start_date']) ? new CDate($a['task_start_date']) : null;
    $end_date = intval($a['task_end_date']) ? new CDate($a['task_end_date']) : null;
    $last_update = isset($a['last_update']) && intval($a['last_update']) ? new CDate($a['last_update']) : null;
    // prepare coloured highlight of task time information
    $style = '';
    if ($start_date) {
        if ($now->after($start_date) && $a['task_percent_complete'] == 0) {
            $style = 'background-color:#ffeebb';
        } else {
            if ($now->after($start_date) && $a['task_percent_complete'] < 100) {
                $style = 'background-color:#e6eedd';
            }
        }
        if (!empty($end_date) && $now->after($end_date)) {
            $style = 'background-color:#cc6666;color:#ffffff';
        }
        if (!$end_date) {
            /*
             ** end date calc has been moved to calcEndByStartAndDuration()-function
             ** called from array_csort and tasks.php 
             ** perhaps this fallback if-clause could be deleted in the future, 
             ** didn't want to remove it shortly before the 2.0.2
             */
            $end_date = new CDate('0000-00-00 00:00:00');
        }
        if ($a['task_percent_complete'] == 100) {
            $style = 'background-color:#aaddaa; color:#00000';
        }
        $days = $end_date->dateDiff($now);
    }
    $s = "\n<tr>";
    // edit icon
    $s .= "\n\t<td>";
    $canEdit = getPermission('tasks', 'edit', $a['task_id']);
    $canViewLog = getPermission('task_log', 'view', $a['task_id']);
    if ($canEdit) {
        $s .= "\n\t\t" . '<a href="?m=tasks&amp;a=addedit&amp;task_id=' . $a['task_id'] . '">' . "\n\t\t\t" . '<img src="./images/icons/pencil.gif" alt="' . $AppUI->_('Edit Task') . '" border="0" width="12" height="12" />' . "\n\t\t</a>";
    }
    $s .= "\n\t</td>";
    // pinned
    $pin_prefix = $a['task_pinned'] ? '' : 'un';
    $s .= "\n\t<td>\n\t\t" . '<a href="?m=tasks&amp;pin=' . ($a['task_pinned'] ? 0 : 1) . '&task_id=' . $a['task_id'] . '">' . "\n\t\t\t" . '<img src="./images/icons/' . $pin_prefix . 'pin.gif" alt="' . $AppUI->_($pin_prefix . 'pin Task') . '" border="0" width="12" height="12" />' . "\n\t\t</a>\n\t</td>";
    // New Log
    $s .= "\n\t" . '<td align="center">';
    if ($canViewLog && $a['task_dynamic'] != 1) {
        $s .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $a['task_id'] . '&tab=1">' . $AppUI->_('Log') . '</a>';
    } else {
        $s .= $AppUI->_('-');
    }
    $s .= '</td>';
    // percent complete and priority
    $s .= "\n\t" . '<td align="right">' . intval($a['task_percent_complete']) . '%</td>' . "\n\t" . '<td align="center" nowrap="nowrap">';
    if (@$a['task_log_problem'] > 0) {
        $s .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $a['task_id'] . '&amp;tab=0&amp;problem=1">' . dPshowImage('./images/icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem!') . '</a>';
    } else {
        if ($a['task_priority'] != 0) {
            $s .= "\n\t\t" . dPshowImage('./images/icons/priority' . ($a['task_priority'] > 0 ? '+' : '-') . abs($a['task_priority']) . '.gif', 13, 16, '', '');
        }
    }
    $s .= (@$a['file_count'] > 0 ? '<img src="./images/clip.png" alt="F" />' : '') . '</td>';
    // dots
    $s .= '<td width="' . ($today_view ? '50%' : '90%') . '">';
    //level
    if ($level == -1) {
        $s .= '...';
    }
    for ($y = 0; $y < $level; $y++) {
        $s .= '<img src="' . ($y + 1 == $level ? './images/corner-dots.gif' : './images/shim.gif') . '" width="16" height="12" border="0" alt="" />';
    }
    // name link
    /*
    $alt = ((mb_strlen($a['task_description']) > 80) 
    		? (mb_substr($a['task_description'], 0, 80) . '...') : $a['task_description']);
    // instead of the statement below
    $alt = str_replace('"', '&quot;', $alt);
    $alt = htmlspecialchars($alt);
    $alt = str_replace("\r", ' ', $alt);
    $alt = str_replace("\n", ' ', $alt);
    */
    $alt = !empty($a['task_description']) ? 'onmouseover="javascript:return overlib(' . "'" . htmlspecialchars('<div><p>' . str_replace(array("\r\n", "\n", "\r"), '</p><p>', addslashes($a['task_description'])), ENT_QUOTES) . '</p></div>' . "', CAPTION, '" . $AppUI->_('Description') . "'" . ', CENTER);" onmouseout="nd();"' : ' ';
    if ($a['task_milestone'] > 0) {
        $s .= '&nbsp;<a href="./index.php?m=tasks&amp;a=view&amp;task_id=' . $a['task_id'] . '" ' . $alt . '>' . '<b>' . $a['task_name'] . '</b></a>' . '<img src="./images/icons/milestone.gif" border="0" alt="Milestone" /></td>';
    } else {
        if ($a['task_dynamic'] == 1 || count($task_obj->getChildren())) {
            if (!($today_view || $hideOpenCloseLink)) {
                $s .= '<a href="index.php' . $query_string . ($is_opened ? '&close_task_id=' . $a['task_id'] . '"><img src="images/icons/collapse.gif" align="center"' : '&open_task_id=' . $a['task_id'] . '"><img src="images/icons/expand.gif"') . ' border="0" alt="" /></a>';
            }
            $s .= '&nbsp;<a href="./index.php?m=tasks&amp;a=view&amp;task_id=' . $a['task_id'] . '" ' . $alt . '>' . ($a['task_dynamic'] == 1 ? '<b><i>' : '') . $a['task_name'] . ($a['task_dynamic'] == 1 ? '</i></b>' : '') . '</a></td>';
        } else {
            $s .= '&nbsp;<a href="./index.php?m=tasks&amp;a=view&amp;task_id=' . $a['task_id'] . '" ' . $alt . '>' . $a['task_name'] . '</a></td>';
        }
    }
    if ($today_view) {
        // Show the project name
        $s .= '<td width="50%"><a href="?m=projects&amp;a=view&amp;project_id=' . $a['task_project'] . '">' . '<span style="padding:2px;background-color:#' . $a['project_color_identifier'] . ';color:' . bestColor($a['project_color_identifier']) . '">' . $a['project_name'] . '</span>' . '</a></td>';
    }
    // task owner
    if (!$today_view) {
        $s .= '<td nowrap="nowrap" align="center">' . '<a href="?m=admin&amp;a=viewuser&amp;user_id=' . $a['user_id'] . '">' . $a['user_username'] . '</a>' . '</td>';
    }
    // $s .= '<td nowrap="nowrap" align="center">' . $a['user_username'] . '</td>';
    if (isset($a['task_assigned_users']) && ($assigned_users = $a['task_assigned_users'])) {
        $a_u_tmp_array = array();
        if ($show_all_assignees) {
            $s .= '<td align="center">';
            foreach ($assigned_users as $val) {
                /*
                $a_u_tmp_array[] = ('<a href="mailto:' . $val['user_email'] . '">' 
                					. $val['user_username'] . '</a>'); 
                */
                $a_u_tmp_array[] = '<a href="?m=admin&amp;a=viewuser&amp;user_id=' . $val['user_id'] . '"' . 'title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' . '">' . $val['user_username'] . ' (' . $val['perc_assignment'] . '%)</a>';
            }
            $s .= join(', ', $a_u_tmp_array) . '</td>';
        } else {
            $s .= '<td align="center" nowrap="nowrap">' . '<a href="?m=admin&amp;a=viewuser&amp;user_id=' . $assigned_users[0]['user_id'] . '" title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%">' . $assigned_users[0]['user_username'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>';
            if ($a['assignee_count'] > 1) {
                $s .= ' <a href="javascript: void(0);" onclick="javascript:toggle_users(' . "'users_" . $a['task_id'] . "'" . ');" title="' . join(', ', $a_u_tmp_array) . '">(+' . ($a['assignee_count'] - 1) . ')</a>' . '<span style="display: none" id="users_' . $a['task_id'] . '">';
                $a_u_tmp_array[] = $assigned_users[0]['user_username'];
                for ($i = 1, $xi = count($assigned_users); $i < $xi; $i++) {
                    $a_u_tmp_array[] = $assigned_users[$i]['user_username'];
                    $s .= '<br /><a href="?m=admin&amp;a=viewuser&amp;user_id=' . $assigned_users[$i]['user_id'] . '" title="' . $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%">' . $assigned_users[$i]['user_username'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>';
                }
                $s .= '</span>';
            }
            $s .= '</td>';
        }
    } else {
        if (!$today_view) {
            // No users asigned to task
            $s .= '<td align="center">-</td>';
        }
    }
    // duration or milestone
    $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($df) : '-') . '</td>' . '<td align="center" nowrap="nowrap" style="' . $style . '">' . $a['task_duration'] . ' ' . $AppUI->_($durnTypes[$a['task_duration_type']]) . '</td>' . '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($df) : '-') . '</td>';
    if ($today_view) {
        $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . $a['task_due_in'] . '</td>';
    } else {
        if ($AppUI->isActiveModule('history') && getPermission('history', 'view')) {
            $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($last_update ? $last_update->format($df) : '-') . '</td>';
        }
    }
    // Assignment checkbox
    if ($showEditCheckbox) {
        $s .= "\n\t" . '<td align="center">' . '<input type="checkbox" name="selected_task[' . $a['task_id'] . ']" value="' . $a['task_id'] . '"/></td>';
    }
    $s .= '</tr>';
    echo $s;
}
 /**
  * createColumn is handy because it can take any input $fieldName and use
  *   its suffix to determine how the field should be displayed.
  *
  * This allows us to treat project_description, task_description,
  *   company_description, or even some_other_crazy_wacky_description in
  *   exactly the same way without additional lines of code or configuration.
  *   If you want to do your own, feel free... but this is probably easier.
  * 
  * Examples: _budget, _date, _name, _owner
  * 
  * This may not work for things like company_type or project_type which are
  *   actually just references to look up tables, ... but should work on
  *   fields like project_company, dept_company because we still have a 
  *   common suffix.
  *
  * @note I'm kind of annoyed about the complexity and sheer number of
  *   paths of this method but overall I think it's laid out reasonably
  *   well. I think the more important part is that I've been able to
  *   encapsulate it all here instead of spreading it all over the modules
  *   and views.
  */
 public function createCell($fieldName, $value, $custom = array())
 {
     $additional = '';
     if ('' == $value) {
         return '<td>-</td>';
     }
     $pieces = explode('_', $fieldName);
     $prefix = $pieces[0];
     $suffix = '_' . end($pieces);
     if ($fieldName == 'project_actual_end_date') {
         $suffix = '_actual';
     }
     switch ($suffix) {
         //BEGIN: object-based linkings
         /*
          * TODO: The following cases are likely to change once we have an approach to 
          *   handle module-level objects and their proper mapping/linkings.
         */
         case '_company':
         case '_contact':
         case '_task':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->{"{$module}" . '_name'} . '</a>';
             $suffix .= ' _name';
             break;
         case '_department':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             /**
              * This is a branch separate from _company, _contact, etc above because although the module is called
              *   departments, the fields are dept_id and dept_name. :(
              *                                                              ~ caseydk, Dec 11 2013
              */
             $link = '?m=' . w2p_pluralize($module) . '&a=view&dept_id=' . $value;
             $cell = '<a href="' . $link . '">' . $obj->dept_name . '</a>';
             $suffix .= ' _name';
             break;
         case '_folder':
             $obj = new CFile_Folder();
             $obj->load($value);
             $foldername = $value ? $obj->file_folder_name : 'Root';
             $image = '<img src="' . w2PfindImage('folder5_small.png', 'files') . '" />';
             $link = '?m=files&tab=4&folder=' . (int) $value;
             $cell = '<a href="' . $link . '">' . $image . ' ' . $foldername . '</a>';
             $suffix .= ' _name';
             break;
         case '_user':
         case '_username':
             $obj = new CContact();
             $obj->findContactByUserid($this->tableRowData['user_id']);
             $link = '?m=users&a=view&user_id=' . $this->tableRowData['user_id'];
             $cell = '<a href="' . $link . '">' . $obj->user_username . '</a>';
             break;
             //END: object-based linkings
             /*
              * TODO: These two prefix adjustments are an ugly hack because our departments 
              *   table doesn't follow the same convention as every other table we have. 
              *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
              *
              * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
              *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
             */
         //END: object-based linkings
         /*
          * TODO: These two prefix adjustments are an ugly hack because our departments 
          *   table doesn't follow the same convention as every other table we have. 
          *   This needs to be fixed in v4.0 - caseydk 13 Feb 2012
          *
          * TODO: And unfortunately, the forums module is screwy using 'viewer' instead 
          *   of our standard 'view' for the page. ~ caseydk 16 Feb 2012
         */
         case '_name':
             $prefix = $prefix == 'project_short' ? 'project' : $prefix;
             $prefix = $prefix == 'dept' ? 'department' : $prefix;
             $page = $prefix == 'forum' || $prefix == 'message' ? 'viewer' : 'view';
             $link = '?m=' . w2p_pluralize($prefix) . '&a=' . $page . '&';
             $link = $prefix == 'message' ? '?m=forums&a=' . $page . '&' : $link;
             $prefix = $prefix == 'department' ? 'dept' : $prefix;
             $link .= $prefix . '_id=' . $this->tableRowData[$prefix . '_id'];
             $link .= $prefix == 'task_log' ? '&tab=1&task_id=' . $this->tableRowData['task_id'] : '';
             $icon = $fieldName == 'file_name' ? '<img src="' . w2PfindImage(getIcon($this->tableRowData['file_type']), 'files') . '" />&nbsp;' : '';
             $cell = '<a href="' . $link . '">' . $icon . $value . '</a>';
             //TODO: task_logs are another oddball..
             $cell = $prefix == 'task_log' ? str_replace('task_logs', 'tasks', $cell) : $cell;
             break;
         case '_author':
         case '_creator':
         case '_owner':
         case '_updator':
             if ((int) $value) {
                 $obj = new CContact();
                 $obj->findContactByUserid($value);
                 $suffix .= ' nowrap';
                 $link = '?m=users&a=view&user_id=' . $value;
                 $cell = '<a href="' . $link . '">' . $obj->contact_display_name . '</a>';
             } else {
                 $cell = $value;
             }
             break;
             // The above are all contact/user display names, the below are numbers.
         // The above are all contact/user display names, the below are numbers.
         case '_count':
         case '_hours':
             $cell = $value;
             break;
         case '_duration':
             $durnTypes = w2PgetSysVal('TaskDurationType');
             $cell = $value . ' ' . $this->AppUI->_($durnTypes[$this->tableRowData['task_duration_type']]);
             break;
         case '_size':
             $cell = file_size($value);
             break;
         case '_budget':
             $cell = w2PgetConfig('currency_symbol');
             $cell .= formatCurrency($value, $this->AppUI->getPref('CURRENCYFORM'));
             break;
         case '_url':
             $value = str_replace(array('"', '"', '<', '>'), '', $value);
             $cell = w2p_url($value);
             break;
         case '_email':
             $cell = w2p_email($value);
             break;
         case '_birthday':
         case '_date':
             $myDate = intval($value) ? new w2p_Utilities_Date($value) : null;
             $cell = $myDate ? $myDate->format($this->df) : '-';
             break;
         case '_actual':
             $end_date = intval($this->tableRowData['project_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_end_date']) : null;
             $actual_end_date = intval($this->tableRowData['project_actual_end_date']) ? new w2p_Utilities_Date($this->tableRowData['project_actual_end_date']) : null;
             $style = $actual_end_date < $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
             if ($actual_end_date) {
                 $cell = '<a href="?m=tasks&a=view&task_id=' . $this->tableRowData['project_last_task'] . '" ' . $style . '>' . $actual_end_date->format($this->df) . '</a>';
             } else {
                 $cell = '-';
             }
             break;
         case '_created':
         case '_datetime':
         case '_update':
         case '_updated':
             $myDate = intval($value) ? new w2p_Utilities_Date($this->AppUI->formatTZAwareTime($value, '%Y-%m-%d %T')) : null;
             $cell = $myDate ? $myDate->format($this->dtf) : '-';
             break;
         case '_description':
             $cell = w2p_textarea($value);
             break;
         case '_priority':
             $mod = $value > 0 ? '+' : '-';
             $image = '<img src="' . w2PfindImage('icons/priority' . $mod . abs($value) . '.gif') . '" width="13" height="16" alt="">';
             $cell = $value != 0 ? $image : '';
             break;
         case '_complete':
         case '_assignment':
         case '_allocated':
         case '_allocation':
             $cell = round($value) . '%';
             break;
         case '_password':
             $cell = '(' . $this->AppUI->_('hidden') . ')';
             break;
         case '_version':
             $value = (int) (100 * $value);
             $cell = number_format($value / 100, 2);
             break;
         case '_identifier':
             $additional = 'style="background-color:#' . $value . '; color:' . bestColor($value) . '" ';
             $cell = $this->tableRowData['project_percent_complete'] . '%';
             break;
         case '_project':
             $module = substr($suffix, 1);
             $class = 'C' . ucfirst($module);
             $obj = new $class();
             $obj->load($value);
             $color = $obj->project_color_identifier;
             $link = '?m=' . w2p_pluralize($module) . '&a=view&' . $module . '_id=' . $value;
             $cell = '<span style="background-color:#' . $color . '; padding: 3px"><a href="' . $link . '" style="color:' . bestColor($color) . '">' . $obj->{"{$module}" . '_name'} . '</a></span>';
             $suffix .= ' _name';
             break;
         case '_assignees':
             $cell = $value;
             break;
         case '_problem':
             if ($value) {
                 $cell = '<a href="?m=tasks&a=index&f=all&project_id=' . $this->tableRowData['project_id'] . '">';
                 $cell .= w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem');
                 $cell .= '</a>';
             } else {
                 $cell = '-';
             }
             break;
         default:
             $value = isset($custom[$fieldName]) ? $custom[$fieldName][$value] : $value;
             $cell = htmlspecialchars($value, ENT_QUOTES);
     }
     $begin = '<td ' . $additional . 'class="' . $suffix . '">';
     $end = '</td>';
     return $begin . $cell . $end;
 }
function displayTask($list, $task, $level, $display_week_hours, $fromPeriod, $toPeriod, $user_id, $canEditINA)
{
    global $AppUI, $df, $durnTypes, $log_userfilter_users, $priority, $system_users, $z, $zi, $x, $userAlloc;
    $zi++;
    $users = $task->task_assigned_users;
    $task->userPriority = $task->getUserSpecificTaskPriority($user_id);
    $projects = $task->getProject();
    $tmp = "<tr>";
    $tmp .= "<td align=\"center\" nowrap=\"nowrap\">";
    $tmp .= "<input type=\"checkbox\" name=\"selected_task[{$task->task_id}]\" value=\"{$task->task_id}\"/>";
    $tmp .= "</td>";
    /*ina
     */
    $tmp .= "<td>";
    for ($i = 0; $i < $level; $i++) {
        $tmp .= "&#160";
    }
    if ($task->task_milestone == true) {
        $tmp .= "<B>";
    }
    if ($level >= 1) {
        $tmp .= dPshowImage(dPfindImage('corner-dots.gif', 'tasks'), 16, 12, 'Subtask') . "&nbsp;";
    }
    $tmp .= "<a href='?m=tasks&a=view&task_id={$task->task_id}'>" . $task->task_name . "</a>";
    if ($task->task_milestone == true) {
        $tmp .= "</B>";
    }
    if ($task->task_priority < 0) {
        $tmp .= "&nbsp;(<img src=\"./images/icons/priority-" . -$task->task_priority . ".gif\" width=13 height=16>)";
    } elseif ($task->task_priority > 0) {
        $tmp .= "&nbsp;(<img src=\"./images/icons/priority+" . $task->task_priority . ".gif\" width=13 height=16>)";
    }
    $tmp .= "</td>";
    $tmp .= "<td align=\"center\">";
    $tmp .= "<a href='?m=projects&a=view&project_id={$task->task_project}' style='background-color:#" . @$projects["project_color_identifier"] . "; color:" . bestColor(@$projects['project_color_identifier']) . "'>" . $projects['project_short_name'] . "</a>";
    $tmp .= "</td>";
    $tmp .= "<td align=\"center\" nowrap=\"nowrap\">";
    $tmp .= $task->task_duration . "&nbsp;" . $AppUI->_($durnTypes[$task->task_duration_type]);
    $tmp .= "</td>";
    $tmp .= "<td align=\"center\" nowrap=\"nowrap\">";
    $dt = new CDate($task->task_start_date);
    $tmp .= $dt->format($df);
    $tmp .= "&#160&#160&#160</td>";
    $tmp .= "<td align=\"center\" nowrap=\"nowrap\">";
    $ed = new CDate($task->task_end_date);
    $now = new CDate();
    $dt = $now->dateDiff($ed);
    $sgn = $now->compare($ed, $now);
    $tmp .= $dt * $sgn;
    $tmp .= "</td>";
    if ($display_week_hours) {
        $tmp .= displayWeeks($list, $task, $level, $fromPeriod, $toPeriod);
    }
    $tmp .= "<td>";
    $sep = $us = "";
    foreach ($users as $row) {
        if ($row["user_id"]) {
            if ($canEditINA) {
                $us .= "<a href='?m=admin&a=viewuser&user_id={$row['0']}'>" . $sep . $row['contact_last_name'] . "&nbsp;\n                        \t(" . $row['perc_assignment'] . "%)</a>";
            } else {
                $us .= $sep . $row['contact_last_name'] . "&nbsp;(" . $row['perc_assignment'] . "%)";
            }
            /*ina*/
            $sep = ", ";
        }
    }
    $tmp .= $us;
    $tmp .= "</td>";
    // create the list of possible assignees
    if ($zi == 1) {
        //  selectbox may not have a size smaller than 2, use 5 here as minimum
        $zz = $z < 5 ? 5 : $z * 1.5;
        if (sizeof($users) >= 7) {
            $zz = $zz * 2;
        }
        $zm1 = $z - 2;
        if ($zm1 == 0) {
            $zm1 = 1;
        }
        $assUser = $userAlloc[$user_id]['userFC'];
        if ($user_id == 0) {
            // need to handle orphaned tasks different from tasks with existing assignees
            $zm1++;
        }
        if ($canEditINA) {
            $tmp .= "<td valign=\"top\" align=\"center\" nowrap=\"nowrap\" rowspan=\"{$zm1}\">";
            $tmp .= '<select name="add_users" style="width:200px" size="' . ($zz - 1) . '" class="text" multiple="multiple" ondblclick="javascript:chAssignment(' . $user_id . ', 0, false)">';
            foreach ($userAlloc as $v => $u) {
                $tmp .= "\n\t<option value=\"" . $u['user_id'] . "\">" . dPformSafe($u['userFC']) . "</option>";
            }
            $tmp .= '</select>';
            //$tmp.= arraySelect( $user_list, 'add_users', 'class="text" STYLE="width: 200px" size="'.($zz-1).'" multiple="multiple"',NULL );
            $tmp .= "</td>";
        }
    }
    $tmp .= "</tr>\n";
    return $tmp;
}
Example #10
0
</th>
</tr>
<?php 
$fp = -1;
$id = 0;
for ($i = ($page - 1) * $xpg_pagesize; $i < $page * $xpg_pagesize && $i < $xpg_totalrecs; $i++) {
    $row = $links[$i];
    if ($fp != $row['link_project']) {
        if (!$row['project_name']) {
            $row['project_name'] = $AppUI->_('No Project Specified');
            $row['project_color_identifier'] = 'f4efe3';
        }
        if ($showProject) {
            $s = '<tr>';
            $s .= '<td colspan="10" style="background-color:#' . $row['project_color_identifier'] . '" style="border: outset 2px #eeeeee">';
            $s .= '<font color="' . bestColor($row['project_color_identifier']) . '">';
            if ($row['link_project'] > 0) {
                $s .= '<a href="?m=projects&a=view&project_id=' . $row['link_project'] . '">' . $row['project_name'] . '</a>';
            } else {
                $s .= $row['project_name'];
            }
            $s .= '</font>';
            $s .= '</td></tr>';
            echo $s;
        }
    }
    $fp = $row['link_project'];
    ?>
<tr>
	<td nowrap="nowrap" width="20">
	<?php 
Example #11
0
$start_date = intval($forum["forum_create_date"]) ? new CDate($forum["forum_create_date"]) : null;
//20090907 KSen@Itsutsubashi
$project_id = $forum['forum_project'];
// setup the title block
$titleBlock = new CTitleBlock('Forum', 'support.png', $m, "{$m}.{$a}");
$titleBlock->addCell(arraySelect($filters, 'f', 'size="1" class="text" onchange="document.filterFrm.submit();"', $f, true), '', '<form action="?m=forums&a=viewer&forum_id=' . $forum_id . '" method="post" name="filterFrm">', '</form>');
$titleBlock->show();
?>
<table width="100%" cellspacing="0" cellpadding="2" border="0" class="std">
<tr>
	<td height="20" colspan="3" style="border: outset #D1D1CD 1px;background-color:#<?php 
echo $forum["project_color_identifier"];
?>
">
		<font size="2" color=<?php 
echo bestColor($forum["project_color_identifier"]);
?>
><strong><?php 
echo @$forum["forum_name"];
?>
</strong></font>
	</td>
</tr>
<tr>
	<td align="left" nowrap><?php 
echo $AppUI->_('Related Project');
?>
:</td>
	<td nowrap="nowrap"><strong><a href="./index.php?m=projects&a=view&project_id=<?php 
echo $forum['forum_project'];
?>
Example #12
0
			<td nowrap="nowrap" colspan="2"><strong><?php 
echo $AppUI->_('Details');
?>
</strong></td>
		</tr>
		<tr>
			<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Project');
?>
:</td>
			<td style="border: outset #d1d1cd 1px;background-color:#<?php 
echo $obj->project_color_identifier;
?>
">
				<?php 
echo '<span style="color:' . bestColor($obj->project_color_identifier) . '; font-weight:bold">' . htmlspecialchars($obj->project_name) . '</span>';
?>
			</td>
		</tr>
		<tr>
			<td align="right" nowrap="nowrap"><?php 
echo $AppUI->_('Task');
?>
:</td>
			<td class="hilite"><strong><?php 
echo htmlspecialchars(@$obj->task_name);
?>
</strong></td>
		</tr>
		<?php 
if ($obj->task_parent != $obj->task_id) {
 public function addBar(array $columnValues, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $active = true, $progress = 0, $identifier = 0)
 {
     foreach ($columnValues as $name => $value) {
         switch ($name) {
             case 'start_date':
                 $start = $value;
                 $startDate = new w2p_Utilities_Date($value);
                 $rowValues[] = $startDate->format($this->df);
                 break;
             case 'end_date':
                 $endDate = new w2p_Utilities_Date($value);
                 $rowValues[] = $endDate->format($this->df);
                 break;
             case 'actual_end':
                 if ('' == $value) {
                     $actual_end = $columnValues['end_date'];
                     $rowValues[] = $value;
                 } else {
                     $actual_end = $value;
                     $actual_endDate = new w2p_Utilities_Date($value);
                     $rowValues[] = $actual_endDate->format($this->df);
                 }
                 break;
             default:
                 $rowValues[] = $value;
         }
     }
     $bar = new GanttBar($this->rowCount++, $rowValues, $start, $actual_end, $caption, $height);
     $this->rowMap[$identifier] = $this->rowCount;
     $bar->progress->Set(min($progress / 100, 1));
     $bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 10);
     $bar->title->SetColor(bestColor('#ffffff', '#' . $barcolor, '#000000'));
     $bar->SetFillColor('#' . $barcolor);
     $bar->SetPattern(BAND_SOLID, '#' . $barcolor);
     if (0.1 == $height) {
         $bar->rightMark->Show();
         $bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
         $bar->rightMark->SetWidth(3);
         $bar->rightMark->SetColor('black');
         $bar->rightMark->SetFillColor('black');
         $bar->leftMark->Show();
         $bar->leftMark->SetType(MARK_LEFTTRIANGLE);
         $bar->leftMark->SetWidth(3);
         $bar->leftMark->SetColor('black');
         $bar->leftMark->SetFillColor('black');
         $bar->SetPattern(BAND_SOLID, 'black');
         $bar->title->SetFont(FF_CUSTOM, FS_BOLD, 9);
     }
     //adding captions
     $bar->caption = new TextProperty($caption);
     $bar->caption->Align('left', 'center');
     if (is_file(TTF_DIR . 'FreeSans.ttf')) {
         $bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8);
     }
     // gray out templates, completes, on ice, on hold
     if (!$active) {
         $bar->caption->SetColor('darkgray');
         $bar->title->SetColor('darkgray');
         $bar->SetColor('darkgray');
         $bar->SetFillColor('gray');
         $bar->progress->SetFillColor('darkgray');
         $bar->progress->SetPattern(BAND_SOLID, 'darkgray', 98);
     }
     $this->graph->Add($this->addDependencies($bar, $identifier));
 }
Example #14
0
    } else {
        $graph->scale->actinfo->SetColTitles(array($AppUI->_('Task name', UI_OUTPUT_RAW), $AppUI->_('Project name', UI_OUTPUT_RAW), $AppUI->_('Dur.', UI_OUTPUT_RAW), $AppUI->_('Start', UI_OUTPUT_RAW), $AppUI->_('Finish', UI_OUTPUT_RAW)), array(180, 50, 60, 60, 60));
    }
} else {
    if ($showWork == '1') {
        $graph->scale->actinfo->SetColTitles(array($AppUI->_('Task name', UI_OUTPUT_RAW), $AppUI->_('Work', UI_OUTPUT_RAW), $AppUI->_('Start', UI_OUTPUT_RAW), $AppUI->_('Finish', UI_OUTPUT_RAW)), array(210, 45, 75, 75));
    } else {
        $graph->scale->actinfo->SetColTitles(array($AppUI->_('Task name', UI_OUTPUT_RAW), $AppUI->_('Dur.', UI_OUTPUT_RAW), $AppUI->_('Start', UI_OUTPUT_RAW), $AppUI->_('Finish', UI_OUTPUT_RAW)), array(210, 45, 75, 75));
    }
}
$graph->scale->tableTitle->Set($projects[$project_id]['project_name']);
// Use TTF font if it exists
// try commenting out the following two lines if gantt charts do not display
$graph->scale->tableTitle->SetFont(FF_CUSTOM, FS_BOLD, 12);
$graph->scale->SetTableTitleBackground('#' . $projects[$project_id]['project_color_identifier']);
$font_color = bestColor('#' . $projects[$project_id]['project_color_identifier']);
$graph->scale->tableTitle->SetColor($font_color);
$graph->scale->tableTitle->Show(true);
//-----------------------------------------
// nice Gantt image
// if diff(end_date,start_date) > 90 days it shows only
//week number
// if diff(end_date,start_date) > 240 days it shows only
//month number
//-----------------------------------------
if ($start_date && $end_date) {
    $min_d_start = new CDate($start_date);
    $max_d_end = new CDate($end_date);
    $graph->SetDateRange($start_date, $end_date);
} else {
    // find out DateRange from gant_arr
Example #15
0
function displayFiles($folder_id)
{
    global $AppUI, $m, $a, $tab, $page;
    global $current_uri;
    global $canAccess, $canRead, $canEdit, $canAuthor, $canDelete;
    global $canAccess_folders, $canRead_folders, $canEdit_folders;
    global $canAuthor_folders, $canDelete_folders;
    global $company_id, $project_id, $task_id;
    global $allowedCompanies, $allowedProjects, $allowedTasks, $allowedFolders;
    global $showProject, $cfObj, $dPconfig;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    $file_types = dPgetSysVal('FileType');
    $xpg_pagesize = 30;
    //TODO?: Set by System Config Value ...
    $xpg_totalrecs = countFiles($folder_id);
    //get file count for folder
    $xpg_total_pages = $xpg_totalrecs > $xpg_pagesize ? ceil($xpg_totalrecs / $xpg_pagesize) : 1;
    $xpg_min = $xpg_pagesize * ($page - 1);
    // This is where we start our record set from
    $q = new DBQuery();
    // most recent version info per file_project and file_version_id
    $q->createTemp('files_count_max' . $folder_id);
    $q->addTable('files', 'f');
    $q->addQuery('DISTINCT count(f.file_id) as file_versions' . ', max(f.file_version) as file_lastversion' . ', file_version_id, f.file_project');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addGroup('f.file_version_id');
    $q->addGroup('f.file_project');
    $file_version_max_counts = $q->exec();
    $q->clear();
    // most recent version
    $q->addTable('files', 'f');
    $q->addQuery('f.*, fmc.file_versions, round(fmc.file_lastversion, 2) as file_lastversion' . ', u.user_username as file_owner, ff.file_folder_name' . ', ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner' . ', cc.contact_first_name as checkout_first_name' . ', cc.contact_last_name as checkout_last_name');
    $q->addJoin('files_count_max' . $folder_id, 'fmc', '(fmc.file_lastversion=f.file_version AND fmc.file_version_id=f.file_version_id' . ' AND fmc.file_project=f.file_project)', 'inner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->leftJoin('users', 'cu', 'cu.user_id = f.file_checkout');
    $q->leftJoin('contacts', 'cc', 'cc.contact_id = cu.user_contact');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $q->addOrder('p.project_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    // all versions
    $q->addTable('files', 'f');
    $q->addQuery('f.*, ff.file_folder_id, ff.file_folder_name, p.project_name' . ', p.project_color_identifier, p.project_owner, c.contact_first_name' . ', c.contact_last_name, t.task_name, u.user_username as file_owner');
    $q->addJoin('projects', 'p', 'p.project_id = f.file_project');
    $q->addJoin('users', 'u', 'u.user_id = f.file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = f.file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = f.file_folder');
    $q->addWhere('f.file_folder = ' . $folder_id);
    if (count($allowedProjects)) {
        $q->addWhere('((' . implode(' AND ', $allowedProjects) . ') OR f.file_project = 0)');
    }
    if (count($allowedTasks)) {
        $q->addWhere('((' . implode(' AND ', $allowedTasks) . ') OR f.file_task = 0)');
    }
    if (count($allowedFolders)) {
        $q->addWhere('((' . implode(' AND ', $allowedFolders) . ') OR f.file_folder = 0)');
    }
    if ($project_id) {
        $q->addWhere('f.file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('f.file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('co.company_id = ' . $company_id);
        if (count($allowedCompanies)) {
            $q->addWhere('(' . implode(' AND ', $allowedCompanies) . ')');
        }
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    //file arrays
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadHashList($file_versions_sql, 'file_id');
    }
    $q->dropTemp('files_count_max' . $folder_id);
    $q->exec();
    if ($files == array()) {
        return;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Date');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        $canEdit_file = getPermission('files', 'edit', $row['file_id']);
        //single file
        if ($fp != $row['file_project']) {
            if (!$row['file_project']) {
                $row['project_name'] = $AppUI->_('Not associated to projects');
                $row['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $row['project_color_identifier'] . ';color:' . bestColor($row['project_color_identifier']);
                ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
                echo $style;
                ?>
">
	<a href="?m=projects&a=view&project_id=<?php 
                echo $row['file_project'];
                ?>
">
	<span style="<?php 
                echo $style;
                ?>
"><?php 
                echo $row['project_name'];
                ?>
</span></a>
	</td>
</tr>
<?php 
            }
        }
        $fp = $row['file_project'];
        ?>
	<form name="frm_remove_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $row['file_id'];
        ?>
" action="?m=files" 
	 method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $row['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
<?php 
        $file_icon = getIcon($row['file_type']);
        ?>
		  <a href="./fileviewer.php?file_id=<?php 
        echo $row['file_id'];
        ?>
" 
		   title="<?php 
        echo $row['file_description'];
        ?>
"> 
		  <?php 
        echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
        ?>
		  &nbsp;<?php 
        echo $row['file_name'];
        ?>
 
		  </a>
		</td>
		<td width="20%"><?php 
        echo $row['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
<?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            ?>
	  <a href="#" onClick="expand('versions_<?php 
            echo $row['file_id'];
            ?>
');">
	  (<?php 
            echo $row['file_versions'];
            ?>
)
	  </a>
<?php 
        }
        ?>
		</td>
		<td width="10%" nowrap="nowrap" align="center">
		  <?php 
        echo $file_types[$row['file_category']];
        ?>
		</td>
		<td width="5%" align="center">
		  <a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $row['file_task'];
        ?>
">
		  <?php 
        echo $row['task_name'];
        ?>
		  </a>
		</td>
		<td width="15%" nowrap="nowrap">
		  <?php 
        echo $row["contact_first_name"] . ' ' . $row["contact_last_name"];
        ?>
		</td>
		<td width="5%" nowrap="nowrap" align="right">
		  <?php 
        echo file_size(intval($row['file_size']));
        ?>
		</td>
		<td width="15%" nowrap="nowrap" align="right">
		  <?php 
        echo $file_date->format($df . ' ' . $tf);
        ?>
		</td>
		<td width="10%"><?php 
        echo $row['file_co_reason'];
        ?>
</td>
		<td nowrap="nowrap" align="center">
		  
<?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
			  <a href="?m=files&a=co&file_id=<?php 
            echo $row['file_id'];
            ?>
">
			  <?php 
            echo dPshowImage(DP_BASE_URL . '/modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
			  </a>
<?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
			  <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $row['file_id'];
                ?>
">
			  <?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
			  </a>
<?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo '			  ' . $AppUI->_('final');
                } else {
                    echo '	  ' . $row['checkout_first_name'] . ' ' . $row['checkout_last_name'] . '<br />(' . $row['co_user'] . ')';
                }
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="right" width="48">
		  <?php 
        if (empty($row['file_checkout']) || $row['file_checkout'] == 'final') {
            // Edit File
            if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                echo $row['file_id'];
                ?>
">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                ?>
		  </a>
<?php 
            }
            // Duplicate File
            if ($canAuthor || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="document.frm_duplicate_file_<?php 
                echo $row['file_id'];
                ?>
.submit()">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                ?>
		  </a>
<?php 
            }
            // Delete File
            if ($canDelete || $row['project_owner'] == $AppUI->user_id) {
                ?>
		  <a href="#" 
		   onclick="if (confirm('Are you sure you want to delete this file?')) {document.frm_remove_file_<?php 
                echo $row['file_id'];
                ?>
.submit()}">
<?php 
                echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', 'delete file');
                ?>
		  </a>
<?php 
            }
        }
        ?>
		</td>
		<td nowrap="nowrap" align="center" width="1">
<?php 
        if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
            ?>
			<input type="checkbox" <?php 
            echo $bulk_op;
            ?>
 
			 name="chk_sub_sel_file_<?php 
            echo $file_row['file_id'];
            ?>
" />
<?php 
        }
        ?>
		</td>
</tr>



<?php 
        if ($row['file_versions'] > 1) {
            ?>

	  <tr><td colspan="20">
		<table style="display: none" id="versions_<?php 
            echo $row['file_id'];
            ?>
" 
		 width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		  <tr>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('File Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Description');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Versions');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Category');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Task Name');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Owner');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Size');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Type');
            ?>
</th>
			<th nowrap="nowrap"><?php 
            echo $AppUI->_('Date');
            ?>
</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
			<th nowrap="nowrap"width="1">&nbsp;</th>
		  </tr>
<?php 
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $row['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $file_version_date = new Date($file['file_date']);
                    ?>

		  <form name="frm_delete_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="del" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>		
		  <form name="frm_duplicate_sub_file_<?php 
                    echo $file['file_id'];
                    ?>
" 
		   action="?m=files" method="post">
		  <input type="hidden" name="dosql" value="do_file_aed" />
		  <input type="hidden" name="duplicate" value="1" />
		  <input type="hidden" name="file_id" value="<?php 
                    echo $file['file_id'];
                    ?>
" />
		  <input type="hidden" name="redirect" value="<?php 
                    echo $current_uri;
                    ?>
" />
		  </form>
		  <tr>
			<td nowrap="8%">
			  <a href="./fileviewer.php?file_id=<?php 
                    echo $file['file_id'];
                    ?>
" 
			   title="<?php 
                    echo $file['file_description'];
                    ?>
">
			  <?php 
                    echo dPshowImage(DP_BASE_URL . '/modules/files/images/' . $file_icon, '16', '16');
                    ?>
			  <?php 
                    echo $file['file_name'];
                    ?>
 
			  </a>
			</td>
			<td width="20%"><?php 
                    echo $file['file_description'];
                    ?>
</td>
			<td width="5%" nowrap="nowrap" align="center"><?php 
                    echo $file['file_version'];
                    ?>
</td>
			<td width="10%" nowrap="nowrap" align="center">
			  <?php 
                    echo $file_types[$file['file_category']];
                    ?>
			</td>
			<td width="5%" align="center">
			  <a href="./index.php?m=tasks&a=view&task_id=<?php 
                    echo $file['file_task'];
                    ?>
">
			  <?php 
                    echo $file['task_name'];
                    ?>
			  </a>
			</td>
			<td width="15%" nowrap="nowrap">
			  <?php 
                    echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
                    ?>
			</td>
			<td width="5%" nowrap="nowrap" align="right">
			  <?php 
                    echo file_size(intval($file['file_size']));
                    ?>
			</td>
			<td nowrap="nowrap">
			  <?php 
                    echo $row['file_type'];
                    ?>
			</td>
			<td width="15%" nowrap="nowrap" align="right">
			  <?php 
                    echo $file_version_date->format($df . ' ' . $tf);
                    ?>
			</td>
			
			<td nowrap="nowrap" align="right" width="48">
			  <?php 
                    if (empty($file['file_checkout']) || $file['file_checkout'] == 'final') {
                        // Edit File
                        if ($canEdit || $row['project_owner'] == $AppUI->user_id) {
                            ?>
			  <a href="./index.php?m=files&a=addedit&file_id=<?php 
                            echo $row['file_id'];
                            ?>
">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
                            ?>
			  </a>
<?php 
                        }
                        // Duplicate File
                        if ($canAuthor) {
                            ?>
			  <a href="#" 
			   onclick="document.frm_duplicate_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file');
                            ?>
			  </a>
<?php 
                        }
                        // Delete File
                        if ($canDelete) {
                            ?>
			  <a href="#" 
			   onclick="if (confirm('<?php 
                            echo $AppUI->_('Are you sure you want to delete this file?');
                            ?>
')) {document.frm_remove_file_<?php 
                            echo $row['file_id'];
                            ?>
.submit()}">
<?php 
                            echo dPshowImage(DP_BASE_URL . '/modules/files/images/remove.png', '16', '16', 'delete file', $AppUI->_('delete file'));
                            ?>
			  </a>
<?php 
                        }
                    }
                    ?>
			</td>
			<td nowrap="nowrap" align="center" width="1">
<?php 
                    if ((empty($row['file_checkout']) || $row['file_checkout'] == 'final') && ($canEdit || $row['project_owner'] == $AppUI->user_id)) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $row['file_id'] . ') : removeBulkComponent(' . $row['file_id'] . ')"';
                        ?>
			  <input type="checkbox" <?php 
                        echo $bulk_op;
                        ?>
 
			   name="chk_sub_sel_file_<?php 
                        echo $file_row['file_id'];
                        ?>
" />
<?php 
                    }
                    ?>
			  </td>
			</tr>
<?php 
                }
            }
            ?>
		</table>
	  </td></tr>
<?php 
        }
    }
    ?>

	</table>
	<?php 
    shownavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder_id);
    echo "<br />";
}
Example #16
0
 public function addSubBar($label, $start, $end, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $progress = 0)
 {
     $startDate = new CDate($start);
     $endDate = new CDate($end);
     $bar = new GanttBar($this->rowCount++, array($label, $startDate->format($this->df), $endDate->format($this->df), ' '), $start, $end, $caption, $height);
     $bar->progress->Set(min($progress / 100, 1));
     $bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
     $bar->title->SetColor(bestColor('#ffffff', '#' . $barcolor, '#000000'));
     $bar->SetFillColor('#' . $barcolor);
     $bar->SetPattern(BAND_SOLID, '#' . $barcolor);
     //adding captions
     $bar->caption = new TextProperty($caption);
     $bar->caption->Align('left', 'center');
     $this->graph->Add($bar);
 }
Example #17
0
foreach ($forums as $row) {
    $message_date = intval($row['forum_last_date']) ? new CDate($row['forum_last_date']) : null;
    if ($p != $row["forum_project"]) {
        $create_date = intval($row['forum_create_date']) ? new CDate($row['forum_create_date']) : null;
        ?>
<tr>
	<td colspan="6" style="background-color:#<?php 
        echo $row["project_color_identifier"];
        ?>
">
		<a href="?m=projects&a=view&project_id=<?php 
        echo $row["forum_project"];
        ?>
">
			<font color=<?php 
        echo bestColor($row["project_color_identifier"]);
        ?>
>
			<strong><?php 
        echo $row["project_name"];
        ?>
</strong>
			</font>
		</a>
	</td>
</tr>
	<?php 
        $p = $row["forum_project"];
    }
    ?>
<tr>
            echo $dPconfig['direct_edit_assignment'] ? $cols - 4 : $cols - 1;
            ?>
">
		<table width="100%" border="0">
		<tr>
			<!-- patch 2.12.04 display company name next to project name -->
			<td nowrap style="border: outset #eeeeee 2px;background-color:#<?php 
            echo @$p["project_color_identifier"];
            ?>
">
				<a href="./index.php?m=projects&a=view&project_id=<?php 
            echo $k;
            ?>
">
				<span style='color:<?php 
            echo bestColor(@$p["project_color_identifier"]);
            ?>
;text-decoration:none;'><strong><?php 
            echo @$p["company_name"] . ' :: ' . @$p["project_name"];
            ?>
</strong></span></a>
			</td>
			<td width="<?php 
            echo 101 - intval(@$p["project_percent_complete"]);
            ?>
%">
				<?php 
            echo intval(@$p["project_percent_complete"]);
            ?>
%
			</td>
Example #19
0
function displayFiles($folder)
{
    global $m, $a, $tab, $AppUI, $xpg_min, $xpg_pagesize;
    global $deny1, $deny2, $project_id, $task_id, $showProject, $file_types, $cfObj;
    global $xpg_totalrecs, $xpg_total_pages, $page;
    global $company_id, $allowed_companies, $current_uri, $dPconfig;
    $canEdit = !getDenyEdit($m, $folder);
    $canRead = !getDenyRead($m, $folder);
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.*,count(file_version) as file_versions,round(max(file_version), 2) as file_lastversion,file_folder_id, file_folder_name,project_name, project_color_identifier,contact_first_name, contact_last_name,task_name,task_id');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('contacts', 'c', 'c.contact_id = u.user_contact');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $q->addGroup('file_folder');
    $q->addGroup('project_name');
    $q->addGroup('file_name');
    $q->addOrder('file_folder');
    $q->addOrder('project_name');
    $q->addOrder('file_name');
    $q->setLimit($xpg_pagesize, $xpg_min);
    $files_sql = $q->prepare();
    $q->clear();
    $q = new DBQuery();
    $q->addTable('files');
    $q->addQuery('files.file_id, file_version, file_project, file_name, file_task, file_description, user_username as file_owner, file_size, file_category, file_type, file_date, file_folder_name');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('users', 'u', 'u.user_id = file_owner');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addWhere('file_folder = ' . $folder);
    if ($project_id) {
        $q->addWhere('file_project = ' . $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . $task_id);
    }
    if ($company_id) {
        $q->innerJoin('companies', 'co', 'co.company_id = p.project_company');
        $q->addWhere('company_id = ' . $company_id);
        $q->addWhere('company_id IN (' . $allowed_companies . ')');
    }
    $file_versions_sql = $q->prepare();
    $q->clear();
    $files = array();
    $file_versions = array();
    if ($canRead) {
        $files = db_loadList($files_sql);
        $file_versions = db_loadList($file_versions_sql);
    }
    if ($files === array()) {
        return 0;
    }
    ?>
	<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('File Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Description');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Versions');
    ?>
</th>
	    <th><?php 
    echo $AppUI->_('Category');
    ?>
</th>
		<th nowrap="nowrap"><?php 
    echo $AppUI->_('Task Name');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Owner');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Size');
    ?>
</th>
		<th><?php 
    echo $AppUI->_('Type');
    ?>
</a></th>
		<th><?php 
    echo $AppUI->_('Date');
    ?>
</th>
    	<th nowrap="nowrap"><?php 
    echo $AppUI->_('co Reason');
    ?>
</th>
    	<th><?php 
    echo $AppUI->_('co');
    ?>
</th>
		<th nowrap width="1"></th>
		<th nowrap width="1"></th>
	</tr>
<?php 
    $fp = -1;
    $file_date = new CDate();
    $id = 0;
    foreach ($files as $row) {
        $file_date = new CDate($row['file_date']);
        if ($fp != $row["file_project"]) {
            if (!$row["project_name"]) {
                $row["project_name"] = $AppUI->_('All Projects');
                $row["project_color_identifier"] = 'f4efe3';
            }
            if ($showProject) {
                $s = '<tr>';
                $s .= '<td colspan="20" style="background-color:#' . $row["project_color_identifier"] . '">';
                $s .= '<font color="' . bestColor($row["project_color_identifier"]) . '">';
                if ($row['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $row['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">' . $row["project_name"] . '</a>';
                $s .= '</font></td></tr>';
                echo $s;
            }
        }
        $fp = $row["file_project"];
        if ($row['file_versions'] > 1) {
            $file = last_file($file_versions, $row['file_name'], $row['file_project']);
        } else {
            $file = $row;
        }
        ?>
	<form name="frm_remove_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="del" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<form name="frm_duplicate_file_<?php 
        echo $file['file_id'];
        ?>
" action="?m=files" method="post">
	<input type="hidden" name="dosql" value="do_file_aed" />
	<input type="hidden" name="duplicate" value="1" />
	<input type="hidden" name="file_id" value="<?php 
        echo $file['file_id'];
        ?>
" />
	<input type="hidden" name="redirect" value="<?php 
        echo $current_uri;
        ?>
" />
	</form>		
	<tr>
		<td nowrap="8%">
			<?php 
        $file_icon = getIcon($row['file_type']);
        echo "<a href=\"./fileviewer.php?file_id={$file['file_id']}\" title=\"{$file['file_description']}\"><img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;{$row['file_name']}</a>";
        ?>
		</td>
		<td width="20%"><?php 
        echo $file['file_description'];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="center">
	        <?php 
        $hidden_table = '';
        echo $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            echo ' <a href="#" onClick="expand(\'versions_' . $file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
	<table style="display: none" id="versions_' . $file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
	<tr>
	        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
	        <th>' . $AppUI->_('Description') . '</th>
	        <th>' . $AppUI->_('Versions') . '</th>
	        <th>' . $AppUI->_('Category') . '</th>
	        <th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
	        <th>' . $AppUI->_('Owner') . '</th>
	        <th>' . $AppUI->_('Size') . '</th>
	        <th>' . $AppUI->_('Type') . '</a></th>
	        <th>' . $AppUI->_('Date') . '</th>
    		<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
    		<th>' . $AppUI->_('co') . '</th>
	        <th nowrap width="1"></th>
	        <th nowrap width="1"></th>
	</tr>
	';
            foreach ($file_versions as $file_row) {
                if ($file_row['file_name'] == $row['file_name'] && $file_row['file_project'] == $row['file_project']) {
                    $file_icon = getIcon($file_row['file_type']);
                    $file_date = new CDate($file_row['file_date']);
                    $hidden_table .= '	
			<form name="frm_delete_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="del" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '	
			<form name="frm_duplicate_sub_file_' . $file_row['file_id'] . '" action="?m=files" method="post">
			<input type="hidden" name="dosql" value="do_file_aed" />
			<input type="hidden" name="duplicate" value="1" />
			<input type="hidden" name="file_id" value="' . $file_row['file_id'] . '" />
			<input type="hidden" name="redirect" value="' . $current_uri . '" />
			</form>';
                    $hidden_table .= '
	        <tr>
	                <td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file_row['file_id'] . '" 
	                        title="' . $file_row['file_description'] . '">' . "<img border=\"0\" width=\"16\" heigth=\"16\" src=\"" . DP_BASE_URL . "/modules/files/images/{$file_icon}\" />&nbsp;" . $file_row['file_name'] . '
	                </a></td>
	                <td width="20%">' . $file_row['file_description'] . '</td>
	                <td width="5%" nowrap="nowrap" align="center">' . $file_row['file_version'] . '</td>
	                <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=' . $m . '&a=' . $a . '&tab=' . ($file_row['file_category'] + 1) . '">' . $file_types[$file_row['file_category'] + 1] . '</a></td>
	                <td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=' . $file_row["file_task"] . '">' . $row["task_name"] . '</a></td>
	                <td width="15%" nowrap="nowrap">' . $row["contact_first_name"] . ' ' . $row["contact_last_name"] . '</td>
	                <td width="5%" nowrap="nowrap" align="right">' . intval($file_row['file_size'] / 1024) . 'kb </td>
	                <td width="15%" nowrap="nowrap">' . $file_row['file_type'] . '</td>
	                <td width="15%" nowrap="nowrap" align="right">' . $file_date->format("{$df} {$tf}") . '</td>
        			<td width="10%">' . $row['file_co_reason'] . '</td>
        			<td nowrap="nowrap" align="center">';
                    if ($canEdit && empty($file_row['file_checkout'])) {
                        $hidden_table .= '<a href="?m=files&a=co&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file') . '</a>';
                    } else {
                        if ($row['file_checkout'] == $AppUI->user_id) {
                            $hidden_table .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $file_row['file_id'] . '">' . dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file') . '</a>';
                        } else {
                            if ($file_row['file_checkout'] == 'final') {
                                $hidden_table .= 'final';
                            } else {
                                $q4 = new DBQuery();
                                $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                                $q4->addTable('files');
                                $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                                $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                                $q4->addWhere('file_id = ' . $file_row['file_id']);
                                $co_user = array();
                                $co_user = $q4->loadList();
                                $co_user = $co_user[0];
                                $q4->clear();
                                $hidden_table .= $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                            }
                        }
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="48">';
                    if ($canEdit && (empty($file_row['file_checkout']) || $file_row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file_row["file_id"] . '">' . dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file') . "</a>" . '<a href="#" onclick="document.frm_duplicate_sub_file_' . $file_row['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . "</a>" . '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_delete_sub_file_' . $file_row['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . "</a>";
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '<td nowrap="nowrap" align="right" width="1">';
                    if ($canEdit && (empty($row['file_checkout']) || $row['file_checkout'] == 'final' && ($canEdit || $row['project_owner'] == $AppUI->user_id))) {
                        $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file_row['file_id'] . ') : removeBulkComponent(' . $file_row['file_id'] . ')"';
                        $hidden_table .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sub_sel_file_' . $file_row['file_id'] . '" />';
                    }
                    $hidden_table .= '</td>';
                    $hidden_table .= '</tr>';
                }
            }
            $hidden_table .= '</table>';
            //$hidden_table .= '</span>';
        }
        ?>
	        </td>
	        <td width="10%" nowrap="nowrap" align="center"><a href="./index.php?m=<?php 
        echo $m;
        ?>
&a=<?php 
        echo $a;
        ?>
&view=categories&tab=<?php 
        echo $file['file_category'];
        ?>
"><?php 
        echo $file_types[$file["file_category"]];
        ?>
</a></td> 
		<td width="5%" align="center"><a href="./index.php?m=tasks&a=view&task_id=<?php 
        echo $file["task_id"];
        ?>
"><?php 
        echo $file["task_name"];
        ?>
</a></td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["contact_first_name"] . ' ' . $file["contact_last_name"];
        ?>
</td>
		<td width="5%" nowrap="nowrap" align="right"><?php 
        echo intval($file["file_size"] / 1024);
        ?>
 kb</td>
		<td width="15%" nowrap="nowrap"><?php 
        echo $file["file_type"];
        ?>
</td>
		<td width="15%" nowrap="nowrap" align="right"><?php 
        echo $file_date->format("{$df} {$tf}");
        ?>
</td>
        <td width="10%"><?php 
        echo $file['file_co_reason'];
        ?>
</td>
        <td nowrap="nowrap" align="center">
        <?php 
        if ($canEdit && empty($row['file_checkout'])) {
            ?>
                <a href="?m=files&a=co&file_id=<?php 
            echo $file['file_id'];
            ?>
"><?php 
            echo dPshowImage('./modules/files/images/up.png', '16', '16', 'checkout', 'checkout file');
            ?>
</a>
        <?php 
        } else {
            if ($row['file_checkout'] == $AppUI->user_id) {
                ?>
                <a href="?m=files&a=addedit&ci=1&file_id=<?php 
                echo $file['file_id'];
                ?>
"><?php 
                echo dPshowImage('./modules/files/images/down.png', '16', '16', 'checkin', 'checkin file');
                ?>
</a>
        <?php 
            } else {
                if ($file['file_checkout'] == 'final') {
                    echo 'final';
                } else {
                    $q4 = new DBQuery();
                    $q4->addQuery("file_id, file_checkout, user_username as co_user, contact_first_name, contact_last_name");
                    $q4->addTable('files');
                    $q4->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
                    $q4->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
                    $q4->addWhere('file_id = ' . $file['file_id']);
                    $co_user = array();
                    $co_user = $q4->loadList();
                    $co_user = $co_user[0];
                    $q4->clear();
                    echo $co_user['contact_first_name'] . ' ' . $co_user['contact_last_name'] . '<br>(' . $co_user['co_user'] . ')';
                }
            }
        }
        ?>
                
        </td>
		<td nowrap="nowrap" align="center" width="48">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            echo '<a href="./index.php?m=files&a=addedit&file_id=' . $file["file_id"] . '">';
            echo dPshowImage('./modules/files/images/kedit.png', '16', '16', 'edit file', 'edit file');
            echo "</a>";
            echo '<a href="#" onclick="document.frm_duplicate_file_' . $file['file_id'] . '.submit()">' . dPshowImage('./modules/files/images/duplicate.png', '16', '16', 'duplicate file', 'duplicate file') . '</a>';
            echo '<a href="#" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $file['file_id'] . '.submit()}">' . dPshowImage('./modules/files/images/remove.png', '16', '16', 'delete file', 'delete file') . '</a>';
        }
        ?>
		<td nowrap="nowrap" align="center" width="1">
		<?php 
        if ($canEdit && (empty($file['file_checkout']) || $file['file_checkout'] == 'final' && ($canEdit || $file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $file['file_id'] . ') : removeBulkComponent(' . $file['file_id'] . ')"';
            echo '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $file['file_id'] . '" />';
        }
        ?>
		
		</td>
	</tr>
	<?php 
        echo $hidden_table;
        ?>
	<?php 
        $hidden_table = '';
    }
    ?>
	</table>
	<?php 
    if ($xpg_totalrecs > $xpg_pagesize) {
        showfnavbar($xpg_totalrecs, $xpg_pagesize, $xpg_total_pages, $page, $folder);
    }
    echo "<br />";
}
?>
</th>
</tr><?php 
$fp = -1;
$file_date = new CDate();
$id = 0;
foreach ($files as $file_row) {
    $latest_file = $file_versions[$file_row['latest_id']];
    $file_date = new CDate($latest_file['file_date']);
    if ($fp != $latest_file["file_project"]) {
        if (!$latest_file["file_project"]) {
            $latest_file["project_name"] = $AppUI->_('Not associated to projects');
            $latest_file["project_color_identifier"] = 'f4efe3';
        }
        if ($showProject) {
            $style = "background-color:#{$latest_file['project_color_identifier']};color:" . bestColor($latest_file["project_color_identifier"]);
            ?>
<tr>
	<td colspan="20" style="border: outset 2px #eeeeee;<?php 
            echo $style;
            ?>
">
		<a href="?m=projects&amp;a=view&amp;project_id=<?php 
            echo $latest_file['file_project'];
            ?>
">
		<span style="<?php 
            echo $style;
            ?>
"><?php 
            echo $latest_file['project_name'];
Example #21
0
     }
 }
 $none = false;
 $start_date = intval($row['project_start_date']) ? new CDate($row['project_start_date']) : null;
 $end_date = intval($row['project_end_date']) ? new CDate($row['project_end_date']) : null;
 $actual_end_date = intval($row['project_actual_end_date']) ? new CDate($row['project_actual_end_date']) : null;
 $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
 $s = '';
 if ($level) {
     $s .= '<tr style="display:none" id="multiproject_tr_' . $row['project_original_parent'] . '_' . $row['project_id'] . '_">';
     $s .= '<div id="multiproject_' . $row['project_original_parent'] . '_' . $row['project_id'] . '">';
 } else {
     $s .= '<tr>';
 }
 $s .= '<td width="65" align="right" style="border: outset #eeeeee 1px;background-color:#' . $row['project_color_identifier'] . '">';
 $s .= '<font color="' . bestColor($row['project_color_identifier']) . '">' . sprintf('%.1f%%', $row['project_percent_complete']) . '</font></td>';
 $s .= '<td align="center">';
 if ($row['project_priority'] < 0) {
     $s .= '<img src="' . w2PfindImage('icons/priority-' . -$row['project_priority'] . '.gif') . '" width=13 height=16>';
 } elseif ($row['project_priority'] > 0) {
     $s .= '<img src="' . w2PfindImage('icons/priority+' . $row['project_priority'] . '.gif') . '"  width=13 height=16>';
 }
 $s .= '</td><td width="40%">';
 $count_projects = $tmpProject->hasChildProjects($row['project_id']);
 if ($level) {
     $s .= str_repeat('&nbsp;&nbsp;&nbsp;&nbsp;', $level - 1);
     $s .= '<img src="' . w2PfindImage('corner-dots.gif') . '" width="16" height="12" border="0">&nbsp;';
     $s .= '<a href="./index.php?m=projects&a=view&project_id=' . $row["project_id"] . '">';
     $s .= nl2br($row['project_description']) ? w2PtoolTip($row['project_name'], nl2br($row['project_description']), true) : w2PtoolTip($row['project_name'], $AppUI->_('No information available'), true);
     $s .= $row["project_name"] . (nl2br($row['project_description']) ? w2PendTip() : '') . '</a>';
 } elseif ($count_projects > 0 && !$level) {
function displayFiles($AppUI, $folder_id, $task_id, $project_id, $company_id)
{
    global $m, $a, $tab, $xpg_min, $xpg_pagesize, $showProject, $file_types, $cfObj, $xpg_totalrecs, $xpg_total_pages, $page, $company_id, $allowed_companies, $current_uri, $w2Pconfig, $canEdit, $canRead;
    $df = $AppUI->getPref('SHDATEFORMAT');
    $tf = $AppUI->getPref('TIMEFORMAT');
    // SETUP FOR FILE LIST
    $q = new w2p_Database_Query();
    $q->addQuery('f.*, max(f.file_id) as latest_id, count(f.file_version) as file_versions, round(max(file_version), 2) as file_lastversion');
    $q->addQuery('ff.*');
    $q->addTable('files', 'f');
    $q->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    $q->addJoin('projects', 'p', 'p.project_id = file_project');
    $q->addJoin('tasks', 't', 't.task_id = file_task');
    $q->leftJoin('project_departments', 'project_departments', 'p.project_id = project_departments.project_id OR project_departments.project_id IS NULL');
    $q->leftJoin('departments', 'departments', 'departments.dept_id = project_departments.department_id OR dept_id IS NULL');
    //TODO: apply permissions properly
    $project = new CProject();
    $deny1 = $project->getDeniedRecords($AppUI->user_id);
    if (count($deny1) > 0) {
        $q->addWhere('file_project NOT IN (' . implode(',', $deny1) . ')');
    }
    //TODO: apply permissions properly
    $task = new CTask();
    $deny2 = $task->getDeniedRecords($AppUI->user_id);
    if (count($deny2) > 0) {
        $q->addWhere('file_task NOT IN (' . implode(',', $deny2) . ')');
    }
    if ($project_id) {
        $q->addWhere('file_project = ' . (int) $project_id);
    }
    if ($task_id) {
        $q->addWhere('file_task = ' . (int) $task_id);
    }
    if ($company_id) {
        $q->addWhere('project_company = ' . (int) $company_id);
    }
    $q->setLimit($xpg_pagesize, $xpg_min);
    $q->addWhere('file_folder = ' . (int) $folder_id);
    $q->addGroup('file_version_id DESC');
    $qv = new w2p_Database_Query();
    $qv->addTable('files');
    $qv->addQuery('file_id, file_version, file_project, file_name, file_task,
		file_description, u.user_username as file_owner, file_size, file_category,
		task_name, file_version_id,  file_checkout, file_co_reason, file_type,
		file_date, cu.user_username as co_user, project_name,
		project_color_identifier, project_owner, con.contact_first_name,
		con.contact_last_name, co.contact_first_name as co_contact_first_name,
		co.contact_last_name as co_contact_last_name ');
    $qv->addJoin('projects', 'p', 'p.project_id = file_project');
    $qv->addJoin('users', 'u', 'u.user_id = file_owner');
    $qv->addJoin('contacts', 'con', 'con.contact_id = u.user_contact');
    $qv->addJoin('tasks', 't', 't.task_id = file_task');
    $qv->addJoin('file_folders', 'ff', 'ff.file_folder_id = file_folder');
    if ($project_id) {
        $qv->addWhere('file_project = ' . (int) $project_id);
    }
    if ($task_id) {
        $qv->addWhere('file_task = ' . (int) $task_id);
    }
    if ($company_id) {
        $qv->addWhere('project_company = ' . (int) $company_id);
    }
    $qv->leftJoin('users', 'cu', 'cu.user_id = file_checkout');
    $qv->leftJoin('contacts', 'co', 'co.contact_id = cu.user_contact');
    $qv->addWhere('file_folder = ' . (int) $folder_id);
    $files = array();
    $file_versions = array();
    $files = $q->loadList();
    $file_versions = $qv->loadHashList('file_id');
    $q->clear();
    $qv->clear();
    if ($files === array()) {
        return 0;
    }
    $s = '
		<table width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
		<tr>
			<th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
			<th>' . $AppUI->_('Description') . '</th>
			<th>' . $AppUI->_('Versions') . '</th>
		    <th>' . $AppUI->_('Category') . '</th>
			<th nowrap="nowrap">' . $AppUI->_('Task Name') . '</th>
			<th>' . $AppUI->_('Owner') . '</th>
			<th>' . $AppUI->_('Size') . '</th>
			<th>' . $AppUI->_('Type') . '</a></th>
			<th>' . $AppUI->_('Date') . '</th>
	    	<th nowrap="nowrap">' . $AppUI->_('co Reason') . '</th>
	    	<th>' . $AppUI->_('co') . '</th>
			<th nowrap="nowrap" width="5%"></th>
			<th nowrap="nowrap" width="1"></th>
		</tr>';
    $fp = -1;
    $file_date = new w2p_Utilities_Date();
    $id = 0;
    foreach ($files as $row) {
        $latest_file = $file_versions[$row['latest_id']];
        $file_date = new w2p_Utilities_Date($latest_file['file_date']);
        if ($fp != $latest_file['file_project']) {
            if (!$latest_file['file_project']) {
                $latest_file['project_name'] = $AppUI->_('Not attached to a project');
                $latest_file['project_color_identifier'] = 'f4efe3';
            }
            if ($showProject) {
                $style = 'background-color:#' . $latest_file['project_color_identifier'] . ';color:' . bestColor($latest_file['project_color_identifier']);
                $s .= '<tr>';
                $s .= '<td colspan="20" style="border: outset 2px #eeeeee;' . $style . '">';
                if ($latest_file['file_project'] > 0) {
                    $href = './index.php?m=projects&a=view&project_id=' . $latest_file['file_project'];
                } else {
                    $href = './index.php?m=projects';
                }
                $s .= '<a href="' . $href . '">';
                $s .= '<span style="' . $style . '">' . $latest_file['project_name'] . '</span></a>';
                $s .= '</td></tr>';
            }
        }
        $fp = $latest_file['file_project'];
        $s .= '<tr>
				<td nowrap="8%">
                    <form name="frm_remove_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                        <input type="hidden" name="dosql" value="do_file_aed" />
                        <input type="hidden" name="del" value="1" />
                        <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" />
                        <input type="hidden" name="redirect" value="' . $current_uri . '" />
                    </form>
                    <form name="frm_duplicate_file_' . $latest_file['file_id'] . '" action="?m=files" method="post" accept-charset="utf-8">
                        <input type="hidden" name="dosql" value="do_file_aed" />
                        <input type="hidden" name="duplicate" value="1" />
                        <input type="hidden" name="file_id" value="' . $latest_file['file_id'] . '" />
                        <input type="hidden" name="redirect" value="' . $current_uri . '" />
                    </form>
                ';
        $junkFile = new CFile();
        // TODO: This is just to get getIcon included..
        $file_icon = getIcon($row['file_type']);
        $s .= '<a href="./fileviewer.php?file_id=' . $latest_file['file_id'] . '"><img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" />&nbsp;' . $latest_file['file_name'] . '</a></td>';
        $s .= '<td width="20%">' . w2p_textarea($latest_file['file_description']) . '</td><td width="5%" nowrap="nowrap" align="right">';
        $hidden_table = '';
        $s .= $row['file_lastversion'];
        if ($row['file_versions'] > 1) {
            $s .= ' <a href="javascript: void(0);" onClick="expand(\'versions_' . $latest_file['file_id'] . '\'); ">(' . $row['file_versions'] . ')</a>';
            $hidden_table = '<tr><td colspan="20">
							<table style="display: none" id="versions_' . $latest_file['file_id'] . '" width="100%" border="0" cellpadding="2" cellspacing="1" class="tbl">
							<tr>
							        <th nowrap="nowrap">' . $AppUI->_('File Name') . '</th>
							        <th>' . $AppUI->_('Description') . '</th>
							        <th>' . $AppUI->_('Versions') . '</th>
							        <th>' . $AppUI->_('Category') . '</th>
									<th>' . $AppUI->_('Folder') . '</th>
							        <th>' . $AppUI->_('Task Name') . '</th>
							        <th>' . $AppUI->_('Owner') . '</th>
							        <th>' . $AppUI->_('Size') . '</th>
							        <th>' . $AppUI->_('Type') . '</a></th>
							        <th>' . $AppUI->_('Date') . '</th>
							</tr>';
            foreach ($file_versions as $file) {
                if ($file['file_version_id'] == $latest_file['file_version_id']) {
                    $file_icon = getIcon($file['file_type']);
                    $hdate = new w2p_Utilities_Date($file['file_date']);
                    $hidden_table .= '<tr><td nowrap="8%"><a href="./fileviewer.php?file_id=' . $file['file_id'] . '" title="' . $file['file_description'] . '">' . '<img border="0" width="16" heigth="16" src="' . w2PfindImage($file_icon, 'files') . '" alt="" />&nbsp;' . $file['file_name'] . '
					  </a></td>
					  <td width="20%">' . $file['file_description'] . '</td>
					  <td width="5%" nowrap="nowrap" align="right">' . $file['file_version'] . '</td>
					  <td nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td>
					  <td nowrap="nowrap" align="left">' . ($file['file_folder_name'] != '' ? '<a href="' . W2P_BASE_URL . '/index.php?m=files&tab=' . (count($file_types) + 1) . '&folder=' . $file['file_folder_id'] . '">' . w2PshowImage('folder5_small.png', '16', '16', 'folder icon', 'show only this folder', 'files') . $file['file_folder_name'] . '</a>' : 'Root') . '</td>
					  <td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $file['file_task'] . '">' . $file['task_name'] . '</a></td>
					  <td nowrap="nowrap">' . $file['contact_first_name'] . ' ' . $file['contact_last_name'] . '</td>
					  <td width="5%" nowrap="nowrap" align="right">' . file_size(intval($file['file_size'])) . '</td>
					  <td nowrap="nowrap">' . $file['file_type'] . '</td>
					  <td width="5%" nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($file['file_date'], $df . ' ' . $tf) . '</td>';
                    if ($canEdit && $w2Pconfig['files_show_versions_edit']) {
                        $hidden_table .= '<a href="./index.php?m=files&a=addedit&file_id=' . $file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . "</a>";
                    }
                    $hidden_table .= '</td><tr>';
                }
            }
            $hidden_table .= '</table>';
        }
        $s .= '</td>
				<td width="10%" nowrap="nowrap" align="left">' . $file_types[$file['file_category']] . '</td>
				<td nowrap="nowrap" align="left"><a href="./index.php?m=tasks&a=view&task_id=' . $latest_file['file_task'] . '">' . $latest_file['task_name'] . '</a></td>
				<td nowrap="nowrap">' . $latest_file['contact_first_name'] . ' ' . $latest_file['contact_last_name'] . '</td>
				<td width="5%" nowrap="nowrap" align="right">' . intval($latest_file['file_size'] / 1024) . ' kb</td>
				<td nowrap="nowrap">' . $latest_file['file_type'] . '</td>
				<td nowrap="nowrap" align="center">' . $AppUI->formatTZAwareTime($latest_file['file_date'], $df . ' ' . $tf) . '</td>
				<td width="10%">' . $latest_file['file_co_reason'] . '</td>
				<td nowrap="nowrap">';
        if (empty($row['file_checkout'])) {
            $s .= '<a href="?m=files&a=co&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('up.png', '16', '16', 'checkout', 'checkout file', 'files') . '</a>';
        } elseif ($row['file_checkout'] == $AppUI->user_id) {
            $s .= '<a href="?m=files&a=addedit&ci=1&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('down.png', '16', '16', 'checkin', 'checkin file', 'files') . '</a>';
        } else {
            if ($latest_file['file_checkout'] == 'final') {
                $s .= 'final';
            } else {
                $s .= $latest_file['co_contact_first_name'] . ' ' . $latest_file['co_contact_last_name'] . '<br>(' . $latest_file['co_user'] . ')';
            }
        }
        $s .= '</td><td nowrap="nowrap" width="50">';
        if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) {
            $s .= '<a style="float: left;" href="./index.php?m=files&a=addedit&file_id=' . $latest_file['file_id'] . '">' . w2PshowImage('kedit.png', '16', '16', 'edit file', 'edit file', 'files') . '</a>';
            $s .= '<a style="float: left;" href="javascript: void(0);" onclick="document.frm_duplicate_file_' . $latest_file['file_id'] . '.submit()">' . w2PshowImage('duplicate.png', '16', '16', 'duplicate file', 'duplicate file', 'files') . '</a>';
            $s .= '<a style="float: left;" href="javascript: void(0);" onclick="if (confirm(\'Are you sure you want to delete this file?\')) {document.frm_remove_file_' . $latest_file['file_id'] . '.submit()}">' . w2PshowImage('remove.png', '16', '16', 'delete file', 'delete file', 'files') . '</a>';
        }
        $s .= '</td>';
        $s .= '<td nowrap="nowrap" align="center" width="1">';
        if ($canEdit && (empty($latest_file['file_checkout']) || $latest_file['file_checkout'] == 'final' && ($canEdit || $latest_file['project_owner'] == $AppUI->user_id))) {
            $bulk_op = 'onchange="(this.checked) ? addBulkComponent(' . $latest_file['file_id'] . ') : removeBulkComponent(' . $latest_file['file_id'] . ')"';
            $s .= '<input type="checkbox" ' . $bulk_op . ' name="chk_sel_file_' . $latest_file['file_id'] . '" />';
        }
        $s .= '</td></tr>';
        $s .= $hidden_table;
        $hidden_table = '';
    }
    return $s;
}
Example #23
0
function displayTask($list, $task, $level, $display_week_hours, $fromPeriod, $toPeriod, $user_id)
{
    global $AppUI, $df, $durnTypes, $log_userfilter_users, $now, $priority, $system_users;
    global $z, $zi, $x, $userAlloc;
    $zi++;
    $users = $task->task_assigned_users;
    $task->userPriority = $task->getUserSpecificTaskPriority($user_id);
    $projects = $task->getProject();
    $tmp = '<tr>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $tmp .= '<input type="checkbox" name="selected_task[' . $task->task_id . ']" value="' . $task->task_id . '" />';
    $tmp .= '</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    if ($task->userPriority) {
        $tmp .= '<img src="./images/icons/priority';
        $tmp .= $task->userPriority < 0 ? '-' . -$task->userPriority : '+' . $task->userPriority;
        $tmp .= '.gif" width="13" height="16" alt="" />';
    }
    $tmp .= '</td>';
    $tmp .= '<td nowrap="nowrap">';
    for ($i = 0; $i < $level; $i++) {
        $tmp .= '&nbsp;&nbsp;&nbsp;';
    }
    if ($task->task_milestone == true) {
        $tmp .= '<strong>';
    }
    if ($level >= 1) {
        $tmp .= dPshowImage(dPfindImage('corner-dots.gif', 'tasks'), 16, 12, 'Subtask') . "&nbsp;";
    }
    $tmp .= '<a href="?m=tasks&amp;a=view&amp;task_id=' . $task->task_id . '">' . $task->task_name . '</a>';
    if ($task->task_milestone == true) {
        $tmp .= '</strong>';
    }
    if ($task->task_priority) {
        $tmp .= '&nbsp;(<img src="./images/icons/priority';
        $tmp .= $task->task_priority < 0 ? '-' . -$task->task_priority : '+' . $task->task_priority;
        $tmp .= '.gif" width="13" height="16" alt="" />)';
    }
    $tmp .= '</td>';
    $tmp .= '<td align="center">';
    $tmp .= '<a href="?m=projects&amp;a=view&amp;project_id=' . $task->task_project . '" style="background-color:#' . @$projects['project_color_identifier'] . '; color:' . bestColor(@$projects['project_color_identifier']) . '">' . $projects['project_short_name'] . '</a>';
    $tmp .= '</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $tmp .= $task->task_duration . '&nbsp;' . $AppUI->_($durnTypes[$task->task_duration_type]);
    $tmp .= '</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $dt = new CDate($task->task_start_date);
    $tmp .= $dt->format($df);
    $tmp .= '&nbsp;&nbsp;&nbsp;</td>';
    $tmp .= '<td align="center" nowrap="nowrap">';
    $ed = new CDate($task->task_end_date);
    $dt = $now->dateDiff($ed);
    $sgn = $now->compare($ed, $now);
    $tmp .= $dt * $sgn;
    $tmp .= '</td>';
    if ($display_week_hours) {
        $tmp .= displayWeeks($list, $task, $level, $fromPeriod, $toPeriod);
    }
    $tmp .= '<td>';
    $sep = $us = '';
    foreach ($users as $row) {
        if ($row['user_id']) {
            $us .= $sep . '<a href="?m=admin&amp;a=viewuser&amp;user_id=' . $row[0] . '">' . $row['contact_first_name'] . ' ' . $row['contact_last_name'] . '&nbsp;(' . $row['perc_assignment'] . '%)</a>';
            $sep = ', ';
        }
    }
    $tmp .= $us;
    $tmp .= '</td>';
    // create the list of possible assignees
    if ($zi == 1) {
        //	selectbox may not have a size smaller than 2, use 5 here as minimum
        $zz = $z < 5 ? 5 : $z * 1.5;
        $zz = sizeof($users) >= 7 ? $zz * 2 : $zz;
        $zm1 = $z - 2;
        $zm1 = $zm1 <= 0 ? 1 : $zm1;
        $assUser = $userAlloc[$user_id]['userFC'];
        // need to handle orphaned tasks different from tasks with existing assignees
        $zm1 += $user_id == 0 ? 1 : 0;
        $tmp .= '<td valign="top" align="center" nowrap="nowrap" rowspan="' . $zm1 . '">';
        $tmp .= '<select name="add_users" style="width:200px" size="' . ($zz - 1) . '" class="text" multiple="multiple" ondblclick="javascript:chAssignment(' . $user_id . ', 0, false)">';
        foreach ($userAlloc as $v => $u) {
            $tmp .= "\n\t" . '<option value="' . $u['user_id'] . '">' . dPformSafe($u['userFC']) . '</option>';
        }
        $tmp .= '</select>';
        /*
        $tmp .= arraySelect($user_list, 'add_users', 'class="text" style="width: 200px" size="' 
                            . ($zz - 1) . '" multiple="multiple"', NULL);
        */
        $tmp .= '</td>';
    }
    $tmp .= "</tr>\n";
    return $tmp;
}
foreach ($projects as $row) {
    if (!$perms->checkModuleItem('projects', 'view', $row['project_id'])) {
        continue;
    }
    // We dont check the percent_completed == 100 because some projects
    // were being categorized as completed because not all the tasks
    // have been created (for new projects)
    if ($proFilter == -1 || $row["project_status"] == $proFilter || $proFilter == -2 && $row["project_status"] != 3 || $proFilter == -3 && $row["project_status"] != 7) {
        $none = false;
        $start_date = intval(@$row["project_start_date"]) ? new CDate($row["project_start_date"]) : null;
        $end_date = intval(@$row["project_end_date"]) ? new CDate($row["project_end_date"]) : null;
        $actual_end_date = intval(@$row["project_actual_end_date"]) ? new CDate($row["project_actual_end_date"]) : null;
        $style = $actual_end_date > $end_date && !empty($end_date) ? 'style="color:red; font-weight:bold"' : '';
        $s = '<tr>';
        $s .= '<td width="65" align="center" style="border: outset #eeeeee 2px;background-color:#' . $row["project_color_identifier"] . '">';
        $s .= $CT . '<font color="' . bestColor($row["project_color_identifier"]) . '">' . sprintf("%.1f%%", $row["project_percent_complete"]) . '</font>';
        $s .= $CR . '</td>';
        $s .= $CR . '<td width="30%">';
        if ($perms->checkModuleItem('companies', 'access', $row['project_company'])) {
            $s .= $CT . '<a href="?m=companies&a=view&company_id=' . $row["project_company"] . '" title="' . htmlspecialchars($row["company_description"], ENT_QUOTES) . '">' . htmlspecialchars($row["company_name"], ENT_QUOTES) . $row["project_department"] . '</a>';
        } else {
            $s .= $CT . htmlspecialchars($row["company_name"], ENT_QUOTES);
        }
        $s .= $CR . '</td>';
        $s .= $CR . '<td width="100%">';
        $s .= $CT . '<a href="?m=projects&a=view&project_id=' . $row["project_id"] . '" onmouseover="return overlib( \'' . htmlspecialchars('<div><p>' . str_replace(array("\r\n", "\n", "\r"), '</p><p>', addslashes($row["project_description"])) . '</p></div>', ENT_QUOTES) . '\', CAPTION, \'' . $AppUI->_('Description') . '\', CENTER);" onmouseout="nd();">' . htmlspecialchars($row["project_name"], ENT_QUOTES) . '</a>';
        $s .= $CR . '</td>';
        $s .= $CR . '<td align="center">' . ($start_date ? $start_date->format($df) : '-') . '</td>';
        $s .= $CR . '<td align="center">' . ($row["project_duration"] > 0 ? round($row["project_duration"], 0) . $AppUI->_('h') : '-') . '</td>';
        $s .= $CR . '<td align="center" nowrap="nowrap" style="background-color:' . $priority[$row['project_priority']]['color'] . '">';
        $s .= $CT . ($end_date ? $end_date->format($df) : '-');
Example #25
0
     $caption .= $AppUI->_($projectStatus[$p['project_status']]) . ', ';
     $caption .= $p['project_active'] != 0 ? $AppUI->_('active') : $AppUI->_('archived');
 }
 $enddate = new w2p_Utilities_Date($end);
 $startdate = new w2p_Utilities_Date($start);
 $actual_end = intval($p['project_actual_end_date']) ? $p['project_actual_end_date'] : $end;
 $columnValues = array('project_name' => $pname, 'start_date' => $start, 'end_date' => $end, 'actual_end' => $actual_end);
 $gantt->addBar($columnValues, $caption, 0.6, $p['project_color_identifier'], $p['project_active'], $progress, $p['project_id']);
 // If showAllGant checkbox is checked
 if ($showAllGantt) {
     // insert tasks into Gantt Chart
     // select for tasks for each project
     $task = new CTask();
     $orderBy = $sortTasksByName ? 'task_name' : 'task_end_date ASC';
     $tasks = $task->getAllowedTaskList($AppUI, $p['project_id'], $orderBy);
     $bestColor = bestColor('#ffffff', '#' . $p['project_color_identifier'], '#000000');
     foreach ($tasks as $t) {
         $name = $t['task_name'];
         $name = mb_strlen($name) > 34 ? mb_substr($name, 0, 30) . '...' : $name;
         //Check if start date exists, if not try giving it the end date.
         //If the end date does not exist then set it for today.
         //This avoids jpgraphs internal errors that render the gantt completely useless
         if ($t['task_start_date'] == '0000-00-00 00:00:00') {
             if ($t['task_end_date'] == '0000-00-00 00:00:00') {
                 $todaydate = new w2p_Utilities_Date();
                 $t['task_start_date'] = $todaydate->format(FMT_TIMESTAMP_DATE);
             } else {
                 $t['task_start_date'] = $t['task_end_date'];
             }
         }
         //Check if end date exists, if not try giving it the start date.
Example #26
0
" />
	<input name="task_project" type="hidden" value="<?php 
echo $task_project;
?>
" />
	<input name='task_contacts' id='task_contacts' type='hidden' value="<?php 
echo $obj->task_contacts;
?>
" />
<tr>
	<td colspan="2" style="border: outset #eeeeee 1px;background-color:#<?php 
echo $project->project_color_identifier;
?>
" >
		<font color="<?php 
echo bestColor($project->project_color_identifier);
?>
">
			<strong><?php 
echo $AppUI->_('Project');
?>
: <?php 
echo @$project->project_name;
?>
</strong>
		</font>
	</td>
</tr>

<tr valign="top" width="50%">
	<td>
Example #27
0
            echo $w2Pconfig['direct_edit_assignment'] ? $cols - 4 : $cols - 1;
            ?>
">
						  <table width="100%" border="0">
							  <tr>
									<!-- patch 2.12.04 display company name next to project name -->
									<td nowrap="nowrap" style="border: outset #eeeeee 1px;background-color:#<?php 
            echo $p['project_color_identifier'];
            ?>
">
										<a href="./index.php?m=projects&amp;a=view&amp;project_id=<?php 
            echo $k;
            ?>
">
											<span style="color:<?php 
            echo bestColor($p['project_color_identifier']);
            ?>
;text-decoration:none;">
											<strong><?php 
            echo $p['company_name'] . ' :: ' . $p['project_name'];
            ?>
</strong></span>
										</a>
									</td>
									<td width="<?php 
            echo 101 - (int) $p['project_percent_complete'];
            ?>
%">
										<?php 
            echo (int) $p['project_percent_complete'];
            ?>
Example #28
0
function showtask(&$arr, $level = 0, $is_opened = true, $today_view = false, $hideOpenCloseLink = false, $allowRepeat = false)
{
    global $AppUI, $query_string, $durnTypes, $userAlloc, $showEditCheckbox;
    global $m, $a, $history_active, $expanded;
    //Check for Tasks Access
    $canAccess = canTaskAccess($arr['task_id'], $arr['task_access'], $arr['task_owner']);
    if (!$canAccess) {
        return false;
    }
    $now = new CDate();
    $tf = $AppUI->getPref('TIMEFORMAT');
    $df = $AppUI->getPref('SHDATEFORMAT');
    $perms =& $AppUI->acl();
    $fdf = $df . ' ' . $tf;
    $show_all_assignees = w2PgetConfig('show_all_task_assignees', false);
    $start_date = intval($arr['task_start_date']) ? new CDate($arr['task_start_date']) : null;
    $end_date = intval($arr['task_end_date']) ? new CDate($arr['task_end_date']) : null;
    $last_update = isset($arr['last_update']) && intval($arr['last_update']) ? new CDate($arr['last_update']) : null;
    // prepare coloured highlight of task time information
    $sign = 1;
    $style = '';
    if ($start_date) {
        if (!$end_date) {
            /*
             ** end date calc has been moved to calcEndByStartAndDuration()-function
             ** called from array_csort and tasks.php
             ** perhaps this fallback if-clause could be deleted in the future,
             ** didn't want to remove it shortly before the 2.0.2
             */
            $end_date = new CDate('0000-00-00 00:00:00');
        }
        if ($now->after($start_date) && $arr['task_percent_complete'] == 0) {
            $style = 'background-color:#ffeebb';
        } elseif ($now->after($start_date) && $arr['task_percent_complete'] < 100) {
            $style = 'background-color:#e6eedd';
        }
        if ($now->after($end_date)) {
            $sign = -1;
            $style = 'background-color:#cc6666;color:#ffffff';
        }
        if ($arr['task_percent_complete'] == 100) {
            $style = 'background-color:#aaddaa; color:#00000';
        }
        $days = $now->dateDiff($end_date) * $sign;
    }
    //     $s = "\n<tr id=\"project_".$arr['task_project'].'_level>'.$level.'<task_'.$arr['task_id']."_\" ".((($level>0 && !($m=='tasks' && $a=='view')) || ($m=='tasks' && ($a=='' || $a=='index'))) ? 'style="display:none"' : '').'>';
    if ($expanded) {
        $s = '<tr id="project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '_" >';
    } else {
        $s = '<tr id="project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '_" ' . ($level > 0 && !($m == 'tasks' && $a == 'view') ? 'style="display:none"' : '') . '>';
    }
    // edit icon
    $s .= '<td align="center">';
    $canEdit = true;
    $canViewLog = true;
    if ($canEdit) {
        $s .= w2PtoolTip('edit task', 'click to edit this task') . '<a href="?m=tasks&a=addedit&task_id=' . $arr['task_id'] . '">' . w2PshowImage('icons/pencil.gif', 12, 12) . '</a>' . w2PendTip();
    }
    $s .= '</td>';
    // pinned
    $pin_prefix = $arr['task_pinned'] ? '' : 'un';
    $s .= '<td align="center"><a href="?m=tasks&pin=' . ($arr['task_pinned'] ? 0 : 1) . '&task_id=' . $arr['task_id'] . '">' . w2PtoolTip('Pin', 'pin/unpin task') . '<img src="' . w2PfindImage('icons/' . $pin_prefix . 'pin.gif') . '" border="0" />' . w2PendTip() . '</a></td>';
    // New Log
    if ($arr['task_log_problem'] > 0) {
        $s .= '<td align="center" valign="middle"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=0&problem=1">' . w2PshowImage('icons/dialog-warning5.png', 16, 16, 'Problem', 'Problem!') . '</a></td>';
    } elseif ($canViewLog && $arr['task_dynamic'] != 1) {
        $s .= '<td align="center"><a href="?m=tasks&a=view&task_id=' . $arr['task_id'] . '&tab=1">' . w2PtoolTip('Add Log', 'create a new log record against this task') . w2PshowImage('edit_add.png') . w2PendTip() . '</a></td>';
    } else {
        $s .= '<td align="center">' . $AppUI->_('-') . '</td>';
    }
    // percent complete and priority
    $s .= '<td align="right">' . intval($arr['task_percent_complete']) . '%</td><td align="center" nowrap="nowrap">';
    if ($arr['task_priority'] < 0) {
        $s .= '<img src="' . w2PfindImage('icons/priority-' . -$arr['task_priority'] . '.gif') . '" />';
    } elseif ($arr['task_priority'] > 0) {
        $s .= '<img src="' . w2PfindImage('icons/priority+' . $arr['task_priority'] . '.gif') . '" />';
    }
    $s .= ($arr['file_count'] > 0 ? '<img src="' . w2PfindImage('clip.png') . '" alt="F" />' : '') . '</td>';
    // dots
    $s .= '<td width="' . ($today_view ? '50%' : '90%') . '">';
    //level
    if ($level == -1) {
        $s .= '...';
    }
    for ($y = 0; $y < $level; $y++) {
        if ($y + 1 == $level) {
            $s .= '<img src="' . w2PfindImage('corner-dots.gif') . '" width="16" height="12" border="0">';
        } else {
            $s .= '<img src="' . w2PfindImage('shim.gif') . '" width="16" height="12"  border="0">';
        }
    }
    if ($arr['task_description']) {
        $s .= w2PtoolTip('Task Description', $arr['task_description'], true);
    }
    $open_link = '<a href="javascript: void(0);"><img onclick="expand_collapse(\'project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '_\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '__collapse" src="' . w2PfindImage('icons/collapse.gif') . '" border="0" align="center" ' . (!$expanded ? 'style="display:none"' : '') . ' /><img onclick="expand_collapse(\'project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '_\', \'tblProjects\',\'\',' . ($level + 1) . ');" id="project_' . $arr['task_project'] . '_level>' . $level . '<task_' . $arr['task_id'] . '__expand" src="' . w2PfindImage('icons/expand.gif') . '" border="0" align="center" ' . ($expanded ? 'style="display:none"' : '') . ' /></a>';
    if ($arr['task_nr_of_children']) {
        $is_parent = true;
    } else {
        $is_parent = false;
    }
    if ($arr['task_milestone'] > 0) {
        $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b>' . $arr['task_name'] . '</b></a> <img src="' . w2PfindImage('icons/milestone.gif') . '" border="0" /></td>';
    } elseif ($arr['task_dynamic'] == '1' || $is_parent) {
        if (!$today_view) {
            $s .= $open_link;
        }
        if ($arr['task_dynamic'] == '1') {
            $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" ><b><i>' . $arr['task_name'] . '</i></b></a></td>';
        } else {
            $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a></td>';
        }
    } else {
        $s .= '&nbsp;<a href="./index.php?m=tasks&a=view&task_id=' . $arr['task_id'] . '" >' . $arr['task_name'] . '</a></td>';
    }
    if ($arr['task_description']) {
        $s .= w2PendTip();
    }
    if ($today_view) {
        // Show the project name
        $s .= '<td width="50%"><a href="./index.php?m=projects&a=view&project_id=' . $arr['task_project'] . '">' . '<span style="padding:2px;background-color:#' . $arr['project_color_identifier'] . ';color:' . bestColor($arr['project_color_identifier']) . '">' . $arr['project_name'] . '</span>' . '</a></td>';
    }
    // task owner
    if (!$today_view) {
        $s .= '<td nowrap="nowrap" align="center">' . '<a href="?m=admin&a=viewuser&user_id=' . $arr['user_id'] . '">' . $arr['owner'] . '</a>' . '</td>';
    }
    if (isset($arr['task_assigned_users']) && ($assigned_users = $arr['task_assigned_users'])) {
        $a_u_tmp_array = array();
        if ($show_all_assignees) {
            $s .= '<td align="center">';
            foreach ($assigned_users as $val) {
                $a_u_tmp_array[] = '<a href="?m=admin&a=viewuser&user_id=' . $val['user_id'] . '"' . 'title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$val['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$val['user_id']]['freeCapacity'] . '%' : '') . '">' . $val['assignee'] . ' (' . $val['perc_assignment'] . '%)</a>';
            }
            $s .= join(', ', $a_u_tmp_array) . '</td>';
        } else {
            $s .= '<td align="center" nowrap="nowrap">' . '<a href="?m=admin&a=viewuser&user_id=' . $assigned_users[0]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[0]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[0]['user_id']]['freeCapacity'] . '%' : '') . '">' . $assigned_users[0]['assignee'] . ' (' . $assigned_users[0]['perc_assignment'] . '%)</a>';
            if ($arr['assignee_count'] > 1) {
                $s .= ' <a href="javascript: void(0);" onclick="toggle_users(' . "'users_" . $arr['task_id'] . "'" . ');" title="' . join(', ', $a_u_tmp_array) . '">(+' . ($arr['assignee_count'] - 1) . ')</a>' . '<span style="display: none" id="users_' . $arr['task_id'] . '">';
                $a_u_tmp_array[] = $assigned_users[0]['assignee'];
                for ($i = 1, $i_cmp = count($assigned_users); $i < $i_cmp; $i++) {
                    $a_u_tmp_array[] = $assigned_users[$i]['assignee'];
                    $s .= '<br /><a href="?m=admin&a=viewuser&user_id=' . $assigned_users[$i]['user_id'] . '" title="' . (w2PgetConfig('check_overallocation') ? $AppUI->_('Extent of Assignment') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['charge'] . '%; ' . $AppUI->_('Free Capacity') . ':' . $userAlloc[$assigned_users[$i]['user_id']]['freeCapacity'] . '%' : '') . '">' . $assigned_users[$i]['assignee'] . ' (' . $assigned_users[$i]['perc_assignment'] . '%)</a>';
                }
                $s .= '</span>';
            }
            $s .= '</td>';
        }
    } elseif (!$today_view) {
        // No users asigned to task
        $s .= '<td align="center">-</td>';
    }
    // duration or milestone
    $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($start_date ? $start_date->format($fdf) : '-') . '</td>' . '<td align="right" nowrap="nowrap" style="' . $style . '">' . $arr['task_duration'] . ' ' . mb_substr($AppUI->_($durnTypes[$arr['task_duration_type']]), 0, 1) . '</td>' . '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($end_date ? $end_date->format($fdf) : '-') . '</td>';
    if ($today_view) {
        $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . $arr['task_due_in'] . '</td>';
    } elseif ($history_active) {
        $s .= '<td nowrap="nowrap" align="center" style="' . $style . '">' . ($last_update ? $last_update->format($fdf) : '-') . '</td>';
    }
    // Assignment checkbox
    if ($showEditCheckbox) {
        $s .= '<td align="center">' . '<input type="checkbox" name="selected_task[' . $arr['task_id'] . ']" value="' . $arr['task_id'] . '"/></td>';
    }
    $s .= '</tr>';
    echo $s;
}
Example #29
0
                    $graph->Add($bar2);
                }
                //Insert workers for each task into Gantt Chart
                $q->addTable('user_tasks', 't');
                $q->addQuery('DISTINCT user_username, t.task_id');
                $q->addJoin('users', 'u', 'u.user_id = t.user_id');
                $q->addWhere('t.task_id = ' . $t['task_id']);
                $q->addOrder('user_username ASC');
                $workers = $q->loadList();
                $q->clear();
                $workersName = '';
                foreach ($workers as $w) {
                    $workersName .= ' ' . $w['user_username'];
                    $bar3 = new GanttBar($row++, array('   * ' . $w['user_username'], ' ', ' ', ' '), $tStartObj->format(FMT_DATETIME_MYSQL), $tEndObj->format(FMT_DATETIME_MYSQL), 0.6);
                    $bar3->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
                    $bar3->title->SetColor(bestColor('#ffffff', '#' . $p['project_color_identifier'], '#000000'));
                    $bar3->SetFillColor('#' . $p['project_color_identifier']);
                    $graph->Add($bar3);
                }
                //End of insert workers for each task into Gantt Chart
            }
            unset($tasks);
            //End of insert tasks into Gantt Chart
        }
        //End of if showAllGant checkbox is checked
    }
}
// End of check for valid projects array.
unset($projects);
$today = date('y-m-d');
$vline = new GanttVLine($today, $AppUI->_('Today', UI_OUTPUT_RAW));
Example #30
0
$df = $AppUI->getPref('SHDATEFORMAT');
$tf = $AppUI->getPref('TIMEFORMAT');
$start_date = $AppUI->formatTZAwareTime($forum->forum_create_date, $df);
// setup the title block
$titleBlock = new CTitleBlock('Forum', 'support.png', $m, $m . '.' . $a);
$titleBlock->addCell(arraySelect($filters, 'f', 'size="1" class="text" onchange="document.filterFrm.submit();"', $f, true), '', '<form action="?m=forums&a=viewer&forum_id=' . $forum_id . '" method="post" name="filterFrm" accept-charset="utf-8">', '</form>');
$titleBlock->show();
?>
<table width="100%" cellspacing="0" cellpadding="2" border="0" class="std">
    <tr>
        <td height="20" colspan="3" style="border: outset #D1D1CD 1px;background-color:#<?php 
echo $forum->project_color_identifier;
?>
">
            <font size="2" color="<?php 
echo bestColor($forum->project_color_identifier);
?>
"><strong><?php 
echo $forum->forum_name;
?>
</strong></font>
        </td>
    </tr>
    <tr>
        <td align="left" nowrap="nowrap"><?php 
echo $AppUI->_('Related Project');
?>
:</td>
        <td nowrap="nowrap"><strong><?php 
echo $forum->project_name ? $forum->project_name : 'No associated project';
?>