Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/settingArticle.inc.php
<?php
	define("ART_SORT_DATE",          1 << 0);
	define("ART_SORT_NUMERIC",       1 << 1);
	define("ART_SORT_MONTH_NUMERIC", 1 << 2);
	define("ART_SORT_DAY_NUMERIC",   1 << 3);
	
	if(!(ADMIN & $cbPerms)) {	
		if(!(ART_SET & $cbPerms)) {
			 echo $error_msg["permission-denied"];
			 exit();
		}
	}
	
	//Ableitung des Article Option Objektes
	$artOption = new CBOption();
	$artOption->setModule("art");
	$artOption->getOptionList();
	
	$myMedia   = new MediaManagement();
	$myMedia->userID = $HTTP_SESSION_VARS[user];
	$myMedia->setOptionObject($cbOption);
	
	/* Include of Language Files */
	if(file_exists($lang_path.$lang_pf."/plugin/article2.lang.php")) {
		include($lang_path.$lang_pf."/plugin/article2.lang.php");
	} else {
		include($lang_path."en/plugin/article2.lang.php");
	}
	
	/*
	* Workaround zur Abschaffung der artLanguages.inc.php zur globalen languages.inc.php
	*/
	$artLangArr = $supportedLangArr;
	
	if(!$artOption->getSingleOption("generalMedia")) {
		$artOption->insertOption('generalMedia', "");
	}
	if(!$artOption->getSingleOption("iconTypeID")) {
		$artOption->insertOption('iconTypeID', "");
	}
	if(!$artOption->getSingleOption("imageTypeID")) {
		$artOption->insertOption('imageTypeID', "");
	}
	if(!$artOption->getSingleOption("default_lang")) {
		$artOption->insertOption('default_lang', "");
	}
	if(!$artOption->getSingleOption("chapterControl")) {
		$artOption->insertOption('chapterControl', "0");
	}
	
	$update = false;
	if(isset($_POST[set])) {
		// zur Sicherheit das Modul noch mal setzen
		$cbOption->setModule("system");
		// einzelne Optionen in die DB eintragen
		$cbOption->updateOption('requireintro',    $_POST[requireintro]);
		$cbOption->updateOption('artstatus',       $_POST[artstatus]);
		$cbOption->updateOption('seticon',         $_POST[seticon]);
		$cbOption->updateOption('timepost',        $_POST[timepost]);
		$cbOption->updateOption('icon_cat',        $_POST[icon_cat]);
		$cbOption->updateOption('change_author',   $_POST[change_author]);
		$cbOption->updateOption('refresh_date',    $_POST[refresh_date]);
		
		$artOption->updateOption('default_lang',   $_POST[default_lang]);
		$artOption->updateOption('generalMedia',   $_POST[generalMediaID]);
		$artOption->updateOption('iconTypeID',     $_POST[iconTypeID]); 
		$artOption->updateOption('imageTypeID',    $_POST[imageTypeID]);
		$artOption->updateOption('chapterControl', $_POST[chapterControl]);
		
		switch($_POST[artSortMethod]) {
			case ART_SORT_NUMERIC:
				 $artOption->updateOption('sortMethod', ART_SORT_NUMERIC);
				 break;
			default:
				 $artOption->updateOption('sortMethod', ART_SORT_DATE);
		}
			
		// aktuelle Listen aktualisieren		
		$cbOption->getOptionList();
		$artOption->getOptionList();
		$update = true;
	}

	$artDefaultLang = $artOption->getSingleOption("default_lang");
	if($artLangArr) {
		foreach($artLangArr as $k => $v) {
			$artLangID[]	    = $v;
			$artLangShort[]     = $k;
			if($artDefaultLang == $v) {
				$artLangSelected[] = "selected";
			} else {
				$artLangSelected[] = "";
			}
		}
	}
	
	$mediaTypeArray = $myMedia->getMediaTypes();
	$mediaBranches  = $myMedia->getAllowedBranches("art");
	
	$mediaGeneralBranch[$artOption->getSingleOption("generalMedia")] = "selected";
	$mediaIcon[$artOption->getSingleOption("iconTypeID")]   = "selected";
	$mediaImage[$artOption->getSingleOption("imageTypeID")] = "selected";
	
	if($mediaTypeArray) {
		foreach($mediaTypeArray as $k => $v) {
			$mediaTypeID[]	    = $k;
			$mediaIconSelect[]  = $mediaIcon[$k];
			$mediaImageSelect[] = $mediaImage[$k];
			$mediaTypeValue[]   = $v;
		}
	}
	
	if($mediaBranches) {
		foreach($mediaBranches as $k => $v) {
			$mediaBranchID[]      = $k;
			$mediaBranchSelect[]  = $mediaGeneralBranch[$k];
			$mediaBranchValue[]   = $v;
		}
	}
	
	// get current settings
	if($cbOption->getSingleOption("requireintro")  == 1) { $chk_intro		 = "checked"; }
	if($cbOption->getSingleOption("artstatus")     == 1) { $chk_status		 = "checked"; }
	if($cbOption->getSingleOption("seticon")       == 1) { $chk_seticon		 = "checked"; }
	if($cbOption->getSingleOption("icon_cat")      == 1) { $chk_iconcat		 = "checked"; }
	if($cbOption->getSingleOption("timepost")      == 1) { $chk_timepost	 = "checked"; }
	if($cbOption->getSingleOption("change_author") == 1) { $chk_authorchange = "checked"; }
	if($cbOption->getSingleOption("refresh_date")  == 1) { $chk_refreshdate  = "checked"; }
	
	/*
	* Kapitel Kontrolle
	*/
	$artChapterControl = "";
	if($artOption->getSingleOption("chapterControl")) {
		$artChapterControl = "checked";
	}
	
	/*
	* Sortier Methode
	*/
	$artSortMethod        = $artOption->getSingleOption("sortMethod");
	
	$artSortMethodsID[]   = ART_SORT_DATE; 
	$artSortMethodsName[] = $amText["moveSortByDate"];
	$artSortMethodsID[]   = ART_SORT_NUMERIC;
	$artSortMethodsName[] = $amText["moveSortByNumeric"];
	
	foreach($artSortMethodsID as $v) {
		if($v == $artSortMethod) {
			$artSortMethodsSelected[] = "checked";
		} else {
			$artSortMethodsSelected[] = "";
		}
	}
	
	$tpl->assign("articleMessages", $amText);
	
	$tpl->assign("settingArticle2",
		array ( "settingTab"       => $settingTab,
				"LANG"             => $lang_pf,
				"CHK_INTRO"        => $chk_intro,
				"CHK_STATUS"       => $chk_status,
				"CHK_SETICON"      => $chk_seticon,
				"CHK_ICONCAT"      => $chk_iconcat,
				"CHK_TIMEPOST"     => $chk_timepost,
				"CHK_CHANGEAUTHOR" => $chk_authorchange,
				"CHK_REFRESHDATE"  => $chk_refreshdate,
				"CHK_CHAPTER"      => $artChapterControl
		)
	);
	$tpl->assign("settingArticle2DefaultLanguages",
		array ( "ID"       => $artLangID,
				"SELECTED" => $artLangSelected,
				"VALUE"    => $artLangShort
		)
	);
	$tpl->assign("settingArticle2IconType",
		array ( "ID"       => $mediaTypeID,
				"SELECTED" => $mediaIconSelect,
				"VALUE"    => $mediaTypeValue
		)
	);
	$tpl->assign("settingArticle2ImageType",
		array ( "ID"       => $mediaTypeID,
				"SELECTED" => $mediaImageSelect,
				"VALUE"    => $mediaTypeValue
		)
	);
	$tpl->assign("settingArticle2generalBranch",
		array ( "ID"       => $mediaBranchID,
				"SELECTED" => $mediaBranchSelect,
				"VALUE"    => $mediaBranchValue
		)
	);
	$tpl->assign("settingArticle2SortMethod",
		array ( "METHODID"   => $artSortMethodsID,
				"METHODNAME" => $artSortMethodsName,
				"SELECTED"   => $artSortMethodsSelected
		)
	);
	$tpl->assign("settingArticle2_set", "1");

	if($update) {
		$tpl->assign("messageSet", "1");
		$tpl->assign("messageList", $success_msg["settings-change"]);
	}
	
	/* 
	* Templates parsen und speichern
	*/
	$mainPluginContent[]  = $tpl->fetch($settingPlugin->getValue("templates")."settingArticle.template", null, "pluginArt2".$cbUserID);
	$mainMessageContent[] = $tpl->fetch($settingPlugin->getValue("templates")."messages.template", null, "pluginArt2".$cbUserID);
?>
Return current item: Content*Builder