Location: PHPKode > projects > Warp.cms - php/mysql content management > warp_121/mod_jobs.php
<?php

// [jobs module v.1.2.1]
// xantis.warp.cms - version 1.2
// (c) 2002 xantis - all rights reserved
// this code is registered and protected by international copyrights laws


//##################################################

if ($warp_module_var_check_auth != 'x99warpv12.cms') {
	$y_hlocalmodz_xdate = date("Y-m-d");
	$y_hlocalmodz_xtime = date("H:i:s");
	$wpmod_xdyech =	"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">\n".
			"<!--:: xantis.warp.cms :: Xantis Warp - Content Management Server - v.1.2 :: $y_hlocalmodz_xdate :: $y_hlocalmodz_xtime :: -->\n".
			"<html>\n".
			"<head>\n".
			"<title>! ! !</title>\n".
			"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n".
			"</head>\n".
			"<body bgcolor=\"#FFFFFF\" leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\">\n".
			"<br>\n".
			"<div align=\"center\"><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash6/cabs/swflash.cab#version=6,0,0,0\" width=\"30\" height=\"30\">\n".
			"<param name=\"movie\" value=\"flagger.swf\">\n".
			"<param name=\"flashvars\" value=\"&xaction=err&\">\n".
			"<param name=\"quality\" value=\"high\">\n".
			"<param name=\"bgcolor\" value=\"#FFFFFF\">\n".
			"<param name=\"menu\" value=\"false\">\n".
			"<embed src=\"flagger.swf\" flashvars=\"&xaction=err&\" quality=\"high\" bgcolor=\"#FFFFFF\" width=\"30\" height=\"30\" menu=\"false\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed>\n".
			"</object>\n".
			"</div>\n".
			"</body>\n".
			"</html>\n" ;
	die("$wpmod_xdyech");
} //end if


//--------------------- data display jobs


function xshow_rep_jobs_data ($ytitle, $ydate, $ytext, $ysall, $yloccx, $yid) {

	global 	$ybar_color, $y_warp_print_text;
	global 	$ymain_color, $y_warp_picts_dir, $ywebsite_addr;
	global 	$ydisplay_width_corrected;
	global	$wpsid, $y_warp_jobs_exp, $y_warp_xdate, $y_warp_jobs_sall, 
		$y_warp_jobs_locx, $y_warp_jobs_apply, $y_warp_jobs_applying,
		$y_warp_jobs_yourcv ;

	$ysize = $ydisplay_width_corrected;
	$ysize_icon = '40';
	$ysize_prn = '40';
	$ysize_date = $ysize - ($ysize_icon + $ysize_prn);

xtable_start ("$ysize");

	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ybar_color");
			xtext_title ("$ytitle");
		xtable_column_end ();
	xtable_row_end ();

	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");
			xvline ("$ysize");
		xtable_column_end ();
	xtable_row_end ();


	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");

		xtable_start ("$ysize");

		xtable_row_start ();

			//the icon
			xtable_column_start ('1', "$ysize_icon", "$ymain_color");
				xspace ();
				if ($y_warp_xdate <= $ydate) {
					xpict ("$ywebsite_addr"."$y_warp_picts_dir".'/jobs.jpg', '30', '30');
				} //end if
				else {
					xpict ("$ywebsite_addr"."$y_warp_picts_dir".'/jobs_exp.jpg', '30', '30');
				} //end else
			xtable_column_end ();

			//the text
			xtable_column_start ('1', "$ysize_date", "$ymain_color");
				xspace ();
				xtext_small ('<b>'."$y_warp_jobs_exp".' : '."$ydate".'</b><br>');
			xtable_column_end ();

			//the apply
			xtable_column_start ('1', "$ysize_prn", "$ymain_color");

				xcenter_right_start ();
					if ($y_warp_xdate <= $ydate) {
						$hxtt_link_reff_text = rawurlencode("[$y_warp_jobs_applying : $yid] - $y_warp_jobs_yourcv");
						xpict_link ("$ywebsite_addr"."$y_warp_picts_dir".'/apply_mini.jpg', "$y_warp_jobs_apply", '20', '20', "$ywebsite_addr"."adm_contact.php?wpsid=$wpsid&opvar=office&vxmsgx=$hxtt_link_reff_text", '_self');
					} //end if
					xspace ();
				xcenter_end ();

			xtable_column_end ();

		xtable_row_end ();

		xtable_end ();

		xtable_column_end ();
	xtable_row_end ();
	
	//descr
	xtable_row_start ();
		xtable_column_start ('1', "$ysize", "$ymain_color");
			xcenter_right_start ();
				xtext_small ('<i><b>'."$y_warp_jobs_sall".' :</b> '."$ysall".'</i>');
				xnewline ();
				xtext_small ('<i><b>'."$y_warp_jobs_locx".' :</b> '."$yloccx".'</i>');
			xcenter_end ();
			xtext_small ("$ytext");
			xnewline ();
			xvline ("$ysize");
		xtable_column_end ();
	xtable_row_end ();


xtable_end ();

} //end function
//----------------




function jobs_module () {
//-------------------


//remote and lib vars
global	$ywebsite_addr, $arr_var_result, $var_result_size, $wpqid, $wpsid ;

//cfg vars
global	$ydisplay_width_corrected, $ysite_back_color, $ybar_menu_color ;
global	$y_warp_total_text, $y_warp_filter_text, $y_warp_filter_text_bttn, $y_warp_filter_hint, $ymain_color, $ysmall_text_color ;
global	$y_warp_prev_text, $y_warp_next_text, $y_warp_filtered_text, $y_warp_picts_dir, $y_warp_filter_remove, $y_warp_filter_sign;

//jobs cfg vars
global	$y_warp_jobs_text, $y_warp_max_jobs_perpage, $y_warp_jobs_subj, $y_warp_jobs_descr, $y_warp_jobs_locx, $y_warp_jobs_sall ;

//local vars
global	$qval,	$offset;


//vars
$y_db_tablename = "jobs";
$limit = $y_warp_max_jobs_perpage;
$xdesired_fields = 'title, description, expiry_date, sallary, location, id';

//------------------------------------------------------search process
//vars
$qval = rawurldecode($qval);
$qwval_src = trim($qval);
$qwval_src_arr = array ();
$qwval_src_arr = explode("$y_warp_filter_sign", $qwval_src);
$qval_url = rawurlencode(stripslashes($qval));
$xurl = "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=0";
//----------------------------------------

//filter empties
$qwval_src_arr_new = array ();
for ($i=0 ; $i<count($qwval_src_arr) ; $i++) {
	if ( trim($qwval_src_arr[$i]) <> '' ) {
		array_push ($qwval_src_arr_new, trim($qwval_src_arr[$i]));
	} //end if
} //end for

//build the querry
if (count($qwval_src_arr_new) <> '0') {
	$w_querryx_bld = " WHERE ";
	for ($i=0 ; $i<count($qwval_src_arr_new) ; $i++) {
		$w_querryx_bld_i = $qwval_src_arr_new[$i];
		$w_querryx_bld = " ".$w_querryx_bld." ( (title LIKE '%".$w_querryx_bld_i."%') OR (description LIKE '%".$w_querryx_bld_i."%') OR (location LIKE '%".$w_querryx_bld_i."%') ) ";
		if ($i <> ( count($qwval_src_arr_new) - 1 ) ) {
			$w_querryx_bld = $w_querryx_bld." AND " ;
		} //end if
	} //end for
} //end if

//[set text if filtered] or [empty querry]
$w_src_filteredby = " - ".$y_warp_filtered_text ;
if (count($qwval_src_arr_new) == '0') {
	$w_querryx_bld = ' ';
	$w_src_filteredby = '';
} //end if

//-----------------------------------------------------------------


//---------------------
if (empty($offset)) {
   $offset = 0;
}
//---------------------

	$w_querryx = "  ".$w_querryx_bld." ";

	$wquerry_main = "SELECT $xdesired_fields FROM $y_db_tablename ".$w_querryx;

	$wquerry_main_c = "SELECT COUNT(*) FROM $y_db_tablename ".$w_querryx;

	xmysql_count_data ($wquerry_main_c);
	xmysql_read_data ($wquerry_main." ORDER BY id DESC LIMIT $offset, $limit");


//---------------------------------------------
	//vars
	$newoffsetnext = $offset + $limit ;
	$newoffsetprev = $offset - $limit ;
	$offsetlistedmin = $offset + 1;

	if ($newoffsetnext <= $var_result_size) {
		$offsetlistedmax = $newoffsetnext;
	} //end if
	else {
		$offsetlistedmax = $var_result_size;
	} //end else

	if ($offsetlistedmax == 0) {
		$offsetlistedmin = 0;
	} //end if
//---------------------------------------------


//=====================================


xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ysite_back_color");
			xcenter_start ();

				xwriteflash_nobg_var ("$ywebsite_addr"."src_frm.swf",
					"&flash_form_backcolor=".rawurlencode($ymain_color).
					"&flash_form_textcolor=".rawurlencode($ysmall_text_color).
					"&flash_form_text_flby=".rawurlencode($y_warp_filter_text).
					"&flash_form_text_hint=".rawurlencode($y_warp_filter_hint).
					"&flash_form_text_bttn=".rawurlencode($y_warp_filter_text_bttn).
					"&flash_form_logo=".rawurlencode("$ywebsite_addr"."$y_warp_picts_dir".'/jobs.jpg').
					"&flash_form_listall=".rawurlencode($y_warp_filter_remove).
					"&qval_hint=".rawurlencode("[$y_warp_jobs_subj | $y_warp_jobs_descr | $y_warp_jobs_locx]").
					"&qval=".$qval_url.
					"&xurl=".rawurlencode("$xurl").
					"&"
				, '500', '40');


			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();


//====================

xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ybar_menu_color");
			xtext_small ('|');
			xspace ();
			xtext_small ("<b>$y_warp_jobs_text</b> [<b>$offsetlistedmin</b> - <b>$offsetlistedmax</b> (<b>$var_result_size</b> $y_warp_total_text)]"."$w_src_filteredby");
			xspace ();
			xtext_small ('|');
		xtable_column_end ();

		xtable_column_start ('1', '', "$ybar_menu_color");
			xcenter_right_start ();
				xtext_small ('|');
					xspace ();
					//Show PREV
					if ($newoffsetprev >= 0) {
						xtext_link ("$y_warp_prev_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetprev&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if

					//Show NEXT
					if ($newoffsetnext < $var_result_size) {
						xtext_link ("$y_warp_next_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetnext&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if
			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();

//=====================================


$arr_count = count($arr_var_result);
for ($i=0; $i < $arr_count; $i++) {
	$i_title = $i;
	$i_descr = $i +1;
	$i_expd = $i + 2;
	$i_sall = $i + 3;
	$i_loc = $i + 4;
	$i_id = $i + 5;
	$i = $i + 5;

	xshow_rep_jobs_data ($arr_var_result[$i_title], $arr_var_result[$i_expd], $arr_var_result[$i_descr], $arr_var_result[$i_sall], $arr_var_result[$i_loc], $arr_var_result[$i_id]);

	xnewline ();
} //end for


//====================

xtable_start ("$ydisplay_width_corrected");
	xtable_row_start ();
		xtable_column_start ('1', '', "$ybar_menu_color");
			xtext_small ('|');
			xspace ();
			xtext_small ("<b>$y_warp_jobs_text</b> [<b>$offsetlistedmin</b> - <b>$offsetlistedmax</b> (<b>$var_result_size</b> $y_warp_total_text)]"."$w_src_filteredby");
			xspace ();
			xtext_small ('|');
		xtable_column_end ();

		xtable_column_start ('1', '', "$ybar_menu_color");
			xcenter_right_start ();
				xtext_small ('|');
					xspace ();
					//Show PREV
					if ($newoffsetprev >= 0) {
						xtext_link ("$y_warp_prev_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetprev&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if

					//Show NEXT
					if ($newoffsetnext < $var_result_size) {
						xtext_link ("$y_warp_next_text", "$ywebsite_addr"."xw_main.php"."?wpqid=$wpqid&wpsid=$wpsid&offset=$newoffsetnext&qval=$qval_url", '_self');
						xspace ();
						xtext_small ('|');
						xspace ();
					} //end if
			xcenter_end ();
		xtable_column_end ();
	xtable_row_end ();
xtable_end ();

xnewline ();

//=====================================


}//-------------------end function



//------------------------------

//jobs_module ();

//------------------------------

// end of php code
?>
Return current item: Warp.cms - php/mysql content management