Location: PHPKode > projects > Web-NoteTaker > notetaker/include/getdata.php
<?php
// NoteTaker
// Created and Coded by Bo Ahlberg
// Copyright 2008 by Bo Ahlberg ( bahlberg at mac.com )
// This code is licensed "AS-IS", No warranty is expressed or implied as to the
// suitability of this software for any purpose. Further, this code is licensed
//	under the:
//    Creative Commons Attribution-Share Alike 3.0 United States License
// This means you are free to:
//		to Share - to copy, distribute, display, and perorm work
//	  to remix - to make derivative works
//  Under the Following Conditions:
//		Attribution - You must attribute the work in the manner 
//    		specified by the author or licensor (but not in any way 
//    		that suggests that they endorse you or your use of the work).
//    Share Alike. If you alter, transform, or build upon this work, 
//				you may distribute the resulting work only under the same, 
//				similar or a compatible license.
//	For any reuse or distribution, you must make clear to others the license 
//		terms of this work. The best way to do this is with a link to this web page.
//	Any of the above conditions can be waived if you get permission from the 
//		copyright holder.
//	Apart from the remix rights granted under this license, nothing in this 
//		license impairs or restricts the author's moral rights.
//
// Getdata.php
//

$kanban     = "";
$children   = "";
$states     = "";
$substates  = "";
$kinds      = "";
$roles      = "";
$colors     = "";
$resources  = "";
$priorities = "";
$projects   = "";
$sets       = "";
$attendees	= "";

$labels['role']     = array( 'key' => 'roleID', 
														 'fields' =>  array(  'roleID'        => 'ID',   
																									'roleName'      => 'Name',  
																									'roleColor'     => 'Color',   
																									'roleDesc'      => 'Description' ) );
															
$labels['user']     = array( 'key' => 'username', 
														 'fields' =>  array(  'username'      => 'ID',   
																									'password'      => 'Password',  
																									'userid'        => 'User ID',    
																									'userLevel'     => 'Level',    
																									'email'         => 'eMail') );
															
$labels['meet']     = array( 'key' => 'meetID', 
														 'fields' =>  array(  'meetID'        => 'ID',   
																									'projID'        => 'Project',    
																									'meetHost'      => 'Host',    
																									'meetLocation'  => 'Location',    
																									'meetSubject'   => 'Subject',    
																									'meetDate'      => 'Date',    
																									'meetNote'      => 'Notes' ) );
															
$labels['proj'] =     array( 'key' => 'projID', 
														 'fields' =>  array(  'projID'        => 'ID',   
																									'projName'      => 'Name',   
																									'projOwner'     => 'Owner',   
																									'projNotes'     => 'Notes' ) );
															
$labels['items'] =    array( 'key' => 'itemID', 
														 'fields' =>  array(  'itemID'        => 'ID',   
																									'itemTime'      => 'Time',   
																									'meetID'        => 'Meeting',   
																									'username'      => 'User',
																									'itemTypeID'    => 'Type',
																									'itemNote'      => 'Notes' ) );
																									
$labels['attend'] =    array( 'key' => 'attendeeID', 
														 'fields' =>  array(  'attendeeID'    => 'ID',   
																									'attendeeName'  => 'Name',   
																									'attendeeOrg'   => 'Organization',   
																									'attendeeTitle' => 'Title',
																									'attendeeRole'  => 'Role',
																									'attendeeNote'  => 'Notes' ) );

$labels['types'] =    array( 'key' => 'typesID', 
														 'fields' =>  array(  'typesID'        => 'ID',   
																									'typesName'      => 'Name',   
																									'typesColor'     => 'Color',   
																									'typesNotes'     => 'Notes' ) );
															
$labels['color']    = array( 'key' => 'colorID', 
														 'fields' =>  array(  'colorID'       => 'ID',   
																									'colorName'     => 'Name',    
																									'colorNumber'   => 'Color',    
																									'colorValue'    => 'Value' ) );
										$proplist = "";

$tables = array( 'meet'     => 'meeting',   
								 'user'     => 'users',   
								 'role'     => 'role',   
								 'color'    => 'colors',   
								 'items'    => 'items',   
								 'types'    => 'types',   
								 'attend'   => 'attendees',   
								 'proj'     => 'proj' );
								 
$menuList = array( 'Meetings'   => 'meet', 
                   'Roles'      => 'role', 
                   'Items'      => 'items', 
                   'Types'      => 'types', 
                   'Colors'     => 'color', 
                   'Attendees'  => 'attend', 
									 'Projects'   => 'proj' );
									 
function setPropList ()
{	global $proplist, $meetings, $types, $users, $roles, $projects, $colors, $attendees;
	$proplist['proj']   = $projects;
	$proplist['meet']   = $meetings;
	$proplist['role']   = $roles;
	$proplist['color']  = $colors;
	$proplist['types']  = $types;
	$proplist['attend'] = $attendees;
	$proplist['user']   = $users;
	
}

function initGlobals( $wanted, $proj )
{	global	$tasks, $meetings, $types, $users, $roles, $projects, $colors, $attendees;

	$roles    = getPropertyList( 'role' );
	$users    = getPropertyList( 'user' );
	$meetings = getPropertyList( 'meet' );
	$types    = getPropertyList( 'types' );
	$attendees= getPropertyList( 'attend' );
	$colors   = getPropertyList( 'color' );
	$projects = getPropertyList( 'proj' );
	
	setPropList( );
}

function getPropertyList( $prop )
{	global $tables, $labels;

	$row = "";
	$query = "SELECT * FROM ".$tables[$prop] ;

	$result = mysql_query( $query );
	if ( $result )
	{	
			while ( $rec = mysql_fetch_array( $result, MYSQL_ASSOC ) )
			{
				$row[$rec[$labels[$prop]['key']]] = $rec;
			}
	}
	else
	{
		Message( 4, "getPropertyList query failure:\n ".$query );
	}

	return $row;
}

function processUpdate( $query )
{
	$result = mysql_query( $query );
	if ( $result )
	{	
		Message( 2, "processUpdate, query Success: ".$query );
		$result = TRUE;
	}
	else
	{
		Message( 4, "getKanBanItems query failure:\n ".$query );
		$result = FALSE;
	}
	return $result;
}

function processInsert( $query )
{
	$result = mysql_query( $query );
	if ( $result )
	{	
			$result = TRUE;
	}
	else
	{
		Message( 4, "getKanBanItems query failure:\n ".$query );
		$result = FALSE;
	}
	return $result;
}

function processQuery( $query )
{
	$result = mysql_query( $query );
	if ( !$result )
		Message( 4, "processQuery query failure:\n ".$query );
	else
		Message( 2, "processQuery, query Success: ".$query );

	return $result;
}

?>
Return current item: Web-NoteTaker