当前位置: 首页>>代码示例>>PHP>>正文


PHP Domain::list_all方法代码示例

本文整理汇总了PHP中Domain::list_all方法的典型用法代码示例。如果您正苦于以下问题:PHP Domain::list_all方法的具体用法?PHP Domain::list_all怎么用?PHP Domain::list_all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Domain的用法示例。


在下文中一共展示了Domain::list_all方法的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;
    }
}
开发者ID:bdmihai,项目名称:vmm,代码行数:36,代码来源:domains.php

示例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;
    }
}
开发者ID:bdmihai,项目名称:vmm,代码行数:67,代码来源:users.php

示例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;
    }
}
开发者ID:bdmihai,项目名称:vmm,代码行数:82,代码来源:aliases.php


注:本文中的Domain::list_all方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。