<?php
	require_once( $GLOBALS["site_root"]."/includes/exports/RSS.inc.php" );

	class JobsRSS extends RSS {

		protected function prepareFeed() {
			$this->aChannel['name']='fordit.hu';
			$this->aChannel['description']='Aktuális munkaajánlatok';
			$query = sprintf( "
				select
					job_title as title,
					'http://www.fordit.hu/munkaajanlat/'||job_id||'/' as link,
					'http://www.fordit.hu/munkaajanlat/'||job_id||'/' as guid,
					job_description as lead,
					floor( extract( epoch from ctstamp) ) as pubdate
				from
					jobs
				where
					is_sent
					and not is_closed
					and not is_revoked
					and job_recipients<>'custom'
					and is_proofread
				order by job_id desc
				limit 25" );
			$ds = FNTH_db_get_resultset( $query );
			$items = array();
			foreach ($ds as $row) {
				$item = $row;
				$item['lead']=trim( strip_tags( $row['lead'] ));
				$items[]=$item;
			}
			$this->aItems = $items;
		}

		public function render() {
			if ($this->sRendered) return $this->sRendered();
			$this->prepareFeed();
			return parent::render();
		}
	}
?>
