Esempio n. 1
0
function renderWidget($widget, $params = "")
{
    global $DEBUG;
    switch ($widget["type"]) {
        case "inline":
            if ($DEBUG) {
                echo "\n<!-- Calling Function:" . $widget["function"] . " -->\n";
            }
            eval($widget["function"]);
            echo "\n";
            break;
        case "ajax":
            echo "\n\t\t\t<div id=\"" . $widget["block"] . "\"></div>\n";
            break;
        case "header":
            //Support header only widgets.
            break;
        case "mixed":
            foreach ($widget["parts"] as $widgetsub) {
                renderWidget($widgetsub);
            }
            break;
        default:
            if (!empty($widget)) {
                echo "\n\n<strong>INVALID WIDGET SPECIFIED (" . $widget["block"] . ") in section " . $sectionId . "</strong>\n<pre>" . print_r($widget) . "</pre>\n";
            }
    }
}
				echo "\t\t<li id=\"".$wId."\" class=\"widget";
				if (!empty($wAttribute["color"])) {
					echo " ".$wAttribute["color"];
				}
				if (!empty($wAttribute["display"])) {
					echo " ".$wAttribute["display"];
				}
				echo "\">";
				echo "\t\t\t<div class=\"widget-head\">";
				echo "\t\t\t\t<h3>".$wAttribute['title']."</h3>\n";
				echo "\t\t\t</div><!-- .widget-head -->\n";
				echo "\t\t\t<div class=\"widget-content\">\n";
				if(empty($wAttribute['params'])) {
					renderWidget($wIndex[$wId]);
				} else {
					renderWidget($wIndex[$wId], $wAttribute['params']);
				}
				echo "\t\t\t</div><!-- .widget-content -->\n";
				echo "\t\t</li><!-- #".$wId." .widget -->\n";
			}
			echo "\t</ul><!-- #".$sectionId." .section -->\n";
		}
		
?>
		</div><!-- #main -->
    	<script type="text/javascript" src="js/jquery.js"></script>
    	<script type="text/javascript" src="js/widget.js"></script>
		</body>
</html>
<?php
}