array( 'controller' => 'uclass_ui', 'path' => null, 'ui' => 'uclass_ui_form', 'uipath' => null ), ); protected $adminMenu = array( 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => '4'), 'main/create' => array('caption'=> LAN_CREATE, 'perm' => '4'), 'main/initial' => array('caption'=> UCSLAN_38, 'perm' => '4'), 'main/options' => array('caption'=> LAN_OPTIONS, 'perm' => '4'), // 'main/custom' => array('caption'=> 'Custom Page', 'perm' => 'P') ); protected $adminMenuAliases = array( 'main/edit' => 'main/list' ); protected $menuTitle = ADLAN_38; protected $adminMenuIcon = 'e-userclass-24'; } class uclass_ui extends e_admin_ui { protected $pluginTitle = ADLAN_38; protected $pluginName = 'core'; // protected $eventName = 'userclass'; protected $table = 'userclass_classes'; protected $pid = 'userclass_id'; protected $perPage = 10; protected $batchDelete = true; protected $batchCopy = false; // no way to generate the non-incrementing primary key at the moment // protected $listOrder = 'userclass_id DESC'; //XXX Make more intuitive. protected $listOrder = "CASE WHEN userclass_id = 250 THEN 1 WHEN userclass_id =254 THEN 2 WHEN userclass_id = 253 THEN 3 WHEN userclass_id < 250 THEN 4 END, userclass_id DESC "; // protected $sortField = 'somefield_order'; // protected $orderStep = 10; protected $tabs = null;// 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', ), 'userclass_id' => array('title'=> LAN_ID, 'type' =>'hidden', 'data'=>'int', 'width' => '5%', 'thclass' => 'left'), 'userclass_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'tab'=>0, 'data'=>'str', 'width' => '5%', 'thclass' => 'left', 'class' => 'center'), 'userclass_name' => array('title'=> LAN_NAME, 'type' => 'text', 'tab'=>0,'data'=>'str', 'inline'=>true, 'width' => 'auto', 'thclass' => 'left'), 'userclass_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'text', 'tab'=>0,'data'=>'str', 'inline'=>true,'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('size'=>'xxlarge')), 'userclass_type' => array('title'=> LAN_TYPE, 'type' => 'dropdown', 'tab'=>0,'data'=>'int', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ), 'userclass_editclass' => array('title'=> LAN_MANAGER, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'nobody,public,main,admin,classes,matchclass,member, no-excludes')), 'userclass_visibility' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array()), 'userclass_parent' => array('title'=> LAN_PARENT, 'type' => 'userclass', 'tab'=>0,'data'=>'int', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array('classlist'=>'main,admin,nobody,public,classes,matchclass,member, no-excludes')), 'userclass_perms' => array('title'=> "Perms", 'type' => 'hidden', 'tab'=>0,'data'=>'str', 'width' => 'auto', 'thclass' => 'left', 'writeParms'=>array()), 'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'right', 'readParms' => array('deleteClass' => e_UC_NOBODY)) ); protected $fieldpref = array('userclass_icon', 'userclass_name', 'userclass_description'); /* protected $prefs = array( 'wm_enclose' => array('title'=> WMLAN_05, 'type'=>'boolean', 'data' => 'int','help'=> WMLAN_06), );*/ public function init() { if(E107_DBG_BASIC && isset($_GET['id']) && intval($_GET['id']) === 254) // Experimental { e107::getMessage()->addDebug("Experimental Feature active"); $this->tabs = array(LAN_GENERAL,"Administrator Permissions"); $this->fields['userclass_perms']['type'] = 'method'; $this->fields['userclass_perms']['tab'] = 1; } // Listen for submitted data. $this->initialPageSubmit(); $this->optionsPageSubmit(); if($this->getAction() == 'list') { $this->fields['userclass_id']['type'] = 'number'; } // Set Defaults for when creating new records. $this->fields['userclass_type']['writeParms'] = array(UC_TYPE_STD => UCSLAN_80, UC_TYPE_GROUP => UCSLAN_81); $this->fields['userclass_editclass']['writeParms']['default'] = e_UC_ADMIN; $this->fields['userclass_parent']['writeParms']['default'] = e_UC_NOBODY; $this->fields['userclass_visibility']['writeParms']['default'] = e_UC_ADMIN; $this->fields['userclass_id']['writeParms']['default'] =$this->getUserClassAdmin()->findNewClassID(); } /** * @return Object */ public function getUserClassAdmin() { return e107::getSingleton('user_class_admin'); } public function beforeCreate($new_data, $old_data) { return $new_data; } public function afterCreate($new_data, $old_data, $id) { e107::getUserClass()->clearCache(); $e_userclass = $this->getUserClassAdmin(); $e_userclass->calc_tree(); $e_userclass->save_tree(); } public function beforeUpdate($new_data, $old_data, $id) { if(!empty($new_data['perms'])) { $new_data['userclass_perms'] = implode(".",$new_data['perms']); } e107::getMessage()->addDebug(print_a($new_data,true)); return $new_data; } public function afterUpdate($new_data, $old_data, $id) { e107::getUserClass()->clearCache(); } public function afterDelete($deleted_data,$id, $deleted_check = false) { e107::getUserClass()->clearCache(); } public function onCreateError($new_data, $old_data) { // do something } public function onUpdateError($new_data, $old_data, $id) { // do something } function renderHelp() { $e_userclass = e107::getSingleton('user_class_admin'); // Admin functions - should just obliterate any previous object created in class2.php $e_userclass->calc_tree(); $text = "