7.1

Table Of Contents
This function generates the <li> elements required by the Treeview plugin. When a publication type contains one or multiple
documents a sub list is created, again using <ul> and <li> elements. For each document a link to the preview_init_form is
inserted supplying the internal ID of the document. The functions of the preview_init_form file determine the workflow of that
document (e.g. show the User Input fields page or Database Upload page).
foreach ($treeDataArray as $publicationTypes)
{
renderPublicationType($publicationTypes);
}
function renderPublicationType($publicationType)
{
echo "<li><span class='folder'>" . $publicationType['name'] . "</span><ul>";
if (isset($publicationType['publicationTypes'])) {
foreach ($publicationType['publicationTypes'] as $subPublicationType) {
renderPublicationType($subPublicationType);
}
}
if (isset($publicationType['documents'])) {
foreach ($publicationType['documents'] as $document) {
echo "<li><span class='file'>";
echo "<a href='site.php?formid=preview_init_form&id=" . $document['id'] . "'>";
echo $document['name'];
echo "</a>";
echo "</span></li>";
}
} else {
if (!isset($publicationType['publicationTypes'])) {
echo "<li><a href='#'>-</a></li>";
}
}
echo "</ul></li>";
}
Virtual Subfolders
In the current version of PrintShop Mail Web a publication type can not contain subfolders. You can however simulate nested
publication types. The getTree() function can create virtual sub publication types or sub folders based on a delimiter character
that appears in a document name.
When you call the function as follows getTree('', '_');, it will split the template names using the underscore character (if it
exists in the name). The parts are used for the virtual folder name, the last part is used as the document name.
©2010 Objectif Lune Inc - 258 -