private_public.php 2.74 KB
Newer Older
moyooo's avatar
moyooo committed
1
<?php
2 3 4
/**
 * ---------------------------------------------------------------------
 * GLPI - Gestionnaire Libre de Parc Informatique
5
 * Copyright (C) 2015-2018 Teclib' and contributors.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
 *
 * http://glpi-project.org
 *
 * based on GLPI - Gestionnaire Libre de Parc Informatique
 * Copyright (C) 2003-2014 by the INDEPNET Development Team.
 *
 * ---------------------------------------------------------------------
 *
 * LICENSE
 *
 * This file is part of GLPI.
 *
 * GLPI is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * GLPI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with GLPI. If not, see <http://www.gnu.org/licenses/>.
 * ---------------------------------------------------------------------
moyooo's avatar
moyooo committed
31 32
 */

33
if (strpos($_SERVER['PHP_SELF'], "private_public.php")) {
34
   include ('../inc/includes.php');
remi's avatar
remi committed
35
   header("Content-Type: text/html; charset=UTF-8");
yllen's avatar
yllen committed
36
   Html::header_nocache();
yllen's avatar
yllen committed
37 38
} else if (!defined('GLPI_ROOT')) {
   die("Sorry. You can't access this file directly");
remi's avatar
remi committed
39
}
moyooo's avatar
moyooo committed
40

remi's avatar
remi committed
41
if (isset($_POST['is_private'])) {
42
   Session::checkLoginUser();
yllen's avatar
yllen committed
43

remi's avatar
remi committed
44 45 46
   switch ($_POST['is_private']) {
      case true :
         echo "<input type='hidden' name='is_private' value='1'>\n";
Johan Cwiklinski's avatar
Johan Cwiklinski committed
47
         echo "<input type='hidden' name='entities_id' value='0'>\n";
remi's avatar
remi committed
48
         echo "<input type='hidden' name='is_recursive' value='0'>\n";
yllen's avatar
yllen committed
49
         $private =  __('Personal');
Johan Cwiklinski's avatar
Johan Cwiklinski committed
50
         $link    = "<a href='#' onClick='setPublic".$_POST['rand']."();return false;'>".__('Set public')."</a>";
yllen's avatar
yllen committed
51
         printf(__('%1$s - %2$s'), $private, $link);
remi's avatar
remi committed
52
         break;
moyooo's avatar
moyooo committed
53

remi's avatar
remi committed
54
      case false :
55 56 57 58 59 60
         if (isset($_POST['entities_id'])
             && in_array($_POST['entities_id'], $_SESSION['glpiactiveentities'])) {
            $val = $_POST['entities_id'];
         } else {
            $val = $_SESSION['glpiactive_entity'];
         }
moyooo's avatar
moyooo committed
61 62
         echo "<table width='100%'>";
         echo "<tr><td>";
remi's avatar
remi committed
63
         echo "<input type='hidden' name='is_private' value='0'>\n";
64
         echo __('Public');
moyooo's avatar
moyooo committed
65
         echo "</td><td>";
66
         Entity::dropdown(['value' => $val]);
moyooo's avatar
moyooo committed
67
         echo "</td><td>". __('Child entities')."</td><td>";
yllen's avatar
yllen committed
68
         Dropdown::showYesNo('is_recursive', $_POST["is_recursive"]);
moyooo's avatar
moyooo committed
69
         echo "</td><td>";
Johan Cwiklinski's avatar
Johan Cwiklinski committed
70
         echo "<a href='#' onClick='setPrivate".$_POST['rand']."();return false'>".__('Set personal')."</a>";
moyooo's avatar
moyooo committed
71
         echo "</td></tr></table>";
remi's avatar
remi committed
72 73 74
         break;
   }
}