Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Curriculum-Request
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tim Steiner
Curriculum-Request
Commits
6c3e86d0
Commit
6c3e86d0
authored
17 years ago
by
Tim Steiner
Browse files
Options
Downloads
Patches
Plain Diff
Allow for some sorting on the home page.
parent
e9eb27ec
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
application/controllers/HomeController.php
+73
-15
73 additions, 15 deletions
application/controllers/HomeController.php
application/views/home.xhtml
+6
-6
6 additions, 6 deletions
application/views/home.xhtml
with
79 additions
and
21 deletions
application/controllers/HomeController.php
+
73
−
15
View file @
6c3e86d0
...
...
@@ -15,6 +15,12 @@ class HomeController extends Nmc_Controller_Action
/************/
$sortBy
=
Nmc_Registry_Session
::
getInstance
(
'home'
)
->
sortBy
;
if
(
!
is_array
(
$sortBy
))
{
$sortBy
=
array
(
'subject'
,
'courseNumber'
,
'courseLetter'
,
'college'
,
'type'
);
Nmc_Registry_Session
::
getInstance
(
'home'
)
->
sortBy
=
$sortBy
;
}
$roles
=
ApprovalBodyRoles
::
getInstance
()
->
fetchRolesForUser
(
$user
);
$rolesData
=
array
();
...
...
@@ -24,6 +30,8 @@ class HomeController extends Nmc_Controller_Action
$roleRequests
[
'subject'
]
=
array
();
$roleRequests
[
'courseNumber'
]
=
array
();
$roleRequests
[
'courseLetter'
]
=
array
();
$roleRequests
[
'college'
]
=
array
();
$roleRequests
[
'type'
]
=
array
();
$roleRequests
[
'counter'
]
=
array
();
$roleRequests
[
'request'
]
=
array
();
...
...
@@ -39,21 +47,28 @@ class HomeController extends Nmc_Controller_Action
$roleRequests
[
'subject'
][]
=
$originalCourse
->
subject
;
$roleRequests
[
'courseNumber'
][]
=
$originalCourse
->
courseNumber
;
$roleRequests
[
'courseLetter'
][]
=
$originalCourse
->
courseLetter
;
$roleRequests
[
'college'
][]
=
$originalCourse
->
getHomeCollege
()
->
name
;
$roleRequests
[
'type'
][]
=
$request
->
type
->
name
;
$roleRequests
[
'counter'
][]
=
$i
++
;
$roleRequests
[
'request'
][]
=
$request
;
}
array_multisort
(
$roleRequests
[
'subject'
],
$roleRequests
[
'courseNumber'
],
$roleRequests
[
'courseLetter'
],
$roleRequests
[
'counter'
],
$roleRequests
[
'request'
]);
$sortParams
=
array
();
foreach
(
$sortBy
as
$sortKey
)
{
$sortParams
[]
=&
$roleRequests
[
$sortKey
];
}
$sortParams
[]
=&
$roleRequests
[
'counter'
];
$sortParams
[]
=&
$roleRequests
[
'request'
];
call_user_func_array
(
'array_multisort'
,
$sortParams
);
$watchingRequests
=
array
();
$watchingRequests
[
'subject'
]
=
array
();
$watchingRequests
[
'courseNumber'
]
=
array
();
$watchingRequests
[
'courseLetter'
]
=
array
();
$watchingRequests
[
'college'
]
=
array
();
$watchingRequests
[
'type'
]
=
array
();
$watchingRequests
[
'counter'
]
=
array
();
$watchingRequests
[
'request'
]
=
array
();
...
...
@@ -70,15 +85,21 @@ class HomeController extends Nmc_Controller_Action
$watchingRequests
[
'subject'
][]
=
$originalCourse
->
subject
;
$watchingRequests
[
'courseNumber'
][]
=
$originalCourse
->
courseNumber
;
$watchingRequests
[
'courseLetter'
][]
=
$originalCourse
->
courseLetter
;
$watchingRequests
[
'college'
][]
=
$originalCourse
->
getHomeCollege
()
->
name
;
$watchingRequests
[
'type'
][]
=
$request
->
type
->
name
;
$watchingRequests
[
'counter'
][]
=
$i
++
;
$watchingRequests
[
'request'
][]
=
$request
;
}
array_multisort
(
$watchingRequests
[
'subject'
],
$watchingRequests
[
'courseNumber'
],
$watchingRequests
[
'courseLetter'
],
$watchingRequests
[
'counter'
],
$watchingRequests
[
'request'
]);
$sortParams
=
array
();
foreach
(
$sortBy
as
$sortKey
)
{
$sortParams
[]
=&
$watchingRequests
[
$sortKey
];
}
$sortParams
[]
=&
$watchingRequests
[
'counter'
];
$sortParams
[]
=&
$watchingRequests
[
'request'
];
call_user_func_array
(
'array_multisort'
,
$sortParams
);
$roleData
=
array
();
$roleData
[
'role'
]
=
$role
;
...
...
@@ -103,6 +124,8 @@ class HomeController extends Nmc_Controller_Action
$myRequests
[
'subject'
]
=
array
();
$myRequests
[
'courseNumber'
]
=
array
();
$myRequests
[
'courseLetter'
]
=
array
();
$myRequests
[
'college'
]
=
array
();
$myRequests
[
'type'
]
=
array
();
$myRequests
[
'counter'
]
=
array
();
$myRequests
[
'request'
]
=
array
();
$i
=
0
;
...
...
@@ -117,16 +140,21 @@ class HomeController extends Nmc_Controller_Action
$myRequests
[
'subject'
][]
=
$originalCourse
->
subject
;
$myRequests
[
'courseNumber'
][]
=
$originalCourse
->
courseNumber
;
$myRequests
[
'courseLetter'
][]
=
$originalCourse
->
courseLetter
;
$myRequests
[
'college'
][]
=
$originalCourse
->
getHomeCollege
()
->
name
;
$myRequests
[
'type'
][]
=
$request
->
type
->
name
;
$myRequests
[
'counter'
][]
=
$i
++
;
$myRequests
[
'request'
][]
=
$request
;
}
array_multisort
(
$myRequests
[
'subject'
],
$myRequests
[
'courseNumber'
],
$myRequests
[
'courseLetter'
],
$myRequests
[
'counter'
],
$myRequests
[
'request'
]);
$sortParams
=
array
();
foreach
(
$sortBy
as
$sortKey
)
{
$sortParams
[]
=&
$myRequests
[
$sortKey
];
}
$sortParams
[]
=&
$myRequests
[
'counter'
];
$sortParams
[]
=&
$myRequests
[
'request'
];
call_user_func_array
(
'array_multisort'
,
$sortParams
);
/*************/
...
...
@@ -182,4 +210,34 @@ class HomeController extends Nmc_Controller_Action
$out
->
setBody
(
$view
->
render
(
'unlModernWrapper.xhtml'
));
}
public
function
sortByAction
()
{
$in
=
$this
->
getRequest
();
$newSortBy
=
$in
->
getParam
(
0
);
$newSortBy
=
strtolower
(
$newSortBy
);
$validSortBy
=
array
(
'course'
,
'college'
,
'type'
);
if
(
in_array
(
$newSortBy
,
$validSortBy
))
{
$sortBy
=
Nmc_Registry_Session
::
getInstance
(
'home'
)
->
sortBy
;
if
(
$newSortBy
==
'course'
)
{
array_unshift
(
$sortBy
,
'courseLetter'
);
array_unshift
(
$sortBy
,
'courseNumber'
);
array_unshift
(
$sortBy
,
'subject'
);
}
else
if
(
$newSortBy
==
'college'
)
{
array_unshift
(
$sortBy
,
'college'
);
}
else
if
(
$newSortBy
==
'type'
)
{
array_unshift
(
$sortBy
,
'type'
);
}
$sortBy
=
array_unique
(
$sortBy
);
Nmc_Registry_Session
::
getInstance
(
'home'
)
->
sortBy
=
$sortBy
;
}
$out
=
$this
->
getResponse
();
$view
=
new
Application_View
();
$view
->
location
=
'/Home'
;
$out
->
setBody
(
$view
->
render
(
'unlModernWrapper.xhtml'
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
application/views/home.xhtml
+
6
−
6
View file @
6c3e86d0
...
...
@@ -85,9 +85,9 @@
<table
class=
"course_list"
>
<tr>
<!-- th id="check"> </th -->
<th
id=
"course"
>
Course
</th>
<th
id=
"college"
>
College
</th>
<th
id=
"type"
>
Type
</th>
<th
id=
"course"
>
<a
href=
"/Home/SortBy/Course"
>
Course
</a>
</th>
<th
id=
"college"
>
<a
href=
"/Home/SortBy/College"
>
College
</a>
</th>
<th
id=
"type"
>
<a
href=
"/Home/SortBy/Type"
>
Type
</a>
</th>
<th
id=
"approval_body"
>
Approval Body
</th>
<th
id=
"status"
>
Status
</th>
<th
id=
"view_edit"
>
View/Edit
</th>
...
...
@@ -163,9 +163,9 @@
<table
class=
"course_list"
>
<tr>
<!-- th id="check"> </th -->
<th
id=
"course"
>
Course
</th>
<th
id=
"college"
>
College
</th>
<th
id=
"type"
>
Type
</th>
<th
id=
"course"
>
<a
href=
"/Home/SortBy/Course"
>
Course
</a>
</th>
<th
id=
"college"
>
<a
href=
"/Home/SortBy/College"
>
College
</a>
</th>
<th
id=
"type"
>
<a
href=
"/Home/SortBy/Type"
>
Type
</a>
</th>
<th
id=
"pending_action"
>
Pending Action
</th>
<th
id=
"status"
>
Status
</th>
<th
id=
"view_edit"
>
View/Edit
</th>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment