Agora_Form_Search::getInfo PHP Метод

getInfo() публичный Метод

Trick getInfo to catch pager parameters
public getInfo ( $vars, &$info )
    function getInfo($vars, &$info)
    {
        parent::getInfo($vars, $info);
        if (!$this->isSubmitted()) {
            foreach ($info as $key => $val) {
                $info[$key] = $vars->get($key);
            }
        }
    }

Usage Example

Пример #1
0
 * See the enclosed file COPYING for license information (GPL). If you
 * did not receive this file, see http://www.horde.org/licenses/gpl.
 *
 * @author  Jason Felice <*****@*****.**>
 */
require_once __DIR__ . '/lib/Application.php';
Horde_Registry::appInit('agora');
/* Set up the forums object. */
$scope = Horde_Util::getGet('scope', 'agora');
$messages = $injector->getInstance('Agora_Factory_Driver')->create($scope);
$vars = Horde_Variables::getDefaultVariables();
$form = new Agora_Form_Search($vars, $scope);
$thread_page = Horde_Util::getFormData('thread_page');
$view = new Agora_View();
if ($form->isSubmitted() || $thread_page != null) {
    $form->getInfo($vars, $info);
    if (!empty($info['keywords'])) {
        $info['keywords'] = preg_split('/\\s+/', $info['keywords']);
    }
    $sort_by = Agora::getSortBy('thread');
    $sort_dir = Agora::getSortDir('thread');
    $thread_per_page = $prefs->getValue('thread_per_page');
    $thread_start = $thread_page * $thread_per_page;
    $searchResults = $messages->search($info, $sort_by, $sort_dir, $thread_start, $thread_per_page);
    if ($searchResults instanceof PEAR_Error) {
        $notification->push($searchResults->getMessage(), 'horde.error');
        Horde::url('search.php')->redirect();
    }
    if ($searchResults['total'] > count($searchResults['results'])) {
        $pager_ob = new Horde_Core_Ui_Pager('thread_page', $vars, array('num' => $searchResults['total'], 'url' => 'search.php', 'perpage' => $thread_per_page));
        foreach ($info as $key => $val) {