Location: PHPKode > projects > Site-Assistant > sas/sas/plugs/intern_link.php
<?php


class intern_link extends plug {
	var $cache_output = FALSE;
	var $label = "Interner Verweis";			// Bezeichnung des Plugs
	var $image_dir = "img_si/";					// Verzeichnis der nutzerbezogenen Pictogramme

	var $form = array (
		"main" => array (
			"property" => array("link_id", "headline", "description")
		)
	);

  // Parameter die in Datenbank gespeichert werden
	var $property =	array (
   	//	"id" => array("type" => "INT NOT NULL AUTO_INCREMENT PRIMARY KEY", "save_as" => "none", "label" => ""),
 		"link_id" => array("type" => "INT", "save_as" => "number", "label" => "Seiten-Id"),
 		"headline" => array("type" => "VARCHAR(64)", "save_as" => "string", "label" => "Linktext", "editable" => TRUE),
 		"description" => array("type" => "TEXT", "save_as" => "string", "label" => "Beschreibung", "editable" => TRUE)
	);

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

	if ($property_name == "link_id") {
		$sql = "SELECT id, label FROM $tbl_pages WHERE status<>'d' and i18n = ".$_SESSION["lang_id"]." ORDER BY label ASC";
		$result = $core->query($sql);

		$str .= "<p><span class='controlHeader'>Zielseite</span></p>";
		$str .= "<select name='$property_name' size='1'>";
  		while($row = mysql_fetch_array($result)) {
			$selected = ($value == $row["id"]) ? " selected='selected'" : "";
			$str .= "<option value='$row[id]'$selected>$row[label] (ID=$row[id])</option>";
		}
		$str .= "</select>";
		return $str;
	}

	else return plug::show_form_element($property_name, $value, $form_id);
}

function output($content_id, $content_list) {
	global $paths;

	extract($this->get_content_editable($content_id));

	$link = "<a href='index.php?page_id=$link_id'>";
	$link_end = "</a>";

	$seperator = ($description) ? "&nbsp; -&nbsp;" : "";
	$str = "<div class='intern_link'>$link$headline$link_end$seperator$description</div>";

	return $str;
}

function output_javascript() {
   return;
}
}
?>
Return current item: Site-Assistant