public function getAcademicCostComponent($con = null) { include_once 'lib/model/om/BaseAcademicCostComponentPeer.php'; if ($this->aAcademicCostComponent === null && $this->academic_cost_component_id !== null) { $this->aAcademicCostComponent = AcademicCostComponentPeer::retrieveByPK($this->academic_cost_component_id, $con); } return $this->aAcademicCostComponent; }
public function executeListDetail() { $cost_id = $this->getRequestParameter('academic_cost_component_id'); $user_id = $this->getRequestParameter('user_id'); $paid_at = $this->getRequestParameter('paid_at'); $academic_cost_component = AcademicCostComponentPeer::retrieveByPK($cost_id); $this->forward404Unless($academic_cost_component); $user = UserPeer::retrieveByPK($user_id); $this->forward404Unless($user); $tanggal = substr($paid_at, 8, 2); $bln = substr($paid_at, 5, 2); $tahun = substr($paid_at, 0, 4); $title = MonthPeer::retrieveByPK($bln); $this->forward404Unless($title); $c = new Criteria(); $c->add(VInfaqPaymentPeer::USER_ID, $user_id); $c->add(VInfaqPaymentPeer::PAID_AT, $paid_at); $c->add(VInfaqPaymentPeer::ACADEMIC_COST_COMPONENT_ID, $academic_cost_component->getId()); $this->sortPayment($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterPayment($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', 50, 'pay_history')); $this->getUser()->setAttribute('max_per_page', $rpp, 'pay_history'); $pager = new sfPropelPager('VInfaqPayment', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'pay_history')); $this->getUser()->setAttribute('page', $page, 'pay_history'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { if ($key == 'PAID_AT') { $filter_string .= "&filters[{$key}][from]=" . $val['from']; $filter_string .= "&filters[{$key}][to]=" . $val['to']; } else { if ($val != '' && $val != null) { $filter_string .= "&filters[{$key}]={$val}"; } } } $filter_string = preg_replace('/^&/', '', $filter_string); } array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "history_applicant/listDetailAsCSV?{$filter_string}&academic_cost_component_id=" . $cost_id . "&user_id=" . $user_id . "&paid_at=" . $paid_at, 'color' => 'white', 'type' => 'direct')); array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "history_applicant/listDetailAsPDF?{$filter_string}&academic_cost_component_id=" . $cost_id . "&user_id=" . $user_id . "&paid_at=" . $paid_at, 'color' => 'white', 'type' => 'direct')); $this->actions = $actions; $this->tanggal = $tanggal; $this->bln = $bln; $this->tahun = $tahun; $this->cost_id = $cost_id; $this->user_id = $user_id; $this->paid_at = $paid_at; if ($user) { $this->subtitle = $academic_cost_component->toString() . ' - ' . $user->getLogin() . ' (' . $tanggal . ' ' . $title->getName() . ' ' . $tahun . ')'; } else { $this->subtitle = $academic_cost_component->toString() . ' (' . $tanggal . ' ' . $title->getName() . ' ' . $tahun . ')'; } }