/** * Add an hover tooltip to the given HTML element id * * @param string $element_id An HTML element id * @param string $content_url The URL that contains the tooltip content to display * @param array $options css true => include alaxos tooltip.css * position 'br', 'bl', 'tl', 'tr' => bottom right, bottom left, top left, top right (position relative to the hovered element) */ function add_ajax_tooltip($element_id, $content_url, $options = array()) { $this->include_js_jquery(); $this->include_js_jquery_no_conflict(); $this->include_js_tooltip(); if (!empty($options['css']) && $options['css']) { /* * include CSS needed to show the tooltip */ $this->css('/alaxos/css/tooltip', null, array('inline' => false)); } if (empty($options['position'])) { $options['position'] = 'br'; } $element_id = StringTool::ensure_start_with($element_id, '#'); echo $this->scriptBlock('$j(document).ready(function(){ register_tool_tip("' . $element_id . '", "' . $this->url($content_url) . '", "' . $options['position'] . '"); });'); }
private function build_one_value_filter($filter, $model_name, $field_name, $value) { $type = $this->get_field_type($model_name, $field_name); $format = $this->get_field_search_format($type); $real_db_name = $this->get_real_db_name($model_name, $field_name); if ($type == 'date' || $type == 'datetime') { $value = $this->get_sql_date($value); } $dbo = $this->controller->{$model_name}->getDataSource(); switch ($dbo->config['driver']) { case 'postgres': $like_operator = 'ILIKE'; // -> case insensitive LIKE break; default: $like_operator = 'LIKE'; break; } if (isset($value)) { $db_field = null; switch ($type) { case 'string': case 'text': $db_field = $real_db_name . ' ' . $like_operator . ' '; break; default: $db_field = $real_db_name; break; } if ($type != 'boolean') { $filter[$db_field] = sprintf($format, $value); } else { if ($value == '0' || $value == 'false' || $value === 0 || $value === false || $value == __d('alaxos', 'false', true) || $value == __d('alaxos', 'no', true)) { $filter[$db_field] = false; } elseif ($value == '1' || $value == 'true' || $value === 1 || $value === true || $value == __d('alaxos', 'true', true) || $value == __d('alaxos', 'yes', true)) { $filter[$db_field] = true; } else { /* * If the boolean value is not one of the values above, * we clear it to hide it in the view */ unset($this->controller->data[$model_name][$field_name]); } } if ($this->auto_append_wildcard_characters && ($type == 'text' || $type == 'string')) { $filter[$db_field] = StringTool::ensure_start_with($filter[$db_field], '%'); $filter[$db_field] = StringTool::ensure_end_with($filter[$db_field], '%'); } return $filter; } else { return null; } }