Location: PHPKode > projects > O - OpenSource GroupWare > osgw/notebook/edit_note.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_note.php,v 1.13 2003/12/10 20:40:55 rthomp Exp $*/
include("./data.php");
$service['add_header'] = TRUE;
include("../config.inc.php");
include($here. "/class.notebook.php");
$notes = new notebook;

$uid = $user->user_id;
if(isset($_POST['back']))
{
	$O->redirect("/notebook");	
}
if(isset($_POST['save_edit_note']) || isset($_POST['save_note']))
{
	$notes->update($_GET['nid'], $_POST, $user->user_id);
	if(isset($_POST['save_note']))
	{
		$O->redirect('/notebook');
	}
}
echo $layout->page_header;
echo $layout->service_header($notes->msg('service_name'), $notes->nav_buttons(), $notes->msg('edit_note'));
$sql = "SELECT * FROM o_categorize LEFT JOIN o_categories ON o_categories.category_id=o_categorize.category
	LEFT JOIN o_notebook ON o_notebook.note_id=o_categorize.id LEFT JOIN o_users ON o_notebook.user_id=o_users.user_id
	WHERE o_notebook.note_id='{$_GET['nid']}' AND o_categorize.service='nb' AND o_notebook.user_id='{$user->user_id}'";
$db->query($sql);
$db->fetch_results();

if($error->buffer)
{
	echo $error->display();
}
$note_data = $db->record;
$sql = "SELECT * FROM o_share WHERE share_item='{$db->record['note_id']}' AND service='nb'";
$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['nid'], 'nb', $user->user_id);
	}
	
	$share_enabled = " checked=\"checked\"";
	$display = "display:block";
} else {
	$display = "display:none";
}

echo $html->create_list(
		array("SELF"=>$_SERVER['PHP_SELF']. "?nid={$note_data['note_id']}",
			"TITLE_TEXT"=>$text['title'],
			"TITLE"=>$note_data['title'],
			"CATEGORY_TEXT"=>$text['category'],
			"CATEGORY"=>$category->get_category_select($user->user_id, 'nb', "edit_note.php?nid={$note_data['note_id']}", $note_data['category_id']),
			"NOTE_TEXT"=>$text['note'],
			"NOTE"=>$note_data['note'],
			"SAVE_EDIT_TEXT"=>$text['save_edit'],
			"SAVE_TEXT"=>$text['save'],
			"CANCEL_TEXT"=>$text['cancel'],
			"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),
			),
		"{$layout->service_theme}/edit_note.html");
echo $layout->create_footer();
Return current item: O - OpenSource GroupWare