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


PHP Stat类代码示例

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


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

示例1: getInstance

 /**
  * Singleton Pattern
  *
  * Auto Create Object Instance.
  *
  */
 public static function getInstance()
 {
     if (null === self::$_objInstance) {
         self::$_objInstance = new Stat();
     }
     return self::$_objInstance;
 }
开发者ID:edupol,项目名称:examsystem,代码行数:13,代码来源:Stat.php

示例2: PageStat

function PageStat(&$skeleton)
{
    $itemlist = new ItemList($skeleton);
    $db = Stat::loadDb();
    $itemlist->setBorders(array('top' => '-', 'bottom' => '-', 'left' => '+', 'right' => '+'));
    $itemlist->setText("Number of page viewed: " . $db['total_pages']);
    $skeleton->addWidget($itemlist);
}
开发者ID:aimxhaisse,项目名称:kenavo,代码行数:8,代码来源:PageStat.php

示例3: testFailedJobExceptionsAreCaught

 public function testFailedJobExceptionsAreCaught()
 {
     $payload = array('class' => 'Failing_Job', 'args' => null);
     $job = new Job('jobs', $payload);
     $job->worker = $this->worker;
     $this->worker->perform($job);
     $this->assertEquals(1, Stat::get('failed'));
     $this->assertEquals(1, Stat::get('failed:' . $this->worker));
 }
开发者ID:shonm,项目名称:php-resque,代码行数:9,代码来源:JobTest.php

示例4: test_run_maxHpIsThere

 function test_run_maxHpIsThere()
 {
     Initial::addData();
     $character = Finalize::run();
     $id = $character->getStatId();
     $stat = Stat::find($id);
     $max_hp = $stat->getMaxHp();
     $result = 11;
     $this->assertEquals($max_hp, $result);
 }
开发者ID:civilianemail,项目名称:dnd,代码行数:10,代码来源:FinalizeTest.php

示例5: points_game

 function points_game($stat_type, $game, &$stats)
 {
     $this->_init_rosters($stats);
     $kp_id = $this->_stat_type_id('Kills');
     $km_id = $this->_stat_type_id('Killed');
     $cp_id = $this->_stat_type_id('Catches');
     $cm_id = $this->_stat_type_id('Caught');
     foreach ($this->rosters as $team_id => $roster) {
         foreach ($roster as $person_id => $position) {
             $value = $this->_value($kp_id, $person_id, $stats) - $this->_value($km_id, $person_id, $stats) + ($this->_value($cp_id, $person_id, $stats) - $this->_value($cm_id, $person_id, $stats)) * 2;
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Stat'][] = array('game_id' => $game['Game']['id'], 'team_id' => $team_id, 'person_id' => $person_id, 'stat_type_id' => $stat_type['id'], 'value' => $value);
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:16,代码来源:sport_dodgeball.php

示例6: points_game

 function points_game($stat_type, $game, &$stats)
 {
     $this->_init_rosters($stats);
     $t_id = $this->_stat_type_id('Tries');
     $c_id = $this->_stat_type_id('Conversions');
     $pk_id = $this->_stat_type_id('Penalty Kicks');
     $dg_id = $this->_stat_type_id('Drop Goals');
     foreach ($this->rosters as $team_id => $roster) {
         foreach ($roster as $person_id => $position) {
             $value = $this->_value($t_id, $person_id, $stats) * 5 + $this->_value($c_id, $person_id, $stats) * 2 + $this->_value($pk_id, $person_id, $stats) * 3 + $this->_value($dg_id, $person_id, $stats) * 3;
             if (Stat::applicable($stat_type, $position) || $value != 0) {
                 $stats['Stat'][] = array('game_id' => $game['Game']['id'], 'team_id' => $team_id, 'person_id' => $person_id, 'stat_type_id' => $stat_type['id'], 'value' => $value);
             }
         }
     }
 }
开发者ID:roboshed,项目名称:Zuluru,代码行数:16,代码来源:sport_rugby.php

示例7: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validation = Validator::make($input, Former::$rules);
     if ($validation->passes()) {
         $this->former->create($input);
         $data = 'lead in ';
         $url = 'http://eleads.lafilm.com:8088/Cmc.Integration.LeadImport.HttpPost/ImportLeadProcessor.aspx';
         if ($input['program'] == 'BSEB-O' || $input['program'] == 'BSDC-O') {
             $camp = 'MAIN2';
         } else {
             $camp = 'MAIN';
         }
         $post = '';
         $post .= 'Leadsource=' . $input['leadSource'];
         $post .= '&Format=' . $input['format'];
         $post .= '&FirstName=' . $input['FirstName'];
         $post .= '&LastName=' . $input['LastName'];
         $post .= '&Program=' . $input['program'];
         $post .= '&Email=' . $input['email'];
         $post .= '&PostalCodeorZip=' . $input['PostalCodeorZip'];
         $post .= '&Phone=' . $input['Phone'];
         $post .= '&Country=' . $input['Country'];
         $post .= '&PreviousEducation=' . $input['PreviousEducation'];
         $post .= '&leadtype=NEWLEAD&campus=' . $camp;
         $ch = curl_init($url);
         curl_setopt($ch, CURLOPT_POST, 1);
         curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
         curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
         curl_setopt($ch, CURLOPT_HEADER, 0);
         curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
         $response = curl_exec($ch);
         $stat = Input::get('stat_id');
         $stats = Stat::find($stat);
         $stats->convert = 1;
         $stats->save();
         return json_encode(array('msg' => 'Lead Processed', 'res' => $response));
     }
     return 'not true';
 }
开发者ID:bailey9005,项目名称:Laravel-For-Landing-Pages,代码行数:45,代码来源:FormsController.php

示例8: display_infocoms_report

/** Display an infocom report for items like consumables
 *
 * @param $itemtype  item type
 * @param $begin     begin date
 * @param $end       end date
**/
function display_infocoms_report($itemtype, $begin, $end)
{
    global $DB, $valeurtot, $valeurnettetot, $valeurnettegraphtot, $valeurgraphtot, $CFG_GLPI;
    $itemtable = getTableForItemType($itemtype);
    $query = "SELECT `glpi_infocoms`.*\n             FROM `glpi_infocoms`\n             INNER JOIN `{$itemtable}`\n                  ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`\n                      AND `glpi_infocoms`.`itemtype`='{$itemtype}') ";
    switch ($itemtype) {
        case 'Consumable':
            $query .= " INNER JOIN `glpi_consumableitems`\n                        ON (`glpi_consumables`.`consumableitems_id` = `glpi_consumableitems`.`id`) " . getEntitiesRestrictRequest("WHERE", "glpi_consumableitems");
            break;
        case 'Cartridge':
            $query .= " INNER JOIN `glpi_cartridgeitems`\n                        ON (`glpi_cartridges`.`cartridgeitems_id` = `glpi_cartridgeitems`.`id`) " . getEntitiesRestrictRequest("WHERE", "glpi_cartridgeitems");
            break;
        case 'SoftwareLicense':
            $query .= " INNER JOIN `glpi_softwares`\n                        ON (`glpi_softwarelicenses`.`softwares_id` = `glpi_softwares`.`id`) " . getEntitiesRestrictRequest("WHERE", "glpi_softwarelicenses");
            break;
    }
    if (!empty($begin)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` >= '{$begin}'\n                       OR `glpi_infocoms`.`use_date` >= '{$begin}')";
    }
    if (!empty($end)) {
        $query .= " AND (`glpi_infocoms`.`buy_date` <= '{$end}'\n                       OR `glpi_infocoms`.`use_date` <= '{$end}')";
    }
    if ($result = $DB->query($query)) {
        if ($DB->numrows($result) > 0 && ($item = getItemForItemtype($itemtype))) {
            echo "<h2>" . $item->getTypeName(1) . "</h2>";
            echo "<table class='tab_cadre'>";
            $valeursoustot = 0;
            $valeurnettesoustot = 0;
            $valeurnettegraph = array();
            $valeurgraph = array();
            while ($line = $DB->fetch_assoc($result)) {
                if ($itemtype == 'SoftwareLicense') {
                    $item->getFromDB($line["items_id"]);
                    if ($item->fields["serial"] == "global") {
                        if ($item->fields["number"] > 0) {
                            $line["value"] *= $item->fields["number"];
                        }
                    }
                }
                if ($line["value"] > 0) {
                    $valeursoustot += $line["value"];
                }
                $valeurnette = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "n");
                $tmp = Infocom::Amort($line["sink_type"], $line["value"], $line["sink_time"], $line["sink_coeff"], $line["buy_date"], $line["use_date"], $CFG_GLPI["date_tax"], "all");
                if (is_array($tmp) && count($tmp) > 0) {
                    foreach ($tmp["annee"] as $key => $val) {
                        if ($tmp["vcnetfin"][$key] > 0) {
                            if (!isset($valeurnettegraph[$val])) {
                                $valeurnettegraph[$val] = 0;
                            }
                            $valeurnettegraph[$val] += $tmp["vcnetdeb"][$key];
                        }
                    }
                }
                if (!empty($line["buy_date"])) {
                    $year = substr($line["buy_date"], 0, 4);
                    if ($line["value"] > 0) {
                        if (!isset($valeurgraph[$year])) {
                            $valeurgraph[$year] = 0;
                        }
                        $valeurgraph[$year] += $line["value"];
                    }
                }
                $valeurnettesoustot += str_replace(" ", "", $valeurnette);
            }
            $valeurtot += $valeursoustot;
            $valeurnettetot += $valeurnettesoustot;
            if (count($valeurnettegraph) > 0) {
                echo "<tr><td colspan='5' class='center'>";
                ksort($valeurnettegraph);
                $valeurnettegraphdisplay = array_map('round', $valeurnettegraph);
                foreach ($valeurnettegraph as $key => $val) {
                    if (!isset($valeurnettegraphtot[$key])) {
                        $valeurnettegraphtot[$key] = 0;
                    }
                    $valeurnettegraphtot[$key] += $valeurnettegraph[$key];
                }
                Stat::showGraph(array(__('Account net value') => $valeurnettegraphdisplay), array('title' => __('Account net value'), 'width' => 400));
                echo "</td></tr>\n";
            }
            if (count($valeurgraph) > 0) {
                echo "<tr><td colspan='5' class='center'>";
                ksort($valeurgraph);
                $valeurgraphdisplay = array_map('round', $valeurgraph);
                foreach ($valeurgraph as $key => $val) {
                    if (!isset($valeurgraphtot[$key])) {
                        $valeurgraphtot[$key] = 0;
                    }
                    $valeurgraphtot[$key] += $valeurgraph[$key];
                }
                Stat::showGraph(array(_x('price', 'Value') => $valeurgraphdisplay), array('title' => _x('price', 'Value'), 'width' => 400));
                echo "</td></tr>";
            }
            echo "</table>\n";
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:report.infocom.conso.php

示例9: int

// Just in case someone has a older version of neon.
$sStatsTable = $database->CachedQuery("CREATE TABLE IF NOT EXISTS `stats` (`id` int(8) NOT NULL AUTO_INCREMENT, `result` varchar(8) NOT NULL, `type` varchar(65) NOT NULL, `timestamp` int(16) NOT NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1;", array(), 1);
// Pull used/total memory for stats
$sFree = shell_exec('free');
$sFree = (string) trim($sFree);
$sFree_Array = explode("\n", $sFree);
$sMemory = explode(" ", $sFree_Array[1]);
$sMemory = array_filter($sMemory);
$sMemory = array_merge($sMemory);
$sUsedMemory = $sMemory[2];
$sTotalMemory = $sMemory[1];
// Pull server load for stats
$sLoad = sys_getloadavg();
$sLoad = $sLoad[0];
$sStat = new Stat(0);
$sStat->uType = "used_memory";
$sStat->uResult = $sUsedMemory;
$sStat->uTimestamp = time();
$sStat->InsertIntoDatabase();
$sStat = new Stat(0);
$sStat->uType = "total_memory";
$sStat->uResult = $sTotalMemory;
$sStat->uTimestamp = time();
$sStat->InsertIntoDatabase();
$sStat = new Stat(0);
$sStat->uType = "load";
$sStat->uResult = $sLoad;
$sStat->uTimestamp = time();
$sStat->InsertIntoDatabase();
$sOld = time() - 60 * 60 * 24;
$sStatsTable = $database->CachedQuery("DELETE FROM stats WHERE timestamp < '{$sOld}'", array(), 1);
开发者ID:deanet,项目名称:Neon,代码行数:31,代码来源:pull_stats.php

示例10: date

if (isset($_GET["date2"])) {
    $_POST["date2"] = $_GET["date2"];
}
if (empty($_POST["date1"]) && empty($_POST["date2"])) {
    $year = date("Y") - 1;
    $_POST["date1"] = date("Y-m-d", mktime(1, 0, 0, date("m"), date("d"), $year));
    $_POST["date2"] = date("Y-m-d");
}
if (!empty($_POST["date1"]) && !empty($_POST["date2"]) && strcmp($_POST["date2"], $_POST["date1"]) < 0) {
    $tmp = $_POST["date1"];
    $_POST["date1"] = $_POST["date2"];
    $_POST["date2"] = $tmp;
}
if (!isset($_GET["start"])) {
    $_GET["start"] = 0;
}
Stat::title();
echo "<div class='center'><form method='post' name='form' action='stat.item.php'>";
echo "<table class='tab_cadre'><tr class='tab_bg_2'>";
echo "<td class='right'>" . __('Start date') . "</td><td>";
Html::showDateField("date1", array('value' => $_POST["date1"]));
echo "</td><td rowspan='2' class='center'>";
echo "<input type='submit' class='submit' name='submit' value='" . __s('Display report') . "'></td></tr>";
echo "<tr class='tab_bg_2'><td class='right'>" . __('End date') . "</td><td>";
Html::showDateField("date2", array('value' => $_POST["date2"]));
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
Stat::showItems($_SERVER['PHP_SELF'], $_POST["date1"], $_POST["date2"], $_GET['start']);
Html::footer();
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:stat.item.php

示例11: test_getModifier

 function test_getModifier()
 {
     $stat_total = 16;
     $mod = Stat::getModifier($stat_total);
     $result = 3;
     $this->assertEquals($mod, $result);
 }
开发者ID:civilianemail,项目名称:dnd,代码行数:7,代码来源:StatTest.php

示例12: updateMaxHp

 function updateMaxHp()
 {
     $mod = $this->getModifier($_SESSION['con']);
     $proficiencies = Stat::getProficiency();
     $GLOBALS['DB']->exec("UPDATE stats SET max_hp = {$mod} WHERE id = {$this->getId()};");
     $this->setMaxHp($mod);
 }
开发者ID:civilianemail,项目名称:dnd,代码行数:7,代码来源:Stat.php

示例13: getSurvival

 function getSurvival()
 {
     $id = $this->getStatId();
     $stat = Stat::find($id);
     $stat_total = $stat->getSurvival();
     return $stat_total;
 }
开发者ID:civilianemail,项目名称:dnd,代码行数:7,代码来源:Character.php

示例14: array

        }
        Stat::showGraph(array(__('Number opened') => $cleandata), array('title' => __('Number opened'), 'showtotal' => 1, 'unit' => __('Tickets'), 'type' => 'pie'));
    }
    if (isset($data['solved']) && is_array($data['solved'])) {
        foreach ($data['solved'] as $key => $val) {
            $cleandata[Html::clean($key)] = $val;
        }
        Stat::showGraph(array(__('Number solved') => $cleandata), array('title' => __('Number solved'), 'showtotal' => 1, 'unit' => __('Tickets'), 'type' => 'pie'));
    }
    if (isset($data['late']) && is_array($data['late'])) {
        foreach ($data['late'] as $key => $val) {
            $cleandata[Html::clean($key)] = $val;
        }
        Stat::showGraph(array(__('Number solved late') => $cleandata), array('title' => __('Number solved late'), 'showtotal' => 1, 'unit' => __('Tickets'), 'type' => 'pie'));
    }
    if (isset($data['closed']) && is_array($data['closed'])) {
        foreach ($data['closed'] as $key => $val) {
            $newkey = Toolbox::unclean_cross_side_scripting_deep(Html::clean($key));
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array(__('Number closed') => $cleandata), array('title' => __('Number closed'), 'showtotal' => 1, 'unit' => __('Tickets'), 'type' => 'pie'));
    }
    if (isset($data['opensatisfaction']) && is_array($data['opensatisfaction'])) {
        foreach ($data['opensatisfaction'] as $key => $val) {
            $newkey = Toolbox::unclean_cross_side_scripting_deep(Html::clean($key));
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array(__('Satisfaction survey') => $cleandata), array('title' => __('Satisfaction survey'), 'showtotal' => 1, 'unit' => __('Tickets'), 'type' => 'pie'));
    }
}
Html::footer();
开发者ID:glpi-project,项目名称:glpi,代码行数:31,代码来源:stat.location.php

示例15: session_start

<?php

session_start();
// Everything has a beginning...
require_once 'src/Config.php';
$time = microtime();
require_once 'src/ModelEntities.php';
require_once 'src/Common.php';
require_once 'src/Holder.php';
require_once 'src/Dispatcher.php';
require_once 'src/Skeleton.php';
require_once 'src/Stat.php';
Holder::init();
Stat::log();
$app = new AsciiMasterWidget(80);
$skeleton = new Skeleton($app);
require_once Dispatcher::dispatch();
require_once 'src/Template.php';
开发者ID:aimxhaisse,项目名称:kenavo,代码行数:18,代码来源:index.php


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