2. The Holy Quran (Al Qur'an) with
audio recitations (mp3).
Translation and Tafseer of all
chapters in different languages.
Recitation by different Qaris.
3. Verse by Verse Transtion and Tafseer in
Different Languages.
4. Accurate prayer
times based on your
current location
with multiple
settings available
(angles).
Azan: visual and
audio notifications
for the calls for
prayer with many
muezzin voices to
choose from
5. Full and
Authentic Books
of Hadith to
increase your
knowledge about
Islam and to live
a better life
following the
path of prophet
Mohammed
(SAW).
6. Dhikr & Dua
authentic dhikr and
duas found in the
holy Quran and
Sunnah.
Beautiful high
quality dua audio
recitations for
all duas.
7. 99 names of Allah
with meaning and
benefits of
reciting are
provided in
English and
Arabic, for every
name of Allah in
Quran (Islamic
Holy Book) with
audio(mp3).
47. 4.
CREATE OR REPLACE FUNCTION "public"."quibla_direction"("fd" float8, "ld" float8)
RETURNS "pg_catalog"."float8" AS $BODY$
DECLARE
fm FLOAT;
lm FLOAT;
ans float;
compassReading FLOAT;
BEGIN
fm:=21.422543;
lm:=39.826186;
ans:= get_degree(ld, fd, lm, fm);
return ans;
END$BODY$
LANGUAGE plpgsql VOLATILE
COST 100
48. 5.
CREATE OR REPLACE FUNCTION "nearest_mosque"("idn" int4)
RETURNS "pg_catalog"."int4" AS $BODY$
DECLARE
lon_1 FLOAT;
lat_1 float;
lon_2 float;
lat_2 FLOAT;
distance FLOAT;
shortest FLOAT;
num INTEGER;
temp1 INTEGER;
r record;
BEGIN
49. shortest:=5000000;
SELECT longitude,latitude into lon_1, lat_1
FROM users INNER JOIN "location"ON users.location_id="location".id
WHERE users.id = idn;
FOR r IN SELECT location_id,longitude,latitude
FROM mosque INNER JOIN "location"ON mosque.location_id="location".id
LOOP
lon_2:=r.longitude;
lat_2:=r.latitude;
temp1:=r.location_id;
distance := get_distance(lon_1, lat_1, lon_2, lat_2);
IF distance<shortest THEN
num:=temp1;
shortest:=distance;
END IF;
END LOOP;
RETURN num;
END;
50. 6.
CREATE OR REPLACE FUNCTION "nearest_mosque_distance"("idn" int4)
RETURNS "pg_catalog"."float8" AS $BODY$
DECLARE
lon_1 FLOAT;
lat_1 float;
lon_2 float;
lat_2 FLOAT;
distance FLOAT;
shortest FLOAT;
num INTEGER;
temp1 INTEGER;
r record;
51. BEGIN
shortest:=5000000;
SELECT longitude,latitude into lon_1, lat_1
FROM users INNER JOIN "location"ON users.location_id="location".id
WHERE users.id = idn;
FOR r IN SELECT location_id,longitude,latitude
FROM mosque INNER JOIN "location"ON mosque.location_id="location".id
LOOP
lon_2:=r.longitude;
lat_2:=r.latitude;
temp1:=r.location_id;
distance := get_distance(lon_1, lat_1, lon_2, lat_2);
IF distance<shortest THEN
num:=temp1;
shortest:=distance;
END IF;
END LOOP;
RETURN distance;
END;
52. 7.
CREATE OR REPLACE FUNCTION "public"."nearest_restaurent"("idn" int4)
RETURNS "pg_catalog"."int4" AS $BODY$
DECLARE
lon_1 FLOAT;
lat_1 float;
lon_2 float;
lat_2 FLOAT;
distance FLOAT;
shortest FLOAT;
num INTEGER;
temp1 INTEGER;
r record;
53. BEGIN
shortest:=5000000;
SELECT longitude,latitude into lon_1, lat_1
FROM users INNER JOIN "location"ON users.location_id="location".id
WHERE users.id = idn;
FOR r IN SELECT location_id,longitude,latitude
FROM restaurents INNER JOIN "location"ON restaurents.location_id="location".id
LOOP
lon_2:=r.longitude;
lat_2:=r.latitude;
temp1:=r.location_id;
distance := get_distance(lon_1, lat_1, lon_2, lat_2);
IF distance<shortest THEN
num:=temp1;
shortest:=distance;
END IF;
END LOOP;
RETURN num;
END;
54. 8.
CREATE OR REPLACE FUNCTION "public"."nearest_restaurent_distance"("idn" int4)
RETURNS "pg_catalog"."int4" AS $BODY$
DECLARE
lon_1 FLOAT;
lat_1 float;
lon_2 float;
lat_2 FLOAT;
distance FLOAT;
shortest FLOAT;
num INTEGER;
temp1 INTEGER;
r record;
55. BEGIN
shortest:=5000000;
SELECT longitude,latitude into lon_1, lat_1
FROM users INNER JOIN "location"ON users.location_id="location".id
WHERE users.id = idn;
FOR r IN SELECT location_id,longitude,latitude
FROM restaurents INNER JOIN "location"ON restaurents.location_id="location".id
LOOP
lon_2:=r.longitude;
lat_2:=r.latitude;
temp1:=r.location_id;
distance := get_distance(lon_1, lat_1, lon_2, lat_2);
IF distance<shortest THEN
num:=temp1;
shortest:=distance;
END IF;
END LOOP;
RETURN shortest;
END;
56. 9.
CREATE OR REPLACE FUNCTION "public"."calculate_jakat"("user_id" int4, "earn"
float8, "expandature" float8)
RETURNS "pg_catalog"."float8" AS $BODY$
DECLARE
j FLOAT;
i float;
BEGIN
i:=earn-expandature;
j:=0;
if i>50000 then
j= i/40;
end if;
RETURN j;
57. Procedure
1.
CREATE OR REPLACE PROCEDURE "public"."bookmark_this"("user_id" int4, "sura_id" int4,
"verse_id" int4)
AS $BODY$
INSERT INTO bookmark VALUES (user_id,sura_id,verse_id);
2.
CREATE OR REPLACE PROCEDURE "public"."increase"("u_id" int4)
AS $BODY$
BEGIN
if EXISTS(SELECT * from tasbih WHERE user_id=u_id and date=CURRENT_DATE) then
UPDATE tasbih set count=count+1 WHERE user_id=u_id and date=CURRENT_DATE;
else
INSERT INTO tasbih VALUES (u_id,CURRENT_DATE,1);
end if;
END;
58. 12.
CREATE OR REPLACE PROCEDURE "public"."increase"("u_id" int4)
AS $BODY$
BEGIN
if EXISTS(SELECT * from tasbih WHERE user_id=u_id and
date=CURRENT_DATE) then
UPDATE tasbih set count=count+1 WHERE user_id=u_id and
date=CURRENT_DATE;
else
INSERT INTO tasbih VALUES (u_id,CURRENT_DATE,1);
end if;
END;
59. Trigger
1.
CREATE TRIGGER upgrade_trigger
after INSERT or UPDATE ON donation
FOR EACH ROW
EXECUTE PROCEDURE upgrade();
CREATE OR REPLACE FUNCTION "public"."upgrade"()
RETURNS "pg_catalog"."trigger" AS $BODY$
DECLARE
dd INT;
BEGIN
SELECT sum(amount) into dd from donation where user_id = new.id;
IF dd>= 499 THEN
UPDATE users SET type = 'premium' WHERE id=new.id;
END if;
RETURN NEW;
END;
60. 2.
CREATE TRIGGER history_trigger
after INSERT or UPDATE ON users
FOR EACH ROW
EXECUTE PROCEDURE user_history();
CREATE OR REPLACE FUNCTION "public"."user_history"()
RETURNS "pg_catalog"."trigger" AS $BODY$
BEGIN
IF not exists ( SELECT * from "location_history" where user_id = new.id and
date=CURRENT_DATE and location_id = new.location_id) THEN
INSERT into location_history VALUES (new.id , CURRENT_DATE ,
new.location_id );
END if;
RETURN NEW;
END;
61. 3.
CREATE trigger add_user_trigger
BEFORE insert or UPDATE of email ON users
FOR EACH ROW
EXECUTE PROCEDURE check_mail();
CREATE OR REPLACE FUNCTION "public"."check_mail"()
RETURNS "pg_catalog"."trigger" AS $BODY$
begin
if exists( SELECT * from users WHERE email= new.email ) then
RAISE EXCEPTION 'Invalid Email --> %', new.sura_id
USING HINT = 'Please check your email';
end if;
RETURN new;
end;