From f545a2e01df6a626a6433b13b24030c9815f9f09 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 21 Jan 2017 11:13:14 -0800 Subject: [PATCH] Remove old code. --- e107_admin/userclass2.php | 1273 +------------------------------------ 1 file changed, 14 insertions(+), 1259 deletions(-) diff --git a/e107_admin/userclass2.php b/e107_admin/userclass2.php index e4538fdb3..703ab67dc 100644 --- a/e107_admin/userclass2.php +++ b/e107_admin/userclass2.php @@ -131,6 +131,9 @@ e107::coreLan('userclass2', true); } + /** + * @return Object + */ public function getUserClassAdmin() { return e107::getSingleton('user_class_admin'); @@ -275,7 +278,7 @@ e107::coreLan('userclass2', true); return false; } - $ns = e107::getRender(); + $message = ''; $sql = e107::getDb(); $mes = e107::getMessage(); $e_userclass = $this->getUserClassAdmin(); @@ -323,6 +326,7 @@ e107::coreLan('userclass2', true); // $ns->tablerender('', "
".$message."
"); } + return null; } @@ -332,11 +336,11 @@ e107::coreLan('userclass2', true); $pref = e107::pref('core'); $mes = e107::getMessage(); - $ns = e107::getRender(); + $frm = e107::getForm(); // $e_userclass = $this->getUserClassAdmin(); - $text = ""; + // $text = ""; $initial_classes = varset($pref['initial_user_classes'],''); @@ -378,7 +382,7 @@ e107::coreLan('userclass2', true); $initClassStages = array(1 =>UCSLAN_47, 2=>UCSLAN_48); $text .= UCSLAN_45."
- ".$frm->select('init_class_stage', $initClassStages, $sel_stage)."".UCSLAN_46." + ".$frm->select('init_class_stage', $initClassStages, $sel_stage, 'size=xlarge')."".UCSLAN_46."
". $frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE)."
"; @@ -419,6 +423,8 @@ e107::coreLan('userclass2', true); $pref['initial_user_classes'] = $newval; e107::getConfig()->setPref($pref)->save(true,true,true); + + return true; } @@ -452,6 +458,7 @@ e107::coreLan('userclass2', true); $classID = $this->getController()->getListModel()->get('userclass_id'); + if(!$this->getController()->getUserClassAdmin()->queryCanDeleteClass($classID)) { $options['readParms']['deleteClass'] = e_UC_NOBODY; @@ -474,6 +481,7 @@ e107::coreLan('userclass2', true); return $text; } + return ''; } @@ -490,6 +498,8 @@ e107::coreLan('userclass2', true); return $prm->renderPermTable('tabs',$curVal); } + + return ''; } } @@ -509,1259 +519,4 @@ e107::coreLan('userclass2', true); - -$e_sub_cat = 'userclass'; -//define('UC_DEBUG_OPTS',FALSE); - -require_once(e_HANDLER.'userclass_class.php'); // Modified class handler -$e_userclass = new user_class_admin; // Admin functions - should just obliterate any previous object created in class2.php - // @TODO: Does core object manager need to know somehow? - -require_once(e_HANDLER.'form_handler.php'); - - -$frm = new e_form(); -// $uc = new uclass_manager; -$mes = e107::getMessage(); - - -$message = ''; - -/** - * See whether a user class is editable. - * - * (Note: On fixed classes, only some fields are editable) - * - * @param integer $class_id - * @param boolean $redirect - if TRUE, will redirect to site home page if class not editable. - * @param boolean $fullEdit - set TRUE if full editing required, FALSE if some editing permitted - * - * @return boolean - TRUE if class editable (fully or partially), FALSE if not. - */ -function checkAllowed($classID, $redirect = true, $fullEdit = FALSE) -{ - global $e_userclass; // TODO: Get rid of this (we need the system admin object; not the user-level object) - $editLevel = $fullEdit ? 2 : 1; - if ($e_userclass->queryCanEditClass($classID) >= $editLevel) - { - return TRUE; - } - - if ($redirect) - { - e107::redirect(); - exit; - } - - return FALSE; - - // Next bit probably redundant - editing of some parts of system class data is allowed. - if(!$uc->isEditableClass($class_id)) - { - if(!$redirect) return false; - e107::getMessage()->addSession(UCSLAN_90, E_MESSAGE_ERROR); - header('location:'.e_SELF); - exit; - } - - return true; -} - -if (e_QUERY) -{ - // BC - SO MUCH BAD, never do this at home!!! - if(isset($_GET['action'])) - { - $uc_qs = array($_GET['action'], $_GET['id']); - } - else $uc_qs = explode('.', e_QUERY); -} -$action = varset($uc_qs[0]); -$params = varset($uc_qs[1],''); -e107::setRegistry('pageParams', $uc_qs); - -//AJAX request check is already made by the API -/* -if(e_AJAX_REQUEST) -{ - $class_num = intval($params); - if ($action == 'edit') - { - require_once(e_HANDLER.'js_helper.php'); - $jshelper = new e_jshelper(); - if(!checkAllowed($class_num, false)) - { - //This will raise an error - //'Access denied' is the message which will be thrown - //by the JS AJAX handler - e_jshelper::sendAjaxError('403', 'Access denied. '.UCSLAN_90); - } - elseif($sql->db_Select('userclass_classes', '*', "userclass_id='".$class_num."' ")) - { - $row = $sql->db_Fetch(); - - //Response action - reset all group checkboxes - $jshelper->addResponseAction('reset-checked', array('group_classes_select' => '0')); - - //it's grouped userclass - if ($row['userclass_type'] == UC_TYPE_GROUP) - { - //Response action - show group, hide standard - $jshelper->addResponseAction('element-invoke-by-id', array('show' => 'userclass_type_groups', 'hide' => 'userclass_type_standard')); - - //fill in the classes array - $tmp = explode(',',$row['userclass_accum']); - foreach ($tmp as $uid) - { - $row['group_classes_select_'.$uid] = $uid; - } - } - else - { - //hide group, show standard rows - $jshelper->addResponseAction('element-invoke-by-id', array('hide' => 'userclass_type_groups', 'show' => 'userclass_type_standard')); - } - unset($row['userclass_accum']); - - $jshelper->addResponseAction('fill-form', $row); - $jshelper->sendResponse('XML'); - // $jshelper->sendResponse('JSON'); - another option (tested) - faster transfer! - } - else - { - e_jshelper::sendAjaxError('500', 'Database read error!'); - } - - } - exit; -} - -e107::getJs()->headerCore('core/admin.js'); -*/ - -/* - * Authorization should be done a bit later! - */ -require_once("auth.php"); -$emessage = e107::getMessage(); - -//--------------------------------------------------- -// Set Initial Classes -//--------------------------------------------------- -/* -if (isset($_POST['set_initial_classes'])) -{ - $changed = $pref['init_class_stage'] != intval($_POST['init_class_stage']); - $pref['init_class_stage'] = intval($_POST['init_class_stage']); - $temp = array(); - foreach ($_POST['init_classes'] as $ic) - { - $temp[] = intval($ic); - } - $newval = implode(',', $temp); - $temp = varset($pref['initial_user_classes'],''); - if ($temp != $newval) $changed = TRUE; - if ($changed) - { - $pref['initial_user_classes'] = $newval; - save_prefs(); - userclass2_adminlog("05","New: {$newval}, Old: {$temp}, Stage: ".$pref['init_class_stage']); - $message = UCSLAN_41; - } - else - { - $message = LAN_NOCHANGE_NOTSAVED; - } -} -*/ - -//--------------------------------------------------- -// Delete existing class -//--------------------------------------------------- - -/* -if (isset($_POST['etrigger_delete']) && !empty($_POST['etrigger_delete'])) -{ - $classID = intval(array_shift(array_keys($_POST['etrigger_delete']))); - //checkAllowed($classID); - - if ($e_userclass->queryCanDeleteClass($classID)) - { - if ($e_userclass->delete_class($class_id) !== FALSE) - { - userclass2_adminlog("02","ID:{$class_id} (".$e_userclass->uc_get_classname($classID).")"); - if ($sql->db_Select('user', 'user_id, user_class', "user_class = '{$classID}' OR user_class REGEXP('^{$classID},') OR user_class REGEXP(',{$classID},') OR user_class REGEXP(',{$classID}$')")) - { // Delete existing users from class - while ($row = $sql->db_Fetch()) - { - $uidList[$row['user_id']] = $row['user_class']; - } - $e_userclass->class_remove($classID, $uidList); - } - $e_pref = e107::getConfig(); - if($e_pref->isData('frontpage/'.$classID)) - { - $e_pref->removePref('frontpage/'.$classID)->save(false); - } - // if (isset($pref['frontpage'][$class_id])) - { - // unset($pref['frontpage'][$class_id]); // (Should work with both 0.7 and 0.8 front page methods) - // save_prefs(); - } - $emessage->add(LAN_DELETED, E_MESSAGE_SUCCESS); - } - else - { - $emessage->add(UCSLAN_10, E_MESSAGE_ERROR); - } - } - else - { - $emessage->add(UCSLAN_10, E_MESSAGE_ERROR); - } -}*/ - - - -//--------------------------------------------------- -// Add/Edit class information -//--------------------------------------------------- -/* - -if (isset($_POST['createclass'])) // Add or edit -{ - $fullEdit = TRUE; // Most of the time, we are allowed to edit everything - $do_tree = FALSE; // Set flag to rebuild tree if no errors - $forwardVals = FALSE; // Set to ripple through existing values to a subsequent pass - - $tempID = intval(varset($_POST['userclass_id'], -1)); - if (($tempID < 0) && $e_userclass->ucGetClassIDFromName($class_record['userclass_name'])) - { - $emessage->add(UCSLAN_63, E_MESSAGE_WARNING); // Duplicate name - $forwardVals = TRUE; - } - if ($tempID > 0) - { - $fullEdit = $e_userclass->queryCanEditClass($tempID) == 2; - } - - $class_record = array( - 'userclass_description' => varset($tp->toDB($_POST['userclass_description']),''), - 'userclass_editclass' => intval(varset($_POST['userclass_editclass'],0)), - 'userclass_parent' => intval(varset($_POST['userclass_parent'],0)), - 'userclass_visibility' => intval(varset($_POST['userclass_visibility'],0)), - 'userclass_icon' => $tp->toDB(varset($_POST['userclass_icon'],'')) - ); - - if ($fullEdit) - { - $class_record['userclass_name'] = varset($tp->toDB($_POST['userclass_name']),''); - $class_record['userclass_type'] = intval(varset($_POST['userclass_type'],UC_TYPE_STD)); - if ($class_record['userclass_type'] == UC_TYPE_GROUP) - { - $temp = array(); - foreach ($_POST['group_classes_select'] as $gc) - { - $temp[] = intval($gc); - } - $class_record['userclass_accum'] = implode(',',$temp); - } - } - - - if ($e_userclass->checkAdminInfo($class_record, $tempID) === FALSE) - { - $emessage->add(UCSLAN_86); // Some fixed values changed - $forwardVals = TRUE; - } - - if (!$forwardVals) - { - if ($tempID > 0) - { // Editing existing class here - checkAllowed($tempID); - $class_record['userclass_id'] = $tempID; - $e_userclass->save_edited_class($class_record); - userclass2_adminlog('03',"ID:{$class_record['userclass_id']} (".$class_record['userclass_name'].")"); - $do_tree = TRUE; - //$message .= LAN_UPDATED.': '.LAN_USERCLASS; - $emessage->add(LAN_UPDATED.': '.LAN_USERCLASS, E_MESSAGE_SUCCESS); - } - else - { // Creating new class - if($class_record['userclass_name']) - { - if (getperms("0") || ($class_record['userclass_editclass'] && check_class($class_record['userclass_editclass']))) - { - $i = $e_userclass->findNewClassID(); - if ($i === FALSE) - { - //$message = UCSLAN_85; - $emessage->add(UCSLAN_85, E_MESSAGE_WARNING); - } - else - { - $class_record['userclass_id'] = $i; - $e_userclass->add_new_class($class_record); - userclass2_adminlog("01","ID:{$class_record['userclass_id']} (".$class_record['userclass_name'].")"); - $do_tree = TRUE; - //$message .= LAN_UPDATED.': '.LAN_USERCLASS; - $emessage->add(LAN_UPDATED.': '.LAN_USERCLASS, E_MESSAGE_SUCCESS); - } - } - else - { - header("location:".SITEURL); - exit; - } - } - else - { - // Class name required - //$message = UCSLAN_37; - $emessage->add(UCSLAN_37, E_MESSAGE_ERROR); - $forwardVals = TRUE; - } - } - } - - if ($do_tree) - { - $e_userclass->calc_tree(); - $e_userclass->save_tree(); - } -} -*/ - -/* -if ($message) -{ - $emessage->add($message); -} - -class uclassFrm extends e_form -{ - function userclass_type($curVal,$mode) - { - $types = array( - UC_TYPE_STD => UCSLAN_80, - UC_TYPE_GROUP => UCSLAN_81 - ); - - return varset($types[$curVal]); - } -} -*/ - - -/* -if(!e_QUERY || $action == 'list') -{ - $uc->show_existing(); - -} -*/ -if(isset($_GET['id']) && $_GET['action'] == 'edit') -{ - $action = 'config'; - $_POST['existing'] = $_GET['id']; -} - -switch ($action) -{ -//----------------------------------- -// Class management -//----------------------------------- - case 'config' : - $fullEdit = TRUE; - if(isset($_POST['existing'])) - { - $params = 'edit'; - $class_num = intval(varset($_POST['existing'],0)); - $fullEdit = $e_userclass->queryCanEditClass($class_num) == 2; - } - else - { - $class_num = intval(varset($uc_qs[2],0)); - } - - $userclass_id = 0; // Set defaults for new class to start with - $userclass_name = ''; - $userclass_description = ''; - $userclass_editclass = e_UC_ADMIN; - $userclass_visibility = e_UC_ADMIN; - $userclass_parent = e_UC_NOBODY; - $userclass_icon = ''; - $userclass_type = UC_TYPE_STD; - $userclass_groupclass = ''; - if ($params == 'edit' || $forwardVals) - { - if (!isset($forwardVals)) - { // Get the values from DB (else just recycle data uer was trying to store) - checkAllowed($class_num); - $sql->db_Select('userclass_classes', '*', "userclass_id='".intval($class_num)."' "); - $class_record = $sql->db_Fetch(); - $userclass_id = $class_record['userclass_id']; // Update fields from DB if editing - } - $userclass_name = $class_record['userclass_name']; - $userclass_description = $class_record['userclass_description']; - $userclass_editclass = $class_record['userclass_editclass']; - $userclass_visibility = $class_record['userclass_visibility']; - $userclass_parent = $class_record['userclass_parent']; - $userclass_icon = $class_record['userclass_icon']; - $userclass_type = $class_record['userclass_type']; - if ($userclass_type == UC_TYPE_GROUP) - { - $userclass_groupclass = $class_record['userclass_accum']; - } - } - - $class_total = $sql->db_Count('userclass_classes', '(*)'); - - $text = "
-
- - - - - - "; - - - $text .= " - - - - - - - - - "; - -// Userclass icon - $text .= " - - - - - "; - - $text .= " - - - - - "; - - // Who can manage class - $text .= " - - - - - "; - - // List of class checkboxes for grouping - $text .= " - - - - - "; - - - $text .= " - - - - - "; - - $text .= " - - - -
".LAN_NAME.""; - if ($fullEdit) - { - $text .= ""; - } - else - { - $text .= "{$userclass_name}"; - } - $text .= "
".UCSLAN_30."
".LAN_DESCRIPTION." -
".UCSLAN_31."
".LAN_ICON."".$frm->iconpicker('userclass_icon', $userclass_icon, LAN_SELECT)." -
".UCSLAN_69."
".LAN_TYPE.""; - $classTypes = array(UC_TYPE_STD => UCSLAN_80, UC_TYPE_GROUP => UCSLAN_81); - if ($fullEdit) - { - $text .= "\n - \n"; - } - else - { - $text .= $classTypes[$userclass_type].""; - } - $text .= "
".UCSLAN_82."
".LAN_VISIBILITY.""; - $text .= "'; - $text .= "
".UCSLAN_33."
".LAN_PARENT.""; - $text .= "'; -// .r_userclass("userclass_parent", $userclass_parent, "off", "admin,classes,matchclass,public,member"). - $text .= "
".UCSLAN_36."
- "; - - - $text .= " -
"; - -if($params == 'edit') -{ - $text .= $frm->admin_button('createclass', LAN_UPDATE, 'create'); - $text .= $frm->admin_button('updatecancel', LAN_CANCEL, 'cancel'); - // $text .= ""; - // $text .= "  "; - $text .= " - - "; -} -else -{ - $text .= $frm->admin_button('createclass', LAN_CREATE, 'create'); - $text .= $frm->admin_button('updatecancel', LAN_CANCEL, 'cancel'); - // $text .= " - //   "; - $text .= " - "; -} - -$text .= "
"; -$text .= "


"; - - -// $text .= $e_userclass->show_graphical_tree(); - -$title = $params == 'edit' ? LAN_EDIT : LAN_CREATE; -$ns->tablerender(ADLAN_38.SEP.$title, $text); -unset($title); - break; // End of 'config' option - - - - -//----------------------------------- -// Initial User class(es) -//----------------------------------- -/* - case 'initial' : - - $initial_classes = varset($pref['initial_user_classes'],''); - $irc = explode(',',$initial_classes); - $icn = array(); - foreach ($irc as $i) - { - if (trim($i)) $icn[] = $e_userclass->uc_get_classname($i); - } - -// $class_text = $e_userclass->uc_checkboxes('init_classes', $initial_classes, 'classes, force', TRUE); - $class_text = $e_userclass->vetted_tree('init_classes',array($e_userclass,'checkbox_desc'), $initial_classes, 'classes, force, no-excludes'); - - $mes->addInfo(UCSLAN_49); - - $text = "
-
- - -
".UCSLAN_43.""; - - if (count($icn) > 0) - { - // $text .= implode(', ',$icn); - } - else - { - $text .= LAN_NONE; - } - - - if ($class_text) - { - $text .= $class_text."
"; - $sel_stage = varset($pref['init_class_stage'],2); - $text .= UCSLAN_45."
- ".UCSLAN_46.""; - $text .= "
-
". - $frm->admin_button('set_initial_classes','no-value','create',LAN_UPDATE) - ."
"; - } - else - { - $text .= UCSLAN_39; - } - - $text .= "
"; - $ns->tablerender(ADLAN_38.SEP.UCSLAN_40, $mes->render() . $text); - - break; // End of 'initial' -*/ - -//----------------------------------- -// Debug aids -//----------------------------------- - case 'debug' : -// if (!check_class(e_UC_MAINADMIN)) break; // Let ordinary admins see this if they know enough to specify the URL - $text .= $e_userclass->show_graphical_tree(TRUE); // Print with debug options - $ns->tablerender(LAN_SETTINGS, $text); - - $text = " - "; - $sql->db_Select('user','user_id,user_name,user_class',"ORDER BY user_id LIMIT 0,20",'no_where'); - while ($row = $sql->db_Fetch()) - { - $inherit = $e_userclass->get_all_user_classes($row['user_class']); - $text .= " - - - - "; - } - $text .= "
Class rights for first 20 users in database
User IDDisp NameRaw classesInherited classesEditable classes
".$row['user_id']."".$row['user_name']."".$row['user_class']."".$inherit."".$e_userclass->get_editable_classes($inherit)."
"; - $ns->tablerender(LAN_SETTINGS, $text); - break; // End of 'debug' - - -//----------------------------------- -// Configuration options -//----------------------------------- - case 'options' : - /* - if (!check_class(e_UC_MAINADMIN)) break; - - if (isset($_POST['add_class_tree'])) - { // Create a default tree - $message = UCSLAN_62; - $e_userclass->set_default_structure(); - $e_userclass->calc_tree(); - $e_userclass->save_tree(); - $e_userclass->readTree(TRUE); // Need to re-read the tree to show correct info - $message .= UCSLAN_64; - } - - if (isset($_POST['flatten_class_tree'])) - { // Remove the default tree - $message = UCSLAN_65; - $sql->db_Update('userclass_classes', "userclass_parent='0'"); - $e_userclass->calc_tree(); - $e_userclass->save_tree(); - $e_userclass->readTree(TRUE); // Need to re-read the tree to show correct info - $message .= UCSLAN_64; - } - - if (isset($_POST['rebuild_tree'])) - { - $message = UCSLAN_70; - $e_userclass->calc_tree(); - $e_userclass->save_tree(); - $message .= UCSLAN_64; - } - - if ($params == 'xml') $params = '.xml'; else $params = ''; - - if (isset($_POST['create_xml_db']) && ($params == '.xml')) - { - $message = $e_userclass->makeXMLFile() ? 'XML file created' : 'Error creating XML file'; - } - - if ($message) - { - $ns->tablerender('', "
".$message."
"); - } - - $mes = e107::getMessage(); - - $mes->addWarning(LAN_OPTIONS."
".UCSLAN_53); - - $text = "
- - - - - - - - - - "; - if ($params == '.xml') - { - $text .= " - - "; - - } - $text .= "
".UCSLAN_54."
".UCSLAN_57."
-
- ".$frm->admin_button('add_class_tree','no-value','delete', UCSLAN_58)." -
".UCSLAN_55."
".UCSLAN_56."
-
- ".$frm->admin_button('flatten_class_tree','no-value','delete', UCSLAN_58)." -
".'Create XML file of DB'."
".'Dev aid to set initial values'."
-
- ".$frm->admin_button('create_xml_db','no-value','create', 'Create')." -
"; - - $ns->tablerender(ADLAN_38.SEP.LAN_PREFS, $mes->render().$text); - - - $text = "
- - - - - - - - - -
".UCSLAN_72."
- ".UCSLAN_73." -
- ".$frm->admin_button('rebuild_tree','no-value','delete', UCSLAN_58)." -
-
"; - - $ns->tablerender(UCSLAN_71, $text); - - break; // End of 'options' -*/ - -//----------------------------------- -// Test options -//----------------------------------- - case 'test' : - if (!check_class(e_UC_MAINADMIN)) break; - break; // ...And disable for everyone at present - if (isset($_POST['add_db_fields'])) - { // Add the extra DB fields - $message = "Add DB fields: "; - $e_userclass->update_db(FALSE); - $message .= "Completed"; - } - - if (isset($_POST['remove_db_fields'])) - { // Remove the DB fields - $message = "Remove DB fields: "; - $sql->gen("ALTER TABLE #userclass_classes DROP `userclass_parent`, DROP `userclass_accum`, DROP `userclass_visibility`"); - $message .= "Completed"; - } - - if (isset($_POST['add_class_tree'])) - { // Create a default tree - $message = "Create default class tree: "; - if (!$e_userclass->update_db(TRUE)) - { - $message .= "Must add new DB fields first"; - } - else - { - $e_userclass->set_default_structure(); - $e_userclass->read_tree(TRUE); // Need to re-read the tree to show correct info - $message .= "Completed"; - } - } - - if (isset($_POST['remove_class_tree'])) - { // Remove the default tree - $message = "Remove default class tree: "; - $sql->db_Delete("userclass_classes","`userclass_id` IN (".implode(',',array(e_UC_MAINADMIN,e_UC_MEMBER, e_UC_ADMIN, e_UC_ADMINMOD, e_UC_MODS, e_UC_USERS, e_UC_READONLY)).") "); - $e_userclass->read_tree(TRUE); // Need to re-read the tree to show correct info - $message .= "completed"; - } - - if (isset($_POST['rebuild_tree'])) - { - $message = 'Rebuilding tree: '; - $e_userclass->calc_tree(); - $e_userclass->save_tree(); - $message .= " completed"; - } - - if ($message) - { - $ns->tablerender("", "
".$message."
"); - } - - $db_status = "Unknown"; - $db_status = $e_userclass->update_db(TRUE) ? "Updated" : "Original"; - $text = "
-
- - "; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - $text .= ""; - - $text .= "
Test Functions and Information
DB Status: ".$db_status."
First required stepReverse the process
Optional default treeDeletes the 'core' class entries
Sets up all the structuresSpare
 
".$e_userclass->show_tree(TRUE)."
"; - - $text .= "
-
"; - $ns->tablerender('User classes - test features', $text); - break; // End of temporary test options - - -//----------------------------------- -// Special fooling around -//----------------------------------- - case 'special' : - if (!check_class(e_UC_MAINADMIN)) break; // Let main admins see this if they know enough to specify the URL - - $text = "
-
"; - - - $text .= "\n"; - $ns->tablerender('Select box with nested items', $text); - - $text = "\n"; - $ns->tablerender('Multiple Select box with nested items', $text); - - $checked_class_list = implode(',',$_POST['classes_select']); - $text = "
"; - $text .= $e_userclass->vetted_tree('classes_select', array($e_userclass,'checkbox'), $checked_class_list, 'is-checkbox'); - $text .= "Classes: ".$checked_class_list; - $text .= ""; - $text .= $e_userclass->vetted_tree('normalised_classes_select', array($e_userclass,'checkbox'), $e_userclass->normalise_classes($checked_class_list), 'is-checkbox'); - $text .= "Normalised Classes: ".$e_userclass->normalise_classes($checked_class_list); - $text .= "
"; - $ns->tablerender('Nested checkboxes, showing the effect of the normalise() routine', $text); - - $text = "Single class: ".$_POST['class_select']."
- Multi-select: ".implode(',',$_POST['multi_class_select'])."
- Check boxes: ".implode(',',$_POST['classes_select'])."
"; - $text .= " -
"; - $ns->tablerender('Click on the button - the settings above should be remembered, and the $_POST values displayed', $text); - break; // End of 'debug' - -} // End - switch ($action) - - - - -/** - * Log event to admin log - * - * @param string $msg_num - 2-digit event number (MUST be as a string) - * @param string $woffle - log detail - * - * @return none - */ -function userclass2_adminlog($msg_num='00', $woffle='') -{ - e107::getAdminLog()->log_event('UCLASS_'.$msg_num,$woffle,E_LOG_INFORMATIVE,''); -} - -/* -function userclass2_adminmenu() -{ - $tmp = array(); - if (e_QUERY) - { - $tmp = explode(".", e_QUERY); - } - $action = vartrue($tmp[0],'list'); - if(isset($_GET['action']) && 'edit' == $_GET['action']) $action = 'list'; - - $var['list']['text'] = LAN_MANAGE; - $var['list']['link'] = 'userclass2.php'; - - - $var['config']['text'] = LAN_CREATE; // UCSLAN_25; - $var['config']['link'] = 'userclass2.php?config'; - -//DEPRECATED - use admin->users instead. - -// $var['membs']['text'] = UCSLAN_26; -// $var['membs']['link'] ='userclass2.php?membs'; - - - $var['initial']['text'] = UCSLAN_38; - $var['initial']['link'] ='userclass2.php?initial'; - - if (check_class(e_UC_MAINADMIN)) - { - $var['options']['text'] = LAN_PREFS; // UCSLAN_50; - $var['options']['link'] ='userclass2.php?options'; - - if (defined('UC_DEBUG_OPTS')) - { - $var['debug']['text'] = UCSLAN_27; - $var['debug']['link'] ='userclass2.php?debug'; - - $var['test']['text'] = 'Test functions'; - $var['test']['link'] ="userclass2.php?test"; - - $var['specials']['text'] = 'Special tests'; - $var['specials']['link'] ="userclass2.php?special"; - } - } - show_admin_menu(ADLAN_38, $action, $var); -} -*/ - - - - -/* - -class uclass_manager -{ - public function __construct() - { - global $user_pref; - if(isset($_POST['etrigger_ecolumns'])) - { - $user_pref['admin_userclass_columns'] = $_POST['e-columns']; - save_prefs('user'); - } - - $this->fieldpref = (varset($user_pref['admin_userclass_columns'])) ? $user_pref['admin_userclass_columns'] : array("userclass_id","userclass_name","userclass_description"); - - $this->fields = array( - 'userclass_icon' => array('title'=> LAN_ICON, 'type' => 'icon', 'width' => '5%', 'thclass' => 'center', 'class' => 'center'), - 'userclass_id' => array('title'=> LAN_ID, 'type' => 'int', 'width' => '5%', 'thclass' => 'left'), - 'userclass_name' => array('title'=> LAN_NAME, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_description' => array('title'=> LAN_DESCRIPTION, 'type' => 'text', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_editclass' => array('title'=> LAN_MANAGER, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_parent' => array('title'=> LAN_PARENT, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_visibility' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'width' => 'auto', 'thclass' => 'left'), - 'userclass_type' => array('title'=> LAN_TYPE, 'type' => 'method', 'width' => '10%', 'thclass' => 'left', 'class'=>'left' ), - 'options' => array('title'=> LAN_OPTIONS, 'type' => null, 'width' => '10%', 'thclass' => 'center last', 'forced'=>TRUE, 'class'=>'right', 'readParms' => array('deleteClass' => e_UC_NOBODY)) - ); - - } - - - -// Show list of existing userclasses, followed by graphical tree of the hierarchy - - public function show_existing() - { - global $e_userclass; - - $tp = e107::getParser(); - $sql = e107::getDb(); - $frm = new uclassFrm; - $ns = e107::getRender(); - $mes = e107::getMessage(); - - - if (!$total = $sql->db_Select('userclass_classes', '*')) - { - $text = ""; - $mes->add(LAN_NO_RECORDS_FOUND, E_MESSAGE_INFO); - - } - else - { - $text = "
-
- ".LAN_UPDATED.': '.LAN_USERCLASS." - ". - $frm->colGroup($this->fields,$this->fieldpref). - $frm->thead($this->fields,$this->fieldpref). - - ""; - $classes = $sql->db_getList('ALL', FALSE, FALSE); - - foreach($classes as $row) - { - $this->fields['options']['readParms']['deleteClass'] = $e_userclass->queryCanDeleteClass($row['userclass_id']) ? '' : e_UC_NOBODY; - $text .= $frm->renderTableRow($this->fields, $this->fieldpref, $row, 'userclass_id'); - } - - $text .= "
"; - } - - // $text .= $e_userclass->show_graphical_tree(); // Show the tree as well - sometimes more useful - - $ns->tablerender(ADLAN_38, $mes->render().$text ); - - } -} - -require_once(e_ADMIN.'footer.php'); -*/ - - -// @TODO: Is this function still required? - Yes - setGroupStatus() used on class add/edit page -function headerjs() -{ - $params = e107::getRegistry('pageParams'); - /* - * e107Ajax.fillForm demonstration - * Open Firebug console for Ajax transaction details - * - */ - $script_js = "\n"; - - if ($params[0] != 'membs') return $script_js; - -// We only want this JS on the class membership selection page -// XXX memebs action is deprecated now, remove this script? - $script_js .= "\n"; - return $script_js; -} - - ?> \ No newline at end of file