Feng Forum

Support => How To's => : lbptl July 26, 2010, 05:56:37 AM

: Date wise Workspace sorting
: lbptl July 26, 2010, 05:56:37 AM
Hi All,

Here I require some different thing that is "Date wise workspace sorting: i.e. new created workspace should be come first in workspace list".

Can any one help me and let me know which code is require to change and in which file.

It is urgent. Your help is highly appreciated.

Thanks in advance.
: Re: Date wise Workspace sorting
: cabeza July 26, 2010, 11:38:19 AM
The PHP Code is found mainly at the end of application/controller/ProjectController.class.php

To modify the javascript control, take a look at 2 files in public/assets/javascript/og :
WorkspacePanel.js and WorkspaceChooser.js
: Re: Date wise Workspace sorting
: lbptl July 28, 2010, 05:34:20 AM
I know that the code is in 2 js files mainly WorkspacePanel.js and WorkspaceChooser.js respectively.

But in which place i should make a change ?? so workspace is sorted by datewise. i am not understand the flow for sorting workspace  :(

Thanks in advance !
: Re: Date wise Workspace sorting
: alvarotm01 July 28, 2010, 11:31:23 AM
Workspaces are sent ordered by the server, the function that return the workspaces is list_projects() in ProjectController.
There it is called the function User::getWorkspaces() and this function uses
ProjectUsers::getProjectsByUser().
This last function takes the parameter "order_by", if not passed then name will be used to order. You have to pass your order criteria to this function
: Re: Date wise Workspace sorting
: lbptl July 29, 2010, 05:56:36 AM
As per your suggestion i have modify the SQL query

$sql = "SELECT $projects_table.* FROM $projects_table, $project_users_table WHERE $commoncond AND ($usercond OR $groupcond) ORDER BY $projects_table.`id` desc ";

it runs perfect in mysql but when the workspace loaded in application then it displays in ascending order!

Can you please suggest me in which place i can make a change or provide modified code  :)

Its Urgent!!