static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { if (in_array(get_class($item), array("AuthLDAP"))) { $AuthLDAP = new PluginMoreldapAuthLDAP(); if (!$AuthLDAP->getFromDB($item->fields['id'])) { //The directory exists in GLPI but there is no data in the plugin $AuthLDAP->preconfig(); } $location_enabled = $AuthLDAP->fields['location_enabled'] == 'Y' ? ' checked' : ''; echo '<div class="spaced">'; echo '<form id="items" name="items" method="post" action="' . Toolbox::getItemTypeFormURL(__CLASS__) . '">'; echo '<table class="tab_cadre_fixehov">'; echo '<tr class="tab_bg_2">'; echo '<th colspan="2">' . __("MoreLDAP", "moreldap") . '</th>'; echo '</tr>'; echo '<tr class="tab_bg_1">'; echo '<td>' . __("LDAP attribute : location of users", "moreldap") . '</td>'; echo '<td>' . __("Enabled", "moreldap") . ' <input type="checkbox" name="location_enabled"' . $location_enabled . ' value="location_enabled"><br />'; echo '<input size="72" type="text" name="location" value="' . $AuthLDAP->fields['location'] . '"> '; echo '<br />'; Entity::dropdown(array('value' => $AuthLDAP->fields['entities_id'])); echo ' ' . __("recursive", "moreldap") . " "; Dropdown::showYesNo('is_recursive', $AuthLDAP->fields['is_recursive']); echo ' </td>'; echo '</tr>'; echo '<tr class="tab_bg_1">'; echo '<td colspan="2" class="center">'; echo '<input type="hidden" value="' . $item->fields['id'] . '" name="id">'; echo '<input type="submit" class="submit" name="update" value="' . _sx('button', 'Save') . '">'; echo '</td>'; echo '</tr>'; echo '</table>'; Html::closeForm(); echo "</div>"; } return true; }
You should have received a copy of the GNU General Public License along with MoreLDAP plugin; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ------------------------------------------------------------------------ @package MoreLDAP @author the MoreLDAP plugin team @copyright Copyright (c) 2014-2014 MoreLDAP plugin team @license GPLv2+ http://www.gnu.org/licenses/gpl.txt @link https://forge.indepnet.net/projects/moreldap @link http://www.glpi-project.org/ @since 2014 ------------------------------------------------------------------------ */ define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; Session::checkRight("config", "w"); $AuthLDAP = new PluginMoreldapAuthLDAP(); if (isset($_POST["update"])) { $_POST['id'] = Toolbox::cleanInteger($_POST['id']); $_POST['location_enabled'] = isset($_POST['location_enabled']) ? "Y" : "N"; $_POST['location'] = html_entity_decode($_POST['location']); if ($AuthLDAP->getFromDB($_POST['id']) == false) { //The directory exists in GLPI but there is no data in the plugin $AuthLDAP->add($_POST); } else { $AuthLDAP->update($_POST); } } Html::back();