value['sector']) {
$this->value['sector'] = "0";
}
$options[0]= t("seleccione");
$query = db_query("SELECT n.nid, n.title FROM {node} as n INNER JOIN {ente_planificador} AS e ON e.nid = n.nid WHERE e.ente_adscrito != 0");
while($rows = db_fetch_object($query)) {
$options[$rows->nid] = $rows->title;
}
$form['value']['sub_sector'] = array(
'#title' => t('Sub-Sector'),
'#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);
}
//excluyendo el campo
$roles = user_roles();
$form['fieldset_roles'] = array(
'#type' => 'fieldset',
'#title' => t('Excluir Filtros'),
'#weight' => 0,
);
$form['fieldset_roles']['roles_exclude_sub_sector_social'] = array(
'#type' => 'checkboxes',
'#weight' => 0,
'#title' => t('Excluir Filtros por roles de la Presentacion'),
'#options' => $roles,
'#default_value' => variable_get('roles_exclude_sub_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_sub_sector_social'])) {
variable_set('roles_exclude_sub_sector_social', $form_state['values']['options']['fieldset_roles']['roles_exclude_sub_sector_social']);
}
}
function query() {
$aid = explode('_',$this->field);
$aid = $aid[1];
$this->ensure_my_table();
$field = "$this->table_alias.sector";
$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);
}
}
}
}