|
Łukasz Serwatka
|
Tuesday 30 November 2004 10:31:00 pm
Comment17043
Hi, Poll i normaly object so you can build templeate for for this class and add this to view results.
{set-block scope=global variable=title}{'Poll %pollname'|i18n('design/standard/content/poll',,hash('%pollname',$node.name))}{/set-block}
<div class="folderTitle">Poll results</div><br />
<div style="padding-left: 4px">
{section loop=$node.object.contentobject_attributes}
{section show=$:item.contentclass_attribute.is_information_collector}
{let attribute=$:item
contentobject_attribute_id=cond($attribute|get_class|eq('ezinformationcollectionattribute'),$attribute.contentobject_attribute_id,
$attribute|get_class|eq('ezcontentobjectattribute'),$attribute.id)
contentobject_attribute=cond($attribute|get_class|eq('ezinformationcollectionattribute'),$attribute.contentobject_attribute,
$attribute|get_class|eq('ezcontentobjectattribute'),$attribute)
total_count=fetch('content','collected_info_count', hash( 'object_attribute_id', $contentobject_attribute_id ) )
item_counts=fetch('content','collected_info_count_list', hash( 'object_attribute_id', $contentobject_attribute_id ) ) }
<h3>{$contentobject_attribute.content.nazwa}</h3>
<table width="100%"border="0" cellspacing="0" cellpadding="0">
<tr>
{section name=Option loop=$contentobject_attribute.content.option_list}
{let item_count=0}
{section show=is_set($item_counts[$:item.id])}
{set item_count=$item_counts[$:item.id]}
{/section}
<td>
</td>
<td>
<table width="250px" cellspacing="0" cellpadding="0" border="0">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="50%" align="left" height="23">{$:item.value}</td>
<td width="50%" align="right"><strong>{div(mul($:item_count,100),$total_count)|l10n(number)} % </strong> ({$:item_count})
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#890101" height="2" width="{div(mul($:item_count,250),$total_count)}"></td>
<td bgcolor="#D9D9D9" height="2" width="{sub(250,div(mul($:item_count,250),$total_count))}"></td>
</tr>
</table>
</td>
<td>
</td>
{/let}
{delimiter}
</tr>
<tr>
{/delimiter}
{/section}
</tr>
</table>
{/let}
{section-else}
{section show=$attribute_hide_list|contains($:item.contentclass_attribute.identifier)|not}
<div class="object_title">{attribute_view_gui attribute=$:item}</div>
{/section}
{/section}
{/section}
<br/>
{"%count total votes"|i18n( 'design/standard/content/poll' ,,
hash( '%count', fetch( content, collected_info_count, hash( object_id, $node.object.id ) ) ) )}
</div>
Just paste it into new template thet display poll results. You will get only results so your users cant`t vote for it any more.
Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog
|