Added fields to Preordercampaign
This commit is contained in:
57
application/Contract/ContractController.php
Normal file
57
application/Contract/ContractController.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
class ContractController extends mfBaseController {
|
||||
|
||||
protected function init() {
|
||||
$this->needlogin=true;
|
||||
$me = new User();
|
||||
$me->loadMe();
|
||||
$this->me = $me;
|
||||
$this->layout()->set("me",$me);
|
||||
|
||||
if(!$me->is(["Admin"])) {
|
||||
$this->redirect("Dashboard");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected function indexAction() {
|
||||
$this->layout()->setTemplate("Contract/Index");
|
||||
|
||||
$rfilter = $this->request->filter;
|
||||
iF(!is_array($rfilter)) {
|
||||
$rfilter = [];
|
||||
}
|
||||
|
||||
$this->layout->set("filter", $rfilter);
|
||||
|
||||
$filter = $this->getPreparedFilter($rfilter);
|
||||
|
||||
// pagination defaults
|
||||
$pagination = [];
|
||||
$pagination['start'] = 0;
|
||||
$pagination['count'] = 50;
|
||||
$pagination['maxItems'] = 0;
|
||||
|
||||
if(is_numeric($this->request->s)) {
|
||||
$pagination['start'] = intval($this->request->s);
|
||||
}
|
||||
//var_dump($filter);exit;
|
||||
$pagination['maxItems'] = ContractModel::count($filter);
|
||||
$contracts = ContractModel::search($filter, $pagination);
|
||||
|
||||
$this->layout()->set("contracts", $contracts);
|
||||
}
|
||||
|
||||
private function getPreparedFilter($filter) {
|
||||
$new_filter = [];
|
||||
|
||||
if(is_array($filter) && count($filter)) {
|
||||
foreach($filter as $name => $value) {
|
||||
$new_filter[$name] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $new_filter;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user