function getView() { $d_gview = $this->dbconn->selectsingle("views", array("person_id" => $this->get("id"), "group_id" => 0), array("limit" => 1)); if ($d_gview) { $view = $this->knj_gallery->getView($d_gview["id"], $d_gview); return $view; } //Create new. require_once "knj/gallery/class_knjgallery_view.php"; $view = knj_gallery_view::createNew($this->knj_gallery, array("person_id" => $this->get("id"))); return $view; }
/** 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; }