55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
|
|
<?
|
||
|
|
require_once("../../config.php");
|
||
|
|
|
||
|
|
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||
|
|
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||
|
|
function getList($type)
|
||
|
|
{
|
||
|
|
$i=0;
|
||
|
|
if($type=="tasks")$status="Completed";
|
||
|
|
else $status="Held";
|
||
|
|
$w=mysql_query("select * from ".$type." where deleted='0' and status!='".$status."' order by date_start desc, time_start asc");
|
||
|
|
while($r=mysql_fetch_array($w))
|
||
|
|
{
|
||
|
|
if($r['date_start']<date("Y-m-d"))
|
||
|
|
{
|
||
|
|
$name[$i]['date_start']=$r['date_start'];
|
||
|
|
$name[$i]['time_start']=$r['time_start'];
|
||
|
|
$name[$i]['name']=$r['name'];
|
||
|
|
$name[$i]['id']=$r['id'];
|
||
|
|
$name[$i]['type']=$type;
|
||
|
|
$i++;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
return $name;
|
||
|
|
}
|
||
|
|
$meetings=getList("meetings");
|
||
|
|
$calls=getList("calls");
|
||
|
|
$tasks=getList("tasks");
|
||
|
|
|
||
|
|
for($i=0;$i<count($meetings);$i++)$name[]=$meetings[$i];
|
||
|
|
for($i=0;$i<count($calls);$i++)$name[]=$calls[$i];
|
||
|
|
for($i=0;$i<count($tasks);$i++)$name[]=$tasks[$i];
|
||
|
|
rsort($name);
|
||
|
|
foreach($name as $value)
|
||
|
|
{
|
||
|
|
if($value['type']=="meetings")
|
||
|
|
{
|
||
|
|
$img="Meetings";
|
||
|
|
$status="Held";
|
||
|
|
}
|
||
|
|
if($value['type']=="calls")
|
||
|
|
{
|
||
|
|
$img="Calls";
|
||
|
|
$status="Held";
|
||
|
|
}
|
||
|
|
if($value['type']=="tasks")
|
||
|
|
{
|
||
|
|
$img="Tasks";
|
||
|
|
$status="Completed";
|
||
|
|
}
|
||
|
|
mysql_query("update ".$value['type']." set status='".$status."' where id='".$value['id']."'");
|
||
|
|
}
|
||
|
|
header("Location: ReminderWindow.php");
|
||
|
|
mysql_close($sql);
|
||
|
|
?>
|