advmultiselect.php 47 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309
  1. <?php
  2. /**
  3. * Copyright (c) 2005-2009, Laurent Laville <pear@laurent-laville.org>
  4. *
  5. * All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * * Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * * Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in the
  15. * documentation and/or other materials provided with the distribution.
  16. * * Neither the name of the authors nor the names of its contributors
  17. * may be used to endorse or promote products derived from this software
  18. * without specific prior written permission.
  19. *
  20. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
  24. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27. * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28. * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30. * POSSIBILITY OF SUCH DAMAGE.
  31. *
  32. * PHP versions 4 and 5
  33. *
  34. * @category HTML
  35. * @package HTML_QuickForm_advmultiselect
  36. * @author Laurent Laville <pear@laurent-laville.org>
  37. * @copyright 2005-2009 Laurent Laville
  38. * @license http://www.opensource.org/licenses/bsd-license.php BSD
  39. * @version CVS: $Id: advmultiselect.php,v 1.36 2009/04/05 07:03:39 farell Exp $
  40. * @link http://pear.php.net/package/HTML_QuickForm_advmultiselect
  41. * @since File available since Release 0.4.0
  42. */
  43. /**
  44. * Code
  45. */
  46. /**
  47. * Element for HTML_QuickForm that emulate a multi-select.
  48. *
  49. * The HTML_QuickForm_advmultiselect package adds an element to the
  50. * HTML_QuickForm package that is two select boxes next to each other
  51. * emulating a multi-select.
  52. *
  53. * @category HTML
  54. * @package HTML_QuickForm_advmultiselect
  55. * @author Laurent Laville <pear@laurent-laville.org>
  56. * @copyright 2005-2009 Laurent Laville
  57. * @license http://www.opensource.org/licenses/bsd-license.php BSD
  58. * @version Release: @package_version@
  59. * @link http://pear.php.net/package/HTML_QuickForm_advmultiselect
  60. * @since Class available since Release 0.4.0
  61. */
  62. class HTML_QuickForm_advmultiselect extends HTML_QuickForm_select
  63. {
  64. /**
  65. * Prefix function name in javascript move selections
  66. *
  67. * @var string
  68. * @access private
  69. * @since 0.4.0
  70. */
  71. var $_jsPrefix;
  72. /**
  73. * Postfix function name in javascript move selections
  74. *
  75. * @var string
  76. * @access private
  77. * @since 0.4.0
  78. */
  79. var $_jsPostfix;
  80. /**
  81. * Associative array of the multi select container attributes
  82. *
  83. * @var array
  84. * @access private
  85. * @since 0.4.0
  86. */
  87. var $_tableAttributes;
  88. /**
  89. * Associative array of the add button attributes
  90. *
  91. * @var array
  92. * @access private
  93. * @since 0.4.0
  94. */
  95. var $_addButtonAttributes;
  96. /**
  97. * Associative array of the remove button attributes
  98. *
  99. * @var array
  100. * @access private
  101. * @since 0.4.0
  102. */
  103. var $_removeButtonAttributes;
  104. /**
  105. * Associative array of the select all button attributes
  106. *
  107. * @var array
  108. * @access private
  109. * @since 1.1.0
  110. */
  111. var $_allButtonAttributes;
  112. /**
  113. * Associative array of the select none button attributes
  114. *
  115. * @var array
  116. * @access private
  117. * @since 1.1.0
  118. */
  119. var $_noneButtonAttributes;
  120. /**
  121. * Associative array of the toggle selection button attributes
  122. *
  123. * @var array
  124. * @access private
  125. * @since 1.1.0
  126. */
  127. var $_toggleButtonAttributes;
  128. /**
  129. * Associative array of the move up button attributes
  130. *
  131. * @var array
  132. * @access private
  133. * @since 0.5.0
  134. */
  135. var $_upButtonAttributes;
  136. /**
  137. * Associative array of the move up button attributes
  138. *
  139. * @var array
  140. * @access private
  141. * @since 0.5.0
  142. */
  143. var $_downButtonAttributes;
  144. /**
  145. * Associative array of the move top button attributes
  146. *
  147. * @var array
  148. * @access private
  149. * @since 1.5.0
  150. */
  151. var $_topButtonAttributes;
  152. /**
  153. * Associative array of the move bottom button attributes
  154. *
  155. * @var array
  156. * @access private
  157. * @since 1.5.0
  158. */
  159. var $_bottomButtonAttributes;
  160. /**
  161. * Defines if both list (unselected, selected) will have their elements be
  162. * arranged from lowest to highest (or reverse)
  163. * depending on comparaison function.
  164. *
  165. * SORT_ASC is used to sort in ascending order
  166. * SORT_DESC is used to sort in descending order
  167. *
  168. * @var string ('none' == false, 'asc' == SORT_ASC, 'desc' == SORT_DESC)
  169. * @access private
  170. * @since 0.5.0
  171. */
  172. var $_sort;
  173. /**
  174. * Associative array of the unselected item box attributes
  175. *
  176. * @var array
  177. * @access private
  178. * @since 0.4.0
  179. */
  180. var $_attributesUnselected;
  181. /**
  182. * Associative array of the selected item box attributes
  183. *
  184. * @var array
  185. * @access private
  186. * @since 0.4.0
  187. */
  188. var $_attributesSelected;
  189. /**
  190. * Associative array of the internal hidden box attributes
  191. *
  192. * @var array
  193. * @access private
  194. * @since 0.4.0
  195. */
  196. var $_attributesHidden;
  197. /**
  198. * Default Element template string
  199. *
  200. * @var string
  201. * @access private
  202. * @since 0.4.0
  203. */
  204. var $_elementTemplate;
  205. /**
  206. * Default Element stylesheet string
  207. *
  208. * @var string
  209. * @access private
  210. * @since 0.4.0
  211. */
  212. var $_elementCSS = '
  213. #qfams_{id} {
  214. font: 13.3px sans-serif;
  215. background-color: #fff;
  216. overflow: auto;
  217. height: 14.3em;
  218. width: 12em;
  219. border-left: 1px solid #404040;
  220. border-top: 1px solid #404040;
  221. border-bottom: 1px solid #d4d0c8;
  222. border-right: 1px solid #d4d0c8;
  223. }
  224. #qfams_{id} label {
  225. padding-right: 3px;
  226. display: block;
  227. }
  228. ';
  229. /**
  230. * Class constructor
  231. *
  232. * Class constructors :
  233. * Zend Engine 1 uses HTML_QuickForm_advmultiselect, while
  234. * Zend Engine 2 uses __construct
  235. *
  236. * @param string $elementName Dual Select name attribute
  237. * @param mixed $elementLabel Label(s) for the select boxes
  238. * @param mixed $options Data to be used to populate options
  239. * @param mixed $attributes Either a typical HTML attribute string or
  240. * an associative array
  241. * @param integer $sort Either SORT_ASC for auto ascending arrange,
  242. * SORT_DESC for auto descending arrange, or
  243. * NULL for no sort (append at end: default)
  244. *
  245. * @access public
  246. * @return void
  247. * @since version 0.4.0 (2005-06-25)
  248. */
  249. function HTML_QuickForm_advmultiselect(
  250. $elementName = null,
  251. $elementLabel = null,
  252. $options = null,
  253. $attributes = null,
  254. $sort = null
  255. ) {
  256. $opts = $options;
  257. $options = null; // prevent to use the default select element load options
  258. $this->HTML_QuickForm_select(
  259. $elementName,
  260. $elementLabel,
  261. $options,
  262. $attributes
  263. );
  264. // allow to load options at once and take care of fancy attributes
  265. $this->load($opts);
  266. // add multiple selection attribute by default if missing
  267. $this->updateAttributes(array('multiple' => 'multiple'));
  268. if (is_null($this->getAttribute('size'))) {
  269. // default size is ten item on each select box (left and right)
  270. $this->updateAttributes(array('size' => 10));
  271. }
  272. if (is_null($this->getAttribute('style'))) {
  273. // default width of each select box
  274. //$this->updateAttributes(array('style' => 'min-width:100px;'));
  275. }
  276. $this->_tableAttributes = $this->getAttribute('class');
  277. $attr = null;
  278. if (is_null($this->_tableAttributes)) {
  279. $this->updateAttributes(array('class' => 'col-md-4'));
  280. } else {
  281. $attr = array('class' => $this->_tableAttributes);
  282. $this->_removeAttr('class', $this->_attributes);
  283. }
  284. $this->_tableAttributes = $this->_getAttrString($attr);
  285. // set default add button attributes
  286. $this->setButtonAttributes('add');
  287. // set default remove button attributes
  288. $this->setButtonAttributes('remove');
  289. // set default selectall button attributes
  290. $this->setButtonAttributes('all');
  291. // set default selectnone button attributes
  292. $this->setButtonAttributes('none');
  293. // set default toggle selection button attributes
  294. $this->setButtonAttributes('toggle');
  295. // set default move up button attributes
  296. $this->setButtonAttributes('moveup');
  297. // set default move up button attributes
  298. $this->setButtonAttributes('movedown');
  299. // set default move top button attributes
  300. $this->setButtonAttributes('movetop');
  301. // set default move bottom button attributes
  302. $this->setButtonAttributes('movebottom');
  303. // defines javascript functions names
  304. $this->_jsPrefix = 'QFAMS.';
  305. $this->_jsPostfix = 'moveSelection';
  306. // set select boxes sort order (none by default)
  307. if (!isset($sort)) {
  308. $sort = false;
  309. }
  310. if ($sort === SORT_ASC) {
  311. $this->_sort = 'asc';
  312. } elseif ($sort === SORT_DESC) {
  313. $this->_sort = 'desc';
  314. } else {
  315. $this->_sort = 'none';
  316. }
  317. // set the default advmultiselect element template (with javascript embedded)
  318. $this->setElementTemplate();
  319. }
  320. /**
  321. * Sets the button attributes
  322. *
  323. * In <b>custom example 1</b>, the <i>add</i> and <i>remove</i> buttons
  324. * have look set by the css class <i>inputCommand</i>.
  325. *
  326. * In <b>custom example 2</b>, the basic text <i>add</i> and <i>remove</i>
  327. * buttons are now replaced by images.
  328. *
  329. * In <b>custom example 5</b>, we have ability to sort the selection list
  330. * (on right side) by :
  331. * <pre>
  332. * - <b>user-end</b>: with <i>Up</i> and <i>Down</i> buttons
  333. * - <b>programming</b>: with the QF element constructor $sort option
  334. * </pre>
  335. *
  336. * @param string $button Button identifier, either 'add', 'remove',
  337. * 'all', 'none', 'toggle',
  338. * 'movetop', 'movebottom'
  339. * 'moveup' or 'movedown'
  340. * @param mixed $attributes (optional) Either a typical HTML attribute string
  341. * or an associative array
  342. *
  343. * @return void
  344. * @throws PEAR_Error $button argument
  345. * is not a string, or not in range
  346. * (add, remove, all, none, toggle,
  347. * movetop, movebottom, moveup, movedown)
  348. * @access public
  349. * @since version 0.4.0 (2005-06-25)
  350. *
  351. * @example examples/qfams_custom_5.php
  352. * Custom example 5: source code
  353. * @link http://www.laurent-laville.org/img/qfams/screenshot/custom5.png
  354. * Custom example 5: screenshot
  355. *
  356. * @example examples/qfams_custom_2.php
  357. * Custom example 2: source code
  358. * @link http://www.laurent-laville.org/img/qfams/screenshot/custom2.png
  359. * Custom example 2: screenshot
  360. *
  361. * @example examples/qfams_custom_1.php
  362. * Custom example 1: source code
  363. * @link http://www.laurent-laville.org/img/qfams/screenshot/custom1.png
  364. * Custom example 1: screenshot
  365. */
  366. function setButtonAttributes($button, $attributes = null)
  367. {
  368. if (!is_string($button)) {
  369. return PEAR::throwError(
  370. 'Argument 1 of HTML_QuickForm_advmultiselect::'.
  371. 'setButtonAttributes is not a string',
  372. HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
  373. array('level' => 'exception')
  374. );
  375. }
  376. switch ($button) {
  377. case 'add':
  378. if (is_null($attributes)) {
  379. $this->_addButtonAttributes
  380. = array(
  381. 'name' => 'add',
  382. 'value' => '',
  383. 'type' => 'button'
  384. );
  385. $this->setValue('<i class="icon-shopping-cart icon-large"></i>');
  386. } else {
  387. $this->_updateAttrArray(
  388. $this->_addButtonAttributes,
  389. $this->_parseAttributes($attributes)
  390. );
  391. }
  392. break;
  393. case 'remove':
  394. if (is_null($attributes)) {
  395. $this->_removeButtonAttributes
  396. = array(
  397. 'name' => 'remove',
  398. 'value' => ' ',
  399. 'type' => 'button'
  400. );
  401. } else {
  402. $this->_updateAttrArray(
  403. $this->_removeButtonAttributes,
  404. $this->_parseAttributes($attributes)
  405. );
  406. }
  407. break;
  408. case 'all':
  409. if (is_null($attributes)) {
  410. $this->_allButtonAttributes
  411. = array(
  412. 'name' => 'all',
  413. 'value' => ' Select All ',
  414. 'type' => 'button'
  415. );
  416. } else {
  417. $this->_updateAttrArray(
  418. $this->_allButtonAttributes,
  419. $this->_parseAttributes($attributes)
  420. );
  421. }
  422. break;
  423. case 'none':
  424. if (is_null($attributes)) {
  425. $this->_noneButtonAttributes
  426. = array(
  427. 'name' => 'none',
  428. 'value' => ' Select None ',
  429. 'type' => 'button'
  430. );
  431. } else {
  432. $this->_updateAttrArray(
  433. $this->_noneButtonAttributes,
  434. $this->_parseAttributes($attributes)
  435. );
  436. }
  437. break;
  438. case 'toggle':
  439. if (is_null($attributes)) {
  440. $this->_toggleButtonAttributes
  441. = array(
  442. 'name' => 'toggle',
  443. 'value' => ' Toggle Selection ',
  444. 'type' => 'button'
  445. );
  446. } else {
  447. $this->_updateAttrArray(
  448. $this->_toggleButtonAttributes,
  449. $this->_parseAttributes($attributes)
  450. );
  451. }
  452. break;
  453. case 'moveup':
  454. if (is_null($attributes)) {
  455. $this->_upButtonAttributes
  456. = array(
  457. 'name' => 'up',
  458. 'value' => ' Up ',
  459. 'type' => 'button'
  460. );
  461. } else {
  462. $this->_updateAttrArray(
  463. $this->_upButtonAttributes,
  464. $this->_parseAttributes($attributes)
  465. );
  466. }
  467. break;
  468. case 'movedown':
  469. if (is_null($attributes)) {
  470. $this->_downButtonAttributes
  471. = array(
  472. 'name' => 'down',
  473. 'value' => ' Down ',
  474. 'type' => 'button'
  475. );
  476. } else {
  477. $this->_updateAttrArray(
  478. $this->_downButtonAttributes,
  479. $this->_parseAttributes($attributes)
  480. );
  481. }
  482. break;
  483. case 'movetop':
  484. if (is_null($attributes)) {
  485. $this->_topButtonAttributes
  486. = array(
  487. 'name' => 'top',
  488. 'value' => ' Top ',
  489. 'type' => 'button'
  490. );
  491. } else {
  492. $this->_updateAttrArray(
  493. $this->_topButtonAttributes,
  494. $this->_parseAttributes($attributes)
  495. );
  496. }
  497. break;
  498. case 'movebottom':
  499. if (is_null($attributes)) {
  500. $this->_bottomButtonAttributes
  501. = array(
  502. 'name' => 'bottom',
  503. 'value' => ' Bottom ',
  504. 'type' => 'button'
  505. );
  506. } else {
  507. $this->_updateAttrArray(
  508. $this->_bottomButtonAttributes,
  509. $this->_parseAttributes($attributes)
  510. );
  511. }
  512. break;
  513. default;
  514. return PEAR::throwError(
  515. 'Argument 1 of HTML_QuickForm_advmultiselect::'.
  516. 'setButtonAttributes has unexpected value',
  517. HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
  518. array('level' => 'error')
  519. );
  520. }
  521. }
  522. /**
  523. * Sets element template
  524. *
  525. * @param string $html (optional) The HTML surrounding select boxes and buttons
  526. * @param string $js (optional) if we need to include qfams javascript handler
  527. *
  528. * @access public
  529. * @return string
  530. * @since version 0.4.0 (2005-06-25)
  531. */
  532. function setElementTemplate($html = null, $js = true)
  533. {
  534. $oldTemplate = $this->_elementTemplate;
  535. if (isset($html) && is_string($html)) {
  536. // $this->_elementTemplate = $html;
  537. } else {
  538. $this->_elementTemplate = '
  539. {javascript}
  540. <div class="advmultiselect row">
  541. <div class="col-md-5">{unselected}</div>
  542. <div class="col-md-2">{add} <br /><br />{remove}</div>
  543. <div class="col-md-5">{selected}</div>
  544. </div>
  545. ';
  546. }
  547. if ($js == false) {
  548. $this->_elementTemplate = str_replace('{javascript}', '', $this->_elementTemplate);
  549. }
  550. //return $oldTemplate;
  551. }
  552. /**
  553. * Gets default element stylesheet for a single multi-select shape render
  554. *
  555. * In <b>custom example 4</b>, the template defined allows
  556. * a single multi-select checkboxes shape. Useful when javascript is disabled
  557. * (or when browser is not js compliant). In our example, no need to add
  558. * javascript code, but css is mandatory.
  559. *
  560. * @param boolean $raw (optional) html output with style tags or just raw data
  561. *
  562. * @access public
  563. * @return string
  564. * @since version 0.4.0 (2005-06-25)
  565. *
  566. * @example qfams_custom_4.php
  567. * Custom example 4: source code
  568. * @link http://www.laurent-laville.org/img/qfams/screenshot/custom4.png
  569. * Custom example 4: screenshot
  570. */
  571. function getElementCss($raw = true)
  572. {
  573. $id = $this->getAttribute('name');
  574. $css = str_replace('{id}', $id, $this->_elementCSS);
  575. if ($raw !== true) {
  576. $css = '<style type="text/css">'.PHP_EOL
  577. // Modified by Chamilo team, 16-MAR-2010.
  578. //. '<!--' . $css . '// -->' . PHP_EOL
  579. .'/*<![CDATA[*/'.PHP_EOL
  580. .$css.PHP_EOL
  581. .'/*]]>*/'.PHP_EOL
  582. //
  583. .'</style>';
  584. }
  585. return $css;
  586. }
  587. /**
  588. * Returns the HTML generated for the advanced mutliple select component
  589. *
  590. * @access public
  591. * @return string
  592. * @since version 0.4.0 (2005-06-25)
  593. */
  594. function toHtml()
  595. {
  596. if ($this->_flagFrozen) {
  597. return $this->getFrozenHtml();
  598. }
  599. $tabs = $this->_getTabs();
  600. $tab = $this->_getTab();
  601. $selectId = $this->getName();
  602. $selectName = $this->getName().'[]';
  603. $selectNameFrom = $this->getName().'-f[]';
  604. $selectNameTo = $this->getName().'-t[]';
  605. $selected_count = 0;
  606. // placeholder {unselected} existence determines if we will render
  607. if (strpos($this->_elementTemplate, '{unselected}') === false) {
  608. // ... a single multi-select with checkboxes
  609. $this->_jsPostfix = 'editSelection';
  610. $id = $this->getAttribute('name');
  611. $strHtmlSelected = $tab.'<div id="qfams_'.$id.'">'.PHP_EOL;
  612. $unselected_count = count($this->_options);
  613. $checkbox_id_suffix = 0;
  614. foreach ($this->_options as $option) {
  615. $_labelAttributes = array('style', 'class', 'onmouseover', 'onmouseout');
  616. $labelAttributes = array();
  617. foreach ($_labelAttributes as $attr) {
  618. if (isset($option['attr'][$attr])) {
  619. $labelAttributes[$attr] = $option['attr'][$attr];
  620. unset($option['attr'][$attr]);
  621. }
  622. }
  623. if (is_array($this->_values)
  624. && in_array((string)$option['attr']['value'], $this->_values)
  625. ) {
  626. // The items is *selected*
  627. $checked = ' checked="checked"';
  628. $selected_count++;
  629. } else {
  630. // The item is *unselected* so we want to put it
  631. $checked = '';
  632. }
  633. $checkbox_id_suffix++;
  634. $strHtmlSelected .= $tab
  635. .'<label'
  636. .$this->_getAttrString($labelAttributes).'>'
  637. .'<input type="checkbox"'
  638. .' id="'.$selectId.$checkbox_id_suffix.'"'
  639. .' name="'.$selectName.'"'
  640. .$checked
  641. .$this->_getAttrString($option['attr'])
  642. .' />'.$option['text'].'</label>'
  643. .PHP_EOL;
  644. }
  645. $strHtmlSelected .= $tab.'</div>'.PHP_EOL;
  646. $strHtmlHidden = '';
  647. $strHtmlUnselected = '';
  648. $strHtmlAdd = '';
  649. $strHtmlRemove = '';
  650. // build the select all button with all its attributes
  651. $jsName = $this->_jsPrefix.$this->_jsPostfix;
  652. $attributes = array(
  653. 'onclick' => $jsName.
  654. "('".$selectId."', 1);"
  655. );
  656. $this->_allButtonAttributes
  657. = array_merge($this->_allButtonAttributes, $attributes);
  658. $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
  659. $strHtmlAll = "<input$attrStrAll />".PHP_EOL;
  660. // build the select none button with all its attributes
  661. $attributes = array(
  662. 'onclick' => $jsName.
  663. "('".$selectId."', 0);"
  664. );
  665. $this->_noneButtonAttributes
  666. = array_merge($this->_noneButtonAttributes, $attributes);
  667. $attrStrNone = $this->_getAttrString($this->_noneButtonAttributes);
  668. $strHtmlNone = "<input$attrStrNone />".PHP_EOL;
  669. // build the toggle selection button with all its attributes
  670. $attributes = array(
  671. 'onclick' => $jsName.
  672. "('".$selectId."', 2);"
  673. );
  674. $this->_toggleButtonAttributes
  675. = array_merge(
  676. $this->_toggleButtonAttributes,
  677. $attributes
  678. );
  679. $attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes);
  680. $strHtmlToggle = "<input$attrStrToggle />".PHP_EOL;
  681. $strHtmlMoveUp = '';
  682. $strHtmlMoveDown = '';
  683. $strHtmlMoveTop = '';
  684. $strHtmlMoveBottom = '';
  685. // default selection counters
  686. $strHtmlSelectedCount = $selected_count.'/'.$unselected_count;
  687. } else {
  688. // ... or a dual multi-select
  689. $this->_jsPostfix = 'moveSelection';
  690. $jsName = $this->_jsPrefix.$this->_jsPostfix;
  691. // set name of Select From Box
  692. $this->_attributesUnselected
  693. = array(
  694. 'id' => $selectId.'-f',
  695. 'name' => $selectNameFrom,
  696. 'ondblclick' => $jsName.
  697. "('{$selectId}', ".
  698. "this.form.elements['".$selectNameFrom."'], ".
  699. "this.form.elements['".$selectNameTo."'], ".
  700. "this.form.elements['".$selectName."'], ".
  701. "'add', '{$this->_sort}')"
  702. );
  703. $this->_attributesUnselected
  704. = array_merge($this->_attributes, $this->_attributesUnselected);
  705. $attrUnselected = $this->_getAttrString($this->_attributesUnselected);
  706. // set name of Select To Box
  707. $this->_attributesSelected
  708. = array(
  709. 'id' => $selectId.'-t',
  710. 'name' => $selectNameTo,
  711. 'ondblclick' => $jsName.
  712. "('{$selectId}', ".
  713. "this.form.elements['".$selectNameFrom."'], ".
  714. "this.form.elements['".$selectNameTo."'], ".
  715. "this.form.elements['".$selectName."'], ".
  716. "'remove', '{$this->_sort}')"
  717. );
  718. $this->_attributesSelected
  719. = array_merge($this->_attributes, $this->_attributesSelected);
  720. $attrSelected = $this->_getAttrString($this->_attributesSelected);
  721. // set name of Select hidden Box
  722. $this->_attributesHidden
  723. = array(
  724. 'name' => $selectName,
  725. 'style' => 'overflow: hidden; visibility: hidden; '.
  726. 'width: 1px; height: 0;'
  727. );
  728. $this->_attributesHidden
  729. = array_merge($this->_attributes, $this->_attributesHidden);
  730. $attrHidden = $this->_getAttrString($this->_attributesHidden);
  731. // prepare option tables to be displayed as in POST order
  732. $append = count($this->_values);
  733. if ($append > 0) {
  734. $arrHtmlSelected = array_fill(0, $append, ' ');
  735. } else {
  736. $arrHtmlSelected = array();
  737. }
  738. $options = count($this->_options);
  739. $arrHtmlUnselected = array();
  740. if ($options > 0) {
  741. $arrHtmlHidden = array_fill(0, $options, ' ');
  742. foreach ($this->_options as $option) {
  743. if (is_array($this->_values)
  744. && in_array(
  745. (string)$option['attr']['value'],
  746. $this->_values
  747. )
  748. ) {
  749. // Get the post order
  750. $key = array_search(
  751. $option['attr']['value'],
  752. $this->_values
  753. );
  754. /** The items is *selected* so we want to put it
  755. in the 'selected' multi-select */
  756. $arrHtmlSelected[$key] = $option;
  757. /** Add it to the 'hidden' multi-select
  758. and set it as 'selected' */
  759. if (isset($option['attr']['disabled'])) {
  760. unset($option['attr']['disabled']);
  761. }
  762. $option['attr']['selected'] = 'selected';
  763. $arrHtmlHidden[$key] = $option;
  764. } else {
  765. /** The item is *unselected* so we want to put it
  766. in the 'unselected' multi-select */
  767. $arrHtmlUnselected[] = $option;
  768. // Add it to the hidden multi-select as 'unselected'
  769. $arrHtmlHidden[$append] = $option;
  770. $append++;
  771. }
  772. }
  773. } else {
  774. $arrHtmlHidden = array();
  775. }
  776. // The 'unselected' multi-select which appears on the left
  777. $unselected_count = count($arrHtmlUnselected);
  778. if ($unselected_count == 0) {
  779. $this->_attributesUnselected['disabled'] = 'disabled';
  780. $this->_attributesUnselected
  781. = array_merge($this->_attributes, $this->_attributesUnselected);
  782. $attrUnselected = $this->_getAttrString($this->_attributesUnselected);
  783. }
  784. $strHtmlUnselected = "<select$attrUnselected>".PHP_EOL;
  785. if ($unselected_count > 0) {
  786. foreach ($arrHtmlUnselected as $data) {
  787. $strHtmlUnselected
  788. .= $tabs.$tab
  789. .'<option'.$this->_getAttrString($data['attr']).'>'
  790. .$data['text'].'</option>'.PHP_EOL;
  791. }
  792. } else {
  793. $strHtmlUnselected .= '<option value="">&nbsp;</option>';
  794. }
  795. $strHtmlUnselected .= '</select>';
  796. $strHtmlUnselected = '<input placeholder="'.get_lang('Search').'" id="f-'.$selectId.'-filter" type="text" class="search-query select_class_filter"><br /><br />'.$strHtmlUnselected;
  797. // The 'selected' multi-select which appears on the right
  798. $selected_count = count($arrHtmlSelected);
  799. if ($selected_count == 0) {
  800. $this->_attributesSelected['disabled'] = 'disabled';
  801. $this->_attributesSelected
  802. = array_merge($this->_attributes, $this->_attributesSelected);
  803. $attrSelected = $this->_getAttrString($this->_attributesSelected);
  804. }
  805. $strHtmlSelected = "<select$attrSelected>".PHP_EOL;
  806. if ($selected_count > 0) {
  807. foreach ($arrHtmlSelected as $data) {
  808. if (!empty($data) && isset($data['attr'])) {
  809. $strHtmlSelected
  810. .= $tabs.$tab
  811. .'<option'.$this->_getAttrString($data['attr']).'>'
  812. .$data['text'].'</option>'.PHP_EOL;
  813. }
  814. }
  815. } else {
  816. $strHtmlSelected .= '<option value="">&nbsp;</option>';
  817. }
  818. $strHtmlSelected .= '</select>';
  819. $strHtmlSelected = '<input placeholder="'.get_lang('Search').'" id="t-'.$selectId.'-filter" type="text" class="search-query"><br /><br />'.$strHtmlSelected;
  820. // The 'hidden' multi-select
  821. $strHtmlHidden = "<select$attrHidden>".PHP_EOL;
  822. if (count($arrHtmlHidden) > 0) {
  823. foreach ($arrHtmlHidden as $data) {
  824. if (!empty($data) && isset($data['attr'])) {
  825. $strHtmlHidden
  826. .= $tabs.$tab
  827. .'<option'.$this->_getAttrString($data['attr']).'>'.$data['text'].'</option>'.PHP_EOL;
  828. }
  829. }
  830. }
  831. $strHtmlHidden .= '</select>';
  832. // build the remove button with all its attributes
  833. $attributes = array(
  834. 'class' => 'btn btn-default ',
  835. 'onclick' => $jsName.
  836. "('{$selectId}', ".
  837. "this.form.elements['".$selectNameFrom."'], ".
  838. "this.form.elements['".$selectNameTo."'], ".
  839. "this.form.elements['".$selectName."'], ".
  840. "'remove', '{$this->_sort}'); return false;"
  841. );
  842. $this->_removeButtonAttributes
  843. = array_merge($this->_removeButtonAttributes, $attributes);
  844. $attrStrRemove = $this->_getAttrString($this->_removeButtonAttributes);
  845. //$strHtmlRemove = "<input$attrStrRemove />". PHP_EOL;
  846. $strHtmlRemove = "<button$attrStrRemove /><i class='fa fa-arrow-left fa2'></i></button>".PHP_EOL;
  847. // build the add button with all its attributes
  848. $attributes
  849. = array(
  850. 'class' => 'btn btn-default',
  851. 'onclick' => $jsName.
  852. "('{$selectId}', ".
  853. "this.form.elements['".$selectNameFrom."'], ".
  854. "this.form.elements['".$selectNameTo."'], ".
  855. "this.form.elements['".$selectName."'], ".
  856. "'add', '{$this->_sort}'); return false;"
  857. );
  858. $this->_addButtonAttributes
  859. = array_merge($this->_addButtonAttributes, $attributes);
  860. $attrStrAdd = $this->_getAttrString($this->_addButtonAttributes);
  861. $strHtmlAdd = "<button$attrStrAdd /><i class='fa fa-arrow-right fa2'></i></button>".PHP_EOL;
  862. // build the select all button with all its attributes
  863. $attributes
  864. = array(
  865. 'onclick' => $jsName.
  866. "('{$selectId}', ".
  867. "this.form.elements['".$selectNameFrom."'], ".
  868. "this.form.elements['".$selectNameTo."'], ".
  869. "this.form.elements['".$selectName."'], ".
  870. "'all', '{$this->_sort}'); return false;"
  871. );
  872. $this->_allButtonAttributes
  873. = array_merge($this->_allButtonAttributes, $attributes);
  874. $attrStrAll = $this->_getAttrString($this->_allButtonAttributes);
  875. $strHtmlAll = "<input$attrStrAll />".PHP_EOL;
  876. // build the select none button with all its attributes
  877. $attributes
  878. = array(
  879. 'onclick' => $jsName.
  880. "('{$selectId}', ".
  881. "this.form.elements['".$selectNameFrom."'], ".
  882. "this.form.elements['".$selectNameTo."'], ".
  883. "this.form.elements['".$selectName."'], ".
  884. "'none', '{$this->_sort}'); return false;"
  885. );
  886. $this->_noneButtonAttributes
  887. = array_merge($this->_noneButtonAttributes, $attributes);
  888. $attrStrNone = $this->_getAttrString($this->_noneButtonAttributes);
  889. $strHtmlNone = "<input$attrStrNone />".PHP_EOL;
  890. // build the toggle button with all its attributes
  891. $attributes
  892. = array(
  893. 'onclick' => $jsName.
  894. "('{$selectId}', ".
  895. "this.form.elements['".$selectNameFrom."'], ".
  896. "this.form.elements['".$selectNameTo."'], ".
  897. "this.form.elements['".$selectName."'], ".
  898. "'toggle', '{$this->_sort}'); return false;"
  899. );
  900. $this->_toggleButtonAttributes
  901. = array_merge($this->_toggleButtonAttributes, $attributes);
  902. $attrStrToggle = $this->_getAttrString($this->_toggleButtonAttributes);
  903. $strHtmlToggle = "<input$attrStrToggle />".PHP_EOL;
  904. // build the move up button with all its attributes
  905. $attributes
  906. = array(
  907. 'onclick' => "{$this->_jsPrefix}moveUp".
  908. "(this.form.elements['".$selectNameTo."'], ".
  909. "this.form.elements['".$selectName."']); ".
  910. "return false;"
  911. );
  912. $this->_upButtonAttributes
  913. = array_merge($this->_upButtonAttributes, $attributes);
  914. $attrStrUp = $this->_getAttrString($this->_upButtonAttributes);
  915. $strHtmlMoveUp = "<input$attrStrUp />".PHP_EOL;
  916. // build the move down button with all its attributes
  917. $attributes
  918. = array(
  919. 'onclick' => "{$this->_jsPrefix}moveDown".
  920. "(this.form.elements['".$selectNameTo."'], ".
  921. "this.form.elements['".$selectName."']); ".
  922. "return false;"
  923. );
  924. $this->_downButtonAttributes
  925. = array_merge($this->_downButtonAttributes, $attributes);
  926. $attrStrDown = $this->_getAttrString($this->_downButtonAttributes);
  927. $strHtmlMoveDown = "<input$attrStrDown />".PHP_EOL;
  928. // build the move top button with all its attributes
  929. $attributes
  930. = array(
  931. 'onclick' => "{$this->_jsPrefix}moveTop".
  932. "(this.form.elements['".$selectNameTo."'], ".
  933. "this.form.elements['".$selectName."']); ".
  934. "return false;"
  935. );
  936. $this->_topButtonAttributes
  937. = array_merge($this->_topButtonAttributes, $attributes);
  938. $attrStrTop = $this->_getAttrString($this->_topButtonAttributes);
  939. $strHtmlMoveTop = "<input$attrStrTop />".PHP_EOL;
  940. // build the move bottom button with all its attributes
  941. $attributes
  942. = array(
  943. 'onclick' => "{$this->_jsPrefix}moveBottom".
  944. "(this.form.elements['".$selectNameTo."'], ".
  945. "this.form.elements['".$selectName."']); ".
  946. "return false;"
  947. );
  948. $this->_bottomButtonAttributes
  949. = array_merge($this->_bottomButtonAttributes, $attributes);
  950. $attrStrBottom = $this->_getAttrString($this->_bottomButtonAttributes);
  951. $strHtmlMoveBottom = "<input$attrStrBottom />".PHP_EOL;
  952. // default selection counters
  953. $strHtmlSelectedCount = $selected_count;
  954. }
  955. $strHtmlUnselectedCount = $unselected_count;
  956. $strHtmlSelectedCountId = $selectId.'_selected';
  957. $strHtmlUnselectedCountId = $selectId.'_unselected';
  958. // render all part of the multi select component with the template
  959. $strHtml = $this->_elementTemplate;
  960. // Prepare multiple labels
  961. $labels = $this->getLabel();
  962. if (is_array($labels)) {
  963. array_shift($labels);
  964. }
  965. // render extra labels, if any
  966. if (is_array($labels)) {
  967. foreach ($labels as $key => $text) {
  968. $key = is_int($key) ? $key + 2 : $key;
  969. $strHtml = str_replace("{label_{$key}}", $text, $strHtml);
  970. $strHtml = str_replace("<!-- BEGIN label_{$key} -->", '', $strHtml);
  971. $strHtml = str_replace("<!-- END label_{$key} -->", '', $strHtml);
  972. }
  973. }
  974. // clean up useless label tags
  975. if (strpos($strHtml, '{label_')) {
  976. $strHtml = preg_replace(
  977. '/\s*<!-- BEGIN label_(\S+) -->'.
  978. '.*<!-- END label_\1 -->\s*/i',
  979. '',
  980. $strHtml
  981. );
  982. }
  983. $placeHolders = array(
  984. '{stylesheet}',
  985. '{javascript}',
  986. '{class}',
  987. '{unselected_count_id}',
  988. '{selected_count_id}',
  989. '{unselected_count}',
  990. '{selected_count}',
  991. '{unselected}',
  992. '{selected}',
  993. '{add}',
  994. '{remove}',
  995. '{all}',
  996. '{none}',
  997. '{toggle}',
  998. '{moveup}',
  999. '{movedown}',
  1000. '{movetop}',
  1001. '{movebottom}'
  1002. );
  1003. $htmlElements = array(
  1004. $this->getElementCss(false),
  1005. $this->getElementJs(false),
  1006. $this->_tableAttributes,
  1007. $strHtmlUnselectedCountId,
  1008. $strHtmlSelectedCountId,
  1009. $strHtmlUnselectedCount,
  1010. $strHtmlSelectedCount,
  1011. $strHtmlUnselected,
  1012. $strHtmlSelected.$strHtmlHidden,
  1013. $strHtmlAdd,
  1014. $strHtmlRemove,
  1015. $strHtmlAll,
  1016. $strHtmlNone,
  1017. $strHtmlToggle,
  1018. $strHtmlMoveUp,
  1019. $strHtmlMoveDown,
  1020. $strHtmlMoveTop,
  1021. $strHtmlMoveBottom
  1022. );
  1023. $strHtml = str_replace($placeHolders, $htmlElements, $strHtml);
  1024. $comment = $this->getComment();
  1025. if (!empty($comment)) {
  1026. $strHtml = $tabs.'<!-- '.$comment." //-->".PHP_EOL.$strHtml;
  1027. }
  1028. return $strHtml;
  1029. }
  1030. /**
  1031. * Returns the javascript code generated to handle this element
  1032. *
  1033. * @param boolean $raw (optional) html output with script tags or just raw data
  1034. * @param boolean $min (optional) uses javascript compressed version
  1035. *
  1036. * @access public
  1037. * @return string
  1038. * @since version 0.4.0 (2005-06-25)
  1039. */
  1040. function getElementJs($raw = true, $min = true)
  1041. {
  1042. //$js = '@data_dir@'.DIRECTORY_SEPARATOR.'@package_name@'.DIRECTORY_SEPARATOR;
  1043. $js = api_get_path(SYS_LIBRARY_JS_PATH).'pear'.DIRECTORY_SEPARATOR;
  1044. if ($min) {
  1045. $js .= 'qfamsHandler-min.js';
  1046. } else {
  1047. $js .= 'qfamsHandler.js';
  1048. }
  1049. if (file_exists($js)) {
  1050. $js = file_get_contents($js);
  1051. } else {
  1052. $js = '';
  1053. }
  1054. if ($raw !== true) {
  1055. $js = '<script type="text/javascript">'
  1056. .PHP_EOL.'//<![CDATA['
  1057. .PHP_EOL.$js
  1058. .PHP_EOL.'//]]>'
  1059. .PHP_EOL.'</script>'
  1060. .PHP_EOL;
  1061. }
  1062. return $js;
  1063. }
  1064. /**
  1065. * Loads options from different types of data sources
  1066. *
  1067. * This method overloaded parent method of select element, to allow
  1068. * loading options with fancy attributes.
  1069. *
  1070. * @param mixed &$options Options source currently supports assoc array or DB_result
  1071. * @param mixed $param1 (optional) See function detail
  1072. * @param mixed $param2 (optional) See function detail
  1073. * @param mixed $param3 (optional) See function detail
  1074. * @param mixed $param4 (optional) See function detail
  1075. *
  1076. * @access public
  1077. * @since version 1.5.0 (2009-02-15)
  1078. * @return PEAR_Error|NULL on error and TRUE on success
  1079. * @throws PEAR_Error
  1080. * @see loadArray()
  1081. */
  1082. function load(
  1083. &$options,
  1084. $param1 = null,
  1085. $param2 = null,
  1086. $param3 = null,
  1087. $param4 = null
  1088. ) {
  1089. if (is_array($options)) {
  1090. $ret = $this->loadArray($options, $param1);
  1091. } else {
  1092. $ret = parent::load($options, $param1, $param2, $param3, $param4);
  1093. }
  1094. return $ret;
  1095. }
  1096. /**
  1097. * Loads the options from an associative array
  1098. *
  1099. * This method overloaded parent method of select element, to allow to load
  1100. * array of options with fancy attributes.
  1101. *
  1102. * @param array $arr Associative array of options
  1103. * @param mixed $values (optional) Array or comma delimited string of selected values
  1104. *
  1105. * @since version 1.5.0 (2009-02-15)
  1106. * @access public
  1107. * @return PEAR_Error on error and TRUE on success
  1108. * @throws PEAR_Error
  1109. * @see load()
  1110. */
  1111. function loadArray($arr, $values = null)
  1112. {
  1113. if (!is_array($arr)) {
  1114. return PEAR::throwError(
  1115. 'Argument 1 of HTML_QuickForm_advmultiselect::'.
  1116. 'loadArray is not a valid array',
  1117. HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
  1118. array('level' => 'exception')
  1119. );
  1120. }
  1121. if (isset($values)) {
  1122. $this->setSelected($values);
  1123. }
  1124. if (is_array($arr)) {
  1125. foreach ($arr as $key => $val) {
  1126. if (is_array($val)) {
  1127. $this->addOption($val[0], $key, $val[1]);
  1128. } else {
  1129. $this->addOption($val, $key);
  1130. }
  1131. }
  1132. }
  1133. return true;
  1134. }
  1135. /**
  1136. * Sets which items should be persistant
  1137. *
  1138. * Sets which items should have the disabled attribute
  1139. * to keep it persistant
  1140. *
  1141. * @param mixed $optionValues Options (key-values) that should be persistant
  1142. * @param bool $persistant (optional) TRUE if persistant, FALSE otherwise
  1143. *
  1144. * @since version 1.5.0 (2009-02-15)
  1145. * @access public
  1146. * @return PEAR_Error on error and TRUE on success
  1147. * @throws PEAR_Error
  1148. */
  1149. function setPersistantOptions($optionValues, $persistant = true)
  1150. {
  1151. if (!is_bool($persistant)) {
  1152. return PEAR::throwError(
  1153. 'Argument 2 of HTML_QuickForm_advmultiselect::'.
  1154. 'setPersistantOptions is not a boolean',
  1155. HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
  1156. array('level' => 'exception')
  1157. );
  1158. }
  1159. if (is_string($optionValues)) {
  1160. $optionValues = array($optionValues);
  1161. }
  1162. if (!is_array($optionValues)) {
  1163. return PEAR::throwError(
  1164. 'Argument 1 of HTML_QuickForm_advmultiselect::'.
  1165. 'setPersistantOptions is not a valid array',
  1166. HTML_QUICKFORM_ADVMULTISELECT_ERROR_INVALID_INPUT,
  1167. array('level' => 'exception')
  1168. );
  1169. }
  1170. foreach ($this->_options as $k => $v) {
  1171. if (in_array($v['attr']['value'], $optionValues)) {
  1172. if ($persistant) {
  1173. $this->_options[$k]['attr']['disabled'] = 'disabled';
  1174. } else {
  1175. unset($this->_options[$k]['attr']['disabled']);
  1176. }
  1177. }
  1178. }
  1179. return true;
  1180. }
  1181. /**
  1182. * Returns list of persistant options
  1183. *
  1184. * Returns list of persistant options (key-values) that could not
  1185. * be selected or unselected.
  1186. *
  1187. * @since version 1.5.0 (2009-02-15)
  1188. * @access public
  1189. * @return array
  1190. */
  1191. function getPersistantOptions()
  1192. {
  1193. $options = array();
  1194. foreach ($this->_options as $k => $v) {
  1195. if (isset($v['attr']['disabled'])) {
  1196. $options[] = $this->_options[$k]['attr']['value'];
  1197. }
  1198. }
  1199. return $options;
  1200. }
  1201. }
  1202. // @todo this fires an PHP notice, needed in order to parse the advmultiselect test it in main/group/group_edit.php
  1203. if (class_exists('HTML_QuickForm')) {
  1204. @HTML_QuickForm::registerElementType(
  1205. 'advmultiselect',
  1206. 'HTML/QuickForm/advmultiselect.php',
  1207. 'HTML_QuickForm_advmultiselect'
  1208. );
  1209. }