dolibarr  7.0.0-beta
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  $accesskeyalreadyassigned=array();
85  foreach($arrayresult as $key => $val)
86  {
87  $tmp=explode('?', $val['url']);
88  $urlaction=$tmp[0];
89  $keysearch='search_all';
90 
91  $accesskey='';
92  if (! $accesskeyalreadyassigned[$val['label'][0]])
93  {
94  $accesskey=$val['label'][0];
95  $accesskeyalreadyassigned[$accesskey]=$accesskey;
96  }
97  $searchform.=printSearchForm($urlaction, $urlaction, $val['label'], 'minwidth200', $keysearch, $accesskey, $key, img_picto('',$val['img'],'', 0, 1), $showtitlebefore);
98  }
99 }
100 
101 // Execute hook printSearchForm
102 $parameters=array('searchform'=>$searchform);
103 $reshook=$hookmanager->executeHooks('printSearchForm',$parameters); // Note that $action and $object may have been modified by some hooks
104 if (empty($reshook))
105 {
106  $searchform.=$hookmanager->resPrint;
107 }
108 else $searchform=$hookmanager->resPrint;
109 
110 
111 print "\n";
112 print "<!-- Begin SearchForm -->\n";
113 print '<div class="center" align="center"><div align="center" style="padding: 6px;">';
114 print '<style>.menu_titre { padding-top: 7px; }</style>';
115 print '<div id="blockvmenusearch">'."\n";
116 print $searchform;
117 print '</div>'."\n";
118 print '</div></div>';
119 print "\n<!-- End SearchForm -->\n";
120 
121 print '</div>';
122 print '</body></html>'."\n";
123 
124 $db->close();
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt='', $morecss='')
Show picto whatever it's its name (generic function)
printSearchForm($urlaction, $urlobject, $title, $htmlmorecss, $htmlinputname, $accesskey='', $prefhtmlinputname='', $img='', $showtitlebefore=0)
Show a search area.
Definition: main.inc.php:1833
if(empty($reshook)) $form
View.
Definition: perms.php:103
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
Class to manage generation of HTML components Only common components must be here.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
top_htmlhead($head, $title='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $disablejmobile=0, $disablenofollow=0)
Ouput html header of a page.
Definition: main.inc.php:1091
print
Draft customers invoices.
Definition: index.php:91