/** * @param $path * @param $key * @param $secret * @return bool|Storage */ static function create($path, $key, $secret) { $_data = new StorageData(array()); $_data->key = $key; $_data->secret = $secret; $_dataArr = $_data->export(); $_file = json_encode($_dataArr); $fe = file_put_contents($path, $_file); if (!$fe) { return false; } return new Storage($path); }
public function getData() { if (!is_object($this->data)) { $objElements = StorageData::selectByItemId($this->getId()); if ($objElements->count() > 0) { $this->data = $objElements->current(); } else { $this->data = new StorageData(); } } return $this->data; }
<?php namespace CurrantPi; include 'content/storage/StorageData.php'; $storage = new StorageData(); $storage_data = $storage->getData(); ?> <h4><i class="demo-icon icon-database"></i> Storage</h4> <table class="table table-striped table-hover"> <thead> <tr> <th><p>Filesystem</p></th> <th><p class='text-center'>Size</p></th> <th><p class='text-center'>Available</p></th> <th><p id='storage_pct_bars' class='text-center'>% Used</p></th> <th><p class='text-right'>Mounted</p></th> </tr> </thead> <tbody> <?php foreach ($storage_data->storage as $row) { echo '<tr>'; $col_count = 0; foreach ($row as $item) { switch ($col_count) { // First Column - The file system. Should be left aligned. case 0: echo "<td><p>{$item}</p></td>";