You are here: In need of help, plz « PHP « IT news, forums, messages
In need of help, plz

Posted by Siegfried on 04/12/05 15:25

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация