Esempio n. 1
0
 $myintvars = array('priority_id', 'duration', 'duration_type_id', 'status_id', 'progress_id', 'progress', 'resource', 'parent_task');
 $newrec = array_merge($newrec, ppGetData($myintvars, false, 'POST', 'int'));
 // Basic Text Variables which should not contain quote's or other special characters
 $myvars = array('start_date', 'estimated_end_date', 'actual_end_date', 'planned_end_date', 'last_updated_date', 'notification_enabled_flag', 'make_private_enabled_flag');
 $newrec = array_merge($newrec, ppGetData($myvars, false, 'POST'));
 // Convert Date to a timestamp
 $newrec['start_date'] = pm_convertdate($newrec['start_date']);
 $newrec['estimated_end_date'] = pm_convertdate($newrec['estimated_end_date']);
 if ($newrec['actual_end_date'] == '') {
     $newrec['actual_end_date'] = $newrec['estimated_end_date'];
 } else {
     $newrec['actual_end_date'] = pm_convertdate($newrec['actual_end_date']);
 }
 $newrec['planned_end_date'] = pm_convertdate($newrec['planned_end_date']);
 $newrec['create_date'] = pm_getdate();
 $newrec['last_updated_date'] = pm_getdate();
 if ($newrec['actual_end_date'] < $newrec['start_date']) {
     $newrec['actual_end_date'] = $newrec['start_date'] + 604800;
     //add 1 week to the start date...
 }
 if ($newrec['estimated_end_date'] < $newrec['start_date']) {
     $newrec['estimated_end_date'] = $newrec['start_date'] + 604800;
     //add 1 week to the start date...
 }
 $newrec['tid'] = prj_insertTask($pid, $parent_task);
 // Insert the new record and update the lhs and rhs values
 prj_updateTask($newrec);
 // Update the new record values
 if (empty($newrec['resource'])) {
     DB_query("INSERT INTO {$_TABLES['prj_task_users']} (tid, uid, role) VALUES ('{$newrec['tid']}', {$uid}, 'o')");
 } else {
Esempio n. 2
0
function pm_convertdate($date)
{
    if (trim($date) == '' or $date == 0) {
        return pm_getdate();
    }
    $tok = strtok($date, " /-\\:");
    while ($tok !== FALSE) {
        $toks[] = $tok;
        $tok = strtok(" /-\\:");
    }
    if ($toks[0] == 1969) {
        //  Assume this is an invalid date - return today
        return pm_getdate();
    } else {
        return $timestamp = mktime(0, 0, 0, $toks[1], $toks[2], $toks[0]);
        //return strtotime($date);
    }
}
Esempio n. 3
0
     break;
 case 'create':
     // Filter Incoming Variables and make them global
     // Text Variables which may contain quote's or other special characters
     $_CLEAN = array();
     $mytextvars = array('name', 'description', 'keywords');
     $_CLEAN = array_merge($_CLEAN, ppGetData($mytextvars, false, 'POST', 'text'));
     // Integer only Variables
     $myintvars = array('priority', 'status', 'progress', 'objective', 'percent', 'location', 'department', 'category', 'resources', 'department');
     $_CLEAN = array_merge($_CLEAN, ppGetData($myintvars, false, 'POST', 'int'));
     // Basic Text Variables which should not contain quote's or other special characters
     $myvars = array('start_date', 'estimated_end_date', 'actual_end_date', 'notification', 'document', 'forum', 'private', 'template');
     $_CLEAN = array_merge($_CLEAN, ppGetData($myvars, false, 'POST'));
     $uid = $_USER['uid'];
     $_CLEAN['percent'] = $_CLEAN['percent'] < 0 ? 0 : $_CLEAN['percent'] > 100 ? 100 : $_CLEAN['percent'];
     $_CLEAN['createdate'] = pm_getdate();
     $_CLEAN['startdate'] = pm_convertdate($_CLEAN['start_date']);
     $_CLEAN['estimateddate'] = pm_convertdate($_CLEAN['estimated_end_date']);
     if ($_CLEAN['actual_end_date'] == '') {
         $_CLEAN['actual_end_date'] = $_CLEAN['estimated_end_date'];
     } else {
         $_CLEAN['actual_end_date'] = pm_convertdate($_CLEAN['actual_end_date']);
     }
     if ($_CLEAN['actual_end_date'] < $_CLEAN['startdate']) {
         $_CLEAN['actual_end_date'] = $_CLEAN['startdate'] + 604800;
         //add 1 week to the start date...
     }
     if ($_CLEAN['estimateddate'] < $_CLEAN['startdate']) {
         $_CLEAN['estimateddate'] = $_CLEAN['startdate'] + 604800;
         //add 1 week to the start date...
     }