本文整理汇总了PHP中Dropdown::showPrivatePublicSwitch方法的典型用法代码示例。如果您正苦于以下问题:PHP Dropdown::showPrivatePublicSwitch方法的具体用法?PHP Dropdown::showPrivatePublicSwitch怎么用?PHP Dropdown::showPrivatePublicSwitch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dropdown
的用法示例。
在下文中一共展示了Dropdown::showPrivatePublicSwitch方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForm
/**
* Print the bookmark form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - type bookmark type when adding a new bookmark
* - url when adding a new bookmark
* - itemtype when adding a new bookmark
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI;
$ID = $this->fields['id'];
// Only an edit form : always check w right
if ($ID > 0) {
$this->check($ID, UPDATE);
} else {
$this->check(-1, CREATE);
}
echo '<br>';
echo "<form method='post' name='form_save_query' action='" . $_SERVER['PHP_SELF'] . "'>";
echo "<div class='center'>";
if (isset($options['itemtype'])) {
echo "<input type='hidden' name='itemtype' value='" . $options['itemtype'] . "'>";
}
if (isset($options['type']) && $options['type'] != 0) {
echo "<input type='hidden' name='type' value='" . $options['type'] . "'>";
}
if (isset($options['url'])) {
echo "<input type='hidden' name='url' value='" . rawurlencode($options['url']) . "'>";
}
echo "<table class='tab_cadre' width='" . self::WIDTH . "px'>";
echo "<tr><th> </th><th>";
if ($ID > 0) {
//TRANS: %1$s is the Itemtype name and $2$d the ID of the item
printf(__('%1$s - ID %2$d'), $this->getTypeName(1), $ID);
} else {
_e('New item');
}
echo "</th></tr>";
echo "<tr><td class='tab_bg_1'>" . __('Name') . "</td>";
echo "<td class='tab_bg_1'>";
Html::autocompletionTextField($this, "name", array('user' => $this->fields["users_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . __('Type') . "</td>";
echo "<td>";
if (static::canCreate()) {
Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]);
} else {
if ($this->fields["is_private"]) {
_e('Private');
} else {
_e('Public');
}
}
echo "</td></tr>";
if ($ID <= 0) {
// add
echo "<tr>";
echo "<td class='tab_bg_2 top' colspan='2'>";
echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>";
echo "<div class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</div></td></tr>";
} else {
echo "<tr>";
echo "<td class='tab_bg_2 top' colspan='2'>";
echo "<input type='hidden' name='id' value='{$ID}'>";
echo "<input type='submit' name='update' value=\"" . __s('Save') . "\" class='submit'>";
echo "</td></tr><tr><td class='tab_bg_2 right' colspan='2'>";
echo "<input type='submit' name='purge' value=\"" . _sx('button', 'Delete permanently') . "\"\n class='submit'>";
echo "</td></tr>";
}
echo "</table></div>";
Html::closeForm();
}
示例2: showForm
/**
* Print the bookmark form
*
* @param $ID integer ID of the item
* @param $options array
* - target for the Form
* - type bookmark type when adding a new bookmark
* - url when adding a new bookmark
* - itemtype when adding a new bookmark
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
$ID = $this->fields['id'];
// Only an edit form : always check w right
if ($ID > 0) {
$this->check($ID, 'w');
} else {
$this->check(-1, 'w');
}
echo '<br>';
echo "<form method='post' name='form_save_query' action='" . $CFG_GLPI['root_doc'] . "/front/popup.php'>";
echo "<div class='center'>";
if (isset($options['itemtype'])) {
echo "<input type='hidden' name='itemtype' value='" . $options['itemtype'] . "'>";
}
if (isset($options['type']) && $options['type'] != 0) {
echo "<input type='hidden' name='type' value='" . $options['type'] . "'>";
}
if (isset($options['url'])) {
echo "<input type='hidden' name='url' value='" . rawurlencode($options['url']) . "'>";
}
echo "<table class='tab_cadre_report' width='" . self::WIDTH . "px'>";
echo "<tr><th> </th><th>";
if ($ID > 0) {
echo $LANG['bookmark'][1] . " - " . $LANG['common'][2] . " {$ID}";
} else {
echo $LANG['bookmark'][4];
}
echo "</th></tr>";
echo "<tr><td class='tab_bg_1'>" . $LANG['common'][16] . " :</td>";
echo "<td class='tab_bg_1'>";
autocompletionTextField($this, "name", array('user' => $this->fields["users_id"]));
echo "</td></tr>";
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][17] . " :</td>";
echo "<td>";
if (haveRight("bookmark_public", "w")) {
Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]);
} else {
if ($this->fields["is_private"]) {
echo $LANG['common'][77];
} else {
echo $LANG['common'][76];
}
}
echo "</td></tr>";
if ($ID <= 0) {
// add
echo "<tr>";
echo "<td class='tab_bg_2 top' colspan='2'>";
echo "<input type='hidden' name='users_id' value='" . $this->fields['users_id'] . "'>";
echo "<div class='center'>";
echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
echo "</div></td></tr>";
} else {
echo "<tr>";
echo "<td class='tab_bg_2 top' colspan='2'>";
echo "<input type='hidden' name='id' value='{$ID}'>";
echo "<div class='center'>";
echo "<input type='submit' name='update' value=\"" . $LANG['buttons'][7] . "\" class='submit'>";
echo "<input type='hidden' name='id' value='{$ID}'>";
echo "<input type='submit' name='delete' value=\"" . $LANG['buttons'][6] . "\" class='submit'>";
echo "</div></td></tr>";
}
echo "</table></div></form>";
}
示例3: showAdvancedForm
function showAdvancedForm($ID, $options = array())
{
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$this->check(-1, UPDATE);
$this->getEmpty();
echo Html::hidden('step', array('value' => 1));
}
echo "<form name='form' method='post' action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<div class='center' id='tabsbody'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th colspan='2'>" . self::getTypeName() . "</th>";
echo "<th colspan='2'>" . PluginDatainjectionDropdown::getStatusLabel($this->fields['step']) . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td><input type='hidden' name='users_id' value='" . Session::getLoginUserID() . "'>" . __('Name') . "</td>";
echo "<td>";
Html::autocompletionTextField($this, "name");
echo "</td>";
echo "<td colspan='2'></td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td colspan='4' class='center'>";
Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Comments') . "</td>";
echo "<td colspan='3' class='middle'>";
echo "<textarea cols='45' rows='5' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Type of datas to import', 'datainjection') . "</td>";
echo "<td>";
if ($this->fields['step'] == '' || $this->fields['step'] == self::INITIAL_STEP) {
//Get only the primary types
PluginDatainjectionInjectionType::dropdown($this->fields['itemtype'], true);
} else {
$itemtype = new $this->fields['itemtype']();
echo $itemtype->getTypeName();
}
echo "</td><td colspan='2'></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Allow lines creation', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showYesNo("behavior_add", $this->fields['behavior_add']);
echo "</td><td>" . __('Allow lines update', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showYesNo("behavior_update", $this->fields['behavior_update']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'><th colspan='4'>" . __('Advanced options', 'datainjection') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Allow creation of dropdowns', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showYesNo("can_add_dropdown", $this->fields['can_add_dropdown']);
echo "</td>";
echo "<td>" . __('Dates format', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showFromArray('date_format', PluginDatainjectionDropdown::dateFormats(), array('value' => $this->fields['date_format']));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Allow update of existing fields', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showYesNo("can_overwrite_if_not_empty", $this->fields['can_overwrite_if_not_empty']);
echo "</td>";
echo "<td>" . __('Float format', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showFromArray('float_format', PluginDatainjectionDropdown::floatFormats(), array('value' => $this->fields['float_format']));
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Try to establish network connection is possible', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showYesNo("perform_network_connection", $this->fields['perform_network_connection']);
echo "</td>";
echo "<td>" . __('Port unicity criteria', 'datainjection') . "</td>";
echo "<td>";
Dropdown::showFromArray('port_unicity', PluginDatainjectionDropdown::portUnicityValues(), array('value' => $this->fields['port_unicity']));
echo "</td></tr>";
if ($ID > 0) {
$tmp = self::getInstance('csv');
$tmp->showAdditionnalForm($this);
}
$this->showFormButtons($options);
return true;
}
示例4: showForm
/**
* Print the reminder form
*
* @param $ID Integer : Id of the item to print
* @param $options array
* - target filename : where to go when done.
**/
function showForm($ID, $options = array())
{
global $CFG_GLPI, $LANG;
// Show Reminder or blank form
$onfocus = "";
if ($ID > 0) {
$this->check($ID, 'r');
} else {
// Create item : do getempty before check right to set default values
$this->check(-1, 'w');
$onfocus = "onfocus=\"if (this.value=='" . $this->fields['name'] . "') this.value='';\"";
}
$canedit = $this->can($ID, 'w');
if ($canedit) {
echo "<form method='post' name='remind' action='" . $this->getFormURL() . "'>";
}
echo "<div class='center'><table class='tab_cadre' width='450'>";
echo "<tr><th> </th><th>";
if (!$ID) {
echo $LANG['reminder'][6];
} else {
echo $LANG['common'][2] . " {$ID}";
}
echo "</th></tr>\n";
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][57] . " : </td>";
echo "<td>";
if ($canedit) {
autocompletionTextField($this, "name", array('size' => 80, 'entity' => -1, 'user' => $this->fields["users_id"], 'option' => $onfocus));
} else {
echo $this->fields['name'];
}
echo "</td></tr>\n";
if (!$canedit) {
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][95] . " : </td>";
echo "<td>";
echo getUserName($this->fields["users_id"]);
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td>" . $LANG['common'][17] . " : </td>";
echo "<td>";
if ($canedit && haveRight("reminder_public", "w")) {
if (!$ID) {
if (isset($_GET["is_private"])) {
$this->fields["is_private"] = $_GET["is_private"];
}
if (isset($_GET["is_recursive"])) {
$this->fields["is_recursive"] = $_GET["is_recursive"];
}
}
Dropdown::showPrivatePublicSwitch($this->fields["is_private"], $this->fields["entities_id"], $this->fields["is_recursive"]);
} else {
if ($this->fields["is_private"]) {
echo $LANG['common'][77];
} else {
echo $LANG['common'][76];
}
}
echo "</td></tr>\n";
if (haveRight("reminder_public", "w") && !$this->fields["is_private"]) {
echo "<tr class='tab_bg_2'><td>" . $LANG['tracking'][39] . " : </td>";
echo "<td>";
if ($canedit) {
Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
} else {
echo Dropdpown::getYesNo($this->fields['is_helpdesk_visible']);
}
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_2'><td >" . $LANG['buttons'][15] . " : </td>";
echo "<td class='center'>";
if ($canedit) {
echo "<script type='text/javascript' >\n";
echo "function showPlan() {\n";
echo "Ext.get('plan').setDisplayed('none');";
$params = array('form' => 'remind');
if ($ID && $this->fields["is_planned"]) {
$params['state'] = $this->fields["state"];
$params['begin'] = $this->fields["begin"];
$params['end'] = $this->fields["end"];
}
ajaxUpdateItemJsCode('viewplan', $CFG_GLPI["root_doc"] . "/ajax/planning.php", $params, false);
echo "}";
echo "</script>\n";
}
if (!$ID || !$this->fields["is_planned"]) {
if (haveRight("show_planning", "1") || haveRight("show_group_planning", "1") || haveRight("show_all_planning", "1")) {
echo "<div id='plan' onClick='showPlan()'>\n";
echo "<span class='showplan'>" . $LANG['reminder'][12] . "</span>";
}
} else {
if ($canedit) {
echo "<div id='plan' onClick='showPlan()'>\n";
echo "<span class='showplan'>";
//.........这里部分代码省略.........