本文整理汇总了PHP中Statistics类的典型用法代码示例。如果您正苦于以下问题:PHP Statistics类的具体用法?PHP Statistics怎么用?PHP Statistics使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Statistics类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: statistics
/**
* to increase the count for different keywords
* @param string $keyword - keyword of different function
*/
protected function statistics($keyword)
{
if ($keyword == null) {
return;
}
$statistics = new Statistics();
$statistics->add($keyword);
}
示例2: process
public function process($parameters)
{
$statistics = new Statistics();
$this->head['title'] = 'Štatistiky webu';
$this->data['usersByArticles'] = $statistics->returnUsersByArticles();
$this->data['usersByComments'] = $statistics->returnUsersByComments();
$this->data['articlesByVisits'] = $statistics->returnArticlesByVisits();
$this->view = 'statistics';
}
示例3: process
public function process($parameters)
{
$statistics = new Statistics();
$validation = new Validation();
$this->head['title'] = 'Štatistiky webu';
$this->data['articlesByVisits'] = array();
$articles = $statistics->returnArticlesByVisits();
//skratenie titulkov jednotlivych clankov na 35 znakov
foreach ($articles as $article) {
$article['title'] = $validation->stringLimitLenght($article['title'], 35);
$this->data['articlesByVisits'][] = $article;
}
$this->view = 'statistics';
}
示例4: postInsert
public function postInsert($event)
{
$oStatistics = new Statistics();
$oStatistics->setCategoryId($this->getId());
try {
$iPeriod = Period::getCurrentPeriod();
} catch (sfException $e) {
return;
}
if (false !== $iPeriod) {
$oStatistics->setPeriodId($iPeriod);
$oStatistics->save();
}
}
示例5: extractPage
public function extractPage($pageID, $pageTitle, $pageSource)
{
$this->extractor->setPageURI($pageID);
if (!$this->extractor->isActive()) {
return $result = new ExtractionResult($pageID, $this->extractor->getLanguage(), $this->getExtractorID());
}
Timer::start($this->extractor->getExtractorID());
$result = $this->extractor->extractPage($pageID, $pageTitle, $pageSource);
Timer::stop($this->extractor->getExtractorID());
Timer::start('validation');
//$this->extractor->check();
if (Options::getOption('validateExtractors')) {
ValidateExtractionResult::validate($result, $this->extractor);
}
Timer::stop('validation');
Statistics::increaseCount($this->extractor->getExtractorID(), 'created_Triples', count($result->getTriples()));
Statistics::increaseCount('Total', 'created_Triples', count($result->getTriples()));
if ($this->extractor->isGenerateOWLAxiomAnnotations()) {
$triples = $result->getTriples();
if (count($triples) > 0) {
foreach ($triples as $triple) {
$triple->addDCModifiedAnnotation();
$triple->addExtractedByAnnotation($this->extractor->getExtractorID());
}
}
}
return $result;
}
示例6: get
public static function get($series)
{
$total = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series));
$week = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series, ' AND `key`>' . (time() - 7 * 60 * 60 * 24)));
$day = $GLOBALS['PW_DB']->executeRaw(Statistics::getSQL($series, ' AND `key`>' . (time() - 60 * 60 * 24)));
return array($total[0], $week[0], $day[0]);
}
示例7: getInstance
public static function getInstance()
{
if (!isset(self::$instace)) {
self::$instace = new Statistics();
}
return self::$instace;
}
示例8: __construct
public function __construct(array $samples, array $stats = [])
{
if (count($samples) < 1) {
throw new \LogicException('Cannot create a distribution with zero samples.');
}
$this->samples = $samples;
$this->closures = ['min' => function () {
return min($this->samples);
}, 'max' => function () {
return max($this->samples);
}, 'sum' => function () {
return array_sum($this->samples);
}, 'stdev' => function () {
return Statistics::stdev($this->samples);
}, 'mean' => function () {
return Statistics::mean($this->samples);
}, 'mode' => function () {
return Statistics::kdeMode($this->samples);
}, 'variance' => function () {
return Statistics::variance($this->samples);
}, 'rstdev' => function () {
$mean = $this->getMean();
return $mean ? $this->getStdev() / $mean * 100 : 0;
}];
if ($diff = array_diff(array_keys($stats), array_keys($this->closures))) {
throw new \RuntimeException(sprintf('Unknown pre-computed stat(s) encountered: "%s"', implode('", "', $diff)));
}
$this->stats = $stats;
}
示例9: skate
public function skate()
{
parent::isAllowedToAccess();
parent::setLayout('defaultLayout');
parent::setView('skate');
$this->data['parameters'] = $this->parameters;
$this->data['orders'] = Statistics::getOrdersOverview(1, '2015-12-02', '2015-12-15');
parent::renderLayout();
}
示例10: getStat
/**
* This method returns Statistics object to create the pie graph or the status list
* @return Statistics
*/
public function getStat()
{
$count = array();
$size = array();
$blks = array();
$db_result = $this->db_request->select(null, ACCT_TABLE, array(STATUS), null);
$stat = new Statistics();
foreach ($db_result as $line) {
$stname = $this->db_request->statusName($line[STATUS]);
$count[$stname] = $line['SUM(' . COUNT . ')'];
$size[$stname] = $line['SUM(' . SIZE . ')'];
$blks[$stname] = $line['SUM(' . BLOCKS . ')'];
}
$stat->setSize($size);
$stat->setBlocks($blks);
$stat->setCount($count);
return $stat;
}
示例11: setSmarty
public function setSmarty()
{
$statistics = Statistics::getInstance();
$month_info = $statistics->getCurrentMonthSalesInformation();
$this->context->smarty->assign("operations", $month_info['operations']);
$this->context->smarty->assign("month_sales", $month_info['total']);
$this->context->smarty->assign("page_title", "Shop page");
$this->context->smarty->display("shop.tpl");
}
示例12: getFullStatistics
/**
* Returns row by input data
*
* @param integer $iPeriodId
* @param integer $iCategoryId: null
* @return Statistics
*/
public function getFullStatistics($iPeriodId, $iCategoryId = null)
{
$q = Doctrine_Query::create()->select('s.*')->from('Statistics s')->where('s.period_id=?', $iPeriodId)->limit(1);
if (null !== $iCategoryId) {
$q->andWhere('s.category_id=?', $iCategoryId);
} else {
$q->andWhere('s.category_id IS NULL');
}
$stat = $q->fetchOne();
if (!is_object($stat)) {
$stat = new Statistics();
$stat->setPeriodId($iPeriodId);
if (null !== $iCategoryId) {
$stat->setCategoryId($iCategoryId);
}
$stat->save();
}
return $stat;
}
示例13: getDashboard
/**
* Displays the administration dashboard
*
* @access public
* @return \Illuminate\Support\Facades\View
*/
public function getDashboard()
{
// Get all stats for the last 1 month
$duration = Site::config('general')->statsDisplay;
$date = date('Y-m-d', strtotime($duration));
$stats = Statistics::where('date', '>', $date)->orderBy('date')->get()->toArray();
// Build the view data
$data = array('users' => User::count(), 'pastes' => Paste::count(), 'php_version' => phpversion(), 'sn_version' => Config::get('app.version'), 'db_driver' => Config::get('database.default'), 'stats' => $stats);
return View::make('admin/dashboard', $data);
}
示例14: getStat
/**
* This method returns Statistics object to create the pie graph or the user list
* @return Statistics
*/
public function getStat()
{
$count = array();
$size = array();
$blks = array();
$db_result = $this->db_request->select(null, ACCT_TABLE, array(GROUP), null);
$stat = new Statistics();
foreach ($db_result as $line) {
if ($line[GROUP] && $line['SUM(' . COUNT . ')'] && $line['SUM(' . SIZE . ')']) {
$count[$line[GROUP]] = $line['SUM(' . COUNT . ')'];
$size[$line[GROUP]] = $line['SUM(' . SIZE . ')'];
$blks[$line[GROUP]] = $line['SUM(' . BLOCKS . ')'];
}
}
$stat->setSize($size);
$stat->setBlocks($blks);
$stat->setCount($count);
return $stat;
}
示例15: defaultView
public function defaultView()
{
parent::isAllowedToAccess();
parent::setLayout('defaultLayout');
parent::setView('default');
$this->data['parameters'] = $this->parameters;
$this->data['clicks'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/');
$this->data['clicks2'] = Statistics::getClicksOverview(1, '1366x768', 'www.skate-praha.cz/');
$this->data['clicks3'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/kosik/');
$this->data['clicks4'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/pokladna/');
$this->data['clicks5'] = Statistics::getClicksOverview(1, '1920x1080', 'www.skate-praha.cz/rekapitulace/');
parent::renderLayout();
}