New way to initialize and modify filter parameters
This commit is contained in:
parent
ce5f89b38f
commit
6b9f1ad9d5
14 changed files with 541 additions and 526 deletions
|
@ -493,16 +493,13 @@ function _stormteam_validate_predelete($node) {
|
|||
* Function to display list of SuiteDesk Teams, called from hook_menu
|
||||
*/
|
||||
function stormteam_list() {
|
||||
// Add SuiteDesk generic CSS
|
||||
drupal_add_css(drupal_get_path('module', 'storm') .'/storm.css', 'module');
|
||||
|
||||
$breadcrumb = array();
|
||||
$breadcrumb[] = l(t('Home'), '<front>');
|
||||
drupal_set_breadcrumb($breadcrumb);
|
||||
|
||||
if (array_key_exists('name', $_GET)) {
|
||||
if ($_SESSION['stormteam_list_filter']['name'] != $_GET['name']) {
|
||||
$_SESSION['stormteam_list_filter']['name'] = $_GET['name'];
|
||||
_storm_set_filter_param('team', 'name', $_GET['name']);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -526,23 +523,23 @@ function stormteam_list() {
|
|||
),
|
||||
);
|
||||
|
||||
$where = array();
|
||||
$args = array();
|
||||
$filterfields = array();
|
||||
|
||||
$s = "SELECT n.nid, n.title, n.type, nre.teaser, nre.format, n.uid FROM {node} AS n
|
||||
INNER JOIN {stormteam} AS ste ON n.vid = ste.vid
|
||||
INNER JOIN {node_revisions} AS nre ON n.vid = nre.vid
|
||||
WHERE n.status=1 AND n.type='stormteam'
|
||||
GROUP BY n.nid";
|
||||
|
||||
$where = array();
|
||||
$args = array();
|
||||
$filterfields = array();
|
||||
|
||||
if (isset($_SESSION['stormteam_list_filter']['name']) && $_SESSION['stormteam_list_filter']['name'] != '') {
|
||||
if (_storm_isset_filter_param('team', 'name', '')) {
|
||||
$where[] = "LOWER(n.title) LIKE LOWER('%%%s%%')";
|
||||
$args[] = $_SESSION['stormteam_list_filter']['name'];
|
||||
$filterfields[] = t('Team name');
|
||||
}
|
||||
|
||||
$itemsperpage = isset($_SESSION['stormteam_list_filter']['itemsperpage']) ? $_SESSION['stormteam_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
|
||||
$itemsperpage = _storm_get_filter_param('team', 'itemsperpage', variable_get('storm_default_items_per_page', 10));
|
||||
|
||||
if (count($filterfields) == 0) {
|
||||
$filterdesc = t('Not filtered');
|
||||
|
@ -581,10 +578,10 @@ function stormteam_list() {
|
|||
* Function to define form for setting SuiteDesk Team list filter.
|
||||
*/
|
||||
function stormteam_list_filter(&$form_state, $filterdesc = 'Filter') {
|
||||
$name = isset($_SESSION['stormteam_list_filter']['name']) ? $_SESSION['stormteam_list_filter']['name'] : '';
|
||||
$name = _storm_get_filter_param('team', 'name', '');
|
||||
|
||||
$itemsperpage = _storm_get_filter_param('team', 'itemsperpage', variable_get('storm_default_items_per_page', 10));
|
||||
|
||||
$itemsperpage = isset($_SESSION['stormteam_list_filter']['itemsperpage']) ? $_SESSION['stormteam_list_filter']['itemsperpage'] : variable_get('storm_default_items_per_page', 10);
|
||||
$_SESSION['stormteam_list_filter']['itemsperpage'] = $itemsperpage;
|
||||
|
||||
$form = array();
|
||||
|
||||
|
|
Reference in a new issue