Location: PHPKode > projects > O - OpenSource GroupWare > osgw/tasklist/edit_task.php
<?php
/**************************************************************************
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
/*$Id: edit_task.php,v 1.20 2003/12/10 20:42:29 rthomp Exp $*/

include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.tasklist.php");
$tasks = new tasklist;


if(isset($_POST['save']))
{

	if($tasks->verify_fields($_POST['summary'], $_POST['description']))
	{
		$tasks->update($_GET['tid'], $_POST);
	}
}

echo $layout->page_header;
echo $layout->service_header($text['service_name'], $tasks->nav_buttons(), $text['add_task']);

$sql = "SELECT * FROM o_categorize LEFT JOIN o_categories ON o_categories.category_id=o_categorize.category
	LEFT JOIN o_tasklist ON o_tasklist.task_id=o_categorize.id LEFT JOIN o_users ON o_tasklist.user_id=o_users.user_id
	WHERE o_tasklist.task_id='{$_GET['tid']}' AND o_categorize.service='tl' AND o_tasklist.user_id='{$user->user_id}'";
$db->query($sql);
$db->fetch_results();
if($error->buffer)
{
	echo $error->display();
}
$due_date_select = $html->select_box('due_day', 'count', array('min'=>1,'max'=>31), date('j', $db->record['task_due']));
$due_date_select .= $html->select_box('due_month', 'value_count', explode(':', $text['med_months']), date('m', $db->record['task_due']));
$due_date_select .= $html->select_box('due_year', 'count', array('min'=>date('Y'), 'max'=>date('Y') + 10), date('Y', $db->record['task_due']));

$data = $db->record;
$sql = "SELECT * FROM o_share WHERE share_item='{$db->record['task_id']}' AND service='tl'";
$db->query($sql);

if($db->num_rows > 0 || isset($_POST['enable_sharing']))
{
	while($db->fetch_results())
	{
		$share_users[] = $db->record['user_id'];
		
	}	
	
	if(isset($_POST['share_groups']))
	{
		$share_groups = $_POST['share_groups'];
	} else {
		$share_groups = $share->get_share_groups($_GET['tid'], 'tl', $user->user_id);
	}
	
	$share_enabled = " checked=\"checked\"";
	$display = "display:block";
} else {
	$display = "display:none";
}

echo $html->create_list(
		array(
			"SELF"=>$_SERVER['PHP_SELF']. "?tid={$data['task_id']}",
			"SUMMARY"=>$text['summary'],
			"SUMMARY_TEXT"=>$data['subject'],
			"DESCRIPTION"=>$text['description'],
			"DESC_TEXT"=>$data['description'],
			"DUE_DATE"=>$text['due_date'],
			"DUE_SELECT_BOXES"=>$due_date_select,
			"CATEGORY"=>$text['category'],
			"CATEGORY_SELECT"=>$category->get_category_select($user->user_id, 'tl', "edit_task.php?tid={$data['task_id']}", $data['category_id']),
			"SHARING"=>$text['share'],
			"SHARE_ENABLED"=>$share_enabled,
			"DISPLAY"=>$display,
			"SHARE_SELECT"=>$share->share_select($user->user_id, $share_groups),
			"USER_SELECT"=>$share->share_select_users($share_groups, $share_users),
			"PRIORITY"=>$text['priority'],
			"PRIORITY_SELECT"=>$html->select_box('priority', 'count', array('min'=>1, 'max'=>10), $data['priority']),
			"STATUS"=>$text['status'],
			"STATUS_SELECT"=>$html->select_box('status', 'value_count', explode(':', $text['status_list']), $data['status']),
			"COMPLETE"=>$text['complete'],
			"COMPLETE_SELECT"=>$html->select_box('complete', 'count', array('min'=>0, 'max'=>100), $data['complete']),
			"SAVE"=>$text['save'],
			"SAVE_AND_EDIT"=>$text['save_edit'],
			"SAVE_AND_ADD"=>$text['save_add'],
			"CANCEL"=>$text['cancel']),
		"{$layout->service_theme}/edit_task.html");

echo $layout->create_footer();
Return current item: O - OpenSource GroupWare