Example #1
0
 function showForm($id)
 {
     if (!Session::haveRight("profile", "r")) {
         return false;
     }
     $canedit = Session::haveRight("profile", "w");
     if ($id) {
         $this->getProfilesFromDB($id);
     }
     $general_profile = new Profile();
     $general_profile->getFromDB($id);
     echo "<form action='" . $this->getSearchURL() . "' method='post'>";
     echo "<table class='tab_cadre_fixe'>";
     $types = PluginGenericobjectType::getTypes(true);
     if (!empty($types)) {
         echo "<tr><th colspan='2' align='center'><strong>";
         echo __("Rights assignment") . "</strong></th></tr>";
         foreach ($types as $tmp => $type) {
             $itemtype = $type['itemtype'];
             $objecttype = new PluginGenericobjectType($itemtype);
             $profile = self::getProfileforItemtype($id, $itemtype);
             echo "<tr><th align='center' colspan='2' class='tab_bg_2'>" . $itemtype::getTypeName() . "</th></tr>";
             if ($general_profile->fields['interface'] == 'central') {
                 echo "<tr class='tab_bg_2'>";
                 $right = $type['itemtype'];
                 echo "<td>" . __("Access object", "genericobject") . ":</td><td>";
                 Profile::dropdownNoneReadWrite($right, $profile['right'], 1, 1, 1);
                 echo "</td></tr>";
             }
             if ($objecttype->canUseTickets()) {
                 echo "<tr class='tab_bg_2'>";
                 echo "<td>" . __("Associate tickets to this object", "genericobject") . ":</td><td>";
                 $right_openticket = $type['itemtype'] . "_open_ticket";
                 Dropdown::showYesNo($right_openticket, $profile['open_ticket']);
                 echo "</td></tr>";
             }
         }
         if ($canedit) {
             echo "<tr class='tab_bg_1'>";
             echo "<td align='center' colspan='2'>";
             echo "<input type='hidden' name='profiles_id' value='" . $id . "'>";
             echo "<input type='hidden' name='id' value={$id}>";
             echo "<input type='submit' name='update_user_profile' value=\"" . _sx('button', 'Post') . "\" class='submit'>";
             echo "</td></tr>";
         }
     } else {
         echo "<tr><td class='center'><strong>";
         echo __("No type defined", "genericobject") . "</strong></td></tr>";
     }
     echo "</table>";
     Html::closeForm();
 }