depth == 1) { //si el termino es padre $options[$term->tid] = $term->name; } } $form['value']['sector'] = array( '#type' =>'select', '#options' => $options, ); } /** * Provide the basic form which calls through to subforms. * If overridden, it is best to call through to the parent, * or to at least make sure all of the functions in this form * are called. */ function options_form(&$form, &$form_state) { if ($this->can_expose()) { $this->show_expose_button($form, $form_state); } $form['op_val_start'] = array('#value' => '
'); $this->show_operator_form($form, $form_state); $this->show_value_form($form, $form_state); $this->value_submit($form, $form_state); $form['op_val_end'] = array('#value' => '
'); if ($this->can_expose()) { $this->show_expose_form($form, $form_state); } if ($this->options['exposed'] == 1) { //excluyendo el campo $roles = user_roles(); $form['fieldset_roles'] = array( '#type' => 'fieldset', '#title' => t('Excluir Filtros'), '#weight' => 0, ); $form['fieldset_roles']['roles_exclude_sector_social'] = array( '#type' => 'checkboxes', '#weight' => 0, '#title' => t('Excluir Filtros por roles de la Presentacion'), '#options' => $roles, '#default_value' => variable_get('roles_exclude_sector_social', 0), '#description' => t('Seleccione los roles para escluir los filtros.'), ); } } /** * Perform any necessary changes to the form values prior to storage. * There is no need for this function to actually store the data. */ function value_submit($form, &$form_state) { if (isset($form_state['values']['options']['fieldset_roles']['roles_exclude_sector_social'])) { variable_set('roles_exclude_sector_social', $form_state['values']['options']['fieldset_roles']['roles_exclude_sector_social']); } } function query() { $aid = explode('_',$this->field); $aid = $aid[1]; $this->ensure_my_table(); $field = "$this->table_alias.$this->real_field"; $upper = ''; $operation_attribute = "="; if($this->operator == 'not in') { $operation_attribute = '<>'; } if(!is_array($this->value)) { $this->value = array($this->value); } foreach ($this->value as &$value) { if ($value) { $this->query->add_where($this->options['group'], "$upper(%s) %s %d", $field, $operation_attribute, $value); } } } }