*/ include '../inc/includes.php'; Session::checkRight("notification", 'r'); if (!isset($_GET["id"])) { $_GET["id"] = ""; } $notification = new Notification(); if (isset($_POST["add"])) { $notification->check(-1, 'w', $_POST); $newID = $notification->add($_POST); Event::log($newID, "notifications", 4, "notification", sprintf(__('%1$s adds the item %2$s'), $_SESSION["glpiname"], $_POST["name"])); Html::redirect($_SERVER['PHP_SELF'] . "?id={$newID}"); } else { if (isset($_POST["delete"])) { $notification->check($_POST["id"], 'd'); $notification->delete($_POST); Event::log($_POST["id"], "notifications", 4, "notification", sprintf(__('%s purges an item'), $_SESSION["glpiname"])); $notification->redirectToList(); } else { if (isset($_POST["update"])) { $notification->check($_POST["id"], 'w'); $notification->update($_POST); Event::log($_POST["id"], "notifications", 4, "notification", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } else { Html::header(Notification::getTypeName(2), $_SERVER['PHP_SELF'], "config", "mailing", "notification"); $notification->showForm($_GET["id"]); Html::footer(); } } }
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate && Notification::canView()) { $nb = 0; switch ($item->getType()) { case 'Group': if ($_SESSION['glpishow_count_on_tabs']) { $nb = self::countForGroup($item); } return self::createTabEntry(Notification::getTypeName(Session::getPluralNumber()), $nb); case 'Notification': if ($_SESSION['glpishow_count_on_tabs']) { $nb = countElementsInTable($this->getTable(), "notifications_id = '" . $item->getID() . "'"); } return self::createTabEntry(self::getTypeName(Session::getPluralNumber()), $nb); } } return ''; }
the Free Software Foundation; either version 2 of the License, or (at your option) any later version. GLPI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include '../inc/includes.php'; Session::checkRight("config", UPDATE); $notificationmail = new NotificationMailSetting(); if (!empty($_POST["test_smtp_send"])) { NotificationMail::testNotification(); Html::back(); } else { if (!empty($_POST["update"])) { $config = new Config(); $config->update($_POST); Html::back(); } } Html::header(Notification::getTypeName(Session::getPluralNumber()), $_SERVER['PHP_SELF'], "config", "notification", "config"); $notificationmail->display(array('id' => 1)); Html::footer();
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { if (!$withtemplate && Session::haveRight('notification', 'r')) { switch ($item->getType()) { case 'Group': if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry(Notification::getTypeName(2), self::countForGroup($item)); } return Notification::getTypeName(2); case 'Notification': if ($_SESSION['glpishow_count_on_tabs']) { return self::createTabEntry(self::getTypeName(2), countElementsInTable($this->getTable(), "notifications_id\n = '" . $item->getID() . "'")); } return self::getTypeName(2); } } return ''; }