コード例 #1
0
 public static function insertServer($id, $givenParameters)
 {
     $auth_servers = $givenParameters['auth_server'];
     AuthResourcesServersRepository::deleteAllForArId($id);
     $cnt = 0;
     //print_r($auth_servers);
     //die;
     foreach ($auth_servers as $key => $auth_server) {
         if (!empty($auth_server['server_address'])) {
             $use_ssl = 0;
             if (!empty($auth_server['use_ssl'])) {
                 $use_ssl = 1;
             }
             $use_tls = 0;
             if (!empty($auth_server['use_tls'])) {
                 $use_tls = 1;
             }
             $server_port = null;
             if (isset($auth_server['server_port'])) {
                 $server_port = $auth_server['server_port'];
             }
             $server_address = null;
             if (isset($auth_server['server_address'])) {
                 $server_address = $auth_server['server_address'];
             }
             try {
                 AuthResourcesServersRepository::create(array('auth_resource_id' => $id, 'server_address' => $server_address, 'server_port' => $server_port, 'use_ssl' => $use_ssl, 'use_tls' => $use_tls, 'server_order' => $cnt), "", "", false);
             } catch (\Exception $e) {
                 //parent::delete(array($id));
                 throw $e;
             }
             $cnt = $cnt + 1;
         }
     }
 }
コード例 #2
0
 public static function renderHtmlInput(array $element)
 {
     if (!isset($element['html'])) {
         $element['html'] = '';
     }
     if (!isset($element['placeholder']) || isset($element['placeholder']) && empty($element['placeholder'])) {
         $element['placeholder'] = $element['label_label'];
     }
     if (!isset($element['id']) || isset($element['id']) && empty($element['id'])) {
         $element['id'] = $element['name'];
     }
     $authServers = AuthResourcesServersRepository::getList($fields = '*', $count = -1, $offset = 0, $order = "server_order", $sort = 'asc', $filters = array('auth_resource_id' => $element['label_extra']['id']));
     $tpl = Di::getDefault()->get('template');
     $tpl->addJs('centreon-clone.js')->addJs('component/authserver.js');
     $tpl->assign('authServers', $authServers);
     return array('html' => $tpl->fetch('file:[Core]/form/component/authserver.tpl'));
 }