Update of /cvsroot/openfirst/projects
In directory sc8-pr-cvs1:/tmp/cvs-serv1814
Added Files:
projectsmodule.php
Log Message:
New include for module that caries the project tree function, a new feature which I programmed to help users navigate around the action register.
--- NEW FILE: projectsmodule.php ---
<?php
/*
* openFIRST.projects - projectsmodule.php
*
* Copyright (C) 2003,
* openFIRST Project
* Original Author: David Di Biase <dav...@ea...>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
// Tree preview function for projects module
function projecttree($option,$value = ""){
// Prepare tree data so the script may loop through and find info
switch($option){
// Case if user wants to view group tree
case "groups":
$groups = "";
$projects = "";
$tasks = "";
break;
// Case if user wants to view projects in a group
case "projects":
$groups = $value;
$projects = $value;
$tasks = "";
break;
// Case if user wants to view tasks in a project
case "tasks":
$task_query = ofirst_dbquery("SELECT * FROM ofirst_projects_tasks WHERE ProjectID = ".$value);
$task = ofirst_dbfetch_object($task_query);
// If you do not set the group value then nothing will show. So we must get
// the value directly by querying the related project value.
if(ofirstdb_num_rows($task_query) == 0){
$project_query = ofirst_dbquery("SELECT * FROM ofirst_projects_projects WHERE ID = ".$value);
$project = ofirst_dbfetch_object($project_query);
$groups = $project->GroupID;
}else{
$groups = $task->GroupID;
}
$projects = $value;
$tasks = $value;
break;
}
// Begin to loop through tree information, beginning with groups list first
$group_query = ofirst_dbquery("SELECT * FROM ofirst_projects_groups");
while($group = ofirst_dbfetch_object($group_query)){
// Show image and name for this group
echo '<img height="20" width="18" src="../members/icons/apps/kuser.png"> <a href="projects.php?GroupID='.$group->ID.'">'.$group->GroupName.'</a><br>';
// Preview current projects
if($projects != "" && $group->ID == $groups){
// Gather list of projects which relate to the selected group and loop through
$project_query = ofirst_dbquery("SELECT * FROM ofirst_projects_projects WHERE GroupID = ".$groups);
while($project = ofirst_dbfetch_object($project_query)){
// Preview image and name of project
echo ' <img src="../members/icons/actions/project_open.png" width="18" height="20" border="0"> <a href="tasks.php?GroupID='.$groups.'&ProjectID='.$project->ID.'">'.$project->ProjectName.'</a><br>';
// Preview current tasks
if($tasks != "" && $project->ID == $projects){
// Gather a list of tasks which relate to the selected project and loop through
$task_query = ofirst_dbquery("SELECT * FROM ofirst_projects_tasks WHERE GroupID = $groups AND ProjectID = $projects");
while($task = ofirst_dbfetch_object($task_query)){
// Preview and image and name of task
echo ' <img src="../members/icons/filesystems/desktop.png" width="18" height="20" border="0"> '.$task->TaskName.'<br>';
}
}
}
}
}
}
?>
|