本文整理匯總了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;
}