Exemple #1
2
 /**
  * Returns an array of properties representing the 'value' of a badge.
  *
  * @param Badge $badge Value should be returned.
  *
  * @return an array of values of the given badges
  */
 private static function getValue(Badge $badge)
 {
     return array("name" => $badge->getName());
 }
 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');
 }