/** Creates a view from a person and a group (every picture of the person in the group). */
 static function getFromPersonAndGroup(knj_gallery $knjgallery, knj_gallery_person $person, knj_gallery_group $group)
 {
     $dbconn = $knjgallery->getDBConn();
     //Check if a group already exists.
     $d_gview = $dbconn->selectsingle("views", array("group_id" => $group->get("id"), "person_id" => $person->get("id")));
     if ($d_gview) {
         $view = $knjgallery->getView($d_gview["id"], $d_gview);
         return $view;
     }
     //Create a new view.
     $arr = array("person_id" => $person->get("id"), "group_id" => $group->get("id"));
     $view = knj_gallery_view::createNew($knjgallery, $arr);
     return $view;
 }
 /** Adds a person to the picture. */
 function addPerson(knj_gallery_person $person, $x, $y, $args = array())
 {
     foreach ($args as $key => $value) {
         if ($key == "user") {
             $user_id = $value["id"];
         } else {
             throw new Exception("Invalid argument: \"" . $key . "\".");
         }
     }
     $this->dbconn->insert("pictures_personlinks", array("picture_id" => $this->get("id"), "person_id" => $person->get("id"), "x_cord" => $x, "y_cord" => $y, "date_saved" => date("Y-m-d H:i:s"), "user_id_saved" => $user_id));
     return true;
 }