08-09-2007 12:13 PM
public function CreateTree($node,$store,$session)
{
foreach($node->children as $child)
{
if($child->child->type == "{http://www.alfresco.org/model/content/1.0}folder")
{
$c_uuid = $child->child->id;
$c_type = "folder";
}
else
{
$c_content = $child->child->cm_content;
$c_uuid = $c_content->getUrl();
$c_type = "content";
}
$c_title = $child->child->cm_title;
$c_description = $child->child->cm_description;
$c_url_name = $child->child->cm_name;
$c_data[] = array('id'=>$c_uuid,'name'=>$c_url_name,'type'=>$c_type, 'title'=>$c_title, 'description'=>$c_description);
}
foreach($node->parents as $parent)
{
$id = $parent->parent->id;
$parent_name = $parent->parent->cm_name;
while($parent_name != "Company Home")
{
$node2 = $session->getNode($store,$id);
$data = array();
foreach($node2->children as $child2)
{
if($parent->child->cm_name == $child2->child->cm_name)
{
$uuid = $child2->child->id;
$url_name = $child2->child->cm_name;
if($child2->child->type == "{http://www.alfresco.org/model/content/1.0}folder")
{
$uuid = $child2->child->id;
$type = "folder";
}
else
{
$content = $child2->child->cm_content;
$uuid = $content->getUrl();
$type = "content";
};
$title = $child2->child->cm_title;
$description = $child2->child->cm_description;
$content = $c_data;
$data[] = array('id'=>$uuid,'name'=>$url_name,'type'=>$type, 'title'=>$title, 'description'=>$description, 'content'=>$content);
}else{
$uuid = $child2->child->id;
$url_name = $child2->child->cm_name;
if($child2->child->type == "{http://www.alfresco.org/model/content/1.0}folder")
{
$uuid = $child2->child->id;
$type = "folder";
}
else
{
$content = $child2->child->cm_content;
$uuid = $content->getUrl();
$type = "content";
};
$title = $child2->child->cm_title;
$description = $child2->child->cm_description;
$data[] = array('id'=>$uuid,'name'=>$url_name,'type'=>$type, 'title'=>$title, 'description'=>$description);
}
}
foreach($node2->parents as $parent2)
{
//assegno i nuovi valori per iserire il parent superiore
$parent_name = $parent2->parent->cm_name;
$parent->child->cm_name = $parent2->child->cm_name;
$id = $parent2->parent->id;
$c_data = $data;
}
}
}
if(empty($data))
$data = $c_data;
return $data;
}
08-15-2007 09:30 AM
08-20-2007 11:25 AM
class Common{
public function ShowTree($contentdata)
{
echo "<ol>";
foreach($contentdata as $content)
{
if($content['type'] == 'folder')
echo "<li><img src='" . IMG_DIR . "/fold.gif'><a href='". BOOT_URL ."/view/index/id/" . $content['id'] . "'>" . $content['name']."</a></li>";
else
echo "<li><img src='" . IMG_DIR . "/post.gif'><a href='". BOOT_URL ."/view/index/url/" . str_replace("/","-.-",$content['id']) . "'>" . $content['name']."</a></li>";
if($content['content'])
$this->ShowTree($content['content']);
echo "</ol>";
}
}
….
….
<div id="left_menu">
<?php
echo "<ul>";
foreach ($this->data_array as $data)
{
echo "<li>";
if($data['type']=='folder')
echo "<img src='" . IMG_DIR . "/fold.gif'><a href='". BOOT_URL ."/view/index/id/" . $data['id'] . "'>" . $data['name']."</a></li>";
else
echo "<img src='" . IMG_DIR . "/post.gif'><a href='". BOOT_URL ."/view/index/url/'" . str_replace("/","-.-",$data['id']) . "''>" . $data['name'] ."</a></li>";
if($data['content'] && is_array($data['content']) && !empty($data['content']))
{
$common=new Common();
$common->ShowTree($data['content']);
}
}
echo "</ul>";
?>
</div>
09-03-2007 07:11 AM
09-12-2007 10:28 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.