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


PHP Team::exists方法代码示例

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


在下文中一共展示了Team::exists方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _ops_delete

function _ops_delete($OID = 0, $CID = 0)
{
    $OID = max(0, intval($OID));
    $CID = max(0, intval($CID));
    $msg = '';
    loginRequireMgmt();
    if (!loginCheckPermission(USER::MGMT_TEAM)) {
        redirect("errors/401");
    }
    $itemName = "Team";
    $urlPrefix = "mgmt_team";
    $object = new Team($OID, $CID);
    if (!$object->exists()) {
        $msg = "{$itemName} not found!";
    } else {
        transactionBegin();
        if ($object->delete()) {
            transactionCommit();
            $msg = "{$itemName} deleted!";
        } else {
            TransactionRollback();
            $msg = "{$itemName} delete failed!";
        }
    }
    redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:ops_delete.php

示例2: _edit_score

function _edit_score($OID = 0, $CID = 0)
{
    loginRequireMgmt();
    if (!loginCheckPermission(USER::MGMT_TEAM)) {
        redirect("errors/401");
    }
    $item = "Team";
    $urlPrefix = "mgmt_team";
    $object = new Team();
    $object->retrieve($OID, $CID);
    if (!$object->exists()) {
        $data['body'][] = "<p>{$item} Not Found!</p>";
    } else {
        $fdata['form_heading'] = "Edit {$item} Score";
        $fdata['object'] = $object;
        $fdata['actionUrl'] = myUrl("{$urlPrefix}/ops_update_score");
        $fdata['actionLabel'] = "Submit";
        $fdata['cancelUrl'] = myUrl("{$urlPrefix}/manage");
        $fdata['cancelLabel'] = "Cancel";
        $form = View::do_fetch(VIEW_PATH . "{$urlPrefix}/score_form.php", $fdata);
        $data['head'][] = View::do_fetch(VIEW_PATH . "{$urlPrefix}/score_form_js.php");
        $data['body'][] = "<h2>Edit {$item} Score</h2>";
        $data['body'][] = $form;
    }
    View::do_dump(VIEW_PATH . 'layouts/mgmtlayout.php', $data);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:26,代码来源:edit_score.php

示例3: _ops_update_score

function _ops_update_score()
{
    $OID = max(0, intval($_POST['OID']));
    $CID = max(0, intval($_POST['CID']));
    $msg = "";
    loginRequireMgmt();
    if (!loginCheckPermission(USER::MGMT_TEAM)) {
        redirect("errors/401");
    }
    $itemName = "Team";
    $urlPrefix = "mgmt_team";
    $object = new Team();
    if ($OID) {
        $object->retrieve($OID, $CID);
        if (!$object->exists()) {
            $msg = "{$itemName} not found!";
        } else {
            transactionBegin();
            if ($object->updateTotalScore()) {
                Event::createEvent(EVENT::TYPE_EDIT, $object, Station::getRegistrationStation(), 0, $_POST);
                // just put the post data into the event
                transactionCommit();
                $msg = "{$itemName} updated!";
            } else {
                transactionRollback();
                $msg = "{$itemName} update failed";
            }
        }
    } else {
        $msg = "attempting to create team from ops_update_score which is not supported";
    }
    redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:33,代码来源:ops_update_score.php

示例4: _ops_update

function _ops_update()
{
    $OID = max(0, intval($_POST['OID']));
    $CID = max(0, intval($_POST['CID']));
    $msg = "";
    loginRequireMgmt();
    if (!loginCheckPermission(USER::MGMT_TEAM)) {
        redirect("errors/401");
    }
    $itemName = "Team";
    $urlPrefix = "mgmt_team";
    $object = new Team();
    if ($OID) {
        $object->retrieve($OID, $CID);
        if (!$object->exists()) {
            $msg = "{$itemName} not found!";
        } else {
            transactionBegin();
            $object->merge($_POST);
            if ($object->update()) {
                transactionCommit();
                $msg = "{$itemName} updated!";
            } else {
                transactionRollback();
                $msg = "{$itemName} update failed";
            }
        }
    } else {
        $object->merge($_POST);
        for ($retry = 0; $retry < PIN_RETRY_MAX; $retry++) {
            $pin = Team::generatePIN();
            if (Team::getFromPin($pin) === false) {
                // not a duplicate
                $object->set('pin', $pin);
                transactionBegin();
                if ($object->create() !== false) {
                    transactionCommit();
                    $msg = "{$itemName} created!";
                    break;
                }
            }
        }
        if ($retry >= PIN_RETRY_MAX) {
            transactionRollback();
            $msg = "{$itemName} Create failed";
        }
    }
    redirect("{$urlPrefix}/manage", $msg);
}
开发者ID:brata-hsdc,项目名称:brata.masterserver,代码行数:49,代码来源:ops_update.php


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