Esempio n. 1
0
 public function executeShowHistory()
 {
     $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo');
     $c = new Criteria();
     $c->add(JobPeer::CODE, 'student_type');
     $job = JobPeer::doSelectOne($c);
     $acl = AclPeer::retrieveByPK($group_id, $job->getId());
     if (!$acl) {
         $this->forward('default', 'error404');
     }
     $this->can_edit = $acl->getEditPriv() == 1;
     $this->can_remove = $acl->getRemovePriv() == 1;
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $payment_history = PaymentHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_history);
     $this->payment_history = $payment_history;
     $this->type = 'detail';
     $actions2 = array(array('name' => '<span>Daftar Murid</span>', 'url' => 'student_type/list', 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pembayaran SPP</span>', 'url' => 'student_payment/listSpp?student_id=' . $student->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Pembayaran Lain-lain</span>', 'url' => 'student_payment/listElse?student_id=' . $student->getId(), 'color' => 'sky'));
     array_push($actions2, array('name' => '<span>Histori Pembayaran</span>', 'url' => 'student_payment/listHistory?student_id=' . $student->getId(), 'color' => 'sun', 'type' => 'direct'));
     $this->actions2 = $actions2;
     $this->subtitle = $payment_history->toString() . ' - id:' . $payment_history->getId();
     $this->student = $student;
 }
Esempio n. 2
0
 public function executeDelete()
 {
     $payment_history = PaymentHistoryPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($payment_history);
     $ref_error = 0;
     foreach ($payment_history->getRefCountMethods() as $ref) {
         $method = "count" . $ref['affix'];
         $count = $payment_history->{$method}();
         if ($count > 0) {
             ++$ref_error;
             $this->getRequest()->setError('payment_history/delete/' . sfInflector::camelize($ref['table']), $count);
         }
     }
     if ($ref_error > 0) {
         $this->getRequest()->setError('payment_history/delete', '_ERR_DELETE_ (' . $payment_history->toString() . ' - id:' . $payment_history->getId() . ')');
     } else {
         $payment_history->delete();
     }
     return $this->forward('payment_history', 'list');
 }