Location: PHPKode > projects > Content*Builder > modules/artbox/artBox_both.php
<?php
	/*
	* artBox_both.php
	* Datei gibt entweder normale Artikel oder ML Artikel aus.
	* Das ganze ist abhängig vom aktuellen Hauptmodul. 
	* 
	* ist $artbox_template gesetzt, 
	* (per setModuleValue("moduleName", "artbox_template", "tplName"); )
	* wird dieses Template anstatt artbox.template gewählt
	* 
	* @version $Id: artBox_both.php,v 1.1 2004/02/14 10:33:34 cb_fog Exp $
	* @copyright 2003 C*B Development Team
	*/

	// Article Liste laden
	if($archive == 1) { 
		$artAmount = 10000; 
	} else { 
		if(!$cbOption->getSingleOption("artAmount")) {
			$artAmount = 10;
		} else {
			$artAmount = $cbOption->getSingleOption("artAmount");
		}
	}
	
	if(!is_object($artOption)) {
		//Ableitung des Article Option Objektes
		$artOption = new CBOption();
		$artOption->setModule("art");
		$artOption->getOptionList();
	}
	
	if($load == "article2") {
		/* Implementation of stage rules in module article2 */
		$today = date( "Ymd", time() );
		if($cbOption->getSingleOption("timepost")) {
			if(!$preview) {
				$stageStatement = "AND general.stage = '3' AND general.publishfrom <= '".$today."' AND (general.publishto >= '".$today."' OR general.publishto = '00000000')";
			} else {
				$stageStatement = "";
			}
		} else {
			$stageStatement = "AND general.stage = '3'";
		}
		
		/*
		* Sortier Methode
		*/
		$sortMethod = $artOption->getSingleOption("sortMethod");
		switch($sortMethod){
			case ART_SORT_NUMERIC: 
				 $sortMethodString = "ORDER BY general.order_num ASC";
				 break;
			default:
				 $sortMethodString = "ORDER BY general.datetime DESC";
		} // switch
		
		$dlQuery = mysql_fetch_array(mysql_query("SELECT * FROM ".TABLE."_options WHERE name = 'default_lang' AND module = 'art'"));
		$defaultLanguage = $dlQuery[value];
		
		if(!empty($_COOKIE['main_language'])) {
			if(ereg("^[0-9]*$", $_COOKIE['main_language'])) {
				$defaultLanguage = $_COOKIE['main_language'];
			}
		}
		
		$contentWhere = "WHERE content.ide = general.ide $stageStatement AND content.language = '$defaultLanguage'";
		
		$query = "SELECT content.ide, content.language, content.title, general.datetime FROM ".TABLE."_art_content AS content, ".TABLE."_art_general AS general $contentWhere $sortMethodString LIMIT 0,$artAmount";
		$result = mysql_query($query);
		
		$noArticles = true;
		while($artData = mysql_fetch_object($result)) {
			$title = substr($artData->title, 0, 20);
			if(strlen($artData->title > 20)) {
				$title .= "...";
			}
			$artTitle[]		= $title;
			$artIde[]		= $artData->ide;
			$artFolderId[]	= $generalFolderID[$artData->ide];
			$noArticles = false;
		}
		
		$artType        = "article2";		
	} else {
		$query = mysql_query("SELECT title, ide, folder FROM ".TABLE."_article WHERE folder = '$openfolder' AND stage = '3' ORDER BY datum DESC LIMIT 0,$artAmount");
		$artTitle = array();
		$artIde = array();
		$artFolderId = array();
		
		$noArticles = true;
		while($articles = mysql_fetch_array($query)) {
			$title = substr($articles[title], 0, 20);
			if(strlen($articles[title]) > 20) {
				$title .= "...";
			}
			$artTitle[]		= $title;
			$artIde[]		= $articles[ide];
			$artFolderId[]	= $articles[folder];
			$noArticles = false;
		}
		unset($articles);
		$artType        = "article";
			
	}
	
	if($noArticles) {
		$message[] = "No Articles in Folder";
		$tpl->assign("MESSAGE", $message);
		$tpl->assign("messageSet", "1");
		$tpl->assign("artListSet", "0");
	} else {
		$tpl->assign("artListSet", "1");
		$artListData = array(  
			"NAV_FOLDER"	=> $artFolderId,
			"ARTICLE_TITLE" => $artTitle,
			"IDE"			=> $artIde
		);
		$tpl->assign("artListData", $artListData);
		$tpl->assign("OPENFOLDER", $openfolder);
	}
	
	/* 
	* Man kann für jede ArtikelBox ein anderes Template angeben
	*/
	if(!empty($artbox_template)) {
		$tpl->display($artbox_template);
	} else {
		$tpl->display("artBox.template");
	}
?>
Return current item: Content*Builder