Ejemplo n.º 1
0
 public function executeDelete()
 {
     $this->ng_reg_period = NgRegPeriodPeer::retrieveByPK($this->getRequestParameter('ng_reg_period_id'));
     $this->forward404Unless($this->ng_reg_period);
     $this->ng_reg_detail = NgRegTestPeriodPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($this->ng_reg_detail);
     $c = new Criteria();
     $c->add(NgTestSchedulePeer::NG_REG_TEST_PERIOD_ID, $this->ng_reg_detail->getId());
     $test_sched = NgTestSchedulePeer::doSelect($c);
     if ($test_sched) {
         $sched_count = NgTestSchedulePeer::doCount($c);
         $test_appl = 0;
         foreach ($test_sched as $ts) {
             $ct = new Criteria();
             $ct->add(NgTestApplSchedPeer::NG_TEST_SCHEDULE_ID, $ts->getId());
             $tas = NgTestApplSchedPeer::doSelect($ct);
             if ($tas) {
                 foreach ($tas as $ta) {
                     $test_appl += 1;
                     $ta->delete();
                 }
             }
             $ts->delete();
         }
         #$this->info = 'Data yg dihapus';
         $this->getRequest()->setError('ng_reg_detail/delete', '_DATA_DELETE_ ' . $this->ng_reg_detail->toString() . ' (' . $test_appl . ' Jadwal #' . $sched_count . ' Pendaftar)');
         $this->ng_reg_detail->delete();
     } else {
         $this->ng_reg_detail->delete();
     }
     $this->getRequest()->setParameter('id', $this->ng_reg_period->getId());
     return $this->forward('ng_reg_detail', 'list');
 }
Ejemplo n.º 2
0
 public function getNgTestApplScheds($criteria = null, $con = null)
 {
     include_once 'lib/model/om/BaseNgTestApplSchedPeer.php';
     if ($criteria === null) {
         $criteria = new Criteria();
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collNgTestApplScheds === null) {
         if ($this->isNew()) {
             $this->collNgTestApplScheds = array();
         } else {
             $criteria->add(NgTestApplSchedPeer::NG_TEST_SCHEDULE_ID, $this->getId());
             NgTestApplSchedPeer::addSelectColumns($criteria);
             $this->collNgTestApplScheds = NgTestApplSchedPeer::doSelect($criteria, $con);
         }
     } else {
         if (!$this->isNew()) {
             $criteria->add(NgTestApplSchedPeer::NG_TEST_SCHEDULE_ID, $this->getId());
             NgTestApplSchedPeer::addSelectColumns($criteria);
             if (!isset($this->lastNgTestApplSchedCriteria) || !$this->lastNgTestApplSchedCriteria->equals($criteria)) {
                 $this->collNgTestApplScheds = NgTestApplSchedPeer::doSelect($criteria, $con);
             }
         }
     }
     $this->lastNgTestApplSchedCriteria = $criteria;
     return $this->collNgTestApplScheds;
 }
Ejemplo n.º 3
0
 public static function retrieveByPKs($pks, $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(self::DATABASE_NAME);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria();
         $criteria->add(NgTestApplSchedPeer::ID, $pks, Criteria::IN);
         $objs = NgTestApplSchedPeer::doSelect($criteria, $con);
     }
     return $objs;
 }