Пример #1
0
 /**
  * {@inhericDoc}
  * @see \MyArtJaub\Webtrees\Hook\HookInterfaces\CustomSimpleTagManagerInterface::hHtmlSimpleTagEditor()
  */
 public function hHtmlSimpleTagEditor($tag, $value = null, $element_id = '', $element_name = '', $context = null, $contextid = null)
 {
     global $controller, $WT_TREE;
     $html = '';
     switch ($tag) {
         case '_ACT':
             $element_id = Uuid::uuid4();
             $controller->addExternalJavascript(WT_AUTOCOMPLETE_JS_URL)->addExternalJavascript(WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/autocomplete.js')->addExternalJavascript(WT_STATIC_URL . WT_MODULES_DIR . $this->getName() . '/js/updatecertificatevalues.js');
             $certificate = null;
             if ($value) {
                 $certificate = new Certificate($value, $WT_TREE, $this->getProvider());
             }
             $tabCities = $this->getProvider()->getCitiesList();
             $html .= '<select id="certifCity' . $element_id . '" class="_CITY">';
             foreach ($tabCities as $cities) {
                 $selectedCity = '';
                 if ($certificate && $cities == $certificate->getCity()) {
                     $selectedCity = 'selected="true"';
                 }
                 $html .= '<option value="' . $cities . '" ' . $selectedCity . ' />' . $cities . '</option>';
             }
             $html .= '</select>';
             $html .= '<input id="certifFile' . $element_id . '" autocomplete="off" class="_ACT" value="' . ($certificate ? basename($certificate->getFilename()) : '') . '" size="35" />';
             $html .= '<input type="hidden" id="' . $element_id . '" name = "' . $element_name . '" value="' . $value . '" size="35"/>';
     }
     return $html;
 }