public function actionGeneratePdf()
 {
     $this->layout = 'pdf';
     $model = new Entry('search');
     if (isset($_GET['Entry'])) {
         $model->attributes = $_GET['Entry'];
     }
     // to execute the filters (if is the case)
     $dataProvider = $model->search();
     $dataProvider->pagination = false;
     $mPDF1 = Yii::app()->ePdf->mpdf();
     # You can easily override default constructor's params
     $mPDF1 = Yii::app()->ePdf->mpdf('', 'A5');
     # renderPartial (only 'view' of current controller)
     $mPDF1->WriteHTML($this->renderPartial('admin', array('model' => $model), true));
     # Outputs ready PDF
     $mPDF1->Output();
 }
示例#2
0
    $page_number = filter_var($_GET["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
    if (!is_numeric($page_number)) {
        die("Неверный номер страницы!");
    }
    if ($page_number < 1) {
        $page_number = 1;
    }
} else {
    $page_number = 1;
}
// if search do this
if (isset($_GET["search"]) && !empty($_GET["search"])) {
    $search = $_GET["search"];
    $search = trim($search);
    $search = strip_tags($search);
    $entry->search($search);
} else {
    if (isset($_GET["sort"]) && isset($_GET["order"]) && ($_GET["sort"] == "name" || $_GET["sort"] == "url") && ($_GET["order"] == "up" || $_GET["order"] == "down")) {
        $sort = $_GET["sort"];
        $order = $_GET["order"];
        $entry->get_result($page_number, $sort, $order);
    } else {
        $entry->get_result($page_number, "", "");
    }
}
?>
        </table>

        <!-- begin pagination -->
        <div class="text-center">
            <nav>
示例#3
0
function getCustomerHistory($id)
{
    if (is_null($id)) {
        Functions::setResponse(400);
    }
    try {
        $c = new Customer($id);
        $whereClause = 'customer_id = :cid';
        $params = array(array('id' => ':cid', 'value' => $id, 'type' => PDO::PARAM_INT));
        return Entry::search($whereClause, $params);
    } catch (RuntimeException $e) {
        if (!isset($c)) {
            Functions::setResponse(404);
        }
    }
}