public function delete(\model\Participant $participant)
 {
     $db = $this->connection();
     $sql = "DELETE FROM {$this->dbTable} WHERE uniqueKey = ?";
     $params = array($participant->getUnique());
     $query = $db->prepare($sql);
     $query->execute($params);
 }
Example #2
0
 /**
  * Generate HTML form to create a new project bound to a participant.
  * 
  * @param \model\Participant $owner The participant that should get the project registred to it.
  * 
  * @return String HTML
  */
 public function getForm(\model\Participant $owner)
 {
     $userUnique = $owner->getUnique();
     $html = "<h1>Add project to " . $owner->getName() . "</h1>";
     $html .= "<form action='?action=" . NavigationView::$actionAddProject . "' method='post'>";
     $html .= "<input type='hidden' name='" . self::$userUnique . "' value='{$userUnique}' />";
     $html .= "<input type='text' name='" . self::$name . "' />";
     $html .= "<input type='submit' value='Add project' />";
     $html .= "</form>";
     return $html;
 }
Example #3
0
 /**
  * Creates the HTML needed to display a participant with a list of projects.
  * 
  * @return String HTML
  */
 public function show(\model\Participant $participant)
 {
     $ret = NavigationView::getUserMenu($participant->getUnique());
     $ret .= '<h1>' . $participant->getName() . '</h1>';
     $ret .= "<h2>Projects</h2>";
     $ret .= "<ul>";
     foreach ($participant->getProjects()->toArray() as $project) {
         $ret .= "<li>" . $project->getName() . "</li>";
     }
     $ret .= "</ul>";
     return $ret;
 }