• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP percent函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中percent函数的典型用法代码示例。如果您正苦于以下问题:PHP percent函数的具体用法?PHP percent怎么用?PHP percent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: show_wahlen

function show_wahlen($row)
{
    extract($row);
    $listen_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $listen_ungueltig;
    $listen_summe = $listen_gueltig - $listen_enthaltungen;
    $kandidaten_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $kandidaten_ungueltig;
    $kandidaten_summe = $kandidaten_gueltig - $kandidaten_enthaltungen;
    print "\\section{Wahl zum {$wahl_name}}\n";
    if (simple_query("SELECT count(*) FROM liste " . "WHERE wahl = {$wahl_id}") > 1) {
        print "\\subsection*{Listenstimmen}\n";
        // Gesamt-Informationen
        print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "\\%" . "\n\n" . "ungültige Stimmzettel: {$stimmzettel_ungueltig}, " . "ungültige Stimmen: {$listen_ungueltig} " . "gültige Stimmen: {$listen_gueltig}, " . "\n\n" . "Enthaltungen: {$listen_enthaltungen} " . "\n\n";
        print "\\begin{tabular}{lrrrrl}\n" . "Liste & Stimmen & Anteil & Quote & Sitze & \\\\\\hline\n";
        // Listen-Tabelle
        do_query("SELECT liste.name_kurz, liste.name_lang, " . "anzeige_red as r, anzeige_green as g, " . "anzeige_blue as b, " . "hoechstzahl, sitze, los, " . "sum(liste_urne.stimmen) AS stimmen, " . "{$listen_summe} AS summe " . "FROM liste, urne, liste_urne " . "WHERE liste.id = liste_urne.liste " . "AND urne.id = liste_urne.urne " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND wahl = {$wahl_id} " . "GROUP BY liste.id " . "ORDER by liste.nummer", show_listen);
        print "\\hline\\end{tabular}\n\n";
        $num_los = simple_query("SELECT los FROM liste " . "WHERE wahl = {$wahl_id} " . "AND los > 0");
        if ($num_los > 0) {
            print "(+1): ggf. +1 von {$num_los} Restsitzen " . "per Los\n\n";
        }
    }
    // Kandidaten
    print "\\subsection*{Kandidierendenstimmen}\n";
    // Gesamt-Daten
    print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "\\%" . "\n\n" . "ungültige Stimmzettel: {$stimmzettel_ungueltig}, " . "ungültige Stimmen: {$kandidaten_ungueltig}, " . "gültig: {$kandidaten_gueltig} " . "\n\n";
    if ($max_stimmen_wert == 1) {
        print "Enthaltungen: {$kandidaten_enthaltungen} " . "\n\n";
    }
    // Kandidaten
    do_query("SELECT liste.id AS liste_id, " . "liste.name_kurz AS liste_name_kurz, " . "liste.name_lang AS liste_name_lang, " . "anzeige_red AS r, " . "anzeige_green AS g, " . "anzeige_blue AS b, " . "kandidat.typ AS kandidat_typ, " . "kandidat.status AS status, " . "kandidat.vorname AS kandidat_vorname, " . "kandidat.nachname AS kandidat_nachname, " . "sum(kandidat_urne.stimmen) AS stimmen " . "FROM liste, kandidat, urne, kandidat_urne " . "WHERE kandidat.id = kandidat_urne.kandidat " . "AND urne.id = kandidat_urne.urne " . "AND liste.id = kandidat.liste " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND liste.wahl = {$wahl_id} " . "GROUP BY kandidat.id " . "ORDER BY liste.nummer, liste.id, status, stimmen DESC, " . "kandidat.listenplatz", show_kandidaten);
    if ($num_los != 0) {
        print "\\footnotemark{(*)} {$num_los} Restsitze werden per " . "Los auf die gekennzeichneten Listen verteilt.\n\n";
    }
}
开发者ID:asta-kit,项目名称:friwahl-legacy,代码行数:34,代码来源:ergebnisse.php


示例2: GetStatsByField

function GetStatsByField($fieldName)
{
    global $db, $NowBots, $BuildId;
    $BuildStr = $BuildId ? "WHERE statBuildId = '{$BuildId}'" : "";
    $stats = $db->query("SELECT {$fieldName},\r\n                        SUM(statBots) as statBots,\r\n                        SUM(statBotsOnline) as statBotsOnline,\r\n                        SUM(statBotsDead) as statBotsDead,\r\n                        SUM(statBotsLifeTime) as statBotsLifeTime,\r\n                        SUM(statBotsNetTime) as statBotsNetTime\r\n                     FROM stats {$BuildStr} GROUP BY ({$fieldName})")->fetchAllAssoc();
    echo "<table cellpadding='3' cellspacing='0' width='100%' class='light_table box' rules='all'>\r\n        <tr>\r\n            <th>{$fieldName}</th>\r\n            <th>Count* (% Now)</th>\r\n            <th>Average Life time **</th>\r\n            <th>% Dead/Month</th>\r\n        </tr>";
    $count = 0;
    foreach ($stats as $s) {
        $bots = $s['statBots'];
        $botsDead = $s['statBotsDead'];
        $botsAlive = $bots - $botsDead;
        $botsSrOnline = $s['statBotsOnline'];
        $botsPC = percent($bots, $NowBots);
        $botsAlivePC = percent($botsAlive, $NowBots);
        $botsDeadPC = percent($botsDead, $NowBots);
        $botsSrOnlinePC = percent($botsSrOnline, $NowBots);
        $srLifeTime = round($s['statBotsLifeTime'] / $bots, 2);
        $srBotNetTime = round($s['statBotsNetTime'] / $bots, 2);
        $ovm = round($s['statBotsNetTime'] / $bots * $s['statBotsDead'] / $bots / 30 * 100, 2);
        $color = $count % 2 ? "#d3e7f0" : "#ebf4f8";
        echo "<tr bgcolor='{$color}' onmouseover=\"this.style.background='#ffffff'\" onmouseout=\"this.style.background='{$color}'\">\r\n                <td align='center'><b>{$s[$fieldName]}</b></td>\r\n                <td align='center'>{$bots} ({$botsPC}%) /\r\n                    <span style='color:green;'>{$botsAlive} ({$botsAlivePC}%)</span> /\r\n                    <span style='color:#808080;'>{$botsDead} ({$botsDeadPC}%)</span> /\r\n                    <span style='color:#ffa500;'>{$botsSrOnline} ({$botsSrOnlinePC}%)</span></td>\r\n                <td align='center'>{$srLifeTime} д. / {$srBotNetTime} д.</td>\r\n                <td align='center'>{$ovm}%</td>\r\n          </tr>";
        $count++;
    }
    echo "<tr style='background:#ffffff !important;'><th colspan='4'>&nbsp;</th></tr></table>";
    echo "<small>*<i>« bots / <span style='color:green'>Alive</span> / <span style='color:#808080'>Dead</span> / <span style='color:#ffa500'>Online</span> »</i></small><br>\r\n     ";
    // <small>**<i>«среднее кол-во дней жизнеспособности ботов / среднее кол-во дней существования ботов»</i></small><br><br>";
}
开发者ID:conjuringtricks,项目名称:PowerLoader,代码行数:27,代码来源:stats.php


示例3: getVersionContrast

 function getVersionContrast($from1, $to1, $from2, $to2)
 {
     $currentProduct = $this->common->getCurrentProduct();
     $productId = $currentProduct->id;
     //get sum num
     $total1 = $this->versionmodel->getNewAndActiveAllCount($productId, $from1, $to1);
     $total2 = $this->versionmodel->getNewAndActiveAllCount($productId, $from2, $to2);
     $query1 = $this->versionmodel->getVersionContrast($productId, $from1, $to1);
     $query2 = $this->versionmodel->getVersionContrast($productId, $from2, $to2);
     $result1 = array();
     $result2 = array();
     $sum1 = $total1[0]['newusers'];
     $sum12 = $total1[0]['startusers'];
     $sum2 = $total2[0]['startusers'];
     $sum21 = $total2[0]['newusers'];
     foreach ($query1->result_array() as $row) {
         $row['newuserpercent'] = percent($row['newusers'], $sum1);
         $row['startuserpercent'] = percent($row['startusers'], $sum12);
         array_push($result1, $row);
     }
     foreach ($query2->result_array() as $row) {
         $row['newuserpercent'] = percent($row['newusers'], $sum21);
         $row['startuserpercent'] = percent($row['startusers'], $sum2);
         array_push($result2, $row);
     }
     $result = array($result1, $result2);
     echo json_encode($result);
 }
开发者ID:npk,项目名称:razor,代码行数:28,代码来源:version.php


示例4: head

function head($title, $file = "")
{
    if ($file != "") {
        print "\n<NEWFILE {$file} {$title}>\n";
    }
    $urnen_total = simple_query("SELECT count(*) FROM urne");
    $urnen_done = simple_query("SELECT count(*) FROM urne WHERE status=" . $GLOBALS["ok_status"]);
    $stimmen_total = simple_query("SELECT sum(stimmen) FROM urne");
    $stimmen_done = simple_query("SELECT sum(stimmen) FROM urne WHERE status=" . $GLOBALS["ok_status"]);
    ?>
<html>
  <head><title>Unabhängige Wahlen KIT - <?php 
    echo $title;
    ?>
</title>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-15">
  <link rel="stylesheet" href="style.css">
  <link rel="stylesheet" href="http://www.usta.de/sites/www.usta.de/themes/usta/font.css">
  </head>
  <body>
     <div id="content">
       <div id="header">
         <h2>Wahlen zum Unabhängigen Modell am Karlsruher Institut für Technologie (KIT)</h2>
         <h1><?php 
    echo $title;
    ?>
</h1>
         <div class="orange-border">
	   Zwischenstand <?php 
    echo date("j.n.Y H:i");
    ?>
, 
           <?php 
    echo $urnen_done;
    ?>
 von <?php 
    echo $urnen_total;
    ?>
 Urnen,
           ca. <?php 
    echo percent($stimmen_done, $stimmen_total);
    ?>
% der Stimmzettel,
           <a href="index.html?cache_dummy=<?php 
    echo time();
    ?>
">&Uuml;bersicht</a>
         </div>
       </div>
<?php 
}
开发者ID:asta-kit,项目名称:friwahl-legacy,代码行数:51,代码来源:headfoot.php


示例5: index

 /**
  * 欢迎页面
  * @author 罗江涛
  */
 public function index()
 {
     $adminId = session('adminId');
     // 获取管理员自己的个人信息
     $admin = M('admin')->where(array('adminId' => $adminId))->find();
     // 获取管理员权限组名称
     $admin['groupName'] = M('group')->where(array('groupId' => $admin['groupId']))->getField('groupName');
     // 统计文章,草稿,审核,发布,撤回,退回,回收站的数目
     $article['allArticleNumber'] = M('article')->where(array('adminId' => $adminId))->count();
     $article['draftArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => 3))->count();
     $article['examineArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => 2))->count();
     $article['publishArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => 1))->count();
     $article['returnArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => -1))->count();
     $article['backArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => -2))->count();
     $article['recycleArticleNumber'] = M('article')->where(array('adminId' => $adminId, 'status' => 0))->count();
     // 统计文章,草稿,审核,发布,撤回,退回,回收站的百分比
     $article['allArticlePercent'] = percent($article['allArticleNumber'], $article['allArticleNumber']);
     $article['draftArticlePercent'] = percent($article['allArticleNumber'], $article['draftArticleNumber']);
     $article['examineArticlePercent'] = percent($article['allArticleNumber'], $article['examineArticleNumber']);
     $article['publishArticlePercent'] = percent($article['allArticleNumber'], $article['publishArticleNumber']);
     $article['returnArticlePercent'] = percent($article['allArticleNumber'], $article['returnArticleNumber']);
     $article['backArticlePercent'] = percent($article['allArticleNumber'], $article['backArticleNumber']);
     $article['recycleArticlePercent'] = percent($article['allArticleNumber'], $article['recycleArticleNumber']);
     // 统计全部用户,男性用户,女性用户,所有文章,已发布,活动,收藏,反馈,管理员,点赞,订阅,标签,管理员日志,待审核,的数目
     $count['allUserNumber'] = M('user')->count();
     $count['manUserNumber'] = M('user')->where(array('sex' => 1))->count();
     $count['womenUserNumber'] = M('article')->where(array('sex' => 2))->count();
     $count['allArticleNumber'] = M('article')->count();
     $count['publishArticleNumber'] = M('article')->where(array('status' => 1))->count();
     $count['campaignNumber'] = M('campaign')->count();
     $count['favoriteNumber'] = M('favorite')->count();
     $count['feedbackNumber'] = M('feedback')->count();
     $count['adminNumber'] = M('admin')->count();
     $count['praiseNumber'] = M('praise')->count();
     $count['subscribeNumber'] = M('subscribe')->count();
     $count['tagNumber'] = M('tag')->count();
     $count['adminLogNumber'] = M('admin_log')->count();
     $count['examineArticleNumber'] = M('article')->where(array('status' => 2))->count();
     $group = M('group')->select();
     foreach ($group as $key => $value) {
         // 统计每个权限组下面有多少人
         $group[$key]['groupUserNumber'] = M('admin')->where(array('groupId' => $group[$key]['groupId']))->count();
     }
     // 分配变量
     $this->assign("admin", $admin);
     $this->assign("article", $article);
     $this->assign("group", $group);
     $this->assign("count", $count);
     $this->display();
 }
开发者ID:luojiangtao,项目名称:vcbeat_my,代码行数:54,代码来源:IndexController.class.php


示例6: show_wahlen

function show_wahlen($row)
{
    extract($row);
    $wahl_file = str_replace(" ", "_", $wahl_name_kurz);
    $listen_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $listen_ungueltig;
    $listen_summe = $listen_gueltig - $listen_enthaltungen;
    $kandidaten_gueltig = $stimmen_gesamt - $stimmzettel_ungueltig - $kandidaten_ungueltig;
    $kandidaten_summe = $kandidaten_gueltig - $kandidaten_enthaltungen;
    if (simple_query("SELECT count(*) FROM liste " . "WHERE wahl = {$wahl_id}") > 1) {
        head($wahl_name_kurz . " (Listen)", "{$wahl_file}-listen.html");
        // Gesamt-Informationen
        print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "%" . "<BR>\n" . "ung&uuml;ltige Stimmzettel: {$stimmzettel_ungueltig}, " . "ung&uuml;ltige Stimmen: {$listen_ungueltig} " . "g&uuml;ltige Stimmen: {$listen_gueltig}, " . "<BR>\n" . "Enthaltungen: {$listen_enthaltungen} " . "<BR>\n";
        // Listen-Tabelle
        print "<TABLE><TR valign=top>" . "<TD><TABLE cellpadding=2>" . "<TR>" . "<TD>Liste</TD>" . "<TD colspan=2>Stimmen</TD>" . "<TD>Sitze</TD>" . "</TR>\n";
        do_query("SELECT liste.name_kurz, anzeige_red as r, " . "anzeige_green as g, anzeige_blue as b, " . "sitze, los, " . "sum(liste_urne.stimmen) AS stimmen, " . "{$listen_summe} AS summe " . "FROM liste, urne, liste_urne " . "WHERE liste.id = liste_urne.liste " . "AND urne.id = liste_urne.urne " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND wahl = {$wahl_id} " . "GROUP BY liste.id " . "ORDER by liste.nummer", show_listen);
        print "</TABLE>";
        $num_los = simple_query("SELECT los FROM liste " . "WHERE wahl = {$wahl_id} " . "AND los > 0");
        if ($num_los > 0) {
            print "(+1): ggf. +1 von {$num_los} Restsitzen " . "per Los\n";
        }
        print "</TD>\n" . "<TD width=20></TD>\n";
        // Listen-Graph
        $chart = array();
        do_query_pass("SELECT sitze, " . "anzeige_red, anzeige_green, anzeige_blue " . "FROM liste " . "WHERE wahl = {$wahl_id} " . "ORDER by liste.anzeige_nummer", set_listen_chart, $chart);
        if ($num_los > 0) {
            array_push($chart, $num_los, 0.5, 0.5, 0.5);
        }
        print "<TD>";
        piechart(400, 200, $chart, "{$wahl_file}-liste.png");
        image("{$wahl_file}-liste.png");
        print "</TD></TR>\n" . "</TABLE>\n" . "<BR>\n";
        foot();
    }
    // Kandidaten
    head($wahl_name_kurz, "{$wahl_file}-kandi.html");
    // Gesamt-Daten
    print "Wahlberechtigte: {$wahlberechtigt}, " . "abgegebene Stimmzettel: {$stimmen_gesamt}, " . "Wahlbeteiligung: " . percent($stimmen_gesamt, $wahlberechtigt) . "%" . "<BR>\n" . "ung&uuml;ltige Stimmzettel: {$stimmzettel_ungueltig}, " . "ung&uuml;ltige Stimmen: {$kandidaten_ungueltig}, " . "g&uuml;ltig: {$kandidaten_gueltig} " . "<BR>\n";
    if ($max_stimmen_wert == 1) {
        print "Enthaltungen: {$kandidaten_enthaltungen} " . "<BR>\n";
    }
    // Kandidaten
    print "<p><div class=\"auswert_tab\"><TABLE><TR valign=top>\n";
    do_query("SELECT liste.id AS liste_id, " . "liste.name_kurz AS liste_name_kurz, " . "anzeige_red AS r, " . "anzeige_green AS g, " . "anzeige_blue AS b, " . "kandidat.status AS status, " . "kandidat.vorname AS kandidat_vorname, " . "kandidat.nachname AS kandidat_nachname, " . "sum(kandidat_urne.stimmen) AS stimmen " . "FROM liste, kandidat, urne, kandidat_urne " . "WHERE kandidat.id = kandidat_urne.kandidat " . "AND urne.id = kandidat_urne.urne " . "AND liste.id = kandidat.liste " . "AND urne.status = " . $GLOBALS["ok_status"] . " " . "AND liste.wahl = {$wahl_id} " . "GROUP BY kandidat.id " . "ORDER BY liste.nummer, status, stimmen DESC, " . "kandidat.listenplatz", show_kandidaten);
    print "</TR></TABLE></div></p>\n";
    if ($num_los != 0) {
        print "(*): {$num_los} Restsitze werden per Los auf " . "die gekennzeichneten Listen verteilt.<BR>";
    }
    foot();
}
开发者ID:asta-kit,项目名称:friwahl-legacy,代码行数:49,代码来源:wahlen.php


示例7: run

 /**
  * Runs the widget.
  */
 public function run()
 {
     function percent($num_amount, $num_total)
     {
         $count1 = $num_amount / $num_total;
         $count2 = $count1 * 100;
         $count = number_format($count2, 0);
         return $count;
     }
     if (!Yii::app()->getModule('likedislike')->countlikes($this->field_id) == 0) {
         echo $rate_like_percent = percent(Yii::app()->getModule('likedislike')->countlikes($this->field_id), Yii::app()->getModule('likedislike')->countlikesall($this->field_id) + Yii::app()->getModule('likedislike')->countlikesall1($this->field_id));
     } else {
         echo '0';
     }
 }
开发者ID:videocms,项目名称:videocms-test,代码行数:18,代码来源:LikeDislikeView.php


示例8: make_thumbs

function make_thumbs($img)
{
    global $BASE_DIR, $BASE_URL;
    $path_info = pathinfo($img);
    $path = $path_info['dirname'] . "/";
    $img_file = $path_info['basename'];
    $thumb = $path . '.' . $img_file;
    $img_info = getimagesize($BASE_DIR . $path . $img_file);
    $w = $img_info[0];
    $h = $img_info[1];
    $nw = 96;
    $nh = 96;
    if ($w <= $nw && $h <= $nh) {
        header('Location: ' . $BASE_URL . $path . $img_file);
        exit;
    }
    if (is_file($BASE_DIR . $thumb)) {
        $t_mtime = filemtime($BASE_DIR . $thumb);
        $o_mtime = filemtime($BASE_DIR . $img);
        if ($t_mtime > $o_mtime) {
            //echo $BASE_URL.$path.'.'.$img_file;
            header('Location: ' . $BASE_URL . $path . '.' . $img_file);
            exit;
        }
    }
    $img_thumbs = Image_Transform::factory(IMAGE_CLASS);
    $img_thumbs->load($BASE_DIR . $path . $img_file);
    if ($w > $h) {
        $nh = unpercent(percent($nw, $w), $h);
    } else {
        if ($h > $w) {
            $nw = unpercent(percent($nh, $h), $w);
        }
    }
    $img_thumbs->resize($nw, $nh);
    $img_thumbs->save($BASE_DIR . $thumb);
    $img_thumbs->free();
    chmod($BASE_DIR . $thumb, 0666);
    if (is_file($BASE_DIR . $thumb)) {
        //echo "Made:".$BASE_URL.$path.'.'.$img_file;
        header('Location: ' . $BASE_URL . $path . '.' . $img_file);
        exit;
    }
}
开发者ID:BackupTheBerlios,项目名称:milaninegw-svn,代码行数:44,代码来源:thumbs.php


示例9: days

 public function days($days = 30)
 {
     //hits
     $hits = Hit::factory()->fetch(time() - 3600 * 24 * $days)->cnt();
     $hitsflow = Hit::timeflow(time() - 3600 * 24 * $days, null, 30, false);
     $unique = Hit::factory()->fetch(time() - 3600 * 24 * $days)->unique()->cnt();
     $uniqueflow = Hit::timeflow(time() - 3600 * 24 * $days, null, 30, true);
     $this->templatemanager->assign('hits', $hits);
     $this->templatemanager->assign('hitsflow', $hitsflow);
     $this->templatemanager->assign('unique', $unique);
     $this->templatemanager->assign('uniqueflow', $uniqueflow);
     $this->templatemanager->assign('days', $days);
     //pages
     $pagehits = Hit::factory()->select('*')->select_func('COUNT', '@id', 'cnt')->include_related('page', null, TRUE, TRUE)->where('page_id >', 0)->fetch(time() - 3600 * 24 * $days)->unique('page_id')->limit(100)->get();
     for ($i = 0; $i < count($pagehits->all); $i++) {
         $pagehits->all[$i]->timeflow = Hit::timeflow(time() - 3600 * 24 * $days, null, 30, false, $pagehits->all[$i]->page_id);
     }
     $this->templatemanager->assign('pagehits', $pagehits);
     //sasa
     $returning = Hit::factory()->fetch(time() - 3600 * 24 * $days)->unique()->where('returning', true)->cnt();
     $returningflow = Hit::timeflow(time() - 3600 * 24 * $days, null, 30, true, null, true);
     $this->templatemanager->assign('returning', $returning);
     $this->templatemanager->assign('returningflow', $returningflow);
     //contents edited
     $cnt_edits = ContentRevision::factory()->where('created >=', time() - 3600 * 24 * $days)->get()->result_count();
     $new_users = User::factory()->where('created >=', time() - 3600 * 24 * $days)->get();
     $new_users = $new_users->result_count();
     $new_pages = Page::factory()->where('created >=', time() - 3600 * 24 * $days)->get()->result_count();
     $repeats = RepeatableItem::factory()->where('timestamp >=', time() - 3600 * 24 * $days)->get()->result_count();
     $this->templatemanager->assign('cnt_edits', $cnt_edits);
     $this->templatemanager->assign('new_users', $new_users);
     $this->templatemanager->assign('new_pages', $new_pages);
     $this->templatemanager->assign('repeatables', $repeats);
     //get stats for browsers
     $browsers = Hit::factory()->select('browser')->select_func('COUNT', '@id', 'cnt')->fetch(time() - 3600 * 24 * $days)->unique('browser')->order_by('cnt DESC')->get();
     $browsersarr = array();
     $browsers->iu_total = 0;
     foreach ($browsers as $bro) {
         $browsers->iu_total += $bro->cnt;
     }
     $limit = $browsers->result_count() > 10 ? 10 : $browsers->result_count();
     for ($i = 0; $i < $limit; $i++) {
         $br = $browsers->all[$i];
         $obj = new stdClass();
         $obj->label = str_replace("'", "\\'", $br->browser) . ' (' . percent($br->cnt, $browsers->iu_total) . '%)';
         $obj->data = (int) $br->cnt;
         $browsersarr[] = $obj;
     }
     //usort($browsersarr, array($this, 'compare_series'));
     $this->templatemanager->assign('browsers', $browsers);
     $this->templatemanager->assign('browsers_series', $browsersarr);
     //get stats for operating systems
     $oses = Hit::factory()->select('os')->select_func('COUNT', '@id', 'cnt')->fetch(time() - 3600 * 24 * $days)->unique('os')->order_by('cnt DESC')->get();
     $osarr = array();
     $oses->iu_total = 0;
     foreach ($oses as $osi) {
         $oses->iu_total += $osi->cnt;
     }
     $limit = $oses->result_count() > 10 ? 10 : $oses->result_count();
     for ($i = 0; $i < $limit; $i++) {
         $os = $oses->all[$i];
         $obj = new stdClass();
         $obj->label = str_replace("'", "\\'", $os->os) . ' (' . percent($os->cnt, $oses->iu_total) . '%)';
         $obj->data = (int) $os->cnt;
         $osarr[] = $obj;
     }
     //usort($osarr, array($this, 'compare_series'));
     $this->templatemanager->assign('oses', $oses);
     $this->templatemanager->assign('oses_series', $osarr);
     //get stats for countries
     $geoip_db_filename = './iu-resources/geoip/GeoIP.dat';
     if (is_file($geoip_db_filename)) {
         $countries = Hit::factory()->select('country')->select_func('COUNT', '@id', 'cnt')->fetch(time() - 3600 * 24 * $days)->unique('country')->order_by('cnt DESC')->get();
         $conarr = array();
         $countries->iu_total = 0;
         foreach ($countries as $cou) {
             $countries->iu_total += $cou->cnt;
         }
         //var_dump(percent(20,100));
         $limit = $countries->result_count() > 10 ? 10 : $countries->result_count();
         for ($i = 0; $i < $limit; $i++) {
             $c = $countries->all[$i];
             $obj = new stdClass();
             $obj->label = str_replace("'", "\\'", empty($c->country) ? __("(unknown)") : $c->country) . ' (' . percent($c->cnt, $countries->iu_total) . '%)';
             $obj->data = (int) $c->cnt;
             $conarr[] = $obj;
         }
         //usort($conarr, array($this, 'compare_series'));
         $this->templatemanager->assign('countries', $countries);
         $this->templatemanager->assign('countries_series', $conarr);
     }
     $this->templatemanager->show_template('statistics');
 }
开发者ID:jotavejv,项目名称:CMS,代码行数:93,代码来源:statistics.php


示例10: foreach

    $wrt = '<table border="0" cellspacing="0" cellpadding="0" width="100%">';
    $wrt .= '<tr><th class="left ft_head font_m">Ship</th><th class="left ft_head font_m">Attacker</th><th class="left ft_head font_m">Damage</th></tr>';
    foreach ($att as $attacker) {
        //$dmgDone = number_format((double)$value['damageDone']);
        if ($evenOdd) {
            $odder = "even";
            $splitter = false;
        } else {
            $odder = "odd";
            $splitter = true;
        }
        $evenOdd = !$evenOdd;
        if ($attacker['fb'] == true) {
            $fb = '_fb';
        } else {
            $fb = '';
        }
        $wrt .= '<tr>';
        $wrt .= '<td class="left font_s tcell' . $odder . '">' . ldimg($attacker['ship'], 'type', 'left', 'kb_border' . $fb . '', '32') . '' . get_name($attacker['ship']) . '<br />' . get_name($attacker['wpn_id']) . '</td>';
        if (!empty($attacker['all_name'])) {
            $alli = '<a onclick="CCPEVE.showInfo(16159, ' . $attacker['all_id'] . ')" href="#">' . $attacker['all_name'] . '</a>';
        } else {
            $alli = '';
        }
        $wrt .= '<td class="left font_s tcell' . $odder . '">' . ldimg($attacker['plt_id'], 'char', 'left', 'kb_border' . $fb . '') . '<a onclick="CCPEVE.showInfo(1377, ' . $attacker['plt_id'] . ')" href="#">' . $attacker['plt_name'] . '</a><br /><a onclick="CCPEVE.showInfo(2, ' . $attacker['crp_id'] . ')" href="#">' . $attacker['crp_name'] . '</a><br />' . $alli . '</td>';
        $wrt .= '<td class="left font_s tcell' . $odder . '">' . number_format((double) $attacker['dmgdone']) . '<br />' . percent($attacker['dmgdone'], $perc['SUM(dmgdone)']) . '%</td>';
        $wrt .= '</tr>';
    }
    $wrt .= '</table>';
    echo $wrt;
}
开发者ID:CraXyOW3,项目名称:eve_cms,代码行数:31,代码来源:kb_view.php


示例11: percent

    $weekly_percent = percent($week["total"], $total_records);
} else {
    $weekly_percent = "0";
}
if (!empty($monthly) || $monthly["total"] != '0') {
    $monthly_percent = percent($monthly["total"], $total_records);
} else {
    $monthly_percent = "0";
}
if (!empty($quarterly) || $quarterly["total"] != '0') {
    $quarterly_percent = percent($quarterly["total"], $total_records);
} else {
    $quarterly_percent = "0";
}
if (!empty($halfyearly) || $halfyearly["total"] != '0') {
    $halfyearly_percent = percent($halfyearly["total"], $total_records);
} else {
    $halfyearly_percent = "0";
}
?>
                        <a href="invoice/index">
                            <div class="circle">
                                <div class="circle-inner">
                                    <h2><span class="counter"><?php 
echo $weekly_percent;
?>
</span>%</h2>
                                    <h4>Weekly</h4>
                                </div>
                            </div>
                        </a>
开发者ID:ravinderphp,项目名称:revitalise,代码行数:31,代码来源:invoice-monthly-detail.php


示例12: foreach

if (is_writable('../languages/')) {
    $tally = $tally + 1;
}
foreach (glob("../languages/*.conf") as $filename) {
    $required = $required + 1;
    if (is_writable($filename)) {
        $tally = $tally + 1;
    }
}
if (is_writable('../libs/dbconnect.php')) {
    $tally = $tally + 1;
}
if (is_writable('../settings.php')) {
    $tally = $tally + 1;
}
$percent = percent($tally, $required);
if ($tally < $required) {
    echo '<div class="alert alert-warning">
		<p><strong>Warning:</strong> Your server has only met <strong>' . $tally . '</strong> of  the <strong>' . $required . '</strong> requirements to run Pligg CMS. While not all of the items on this page are required to run Pligg, we suggest that you try to comply with the suggestions made on this page. Please see the list below to discover what issues need to be addressed.</p><br />';
    echo '<div class="progress" style="margin-bottom: 9px;">
				<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="' . $percent . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $percent . '%;">
					<span class="sr-only">' . $percent . '% Complete</span>
				</div>
			</div>';
} else {
    echo '<div class="alert alert-success">
		<p>Your server met all of the requirements needed to run Pligg CMS. See the information below for a detailed report.</p><br />';
    echo '<div class="progress" style="margin-bottom: 9px;">
				<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="' . $percent . '" aria-valuemin="0" aria-valuemax="100" style="width: ' . $percent . '%;">
					<span class="sr-only">' . $percent . '% Complete</span>
				</div>
开发者ID:hyrmedia,项目名称:pligg-cms,代码行数:31,代码来源:troubleshooter.php


示例13: printResults

function printResults($human, $comp, $winner)
{
    $guessName = array("Rock", "Paper", "Scissors");
    ?>
  <div>
   <dl class="results">
     <dt>Human Guess:</dt>
      <dd><?php 
    echo $guessName[$human];
    ?>
</dd>
     <dt>Computer Guess:</dt>
      <dd><?php 
    echo $guessName[$comp];
    ?>
</dd>
     <dt>Winner:</dt>
      <dd><?php 
    echo $winner;
    ?>
</dd>
   </dl>
   <dl class="results">
     <dt>Human Wins:</dt>
      <dd><?php 
    echo $_SESSION['WIN'] ? $_SESSION['WIN'] : 0;
    ?>
(<?php 
    echo percent('WIN');
    ?>
%)</dd>
     <dt>Computer Wins:</dt>
      <dd><?php 
    echo $_SESSION['LOSS'] ? $_SESSION['LOSS'] : 0;
    ?>
(<?php 
    echo percent('LOSS');
    ?>
%)</dd>
     <dt>Ties:</dt>
      <dd><?php 
    echo $_SESSION['TIE'] ? $_SESSION['TIE'] : 0;
    ?>
(<?php 
    echo percent('TIE');
    ?>
%)</dd>
   </dl>
   <?php 
    ?>
  </div> 
<?php 
}
开发者ID:anfleene,项目名称:N342,代码行数:53,代码来源:rock_paper_scissors.php


示例14: percent

    echo $todayDataArray[$i]['allusers'];
    ?>
</td>
					<td><?php 
    if ($todayDataArray[$i]['allusers'] == 0) {
        echo '0.0%';
    } else {
        echo percent($sevenDayActive[$i]['startusers'], $todayDataArray[$i]['allusers']);
    }
    ?>
</td>
					<td><?php 
    if ($todayDataArray[$i]['allusers'] == 0) {
        echo '0.0%';
    } else {
        echo percent($thirtyDayActive[$i]['startusers'], $todayDataArray[$i]['allusers']);
    }
    ?>
</td>
					<!--  td><?php 
    // echo ($new_user_time_phase[$i]*100)."%" ;
    ?>
</td>-->
				</tr>
		<?php 
}
?>

	</tbody>
		</table>
	</article>
开发者ID:npk,项目名称:razor,代码行数:31,代码来源:productmarket.php


示例15: array

 				
 		<center>
 			<?php 
 $bar_width = "273px";
 $bar_height = "20px";
 $ally_img = "wow/static/images/services/status/ally.png";
 $horde_img = "wow/static/images/services/status/horde.png";
 //Show percent online (true = yes, false = no)
 $show_percent = true;
 $alliance = array("1", "3", "4", "7", "11", "22");
 $horde = array("2", "5", "6", "8", "9", "10");
 $p = @getPlayers($server_cdb);
 $a = @doFaction($server_cdb, $alliance);
 $h = @doFaction($server_cdb, $horde);
 $ap = @percent($a, $p);
 $hp = @percent($h, $p);
 $b = @barWidth($a, $p, 273);
 $c = @barWidth($h, $p, 273);
 echo "<a data-tooltip='" . doFaction($server_cdb, $alliance) . " <font style=\"color:#3399ff;font-weight:bold;\">" . $Status['Ali'] . "</font> <small>" . $Status['PlOnLine'] . "</small>'\\><div style=\"width:" . $bar_width . ";height:" . $bar_height . ";\">\n    \t\t\t<div style=\"float:left;text-align:right;background:url(./" . $ally_img . ");width:" . $b . "px;height:20px;\">";
 if ($show_percent) {
     echo "<font style=\"color:#FFFFFF;font-weight:bold;\"><center>{$ap}%</center></font></a>";
 }
 echo "<a data-tooltip='" . doFaction($server_cdb, $horde) . " <font style=\"color:#ff3333;font-weight:bold;\">" . $Status['Horde'] . "</font> <small>" . $Status['PlOnLine'] . "</small>'\\></div>\n    \t\t\t<div style=\"float:right;text-align:left;background:url(./" . $horde_img . ");background-position:right;width:" . $c . "px;height:20px;\">";
 if ($show_percent) {
     echo "<font style=\"color:#FFFFFF;font-weight:bold;\"><center>{$hp}%</center></font></a>";
 }
 echo "</div>\n    \t\t\t</div>";
 ?>
 		</center>
 		</div>
 	</div>
开发者ID:hcet4a,项目名称:AquaFlameCMS_Trinity,代码行数:30,代码来源:server_information.php


示例16: getcountry

             $bg2 = BG_2;
         } else {
             $bg1 = BG_3;
             $bg2 = BG_4;
         }
         $country = '[flag]' . getcountry($id) . '[/flag]';
         $country = flags($country);
         $member = '<a href="index.php?site=profile&amp;id=' . $id . '"><b>' . getnickname($id) . '</b></a>';
         if (!isset($anz[$id])) {
             $anz[$id] = '';
         }
         $wars = $anz[$id];
         if (empty($wars)) {
             $wars = '0';
         }
         $perc = percent($wars, $total, 2);
         if ($perc) {
             $percpic = '<img src="images/icons/poll_start.gif" width="1" height="5" alt="" /><img src="images/icons/poll.gif" width="' . round($perc, 0) . '" height="5" alt="" /><img src="images/icons/poll_end.gif" width="1" height="5" alt="" /> ' . $perc . '%';
         } else {
             $percpic = '<img src="images/icons/poll_start.gif" width="1" height="5" alt="" /><img src="images/icons/poll_end.gif" width="1" height="5" alt="" /> ' . $perc . '%';
         }
         eval("\$clanwars_stats_player_content = \"" . gettemplate("clanwars_stats_player_content") . "\";");
         echo $clanwars_stats_player_content;
         $i++;
     }
 }
 echo '</table>';
 unset($wonall);
 unset($loseall);
 unset($drawall);
 unset($playerlist);
开发者ID:Blaz3r,项目名称:webSPELL,代码行数:31,代码来源:clanwars.php


示例17: getPlayers

    function getPlayers()
    {
        if ($this->request->is('ajax')) {
            $this->disableCache();
            //Configure::write('debug', 0);
            $this->autoRender = false;
            include APP . 'spacebukkitcall.php';
            //Get Players
            $args = array();
            $players = $api->call("getPlayers", $args, false);
            $ops = $api->call("getOps", $args, false);
            $playerslist = array();
            foreach ($players as $player) {
                $args = array($player);
                $playerslist[] = $api->call("getPlayerInformations", $args, false);
            }
            //Function to get percentage
            function percent($num_amount, $num_total)
            {
                $count1 = @($num_amount / $num_total);
                $count2 = $count1 * 100;
                $count = number_format($count2, 0);
                return $count;
            }
            //Output
            $args = array();
            $server = $api->call("getServer", $args, false);
            $num = count($playerslist);
            if ($server['OnlinePlayers'] == 0) {
                $noPl = __('There are no players online!');
                echo <<<END
{ "aaData": [
[
"",
"",
"",
"{$noPl}",
"",
""
]
] }
END;
            } else {
                $i = 1;
                echo '{ "aaData": [';
                foreach ($playerslist as $p) {
                    $name = $p['Name'];
                    $ip = $p['IP'];
                    $life = percent($p['Health'], '20');
                    $hunger = percent($p['FoodLevel'], '20');
                    $lvl = $p['Level'];
                    $gamemode = $p['GameMode'];
                    if ($p['GameMode'] == 'SURVIVAL') {
                        $gamemode = __('Survival');
                        $gamemode .= perm_action('users', 'changeGamemode', $this->Session->read("user_perm"), '<span class=\'button-group\'><a href=\'./tplayers/gameMode/' . $name . '/1\'  class=\'button icon arrowup ajax_table1\'>' . __('Set to creative') . '</a></span>');
                    } elseif ($p['GameMode'] == 'CREATIVE') {
                        $gamemode = __('Creative');
                        $gamemode .= perm_action('users', 'changeGamemode', $this->Session->read("user_perm"), '<span class=\'button 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP percent_format函数代码示例发布时间:2022-05-15
下一篇:
PHP people_get_variables函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap