Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 4.0_templates
  • 4.1_templates-symlink
  • develop
  • git-fixes
  • master
5 results

Target

Select target project
  • tneumann9/PlanetRed
  • JSTUREK8/PlanetRed
  • smccoy12/PlanetRed
  • dkuzelka2/PlanetRed
  • s-cwiedel5/PlanetRed
  • dxg/PlanetRed
6 results
Select Git revision
  • 4.0_templates
  • 4.1_templates-symlink
  • develop
  • git-fixes
  • master
5 results
Show changes
Showing
with 1072 additions and 0 deletions
a { color: #336699; text-decoration: none; }
a:hover { color: #6699CC; text-decoration: underline; }
a:active { color: #6699CC; text-decoration: underline; }
body { background : #FFFFFF; }
body, table { font-family: Georgia, Times New Roman, Times, serif; font-size: 10pt }
p, li { line-height: 140% }
a img { border: 0px; }
dd { margin-left: 0px; padding-left: 1em; }
/* Page layout/boxes */
.info-box {}
.info-box-title { margin: 1em 0em 0em 0em; padding: .25em; font-weight: normal; font-size: 14pt; border: 2px solid #999999; background-color: #CCCCFF }
.info-box-body { border: 1px solid #999999; padding: .5em; }
.nav-bar { font-size: 8pt; white-space: nowrap; text-align: right; padding: .2em; margin: 0em 0em 1em 0em; }
.oddrow { background-color: #F8F8F8; border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
.evenrow { border: 1px solid #AAAAAA; padding: .5em; margin-bottom: 1em}
.page-body { max-width: 800px; margin: auto; }
.tree dl { margin: 0px }
/* Index formatting classes */
.index-item-body { margin-top: .5em; margin-bottom: .5em}
.index-item-description { margin-top: .25em }
.index-item-details { font-weight: normal; font-style: italic; font-size: 8pt }
.index-letter-section { background-color: #EEEEEE; border: 1px dotted #999999; padding: .5em; margin-bottom: 1em}
.index-letter-title { font-size: 12pt; font-weight: bold }
.index-letter-menu { text-align: center; margin: 1em }
.index-letter { font-size: 12pt }
/* Docbook classes */
.description {}
.short-description { font-weight: bold; color: #666666; }
.tags { padding-left: 0em; margin-left: 3em; color: #666666; list-style-type: square; }
.parameters { padding-left: 0em; margin-left: 3em; font-style: italic; list-style-type: square; }
.redefinitions { font-size: 8pt; padding-left: 0em; margin-left: 2em; }
.package { }
.package-title { font-weight: bold; font-size: 14pt; border-bottom: 1px solid black }
.package-details { font-size: 85%; }
.sub-package { font-weight: bold; font-size: 120% }
.tutorial { border-width: thin; border-color: #0066ff }
.tutorial-nav-box { width: 100%; border: 1px solid #999999; background-color: #F8F8F8; }
.nav-button-disabled { color: #999999; }
.nav-button:active,
.nav-button:focus,
.nav-button:hover { background-color: #DDDDDD; outline: 1px solid #999999; text-decoration: none }
.folder-title { font-style: italic }
/* Generic formatting */
.field { font-weight: bold; }
.detail { font-size: 8pt; }
.notes { font-style: italic; font-size: 8pt; }
.separator { background-color: #999999; height: 2px; }
.warning { color: #FF6600; }
.disabled { font-style: italic; color: #999999; }
/* Code elements */
.line-number { }
.class-table { width: 100%; }
.class-table-header { border-bottom: 1px dotted #666666; text-align: left}
.class-name { color: #000000; font-weight: bold; }
.method-summary { padding-left: 1em; font-size: 8pt }
.method-header { }
.method-definition { margin-bottom: .3em }
.method-title { font-weight: bold; }
.method-name { font-weight: bold; }
.method-signature { font-size: 85%; color: #666666; margin: .5em 0em }
.method-result { font-style: italic; }
.var-summary { padding-left: 1em; font-size: 8pt; }
.var-header { }
.var-title { margin-bottom: .3em }
.var-type { font-style: italic; }
.var-name { font-weight: bold; }
.var-default {}
.var-description { font-weight: normal; color: #000000; }
.include-title { }
.include-type { font-style: italic; }
.include-name { font-weight: bold; }
.const-title { }
.const-name { font-weight: bold; }
/* Syntax highlighting */
.src-code { border: 1px solid #336699; padding: 1em; background-color: #EEEEEE; }
.src-comm { color: green; }
.src-id { }
.src-inc { color: #0000FF; }
.src-key { color: #0000FF; }
.src-num { color: #CC0000; }
.src-str { color: #66cccc; }
.src-sym { font-weight: bold; }
.src-var { }
.src-php { font-weight: bold; }
.src-doc { color: #009999 }
.src-doc-close-template { color: #0000FF }
.src-doc-coretag { color: #0099FF; font-weight: bold }
.src-doc-inlinetag { color: #0099FF }
.src-doc-internal { color: #6699cc }
.src-doc-tag { color: #0080CC }
.src-doc-template { color: #0000FF }
.src-doc-type { font-style: italic }
.src-doc-var { font-style: italic }
/* tutorial */
.authors { }
.author { font-style: italic; font-weight: bold }
.author-blurb { margin: .5em 0em .5em 2em; font-size: 85%; font-weight: normal; font-style: normal }
.example { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em }
.listing { border: 1px dashed #999999; background-color: #EEEEEE; padding: .5em; white-space: nowrap }
.release-info { font-size: 85%; font-style: italic; margin: 1em 0em }
.ref-title-box { }
.ref-title { }
.ref-purpose { font-style: italic; color: #666666 }
.ref-synopsis { }
.title { font-weight: bold; margin: 1em 0em 0em 0em; padding: .25em; border: 2px solid #999999; background-color: #CCCCFF }
.cmd-synopsis { margin: 1em 0em }
.cmd-title { font-weight: bold }
.toc { margin-left: 2em; padding-left: 0em }
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title></title>
<link rel="stylesheet" href="media/stylesheet.css" />
<link rel="stylesheet" href="media/banner.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div class="banner">
<div class="banner-title">Structures_Graph</div>
<div class="banner-menu">
<table cellpadding="0" cellspacing="0" style="width: 100%">
<tr>
<td>
</td>
<td style="width: 2em">&nbsp;</td>
<td style="text-align: right">
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
\ No newline at end of file
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- template designed by Marco Von Ballmoos -->
<title>Todo List</title>
<link rel="stylesheet" href="media/stylesheet.css" />
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
</head>
<body>
<div align="center"><h1>Todo List</h1></div>
<h2>Structures_Graph</h2>
<h3><a href="Structures_Graph/Structures_Graph.html#methodremoveNode">Structures_Graph::removeNode()</a></h3>
<ul>
<li>This is unimplemented</li>
</ul>
<p class="notes" id="credit">
Documentation generated on Fri, 30 Jan 2004 16:37:29 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.2.3</a>
</p>
</body>
</html>
\ No newline at end of file
<refentry id="{@id package.database.structures_graph.tutorial}">
<refnamediv>
<refname><classname>Structures_Graph</classname> Tutorial</refname>
<refpurpose>A first tour of graph datastructure manipulation</refpurpose>
</refnamediv>
<refsect1 id="{@id package.database.structures_graph.tutorial.intro}">
<title>Introduction</title>
<para>
Structures_Graph is a package for creating and manipulating graph datastructures. A graph is a set of objects, called nodes, connected by arcs. When used as a datastructure, usually nodes contain data, and arcs represent relationships between nodes. When arcs have a direction, and can be travelled only one way, graphs are said to be directed. When arcs have no direction, and can always be travelled both ways, graphs are said to be non directed.
</para>
<para>
Structures_Graph provides an object oriented API to create and directly query a graph, as well as a set of Manipulator classes to extract information from the graph.
</para>
</refsect1>
<refsect1 id="{@id package.database.structures_graph.tutorial.creation}">
<title>Creating a Graph</title>
<para>
Creating a graph is done using the simple constructor:
<programlisting>
<![CDATA[
require_once 'Structures/Graph.php';
$directedGraph =& new Structures_Graph(true);
$nonDirectedGraph =& new Structures_Graph(false);
]]>
</programlisting>
and passing the constructor a flag telling it whether the graph should be directed. A directed graph will always be directed during its lifetime. It's a permanent characteristic.
</para>
<para>
To fill out the graph, we'll need to create some nodes, and then call Graph::addNode.
<programlisting>
<![CDATA[
require_once 'Structures/Graph/Node.php';
$nodeOne =& new Structures_Graph_Node();
$nodeTwo =& new Structures_Graph_Node();
$nodeThree =& new Structures_Graph_Node();
$directedGraph->addNode(&$nodeOne);
$directedGraph->addNode(&$nodeTwo);
$directedGraph->addNode(&$nodeThree);
]]>
</programlisting>
and then setup the arcs:
<programlisting>
<![CDATA[
$nodeOne->connectTo($nodeTwo);
$nodeOne->connectTo($nodeThree);
]]>
</programlisting>
Note that arcs can only be created after the nodes have been inserted into the graph.
</para>
</refsect1>
<refsect1 id="{@id package.database.structures_graph.tutorial.nodesanddata}">
<title>Associating Data</title>
<para>
Graphs are only useful as datastructures if they can hold data. Structure_Graph stores data in nodes. Each node contains a setter and a getter for its data.
<programlisting>
<![CDATA[
$nodeOne->setData("Node One's Data is a String");
$nodeTwo->setData(1976);
$nodeThree->setData('Some other string');
print("NodeTwo's Data is an integer: " . $nodeTwo->getData());
]]>
</programlisting>
</para>
<para>
Structure_Graph nodes can also store metadata, alongside with the main data. Metadata differs from regular data just because it is stored under a key, making it possible to store more than one data reference per node. The metadata getter and setter need the key to perform the operation:
<programlisting>
<![CDATA[
$nodeOne->setMetadata('example key', "Node One's Sample Metadata");
print("Metadata stored under key 'example key' in node one: " . $nodeOne->getMetadata('example key'));
$nodeOne->unsetMetadata('example key');
]]>
</programlisting>
</para>
</refsect1>
<refsect1 id="{@id package.database.structures_graph.tutorial.querying}">
<title>Querying a Graph</title>
<para>
Structures_Graph provides for basic querying of the graph:
<programlisting>
<![CDATA[
// Nodes are able to calculate their indegree and outdegree
print("NodeOne's inDegree: " . $nodeOne->inDegree());
print("NodeOne's outDegree: " . $nodeOne->outDegree());
// and naturally, nodes can report on their arcs
$arcs = $nodeOne->getNeighbours();
for ($i=0;$i<sizeof($arcs);$i++) {
print("NodeOne has an arc to " . $arcs[$i]->getData());
}
]]>
</programlisting>
</para>
</refsect1>
</refentry>
A few examples of Cache_Lite using :
------------------------------------
>>> Basic one :
<?php
// Include the package
require_once('Cache/Lite.php');
// Set a id for this cache
$id = '123';
// Set a few options
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 3600
);
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
// Test if thereis a valide cache for this id
if ($data = $Cache_Lite->get($id)) {
// Cache hit !
// Content is in $data
// (...)
} else { // No valid cache found (you have to make the page)
// Cache miss !
// Put in $data datas to put in cache
// (...)
$Cache_Lite->save($data);
}
?>
>>> Usage with blocks
(You can use Cache_Lite for caching blocks and not the whole page)
<?php
require_once('Cache/Lite.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 3600
);
// Create a Cache_Lite object
$Cache_Lite = new Cache_Lite($options);
if ($data = $Cache_Lite->get('block1')) {
echo($data);
} else {
$data = 'Data of the block 1';
$Cache_Lite->save($data);
}
echo('<br><br>Non cached line !<br><br>');
if ($data = $Cache_Lite->get('block2')) {
echo($data);
} else {
$data = 'Data of the block 2';
$Cache_Lite->save($data);
}
?>
A few examples of Cache_Lite_Output using :
-------------------------------------------
>>> Basic one :
<?php
require_once('Cache/Lite/Output.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Output($options);
if (!($cache->start('123'))) {
// Cache missed...
for($i=0;$i<1000;$i++) { // Making of the page...
echo('0123456789');
}
$cache->end();
}
?>
>>> Usage with blocks :
(You can use Cache_Lite_Output for caching blocks and not the whole page)
<?php
require_once('Cache/Lite/Output.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Output($options);
if (!($cache->start('block1'))) {
// Cache missed...
echo('Data of the block 1 !<br>');
$cache->end();
}
echo('<br><br>Non cached line !<br><br>');
if (!($cache->start('block2'))) {
// Cache missed...
echo('Data of the block 2 !<br>');
$cache->end();
}
A few examples of Cache_Lite_Function using :
---------------------------------------------
>>> With function :
<?php
require_once('Cache/Lite/Function.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Function($options);
$cache->call('function_to_bench', 12, 45);
function function_to_bench($arg1, $arg2)
{
echo "This is the output of the function function_to_bench($arg1, $arg2) !<br>";
return "This is the result of the function function_to_bench($arg1, $arg2) !<br>";
}
?>
>>> With method :
<?php
require_once('Cache/Lite/Function.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Function($options);
$obj = new bench();
$obj->test = 666;
$cache->call('obj->method_to_bench', 12, 45);
class bench
{
var $test;
function method_to_bench($arg1, $arg2)
{
echo "\$obj->test = $this->test and this is the output of the method \$obj->method_to_bench($arg1, $arg2) !<br>";
return "\$obj->test = $this->test and this is the result of the method \$obj->method_to_bench($arg1, $arg2) !<br>";
}
}
?>
>>> With static method :
<?php
require_once('Cache/Lite/Function.php');
$options = array(
'cacheDir' => '/tmp/',
'lifeTime' => 10
);
$cache = new Cache_Lite_Function($options);
$cache->call('bench::static_method_to_bench', 12, 45);
class bench
{
var $test;
function static_method_to_bench($arg1, $arg2) {
echo "This is the output of the function static_method_to_bench($arg1, $arg2) !<br>";
return "This is the result of the function static_method_to_bench($arg1, $arg2) !<br>";
}
}
?>
>>> IMPORTANT :
If you try to use Cache_Lite_Function with $this object ($cache->call('this->method',...)
for example), have a look first at :
http://pear.php.net/bugs/bug.php?id=660
A few examples of Cache_Lite_File using :
-----------------------------------------
<?php
$options = array(
'cacheDir' => '/tmp/',
'masterFile' => '/home/web/config.xml'
);
$cache = new Cache_Lite_File($options);
// Set a id for this cache
$id = '123';
if ($data = $cache->get($id)) {
// Cache hit !
// Content is in $data
// (...)
} else { // No valid cache found (you have to make the page)
// Cache miss !
// Put in $data datas to put in cache
// (...)
$cache->save($data);
}
?>
Technical choices for Cache_Lite...
-----------------------------------
To begin, the main goals of Cache_Lite :
- performances
- safe use (even on very high traffic or with NFS (file locking doesn't work
with NFS))
- flexibility (can be used by the end user or as a part of a larger script)
For speed reasons, it has been decided to focus on the file container (the
faster one). So, cache is only stored in files. The class is optimized for that.
If you want to use a different cache container, have a look to PEAR/Cache.
For speed reasons too, the class 'Cache_Lite' has do be independant (so no
'require_once' at all in 'Cache_Lite.php'). But, a conditional include_once
is allowed. For example, when an error is detected, the class include dynamicaly
the PEAR base class 'PEAR.php' to be able to use PEAR::raiseError(). But, in
most cases, PEAR.php isn't included.
For the second goal (safe use), there is three (optional) mecanisms :
- File Locking : seems to work fine (but not with distributed file system
like NFS...)
- WriteControl : the cache is read and compared just after being stored
(efficient but not perfect)
- ReadControl : a control key (crc32(), md5() ou strlen()) is embeded is the
cache file and compared just after reading (the most efficient
but the slowest)
<?php
/**
* Template Definition for template_style1.dwt
*/
require_once 'UNL/DWT.php';
class UNL_DWT_Template_style1 extends UNL_DWT
{
###START_AUTOCODE
/* the code below is auto generated do not remove the above tag */
var $__template = 'Template_style1.tpl'; // template name
var $doctitle = "<title>Sample Template Style 1</title>"; // string()
var $head = ""; // string()
var $header = "Header"; // string()
var $leftnav = "<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut. </p>"; // string()
var $content = "<h2>Subheading</h2> <p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p> <p> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>"; // string()
var $footer = "Footer"; // string()
/* Static get */
function staticGet($k,$v=NULL) { return UNL_DWT::staticGet('UNL_DWT_Template_style1',$k,$v); }
/* the code above is auto generated do not remove the tag below */
###END_AUTOCODE
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/template_style1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Sample Template Style 1</title>
<!-- InstanceEndEditable -->
<style type="text/css">
#container
{
width: 90%;
margin: 10px auto;
background-color: #fff;
color: #333;
border: 1px solid gray;
line-height: 130%;
}
#top
{
padding: .5em;
background-color: #ddd;
border-bottom: 1px solid gray;
}
#top h1
{
padding: 0;
margin: 0;
}
#leftnav
{
float: left;
width: 160px;
margin: 0;
padding: 1em;
}
#content
{
margin-left: 200px;
border-left: 1px solid gray;
padding: 1em;
max-width: 36em;
}
#footer
{
clear: both;
margin: 0;
padding: .5em;
color: #333;
background-color: #ddd;
border-top: 1px solid gray;
}
#leftnav p { margin: 0 0 1em 0; }
#content h2 { margin: 0 0 .5em 0; }
</style>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>
<body>
<div id="container">
<div id="top">
<h1>
<!-- InstanceBeginEditable name="header" -->
Header
<!-- InstanceEndEditable -->
</h1>
</div>
<div id="leftnav">
<!-- InstanceBeginEditable name="leftnav" -->
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut. </p>
<!-- InstanceEndEditable -->
</div>
<div id="content">
<!-- InstanceBeginEditable name="content" -->
<h2>Subheading</h2>
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p>
<p> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
<!-- InstanceEndEditable -->
</div>
<div id="footer">
<!-- InstanceBeginEditable name="footer" -->
Footer
<!-- InstanceEndEditable -->
</div>
</div>
</body>
</html>
[UNL_DWT]
dwt_location = /Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/
class_location = /Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/
tpl_location = /Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/
class_prefix = UNL_DWT_
\ No newline at end of file
<?php
/**
* This example uses the DWT object generated by: '/usr/local/bin/php /Users/bbieber/Documents/workspace/UNL_Elgg/lib/php/UNL/DWT/createTemplates.php /Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/example.ini'
*
*/
ini_set('display_errors',true);
error_reporting(E_ALL|E_STRICT);
require_once 'UNL/DWT.php';
if ('/Users/bbieber/Documents/workspace/UNL_Elgg/lib/data' == '@'.'DATA_DIR@') {
$configfile = 'example.test.ini';
} else {
$configfile = '/Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/example.ini';
}
$config = parse_ini_file($configfile, true);
foreach($config as $class=>$values) {
UNL_DWT::$options = $values;
}
$page = UNL_DWT::factory('Template_style1');
$page->header = "Example Using Template Style 1";
$page->leftnav = "<ul><li><a href='http://pear.unl.edu/'>UNL PEAR Channel</a></li></ul>";
$page->content = "<p>This example demonstrates the usefulness of the DWT object generator for Dreamweaver Templates.</p>";
$page->content .= "<p>Included with the DWT package is a Dreamweaver template with 4 editable regions [template_style1.dwt]. This page is rendered using the DWT class created from that template.</p>";
$page->content .= "<p>To create classes for your Templates, create a .ini file with the location of your Dreamweaver templates (dwt's) and then run the createTemplates.php script to generate objects for each of your template files.</p>";
$page->content .= "<p>Here is the ini file used to create the Template_style1:<pre><code>".file_get_contents($configfile)."</code></pre></p>";
$page->content .= "<p>And the command used to create the template classes:<pre><code>/usr/local/bin/php /Users/bbieber/Documents/workspace/UNL_Elgg/lib/php/UNL/DWT/createTemplates.php /Users/bbieber/Documents/workspace/UNL_Elgg/lib/docs/UNL_DWT/docs/examples/example.ini</code></pre></p>";
$page->footer = "<a href='mailto:brett.bieber@gmail.com'>Brett Bieber</a>";
echo $page->toHtml();
\ No newline at end of file
<?php
require_once 'UNL/DWT/Scanner.php';
$file = file_get_contents(dirname(__FILE__).'/'.'template_style1.dwt');
$scanned = new UNL_DWT_Scanner($file);
echo $scanned->leftnav;
echo $scanned->content;
?>
\ No newline at end of file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Sample Template Style 1</title>
<!-- TemplateEndEditable -->
<style type="text/css">
#container
{
width: 90%;
margin: 10px auto;
background-color: #fff;
color: #333;
border: 1px solid gray;
line-height: 130%;
}
#top
{
padding: .5em;
background-color: #ddd;
border-bottom: 1px solid gray;
}
#top h1
{
padding: 0;
margin: 0;
}
#leftnav
{
float: left;
width: 160px;
margin: 0;
padding: 1em;
}
#content
{
margin-left: 200px;
border-left: 1px solid gray;
padding: 1em;
max-width: 36em;
}
#footer
{
clear: both;
margin: 0;
padding: .5em;
color: #333;
background-color: #ddd;
border-top: 1px solid gray;
}
#leftnav p { margin: 0 0 1em 0; }
#content h2 { margin: 0 0 .5em 0; }
</style>
<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
</head>
<body>
<div id="container">
<div id="top">
<h1><!-- TemplateBeginEditable name="header" -->Header<!-- TemplateEndEditable --></h1>
</div>
<div id="leftnav"><!-- TemplateBeginEditable name="leftnav" -->
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut. </p>
<!-- TemplateEndEditable --></div>
<div id="content"><!-- TemplateBeginEditable name="content" -->
<h2>Subheading</h2>
<p> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </p>
<p> Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. </p>
<!-- TemplateEndEditable --></div>
<div id="footer"><!-- TemplateBeginEditable name="footer" -->Footer<!-- TemplateEndEditable --></div>
</div>
</body>
</html>
<?php
/**
* This file conducts a simple ldap search
*
* PHP version 5
*
* $Id$
*
* @category Default
* @package UNL_LDAP
* @author Brett Bieber <brett.bieber@gmail.com>
* @copyright 2009 Regents of the University of Nebraska
* @license http://www1.unl.edu/wdn/wiki/Software_License BSD License
* @link http://pear.unl.edu/package/UNL_LDAP
*/
chdir(dirname(__FILE__).'/../../');
require_once 'UNL/LDAP.php';
require_once 'config.inc.php';
$ldap = UNL_LDAP::getConnection($options);
$results = $ldap->search('dc=unl,dc=edu', '(|(sn=ryan lim)(cn=ryan lim)(&(| (givenname=ryan) (sn=ryan) (mail=ryan) (unlemailnickname=ryan) (unlemailalias=ryan))(| (givenname=lim) (sn=lim) (mail=lim) (unlemailnickname=lim) (unlemailalias=lim))))');
$results->sort('uid');
echo count($results).' results found.'.PHP_EOL;
foreach ($results as $entry) {
echo '<pre>';
print_r($entry);
echo $entry->givenName.' '.$entry->sn.' is '.$entry->uid.PHP_EOL;
echo $entry->cn;
if (count($entry->objectClass)) {
echo $entry->givenName.' is a member of:';
foreach ($entry->objectClass as $class) {
echo $class.',';
}
echo PHP_EOL.'<br>';
}
}
highlight_file(__FILE__);
\ No newline at end of file
<?php
chdir(dirname(__FILE__).'/../../');
require_once 'UNL/LDAP.php';
require_once 'config.inc.php';
echo '<pre>';
$ldap1 = UNL_LDAP::getConnection($options);
$result = $ldap1->search('dc=unl,dc=edu', '(|(sn=ryan lim)(cn=ryan lim)(&(| (givenname=ryan) (sn=ryan) (mail=ryan) (unlemailnickname=ryan) (unlemailalias=ryan))(| (givenname=lim) (sn=lim) (mail=lim) (unlemailnickname=lim) (unlemailalias=lim))))');
$result->sort('uid');
echo $result->count().' results found.'.PHP_EOL;
foreach ($result as $entry) {
echo $entry->givenName.' '.$entry->sn.' is '.$entry->uid.PHP_EOL;
if (count($entry->objectClass)) {
echo $entry->givenName.' is a member of:';
foreach ($entry->objectClass as $class) {
echo $class.',';
}
echo PHP_EOL;
}
}
echo '<br />';
$ldap2 = UNL_LDAP::getConnection($ldap2_options);
$result = $ldap2->search('dc=unl,dc=edu', '(|(sn=ryan lim)(cn=ryan lim)(&(| (givenname=ryan) (sn=ryan) (mail=ryan) (unlemailnickname=ryan) (unlemailalias=ryan))(| (givenname=lim) (sn=lim) (mail=lim) (unlemailnickname=lim) (unlemailalias=lim))))');
$result->sort('uid');
echo $result->count().' results found.'.PHP_EOL;
foreach ($result as $entry) {
echo $entry->givenName.' '.$entry->sn.' is '.$entry->uid.PHP_EOL;
if (count($entry->objectClass)) {
echo $entry->givenName.' is a member of:';
foreach ($entry->objectClass as $class) {
echo $class.',';
}
echo PHP_EOL;
}
}
?>
\ No newline at end of file
<?php
require_once 'UNL/Autoload.php';
set_include_path(dirname(dirname(__FILE__)).'/src/'.PATH_SEPARATOR.dirname(dirname(__FILE__)).'/lib/php'.PATH_SEPARATOR.get_include_path());
<?php
require_once 'config.inc.php';
$pf = new UNL_Peoplefinder();
$results = $pf->getExactMatches('Bieber');
foreach ($results as $uid) {
echo $uid->cn.'<br />';
}
\ No newline at end of file
<?php
require_once 'config.inc.php';
$pf = new UNL_Peoplefinder();
$results = $pf->getLikeMatches('Bieber');
foreach ($results as $uid) {
echo $uid->cn.'<br />';
}
\ No newline at end of file
<?php
require_once 'config.inc.php';
$pf = new UNL_Peoplefinder($driver);
$uid = $pf->getUID('bbieber2');
echo 'uid:' . $uid->uid;
echo ' cn:' . $uid->cn;
echo ' mail:' . $uid->mail;
echo ' department:' . $uid->unlHRPrimaryDepartment;
foreach ($uid->eduPersonAffiliation as $affiliation) {
echo ' affiliation:' . $affiliation;
}
\ No newline at end of file
#!/usr/bin/env php
<?php
if (!isset($_SERVER['argv'],$_SERVER['argv'][1])
|| $_SERVER['argv'][1] == '--help' || $_SERVER['argc'] != 2) {
echo "This program requires 1 argument.\n";
echo "convert.php oldfile.shtml newfile.shtml\n\n";
exit();
}
require_once 'UNL/Autoload.php';
if (!file_exists($_SERVER['argv'][1])) {
echo "Filename does not exist!\n";
exit();
}
UNL_Templates::$options['version'] = 3;
UNL_Templates::$options['templatedependentspath'] = '/Library/WebServer/Documents';
$p = new UNL_Templates_Scanner(file_get_contents($_SERVER['argv'][1]));
$new = UNL_Templates::factory('Fixed');
UNL_Templates::$options['templatedependentspath'] = '/Library/WebServer/Documents';
foreach ($p->getRegions() as $region) {
if (count($region)) {
$new->{$region->name} = $region->value;
}
}
UNL_Templates::$options['templatedependentspath'] = 'paththatdoesnotexist!';
echo $new;
?>
\ No newline at end of file
<?php
require_once 'UNL/Templates.php';
class CustomClass
{
public $template;
function __construct()
{
$this->template = UNL_Templates::factory('Fixed');
$this->autoGenerate('Department of Mathematics', 'Math');
}
function autoGenerateBreadcrumbs($unitShortName, array $organization = array('name' => 'UNL', 'url' => 'http://www.unl.edu/'), $delimiter = ' | ')
{
$fileName = array_shift(explode('.', array_pop(explode(DIRECTORY_SEPARATOR, htmlentities($_SERVER['SCRIPT_NAME'])))));
$generatedBreadcrumbs = '';
$generatedDocTitle = '';
$isIndexPage = preg_match('/index/', $fileName);
$searchFor = array($_SERVER['DOCUMENT_ROOT'], '_');
$replaceWith = array($unitShortName, ' ');
$keys = explode(DIRECTORY_SEPARATOR, str_replace($searchFor, $replaceWith, getcwd()));
$values = array();
for ($i = count($keys)-1; $i >= 0; $i--) {
array_push($values, str_replace($_SERVER['DOCUMENT_ROOT'], '', implode(DIRECTORY_SEPARATOR, explode(DIRECTORY_SEPARATOR, getcwd(), -$i)).DIRECTORY_SEPARATOR));
}
for ($i = 0; $i < count($keys) - $isIndexPage ; $i++) {
$generatedBreadcrumbs .= '<li><a href="'. $values[$i] .'">' . ucwords($keys[$i]) .' </a></li> ';
$generatedDocTitle .= ucwords($keys[$i]) . $delimiter;
}
if ($isIndexPage) {
$generatedBreadcrumbs .= '<li>'. ucwords(end($keys)) .'</li></ul>';
$generatedDocTitle .= ucwords(end($keys));
} else {
$generatedBreadcrumbs .= '<li>'. ucwords($fileName) .'</li></ul>';
$generatedDocTitle .= ucwords($fileName);
}
$doctitle = '<title>' . $organization['name'] . $delimiter . $generatedDocTitle . '</title>';
$breadcrumbs = '<ul><li class="first"><a href="'.$organization['url'].'">'.$organization['name'].'</a></li> ' . $generatedBreadcrumbs;
$this->template->doctitle = $doctitle;
$this->template->breadcrumbs = $breadcrumbs;
}
/**
* This function finds an html file with the content of the body file and
* inserts it into the template.
*
* @param string $unitName Name of the department/unit
*
* @return void
*/
function autoGenerateBody($unitName)
{
// The file that has the body is in the same dir with the same base file name.
$bodyFile = array_shift(explode('.', array_pop(explode(DIRECTORY_SEPARATOR, htmlentities($_SERVER['SCRIPT_NAME']))))) . '.html';
$maincontentarea_array = file($bodyFile);
$maincontentarea = implode(' ', $maincontentarea_array);
$subhead = preg_replace('/<!--\s*(.+)\s*-->/i', '$1', array_shift($maincontentarea_array));
$titlegraphic = '<h1>' . $unitName . '</h1><h2>' . $subhead . '</h2>';
$this->template->titlegraphic = $titlegraphic;
$this->template->maincontentarea = $maincontentarea;
}
/**
* Autogenerate the contents of a page.
*
* @param string $unitName name of the unit/department
* @param string $unitShortName abbreviation for the unit
* @param array $organization organization heirarchy
* @param string $delimiter what separates files
*
* @return void
*/
function autoGenerate($unitName, $unitShortName, array $organization = array('name' => 'UNL', 'url' => 'http://www.unl.edu/'), $delimiter = ' | ')
{
$this->autoGenerateBreadcrumbs($unitShortName, $organization, $delimiter);
$this->autoGenerateBody($unitName);
}
/**
* renders a string representation of the template
*
* @return unknown
*/
function __toString()
{
return $this->template->toHtml();
}
}
?>
\ No newline at end of file