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


PHP Team::isAdmin方法代码示例

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


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

示例1: getByLink

 /**
  * @param $link
  * @return Season
  */
 public static function getByLink($link)
 {
     foreach (Season::find('1=1') as $season) {
         if (($season->ispublic || Team::isAdmin()) && $season->getLink() == $link) {
             return $season;
         }
     }
 }
开发者ID:xJakub,项目名称:LCE,代码行数:12,代码来源:Season.php

示例2: show


//.........这里部分代码省略.........

            if ($this->team->isManager()) {
                $this->checkPlayerChanges();
            }
            $this->showPlayers();
            if ($this->team->isManager()) {
                $this->showPlayersEditor();
            }

            $sanctionLevels = Sanction::getLevelNames();

            $sanctions = Sanction::find('seasonid = ? and teamid = ? order by dateline desc',
                [$this->season->seasonid, $this->team->teamid]);

            if ($sanctions && Team::isMember()) {
                ?>
                <h2>Sanciones recibidas</h2>
                <table style="min-width: 512px">
                    <thead>
                    <tr>
                        <!-- <td>Fecha</td> -->
                        <td>Tipo</td>
                        <td>Razón</td>
                    </tr>
                    </thead>

                    <? foreach($sanctions as $sanction) { ?>
                        <tr>
                            <!-- <td style="font-style: italic">
                                <?= date("Y-m-d H:i:s", $sanction->dateline) ?>
                            </td> -->
                            <td>
                                <?= $sanctionLevels[$sanction->level] ?>
                                <? if (Team::isAdmin()) { ?>
                                    <i style="color: #666">
                                        por
                                    </i>
                                    <?= htmlentities($sanction->adminname) ?>
                                <? } ?>
                            </td>
                            <td>
                                <?= htmlentities($sanction->reason) ?>
                            </td>
                        </tr>
                    <? } ?>
                </table><br>

                <?
            }

            if (Team::isAdmin()) {

                $postCsrf = HTMLResponse::fromPOST('sanctioncsrf', '');

                if ($postCsrf == $csrf) {
                    if (strlen($reason = HTMLResponse::fromPOST('sanctionreason'))) {
                        $sanction = Sanction::create();
                        $sanction->adminid = TwitterAuth::getUserId();
                        $sanction->adminname = TwitterAuth::getUserName();
                        $sanction->dateline = time();
                        $sanction->reason = $reason;
                        $sanction->seasonid = $this->season->seasonid;
                        $sanction->teamid = $this->team->teamid;
                        $sanction->level = HTMLResponse::fromPOST('sanctionlevel', 0);
                        $sanction->save();
                        HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
开发者ID:xJakub,项目名称:LCE,代码行数:67,代码来源:Team_Index.php

示例3: show

    /**
     * @return void
     */
    public function show()
    {
        if (!TwitterAuth::isLogged()) {
            ?>
            Sólo los administradores pueden ver esta página.
            <a href="<?=HTMLResponse::getRoute()?>?authenticate=1">
                Inicia sesión.
            </a><br>
            <?
            return;
        }
        else if (!Team::isAdmin()) {
            ?>
            Sólo los administradores pueden ver esta página.<br>
            <?
            return;
        }
        else {
            $title = trim(HTMLResponse::fromPOST('title', ''));
            $description = trim(HTMLResponse::fromPOST('description', ''));
            $options = [];
            for ($i=1; $i<6; $i++) {
                $value = trim(HTMLResponse::fromPOST('option'.$i, ''));
                if (strlen($value)) {
                    $options[] = $value;
                }
            }

            if (strlen($title) && count($options)>=2) {
                $poll = Poll::create();
                $poll->title = $title;
                $poll->description = $description;
                $poll->isvisible = true;
                $poll->isopen = true;
                $poll->username = TwitterAuth::getUserName();
                $poll->userid = TwitterAuth::getUserId();
                $poll->dateline = time();
                $poll->avatar = TwitterAuth::getAvatar();
                $poll->save();

                foreach($options as $index => $option) {
                    $pollOption = PollOption::create();
                    $pollOption->pollid = $poll->pollid;
                    $pollOption->userid = TwitterAuth::getUserId();
                    $pollOption->username = TwitterAuth::getUserName();
                    $pollOption->title = $option;
                    $pollOption->save();
                }

                HTMLResponse::exitWithRoute("/votaciones/{$poll->pollid}/");
            }

            ?>
            <form action="<?=HTMLResponse::getRoute()?>" method="post">
                <div style="padding:3px">
                    <div class="inblock middle" style="width:120px">
                        Título
                    </div>
                    <input name="title" value="<?=htmlentities($title)?>">
                </div>

                <div style="padding:3px">
                    <div class="inblock middle" style="width:120px">
                        Descripción
                    </div>
                    <input name="description" value="<?=htmlentities($description)?>">
                </div>

                <?
                for ($i=1; $i<=6; $i++) {
                    ?>
                    <div style="padding:3px">
                        <div class="inblock middle" style="width:120px">
                            Opción <?=$i?>
                        </div>
                        <input name="option<?=$i?>" value="<?=htmlentities($options[$i-1])?>">
                    </div>
                    <?
                }
                ?>

                <div style="padding:3px">
                    <div class="inblock middle" style="width:120px">

                    </div>
                    <input type="submit" value="Crear votación">
                </div>
            </form>
            <?


        }
    }
开发者ID:xJakub,项目名称:LCE,代码行数:96,代码来源:AddPoll.php

示例4: foreach

    require_once $file;
}
require "config.php";
foreach (glob("models/*.php") as $file) {
    require_once $file;
}
require_once 'PublicDesign.php';
require_once 'PublicSection.php';
$router = new Router();
$rId = '([^/|\\-]+)';
$rDir = '([^/]+)';
$rNum = '([0-9]+)';
$rExtra = '(?:-[^/]*)?';
$rIdExtra = "{$rId}{$rExtra}";
$rNumExtra = "{$rNum}{$rExtra}";
if (Team::isAdmin()) {
    $router->addRoute("/unete/", array('JoinUs'));
}
$router->addRoute("/normas/", array('Rules'));
$router->addRoute("/votaciones/", array('Polls'));
$router->addRoute("/votaciones/crear/", array('AddPoll'));
$router->addRoute("/votaciones/{$rNum}/", array('ViewPoll'));
$router->addRoute("/admin/", array('Admin_Index'));
$router->addRoute("/admin/comunicados/", array('Admin_Notices'));
$router->addRoute("/admin/equipos/", array('Admin_Teams'));
$router->addRoute("/admin/equipos/{$rNum}/", array('Admin_Team'));
$router->addRoute("/admin/temporadas/", array('Admin_Seasons'));
$router->addRoute("/admin/temporadas/{$rNum}/", array('Admin_Season'));
$router->addRoute("/admin/temporadas/{$rNum}/jornadas/", array('Admin_Season_Weeks'));
$router->addRoute("/admin/temporadas/{$rNum}/eventos/", array('Admin_Season_Events'));
$router->addRoute("/", array('Index'));
开发者ID:xJakub,项目名称:LCE,代码行数:31,代码来源:index.php

示例5: __construct

    public function __construct(PublicSection $section)
    {
        parent::__construct();

        if (HTMLResponse::fromGET('authenticate')) {
            HTMLResponse::exitWithRoute(TwitterAuth::getAuthorizeURL(HTMLResponse::getRoute()));
        }


        if (HTMLResponse::fromGET('logout')) {
            session_destroy();
            HTMLResponse::exitWithRoute(HTMLResponse::getRoute());
        }

        TwitterAuth::isLogged();

        if (TwitterAuth::isBot()) {
            if (HTMLResponse::fromGET('authenticatebot')) {
                HTMLResponse::exitWithRoute(TwitterAuth::getBotAuthorizeURL(HTMLResponse::getRoute()));
            }
            TwitterAuth::doBotLogin();
        }

        $this->topMenu = array();

        $this->setMeta('charset', 'utf-8');
        $this->setMeta('viewport', 'width=device-width, initial-scale=1.0');
        $this->setTitle($section->getTitle() . ' - ' . $section->getSubtitle());

        $this->addStyleSheet('/css/style.css');

        if ($_SERVER['REMOTE_ADDR'] == '127.0.0.1' || $_SERVER['REMOTE_ADDR'] == '::1') {
            $this->addJavaScript("http://localhost/jquery.js", true);
        }
        else {
            $this->addJavaScript("https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js", true);
        }

        $this->addJavaScript("
            $(document).ready(function() {
                if(screen.width <= 512) {
                    document.getElementById('meta-viewport').setAttribute('content','width=512');
                }
            })
        ", false);



        $this->season = null;
        if ($_SESSION['seasonid']) {
            $this->season = Season::get($_SESSION['seasonid']);
        }

        $section->setDesign($this);
        $this->section = $section;

        if ($this->season == null) {
            $this->season = Season::findOne('ispublic order by isdefault desc');
        }
        $seasonLink = $this->season->getLink();

        $this->addToTopMenu("/{$seasonLink}/", 'Enfrentamientos', '/');
        $this->addToTopMenu("/{$seasonLink}/equipos/", 'Equipos', '/equipos/.*');
        $this->addToTopMenu("/{$seasonLink}/calendario/", 'Calendario', '/calendario/');
        $this->addToTopMenu("/{$seasonLink}/clasificacion/", 'Clasificación', '/clasificacion/');
        $this->addToTopMenu("/{$seasonLink}/quiniela/", 'Quiniela', '/quiniela/');

        $this->addToTopMenu('/normas/', 'Normas', '/normas/');

        if (Team::isAdmin()) {
            $this->addToTopMenu('/unete/', '¡Únete!', '/unete/');
        }

        /*
        if (Team::isMember()) {
            // $this->addToTopMenu('/votaciones/', 'Votaciones', '/votaciones/.*');
        }

        if (Team::isSuperAdmin()) {
            // $this->addToTopMenu('/admin/', 'Admin', '/admin/.*');
            // $this->addToTopMenu('/comunicados/', 'Comunicados', '/comunicados/.*');
        }
        */

        $this->addJavaScript('/js/lce.js', true);
        $this->addStyleSheet("
            html {
                background: url(/".$this->season->getBackgroundLink().") no-repeat center center fixed;
                -webkit-background-size: cover;
                -moz-background-size: cover;
                -o-background-size: cover;
                background-size: cover;
            }
        ", false);
        ob_start();
        $this->section->show();
        $this->contents = ob_get_contents();
        ob_end_clean();
    }
开发者ID:xJakub,项目名称:LCE,代码行数:99,代码来源:PublicDesign.php


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