-
Côme Bernigaud authored315e43fa
<?php
/*
This code is part of FusionDirectory (http://www.fusiondirectory.org/)
Copyright (C) 2003-2010 Cajus Pollmeier
Copyright (C) 2011-2013 FusionDirectory
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program 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 this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
/*!
* \file class_msg_dialog.inc
* Source code for class message dialog
*/
define("INFO_DIALOG", 10001);
define("WARNING_DIALOG", 10002);
define("ERROR_DIALOG", 10003);
define("LDAP_ERROR", 10003); // LDAP_ERROR is the same as ERROR_DIALOG
define("CONFIRM_DIALOG", 10004);
define("FATAL_ERROR_DIALOG", 10006);
/*!
* \brief This class contains all the function needed to make messages
* dialogs
*/
class msg_dialog
{
private $s_Title = "Undefined";
private $s_Message = "Undefined";
private $i_Type = INFO_DIALOG;
private $i_ID = 0;
private $a_Trace = array();
/*!
* \brief Message dialog constructor
*
* \param string $s_title The title of the message dialog
*
* \param string $s_message The message of the message dialog
*
* \param string $i_type The type of the message dialog, by default = INFO_DIALOG
*/
public function __construct($s_title, $s_message, $i_type)
{
global $config;
if (empty($s_message)) {
return;
}
if (!in_array($i_type, array(INFO_DIALOG,WARNING_DIALOG,ERROR_DIALOG,CONFIRM_DIALOG,FATAL_ERROR_DIALOG))) {
trigger_error("Invalid msg_dialog type.");
$i_type = INFO_DIALOG;
}
if ((!session::is_set('errorsAlreadyPosted')) || !is_array(session::get('errorsAlreadyPosted'))) {
session::set('errorsAlreadyPosted', array());
}