本文整理汇总了PHP中Options::userGet方法的典型用法代码示例。如果您正苦于以下问题:PHP Options::userGet方法的具体用法?PHP Options::userGet怎么用?PHP Options::userGet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Options
的用法示例。
在下文中一共展示了Options::userGet方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
<th>Group</th>
<th>First Name</th>
<th>Surname</th>
<th>Birthdate</th>
</tr>
</thead>
<tbody>
<?php
foreach ($users as $id => $values) {
echo "<tr>" . nl();
echo "<td>" . $values['username'] . "</td>" . nl();
echo "<td><a class='btn' href='mailto:" . $values['email'] . "?subject=Hi There'>Send Email</i></a></td>" . nl();
echo "<td>" . $values['group'] . "</td>" . nl();
echo "<td>" . Options::userGet($id, 'firstName') . "</td>" . nl();
echo "<td>" . Options::userGet($id, 'surname') . "</td>" . nl();
$dob = Options::userExists($id, 'dateOfBirth') ? time2str(Options::userGet($id, 'dateOfBirth')) : '';
echo "<td>" . $dob . "</td>" . nl();
echo "</tr>" . nl();
}
}
?>
</tbody>
</table>
<?php
if (isset($pager)) {
echo $pager;
}
// Print Pager
} else {
示例2: foreach
<br />
<div class="alert alert-error">
<strong>Warning</strong>
<br />
Changing your password will log you out
</div>
</div>
</div>
<!-- Default settings above, now for the dynamic fields -->
<?php
$options = Options::getList(false, 'User Settings');
if (!empty($options)) {
foreach ($options as $option => $value) {
$type = $value['type'];
// Get the user specific values from the Options_users table
$val = Options::userGet($userId, $option);
$label = camelcase2space($option);
echo '<div class="control-group">' . nl();
echo ' <label class="control-label" for="' . $option . '">' . $label . '</label>' . nl();
echo ' <div class="controls">' . nl();
if ($type == 'input') {
echo '<input type="text" class="input-xlarge" id="' . $option . '" name="' . $option . '" value="' . $val . '">' . nl();
}
if ($type == 'textarea') {
echo '<textarea class="textarea input-xxlarge" id="' . $option . '" name="' . $option . '">' . $val . '</textarea>' . nl();
}
if ($type == 'bool') {
echo bool_select($val, $option);
}
if ($type == 'date') {
echo mdy($val, $option, 'd m y');
示例3: date
$mm = $_POST[$dateOption . $dmy[1]];
} else {
$mm = 1;
}
if (isset($_POST[$dateOption . $dmy[2]])) {
$yyyy = $_POST[$dateOption . $dmy[2]];
} else {
$yyyy = date('Y', time());
}
//echo $dd . "/" . $mm . "/" . $yyyy;
$timestamp = mktime(0, 0, 0, $mm, $dd, $yyyy);
//echo date('r', $timestamp);
// Check if the options exists, then if the value compares otherwise update it.
if (Options::exists($dateOption)) {
// Compare the posted value to the value in the DB and update it if neccesarry
if (htmlspecialchars(Options::userGet($userId, $dateOption)) !== htmlspecialchars($timestamp)) {
// Set the option to the new value
Options::userSet($userId, $dateOption, $timestamp);
$changes = true;
}
}
}
if (isset($_POST['action']) && $_POST['action'] == 'Save Changes') {
// These are the 2 static things in your account a password and a email address
if (isset($_POST['user-email']) && $Error->email($_POST['user-email'], false) && $_POST['user-email'] !== $u->email) {
$u->email = $_POST['user-email'];
$u->update();
Activation::remove($userId);
$link = full_url_to_script('activate.php') . "?action=activate&code=" . Activation::generate($userId) . "&id=" . $userId;
Emailtemplate::setBaseDir('./assets/email_templates');
$html = Emailtemplate::loadTemplate('reactivate', array('title' => 'Reactivation Email', 'prettyName' => Options::get('prettyName'), 'name' => $u->username, 'siteName' => Options::get('emailName'), 'activationLink' => $link, 'footerLink' => Options::get('siteName'), 'footerEmail' => Options::get('emailInfo')));
示例4: fix_slashes
$_REQUEST = fix_slashes($_REQUEST);
$_COOKIE = fix_slashes($_COOKIE);
}
// Load our config settings
$Config = Config::getConfig();
// Run the options and install functions, this would be if there are no information present in the db
require DOC_ROOT . '/includes/install.inc.php';
// Check for installation and create the tables needed
require DOC_ROOT . '/includes/options.inc.php';
// Get the options from the DB
// Store session info in the database?
if (Config::get('useDBSessions') === true) {
DBSession::register();
}
// Initialize our session
session_name('spfs');
session_start();
// Initialize current user
$Auth = Auth::getAuth();
// This dynamically creates the options variables except for the User Settings
foreach (Options::getList(false, false, "WHERE `group`!='User Settings'") as $option => $values) {
${$option} = $values['value'];
}
// This dynamically creates the User Variables
if ($Auth->loggedIn()) {
foreach (Options::getList(false, 'User Settings') as $option => $val) {
${$option} = Options::userGet($Auth->id, $option);
}
}
// Object for tracking and displaying error messages
$Error = Error::getError();