Share » Forums » Setup & design » Customised sort in Admin section

Customised sort in Admin section

Customised sort in Admin section

Tuesday 26 June 2007 4:31:49 pm - 4 replies

Author Message

Greg McAvoy-Jensen

Tuesday 26 June 2007 7:48:34 pm

Paul,

One way would be to use the fetch function (http://ez.no/doc/ez_publish/technical_manual/3_9/reference/modules/content/fetch_functions/list):

fetch( 'content', 'list',
 hash( 'parent_node_id',            parent_node_id,
     [ 'sort_by',                   sort_by,                   ]

Perhaps something like this would be a start?

{def $pauls_list=fetch( 'content',         'list',
	hash(	'parent_node_id',     $node.node_id,
		'sort_by',		array( 'attribute', 1, 'pauls_class/start_date')	) )}


{foreach $pauls_list as $children}

	{node_view_gui content_node=$children view="line"}

{/foreach}

Replace "pauls_class" with the class of objects being sorted, and "start_date" with the identifier of "start date", if necessary.

Granite Horizon, Certified Developer of eZ Publish Web Solutions
Provider of the SaaS Solution Granite Horizon In The Cloud | http://granitehorizon.com/cloud
http://granitehorizon.com | +1 916 647 6350 | California USA | @granitegreg
Blog: http://granitehorizon.com/blog

paul bolger

Tuesday 26 June 2007 10:02:17 pm

Thanks Greg, but...

I could do it pretty easily in a display (external node) template, but those admin templates are hellishly complicated! By the looks of things you should be able to add options by adding entries to the hash table above, but I don't know the syntax for adding an attribute, and I'm not sure if it needs to be added somewhere else as well to work.

Paul Bolger

André R.

Wednesday 27 June 2007 1:09:15 am

If you add a custom entry there I'm afraid you have to hack ezcontentobjecttreenode.php to make it work.

Specifically the functions createSortingSQLStrings and sortFieldName.
From the last one you can see what is currently supported:

            case 1:
                return 'path';
            case 2:
                return 'published';
            case 3:
                return 'modified';
            case 4:
                return 'section';
            case 5:
                return 'depth';
            case 6:
                return 'class_identifier';
            case 7:
                return 'class_name';
            case 8:
                return 'priority';
            case 9:
                return 'name';
            case 10:
                return 'modified_subnode';

So I would rather recommend to override children.tpl to override the sorting.

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

paul bolger

Wednesday 27 June 2007 10:45:09 pm

......So I would rather recommend to override children.tpl to override the sorting.

Thanks Andre. I just wanted to check that there isn't an easy way before hoeing into the template.

BTW - is there a way to get these forums to show you the post you are replying to rather than the original question?

Paul Bolger

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu