type = 'stormorganization'; $header = array( array( 'data' => t('Name'), 'field' => 'n.title', 'sort' => 'ASC', ), array( 'data' => t('Country'), 'field' => 'sor.country', 'sort' => '', ), array( 'data' => storm_icon_add_node($i, $_GET), 'class' => 'storm_list_operations', ), ); $s = "SELECT n.*, sor.* FROM {node} AS n INNER JOIN {stormorganization} AS sor ON n.vid=sor.vid WHERE n.status=1 AND n.type='stormorganization'"; $where = array(); $args = array(); if ($_SESSION['stormorganization_list_filter']['country']) { $where[] = "sor.country='%s'"; $args[] = $_SESSION['stormorganization_list_filter']['country']; } if ($_SESSION['stormorganization_list_filter']['name']) { $where[] = "LOWER(n.title) LIKE LOWER('%s')"; $args[] = $_SESSION['stormorganization_list_filter']['name']; } $itemsperpage = $_SESSION['stormorganization_list_filter']['itemsperpage']; $s = stormorganization_access_sql($s, $where); $s = db_rewrite_sql($s); $tablesort = tablesort_sql($header); $r = pager_query($s . $tablesort, $itemsperpage, 0, NULL, $args); $organizations = array(); while ($organization = db_fetch_object($r)) { $organizations[] = $organization; } $o .= theme('stormorganization_list', $header, $organizations); $o .= theme('pager', NULL, $itemsperpage, 0); print theme('page', $o); } function stormorganization_list_filter() { $country = $_SESSION['stormorganization_list_filter']['country']; $name = $_SESSION['stormorganization_list_filter']['name']; $itemsperpage = $_SESSION['stormorganization_list_filter']['itemsperpage']; if (!$itemsperpage) { $itemsperpage = 10; $_SESSION['stormorganization_list_filter']['itemsperpage'] = $itemsperpage; } $form = array(); $form['filter'] = array( '#type' => 'fieldset', '#title' => t('Filter'), '#collapsible' => TRUE, '#collapsed' => TRUE, '#weight' => -20, ); $form['filter']['country'] = array( '#type' => 'select', '#title' => t('Country'), '#default_value' => $country, '#options' => array(0 => t('All')) + stormattribute_attributes_bydomain('Country'), ); $form['filter']['name'] = array( '#type' => 'textfield', '#title' => t('Name'), '#default_value' => $name, '#autocomplete_path' => 'storm/organizations/autocomplete', ); $qs = '