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


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

	var $form = array (
		"main" => array (
			"property" => array("id","list", "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" => ""),
 		"list" => array("type" => "VARCHAR(11)", "save_as" => "string", "label" => "Linkliste"),
 		"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, $database;

	if ($property_name == "list") {
		$result = $core->query("SELECT * FROM ".$database["prefix"]."_pages_options group by page_group");
		$str .= "<p><span class='controlHeader'>Seitengruppe/Linkliste</span></p>";
		$str .= "<select name='$property_name' size='1'>";
  		while($row = mysql_fetch_array($result)) {
			$selected = ($value == $row["id"]) ? " selected='selected'" : "";
			$str .= "<option value='SG|$row[id]'$selected>Seitengruppe=$row[id]</option>";
		}
		$result = $core->query("SELECT * FROM ".$database["prefix"]."_link_categories");
  		while($row = mysql_fetch_array($result)) {
			$selected = ($value == $row["id"]) ? " selected='selected'" : "";
			$str .= "<option value='LL|$row[id]'$selected>Linkliste=$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,$core,$database,$tbl_pages;

	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='linklist'>";

		$sql = "SELECT * FROM $tbl_pages inner join ".$database["prefix"]."_pages_options on $tbl_pages.id=page_id WHERE page_group=$pagegroup and status<>'d' and i18n = ".$_SESSION["lang_id"]." ORDER BY label ASC";
		$result = $core->query($sql);

		$str .= "<h1>$headline</h1>";
		$str .= "<ul>";
  		while($row = mysql_fetch_array($result)) {
			$str .= "<li><a title=\"$row[pagetitle]\" href=\"index.php?page_id=$row[id]\">$row[label]</a></li>";
		}
		$str .= "</ul>";
		$str .= "<div>$description</div>";

	$str .= "</div>";

	return $str;
}

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