public function __construct() { $this->id = 'SFMGrid'; $this->source = SFM::table(); $this->endpoint = __HOME__ . '/sfm/grid'; $this->columns = ['id' => ['visible' => false], 'name' => ['label' => _('Name')], 'category' => ['label' => _('Category')], 'created' => ['label' => _('Created')], 'lastedit' => ['label' => _('Last edit')], 'command' => ['label' => _('Command'), 'field' => 'id', 'sortable' => false, 'html' => '<a href="' . __HOME__ . '/sfm/detail/id/{?}" class="btn btn-xs btn-success">' . _('View') . '</a> ' . '<a href="' . __HOME__ . '/sfm/modify/id/{?}" class="btn btn-xs btn-primary"><i class="glyphicon glyphicon-pencil"></i>' . _('Edit') . '</a> ' . '<button class="btn btn-xs btn-danger" type="button" data-toggle="modal" data-target="#modal-delete" data-delete-url="' . __HOME__ . '/sfm/delete/id/{?}"><i class="glyphicon glyphicon-trash"></i>' . _('Delete') . '</button>']]; $this->events = ['row.click' => 'window.location = "' . __HOME__ . '/sfm/detail/id/"+id;']; }
<?php require_once __BASE__ . '/model/Storable.php'; class SFM extends Storable { public $id = MYSQL_PRIMARY_KEY; public $name = ''; public $description = MYSQL_TEXT; public $version = ''; public $created = MYSQL_DATETIME; public $lastedit = MYSQL_DATETIME; public $active = true; public $demo_url = ''; public $category = ''; } SFM::schemadb_update();
public function renderAction() { $item = SFM::load($_POST['id']); echo json_encode($item); }