定制 mothership-ec/cog-mothership-cp 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mothership-ec/cog-mothership-cp

最新稳定版本:3.5.5

Composer 安装命令:

composer require mothership-ec/cog-mothership-cp

包简介

Cog module for the Mothership Control Panel

README 文档

README

Main menu building

Group markup

This is the markup required for groups of content, repeatable groups and dual column groups.

<!-- Normal group -->
<section class="group">
	<h2 class="title">Group title</h2>
	<div class="content">
		...
	</div>
</section>

<!-- Group grid layout -->
<section class="group-grid">
	<div class="row">
		<div class="group">
			<h2 class="title">Group title</h2>
			<div class="content">
				...
			</div>
		</div>
		<div class="group">
			<h2 class="title">Group title</h2>
			<div class="content">
				...
			</div>
		</div>
		<div class="group">
			<h2 class="title">Group title</h2>
			<div class="content">
				...
			</div>
		</div>
	</div>
</section>

<!-- Repeatable group -->
<section class="repeatable-group">
	<div class="group">
		<h2 class="title">Group title</h2>
		<div class="content">
			...
		</div>
	</div>
	<div class="group">
		<h2 class="title">Group title</h2>
		<div class="content">
			...
		</div>
	</div>
	<div class="group">
		<h2 class="title">Group title</h2>
		<div class="content">
			...
		</div>
	</div>
	<div class="group">
		<h2 class="title">Group title</h2>
		<div class="content">
			...
		</div>
	</div>
</section>

<!-- Dual column  -->
<section class="dual-column">
	<h2 class="title">Test title</h2>
	<div class="content">
		<div class="column">
			...
		</div>
		<div class="column">
			...
		</div>
	</div>
</section>

Dashboards and Statistics

Datasets

Register new dataset

$services->extend('statistics', function($statistics, $c) {
    // Simple value counter
	$statistics->add(new MyDataset($c['db.query'], $c['statistics.counter'], $c['statistics.range.date']));

	// Key based counter
	$statistics->add(new MyKeyDataset($c['db.query'], $c['statistics.counter.key'], $c['statistics.range.date']));
});
class MyDataset extends AbstractDataset
{
    public function getName()
    {
        return 'my.dataset';
    }

    public function getPeriodLength()
    {
        return static::DAILY;
    }

    public function rebuild()
    {
        // add rebuilding sql to transaction and commit if not overridden
    }
}

Get a dataset

$dataset = $this->get('statistics')->get('my.dataset');

Push a value

$dataset->counter->push($value);

Set a value by key

$dataset->counter->set($key, $value);

Get the current counter

$dataset->counter->get();
$dataset->counter->get($key);

Increment / decrement

$dataset->counter->increment();
$dataset->counter->decrement($step);

$dataset->counter->decrement($key);
$dataset->counter->increment($key, $step);

Get a range of values

// From the beginning of time
$values = $dataset->range->getValues(0);

// From a week ago
$values = $dataset->range->getValues(
    $dataset->range->getWeekAgo()
);

// Previous month
$values = $dataset->range->getValues(
    $dataset->range->getMonthAgo(1),
    $dataset->range->getMonthAgo()
);

Get a range of values with keys

$data = $dataset->range->getKeyValues(0);

Get average of values

$monthAverage = $dataset->range->getAverage(
    $dataset->range->getMonthAgo()
);

Get total of values

$yearToDate = $dataset->range->getTotal(
    $dataset->range->getYearAgo()
);

统计信息

  • 总下载量: 2.7k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 8
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 4
  • Forks: 2
  • 开发语言: JavaScript

其他信息

  • 授权协议: proprietary
  • 更新时间: 2015-02-24