[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 {* Relations windows. *} 2 <a name="relations"></a> 3 <div class="context-block"> 4 5 {* DESIGN: Header START *}<div class="box-header"><div class="box-tc"><div class="box-ml"><div class="box-mr"><div class="box-tl"><div class="box-tr"> 6 7 {def $related_objects_count = fetch( 'content', 'related_objects_count', hash( 'object_id', $node.object.id , 'all_relations', true() ) )} 8 {def $reverse_related_objects_count = fetch( 'content', 'reverse_related_objects_count', hash( 'object_id', $node.object.id , 'all_relations', true() ) )} 9 <h2 class="context-title">{'Relations [%relation_count]'|i18n( 'design/admin/node/view/full',, hash( '%relation_count', sum( $related_objects_count, $reverse_related_objects_count ) ) )}</h2> 10 11 {* DESIGN: Subline *}<div class="header-subline"></div> 12 13 {* DESIGN: Header END *}</div></div></div></div></div></div> 14 15 {* DESIGN: Content START *}<div class="box-bc"><div class="box-ml"><div class="box-mr"><div class="box-bl"><div class="box-br"><div class="box-content"> 16 17 {* Related objects list. *} 18 19 {def $relation_type_names = hash( 'common', 'Common'|i18n( 'design/admin/content/edit' ), 20 'xml_embed', 'Embedded'|i18n( 'design/admin/content/edit' ), 21 'xml_link', 'Linked'|i18n( 'design/admin/content/edit' ), 22 'attribute', 'Attribute'|i18n( 'design/admin/content/edit' ) )} 23 {def $relation_name_delimiter = ', '} 24 25 {def $empty_array = array( 1 )} 26 {set $empty_array = $empty_array|extract( 1 )} 27 28 <table class="list" cellspacing="0"> 29 <tr> 30 <th>{'Related objects [%related_objects_count]'|i18n( 'design/admin/node/view/full',, hash( '%related_objects_count', $related_objects_count ) )}</th> 31 {if $related_objects_count} 32 <th>{'Class'|i18n( 'design/admin/node/view/full' )}</th> 33 <th>{'Relation type'|i18n( 'design/admin/node/view/full')}</th> 34 {/if} 35 </tr> 36 {if $related_objects_count} 37 {def $related_objects_grouped = fetch( 'content', 'related_objects', hash( 'object_id', $node.object.id, 'all_relations', true(), 'group_by_attribute', true(), 'sort_by', array( array( 'class_identifier', true() ), array( 'name', true() ) ) ) )} 38 {def $related_objects_id_typed = fetch( 'content', 'related_objects_ids', hash( 'object_id', $node.object.id ) )} 39 40 {def $tr_class='bglight'} 41 {def $attr = 0} 42 {foreach $related_objects_grouped as $attribute_id => $related_objects_array } 43 {if ne( $attribute_id, 0 )} 44 {set $attr = fetch( 'content', 'class_attribute', hash( 'attribute_id', $attribute_id ) )} 45 {/if} 46 {foreach $related_objects_array as $object } 47 <tr class="{$tr_class}"> 48 <td>{$object.content_class.identifier|class_icon( small, $object.content_class.name|wash )} {content_view_gui view=text_linked content_object=$object}</td> 49 <td>{$object.content_class.name|wash}</td> 50 <td> 51 {if and( ne( $attribute_id, 0 ), $related_objects_id_typed['attribute']|contains( $object.id ) )} 52 {$relation_type_names['attribute']} ( {$attr.name} ) 53 {elseif eq( $attribute_id, 0 )} 54 {def $relation_name_array = $empty_array} 55 {foreach $related_objects_id_typed as $relation_type => $relation_id_array} 56 {if ne( $relation_type, 'attribute' )} 57 {if $relation_id_array|contains( $object.id )} 58 {set $relation_name_array = $relation_name_array|append( $relation_type_names[$relation_type] )} 59 {/if} 60 {/if} 61 {/foreach} 62 {$relation_name_array|implode( $relation_name_delimiter )} 63 {undef $relation_name_array} 64 {/if} 65 </td> 66 </tr> 67 {if eq( $tr_class,'bdark' )} 68 {set $tr_class='bglight'} 69 {else} 70 {set $tr_class='bgdark'} 71 {/if} 72 {/foreach} 73 {/foreach} 74 {else} 75 <tr><td>{'The item being viewed does not make use of any other objects.'|i18n( 'design/admin/node/view/full' )}</td></tr> 76 {/if} 77 </table> 78 79 {* Reverse related objects list. *} 80 81 <table class="list" cellspacing="0"> 82 <tr> 83 <th>{'Reverse related objects [%related_objects_count]'|i18n( 'design/admin/node/view/full',, hash( '%related_objects_count', $reverse_related_objects_count ) )}</th> 84 {if $reverse_related_objects_count} 85 <th>{'Class'|i18n( 'design/admin/node/view/full' )}</th> 86 <th>{'Relation type'|i18n( 'design/admin/node/view/full' )}</th> 87 {/if} 88 </tr> 89 {if $reverse_related_objects_count} 90 {def $reverse_related_objects_grouped = fetch( 'content', 'reverse_related_objects', hash( 'object_id', $node.object.id, 'all_relations', true(), 'group_by_attribute', true(), 'sort_by', array( array( 'class_identifier', true() ), array( 'name', true() ) ) ) )} 91 {def $reverse_related_objects_id_typed = fetch( 'content', 'reverse_related_objects_ids', hash( 'object_id', $node.object.id ) )} 92 93 {def $tr_class='bglight'} 94 {def $attr = 0} 95 {foreach $reverse_related_objects_grouped as $attribute_id => $related_objects_array } 96 {if ne( $attribute_id, 0 )} 97 {set $attr = fetch( 'content', 'class_attribute', hash( 'attribute_id', $attribute_id ) )} 98 {/if} 99 {foreach $related_objects_array as $object } 100 <tr class="{$tr_class}"> 101 <td>{$object.content_class.identifier|class_icon( small, $object.content_class.name|wash )} {content_view_gui view=text_linked content_object=$object}</td> 102 <td>{$object.content_class.name|wash}</td> 103 <td> 104 {if and( ne( $attribute_id, 0 ), $reverse_related_objects_id_typed['attribute']|contains( $object.id ) )} 105 {$relation_type_names['attribute']} ( {$attr.name} ) 106 {elseif eq( $attribute_id, 0 )} 107 {def $relation_name_array = $empty_array} 108 {foreach $reverse_related_objects_id_typed as $relation_type => $relation_id_array} 109 {if ne( $relation_type, 'attribute' )} 110 {if $relation_id_array|contains( $object.id )} 111 {set $relation_name_array = $relation_name_array|append( $relation_type_names[$relation_type] )} 112 {/if} 113 {/if} 114 {/foreach} 115 {$relation_name_array|implode( $relation_name_delimiter )} 116 {undef $relation_name_array} 117 {/if} 118 </td> 119 </tr> 120 {if eq( $tr_class,'bdark' )} 121 {set $tr_class='bglight'} 122 {else} 123 {set $tr_class='bgdark'} 124 {/if} 125 {/foreach} 126 {/foreach} 127 {else} 128 <tr><td>{'The item being viewed is not in use by any other objects.'|i18n( 'design/admin/node/view/full' )}</td></tr> 129 {/if} 130 </table> 131 132 {* DESIGN: Content END *}</div></div></div></div></div></div> 133 134 </div>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |