<?php

/**
 * Install file for Jobwantedman
 *
 * @version $Id: install.php,v 1.2 2004/12/27 16:46:44 gbrackett Exp $
 * @author  George Brackett <gbrackett@NOSPAM.luceatlux.com>
 */

/* return to home page if the user is not a Deity */
if (!$_SESSION["OBJ_user"]->isDeity()){
	header("location:index.php");
	exit();
}

if (version_compare($GLOBALS["core"]->version, "0.9.3-1") < 0) {
  $content .= "This module requires a phpWebSite core version of 0.9.2-1 or greater.<br />";
  $content .= "<br />You are currently using phpWebSite core version " . $GLOBALS["core"]->version . ".<br />";
  return;
} 

/* read sql install script, execute it, suppress errors */
if ($GLOBALS['core']->sqlImport(PHPWS_SOURCE_DIR . "mod/jobwantedman/boost/install.sql", TRUE, TRUE)) {

	/* if successful, report the fact */
	$content = "All Positions Wanted tables successfully written.<br />";
	$status = 1;
	
	// by 9.3-3, boost does all registration for help and search (conf/help.php, search.php required)
	if(version_compare($GLOBALS["core"]->version,"0.9.3-3") < 0) {	
		/* register the module with the help system if it's loaded */
		if(isset($_SESSION["OBJ_help"])) {
			CLS_help::setup_help("jobwantedman");	
			$content .= "Positions Wanted successfully registered with Help system.<br />";
		}
		
		/* register the module with the search system */
		/* comment out this section if you don't want search included */
		$search['module'] = "jobwantedman";
		$search['search_class'] = "JobWanted_ListManager";
		$search['search_function'] = "search";
		$search['search_cols'] = "label, status, description, qualifications";
		$search['view_string'] = "&amp;JOBWANTED_MAN_op=sView&amp;JOBWANTED_id=";
		$search['show_block'] = 1;
	
		if(!$GLOBALS['core']->sqlInsert($search, "mod_search_register")) {
			$content .= "Positions Wanted NOT registered with Search system.<br />";
		 } else {
			$content .= "Positions Wanted successfully registered with Search system.<br />";
		 }
		 /* end of search section */
	}

} else {
	$content .= "Unable to write to the database.<br />";
	$status = 0;
}

?>
