/** The constructor of the class. */ function __construct(knj_gallery_group $knj_gallery_group, $id, $data = null) { $this->knj_gallery_group = $knj_gallery_group; $this->knj_gallery = $knj_gallery_group->getKNJGallery(); $this->dbconn = $this->knj_gallery->getDBConn(); parent::__construct($this->dbconn, "pictures", $id, $data); }
/** 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; }