2006-12-02 04:36:16 +00:00
< ? php
/*
2009-11-12 14:30:07 +00:00
* e107 website system
*
2017-01-07 17:00:45 +00:00
* Copyright ( C ) 2008 - 2017 e107 Inc ( e107 . org )
2009-11-12 14:30:07 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
*/
2021-01-16 13:32:35 -08:00
require_once ( __DIR__ . '/../class2.php' );
2008-11-02 12:23:56 +00:00
if ( ! getperms ( " M " ))
{
2016-01-13 19:17:37 -08:00
e107 :: redirect ( 'admin' );
exit ;
2006-12-02 04:36:16 +00:00
}
2009-08-28 16:11:02 +00:00
2017-01-17 01:33:03 +01:00
e107 :: coreLan ( 'wmessage' , true );
2009-08-28 16:11:02 +00:00
2006-12-02 04:36:16 +00:00
2015-02-03 12:26:56 -08:00
class wmessage_admin extends e_admin_dispatcher
{
protected $modes = array (
'main' => array (
'controller' => 'generic_ui' ,
'path' => null ,
'ui' => 'generic_form_ui' ,
'uipath' => null
),
);
protected $adminMenu = array (
'main/list' => array ( 'caption' => LAN_MANAGE , 'perm' => 'P' ),
'main/create' => array ( 'caption' => LAN_CREATE , 'perm' => 'P' ),
'main/prefs' => array ( 'caption' => LAN_PREFS , 'perm' => 'P' ),
// 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P')
);
protected $adminMenuAliases = array (
'main/edit' => 'main/list'
);
protected $menuTitle = WMLAN_00 ;
2017-02-01 18:25:32 -08:00
protected $adminMenuIcon = 'e-welcome-24' ;
2015-02-03 12:26:56 -08:00
}
class generic_ui extends e_admin_ui
{
protected $pluginTitle = WMLAN_00 ;
protected $pluginName = 'core' ;
2015-02-09 01:05:33 -08:00
protected $eventName = 'wmessage' ;
2015-02-03 12:26:56 -08:00
protected $table = 'generic' ;
protected $pid = 'gen_id' ;
protected $perPage = 10 ;
protected $batchDelete = true ;
protected $batchCopy = true ;
2020-12-02 07:54:55 +01:00
protected $batchExport = true ;
2015-02-03 12:26:56 -08:00
// protected $sortField = 'somefield_order';
// protected $orderStep = 10;
// protected $tabs = array('Tabl 1','Tab 2'); // Use 'tab'=>0 OR 'tab'=>1 in the $fields below to enable.
protected $listQry = " SELECT * FROM `#generic` WHERE gen_type='wmessage' " ; // Example Custom Query. LEFT JOINS allowed. Should be without any Order or Limit.
protected $listOrder = 'gen_id DESC' ;
2017-01-07 17:00:45 +00:00
protected $fields = array (
'checkboxes' => array ( 'title' => '' , 'type' => null , 'data' => null , 'width' => '5%' , 'thclass' => 'center' , 'forced' => '1' , 'class' => 'center' , 'toggle' => 'e-multiselect' , ),
'gen_id' => array ( 'title' => LAN_ID , 'data' => 'int' , 'width' => '5%' , 'help' => '' , 'readParms' => '' , 'writeParms' => '' , 'class' => 'left' , 'thclass' => 'left' , ),
2019-03-19 15:12:17 -07:00
'gen_type' => array ( 'title' => LAN_TYPE , 'type' => 'hidden' , 'data' => 'safestr' , 'width' => 'auto' , 'help' => '' , 'readParms' => '' , 'writeParms' => 'default=wmessage' , 'class' => 'left' , 'thclass' => 'left' , ),
2015-02-03 12:26:56 -08:00
'gen_datestamp' => array ( 'title' => LAN_DATESTAMP , 'type' => 'hidden' , 'data' => 'int' , 'width' => 'auto' , 'filter' => true , 'help' => '' , 'readParms' => '' , 'writeParms' => '' , 'class' => 'left' , 'thclass' => 'left' , ),
2017-01-07 17:00:45 +00:00
'gen_user_id' => array ( 'title' => LAN_AUTHOR , 'type' => 'hidden' , 'data' => 'int' , 'width' => '5%' , 'help' => '' , 'readParms' => '' , 'writeParms' => '' , 'class' => 'left' , 'thclass' => 'left' , ),
2019-03-19 15:12:17 -07:00
'gen_ip' => array ( 'title' => LAN_TITLE , 'type' => 'text' , 'data' => 'safestr' , 'width' => 'auto' , 'inline' => true , 'help' => '' , 'readParms' => '' , 'writeParms' => 'size=xxlarge' , 'class' => 'left' , 'thclass' => 'left' , ),
2017-01-07 17:00:45 +00:00
'gen_intdata' => array ( 'title' => LAN_VISIBILITY , 'type' => 'userclass' , 'data' => 'int' , 'inline' => true , 'batch' => true , 'filter' => true , 'width' => 'auto' , 'help' => '' , 'readParms' => '' , 'writeParms' => '' , 'class' => 'left' , 'thclass' => 'left' , ),
'gen_chardata' => array ( 'title' => LAN_MESSAGE , 'type' => 'bbarea' , 'data' => 'str' , 'width' => 'auto' , 'help' => '' , 'readParms' => '' , 'writeParms' => '' , 'class' => 'center' , 'thclass' => 'center' , ),
2015-02-03 12:26:56 -08:00
'options' => array ( 'title' => LAN_OPTIONS , 'type' => null , 'data' => null , 'width' => '10%' , 'thclass' => 'center last' , 'class' => 'center last' , 'forced' => '1' , ),
);
protected $fieldpref = array ( 'gen_ip' , 'gen_intdata' );
protected $prefs = array (
2017-01-07 17:00:45 +00:00
'wm_enclose' => array ( 'title' => WMLAN_05 , 'type' => 'radio' , 'data' => 'int' , 'help' => WMLAN_06 , 'writeParms' => array ( 'optArray' => array ( 0 => LAN_DISABLED , 1 => LAN_ENABLED , 2 => WMLAN_11 ))),
2015-07-25 18:14:44 -07:00
);
2015-02-03 12:26:56 -08:00
public function init ()
{
}
2019-03-19 15:12:17 -07:00
public function beforeCreate ( $new_data , $old_data )
2015-02-03 12:26:56 -08:00
{
return $new_data ;
}
public function afterCreate ( $new_data , $old_data , $id )
{
// do something
}
public function beforeUpdate ( $new_data , $old_data , $id )
{
return $new_data ;
}
public function afterUpdate ( $new_data , $old_data , $id )
{
e107 :: getCache () -> clear ( " wmessage " );
}
public function onCreateError ( $new_data , $old_data )
{
// do something
}
public function onUpdateError ( $new_data , $old_data , $id )
{
// do something
}
/*
// optional - override edit page.
public function customPage ()
{
$ns = e107 :: getRender ();
$text = 'Hello World!' ;
$ns -> tablerender ( 'Hello' , $text );
}
*/
}
class generic_form_ui extends e_admin_form_ui
{
}
new wmessage_admin ();
require_once ( e_ADMIN . " auth.php " );
e107 :: getAdminUI () -> runPage ();
require_once ( e_ADMIN . " footer.php " );