本文整理汇总了PHP中Domain::list_by_id方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::list_by_id方法的具体用法?PHP Domain::list_by_id怎么用?PHP Domain::list_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Domain
的用法示例。
在下文中一共展示了Domain::list_by_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
// perform requested actions
switch ($app->action) {
case 'edit_domain':
$var['domain_name'] = Domain::list_by_id($var['domain_id'])->get_name();
break;
case 'insert_new_domain':
$domain = new Domain();
$domain->set_name($var['domain_name']);
if ($domain->insert()) {
$app->reload();
} else {
$app->action = 'new_domain';
}
break;
case 'update_edit_domain':
$domain = Domain::list_by_id($var['domain_id']);
$domain->set_name($var['domain_name']);
if ($domain->update()) {
$app->reload();
} else {
$app->action = 'edit_domain';
}
break;
case 'delete_domain':
$domain = Domain::list_by_id($var['domain_id']);
if ($domain->delete()) {
$app->reload();
}
break;
}
}
示例2: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
if (!isset($var['domain_id'])) {
if (isset($_COOKIE['app/users/domain_id'])) {
$var['domain_id'] = filter_var($_COOKIE['app/users/domain_id'], FILTER_SANITIZE_STRING);
if (Domain::list_by_id($var['domain_id']) == null) {
$var['domain_id'] = 0;
}
} else {
$var['domain_id'] = 0;
}
}
if ($var['domain_id'] != 0) {
$var['users'] = User::list_by_domain_id($var['domain_id']);
$var['active_domain'] = Domain::list_by_id($var['domain_id']);
} else {
$var['users'] = User::list_all();
}
switch ($app->action) {
case 'select_domain':
setcookie('app/users/domain_id', $var['domain_id']);
$app->reload();
break;
case 'edit_user':
$user = User::list_by_id($var['user_id']);
$var['user_email'] = $user->get_email();
$var['user_password'] = '';
if ($user->is_admin()) {
$var['user_admin'] = 'on';
} else {
unset($var['user_admin']);
}
break;
case 'insert_new_user':
$user = new User();
$user->set_email($var['user_email']);
$user->set_password($var['user_password']);
$user->set_domain_id($var['domain_id']);
$user->set_admin(isset($var['user_admin']));
if ($user->insert()) {
$app->reload();
} else {
$app->action = 'new_user';
}
break;
case 'update_edit_user':
$user = User::list_by_id($var['user_id']);
$user->set_email($var['user_email']);
$user->set_password($var['user_password']);
$user->set_admin(isset($var['user_admin']));
if ($user->update()) {
$app->reload();
} else {
$app->action = 'edit_user';
}
break;
case 'delete_user':
$user = User::list_by_id($var['user_id']);
if ($user->delete()) {
$app->reload();
}
break;
}
}
示例3: process_page
function process_page($app, $action, &$var)
{
$var['domain_count'] = Domain::count();
$var['user_count'] = User::count();
$var['domains'] = Domain::list_all();
if (!isset($var['domain_id'])) {
if (isset($_COOKIE['app/aliases/domain_id'])) {
$var['domain_id'] = filter_var($_COOKIE['app/aliases/domain_id'], FILTER_SANITIZE_STRING);
if (Domain::list_by_id($var['domain_id']) == null) {
$var['domain_id'] = 0;
}
} else {
$var['domain_id'] = 0;
}
}
if ($var['domain_id'] != 0) {
$var['users'] = User::list_by_domain_id($var['domain_id']);
$var['active_domain'] = Domain::list_by_id($var['domain_id']);
} else {
$var['users'] = User::list_all();
}
if (!isset($var['user_id'])) {
if (isset($_COOKIE['app/aliases/user_id'])) {
$var['user_id'] = filter_var($_COOKIE['app/aliases/user_id'], FILTER_SANITIZE_STRING);
if (User::list_by_id($var['user_id']) == null) {
$var['user_id'] = 0;
}
} else {
$var['user_id'] = 0;
}
}
if ($var['user_id'] != 0) {
$var['active_user'] = User::list_by_id($var['user_id']);
$var['aliases'] = Alias::list_by_destination($var['active_user']->get_email());
} else {
if ($var['domain_id'] != 0) {
$var['aliases'] = Alias::list_by_domain_id($var['domain_id']);
} else {
$var['aliases'] = Alias::list_all();
}
}
switch ($app->action) {
case 'select_domain':
setcookie('app/aliases/domain_id', $var['domain_id']);
setcookie('app/aliases/user_id', null);
$app->reload();
break;
case 'select_user':
setcookie('app/aliases/user_id', $var['user_id']);
$app->reload();
break;
case 'edit_alias':
$var['alias_source'] = Alias::list_by_id($var['alias_id'])->get_source();
break;
case 'insert_new_alias':
$alias = new Alias();
$alias->set_destination($var['active_user']->get_email());
$alias->set_domain_id($var['domain_id']);
$alias->set_source($var['alias_source']);
if ($alias->insert()) {
$app->reload();
} else {
$app->action = 'new_alias';
}
break;
case 'update_edit_alias':
$alias = Alias::list_by_id($var['alias_id']);
$alias->set_source($var['alias_source']);
if ($alias->update()) {
$app->reload();
} else {
$app->action = 'edit_alias';
}
break;
case 'delete_alias':
$alias = Alias::list_by_id($var['alias_id']);
if ($alias->delete()) {
$app->reload();
}
break;
}
}