⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index1.php

📁 通达网络办公 - Office Anywhere 2008 增强版100%源码(3.4.081216) 内含 通达OA2008增強版接近完美破解补丁20081216集 及 最新通达OA2008ADV(
💻 PHP
字号:
<?php

function showgtask( &$a, $level = 0 )
{
	global $gantt_arr;
	$gantt_arr[] = array(
		$a,
		$level
	);
}

function findgchild( &$tarr, $parent, $level = 0 )
{
	global $projects;
	$level += 1;
	$n = count( $tarr );
	$x = 0;
	for ( ;	$x < $n;	++$x	)
	{
		if ( !( $tarr[$x]['task_parent'] == $parent ) && !( $tarr[$x]['task_parent'] != $tarr[$x]['task_id'] ) )
		{
			showgtask( &$tarr[$x], $level );
			findgchild( $tarr, $tarr[$x]['task_id'], $level );
		}
	}
}

include_once( "inc/auth.php" );
include( "inc/jpgraph/jpgraph.php" );
include( "inc/jpgraph/jpgraph_gantt.php" );
( $width );
$graph = new GanttGraph( );
$graph->ShowHeaders( GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK );
$graph->SetFrame( FALSE );
$graph->SetBox( TRUE, array( 0, 0, 0 ), 2 );
$graph->scale->week->SetStyle( WEEKSTYLE_FIRSTDAY );
if ( $start_date && $end_date )
{
	$graph->SetDateRange( $start_date, $end_date );
}
setjpgraphfonthelper( $graph->scale->actinfo );
$graph->scale->actinfo->vgrid->SetColor( "gray" );
$graph->scale->actinfo->SetColor( "darkgray" );
if ( $caller == "todo" )
{
	if ( $showWork == "1" )
	{
		$graph->scale->actinfo->SetColTitles( array(
			$AppUI->_( "Task name", UI_OUTPUT_RAW ),
			$AppUI->_( "Project name", UI_OUTPUT_RAW ),
			$AppUI->_( "Work", UI_OUTPUT_RAW ),
			$AppUI->_( "Start", UI_OUTPUT_RAW ),
			$AppUI->_( "Finish", UI_OUTPUT_RAW )
		), array( 180, 50, 60, 60, 60 ) );
	}
	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( 230, 60, 60, 60 ) );
}
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( 230, 60, 60, 60 ) );
}
$graph->scale->tableTitle->Set( $projects[$project_id]['project_name'] );
setjpgraphfonthelper( $graph->scale->tableTitle, FS_BOLD, 12 );
$graph->scale->SetTableTitleBackground( "#".$projects[$project_id]['project_color_identifier'] );
$graph->scale->tableTitle->Show( TRUE );
if ( $start_date && $end_date )
{
	( $start_date );
	$min_d_start = new CDate( );
	( $end_date );
	$max_d_end = new CDate( );
	$graph->SetDateRange( $start_date, $end_date );
}
else
{
	( );
	$d_start = new CDate( );
	( );
	$d_end = new CDate( );
	$i = 0;
	for ( ;	$i < count( $gantt_arr );	++$i	)
	{
		$a = $gantt_arr[$i][0];
		$start = substr( $a['task_start_date'], 0, 10 );
		$end = substr( $a['task_end_date'], 0, 10 );
		$d_start->Date( $start );
		$d_end->Date( $end );
		if ( $i == 0 )
		{
			$min_d_start = $d_start;
			$max_d_end = $d_end;
		}
		else
		{
			if ( 0 < Date::compare( $min_d_start, $d_start ) )
			{
				$min_d_start = $d_start;
			}
			if ( Date::compare( $max_d_end, $d_end ) < 0 )
			{
				$max_d_end = $d_end;
			}
		}
	}
}
$day_diff = $min_d_start->dateDiff( $max_d_end );
if ( 240 < $day_diff )
{
	$graph->ShowHeaders( GANTT_HYEAR | GANTT_HMONTH );
}
else if ( 90 < $day_diff )
{
	$graph->ShowHeaders( GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK );
	$graph->scale->week->SetStyle( WEEKSTYLE_WNBR );
}
reset( &$projects );
foreach ( $projects as $p )
{
	$tnums = count( $p['tasks'] );
	$i = 0;
	for ( ;	$i < $tnums;	++$i	)
	{
		$t = $p['tasks'][$i];
		if ( $t['task_parent'] == $t['task_id'] )
		{
			showgtask( &$t );
			findgchild( &$p['tasks'], $t['task_id'] );
		}
	}
}
$hide_task_groups = FALSE;
if ( $hide_task_groups )
{
	$i = 0;
	for ( ;	$i < count( $gantt_arr );	++$i	)
	{
		if ( !( $i != count( $gantt_arr ) - 1 ) && !( $gantt_arr[$i][1] < $gantt_arr[$i + 1][1] ) )
		{
			array_splice( &$gantt_arr, $i, 1 );
		}
	}
}
$row = 0;
$i = 0;
for ( ;	$i < count( $gantt_arr );	++$i	)
{
	$a = $gantt_arr[$i][0];
	$level = $gantt_arr[$i][1];
	if ( $hide_task_groups )
	{
		$level = 0;
	}
	$name = $a['task_name'];
	if ( $locale_char_set == "utf-8" )
	{
		$name = 17 < utf8_strlen( $name ) ? utf8_substr( $name, 0, 16 )."..." : $name;
	}
	else
	{
		$name = 34 < strlen( $name ) ? substr( $name, 0, 33 )."..." : $name;
	}
	$name = str_repeat( " ", $level ).$name;
	if ( $caller == "todo" )
	{
		$pname = $a['project_name'];
		if ( $locale_char_set == "utf-8" )
		{
			$pname = 14 < utf8_strlen( $pname ) ? utf8_substr( $pname, 0, 5 )."...".utf8_substr( $pname, -5, 5 ) : $pname;
		}
		else
		{
			$pname = 14 < strlen( $pname ) ? substr( $pname, 0, 5 )."...".substr( $pname, -5, 5 ) : $pname;
		}
	}
	$start = $a['task_start_date'];
	$end_date = $a['task_end_date'];
	( $end_date );
	$end_date = new CDate( );
	$end = $end_date->getDate( );
	( $start );
	$start = new CDate( );
	$start = $start->getDate( );
	$progress = $a['task_percent_complete'] + 0;
	if ( 100 < $progress )
	{
		$progress = 100;
	}
	else if ( $progress < 0 )
	{
		$progress = 0;
	}
	$flags = $a['task_milestone'] ? "m" : "";
	$cap = "";
	if ( !$start && $start == "0000-00-00" )
	{
		$start = !$end ? date( "Y-m-d" ) : $end;
		$cap .= "(no start date)";
	}
	if ( !$end )
	{
		$end = $start;
		$cap .= " (no end date)";
	}
	else
	{
		$cap = "";
	}
	$caption = "";
	if ( $showLabels == "1" )
	{
		( );
		$q = new DBQuery( );
		$q->addTable( "user_tasks", "ut" );
		$q->addTable( "users", "u" );
		$q->addQuery( "ut.task_id, u.user_username, ut.perc_assignment" );
		$q->addWhere( "u.user_id = ut.user_id" );
		$q->addWhere( "ut.task_id = ".$a['task_id'] );
		$res = $q->loadList( );
		foreach ( $res as $rw )
		{
			switch ( $rw['perc_assignment'] )
			{
			case 100 :
				$caption = $caption.$rw['user_username'].";";
				break;
			default :
				$caption = $caption.$rw['user_username']."[".$rw['perc_assignment']."%];";
			}
		}
		$q->clear( );
		$caption = substr( $caption, 0, strlen( $caption ) - 1 );
	}
	if ( $flags == "m" )
	{
		( $start );
		$start = new CDate( );
		$start->addDays( 0 );
		$s = $start->format( $df );
		if ( $caller == "todo" )
		{
			( $row++, array(
				$name,
				$pname,
				"",
				substr( $s, 0, 10 ),
				substr( $s, 0, 10 )
			), $a['task_start_date'], $s );
			$bar = new MileStone( );
		}
		else
		{
			( $row++, array(
				$name,
				"",
				substr( $s, 0, 10 ),
				substr( $s, 0, 10 )
			), $a['task_start_date'], $s );
			$bar = new MileStone( );
		}
		setjpgraphfonthelper( $bar->title, FS_NORMAL, 9 );
		if ( $showLabels == "1" )
		{
			$caption = $start->format( $df );
		}
		$bar->title->SetColor( "#CC0000" );
		$graph->Add( $bar );
	}
	else
	{
		$type = $a['task_duration_type'];
		$dur = $a['task_duration'];
		if ( $type == 24 )
		{
			$dur *= $dPconfig['daily_working_hours'];
		}
		if ( $showWork == "1" )
		{
			$work_hours = 0;
			( );
			$q = new DBQuery( );
			$q->addTable( "tasks", "t" );
			$q->addJoin( "user_tasks", "u", "t.task_id = u.task_id" );
			$q->addQuery( "ROUND(SUM(t.task_duration*u.perc_assignment/100),2) AS wh" );
			$q->addWhere( "t.task_duration_type = 24" );
			$q->addWhere( "t.task_id = ".$a['task_id'] );
			$wh = $q->loadResult( );
			$work_hours = $wh * $dPconfig['daily_working_hours'];
			$q->clear( );
			( );
			$q = new DBQuery( );
			$q->addTable( "tasks", "t" );
			$q->addJoin( "user_tasks", "u", "t.task_id = u.task_id" );
			$q->addQuery( "ROUND(SUM(t.task_duration*u.perc_assignment/100),2) AS wh" );
			$q->addWhere( "t.task_duration_type = 1" );
			$q->addWhere( "t.task_id = ".$a['task_id'] );
			$wh2 = $q->loadResult( );
			$work_hours += $wh2;
			$q->clear( );
			$dur = $work_hours;
		}
		$dur .= " h";
		( $end );
		$enddate = new CDate( );
		( $start );
		$startdate = new CDate( );
		if ( $caller == "todo" )
		{
			( $row++, array(
				$name,
				$pname,
				$dur,
				$startdate->format( $df ),
				$enddate->format( $df )
			), substr( $start, 2, 8 ), substr( $end, 2, 8 ), $cap, $a['task_dynamic'] == 1 ? 0.1 : 0.6 );
			$bar = new GanttBar( );
		}
		else
		{
			( $row++, array(
				$name,
				$dur,
				$startdate->format( $df ),
				$enddate->format( $df )
			), substr( $start, 2, 8 ), substr( $end, 2, 8 ), $cap, $a['task_dynamic'] == 1 ? 0.1 : 0.6 );
			$bar = new GanttBar( );
		}
		$bar->progress->Set( min( $progress / 100, 1 ) );
		setjpgraphfonthelper( $bar->title, FS_NORMAL, 9 );
		if ( $a['task_dynamic'] == 1 )
		{
			setjpgraphfonthelper( $bar->title, FS_NORMAL, 9 );
			$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" );
		}
	}
	( $caption );
	$bar->caption = new TextProperty( );
	$bar->caption->Align( "left", "center" );
	if ( 100 <= $progress && $end_date->isPast( ) && get_class( $bar ) == "ganttbar" )
	{
		$bar->caption->SetColor( "darkgray" );
		$bar->title->SetColor( "darkgray" );
		$bar->setColor( "darkgray" );
		$bar->SetFillColor( "darkgray" );
		$bar->SetPattern( BAND_SOLID, "gray" );
		$bar->progress->SetFillColor( "darkgray" );
		$bar->progress->SetPattern( BAND_SOLID, "gray", 98 );
	}
	( );
	$q = new DBQuery( );
	$q->addTable( "task_dependencies" );
	$q->addQuery( "dependencies_task_id" );
	$q->addWhere( "dependencies_req_task_id=".$a['task_id'] );
	$query = $q->loadList( );
	foreach ( $query as $dep )
	{
		$d = 0;
		for ( ;	$d < count( $gantt_arr );	++$d	)
		{
			if ( $gantt_arr[$d][0]['task_id'] == $dep['dependencies_task_id'] )
			{
				$bar->SetConstrain( $d, CONSTRAIN_ENDSTART );
			}
		}
	}
	$q->clear( );
	$graph->Add( $bar );
}
$today = date( "y-m-d" );
( $today, $AppUI->_( "Today", UI_OUTPUT_RAW ) );
$vline = new GanttVLine( );
setjpgraphfonthelper( $vline->title, FS_BOLD, 10 );
$graph->Add( $vline );
$graph->Stroke( );
echo "?>";
?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -