本文整理汇总了PHP中Supplier::dropdown方法的典型用法代码示例。如果您正苦于以下问题:PHP Supplier::dropdown方法的具体用法?PHP Supplier::dropdown怎么用?PHP Supplier::dropdown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Supplier
的用法示例。
在下文中一共展示了Supplier::dropdown方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showForContract
/**
* Print the HTML array of suppliers for this contract
*
* @since version 0.84
*
* @param $contract Contract object
*
* @return Nothing (HTML display)
**/
static function showForContract(Contract $contract)
{
global $DB, $CFG_GLPI;
$instID = $contract->fields['id'];
if (!$contract->can($instID, 'r') || !Session::haveRight("contact_enterprise", "r")) {
return false;
}
$canedit = $contract->can($instID, 'w');
$rand = mt_rand();
$query = "SELECT `glpi_contracts_suppliers`.`id`,\n `glpi_suppliers`.`id` AS entID,\n `glpi_suppliers`.`name` AS name,\n `glpi_suppliers`.`website` AS website,\n `glpi_suppliers`.`phonenumber` AS phone,\n `glpi_suppliers`.`suppliertypes_id` AS type,\n `glpi_entities`.`id` AS entity\n FROM `glpi_contracts_suppliers`,\n `glpi_suppliers`\n LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_suppliers`.`entities_id`)\n WHERE `glpi_contracts_suppliers`.`contracts_id` = '{$instID}'\n AND `glpi_contracts_suppliers`.`suppliers_id`=`glpi_suppliers`.`id`" . getEntitiesRestrictRequest(" AND", "glpi_suppliers", '', '', true) . "\n ORDER BY `glpi_entities`.`completename`, `name`";
$result = $DB->query($query);
$suppliers = array();
$used = array();
if ($number = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$suppliers[$data['id']] = $data;
$used[$data['entID']] = $data['entID'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='contractsupplier_form{$rand}' id='contractsupplier_form{$rand}' method='post'\n action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<input type='hidden' name='contracts_id' value='{$instID}'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_2'><th colspan='2'>" . __('Add a supplier') . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='right'>";
Supplier::dropdown(array('used' => $used, 'entity' => $contract->fields["entities_id"], 'entity_sons' => $contract->fields["is_recursive"]));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number);
Html::showMassiveActions(__CLASS__, $massiveactionparams);
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
if ($canedit && $number) {
echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
}
echo "<th>" . __('Supplier') . "</th>";
echo "<th>" . __('Entity') . "</th>";
echo "<th>" . __('Third party type') . "</th>";
echo "<th>" . __('Phone') . "</th>";
echo "<th>" . __('Website') . "</th>";
echo "</tr>";
$used = array();
foreach ($suppliers as $data) {
$ID = $data['id'];
$website = $data['website'];
if (!empty($website)) {
if (!preg_match("?https*://?", $website)) {
$website = "http://" . $website;
}
$website = "<a target=_blank href='{$website}'>" . $data['website'] . "</a>";
}
$entID = $data['entID'];
$entity = $data['entity'];
$used[$entID] = $entID;
$entname = Dropdown::getDropdownName("glpi_suppliers", $entID);
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td>";
Html::showMassiveActionCheckBox(__CLASS__, $data["id"]);
echo "</td>";
}
echo "<td class='center'>";
if ($_SESSION["glpiis_ids_visible"] || empty($entname)) {
$entname = sprintf(__('%1$s (%2$s)'), $entname, $entID);
}
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/supplier.form.php?id={$entID}'>" . $entname;
echo "</a></td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $entity) . "</td>";
echo "<td class='center'>";
echo Dropdown::getDropdownName("glpi_suppliertypes", $data['type']) . "</td>";
echo "<td class='center'>" . $data['phone'] . "</td>";
echo "<td class='center'>" . $website . "</td>";
echo "</tr>";
}
echo "</table>";
if ($canedit && $number) {
$paramsma['ontop'] = false;
Html::showMassiveActions(__CLASS__, $paramsma);
Html::closeForm();
}
echo "</div>";
//.........这里部分代码省略.........
示例2: showForItem
/**
* Show Infocom form for an item (not a standard showForm)
*
* @param $item CommonDBTM object
* @param $withtemplate integer template or basic item (default '')
**/
static function showForItem(CommonDBTM $item, $withtemplate = '')
{
global $CFG_GLPI;
// Show Infocom or blank form
if (!Session::haveRight("infocom", "r")) {
return false;
}
if (!$item) {
echo "<div class='spaced'>" . __('Requested item not found') . "</div>";
} else {
$date_tax = $CFG_GLPI["date_tax"];
$dev_ID = $item->getField('id');
$ic = new self();
$option = "";
if ($withtemplate == 2) {
$option = " readonly ";
}
if (!strpos($_SERVER['PHP_SELF'], "infocoms-show") && in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
echo "<div class='firstbloc center'>" . __('For this type of item, the financial and administrative information are only a model for the items which you should add.') . "</div>";
}
if (!$ic->getFromDBforDevice($item->getType(), $dev_ID)) {
$input = array('itemtype' => $item->getType(), 'items_id' => $dev_ID, 'entities_id' => $item->getEntityID());
if ($ic->can(-1, "w", $input) && $withtemplate != 2) {
echo "<div class='spaced b'>";
echo "<table class='tab_cadre_fixe'><tr class='tab_bg_1'><th>";
echo sprintf(__('%1$s - %2$s'), $item->getTypeName(1), $item->getName()) . "</th></tr>";
echo "<tr class='tab_bg_1'><td class='center'>";
Html::showSimpleForm($CFG_GLPI["root_doc"] . "/front/infocom.form.php", 'add', __('Enable the financial and administrative information'), array('itemtype' => $item->getType(), 'items_id' => $dev_ID));
echo "</td></tr></table></div>";
}
} else {
// getFromDBforDevice
$canedit = $ic->can($ic->fields['id'], "w") && $withtemplate != 2;
if ($canedit) {
echo "<form name='form_ic' method='post' action='" . $CFG_GLPI["root_doc"] . "/front/infocom.form.php'>";
}
echo "<div class='spaced'>";
echo "<table class='tab_cadre" . (!strpos($_SERVER['PHP_SELF'], "infocoms-show") ? "_fixe" : "") . "'>";
echo "<tr><th colspan='4'>" . __('Financial and administrative information') . "</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Supplier') . "</td>";
echo "<td>";
if ($withtemplate == 2) {
echo Dropdown::getDropdownName("glpi_suppliers", $ic->fields["suppliers_id"]);
} else {
Supplier::dropdown(array('value' => $ic->fields["suppliers_id"], 'entity' => $item->getEntityID()));
}
echo "</td>";
if (Session::haveRight("budget", "r")) {
echo "<td>" . __('Budget') . "</td><td >";
Budget::dropdown(array('value' => $ic->fields["budgets_id"], 'entity' => $item->getEntityID(), 'comments' => 1));
} else {
echo "<td colspan='2'>";
}
echo "</td></tr>";
// Can edit calendar ?
$editcalendar = $withtemplate != 2;
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Order number') . "</td>";
echo "<td >";
Html::autocompletionTextField($ic, "order_number", array('option' => $option));
echo "</td>";
echo "<td>" . __('Order date') . "</td><td>";
Html::showDateFormItem("order_date", $ic->fields["order_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
$istemplate = '';
if ($item->isTemplate() || in_array($item->getType(), array('CartridgeItem', 'ConsumableItem', 'Software'))) {
$istemplate = '*';
}
echo "<td>" . sprintf(__('%1$s%2$s'), __('Immobilization number'), $istemplate) . "</td>";
echo "<td>";
$objectName = autoName($ic->fields["immo_number"], "immo_number", $withtemplate == 2, 'Infocom', $item->getEntityID());
Html::autocompletionTextField($ic, "immo_number", array('value' => $objectName, 'option' => $option));
echo "</td>";
echo "<td>" . __('Date of purchase') . "</td><td>";
Html::showDateFormItem("buy_date", $ic->fields["buy_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Invoice number') . "</td>";
echo "<td>";
Html::autocompletionTextField($ic, "bill", array('option' => $option));
echo "</td>";
echo "<td>" . __('Delivery date') . "</td><td>";
Html::showDateFormItem("delivery_date", $ic->fields["delivery_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Delivery form') . "</td><td>";
Html::autocompletionTextField($ic, "delivery_number", array('option' => $option));
echo "</td>";
echo "<td>" . __('Startup date') . "</td><td>";
Html::showDateFormItem("use_date", $ic->fields["use_date"], true, $editcalendar);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
//.........这里部分代码省略.........
示例3: showSupplierAddFormOnCreate
/**
* show supplier add div on creation
*
* @param $options array options for default values ($options of showForm)
*
* @return nothing display
**/
function showSupplierAddFormOnCreate(array $options)
{
global $CFG_GLPI;
$itemtype = $this->getType();
echo self::getActorIcon('supplier', 'assign');
// For ticket templates : mandatories
if ($itemtype == 'Ticket' && isset($options['_tickettemplate'])) {
echo $options['_tickettemplate']->getMandatoryMark("_suppliers_id_assign");
}
echo " ";
$rand = mt_rand();
$params = array('name' => '_suppliers_id_assign', 'value' => $options["_suppliers_id_assign"], 'rand' => $rand);
if ($CFG_GLPI['use_mailing']) {
$paramscomment = array('value' => '__VALUE__', 'field' => "_suppliers_id_assign_notif", 'allow_email' => true, 'typefield' => 'supplier', 'use_notification' => $options["_suppliers_id_assign_notif"]['use_notification']);
if (isset($options["_suppliers_id_assign_notif"]['alternative_email'])) {
$paramscomment['alternative_email'] = $options["_suppliers_id_assign_notif"]['alternative_email'];
}
$params['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "notif_assign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment);
}
if ($itemtype == 'Ticket') {
$toupdate = array();
if (isset($params['toupdate']) && is_array($params['toupdate'])) {
$toupdate[] = $params['toupdate'];
}
$toupdate[] = array('value_fieldname' => 'value', 'to_update' => "countassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('suppliers_id_assign' => '__VALUE__'));
$params['toupdate'] = $toupdate;
}
Supplier::dropdown($params);
if ($itemtype == 'Ticket') {
// Display active tickets for a tech
// Need to update information on dropdown changes
echo "<span id='countassign_{$rand}'>";
echo "</span>";
echo "<script type='text/javascript'>";
Ajax::updateItemJsCode("countassign_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", array('suppliers_id_assign' => '__VALUE__'), "dropdown__suppliers_id_assign" . $rand);
echo "</script>";
}
if ($CFG_GLPI['use_mailing']) {
echo "<div id='notif_assign_{$rand}'>";
echo "</div>";
echo "<script type='text/javascript'>";
Ajax::updateItemJsCode("notif_assign_{$rand}", $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", $paramscomment, "dropdown__suppliers_id_assign" . $rand);
echo "</script>";
}
}
示例4: isset
if ($CFG_GLPI["use_mailing"]) {
$withemail = isset($_POST["allow_email"]) ? $_POST["allow_email"] : false;
$paramscomment = array('value' => '__VALUE__', 'allow_email' => $withemail, 'field' => '_itil_' . $_POST["actortype"], 'typefield' => "supplier", 'use_notification' => $_POST["use_notif"]);
// Fix rand value
$options['rand'] = $rand;
$options['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "notif_supplier_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/uemailUpdate.php", 'moreparams' => $paramscomment);
}
if ($_POST["itemtype"] == 'Ticket') {
$toupdate = array();
if (isset($options['toupdate']) && is_array($options['toupdate'])) {
$toupdate[] = $options['toupdate'];
}
$toupdate[] = array('value_fieldname' => 'value', 'to_update' => "countassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('suppliers_id_assign' => '__VALUE__'));
$options['toupdate'] = $toupdate;
}
$rand = Supplier::dropdown($options);
// Display active tickets for a supplier
// Need to update information on dropdown changes
if ($_POST["itemtype"] == 'Ticket') {
echo "<span id='countassign_{$rand}'>";
echo "</span>";
}
if ($CFG_GLPI["use_mailing"]) {
echo "<br><span id='notif_supplier_{$rand}'>";
if ($withemail) {
echo __('Email followup') . ' ';
$rand = Dropdown::showYesNo('_itil_' . $_POST["actortype"] . '[use_notification]', $_POST['use_notif']);
echo '<br>';
printf(__('%1$s: %2$s'), __('Email'), "<input type='text' size='25' name='_itil_" . $_POST["actortype"] . "[alternative_email]'>");
}
echo "</span>";
示例5: showForm
//.........这里部分代码省略.........
Budget::Dropdown(array('name' => "budgets_id", 'value' => $this->fields["budgets_id"], 'entity' => $this->fields["entities_id"], 'comments' => true, 'condition' => $restrict, 'width' => '150px'));
} else {
$budget = new Budget();
if ($this->fields["budgets_id"] > 0 && $budget->can($this->fields["budgets_id"], READ)) {
echo $budget->getLink();
} else {
echo Dropdown::getDropdownName("glpi_budgets", $this->fields["budgets_id"]);
}
}
echo "</td></tr>";
/* location */
echo "<tr class='tab_bg_1'><td>" . __("Delivery location", "order") . ": </td>";
echo "<td>";
if ($canedit) {
Location::Dropdown(array('name' => "locations_id", 'value' => $this->fields["locations_id"], 'entity' => $this->fields["entities_id"]));
} else {
echo Dropdown::getDropdownName("glpi_locations", $this->fields["locations_id"]);
}
echo "</td>";
/* payment */
echo "<td>" . __("Payment conditions", "order") . ": </td><td>";
if ($canedit) {
PluginOrderOrderPayment::Dropdown(array('name' => "plugin_order_orderpayments_id", 'value' => $this->fields["plugin_order_orderpayments_id"]));
} else {
echo Dropdown::getDropdownName("glpi_plugin_order_orderpayments", $this->fields["plugin_order_orderpayments_id"]);
}
echo "</td>";
echo "</tr>";
/* supplier of order */
echo "<tr class='tab_bg_1'><td>" . __("Supplier") . ": </td>";
echo "<td>";
if ($canedit && !$this->checkIfDetailExists($ID)) {
$rand = mt_rand();
Supplier::dropdown(array('name' => "suppliers_id", 'rand' => $rand, 'value' => $this->fields["suppliers_id"], 'entity' => $this->fields["entities_id"]));
$params = array('suppliers_id' => '__VALUE__', 'fieldname' => 'contacts_id');
Ajax::updateItemOnSelectEvent("dropdown_suppliers_id{$rand}", "show_contacts_id{$rand}", "../ajax/dropdownSupplier.php", $params);
} else {
$supplier = new Supplier();
if ($supplier->can($this->fields['suppliers_id'], READ)) {
echo $supplier->getLink();
} else {
echo Dropdown::getDropdownName("glpi_suppliers", $this->fields["suppliers_id"]);
}
}
echo "</td>";
/* port price */
echo "<td>" . __("Postage", "order") . ": </td>";
echo "<td>";
if ($canedit) {
echo "<input type='number' step='" . PLUGIN_ORDER_NUMBER_STEP . "' name='port_price' size='5'" . " value=\"" . Html::formatNumber($this->fields["port_price"], true) . "\">";
} else {
echo Html::formatNumber($this->fields["port_price"]);
}
echo "</td>";
echo "</tr>";
/* linked contact of the supplier of order */
echo "<tr class='tab_bg_1'><td>" . __("Contact") . ": </td>";
echo "<td><span id='show_contacts_id'>";
if ($canedit) {
echo "<span id='show_contacts_id{$rand}'>";
// Make a select box
$query = "SELECT c.`id`, c.`name`, c.`firstname`\n FROM `glpi_contacts` c\n LEFT JOIN `glpi_contacts_suppliers` s ON (s.`contacts_id` = c.`id`)\n WHERE s.`suppliers_id` = '{$this->fields['suppliers_id']}'\n ORDER BY c.`name`";
$result = $DB->query($query);
$number = $DB->numrows($result);
$values = array(0 => Dropdown::EMPTY_VALUE);
if ($number) {
示例6: __
}
if ($CFG_GLPI["use_mailing"] == 1) {
echo "<br><span id='notif_user_{$rand}'>";
if ($withemail) {
echo __('Email followup') . ' ';
$rand = Dropdown::showYesNo('_itil_' . $_POST["actortype"] . '[use_notification]', 1);
echo '<br>';
printf(__('%1$s: %2$s'), __('Email'), "<input type='text' size='25' name='_itil_" . $_POST["actortype"] . "[alternative_email]'>");
}
echo "</span>";
}
break;
case "group":
$cond = $_POST["actortype"] == 'assign' ? $cond = '`is_assign`' : ($cond = '`is_requester`');
$param = array('name' => '_itil_' . $_POST["actortype"] . '[groups_id]', 'entity' => $_POST['entity_restrict'], 'condition' => $cond, 'rand' => $rand);
if ($_POST["itemtype"] == 'Ticket' && $_POST["actortype"] == 'assign') {
$param['toupdate'] = array('value_fieldname' => 'value', 'to_update' => "countgroupassign_{$rand}", 'url' => $CFG_GLPI["root_doc"] . "/ajax/ticketassigninformation.php", 'moreparams' => array('groups_id_assign' => '__VALUE__'));
}
$rand = Group::dropdown($param);
if ($_POST["itemtype"] == 'Ticket' && $_POST["actortype"] == 'assign') {
echo "<br><span id='countgroupassign_{$rand}'>";
echo "</span>";
}
break;
case "supplier":
$param = array('name' => '_itil_' . $_POST["actortype"] . '[suppliers_id]', 'entity' => $_POST['entity_restrict'], 'rand' => $rand);
$rand = Supplier::dropdown($param);
break;
}
}
}
示例7: showActorsPartForm
/**
* show actor part in ITIL object form
*
* @param $ID integer ITIL object ID
* @param $options array options for default values ($options of showForm)
*
* @return nothing display
**/
function showActorsPartForm($ID, array $options)
{
global $CFG_GLPI;
$showuserlink = 0;
if (Session::haveRight('user', 'r')) {
$showuserlink = 1;
}
// check is_hidden fields
foreach (array('_users_id_requester', '_groups_id_requester', '_users_id_observer', '_groups_id_observer', '_users_id_assign', '_groups_id_assign', '_suppliers_id_assign') as $f) {
$is_hidden[$f] = false;
if (isset($options['_tickettemplate']) && $options['_tickettemplate']->isHiddenField($f)) {
$is_hidden[$f] = true;
}
}
$can_admin = $this->canAdminActors();
$can_assign = $this->canAssign();
$can_assigntome = $this->canAssignToMe();
if (isset($options['_noupdate']) && $options['_noupdate']) {
$can_admin = false;
$can_assign = false;
$can_assigntome = false;
}
// Manage actors : requester and assign
echo "<table class='tab_cadre_fixe' id='mainformtable5'>";
echo "<tr class='tab_bg_1'>";
echo "<th rowspan='2' width='13%'>" . __('Actor') . "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester']) {
_e('Requester');
}
$rand_requester = -1;
$candeleterequester = false;
if ($ID && $can_admin && (!$is_hidden['_users_id_requester'] || !$is_hidden['_groups_id_requester'])) {
$rand_requester = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"Ext.get('itilactor{$rand_requester}').setDisplayed('block')\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
$candeleterequester = true;
}
echo "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer']) {
_e('Watcher');
}
$rand_observer = -1;
$candeleteobserver = false;
if ($ID && $can_admin && (!$is_hidden['_users_id_observer'] || !$is_hidden['_groups_id_observer'])) {
$rand_observer = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"Ext.get('itilactor{$rand_observer}').setDisplayed('block')\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
$candeleteobserver = true;
} else {
if ($ID > 0 && !in_array($this->fields['status'], $this->getClosedStatusArray()) && !$is_hidden['_users_id_observer'] && !$this->isUser(CommonITILActor::OBSERVER, Session::getLoginUserID()) && !$this->isUser(CommonITILActor::REQUESTER, Session::getLoginUserID())) {
echo " ";
Html::showSimpleForm($this->getFormURL(), 'addme_observer', __('Associate myself with this ticket'), array('tickets_id' => $this->fields['id']));
}
}
echo "</th>";
echo "<th width='29%'>";
if (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign']) {
_e('Assigned to');
}
$rand_assign = -1;
$candeleteassign = false;
if ($ID && ($can_assign || $can_assigntome) && (!$is_hidden['_users_id_assign'] || !$is_hidden['_groups_id_assign'] || !$is_hidden['_suppliers_id_assign'])) {
$rand_assign = mt_rand();
echo " ";
echo "<img title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n onClick=\"Ext.get('itilactor{$rand_assign}').setDisplayed('block')\"\n class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
}
if ($ID && $can_assign) {
$candeleteassign = true;
}
echo "</th></tr>";
echo "<tr class='tab_bg_1 top'>";
echo "<td>";
if ($rand_requester >= 0) {
$this->showActorAddForm(CommonITILActor::REQUESTER, $rand_requester, $this->fields['entities_id'], $is_hidden);
}
// Requester
if (!$ID) {
$reqdisplay = false;
if ($can_admin && !$is_hidden['_users_id_requester']) {
$this->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $options);
$reqdisplay = true;
} else {
$delegating = User::getDelegateGroupsForUser($options['entities_id']);
if (count($delegating) && !$is_hidden['_users_id_requester']) {
//$this->getDefaultActor(CommonITILActor::REQUESTER);
$options['_right'] = "delegate";
$this->showActorAddFormOnCreate(CommonITILActor::REQUESTER, $options);
$reqdisplay = true;
} else {
// predefined value
//.........这里部分代码省略.........
示例8: showForm
//.........这里部分代码省略.........
case 'User':
$section_questions_user[$question['id']] = $question['name'];
break;
case 'Group':
$section_questions_group[$question['id']] = $question['name'];
break;
case 'Supplier':
$section_questions_supplier[$question['id']] = $question['name'];
break;
}
}
$questions_user_list[$section['name']] = $section_questions_user;
$questions_group_list[$section['name']] = $section_questions_group;
$questions_supplier_list[$section['name']] = $section_questions_supplier;
}
// Get available questions for actors lists
$actors = array('requester' => array(), 'observer' => array(), 'assigned' => array());
$query = "SELECT id, actor_role, actor_type, actor_value, use_notification\n FROM glpi_plugin_formcreator_targettickets_actors\n WHERE plugin_formcreator_targettickets_id = " . $this->getID();
$result = $GLOBALS['DB']->query($query);
while ($actor = $GLOBALS['DB']->fetch_array($result)) {
$actors[$actor['actor_role']][$actor['id']] = array('actor_type' => $actor['actor_type'], 'actor_value' => $actor['actor_value'], 'use_notification' => $actor['use_notification']);
}
$img_user = '<img src="../../../pics/users.png" alt="' . __('User') . '" title="' . __('User') . '" width="20" />';
$img_group = '<img src="../../../pics/groupes.png" alt="' . __('Group') . '" title="' . __('Group') . '" width="20" />';
$img_supplier = '<img src="../../../pics/supplier.png" alt="' . __('Supplier') . '" title="' . __('Supplier') . '" width="20" />';
$img_mail = '<img src="../pics/email.png" alt="' . __('Yes') . '" title="' . __('Email followup') . ' ' . __('Yes') . '" />';
$img_nomail = '<img src="../pics/email-no.png" alt="' . __('No') . '" title="' . __('Email followup') . ' ' . __('No') . '" />';
echo '<table class="tab_cadre_fixe">';
echo '<tr><th colspan="3">' . __('Ticket actors', 'formcreator') . '</th></tr>';
echo '<tr>';
echo '<th width="33%">';
echo _n('Requester', 'Requesters', 1) . ' ';
echo '<img title="Ajouter" alt="Ajouter" onclick="displayRequesterForm()" class="pointer"
id="btn_add_requester" src="../../../pics/add_dropdown.png">';
echo '<img title="Annuler" alt="Annuler" onclick="hideRequesterForm()" class="pointer"
id="btn_cancel_requester" src="../../../pics/delete.png" style="display:none">';
echo '</th>';
echo '<th width="34%">';
echo _n('Watcher', 'Watchers', 1) . ' ';
echo '<img title="Ajouter" alt="Ajouter" onclick="displayWatcherForm()" class="pointer"
id="btn_add_watcher" src="../../../pics/add_dropdown.png">';
echo '<img title="Annuler" alt="Annuler" onclick="hideWatcherForm()" class="pointer"
id="btn_cancel_watcher" src="../../../pics/delete.png" style="display:none">';
echo '</th>';
echo '<th width="33%">';
echo __('Assigned to') . ' ';
echo '<img title="Ajouter" alt="Ajouter" onclick="displayAssignedForm()" class="pointer"
id="btn_add_assigned" src="../../../pics/add_dropdown.png">';
echo '<img title="Annuler" alt="Annuler" onclick="hideAssignedForm()" class="pointer"
id="btn_cancel_assigned" src="../../../pics/delete.png" style="display:none">';
echo '</th>';
echo '</tr>';
echo '<tr>';
// Requester
echo '<td valign="top">';
// => Add requester form
echo '<form name="form_target" id="form_add_requester" method="post" style="display:none" action="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/targetticket.form.php">';
Dropdown::showFromArray('actor_type', array('' => Dropdown::EMPTY_VALUE, 'creator' => __('Form requester', 'formcreator'), 'validator' => __('Form validator', 'formcreator'), 'person' => __('Specific person', 'formcreator'), 'question_person' => __('Person from the question', 'formcreator'), 'group' => __('Specific group', 'formcreator'), 'question_group' => __('Group from the question', 'formcreator')), array('on_change' => 'formcreatorChangeActorRequester(this.value)'));
echo '<div id="block_requester_user" style="display:none">';
User::dropdown(array('name' => 'actor_value_person', 'right' => 'all', 'all' => 0));
echo '</div>';
echo '<div id="block_requester_group" style="display:none">';
Group::dropdown(array('name' => 'actor_value_group'));
echo '</div>';
echo '<div id="block_requester_question_user" style="display:none">';
Dropdown::showFromArray('actor_value_question_person', $questions_user_list, array('value' => $this->fields['due_date_question']));
示例9: showForContact
/**
* Print the HTML array for entreprises on the current contact
*
*@return Nothing (display)
**/
static function showForContact(Contact $contact)
{
global $DB, $CFG_GLPI;
$instID = $contact->fields['id'];
if (!$contact->can($instID, READ)) {
return false;
}
$canedit = $contact->can($instID, UPDATE);
$rand = mt_rand();
$query = "SELECT `glpi_contacts_suppliers`.`id`,\n `glpi_suppliers`.`id` AS entID,\n `glpi_suppliers`.`name` AS name,\n `glpi_suppliers`.`website` AS website,\n `glpi_suppliers`.`fax` AS fax,\n `glpi_suppliers`.`phonenumber` AS phone,\n `glpi_suppliers`.`suppliertypes_id` AS type,\n `glpi_suppliers`.`is_deleted`,\n `glpi_entities`.`id` AS entity\n FROM `glpi_contacts_suppliers`, `glpi_suppliers`\n LEFT JOIN `glpi_entities` ON (`glpi_entities`.`id`=`glpi_suppliers`.`entities_id`)\n WHERE `glpi_contacts_suppliers`.`contacts_id` = '{$instID}'\n AND `glpi_contacts_suppliers`.`suppliers_id` = `glpi_suppliers`.`id`" . getEntitiesRestrictRequest(" AND", "glpi_suppliers", '', '', true) . "\n ORDER BY `glpi_entities`.`completename`, `name`";
$result = $DB->query($query);
$suppliers = array();
$used = array();
if ($number = $DB->numrows($result)) {
while ($data = $DB->fetch_assoc($result)) {
$suppliers[$data['id']] = $data;
$used[$data['entID']] = $data['entID'];
}
}
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='contactsupplier_form{$rand}' id='contactsupplier_form{$rand}'\n method='post' action='";
echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='2'>" . __('Add a supplier') . "</tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
echo "<input type='hidden' name='contacts_id' value='{$instID}'>";
Supplier::dropdown(array('used' => $used, 'entity' => $contact->fields["entities_id"], 'entity_sons' => $contact->fields["is_recursive"]));
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
echo "<div class='spaced'>";
if ($canedit && $number) {
Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
$massiveactionparams = array('num_displayed' => $number, 'container' => 'mass' . __CLASS__ . $rand);
Html::showMassiveActions($massiveactionparams);
}
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit && $number) {
$header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_top .= "</th>";
$header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
$header_bottom .= "</th>";
}
$header_end .= "<th>" . __('Supplier') . "</th>";
$header_end .= "<th>" . __('Entity') . "</th>";
$header_end .= "<th>" . __('Third party type') . "</th>";
$header_end .= "<th>" . __('Phone') . "</th>";
$header_end .= "<th>" . __('Fax') . "</th>";
$header_end .= "<th>" . __('Website') . "</th>";
$header_end .= "</tr>";
echo $header_begin . $header_top . $header_end;
$used = array();
if ($number > 0) {
Session::initNavigateListItems('Supplier', sprintf(__('%1$s = %2$s'), Contact::getTypeName(1), $contact->getName()));
foreach ($suppliers as $data) {
$ID = $data["id"];
Session::addToNavigateListItems('Supplier', $data["entID"]);
$used[$data["entID"]] = $data["entID"];
$website = $data["website"];
if (!empty($website)) {
$website = $data["website"];
if (!preg_match("?https*://?", $website)) {
$website = "http://" . $website;
}
$website = "<a target=_blank href='{$website}'>" . $data["website"] . "</a>";
}
echo "<tr class='tab_bg_1" . ($data["is_deleted"] ? "_2" : "") . "'>";
if ($canedit) {
echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
}
echo "<td class='center'>";
echo "<a href='" . $CFG_GLPI["root_doc"] . "/front/supplier.form.php?id=" . $data["entID"] . "'>" . Dropdown::getDropdownName("glpi_suppliers", $data["entID"]) . "</a></td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_entities", $data["entity"]);
echo "</td>";
echo "<td class='center'>" . Dropdown::getDropdownName("glpi_suppliertypes", $data["type"]);
echo "</td>";
echo "<td class='center' width='80'>" . $data["phone"] . "</td>";
echo "<td class='center' width='80'>" . $data["fax"] . "</td>";
echo "<td class='center'>" . $website . "</td>";
echo "</tr>";
}
echo $header_begin . $header_bottom . $header_end;
}
echo "</table>";
if ($canedit && $number) {
$massiveactionparams['ontop'] = false;
//.........这里部分代码省略.........
示例10: showForm
public function showForm($ID, $options = array())
{
global $CFG_GLPI;
if (!$this->canView()) {
return false;
}
if ($ID > 0) {
$this->check($ID, READ);
} else {
// Create item
$this->check(-1, UPDATE);
$this->getEmpty();
}
$this->initForm($ID, $options);
$this->showFormHeader($options);
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Name') . " : </td>";
echo "<td>";
Html::autocompletionTextField($this, "name");
echo "</td>";
echo "<td>" . __('Other') . " : </td>";
echo "<td>";
Html::autocompletionTextField($this, "others");
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Supplier') . " : </td>";
echo "<td>";
Supplier::dropdown(array('name' => "suppliers_id", 'value' => $this->fields["suppliers_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Rates', 'connections') . " : </td>";
echo "<td>";
PluginConnectionsConnectionRate::dropdown(array('name' => "plugin_connections_connectionrates_id", 'value' => $this->fields["plugin_connections_connectionrates_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Type of Connections', 'connections') . " : </td><td>";
PluginConnectionsConnectionType::dropdown(array('name' => "plugin_connections_connectiontypes_id", 'value' => $this->fields["plugin_connections_connectiontypes_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Guaranteed Rates', 'connections') . " : </td>";
echo "<td>";
PluginConnectionsGuaranteedConnectionRate::dropdown(array('name' => "plugin_connections_guaranteedconnectionrates_id", 'value' => $this->fields["plugin_connections_guaranteedconnectionrates_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Technician in charge of the hardware') . " : </td><td>";
User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
echo "</td>";
echo "<td>" . __('Associable to a ticket') . " :</td><td>";
Dropdown::showYesNo('is_helpdesk_visible', $this->fields['is_helpdesk_visible']);
echo "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Group') . " : </td><td>";
Group::dropdown(array('name' => "groups_id", 'value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"]));
echo "</td>";
echo "<td>" . __('Last update') . " : </td>";
echo "<td>" . Html::convDateTime($this->fields["date_mod"]) . "</td>";
echo "</tr>";
echo "<tr class='tab_bg_1'>";
echo "<td>" . __('Comments') . " : </td>";
echo "<td class='center' colspan='3'>";
echo "<textarea cols='35' rows='4' name='comment' >" . $this->fields["comment"] . "</textarea>";
echo "</td>";
echo "</tr>";
$this->showFormButtons($options);
return true;
}