Location: PHPKode > projects > Banshee PHP Framework > models/admin/albums.php
<?php
	class admin_albums_model extends tablemanager_model {
		protected $table = "photo_albums";
		protected $elements = array(
			"name" => array(
				"label"    => "Name",
				"type"     => "varchar",
				"overview" => true,
				"required" => true),
			"description" => array(
				"label"    => "Description",
				"type"     => "text",
				"overview" => false,
				"required" => true),
			"timestamp" => array(
				"label"    => "Timestamp",
				"type"     => "datetime",
				"overview" => true,
				"readonly" => true));

		public function delete_oke($item_id) {
			$query = "select count(*) as count from photos where photo_album_id=%d";

			if (($result = $this->db->execute($query, $item_id)) === false) {
				$this->output->add_message("Error counting photos in album.");
				return false;
			} else if ($result[0]["count"] > 0) {
				$this->output->add_message("Photo album contains photos. Delete them first.");
				return false;
			}

			return true;
		}
	}
?>
Return current item: Banshee PHP Framework