alphabetQuery(); } if (!$result) { return NULL; } $dynamicAlphabets = array(); while ($result->fetch()) { $dynamicAlphabets[] = $result->sort_name; } return $dynamicAlphabets; } /** * create the links * * @param array $query The form values for search * @param string $sortByCharacter The character that we are potentially sorting on * * @return array with links * @access private * @static */ static function createLinks(&$query, $sortByCharacter, $isDAO) { $AToZBar = self::getStaticCharacters(); $dynamicAlphabets = self::getDynamicCharacters($query, $isDAO); if (!$dynamicAlphabets) { return NULL; } $AToZBar = array_merge($AToZBar, $dynamicAlphabets); sort($AToZBar, SORT_STRING); $AToZBar = array_unique($AToZBar); //get the current path $path = CRM_Utils_System::currentPath(); $qfKey = null; if (isset($query->_formValues)) { $qfKey = CRM_Utils_Array::value('qfKey', $query->_formValues); } if (empty($qfKey)) { $qfKey = CRM_Utils_Request::retrieve('qfKey', 'String', $this, FALSE, NULL, $_REQUEST); } $aToZBar = array(); foreach ($AToZBar as $key => $link) { if ($link === NULL) { continue; } $element = array(); if (in_array($link, $dynamicAlphabets)) { $klass = ''; if ($link == $sortByCharacter) { $element['class'] = "active"; $klass = 'class="active"'; } $url = CRM_Utils_System::url($path, "force=1&qfKey=$qfKey&sortByCharacter="); // we do it this way since we want the url to be encoded but not the link character // since that seems to mess up drupal utf-8 encoding etc $url .= urlencode($link); $element['item'] = sprintf('%s', $url, $klass, $link ); } else { $element['item'] = $link; } $aToZBar[] = $element; } $url = sprintf('%s', CRM_Utils_System::url($path, "force=1&qfKey=$qfKey&sortByCharacter=all"), 'All' ); $aToZBar[] = array('item' => $url); return $aToZBar; } }