public static function fetchAll($where = null, $order = null, $limit = null, $offset = null) { $resultSet = self::getDbTable()->fetchAll($where, $order, $limit, $offset); $entries = array(); foreach ($resultSet as $row) { $entry = new Application_Model_O_GlobalConsultationApply(); $entry->setId($row->id)->setDepartment_category_id($row->department_category_id)->setDepartment_id($row->department_id)->setEmail($row->email)->setMobile($row->mobile)->setAge($row->age)->setSex($row->sex)->setLocation($row->location)->setTreatment_time($row->treatment_time)->setOpinion($row->opinion)->setReport($row->report)->setCtime($row->ctime)->setUtime($row->utime)->setStatus($row->status); $entry->setNew(false); $entries[] = $entry; } return $entries; }
public static function fetchAllPage($page = 1, $perpage = 30) { $select = self::select(); $adapter = new Zend_Paginator_Adapter_DbTableSelect($select); $paginator = new Zend_Paginator($adapter); $paginator->setItemCountPerPage($perpage)->setCurrentPageNumber($page); $data = $paginator->getCurrentItems(); $pages = $paginator->count(); $applys = array(); if (count($data) > 0) { foreach ($data as $da) { $applyModel = new Application_Model_O_GlobalConsultationApply(); $applyModel->setId($da->id)->setDepartment_category_id($da->department_category_id)->setDepartment_id($da->department_id)->setEmail($da->email)->setMobile($da->mobile)->setAge($da->age)->setSex($da->sex)->setLocation($da->location)->setTreatment_time($da->treatment_time)->setOpinion($da->opinion)->setReport($da->report)->setCtime($da->ctime)->setUtime($da->utime)->setStatus($da->status); array_push($applys, $applyModel); } } $res = array('applys' => $applys, 'pages' => $pages); return $res; }