예제 #1
0
/**
LINK TYPES -
				SS . Start to Start
				SF . Start to Finish  
				FS . Finish to Start
				FF . Finish to Finish
	params:
	$session_hash
	$group_project_id (subproject_id)
	$tasks = 
		array(
			id=>1,
			msproj_id=>p1,
			parent_id=>4,
			parent_msproj_id=>p5
			name=>'Task Name',
			duration=>5,
			work=>40,
			start_date=>'10/1/04',
			end_date=>'10/8/04',
			percent_complete=>'50',
			priority=>'medium',
			resources=>array(
				array(user_name=>'unix_name'),
				...
			),
			dependenton=>array(
				array( 'task_id'=>'55', 'msproj_id'=44, 'task_name'=>'Task Name', 'link_type'='SS' ),
				...
			)
			notes=>'notes'
		),
Return:
	$array[success]=true;
**OR**
	$array[success]=false;
	$array[errormessage]='Invalid Subproject';
	$array[resourcename]=array(
			'Michael',
			'Jon',
			...
		)
	$array[usernames]=array(
			array(user_id=>55,user_name='Jon Doe'),
			array(user_id=>87,user_name='Foo'),
			...
		)
*/
function &MSPCheckin($session_hash, $group_project_id, $tasks)
{
    global $primap;
    printr($tasks, 'MSPCheckin::in-tasks');
    if (!session_continue($session_hash)) {
        $array['success'] = false;
        $array['errormessage'] = 'Could Not Continue Session';
    }
    return pm_import_tasks($group_project_id, $tasks);
}
예제 #2
0
<?php

require_once $gfcommon . 'pm/import_utils.php';
$input_file = getUploadedFile('userfile');
if (is_uploaded_file($input_file['tmp_name'])) {
    $size = $input_file['size'];
    $handle = fopen($input_file['tmp_name'], 'r');
    $tasks = array();
    while (($cols = fgetcsv($handle, 4096, ",")) !== FALSE) {
        $resources = array();
        for ($i = 12; $i < 17; $i++) {
            if (trim($cols[$i]) != '') {
                $resources[] = array('user_name' => $cols[$i]);
            }
        }
        $dependentOn = array();
        for ($i = 17; $i < 30; $i = $i + 3) {
            if (trim($cols[$i]) != '') {
                $dependentOn[] = array('task_id' => $cols[$i], 'msproj_id' => $cols[$i + 1], 'task_name' => '', 'link_type' => $cols[$i + 2]);
            }
        }
        $tasks[] = array('id' => $cols[0], 'msproj_id' => $cols[1], 'parent_id' => $cols[2], 'parent_msproj_id' => $cols[3], 'name' => $cols[4], 'duration' => $cols[5], 'work' => $cols[6], 'start_date' => $cols[7], 'end_date' => $cols[8], 'percent_complete' => $cols[9], 'priority' => $cols[10], 'resources' => $resources, 'dependenton' => $dependentOn, 'notes' => $cols[11]);
    }
}
$res =& pm_import_tasks($group_project_id, &$tasks);
if ($res['success']) {
    $feedback .= 'Import Was Successful';
} else {
    $feedback .= $res['errormessage'];
}