b2evolution

Multilingual multiuser multiblog engine

b2evolution Technical Documentation (CVS HEAD) [ class tree: evocore ] [ index: evocore ] [ all elements ]

Source for file _coll_search_form.widget.php

Documentation is available at _coll_search_form.widget.php

  1. <?php
  2. /**
  3.  * This file implements the xyz Widget class.
  4.  *
  5.  * This file is part of the evoCore framework - {@link http://evocore.net/}
  6.  * See also {@link http://sourceforge.net/projects/evocms/}.
  7.  *
  8.  * @copyright (c)2003-2010 by Francois PLANQUE - {@link http://fplanque.net/}
  9.  *
  10.  *  {@internal License choice
  11.  *  - If you have received this file as part of a package, please find the license.txt file in
  12.  *    the same folder or the closest folder above for complete license terms.
  13.  *  - If you have received this file individually (e-g: from http://evocms.cvs.sourceforge.net/)
  14.  *    then you must choose one of the following licenses before using the file:
  15.  *    - GNU General Public License 2 (GPL) - http://www.opensource.org/licenses/gpl-license.php
  16.  *    - Mozilla Public License 1.1 (MPL) - http://www.opensource.org/licenses/mozilla1.1.php
  17.  *  }}}
  18.  *
  19.  * @package evocore
  20.  *
  21.  *  {@internal Below is a list of authors who have contributed to design/coding of this file: }}
  22.  * @author fplanque: Francois PLANQUE.
  23.  *
  24.  * @version $Id: _coll_search_form.widget.php,v 1.19 2010/02/08 17:54:48 efy-yury Exp $
  25.  */
  26. if!defined('EVO_MAIN_INIT') ) die'Please, do not access this page directly.' );
  27.  
  28. load_class'widgets/model/_widget.class.php''ComponentWidget' );
  29.  
  30. /**
  31.  * ComponentWidget Class
  32.  *
  33.  * A ComponentWidget is a displayable entity that can be placed into a Container on a web page.
  34.  *
  35.  * @package evocore
  36.  */
  37. {
  38.     /**
  39.      * Constructor
  40.      */
  41.     function coll_search_form_Widget$db_row NULL )
  42.     {
  43.         // Call parent constructor:
  44.         parent::ComponentWidget$db_row'core''coll_search_form' );
  45.     }
  46.  
  47.  
  48.     /**
  49.      * Get name of widget
  50.      */
  51.     function get_name()
  52.     {
  53.         return T_('Search Form');
  54.     }
  55.  
  56.  
  57.     /**
  58.      * Get a very short desc. Used in the widget list.
  59.      */
  60.     function get_short_desc()
  61.     {
  62.         return format_to_output($this->disp_params['title']);
  63.     }
  64.  
  65.  
  66.   /**
  67.      * Get short description
  68.      */
  69.     function get_desc()
  70.     {
  71.         return T_('Display search form');
  72.     }
  73.  
  74.  
  75.   /**
  76.    * Get definitions for editable params
  77.    *
  78.      * @see Plugin::GetDefaultSettings()
  79.      * @param local params like 'for_editing' => true
  80.      */
  81.     function get_param_definitions$params )
  82.     {
  83.         $r array_mergearray(
  84.                 'title' => array(
  85.                     'label' => T_('Block title'),
  86.                     'note' => T_'Title to display in your skin.' ),
  87.                     'size' => 40,
  88.                     'defaultvalue' => T_('Search'),
  89.                 ),
  90.                 'disp_search_options' => array(
  91.                     'label' => T_'Search options' ),
  92.                     'note' => T_'Display radio buttons for "All Words", "Some Word" and "Entire Phrase"' ),
  93.                     'type' => 'checkbox',
  94.                     'defaultvalue' => false,
  95.                 ),
  96.                 'use_search_disp' => array(
  97.                     'label' => T_'Results on search page' ),
  98.                     'note' => T_'Use advanced search page to display results (disp=search)' ),
  99.                     'type' => 'checkbox',
  100.                     'defaultvalue' => true,
  101.                 ),
  102.             )parent::get_param_definitions$params )    );
  103.  
  104.         return $r;
  105.     }
  106.  
  107.  
  108.     /**
  109.      * Display the widget!
  110.      *
  111.      * @param array MUST contain at least the basic display params
  112.      */
  113.     function display$params )
  114.     {
  115.         global $Blog;
  116.  
  117.         $this->init_display$params );
  118.  
  119.         // Collection search form:
  120.         echo $this->disp_params['block_start'];
  121.  
  122.         $this->disp_title();
  123.  
  124.         form_formstart$Blog->gen_blogurl()'search''SearchForm' );
  125.         if$this->disp_params'disp_search_options' )
  126.         {
  127.             echo '<div class="extended_search_form">';
  128.         }
  129.         else
  130.         {
  131.             echo '<div class="compact_search_form">';
  132.         }
  133.         $s get_param's' );
  134.         echo '<input type="text" name="s" size="25" value="'.htmlspecialchars($s).'" class="search_field SearchField" />';
  135.  
  136.         if$this->disp_params'disp_search_options' )
  137.         {
  138.             $sentence get_param'sentence' );
  139.             echo '<div class="search_options">';
  140.             echo '<div class="search_option"><input type="radio" name="sentence" value="AND" id="sentAND" '.$sentence=='AND' 'checked="checked" ' '' ).'/><label for="sentAND">'.T_('All words').'</label></div>';
  141.             echo '<div class="search_option"><input type="radio" name="sentence" value="OR" id="sentOR" '.$sentence=='OR' 'checked="checked" ' '' ).'/><label for="sentOR">'.T_('Some word').'</label></div>';
  142.             echo '<div class="search_option"><input type="radio" name="sentence" value="sentence" id="sentence" '.$sentence=='sentence' 'checked="checked" ' '' ).'/><label for="sentence">'.T_('Entire phrase').'</label></div>';
  143.             echo '</div>';
  144.         }
  145.         if$this->disp_params'use_search_disp' )
  146.         {
  147.             echo '<input type="hidden" name="disp" value="search" />';
  148.         }
  149.         echo '<input type="submit" name="submit" class="search_submit submit" value="'.T_('Search').'" />';
  150.         echo '</div>';
  151.         echo '</form>';
  152.  
  153.         echo $this->disp_params['block_end'];
  154.  
  155.         return true;
  156.     }
  157. }
  158.  
  159.  
  160. /*
  161.  * $Log: _coll_search_form.widget.php,v $
  162.  * Revision 1.19  2010/02/08 17:54:48  efy-yury
  163.  * copyright 2009 -> 2010
  164.  *
  165.  * Revision 1.18  2009/12/22 23:13:39  fplanque
  166.  * Skins v4, step 1:
  167.  * Added new disp modes
  168.  * Hooks for plugin disp modes
  169.  * Enhanced menu widgets (BIG TIME! :)
  170.  *
  171.  * Revision 1.17  2009/12/20 21:05:10  fplanque
  172.  * New default widget styles
  173.  *
  174.  * Revision 1.16  2009/10/21 22:12:44  blueyed
  175.  * whoops. fix is to use DIVs instead.
  176.  *
  177.  * Revision 1.15  2009/10/21 22:09:52  blueyed
  178.  * Remove wrong closing P tag.
  179.  *
  180.  * Revision 1.14  2009/09/14 13:54:13  efy-arrin
  181.  * Included the ClassName in load_class() call with proper UpperCase
  182.  *
  183.  * Revision 1.13  2009/09/12 11:03:13  efy-arrin
  184.  * Included the ClassName in the loadclass() with proper UpperCase
  185.  *
  186.  * Revision 1.12  2009/09/10 13:44:57  tblue246
  187.  * Translation fixes/update
  188.  *
  189.  * Revision 1.11  2009/03/13 02:32:07  fplanque
  190.  * Cleaned up widgets.
  191.  * Removed stupid widget_name param.
  192.  *
  193.  * Revision 1.10  2009/03/08 23:57:46  fplanque
  194.  * 2009
  195.  *
  196.  * Revision 1.9  2009/02/07 10:09:56  yabs
  197.  * Validation
  198.  *
  199.  * Revision 1.8  2008/05/26 19:02:28  fplanque
  200.  * enhanced search widget
  201.  *
  202.  * Revision 1.7  2008/05/11 01:06:40  fplanque
  203.  * OMG I'm pathetic :/
  204.  *
  205.  * Revision 1.6  2008/05/06 23:34:25  fplanque
  206.  * reverted my own screwup on the search_submit class
  207.  *
  208.  * Revision 1.4  2008/04/30 04:18:34  afwas
  209.  * Combined class submit and class search_submit
  210.  *
  211.  * Revision 1.3  2008/04/26 22:20:45  fplanque
  212.  * Improved compatibility with older skins.
  213.  *
  214.  * Revision 1.2  2008/01/21 09:35:37  fplanque
  215.  * (c) 2008
  216.  *
  217.  * Revision 1.1  2007/06/25 11:02:20  fplanque
  218.  * MODULES (refactored MVC)
  219.  *
  220.  * Revision 1.3  2007/06/23 22:05:16  fplanque
  221.  * fixes
  222.  *
  223.  * Revision 1.2  2007/06/20 21:42:13  fplanque
  224.  * implemented working widget/plugin params
  225.  *
  226.  * Revision 1.1  2007/06/18 21:25:47  fplanque
  227.  * one class per core widget
  228.  *
  229.  */
  230. ?>

Documentation generated on Sat, 06 Mar 2010 04:05:27 +0100 by phpDocumentor 1.4.2. This site is hosted and maintained by Daniel HAHLER (Contact).