Ejemplo n.º 1
0
 public function executeAddbadge()
 {
     $c = new Criteria();
     $c->add(BadgePeer::NAME, $this->getRequestParameter('badge'));
     $exbadge = BadgePeer::doSelectOne($c);
     if ($exbadge) {
         $this->setFlash('notice', 'Badge could not be added. A badge with this name already exists.');
     } else {
         $badge = new Badge();
         $badge->setName($this->getRequestParameter('badge'));
         $badge->save();
         $this->setFlash('notice', 'Badge <b>' . $badge->getName() . '</b> added successfully.');
     }
     $this->redirect('/admin/badges');
 }