Location: PHPKode > projects > Site-Assistant > sas/sas/plugs/text.php
<?php
class text extends plug {
	// Bezeichnung des Plugs
	var $label = "Text";
  // Parameter die in Datenbank gespeichert werden
  // save_as kann Werte 'none', 'number' und 'string' annehmen
	var $form = array (
		"main" => array (
			"property" => array("content","cssclass")
		)
	);

	var $property =	array(
   	"id" => array("type" => "INT NOT NULL AUTO_INCREMENT PRIMARY KEY", "save_as" => "none", "label" => ""),
   	"content" => array("type" => "TEXT", "save_as" => "string", "label" => "Inhalt", "use_editor" => TRUE, "rows" => 24, "editable" => TRUE),
   	"cssclass" => array("type" => "VARCHAR(100)", "save_as" => "string", "label" => "CSS Klasse")
	);

function output($content_id, $content_list) {
	global $core,$database;
	extract($this->get_content_editable($content_id));
	// $content = nl2br($content);
	if (empty($cssclass)) $cssclass = "text";
	return "<div class=\"".$cssclass."\">$content</div>";
}

function show_form_element($property_name, &$value, $form_id = 0) {
	global $core,$database;

	if ($property_name == "cssclass") {
		$str = "Bitte wählen Sie eine der verfügbaren CSS Klassen aus:<br />";
		$str .= "<select id='cssclass' name='cssclass'>";
		$result = $core->query("select * from ".$database['prefix']."_css");
		while($row = mysql_fetch_array($result)){
			$cl = $row["name"];
			if ($value == $row["name"]) $selected = " selected";
			else $selected = "";
			$str .= "<option value='".$row["name"]."'$selected>$cl</<option>";
		}
		$str .= "</select>";
		return $str;
	}
	else return plug::show_form_element($property_name, $value, $form_id);
}

function form_test(&$POST_VARS, &$error_text) {
	if (trim($POST_VARS['content']))
		return TRUE;
	else {
		$error_text = "Füllen Sie bitte das Feld 'Inhalt' aus!";
		return FALSE;
	}
}

function output_javascript() {
	return;
}

}
?>
Return current item: Site-Assistant