Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/article2/artOptions.inc.php
<?
	$tpl->readTemplatesFromFile($config['templates']."options.template");
	$tpl->readTemplatesFromFile($config['templates']."messages.template");
	$tpl->addGlobalVar("SUB", "artOptions");

	if(!(ADMIN & $cbPerms)) {	
		if(!(ART_SET & $cbPerms)) {
			 echo $error_msg["permission-denied"];
			 exit();
		}
	}
	
	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(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]);
		// aktuelle Listen aktualisieren		
		$cbOption->getOptionList();
		$artOption->getOptionList();
	}

	$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"; }

	
	$tpl->addVars("options",
		array ( "ART_SETTINGS"     => $amLink["article_settings"],
				"REQUIRE_INTRO"    => $amText["requireintro-enable"],
				"STATUS"           => $amText["artstatus-enable"],
				"SET_ICON"         => $amText["seticon-enable"],
				"ICON_CAT"         => $amText["showicon-catalog-enable"],
				"TIMEPOST"         => $amText["timepost-enable"],
				"CHANGE_AUTHOR"    => $amText["change-author-enable"],
				"REFRESH_DATE"     => $amText["refresh-date-enable"],
				"TXT_DEFAULT_LANG" => $amText["default_language"],
				"TXT_MM_ICON"      => $amText["iconTypeText"],
				"TXT_MM_IMAGE"     => $amText["imageTypeText"],
				"TXT_MM_GENERAL"   => $amText["generalMediaBranch"],
				"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
		)
	);
	$tpl->addVars("defaultLanguages",
		array ( "ID"       => $artLangID,
				"SELECTED" => $artLangSelected,
				"VALUE"    => $artLangShort
		)
	);
	$tpl->addVars("iconType",
		array ( "ID"       => $mediaTypeID,
				"SELECTED" => $mediaIconSelect,
				"VALUE"    => $mediaTypeValue
		)
	);
	$tpl->addVars("imageType",
		array ( "ID"       => $mediaTypeID,
				"SELECTED" => $mediaImageSelect,
				"VALUE"    => $mediaTypeValue
		)
	);
	$tpl->addVars("generalBranch",
		array ( "ID"       => $mediaBranchID,
				"SELECTED" => $mediaBranchSelect,
				"VALUE"    => $mediaBranchValue
		)
	);	
	$tpl->setAttribute("options", "visibility", "visible");

	if($update) {
		$tpl->setAttribute("message", "visibility", "visible");
		$tpl->addVar("message", "MESSAGE", $success_msg["settings-change"]);
	}
	$tpl->displayParsedTemplate("article");
	$tpl->displayParsedTemplate("messages");
?>
Return current item: Content*Builder