*/ class LSformElement_ssh_key extends LSformElement { var $template = 'LSformElement_ssh_key.tpl'; var $fieldTemplate = 'LSformElement_ssh_key_field.tpl'; /** * Retourne les infos d'affichage de l'élément * * Cette méthode retourne les informations d'affichage de l'élement * * @retval array */ public function getDisplay(){ LStemplate :: addCssFile('LSformElement_ssh_key.css'); $return = $this -> getLabelInfos(); $params = array(); if (!$this -> isFreeze()) { $params['values_txt'] = $this -> values; } else { LStemplate :: addJSscript('LSformElement_ssh_key.js'); LSsession :: addHelpInfos ( 'LSformElement_ssh_key', array( 'display' => _("Display the full key.") ) ); $values_txt = array(); foreach ($this -> values as $value) { if (preg_match('/^ssh-([a-z0-9]+) +([^ ]+) +(.*)$/',$value,$regs)) { $values_txt[] = array( 'type' => $regs[1], 'shortTxt' => substr($regs[2],0,10), 'mail' => $regs[3], 'value' => $value ); } else { $values_txt[] = array( 'shortTxt' => substr($value,0,15), 'value' => $value ); } } $params['values_txt'] = $values_txt; $params['unknowTypeTxt'] = _('Unknown type'); } $return['html'] = $this -> fetchTemplate(NULL,$params); return $return; } }