예제 #1
0
                    $level = $gantt_arr[$p['project_id']][$i][1];
                    if ($t['task_end_date'] == null) {
                        $t['task_end_date'] = $t['task_start_date'];
                    }
                    $tStart = $t['task_start_date'] > '0000-00-00 00:00:00' ? $t['task_start_date'] : date('Y-m-d H:i:s');
                    $tEnd = $t['task_end_date'] > '0000-00-00 00:00:00' ? $t['task_end_date'] : date('Y-m-d H:i:s');
                    $tStartObj = new w2p_Utilities_Date($tStart);
                    $tEndObj = new w2p_Utilities_Date($tEnd);
                    if ($t['task_milestone'] != 1) {
                        $advance = str_repeat('  ', $level + 2);
                        $name = mb_strlen($advance . $t['task_name']) > 35 ? mb_substr($advance . $t['task_name'], 0, 33) . '...' : $advance . $t['task_name'];
                        $height = $t['task_dynamic'] == 1 ? 0.1 : 0.6;
                        $columnValues = array('project_name' => $name, 'start_date' => $tStartObj->getDate(), 'end_date' => $tEndObj->getDate(), 'actual_end' => '');
                        $gantt->addBar($columnValues, '', $height, $p['project_color_identifier'], $p['project_active'], $progress, $p['project_id']);
                    } else {
                        $name = $advance . '* ' . $t['task_name'];
                        $milestone = substr($t['task_start_date'], 0, 10);
                        $milestoneDate = new w2p_Utilities_Date($milestone);
                        $gantt->addMilestone(array($name, '', $milestoneDate->format($df)), $t['task_start_date']);
                    }
                    // End of insert workers for each task into Gantt Chart
                }
                // End of insert tasks into Gantt Chart
            }
            // End of if showAllGant checkbox is checked
        }
    }
    // End of check for valid projects array.
}
$gantt->render();
예제 #2
0
                $columnValues = array('task_name' => $name);
            } else {
                if ($caller == 'todo') {
                    $columnValues = array('task_name' => $name, 'project_name' => $pname, 'duration' => $dur, 'start_date' => $start, 'end_date' => $end, 'actual_end' => '');
                } else {
                    $columnValues = array('task_name' => $name, 'duration' => $dur, 'start_date' => $start, 'end_date' => $end, 'actual_end' => '');
                }
            }
            $gantt->addBar($columnValues, $caption, $height, '8F8FBD', true, $progress, $a['task_id']);
        }
        $q->clear();
    }
    unset($gts);
    $filename = W2P_BASE_DIR . "/files/temp/GanttPDF" . md5(time()) . ".png";
    // Prepare Gantt image and store in $filename
    $gantt->render(true, $filename);
    $outpfiles[] = $filename;
    $page++;
}
//Override of some variables, not very tidy but necessary when importing code from other sources...
$skip_page = 0;
$do_report = 1;
$show_task = 1;
$show_assignee = 1;
$show_gantt = 1;
$show_gantt_taskdetails = $showTaskNameOnly == '1' ? 0 : 1;
$ganttfile = $outpfiles;
// Initialize PDF document
$font_dir = W2P_BASE_DIR . '/lib/ezpdf/fonts';
$temp_dir = W2P_BASE_DIR . '/files/temp';
$base_url = w2PgetConfig('base_url');