dolibarr  9.0.0
search_page.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2005-2017 Laurent Destailleur <eldy@users.sourceforge.net>
3  *
4  * This file is a modified version of datepicker.php from phpBSM to fix some
5  * bugs, to add new features and to dramatically increase speed.
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
26 //if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
27 //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
28 //if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1');
29 //if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations
30 if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1);
31 if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1);
32 //if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled cause need to load personalized language
33 if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1);
34 //if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1);
35 
36 require_once '../main.inc.php';
37 
38 if (GETPOST('lang', 'aZ09')) $langs->setDefaultLang(GETPOST('lang', 'aZ09')); // If language was forced on URL by the main.inc.php
39 
40 $langs->load("main");
41 
42 $right=($langs->trans("DIRECTION")=='rtl'?'left':'right');
43 $left=($langs->trans("DIRECTION")=='rtl'?'right':'left');
44 
45 
46 /*
47  * View
48  */
49 
50 $title=$langs->trans("Search");
51 
52 // URL http://mydolibarr/core/search_page?dol_use_jmobile=1 can be used for tests
53 $head='<!-- Quick access -->'."\n";
54 $arrayofjs=array();
55 $arrayofcss=array();
56 top_htmlhead($head, $title, 0, 0, $arrayofjs, $arrayofcss);
57 
58 
59 
60 print '<body>'."\n";
61 print '<div>';
62 //print '<br>';
63 
64 $nbofsearch=0;
65 
66 // Instantiate hooks of thirdparty module
67 $hookmanager->initHooks(array('searchform'));
68 
69 // Define $searchform
70 $searchform = '';
71 
72 if ($conf->use_javascript_ajax && 1 == 2) // select2 is ko with jmobile
73 {
74  if (! is_object($form)) $form=new Form($db);
75  $selected=-1;
76  $searchform.='<br><br>'.$form->selectArrayAjax('searchselectcombo', DOL_URL_ROOT.'/core/ajax/selectsearchbox.php', $selected, '', '', 0, 1, 'minwidth300', 1, $langs->trans("Search"), 0);
77 }
78 else
79 {
80  $usedbyinclude = 1; // Used into next include
81  $showtitlebefore = GETPOST('showtitlebefore','int');
82  include DOL_DOCUMENT_ROOT.'/core/ajax/selectsearchbox.php';
83 
84  $i=0;
85  $accesskeyalreadyassigned=array();
86  foreach($arrayresult as $key => $val)
87  {
88  $tmp=explode('?', $val['url']);
89  $urlaction=$tmp[0];
90  $keysearch='search_all';
91 
92  $accesskey='';
93  if (! $accesskeyalreadyassigned[$val['label'][0]])
94  {
95  $accesskey=$val['label'][0];
96  $accesskeyalreadyassigned[$accesskey]=$accesskey;
97  }
98  $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore, ($i>0?0:1));
99 
100  $i++;
101  }
102 }
103 
104 // Execute hook printSearchForm
105 $parameters=array('searchform'=>$searchform);
106 $reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
107 if (empty($reshook))
108 {
109  $searchform.=$hookmanager->resPrint;
110 }
111 else $searchform=$hookmanager->resPrint;
112 
113 
114 print "\n";
115 print "<!-- Begin SearchForm -->\n";
116 print '<div class="center" align="center"><div align="center" style="padding: 6px;">';
117 print '<style>.menu_titre { padding-top: 7px; }</style>';
118 print '<div id="blockvmenusearch">'."\n";
119 print $searchform;
120 print '</div>'."\n";
121 print '</div></div>';
122 print "\n<!-- End SearchForm -->\n";
123 
124 print '</div>';
125 print '</body></html>'."\n";
126 
127 $db->close();
GETPOST($paramname, $check='none', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
print
Draft customers invoices.
Definition: index.php:91
Class to manage generation of HTML components Only common components must be here.
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1172
printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='', $img='', $showtitlebefore=0, $autofocus=0)
Show a search area.
Definition: main.inc.php:1941
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it&#39;s its name (generic function)