2012-04-02 13:04:53 -04:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* OpenSQLManager
|
|
|
|
*
|
|
|
|
* Free Database manager for Open Source Databases
|
|
|
|
*
|
2012-04-20 13:30:27 -04:00
|
|
|
* @package OpenSQLManager
|
2012-04-02 13:04:53 -04:00
|
|
|
* @author Timothy J. Warren
|
|
|
|
* @copyright Copyright (c) 2012
|
|
|
|
* @link https://github.com/aviat4ion/OpenSQLManager
|
|
|
|
* @license http://philsturgeon.co.uk/code/dbad-license
|
|
|
|
*/
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
2012-06-05 16:53:03 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Global Functions
|
|
|
|
*
|
|
|
|
* @package OpenSQLManager
|
|
|
|
* @subpackage Common
|
|
|
|
*/
|
2012-04-02 13:04:53 -04:00
|
|
|
|
2012-05-29 14:29:20 -04:00
|
|
|
namespace OpenSQLManager;
|
|
|
|
|
2012-04-02 13:04:53 -04:00
|
|
|
/**
|
|
|
|
* Convert an array to an object
|
|
|
|
*
|
|
|
|
* @param array $array
|
|
|
|
* @return object
|
|
|
|
*/
|
|
|
|
function array_to_object($array)
|
|
|
|
{
|
|
|
|
if (is_object($array))
|
|
|
|
{
|
|
|
|
return $array;
|
|
|
|
}
|
|
|
|
|
2012-05-29 14:29:20 -04:00
|
|
|
$obj = new \StdClass();
|
2012-04-02 13:04:53 -04:00
|
|
|
|
2012-11-27 09:34:38 -05:00
|
|
|
foreach($array as $k => $v)
|
2012-04-02 13:04:53 -04:00
|
|
|
{
|
|
|
|
$obj->$k = $v;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
2012-04-19 21:55:44 -04:00
|
|
|
* Create info dialog to return an informational message
|
2012-04-02 13:04:53 -04:00
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function alert($message)
|
|
|
|
{
|
2012-05-30 16:41:33 -04:00
|
|
|
return \wxMessageBox($message, 'Info', wxOK|wxICON_INFORMATION);
|
2012-04-02 13:04:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create info dialog to retun an informational message
|
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
function error($message)
|
|
|
|
{
|
2012-05-30 16:41:33 -04:00
|
|
|
return \wxMessageBox($message, 'Error', wxOK|wxICON_ERROR);
|
2012-04-02 13:04:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates a binary confirmation dialog
|
|
|
|
*
|
|
|
|
* @param string $message
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
function confirm($message)
|
|
|
|
{
|
2012-05-30 16:41:33 -04:00
|
|
|
$answer = \wxMessageBox($message, 'Prompt', wxYES_NO);
|
|
|
|
return ($answer === wxYES) ? TRUE : FALSE;
|
2012-04-02 13:04:53 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// End of functions.php
|