artifacttypes.class

来自「GForge 3.0 协作开发平台 支持CVS, mailing lists, 」· CLASS 代码 · 共 238 行

CLASS
238 行
字号
<?php/** * ArtifactTypes.class - Class to handle artifact types * * SourceForge: Breaking Down the Barriers to Open Source Development * Copyright 1999-2001 (c) VA Linux Systems * http://sourceforge.net * * @version   $Id: ArtifactTypes.class,v 1.5 2001/06/07 20:15:23 dbrogdon Exp $ * * This file is part of GForge. * * GForge 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. * * GForge 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 GForge; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  US */require_once('common/include/Error.class');require_once('common/tracker/ArtifactType.class');require_once('common/tracker/ArtifactGroup.class');require_once('common/tracker/ArtifactCategory.class');class ArtifactTypes extends Error {	/** 	 * The artifact type object.	 *	 * @var		object	$ArtifactType.	 */	var $Group; //group object	/**	 * Array of artifactTypes data.	 *	 * @var		array	$data_array.	 */	var $data_array;	/**	 *	ArtifactTypes - constructor.	 *	 *	@param	object	The Group object.	 *	@return	boolean	success.	 */	function ArtifactTypes(&$Group) {		$this->Error();		if (!$Group || !is_object($Group)) {			$this->setError('No Valid Group Object');			return false;		}		if ($Group->isError()) {			$this->setError('ArtifactType: '.$Group->getErrorMessage());			return false;		}		$this->Group =& $Group;		return true;	}	/**	 *	createTrackers - creates all the standard trackers for a given Group.	 *	 *	@return	boolean	success.	 */	function createTrackers() {		// first, check if trackers already exist		$res=db_query("SELECT * FROM artifact_group_list 			WHERE group_id='".$this->Group->getID()."' AND datatype > 0");		if (db_numrows($res) > 0) {			return true;		}		db_begin();		if (!$this->createBugTracker()) {			db_rollback();			return false;		} elseif (!$this->createSupportTracker()) {			db_rollback();			return false;		} elseif (!$this->createPatchTracker()) {			db_rollback();			return false;		} elseif (!$this->createFeatureTracker()) {			db_rollback();			return false;		} else {			db_commit();			return true;		}	}	/**	 *	createBugTracker creates bug tracker.	 *	 *	@return	boolean	success.	 *	@access private.	 */	function createBugTracker() {		$at=new ArtifactType($this->Group);		if (!$at || !is_object($at)) {			$this->setError('Error Creating ArtifactType for Bug Tracker');			return false;		} else {			if ($at->create('Bugs','Bug Tracking System',1,1,0,'',30,1,'','',1)) {				//				//	create a default category				//					$ac=new ArtifactCategory($at);				$ac->create('Interface (example)',100);				//				//	create a default group				//					$ag=new ArtifactGroup($at);				$ag->create('v1.0 (example)');				return true;			} else {				$this->setError('Failed to create bug tracker: '.$at->getErrorMessage());				return false;			}		}	  	}	/**	 *	createSupportTracker creates support tracker.	 *	 *	@return	boolean	success.	 *	@access private.	 */	function createSupportTracker() {		$at=new ArtifactType($this->Group);		if (!$at || !is_object($at)) {			$this->setError('Error Creating ArtifactType for support Tracker');			return false;		} else {			if ($at->create('Support Requests','Tech Support Tracking System',1,1,0,'',15,0,'','',2)) {				//				//  create a default category				//  				$ac=new ArtifactCategory($at);				$ac->create('Install Problem (example)',100);				//				//  create a default group				//  				$ag=new ArtifactGroup($at);				$ag->create('v1.0 (example)');				return true;			} else {				$this->setError('Failed to create support tracker: '.$at->getErrorMessage());				return false;			}   		}	}	/**	 *	createPatchTracker creates patch tracker.	 *	 *	@return	boolean	success.	 *	@access private.	 */	function createPatchTracker() {		//			//  Set up a patch tracker for this group		//  		$at=new ArtifactType($this->Group);		if (!$at || !is_object($at)) {			$this->setError('Error Creating ArtifactType for patch Tracker');			return false;		} else {			if ($at->create('Patches','Patch Tracking System',1,1,0,'',15,1,'','',3)) {				//				//  create a default category				//				$ac=new ArtifactCategory($at);				$ac->create('Widget (example)',100);				//  				//  create a default group				//				$ag=new ArtifactGroup($at);				$ag->create('Unstable (example)');				return true;			} else {				$this->setError('Failed to create support tracker: '.$at->getErrorMessage());				return false;			}		}	}	/**	 *	createFeatureTracker creates feature tracker.	 *	 *	@return	boolean	success.	 *	@access private.	 */	function createFeatureTracker() {		//			//  Set up a feature request tracker for this group		//			$at=new ArtifactType($this->Group);		if (!$at || !is_object($at)) {			$this->setError('Error Creating ArtifactType for feature Tracker');			return false;		} else {			if ($at->create('Feature Requests','Feature Request Tracking System',1,1,0,'',45,0,'','',4)) {				//				//  create a default category				//				$ac=new ArtifactCategory($at);				$ac->create('Interface Improvements (example)',100);				//  				//  create a default group				//				$ag=new ArtifactGroup($at);				$ag->create('Next Release (example)');				return true;			} else {				$this->setError('Failed to create support tracker: '.$at->getErrorMessage());				return false;			}		}	}}?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?