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; } class generic_ui extends e_admin_ui { protected $pluginTitle = WMLAN_00; protected $pluginName = 'core'; protected $eventName = 'wmessage'; protected $table = 'generic'; protected $pid = 'gen_id'; protected $perPage = 10; protected $batchDelete = true; protected $batchCopy = true; // 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'; 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', ), 'gen_type' => array ( 'title' => LAN_TYPE, 'type' => 'hidden', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => 'default=wmessage', 'class' => 'left', 'thclass' => 'left', ), 'gen_datestamp' => array ( 'title' => LAN_DATESTAMP, 'type' => 'hidden', 'data' => 'int', 'width' => 'auto', 'filter' => true, 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'gen_user_id' => array ( 'title' => LAN_ID, 'type' => 'hidden', 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ), 'gen_ip' => array ( 'title' => WMLAN_10, 'type' => 'text', 'data' => 'str', 'width' => 'auto', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => 'size=xxlarge', 'class' => 'left', 'thclass' => 'left', ), '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' => WMLAN_04, 'type' => 'bbarea', 'data' => 'str', 'width' => 'auto', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'center', 'thclass' => 'center', ), '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( 'wm_enclose' => array('title'=> WMLAN_05, 'type'=>'boolean', 'data' => 'int','help'=> WMLAN_06), ); public function init() { } public function beforeCreate($new_data) { 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"); exit; /* require_once(e_HANDLER.'userclass_class.php'); require_once(e_HANDLER."ren_help.php"); $frm = e107::getForm(); $mes = e107::getMessage(); vartrue($action) == ''; if (e_QUERY) { $tmp = explode('.', e_QUERY); $action = $tmp[0]; $sub_action = varset($tmp[1], ''); $id = varset($tmp[2], 0); unset($tmp); } if($_POST) { $e107cache->clear("wmessage"); } if (isset($_POST['wm_update'])) { $data = $_POST['data']; // $tp->toDB($_POST['data']) causes issues with ':' $wm_title = $tp->toDB($_POST['wm_caption']); $wmId = intval($_POST['wm_id']); $updateArray = array( 'gen_chardata' => $data, 'gen_ip' => $wm_title, 'gen_intdata' => $_POST['wm_active'], 'WHERE' => "gen_id=".$wmId ); //$message = ($sql->db_Update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." ")) ? LAN_UPDATED : LAN_UPDATED_FAILED; // if ($sql->update("generic", "gen_chardata ='{$data}',gen_ip ='{$wm_title}', gen_intdata='".$_POST['wm_active']."' WHERE gen_id=".$wmId." ")) if ($sql->update("generic", $updateArray)) { $mes->addSuccess(LAN_UPDATED); welcome_adminlog('02', $wmId, $wm_title); } else { $mes->addError(LAN_UPDATED_FAILED); } } if (isset($_POST['wm_insert'])) { $wmtext = $tp->toDB($_POST['data']); $wmtitle = $tp->toDB($_POST['wm_caption']); welcome_adminlog('01', 0, $wmtitle); //$message = ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) ? LAN_CREATED : LAN_CREATED_FAILED ; if ($sql->db_Insert("generic", "0, 'wmessage', '".time()."', ".USERID.", '{$wmtitle}', '{$_POST['wm_active']}', '{$wmtext}' ")) { $mes->addSuccess(LAN_CREATED); } else { $mes->addError(LAN_CREATED_FAILED); } } if (isset($_POST['updateoptions'])) { $changed = FALSE; foreach (array('wm_enclose','wmessage_sc') as $opt) { $temp = intval($_POST[$opt]); if ($temp != $pref[$opt]) { $pref[$opt] = $temp; $changed = TRUE; } } if ($changed) { save_prefs(); welcome_adminlog('04', 0, $pref['wm_enclose'].', '.$pref['wmessage_sc']); } else { $mes->addInfo(LAN_NOCHANGE_NOTSAVED); } } if (isset($_POST['main_delete'])) { $del_id = array_keys($_POST['main_delete']); welcome_adminlog('03', $wmId, ''); if ($sql->delete("generic", "gen_id='".$del_id[0]."' ")) { $mes->addSuccess(LAN_DELETED); } else { $mes->addError(LAN_DELETED_FAILED); } } echo $mes->render(); // Show Existing ------- if ($action == "main" || $action == "") { if ($wm_total = $sql->select("generic", "*", "gen_type='wmessage' ORDER BY gen_id ASC")) { $wmList = $sql->db_getList(); $text = $frm->open('myform_wmessage','post',e_SELF); $text .= "
".LAN_ID." | ".WMLAN_02." | ".LAN_VISIBILITY." | ".LAN_OPTIONS." |
---|---|---|---|
".$row['gen_id']." | ".strip_tags($tp->toHTML($row['gen_ip']))." | ".r_userclass_name($row['gen_intdata'])." | ".ADMIN_EDIT_ICON." |