$comment->update($_POST); Html::back(); } else { if (isset($_POST["delete"])) { $comment->check($_POST['id'], 'w'); $comment->delete($_POST, 1); Html::redirect(Toolbox::getItemTypeFormURL('PluginIdeaboxIdeabox') . "?id=" . $_POST["plugin_ideabox_ideaboxes_id"]); } else { if (isset($_POST["delete_comment"])) { foreach ($_POST["check"] as $ID => $value) { $comment->check($ID, 'w'); $comment->delete(array("id" => $ID), 1); } Html::back(); } else { $comment->checkGlobal("r"); if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { Html::header(PluginIdeaboxIdeabox::getTypeName(2), '', "plugins", "ideabox"); } else { Html::helpHeader(PluginIdeaboxIdeabox::getTypeName(2)); } $comment->showForm($_GET["id"], array('plugin_ideabox_ideaboxes_id' => $_GET["plugin_ideabox_ideaboxes_id"])); if ($_SESSION['glpiactiveprofile']['interface'] == 'central') { Html::footer(); } else { Html::helpFooter(); } } } } }
function showComments(PluginIdeaboxIdeabox $ideabox) { global $DB, $CFG_GLPI; $instID = $ideabox->fields['id']; if (!$ideabox->can($instID, "r")) { return false; } $rand = mt_rand(); $canedit = $ideabox->can($instID, 'w'); $query = "SELECT `glpi_plugin_ideabox_comments`.`name` AS name,\n `glpi_plugin_ideabox_comments`.`id`,\n `glpi_plugin_ideabox_comments`.`plugin_ideabox_ideaboxes_id`,\n `glpi_plugin_ideabox_comments`.`date_comment`,\n `glpi_plugin_ideabox_comments`.`comment`,\n `glpi_plugin_ideabox_comments`.`users_id` AS users_id\n FROM `glpi_plugin_ideabox_comments` "; $query .= " LEFT JOIN `glpi_plugin_ideabox_ideaboxes`\n ON (`glpi_plugin_ideabox_ideaboxes`.`id` = `glpi_plugin_ideabox_comments`.`plugin_ideabox_ideaboxes_id`)"; $query .= " WHERE `glpi_plugin_ideabox_comments`.`plugin_ideabox_ideaboxes_id` = '{$instID}'\n ORDER BY `glpi_plugin_ideabox_comments`.`name`"; $result = $DB->query($query); $number = $DB->numrows($result); echo "<div class='spaced'>"; if ($canedit && $number) { Html::openMassiveActionsForm('mass' . __CLASS__ . $rand); $massiveactionparams = array(); Html::showMassiveActions(__CLASS__, $massiveactionparams); } if ($number != 0) { echo "<table class='tab_cadre_fixe'>"; echo "<tr>"; if ($canedit && $number) { echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>"; } echo "<th>" . __('Name') . "</th>"; echo "<th>" . __('Author') . "</th>"; echo "<th>" . __('Date') . "</th>"; echo "<th>" . __('Content') . "</th>"; echo "</tr>"; Session::initNavigateListItems($this->getType(), PluginIdeaboxIdeabox::getTypeName(2) . " = " . $ideabox->fields["name"]); $i = 0; $row_num = 1; while ($data = $DB->fetch_array($result)) { Session::addToNavigateListItems($this->getType(), $data['id']); $i++; $row_num++; echo "<tr class='tab_bg_1 center'>"; echo "<td width='10'>"; if ($canedit) { Html::showMassiveActionCheckBox(__CLASS__, $data["id"]); } echo "</td>"; echo "<td class='center'>"; echo "<a href='" . $CFG_GLPI["root_doc"] . "/plugins/ideabox/front/comment.form.php?id=" . $data["id"] . "&plugin_ideabox_ideaboxes_id=" . $data["plugin_ideabox_ideaboxes_id"] . "'>"; echo $data["name"]; if ($_SESSION["glpiis_ids_visible"] || empty($data["name"])) { echo " (" . $data["id"] . ")"; } echo "</a></td>"; echo "<td class='center'>" . getusername($data["users_id"]) . "</td>"; echo "<td class='center'>" . Html::convdatetime($data["date_comment"]) . "</td>"; echo "<td class='left'>" . nl2br($data["comment"]) . "</td>"; echo "</tr>"; } echo "</table>"; } if ($canedit && $number) { $paramsma['ontop'] = false; Html::showMassiveActions(__CLASS__, $paramsma); Html::closeForm(); } echo "</div>"; }
function plugin_ideabox_AssignToTicket($types) { if (plugin_ideabox_haveRight("open_ticket", "1")) { $types['PluginIdeaboxIdeabox'] = PluginIdeaboxIdeabox::getTypeName(2); } return $types; }
function showForm($ID, $options = array()) { if (!Session::haveRight("profile", "r")) { return false; } $prof = new Profile(); if ($ID) { $this->getFromDBByProfile($ID); $prof->getFromDB($ID); } $options['colspan'] = 1; $this->showFormHeader($options); echo "<tr class='tab_bg_2'>"; echo "<th colspan='4'>" . sprintf(__('%1$s - %2$s'), __('Rights management', 'ideabox'), $prof->fields["name"]) . "</th>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Read - add ideas', 'ideabox') . ":</td><td>"; Profile::dropdownNoneReadWrite("ideabox", $this->fields["ideabox"], 1, 1, 1); echo "</td>"; echo "</tr>"; echo "<tr class='tab_bg_2'>"; echo "<td>" . __('Associable items to a ticket') . " - " . PluginIdeaboxIdeabox::getTypeName(2) . "</td><td>"; if ($prof->fields['create_ticket']) { Dropdown::showYesNo("open_ticket", $this->fields["open_ticket"]); } else { echo Dropdown::getYesNo(0); } echo "</td>"; echo "</tr>"; echo "<input type='hidden' name='id' value=" . $this->fields["id"] . ">"; $options['candel'] = false; $this->showFormButtons($options); }