/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $params = $this->getParams(); $tz_offset = $params->get('gmt_or_local', '0') == '0'; $data = JHTML::_('date', $data, FText::_($params->get('timestamp_format', 'DATE_FORMAT_LC2')), $tz_offset); return parent::renderListData($data, $thisRow, $opts); }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $params = $this->getParams(); $format = $params->get('text_format_string'); $format_blank = $params->get('field_format_string_blank', true); if ($format != '' && ($format_blank || $d != '')) { $str = sprintf($format, $data); // ToDo - No idea why eval is here but not in similar code in field.php (Sophist) $data = eval($str); } return parent::renderListData($data, $thisRow, $opts); }
/** * Should the validation be run - based on whether new record or editing existing * * @return boolean */ protected function shouldValidateOn() { $params = $this->getParams(); $on = $params->get('validation_on', 'both'); $rowId = $this->elementModel->getFormModel()->getRowId(); if ($on === 'both') { return true; } if ($rowId === '' && $on === 'new') { return true; } if ($rowId !== '' && $on === 'edit') { return true; } return false; }
/** * Create hover tip text for validations * * @return array Messages */ public function hoverTexts() { $texts = array(); if ($this->elementModel->isEditable()) { $tmpl = $this->elementModel->getFormModel()->getTmpl(); $validations = array_unique($this->findAll()); foreach ($validations as $c => $validation) { $texts[] = $validation->getHoverText($c, $tmpl); } $internal = $this->elementModel->internalValidataionText(); if ($internal !== '') { $i = $this->elementModel->internalValidationIcon(); $icon = FabrikHelperHTML::image($i, 'form', $tmpl, $this->iconOpts); $texts[] = $icon . ' ' . $internal; } } return $texts; }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $listModel = $this->getlistModel(); $params = $this->getParams(); $target = $params->get('link_target', ''); $smart_link = $params->get('link_smart_link', false); if ($listModel->getOutPutFormat() != 'rss' && ($smart_link || $target == 'mediabox')) { FabrikHelperHTML::slimbox(); } $data = FabrikWorker::JSONtoData($data, true); if (!empty($data)) { if (array_key_exists('label', $data)) { $data = (array) $this->_renderListData($data, $thisRow); } else { for ($i = 0; $i < count($data); $i++) { $data[$i] = ArrayHelper::fromObject($data[$i]); $data[$i] = $this->_renderListData($data[$i], $thisRow); } } } $data = json_encode($data); return parent::renderListData($data, $thisRow, $opts); }
/** * Get the class to manage the form element * to ensure that the file is loaded only once * * @param array &$srcs Scripts previously loaded * @param string $script Script to load once class has loaded * @param array &$shim Dependant class names to load before loading the class - put in requirejs.config shim * * @return void */ public function formJavascriptClass(&$srcs, $script = '', &$shim = array()) { // Whilst link isn't really an element list we can use its js AddNewEvent method $s = new stdClass(); $s->deps = array('fab/elementlist'); $shim['element/link/link'] = $s; parent::formJavascriptClass($srcs, $script, $shim); }
/** * Turn form value into email formatted value * * @param mixed $value Element value * @param array $data Form data * @param int $repeatCounter Group repeat counter * * @return string email formatted value */ protected function getIndEmailValue($value, $data = array(), $repeatCounter = 0) { $params = $this->getParams(); if ($params->get('render_as_qrcode', '0') === '1') { return html_entity_decode($this->qrCodeLink($data)); } else { $value = $this->format($value); return parent::getIndEmailValue($value, $data, $repeatCounter); } }
/** * Load a new set of default properties and params for the element * * @return object element (id = 0) */ public function getDefaultProperties() { $item = parent::getDefaultProperties(); $item->primary_key = true; $item->width = 3; $item->hidden = 1; $item->auto_increment = 1; return $item; }
/** * Determines the value for the element in the form view * * @param array $data Element value * @param int $repeatCounter When repeating joined groups we need to know what part of the array to access * @param array $opts Options * * @return string Value */ public function getValue($data, $repeatCounter = 0, $opts = array()) { $value = parent::getValue($data, $repeatCounter, $opts); return $value; }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $w = new FabrikWorker(); $data = FabrikWorker::JSONtoData($data, true); $params = $this->getParams(); $pathset = false; foreach ($data as $d) { if (strstr($d, '/')) { $pathset = true; break; } } if ($data === '' || empty($data) || !$pathset) { // No data so default to image (or simple image name stored). $iPath = $params->get('imagepath'); if (!strstr($iPath, '/')) { // Single file specified so find it in tmpl folder $data = (array) FabrikHelperHTML::image($iPath, 'list', @$this->tmpl, array(), true); } else { $data = (array) $iPath; } } $selectImage_root_folder = $this->rootFolder(); // $$$ hugh - tidy up a bit so we don't have so many ///'s in the URL's $selectImage_root_folder = JString::ltrim($selectImage_root_folder, '/'); $selectImage_root_folder = JString::rtrim($selectImage_root_folder, '/'); $selectImage_root_folder = $selectImage_root_folder === '' ? '' : $selectImage_root_folder . '/'; $showImage = $params->get('show_image_in_table', 0); $linkURL = $params->get('link_url', ''); if (empty($data) || $data[0] == '') { $data[] = $params->get('imagepath'); } for ($i = 0; $i < count($data); $i++) { if ($showImage) { // $$$ rob 30/06/2011 - say if we import via csv a url to the image check that and use that rather than the relative path if (JString::substr($data[$i], 0, 4) == 'http') { $src = $data[$i]; } else { $data[$i] = JString::ltrim($data[$i], '/'); $src = COM_FABRIK_LIVESITE . $selectImage_root_folder . $data[$i]; } $data[$i] = '<img src="' . $src . '" alt="' . $data[$i] . '" />'; } if ($linkURL) { $data[$i] = '<a href="' . $linkURL . '" target="_blank">' . $data[$i] . '</a>'; } $data[$i] = $w->parseMessageForPlaceHolder($data[$i], $thisRow); } $data = json_encode($data); return parent::renderListData($data, $thisRow, $opts); }
/** * Get the class to manage the form element * to ensure that the file is loaded only once * * @param array &$srcs Scripts previously loaded * @param string $script Script to load once class has loaded * @param array &$shim Dependant class names to load before loading the class - put in requirejs.config shim * * @return void */ public function formJavascriptClass(&$srcs, $script = '', &$shim = array()) { $ext = FabrikHelperHTML::isDebug() ? '.js' : '-min.js'; $files = array('media/com_fabrik/js/element' . $ext, 'media/com_fabrik/js/elementlist' . $ext); foreach ($files as $file) { if (!in_array($file, $srcs)) { $srcs[] = $file; } } parent::formJavascriptClass($srcs, $script, $shim); }
/** * Get the class to manage the form element * to ensure that the file is loaded only once * * @param array &$srcs Scripts previously loaded * @param string $script Script to load once class has loaded * @param array &$shim Dependant class names to load before loading the class - put in requirejs.config shim * * @return void */ public function formJavascriptClass(&$srcs, $script = '', &$shim = array()) { $key = FabrikHelperHTML::isDebug() ? 'element/digsig/digsig' : 'element/digsig/digsig-min'; $s = new stdClass(); $s->deps = array(); $folder = 'element/digsig/libs/signature-pad/'; $digsigShim = new stdClass(); $digsigShim->deps = array($folder . 'jquery.signaturepad'); $s->deps[] = $folder . 'jquery.signaturepad'; $s->deps[] = $folder . 'flashcanvas'; $shim[$folder . 'flashcanvas'] = $digsigShim; $s->deps[] = $folder . 'json2'; $shim[$folder . 'json2'] = $digsigShim; $shim[$key] = $s; FabrikHelperHTML::stylesheet(COM_FABRIK_LIVESITE . 'plugins/fabrik_element/digsig/libs/signature-pad/jquery.signaturepad.css'); parent::formJavascriptClass($srcs, $script, $shim); // $$$ hugh - added this, and some logic in the view, so we will get called on a per-element basis return false; }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { unset($this->default); $value = $this->getValue(ArrayHelper::fromObject($thisRow)); return parent::renderListData($value, $thisRow, $opts); }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $options = $this->getOpts(); $text = ''; if ((string) $data !== '') { foreach ($options as $o) { if ($o->value == $data) { $text = JString::ltrim(str_replace('-', '', $o->text)); } } } $layoutData = new stdClass(); $layoutData->text = $text; return parent::renderListData($layoutData, $thisRow, $opts); }
/** * Render the element admin settings * * @param array $data admin data * @param int $repeatCounter repeat plugin counter * @param string $mode how the fieldsets should be rendered currently support 'nav-tabs' (@since 3.1) * * @return string admin html */ public function onRenderAdminSettings($data = array(), $repeatCounter = null, $mode = null) { $this->install(); return parent::onRenderAdminSettings($data, $repeatCounter, $mode); }
/** * Get the element's cell class * * @since 3.0.4 * * @return string css classes */ public function getCellClass() { $params = $this->getParams(); $classes = parent::getCellClass(); $format = $params->get('text_format'); if ($format == 'decimal' || $format == 'integer') { $classes .= ' ' . $format; } return $classes; }
/** * Get a query for our median query * * @param FabrikFEModelList &$listModel List * @param array $labels Label * * @return string */ protected function getMedianQuery(&$listModel, $labels = array()) { $fields = $listModel->getDBFields($this->getTableName(), 'Field'); $name = $this->getElement()->name; $field = FArrayHelper::getValue($fields, $name, false); if ($field !== false && $field->Type == 'time') { $db = $listModel->getDb(); $label = count($labels) == 0 ? "'calc' AS label" : 'CONCAT(' . implode(', " & " , ', $labels) . ') AS label'; $name = $this->getFullName(false, false); $table = $listModel->getTable(); $joinSQL = $listModel->buildQueryJoin(); $whereSQL = $listModel->buildQueryWhere(); return "SELECT SEC_TO_TIME(TIME_TO_SEC({$name})) AS value, {$label} FROM " . $db->qn($table->db_table_name) . " {$joinSQL} {$whereSQL}"; } else { return parent::getMedianQuery($listModel, $labels); } }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { static $range; static $fullName; if (!isset($range)) { $range = $this->getRange(); $fullName = $this->getDataElementFullName() . '_raw'; } $dataElement = $this->getDataElement(); $data = $thisRow->{$fullName}; if ($dataElement->getGroupModel()->canRepeat()) { $data = FabrikWorker::JSONtoData($data, true); foreach ($data as $i => &$d) { $d = $this->_renderListData($d, $range); } } else { $data = $this->_renderListData($data, $range); } return parent::renderListData($data, $thisRow, $opts); }
/** * Build query prefilter where part * * @param PlgFabrik_Element $element Element model * * @return string */ public function buildQueryPrefilterWhere($element) { $elementName = FabrikString::safeColName($element->getFullName(false, false)); $filters = $this->getFilterArray(); $keys = array_keys($filters); $valueKeys = array_keys(FArrayHelper::getValue($filters, 'value', array())); foreach ($valueKeys as $i) { if ($filters['search_type'][$i] != 'prefilter' || $filters['key'][$i] != $elementName) { foreach ($keys as $key) { unset($filters[$key][$i]); } } } list($sqlNoFilter, $sql) = $this->_filtersToSQL($filters); $where = str_replace('WHERE', '', $sql); if ($where != '') { $where = ' AND ' . $where; } return $where; }
/** * Determines the value for the element in the form view. Ensure its set to be a r,g,b string * * @param array $data Form data * @param int $repeatCounter When repeating joined groups we need to know what part of the array to access * @param array $opts Options, 'raw' = 1/0 use raw value * * @return string value */ public function getValue($data, $repeatCounter = 0, $opts = array()) { $value = parent::getValue($data, $repeatCounter, $opts); $value = strstr($value, '#') ? FabrikString::hex2rgb($value) : $value; return $value; }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $params = $this->getParams(); $formId = $this->getFormModel()->getId(); $listId = $this->getListModel()->getId(); $rowId = isset($thisRow->__pk_val) ? $thisRow->__pk_val : $thisRow->id; if ($params->get('rating-mode') !== 'creator-rating') { $d = $this->getListModel()->getData(); $ids = ArrayHelper::getColumn($d, '__pk_val'); list($data, $total) = $this->getRatingAverage($data, $listId, $formId, $rowId, $ids); } $data = FabrikWorker::JSONtoData($data, true); FabrikHelperHTML::addPath(COM_FABRIK_BASE . 'plugins/fabrik_element/rating/images/', 'image', 'list', false); $colData = $this->getListModel()->getData(); $ids = ArrayHelper::getColumn($colData, '__pk_val'); $canRate = $this->canRate($rowId, $ids); for ($i = 0; $i < count($data); $i++) { $avg = $this->_renderListData($data[$i], $thisRow); $atpl = ''; $a2 = ''; $str = array(); $str[] = '<div style="width:101px;position:relative;">'; for ($s = 0; $s < $avg; $s++) { $r = $s + 1; $a = str_replace('{r}', $r, $atpl); $imgOpts = array('icon-class' => 'starRating rate_' . $r); $imgOpts['data-fabrik-rating'] = $r; $img = FabrikHelperHTML::image("star.png", 'list', @$this->tmpl, $imgOpts); $str[] = $a . $img . $a2; } for ($s = $avg; $s < 5; $s++) { $r = $s + 1; $a = str_replace('{r}', $r, $atpl); $imgOpts = array('icon-class' => 'starRating rate_' . $r); $imgOpts['data-fabrik-rating'] = $r; $img = FabrikHelperHTML::image("star-empty.png", 'list', @$this->tmpl, $imgOpts); $str[] = $a . $img . $a2; } if ($params->get('rating-mode') != 'creator-rating') { $str[] = '<div class="ratingMessage">' . $avg . '</div>'; } $str[] = '</div>'; $data[$i] = implode("\n", $str); } $data = json_encode($data); return parent::renderListData($data, $thisRow, $opts); }
/** * Determines the value for the element in the form view * * @param array $data form data * @param int $repeatCounter when repeating joined groups we need to know what part of the array to access * @param array $opts options * * @return string value */ public function getValue($data, $repeatCounter = 0, $opts = array()) { // Kludge for 2 scenarios if (array_key_exists('rowid', $data)) { // When validating the data on form submission $key = 'rowid'; } else { // When rendering the element to the form $key = '__pk_val'; } if (empty($data) || !array_key_exists($key, $data) || array_key_exists($key, $data) && empty($data[$key])) { $value = $this->getDefaultOnACL($data, $opts); return $value; } $res = parent::getValue($data, $repeatCounter, $opts); return $res; }
/** * Get the class to manage the form element * to ensure that the file is loaded only once * * @param array &$srcs Scripts previously loaded * @param string $script Script to load once class has loaded * @param array &$shim Dependant class names to load before loading the class - put in requirejs.config shim * * @return void */ public function formJavascriptClass(&$srcs, $script = '', &$shim = array()) { $mediaFolder = FabrikHelperHTML::getMediaFolder(); $files = array('Element' => $mediaFolder . '/element.js', 'ElementList' => $mediaFolder . '/elementlist.js'); $srcs = array_merge($srcs, $files); parent::formJavascriptClass($srcs, $script, $shim); }
/** * Determine if the element should run its validation plugins on form submission * * @return bool default true */ public function mustValidate() { if (!$this->canUse() && !$this->canView()) { return false; } return parent::mustValidate(); }
/** * Shows the data formatted for the list view * * @param string $data Elements data * @param stdClass &$thisRow All the data in the lists current row * @param array $opts Rendering options * * @return string formatted value */ public function renderListData($data, stdClass &$thisRow, $opts = array()) { $params = $this->getParams(); $groupModel = $this->getGroup(); /* * Jaanus: removed condition canrepeat() from renderListData: * weird result such as ["00:03:45","00 when not repeating but still join and merged. Using isJoin() instead */ $data = $groupModel->isJoin() ? FabrikWorker::JSONtoData($data, true) : array($data); $data = (array) $data; $ft = $params->get('list_time_format', 'H:i:s'); $sep = $params->get('time_separatorlabel', FText::_(':')); $format = array(); foreach ($data as $d) { if ($d) { $bits = explode(':', $d); $hour = FArrayHelper::getValue($bits, 0, '00'); $min = FArrayHelper::getValue($bits, 1, '00'); $sec = FArrayHelper::getValue($bits, 2, '00'); $hms = $hour . $sep . $min . $sep . $sec; $hm = $hour . $sep . $min; $ms = $min . $sep . $sec; $timedisp = ''; if ($ft == "H:i:s") { list($hour, $min, $sec) = explode(':', $d); $timedisp = $hour . $sep . $min . $sep . $sec; } else { if ($ft == "H:i") { list($hour, $min) = explode(':', $d); $timedisp = $hour . $sep . $min; } if ($ft == "i:s") { list($min, $sec) = explode(':', $d); $timedisp = $min . $sep . $sec; } } $format[] = $timedisp; } else { $format[] = ''; } } $data = json_encode($format); return parent::renderListData($data, $thisRow, $opts); }
/** * Used by radio and dropdown elements to get a dropdown list of their unique * unique values OR all options - based on filter_build_method * * @param bool $normal Do we render as a normal filter or as an advanced search filter * @param string $tableName Table name to use - defaults to element's current table * @param string $label Field to use, defaults to element name * @param string $id Field to use, defaults to element name * @param bool $incjoin Include join * * @return array text/value objects */ public function filterValueList($normal, $tableName = '', $label = '', $id = '', $incjoin = true) { $params = $this->getParams(); if ($params->get('textarea-tagify') == true) { return $this->getTags(); } else { return parent::filterValueList($normal, $tableName, $label, $id, $incjoin); } }
/** * Take a table name and make elements for all of its fields * * @param int $groupId group id * @param string $tableName table name * * @return void */ protected function makeElementsFromFields($groupId, $tableName) { $fabrikDb = $this->getFEModel()->getDb(); $dispatcher = JEventDispatcher::getInstance(); $input = $this->app->input; $elementModel = new PlgFabrik_Element($dispatcher); $pluginManager = FabrikWorker::getPluginManager(); $fbConfig = JComponentHelper::getParams('com_fabrik'); $elementTypes = $input->get('elementtype', array(), 'array'); $fields = $fabrikDb->getTableColumns($tableName, false); $createDate = JFactory::getDate()->toSQL(); $key = $this->getFEModel()->getPrimaryKeyAndExtra($tableName); $ordering = 0; /** * no existing fabrik table so we take a guess at the most * relevant element types to create */ $elementLabels = $input->get('elementlabels', array(), 'array'); foreach ($fields as $label => $properties) { $plugin = 'field'; $type = $properties->Type; $maxLength = 255; $maxLength2 = 0; if (preg_match("/\\((.*)\\)/i", $type, $matches)) { $maxLength = FArrayHelper::getValue($matches, 1, 255); $maxLength = explode(',', $maxLength); if (count($maxLength) > 1) { $maxLength2 = $maxLength[1]; $maxLength = $maxLength[0]; } else { $maxLength = $maxLength[0]; $maxLength2 = 0; } } // Get the basic type $type = explode(" ", $type); $type = FArrayHelper::getValue($type, 0, ''); $type = preg_replace("/\\((.*)\\)/i", '', $type); $element = FabTable::getInstance('Element', 'FabrikTable'); if (array_key_exists($ordering, $elementTypes)) { // If importing from a CSV file then we have userselect field definitions $plugin = $elementTypes[$ordering]; } else { // If the field is the primary key and it's an INT type set the plugin to be the fabrik internal id if ($key[0]['colname'] == $label && JString::strtolower(substr($key[0]['type'], 0, 3)) === 'int') { $plugin = 'internalid'; } else { // Otherwise set default type switch ($type) { case "int": case "decimal": case "tinyint": case "smallint": case "mediumint": case "bigint": case "varchar": case "time": $plugin = 'field'; break; case "text": case "tinytext": case "mediumtext": case "longtext": $plugin = 'textarea'; break; case "datetime": case "date": case "timestamp": $plugin = 'date'; break; default: $plugin = 'field'; break; } } // Then alter if defined in Fabrik global config // Jaanus: but first check if there are any pk field and if yes then create as internalid $defType = JString::strtolower(substr($key[0]['type'], 0, 3)); $plugin = $key[0]['colname'] == $label && $defType === 'int' ? 'internalid' : $fbConfig->get($type, $plugin); } $element->plugin = $plugin; $element->hidden = $element->label == 'id' ? '1' : '0'; $element->group_id = $groupId; $element->name = $label; $element->created = $createDate; $element->created_by = $this->user->get('id'); $element->created_by_alias = $this->user->get('username'); $element->published = '1'; $element->show_in_list_summary = '1'; switch ($plugin) { case 'textarea': $element->width = '40'; break; case 'date': $element->width = '10'; break; default: $element->width = '30'; break; } if ($element->width > $maxLength) { $element->width = $maxLength; } $element->height = '6'; $element->ordering = $ordering; $p = json_decode($elementModel->getDefaultAttribs()); if (in_array($type, array('int', 'tinyint', 'smallint', 'mediumint', 'bigint')) && $plugin == 'field') { $p->integer_length = $maxLength; $p->text_format = 'integer'; $p->maxlength = '255'; $element->width = '30'; } elseif ($type == 'decimal' && $plugin == 'field') { $p->text_format = 'decimal'; $p->decimal_length = $maxLength2; $p->integer_length = $maxLength - $maxLength2; $p->maxlength = '255'; $element->width = '30'; } else { $p->maxlength = $maxLength; } $element->params = json_encode($p); $element->label = FArrayHelper::getValue($elementLabels, $ordering, str_replace("_", " ", $label)); //Format Label $labelConfig = $fbConfig->get('format_labels', '0'); switch ($labelConfig) { case '1': $element->label = strtolower($element->label); break; case '2': $element->label = ucwords($element->label); break; case '3': $element->label = ucfirst($element->label); break; case '4': $element->label = strtoupper($element->label); break; default: break; } $element->store(); $elementModel = $pluginManager->getPlugIn($element->plugin, 'element'); $elementModel->setId($element->id); $elementModel->element = $element; // Hack for user element $details = array('group_id' => $element->group_id); $input->set('details', $details); $elementModel->onSave(array()); $ordering++; } }
/** * Build the filter query for the given element. * Can be overwritten in plugin - e.g. see checkbox element which checks for partial matches * * @param string $key element name in format `tablename`.`elementname` * @param string $condition =/like etc. * @param string $value search string - already quoted if specified in filter array options * @param string $originalValue original filter value without quotes or %'s applied * @param string $type filter type advanced/normal/prefilter/search/querystring/searchall * @param string $evalFilter evaled * * @return string sql query part e,g, "key = value" */ public function getFilterQuery($key, $condition, $value, $originalValue, $type = 'normal', $evalFilter = '0') { $params = $this->getParams(); $element = $this->getElement(); if ($type === 'prefilter' || $type === 'menuPrefilter') { switch ($condition) { case 'earlierthisyear': throw new UnexpectedValueException('The birthday element can not deal with "Earlier This Year" prefilters'); break; case 'laterthisyear': throw new UnexpectedValueException('The birthday element can not deal with "Later This Year" prefilters'); break; case 'today': $search = array(date('Y'), date('n'), date('j')); return $this->_dayMonthYearFilterQuery($key, $search); break; case 'yesterday': $today = new DateTime(); $today->sub(new DateInterval('P1D')); $search = array('', $today->format('n'), $today->format('j')); return $this->_dayMonthYearFilterQuery($key, $search); break; case 'tomorrow': $today = new DateTime(); $today->add(new DateInterval('P1D')); $search = array('', $today->format('n'), $today->format('j')); return $this->_dayMonthYearFilterQuery($key, $search); case 'thismonth': $search = array('', date('n'), ''); return $this->_dayMonthYearFilterQuery($key, $search); break; case 'lastmonth': $today = new DateTime(); $today->sub(new DateInterval('P1M')); $search = array('', $today->format('n'), ''); return $this->_dayMonthYearFilterQuery($key, $search); case 'nextmonth': $today = new DateTime(); $today->add(new DateInterval('P1M')); $search = array('', $today->format('n'), ''); return $this->_dayMonthYearFilterQuery($key, $search); case 'birthday': $search = array('', date('n'), date('j')); return $this->_dayMonthYearFilterQuery($key, $search); break; } } if ($element->filter_type === 'dropdown' && $params->get('list_filter_layout', 'individual') === 'day_mont_year') { return $this->_dayMonthYearFilterQuery($key, $originalValue); } else { $ft = $this->getParams()->get('list_date_format', 'd.m.Y'); if ($ft === 'd m') { $value = explode('-', $originalValue); array_shift($value); $value = implode('-', $value); $query = 'DATE_FORMAT(' . $key . ', \'%m-%d\') = ' . $this->_db->q($value); return $query; } $query = parent::getFilterQuery($key, $condition, $value, $originalValue, $type, $evalFilter); return $query; } }