本文整理汇总了PHP中CRUD::setModel方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::setModel方法的具体用法?PHP CRUD::setModel怎么用?PHP CRUD::setModel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRUD
的用法示例。
在下文中一共展示了CRUD::setModel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setModel
function setModel($m, $a = null, $b = null)
{
parent::setModel($m, $a, $b);
if ($this->grid) {
$this->grid->addColumn('button', 'test');
if ($_GET[$this->grid->name . '_test']) {
$this->grid->model->load($_GET['test'])->test();
$this->js()->univ()->location($this->api->url())->execute();
}
}
}
示例2: setModel
function setModel($a, $b = null, $c = null)
{
$r = parent::setModel($a, $b, $c);
if ($this->grid) {
$this->grid->addButton("Export CSV")->js("click")->redirect($this->api->url(null, array("export_csv" => $this->grid->name)));
$this->grid->addButton("Export PDF")->js("click")->redirect($this->api->url(null, array("export_pdf" => $this->grid->name)));
$this->grid->addButton("Export XLS")->js("click")->redirect($this->api->url(null, array("export_xls" => $this->grid->name)));
if ($_GET["export_csv"] == $this->grid->name) {
$this->preFetchData("csv");
/* format csv, export */
$export = $this->add("Export");
$data = $export->getDataFromMVCGrid($this->grid);
$export->setHeaderModel($this->grid->getController()->getModel());
$export->convertToCSV($data);
$export->exportCSV("export.csv");
}
if ($_GET["export_pdf"] == $this->grid->name) {
/* format csv, export */
$this->preFetchData("pdf");
$export = $this->add("Export");
$data = $export->getDataFromMVCGrid($this->grid);
$export->setHeaderModel($this->grid->getController()->getModel());
$export->convertToPDF($data);
$export->exportPDF("export.pdf");
}
if ($_GET["export_xls"] == $this->grid->name) {
$this->preFetchData("xls");
/* format csv, export */
$export = $this->add("Export");
$data = $export->getDataFromMVCGrid($this->grid);
$export->setHeaderModel($this->grid->getController()->getModel());
$export->setConverterTemplate("export/xls");
$export->convertToXLS($data);
$export->exportXLS("export.xls");
}
}
return $r;
}