function getAllUserSettings($user_id, $con) { $types = array("request", "pm", "requester", "donator"); $types_text = array("ประกาศขอเลือด", "ข้อความส่วนตัว", "มีผู้บริจาค", "สถานะการบริจาค"); $settings = array(); foreach ($types as $i => $type) { $setting = array("type" => $type, "type_text" => $types_text[$i], "value" => getUserSettings($user_id, $type, $con)); array_push($settings, $setting); } return $settings; }
$General = new General($connGroupjoleAdodb); //user settings function getUserSettings($General) { $userId = !empty($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : ''; $query = "select * from dcomerce_settings WHERE user_id = ?"; $returnSettings = $General->fetchRow($query, array($userId), 1500); return $returnSettings; } function clearUserSettings($General) { $userId = !empty($_SESSION['user']['user_id']) ? $_SESSION['user']['user_id'] : ''; $query = "select * from dcomerce_settings WHERE user_id = ?"; $General->clearCache($query, array($userId)); return true; } //end user settings $returnSettings = getUserSettings($General); //functions end $pageTitle = 'Dcommerce'; $page = 'home'; $p = !empty($_GET['p']) ? $_GET['p'] : 'home'; //$p = str_replace('.mk', '', $p); if (!empty($p) && file_exists('pages/' . $p . '.php')) { $page = $p; } $fileToInclude = 'pages/' . $page . '.php'; ob_start(); include $fileToInclude; $contentForTemplate = ob_get_clean(); include 'theme3/index.php';
<?php require 'core/sessions.php'; require 'core/functions.php'; include 'includes/head.php'; startSession(); getGetVar(); getUserToken($id); include 'includes/header.php'; if ($_COOKIE['online'] == $userID) { getUserSettings($userID); $db = new dbConnect(); $connection = $db->connection(); foreach ($options as $option) { $sql = mysqli_query($connection, "SELECT " . $option . " FROM user_settings WHERE userID = '{$userID}'"); $row = mysqli_fetch_array($sql); $val = $row[$option]; unabbr($option); echo '<div id="settings"> <div class="left"> <p class="col_name_settings">' . $col . '</p> </div> <div class="middle"> <div class="settings_col settings_' . $option . '" id="' . $option . '_id"> ' . $val . '</div> <input type="text" class="settings_col_input" name="set_' . $option . '" value="' . $val . '" id="' . $option . '_input"> <hr> </div> <div class="right"> <div id="edit_settings_btn" class="edit_' . $option . '"><img src="img/edit_setting.png" height="20px" style="margin-top:-4px;"> </div> <div id="edit_settings_btn" class="done_' . $option . '"><img src="img/done.png" height="20px" style="margin-top:-4px;"> </div> </div>
if (!empty($groups) && sizeof($groups) > 1 && !$userIsExcluded) { $chooseGroupStyle = ""; } if (!empty($groups) && sizeof($groups) > 0 && $userIsAdmin) { $setEndDateStyle = ""; } if ($userIsAdmin) { $showUserSettingsStyle = ''; $f_params = array(); $f_params['excludedFromDashboardUserGuids'] = $excludedFromDashboardUserGuids; $f_params['monitorGroupGuids'] = $monitorGroupGuids; $f_params['key'] = "TOC"; // NOTE don't show TOC user settings anymore // $userSettingsForTOC = getUserSettings($f_params); $f_params['key'] = "shareWithOthers"; $userSettingsForShareWithOthers = getUserSettings($f_params); } } ?> <p> <div style="<?php echo elgg_echo($TOCStyle); ?> "> <?php echo elgg_echo("activityAndPerformanceDashboard:TOC"); ?> :<br/> <select name="params[TOC]"> <?php