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

PHP Stat类代码示例

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

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



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


示例16: postLoad

 public function postLoad()
 {
     $job = Input::get('job');
     $level = Input::get('level');
     $craftable_only = Input::get('craftable_only');
     $rewardable_too = Input::get('rewardable_too');
     // All Jobs
     $job_list = ClassJob::get_name_abbr_list();
     // Jobs are capital
     $desired_job = strtoupper($job);
     $job = ClassJob::get_by_abbr($desired_job);
     // What stats do the class like?
     $stat_ids_to_focus = Stat::get_ids(Stat::focus($job->abbr->term));
     View::share('job_list', $job_list);
     View::share('job', $job);
     View::share('stat_ids_to_focus', $stat_ids_to_focus);
     View::share('level', $level);
     $equipment = Item::calculate($job->id, $level, 0, $craftable_only, $rewardable_too);
     exit(json_encode($this->getOutput($equipment)));
 }
开发者ID:sevenredreturns,项目名称:ffxivcrafting,代码行数:20,代码来源:EquipmentController.php


示例17: switch

                switch ($params["type"]) {
                    case "comp_champ":
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
                        Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
                        break;
                    case "device":
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["dropdown"]);
                        Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $params["dropdown"]);
                        break;
                    default:
                        $val2 = isset($params['value2']) ? $params['value2'] : 0;
                        $val = Stat::getItems($_GET["itemtype"], $params["date1"], $params["date2"], $params["type"], $val2);
                        Stat::showTable($_GET["itemtype"], $params["type"], $params["date1"], $params["date2"], $params["start"], $val, $val2);
                }
            } else {
                if (isset($_GET["type"]) && $_GET["type"] == "hardwares") {
                    Stat::showItems("", $_GET["date1"], $_GET["date2"], $_GET['start']);
                }
            }
            break;
        default:
            // Plugin case
            if ($plug = isPluginItemType($_GET["item_type"])) {
                if (Plugin::doOneHook($plug['plugin'], 'dynamicReport', $_GET)) {
                    exit;
                }
            }
            $params = Search::manageParams($_GET["item_type"], $_GET);
            Search::showList($_GET["item_type"], $params);
    }
}
开发者ID:btry,项目名称:glpi,代码行数:31,代码来源:report.dynamic.php


示例18: foreach

    }
    if (isset($data['solved']) && is_array($data['solved'])) {
        foreach ($data['solved'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['stats'][11], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['late']) && is_array($data['late'])) {
        foreach ($data['late'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][19] => $cleandata), array('title' => $LANG['stats'][19], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['closed']) && is_array($data['closed'])) {
        foreach ($data['closed'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['stats'][17], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
    if (isset($data['opensatisfaction']) && is_array($data['opensatisfaction'])) {
        foreach ($data['opensatisfaction'] as $key => $val) {
            $newkey = html_clean($key);
            $cleandata[$newkey] = $val;
        }
        Stat::showGraph(array($LANG['stats'][11] => $cleandata), array('title' => $LANG['satisfaction'][3], 'showtotal' => 1, 'unit' => $LANG['stats'][35], 'type' => 'pie'));
    }
}
commonFooter();
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:stat.tracking.php


示例19: display_infocoms_report

/** Display an infocom report
 *
 * @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                    `{$itemtable}`.`name` AS name,\n                    `{$itemtable}`.`ticket_tco`,\n                    `glpi_entities`.`completename` AS entname,\n                    `glpi_entities`.`id` AS entID\n             FROM `glpi_infocoms`\n             INNER JOIN `{$itemtable}` ON (`{$itemtable}`.`id` = `glpi_infocoms`.`items_id`\n                                         AND `glpi_infocoms`.`itemtype` = '{$itemtype}')\n             LEFT JOIN `glpi_entities` ON (`{$itemtable}`.`entities_id` = `glpi_entities`.`id`)\n             WHERE `{$itemtable}`.`is_template` = '0' " . getEntitiesRestrictRequest("AND", $itemtable);
    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}') ";
    }
    $query .= " ORDER BY entname ASC, `buy_date`, `use_date`";
    $display_entity = Session::isMultiEntitiesMode();
    $result = $DB->query($query);
    if ($DB->numrows($result) > 0 && ($item = getItemForItemtype($itemtype))) {
        echo "<h2>" . $item->getTypeName(1) . "</h2>";
        echo "<table class='tab_cadre'><tr><th>" . __('Name') . "</th>";
        if ($display_entity) {
            echo "<th>" . __('Entity') . "</th>";
        }
        echo "<th>" . _x('price', 'Value') . "</th><th>" . __('ANV') . "</th>";
        echo "<th>" . __('TCO') . "</th><th>" . __('Date of purchase') . "</th>";
        echo "<th>" . __('Startup date') . "</th><th>" . __('Warranty expiration date') . "</th></tr>";
        $valeursoustot = 0;
        $valeurnettesoustot = 0;
        $valeurnettegraph = array();
        $valeurgraph = array();
        while ($line = $DB->fetch_assoc($result)) {
            if (isset($line["is_global"]) && $line["is_global"] && $item->getFromDB($line["items_id"])) {
                $line["value"] *= Computer_Item::countForItem($item);
            }
            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);
            echo "<tr class='tab_bg_1'><td>" . $line["name"] . "</td>";
            if ($display_entity) {
                echo "<td>" . $line['entname'] . "</td>";
            }
            echo "<td class='right'>" . Html::formatNumber($line["value"]) . "</td>" . "<td class='right'>" . Html::formatNumber($valeurnette) . "</td>" . "<td class='right'>" . Infocom::showTco($line["ticket_tco"], $line["value"]) . "</td>" . "<td>" . Html::convDate($line["buy_date"]) . "</td>" . "<td>" . Html::convDate($line["use_date"]) . "</td>" . "<td>" . Infocom::getWarrantyExpir($line["buy_date"], $line["warranty_duration"]) . "</td></tr>";
        }
        $valeurtot += $valeursoustot;
        $valeurnettetot += $valeurnettesoustot;
        $tmpmsg = sprintf(__('Total: Value=%1$s - Account net value=%2$s'), Html::formatNumber($valeursoustot), Html::formatNumber($valeurnettesoustot));
        echo "<tr><td colspan='6' class='center'><h3>{$tmpmsg}</h3></td></tr>";
        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>";
        }
        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>";
        return true;
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:report.infocom.php


示例20: ini_set

<?php

ini_set('display_errors', "On");
error_reporting(E_ALL | E_STRICT);
//自动加载类
set_include_path(get_include_path() . PATH_SEPARATOR . 'class/');
//设置加载路径
spl_autoload_extensions('.php');
//设置加载后缀名
function myAutoload($className)
{
    require_once $className . '.php';
    //直接根据类名跟文件关系包含文件
}
spl_autoload_register("myAutoload");
//注册自动加载函数
//测试代码开始
echo Stat::getInstance()->sayHi();
echo '<br>';
echo Teacher::getInstance()->sayHi();
echo '<br>';
class People
{
    function sayHi()
    {
        return 'Hello i am a people?';
    }
}
echo Singleton::getInstance('People')->sayHi();
echo '<hr>';
echo file_get_contents('./read.txt');
开发者ID:zhaojianhui129,项目名称:headFirst,代码行数:31,代码来源:index.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP State类代码示例发布时间:2022-05-23
下一篇:
PHP Starkers_Utilities类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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