private_public.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  * @version $Id: private_public.php 20129 2013-02-04 16:53:59Z moyo $
00004  -------------------------------------------------------------------------
00005  GLPI - Gestionnaire Libre de Parc Informatique
00006  Copyright (C) 2003-2013 by the INDEPNET Development Team.
00007 
00008  http://indepnet.net/   http://glpi-project.org
00009  -------------------------------------------------------------------------
00010 
00011  LICENSE
00012 
00013  This file is part of GLPI.
00014 
00015  GLPI is free software; you can redistribute it and/or modify
00016  it under the terms of the GNU General Public License as published by
00017  the Free Software Foundation; either version 2 of the License, or
00018  (at your option) any later version.
00019 
00020  GLPI is distributed in the hope that it will be useful,
00021  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023  GNU General Public License for more details.
00024 
00025  You should have received a copy of the GNU General Public License
00026  along with GLPI. If not, see <http://www.gnu.org/licenses/>.
00027  --------------------------------------------------------------------------
00028  */
00029 
00030 /** @file
00031 * @brief
00032 */
00033 
00034 if (strpos($_SERVER['PHP_SELF'],"private_public.php")) {
00035    include ('../inc/includes.php');
00036    header("Content-Type: text/html; charset=UTF-8");
00037    Html::header_nocache();
00038 }
00039 
00040 if (!defined('GLPI_ROOT')) {
00041    die("Can not acces directly to this file");
00042 }
00043 
00044 if (isset($_POST['is_private'])) {
00045    Session::checkLoginUser();
00046 
00047    switch ($_POST['is_private']) {
00048       case true :
00049          echo "<input type='hidden' name='is_private' value='1'>\n";
00050          echo "<input type='hidden' name='entities_id' value='-1'>\n";
00051          echo "<input type='hidden' name='is_recursive' value='0'>\n";
00052          $private =  __('Personal');
00053          $link    = "<a onClick='setPublic".$_POST['rand']."()'>".__('Set public')."</a>";
00054          printf(__('%1$s - %2$s'), $private, $link);
00055          break;
00056 
00057       case false :
00058          if (isset($_POST['entities_id'])
00059              && in_array($_POST['entities_id'], $_SESSION['glpiactiveentities'])) {
00060             $val = $_POST['entities_id'];
00061          } else {
00062             $val = $_SESSION['glpiactive_entity'];
00063          }
00064          echo "<input type='hidden' name='is_private' value='0'>\n";
00065          echo __('Public')."&nbsp;";
00066          Entity::dropdown(array('value' => $val));
00067          echo "&nbsp;";
00068          _e('Child entities');
00069          echo "&nbsp;";
00070          Dropdown::showYesNo('is_recursive', $_POST["is_recursive"]);
00071          echo "&nbsp;<a onClick='setPrivate".$_POST['rand']."()'>".__('Set personal')."</a>";
00072          break;
00073    }
00074 }
00075 ?>