mothership-ec / cog-mothership-cp
Cog module for the Mothership Control Panel
Installs: 2 635
Dependents: 8
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 2
Language:JavaScript
Requires
- php: >=5.4.0
- mothership-ec/cog: ~4.0
- mothership-ec/cog-user: ~2.0
Requires (Dev)
- mockery/mockery: dev-master
- dev-develop
- 3.5.5
- 3.5.4
- 3.5.3
- 3.5.2
- 3.5.1
- 3.5.0
- 3.4.3
- 3.4.2
- 3.4.1
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.2.1
- 2.2.0
- 2.1.0
- 2.0.1
- 2.0.0
- 1.8.0
- 1.7.0
- 1.6.1
- 1.6.0
- 1.5.0
- 1.4.0
- 1.3.3
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.6
- 1.1.5
- 1.1.4
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-feature/ux/admin-rebuild
- dev-fulfillment-button-fix
- dev-master
- dev-refer-a-friend
- dev-revert-287-revert-270-feature/ux/product-create
- dev-revert-270-feature/ux/product-create
- dev-feature/ux/product-create
- dev-compatibility/stoneham
- dev-feature/ux/flash-bug
- dev-feature/ux/blog-comments
- dev-feature/ux/overhaul
- dev-feature/ajax-modal-for-forms
- dev-feature/ux/261-font-rendering
- dev-feature/ux/product-process
- dev-reports-totals
- dev-nested-accordian-collapsible
- dev-asset-relocating
- dev-sidebar-js
This package is not auto-updated.
Last update: 2021-03-22 11:07:57 UTC
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() );