@@ -73,11 +73,15 @@ public function handle(&$values, &$extras)
7373
7474 // Informazioni aggiuntive per il select
7575 $ infos = $ values ['select-options ' ] ?? [];
76+ // Aggiunta dell'informazione del link alle opzioni per le chiamate AJAX
77+ if (!empty ($ values ['link ' ])) {
78+ $ infos ['link ' ] = $ values ['link ' ];
79+ }
7680 $ values ['data-select-options ' ] = json_encode ($ infos );
7781 unset($ values ['select-options ' ]);
7882
7983 if (!empty ($ values ['value ' ]) || is_numeric ($ values ['value ' ])) {
80- $ result .= $ this ->select2 ($ source , $ values ['value ' ], $ infos, $ values [ ' link ' ] );
84+ $ result .= $ this ->select2 ($ source , $ values ['value ' ], $ infos );
8185 }
8286 } else {
8387 if (!in_array ('multiple ' , $ extras )) {
@@ -142,7 +146,7 @@ public function handle(&$values, &$extras)
142146 *
143147 * @return string
144148 */
145- protected function select2 ($ op , $ elements , $ info, $ link = null )
149+ protected function select2 ($ op , $ elements , $ info )
146150 {
147151 // Richiamo del file dedicato alle richieste AJAX per ottenere il valore iniziale del select
148152 $ response = \AJAX ::select ($ op , $ elements , null , 0 , 100 , $ info );
@@ -160,14 +164,6 @@ protected function select2($op, $elements, $info, $link = null)
160164 $ attributes [] = 'selected ' ;
161165 }
162166
163- if ($ link == 'stampa ' ) {
164- $ element ['title ' ] = ' ' ;
165- $ element ['text ' ] = '<a href=" ' .\Prints::getHref ($ element ['id ' ], get ('id_record ' )).'" class="text-black" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
166- } elseif ($ link == 'allegato ' ) {
167- $ element ['title ' ] = ' ' ;
168- $ element ['text ' ] = '<a href=" ' .base_path ().'/view.php?file_id= ' .$ element ['id ' ].'" class="text-black" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
169- }
170-
171167 if (!empty ($ element ['_bgcolor_ ' ])) {
172168 $ attributes [] = 'style="background: ' .$ element ['_bgcolor_ ' ].'; color: ' .color_inverse ($ element ['_bgcolor_ ' ]).'" ' ;
173169 }
@@ -209,10 +205,16 @@ protected function selectArray($array, $values, $link = null)
209205
210206 if ($ link == 'stampa ' ) {
211207 $ element ['title ' ] = ' ' ;
212- $ element ['text ' ] = '<a href=" ' .\Prints::getHref ($ element ['id ' ], get ('id_record ' )).'" class="text-black" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
208+ $ element ['text ' ] = '<a href=" ' .\Prints::getHref ($ element ['id ' ], get ('id_record ' )).'" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
213209 } elseif ($ link == 'allegato ' ) {
214210 $ element ['title ' ] = ' ' ;
215- $ element ['text ' ] = '<a href=" ' .base_path ().'/view.php?file_id= ' .$ element ['id ' ].'" class="text-black" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
211+ $ element ['text ' ] = '<a href=" ' .base_path ().'/view.php?file_id= ' .$ element ['id ' ].'" target="_blank"> ' .$ element ['text ' ].' <i class="fa fa-external-link"></i></a> ' ;
212+ } elseif (string_contains ($ link , 'module: ' )) {
213+ $ element ['title ' ] = ' ' ;
214+ $ element ['text ' ] = \Modules::link (str_replace ('module: ' , '' , $ link ), $ element ['id ' ], $ element ['text ' ], false , ' target="_blank" ' );
215+ } elseif (string_contains ($ link , 'plugin: ' )) {
216+ $ element ['title ' ] = ' ' ;
217+ $ element ['text ' ] = \Plugins::link (str_replace ('plugin: ' , '' , $ link ), $ element ['id ' ], $ element ['text ' ], false , ' target="_blank" ' );
216218 }
217219
218220 $ attributes = [];
0 commit comments