Author: sevein
Date: Thu Apr 5 22:04:59 2012
New Revision: 11406
Log:
Basic non-js treeview, getting familiarized with ES
Modified:
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
branches/2.0/apps/qubit/modules/informationobject/templates/_treeView.php
Modified:
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
==============================================================================
---
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Thu Apr 5 18:52:15 2012 (r11405)
+++
branches/2.0/apps/qubit/modules/informationobject/actions/treeViewComponent.class.php
Thu Apr 5 22:04:59 2012 (r11406)
@@ -23,6 +23,7 @@
{
$this->resource = $request->getAttribute('sf_route')->resource;
+ /*
// Get tree (limit 10 siblings and children)
$this->treeViewObjects = $this->resource->getFullYuiTree(10);
@@ -40,5 +41,16 @@
// Is it draggable?
$this->treeViewDraggable =
json_encode(QubitAcl::check(QubitInformationObject::getRoot(), 'update'));
+ */
+
+ $query = new Elastica_Query_Ids('QubitInformationObject',
array($this->resource->id));
+ $this->current = QubitSearch::getInstance()->index->search($query);
+
+ $query = new Elastica_Query_Term(array('parentId' =>
$this->resource->parentId));
+ $this->siblings =
QubitSearch::getInstance()->index->getType('QubitInformationObject')->search($query);
+
+ $query = new Elastica_Query_Term(array('parentId' => $this->resource->id));
+ $this->children =
QubitSearch::getInstance()->index->getType('QubitInformationObject')->search($query);
+
}
}
Modified:
branches/2.0/apps/qubit/modules/informationobject/templates/_treeView.php
==============================================================================
--- branches/2.0/apps/qubit/modules/informationobject/templates/_treeView.php
Thu Apr 5 18:52:15 2012 (r11405)
+++ branches/2.0/apps/qubit/modules/informationobject/templates/_treeView.php
Thu Apr 5 22:04:59 2012 (r11406)
@@ -2,15 +2,46 @@
<ul class="unstyled">
- <?php if (true): ?>
+ <?php if (false): ?>
<li class="back"><i></i><?php echo link_to(__('Show all'), array(),
array('class' => 'arrow-left')) ?></li>
<?php endif; ?>
- <li class="up"><a href="#"><i></i>Foobar <strong>Fonds</strong></a></li>
+ <?php $resultSet = $current->getResults() ?>
+ <?php $doc = $resultSet[0]->getData() ?>
+ <?php foreach ($doc['i18n'] as $i18n): ?>
+ <?php $doc[$i18n['culture']] = $i18n ?>
+ <?php endforeach; ?>
+ <?php unset($doc['i18n']); // continue; ?>
+
+ <?php foreach($doc['ancestors'] as $id): ?>
+ <?php if ($id == QubitInformationObject::ROOT_ID) continue; ?>
+ <?php $ancestor = QubitInformationObject::getById($id) ?>
+ <li class="up"><i></i><?php echo link_to($ancestor, array($ancestor,
'module' => 'informationobject')) ?></li>
+ <?php endforeach; ?>
+
+ <li class="active"><i></i><?php echo link_to($resource, array($resource,
'module' => 'informationobject')) ?></li>
+
+ <?php foreach ($children->getResults() as $hit): ?>
+
+ <?php $doc = $hit->getData() ?>
+ <?php foreach ($doc['i18n'] as $i18n): ?>
+ <?php $doc[$i18n['culture']] = $i18n ?>
+ <?php endforeach; ?>
+ <?php unset($doc['i18n']) // continue; ?>
+
+ <?php if ($hit->getId() == $resource->id): ?>
+ <li class="active"><?php echo $doc[$sf_user->getCulture()]['title'] ?:
$doc[$doc['sourceCulture']]['title'] ?></li>
+ <?php else: ?>
+ <li><?php echo
link_to('<i></i>'.($doc[$sf_user->getCulture()]['title'] ?:
$doc[$doc['sourceCulture']]['title']), array('module' => 'informationobject',
'slug' => $doc['slug'])) ?></li>
+ <?php endif; ?>
- <li class="expand"><a href="#"><i></i>Douglas Coupland
<strong>File</strong></a></li>
+ <?php endforeach; ?>
- <li class=""><a href="#"><i></i>Charles Xingpeau
<strong>File</strong></a></li>
+ <!--
+ <li class="up"><a href="#"><i></i>Foobar <strong>Fonds</strong></a></li>
+ <li class="expand"><a href="#"><i></i>Douglas Coupland
<strong>File</strong></a></li>
+ <li class=""><a href="#">Charles Xingpeau <strong>File</strong></a></li>
+ -->
</ul>
--
You received this message because you are subscribed to the Google Groups
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/qubit-commits?hl=en.