Location: PHPKode > projects > O - OpenSource GroupWare > osgw/tasklist/create_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: create_task.php,v 1.18 2003/12/09 21:56:07 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']) || isset($_POST['save_add']))
{

	if($tasks->verify_fields($_POST['summary'], $_POST['description']))
	{
		$tasks->create($_POST);
		
		if(isset($_POST['save']))
		{
	
			$O->redirect('/tasklist/index.php');
		} elseif(isset($_POST['save_add']))
		{
	
			unset($_POST);
		}
	}
} elseif(isset($_POST['cancel']))
{
	$O->redirect('/tasklist');
}

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

if($error->buffer)
{
	echo $error->display();
}
if(isset($_POST['due_day']))
{
	$due_day = $_POST['due_day'];
	$due_month = $_POST['due_month'];
	$due_year = $_POST['due_year'];	
} else {
	$due_day = date('j');
	$due_month = date('m');
	$due_year = date('Y');
}
$due_date_select = $html->select_box('due_day', 'count', array('min'=>1,'max'=>31), $due_day);
$due_date_select .= $html->select_box('due_month', 'value_count', explode(':', $text['med_months']), $due_month);
$due_date_select .= $html->select_box('due_year', 'count', array('min'=>date('Y'), 'max'=>date('Y') + 10), $due_year);
if(isset($_POST['enable_sharing']))
{
	
	$share_enabled = " checked=\"checked\"";
	$display = "display:block";
} else {
	$display = "display:none";
}


echo $html->create_list(
		array(
			"SELF"=>$_SERVER['PHP_SELF'],
			"SUMMARY"=>$text['summary'],
			"SUMMARY_TEXT"=>$_POST['summary'],
			"DESCRIPTION"=>$text['description'],
			"DESC_TEXT"=>$_POST['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', 'create_task.php', 0),
			"SHARING"=>$text['share'],
			"SHARE_ENABLED"=>$share_enabled,
			"DISPLAY"=>$display,
			"SHARE_SELECT"=>$share->share_select($user->user_id, $_POST['share_groups']),
			"USER_SELECT"=>$share->share_select_users($_POST['share_groups'], $_POST['share_users']),
			"PRIORITY"=>$text['priority'],
			"PRIORITY_SELECT"=>$html->select_box('priority', 'count', array('min'=>1, 'max'=>10), $_POST['priority']),
			"STATUS"=>$text['status'],
			"STATUS_SELECT"=>$html->select_box('status', 'value_count', explode(':', $text['status_list']), $_POST['status']),
			"COMPLETE"=>$text['complete'],
			"COMPLETE_SELECT"=>$html->select_box('complete', 'count', array('min'=>0, 'max'=>100), $_POST['complete']),
			"SAVE"=>$text['save'],
			"SAVE_AND_EDIT"=>$text['save_edit'],
			"SAVE_AND_ADD"=>$text['save_add'],
			"CANCEL"=>$text['cancel']),
		"{$layout->service_theme}/create_task.html");

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