/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { $profile = new Profile(); echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); if ($profile->getField('interface') == 'central') { $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General'))); } echo "<table class='tab_cadre_fixehov'>"; echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Helpdesk') . "</th></tr>\n"; $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_racks_open_ticket')); echo "<tr class='tab_bg_2'>"; echo "<td width='20%'>" . __('Associable items to a ticket') . "</td>"; echo "<td colspan='5'>"; Html::showCheckbox(array('name' => '_plugin_racks_open_ticket', 'checked' => $effective_rights['plugin_racks_open_ticket'])); echo "</td></tr>\n"; echo "</table>"; if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { $profile = new Profile(); echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); $rights = array(array('itemtype' => 'PluginAddressingAddressing', 'label' => __('Generate reports', 'addressing'), 'field' => 'plugin_addressing')); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General'))); echo "<table class='tab_cadre_fixehov'>"; $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_addressing_use_ping_in_equipment')); echo "<tr class='tab_bg_2'>"; echo "<td width='20%'>" . __('Use ping on equipment form', 'addressing') . "</td>"; echo "<td colspan='5'>"; Html::showCheckbox(array('name' => '_plugin_addressing_use_ping_in_equipment[1_0]', 'checked' => $effective_rights['plugin_addressing_use_ping_in_equipment'])); echo "</td></tr>\n"; echo "</table>"; if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
function showForm($ID, $options = array()) { global $LANG; if (!Profile::canView()) { return false; } $canedit = self::canUpdate(); $profile = new Profile(); if ($ID) { //$this->getFromDBByProfile($ID); $profile->getFromDB($ID); } if ($canedit) { echo "<form action='" . $profile->getFormURL() . "' method='post'>"; } $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2')); if ($canedit) { echo "<div class='center'>"; echo "<input type='hidden' name='id' value=" . $ID . ">"; echo "<input type='submit' name='update' value=\"" . _sx('button', 'Save') . "\" class='submit'>"; echo "</div>"; } Html::closeForm(); $this->showLegend(); }
/** * @param $prof Profile object **/ static function showForProfile(Profile $prof) { global $DB; $canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE)); if ($canedit) { echo "<form method='post' action='" . $prof->getFormURL() . "'>"; } $rights = self::getAllRights(); $prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Rights management by profil', 'reports'))); if ($canedit) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $prof->getField('id'))); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { $profile = new Profile(); echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile->getFromDB($profiles_id); $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Reforme', 'reforme'))); if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; echo Html::closeForm(false); } echo "</div>"; }
function showForm($ID, $options = array()) { global $DB; $profile = new Profile(); if ($ID) { $this->getFromDB($ID); $profile->getFromDB($ID); } else { $this->getEmpty(); } if ($canedit = self::canUpdate()) { $options['colspan'] = 1; $options['target'] = $profile->getFormURL(); $this->fields["id"] = $ID; $this->showFormHeader($options); } $rights = $this->getGeneralRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2')); if ($canedit) { $options['candel'] = false; $this->showFormButtons($options); } }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { $profile = new Profile(); echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); $rights = $this->getRightsGeneral(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General', 'fusioninventory'))); $rights = $this->getRightsRules(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => _n('Rule', 'Rules', 2))); $rights = $this->getRightsInventory(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Inventory', 'fusioninventory'))); $rights = $this->getRightsDeploy(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('Software deployment', 'fusioninventory'))); if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; $this->showLegend(); }
public function showForm($profiles_id, $options = array()) { global $LANG; $profile = new Profile(); $profile->getFromDB($profiles_id); if ($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) { echo "<form action='" . $profile->getFormURL() . "' method='post'>"; } $profile = new Profile(); $profile->getFromDB($profiles_id); $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => $LANG['plugin_news']['title'])); if ($canedit) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } HTML::closeForm(); }
/** * Show profile form * * @param $items_id integer id of the profile * @param $target value url of target * * @return nothing **/ function showForm($profiles_id = 0, $openform = TRUE, $closeform = TRUE) { global $DB, $CFG_GLPI; $profile = new Profile(); $profile->getFromDB($profiles_id); echo "<div class='firstbloc'>"; if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { echo "<form action='" . $CFG_GLPI['root_doc'] . "/plugins/ocsinventoryng/front/profile.form.php' method='post'>"; } //Delegating $effective_rights = ProfileRight::getProfileRights($profiles_id, array('plugin_ocsinventoryng')); echo "<table class='tab_cadre_fixehov'>"; echo "<tr><th colspan='4' class='center b'>" . sprintf(__('%1$s - %2$s'), 'OcsinventoryNG', $profile->fields["name"]) . "</th>"; echo "</tr>"; $used = array(); echo "<tr class='tab_bg_1'>"; echo "<td>" . sprintf(__('%1$s : %2$s'), _n('Allowed OCSNG server', 'Allowed OCSNG servers', 2, 'ocsinventoryng'), " "); //$profile = $this->fields['id']; $crit = array('profiles_id' => $profiles_id); foreach ($DB->request("glpi_plugin_ocsinventoryng_ocsservers_profiles", $crit) as $data) { $used[$data['plugin_ocsinventoryng_ocsservers_id']] = $data['plugin_ocsinventoryng_ocsservers_id']; $configid[$data['plugin_ocsinventoryng_ocsservers_id']] = $data['id']; } if (Session::haveRight("profile", UPDATE)) { Dropdown::show('PluginOcsinventoryngOcsServer', array('width' => '50%', 'used' => $used, 'value' => '', 'condition' => "is_active = 1")); echo " <input type='hidden' name='profile' value='{$profiles_id}'>"; echo " <input type='submit' name='addocsserver' value=\"" . _sx('button', 'Add') . "\" class='submit' >"; } echo "</td><td>"; echo "<table width='100%'><tr class='tab_bg_1'><td>"; $nbservers = countElementsInTable('glpi_plugin_ocsinventoryng_ocsservers_profiles', "`profiles_id` = " . $profiles_id); $query = "SELECT `glpi_plugin_ocsinventoryng_ocsservers`.`id`,\n `glpi_plugin_ocsinventoryng_ocsservers`.`name`\n FROM `glpi_plugin_ocsinventoryng_ocsservers_profiles`\n LEFT JOIN `glpi_plugin_ocsinventoryng_ocsservers`\n ON `glpi_plugin_ocsinventoryng_ocsservers_profiles`.`plugin_ocsinventoryng_ocsservers_id` = `glpi_plugin_ocsinventoryng_ocsservers`.`id`\n WHERE `profiles_id`= " . $_SESSION["glpiactiveprofile"]['id'] . "\n ORDER BY `name` ASC"; $result = $DB->query($query); if ($data = $DB->fetch_assoc($result)) { $ocsserver = new PluginOcsinventoryngOcsServer(); foreach ($used as $id) { if ($ocsserver->getFromDB($id)) { echo "<br>"; if (Session::haveRight("profile", UPDATE)) { echo "<input type='checkbox' name='item[" . $configid[$id] . "]' value='1'>"; } if ($data['id'] == $id) { echo $ocsserver->getLink(); } else { echo $ocsserver->getName(); } } } } if (!$nbservers) { _e('None'); } echo "</td></tr>"; if ($nbservers && Session::haveRight("profile", UPDATE)) { echo "<tr class='tab_bg_1 center'><td>"; echo "<input type='submit' name='delete' value='Supprimer' class='submit' >"; echo "</td></tr>"; } echo "</table>"; echo "</td></tr>"; echo "</table>"; Html::closeForm(); if (($canedit = Session::haveRightsOr(self::$rightname, array(CREATE, UPDATE, PURGE))) && $openform) { echo "<form method='post' action='" . $profile->getFormURL() . "'>"; } $rights = $this->getAllRights(); $profile->displayRightsChoiceMatrix($rights, array('canedit' => $canedit, 'default_class' => 'tab_bg_2', 'title' => __('General'))); if ($canedit && $closeform) { echo "<div class='center'>"; echo Html::hidden('id', array('value' => $profiles_id)); echo Html::submit(_sx('button', 'Save'), array('name' => 'update')); echo "</div>\n"; Html::closeForm(); } echo "</div>"; }