In need of help, plz

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I've been working on a script to contain a monthly/weekly schema. The script is only starting from the start and stop unix timestamps for every task.

Now I'm having the problem of displaying the tasks properly.
For the time being, all tasks on a specific day gets its own column, but I want them to only appear in a new column if they collide with another task.


Example:   (example viewn with Courier New)
  (Now)      (Should be)
|--------|   |--------|
|11      |   |11111111|
|        |   |        |
|  22    |   |2222    |
|  22  44|   |22224444|
|      44|   |    4444|
|    3344|   |33334444|
|      44|   |    4444|
|      44|   |    4444|
|--------|   |--------|

Im using <div> tags and absolute positions, Here is my current "collision script":
#The $printTask is built up as follows
#$printTask[day_of_week][unique_task_id] = settings_for_this
#unique_task_id is allways different
#settings_for_this contains:
# sx = starting y position
# sy = starting x position
# ey = ending y position
# id = says wich task the settings are made for, different from unique_task_id
##_BEGIN_CODE_##
if(is_array($printTask)) ksort($printTask);
foreach($printTask as $id_1 => $day){
if(is_array($printTask[$id_3])) ksort($printTask[$id_3]);
ksort($day);
print n();
foreach($day as $id_2 => $task){
$width = 100;
$collides = array();
foreach($day as $id_3 => $task2){
if($id_3 != $id_2){
if($task['sy'] <= $task2['sy'] && $task['ey'] >= ($task2['ey'] + $task2['sy'])){
if(is_array($printTask[$id_1][$id_3]['c']) && in_array("c_data_".$task['id'],$printTask[$id_1][$id_3]['c'])){
$printTask[$id_1][$id_2]['l'][] = "c_data_".$task2['id'];
}else{
$printTask[$id_1][$id_2]['c'][] = "c_data_".$task2['id'];
}
}elseif($task['sy'] >= $task2['sy'] && $task['ey'] <= ($task2['ey'] + $task2['sy'])){
if(is_array($printTask[$id_1][$id_3]['c']) && in_array("c_data_".$task['id'],$printTask[$id_1][$id_3]['c'])){
$printTask[$id_1][$id_2]['l'][] = "c_data_".$task2['id'];
}else{
$printTask[$id_1][$id_2]['c'][] = "c_data_".$task2['id'];
}
}
}
}
}
}
#drawarray($printTask);
$fe['max'] = arrayMax($fe['tasks']);
foreach($printTask as $id_1 => $day){
foreach($day as $id_2 => $task){
$w = 0; $l = 0; $c = 0;
if(isset($task['c'])){
$w+= count($task['c']);
$c = count($task['c']);
}
if(isset($task['l'])){
$w+= count($task['l']);
$l = count($task['l']);
}
$width = 100;
if($w > 0) $width = (int)(100 / ($w + 1))+($w == $l?$l:0);
$left = 67 + ($id_1 * 101);
if($l > 0) $left+= (int)((100 / ($w + 1)) * $l) - $l;
printDiv($left, $task['sy'], makeColor($fe['max'] + 1, $task['id']), $task['ey'], $width, $task['id'], 0, 0, $task['cf'], $task['cb']);
}
}


##_END_CODE_##




I hope you will be able to help me, I've gotten gray hairs over this one //SIEGFRIED

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux