Ejemplo n.º 1
0
 /**
  * @throws CMbException
  * @return CSourceLDAP
  */
 static function connect()
 {
     $source_ldap = new CSourceLDAP();
     /** @var CSourceLDAP[] $sources_ldap */
     $sources_ldap = $source_ldap->loadList(null, "priority DESC");
     if (empty($sources_ldap)) {
         throw new CMbException("CSourceLDAP_undefined");
     }
     foreach ($sources_ldap as $_source) {
         try {
             $ldapconn = $_source->ldap_connect();
             $_source->_ldapconn = $ldapconn;
             return $_source;
         } catch (CMbException $e) {
             CAppUI::setMsg($e->getMessage(), UI_MSG_WARNING);
         }
     }
     return false;
 }
Ejemplo n.º 2
0
<?php

/**
 * $Id: ajax_refresh_source_ldap.php 18997 2013-05-02 09:24:16Z rhum1 $
 *
 * @category Admin
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 18997 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkAdmin();
$source_ldap = new CSourceLDAP();
$sources_ldap = $source_ldap->loadList(null, "priority DESC");
$sources_ldap[] = $source_ldap;
// to create a new one
// Création du template
$smarty = new CSmartyDP();
$smarty->assign("sources_ldap", $sources_ldap);
$smarty->display("inc_sources_ldap.tpl");