-
Notifications
You must be signed in to change notification settings - Fork 1
/
pages.py
664 lines (502 loc) · 18.1 KB
/
pages.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
import messages
import prev_page as pv
import registration as reg
import menus as menu
import jobs as job
import friends as friend
import database as db
import profile as pf
import messages as msg
import training as train
import api
#Note
# 1) make sure to separate EVERY individual page in a different function
# 2) Add the new page created to the previous() with the according string and function
# 3) also DON'T FORGET to append the page to the vistedPages list
# 4) make sure you change the parameter of user_input() when the size of the menu changes
# changes
# added job_post_function
# made pagesVisited list global. Now it doesn't need to be passed through every page's parameter anymore
# --------------------------GO TO PAGE---------------------------
# ****************************add to this list as we make new pages*********
# ------------------------------HOMEPAGE---------------------
def homepage():
# when at the homepage menu, you shouldn't have access to prev
global login_flag
login_flag = False
global pagesVisited
# check what back means
pagesVisited = ["homepage"]
username = ""
password = ""
selection = 0
api.output_users()
api.output_training()
api.output_appliedJobs()
api.output_savedJobs()
api.output_profiles()
# Success story
print("\nI was born with no money, no belly button, and five different father figures. "
"Which father figure was the real one? I don't know. They all passed away before I could ask. "
"During my time with inCollege has helped me find a job that has changed my life. "
"I am now a full time janitor at google. "
"With my impressive salary I have acquired a new belly button of my own, a life long dream. "
"I have also successfully DNA tested myself to find out who my true father is. "
"The results were interesting as my true father is Donald Trump. "
"I am the true heir to the Trump fortune and now I am plotting my global takeover. "
"Thank you inCollege, everything is thanks to your website.")
# returns num options
optionNum = menu.print_login_menu()
selection = menu.user_input(optionNum)
# login option
if selection == 1: # log in
login_flag = True
reg.login()
# signup option
elif selection == 2:
reg.signup()
# find friends option
elif selection == 3:
print("\nVideo now playing...")
homepage()
# play video (not separate page)
elif selection == 4:
friend.findfriendsPage()
elif selection == 5:
usefulLinksPage()
return
elif selection == 6:
importantLinksPage()
return
elif selection == 7:
training()
return
elif selection == 8:
exit()
#pass
# ---------------------------------Training option--------------------------------------------------------------
def training():
if not pagesVisited:
pagesVisited.append("training")
elif pagesVisited[-1] != "training":
pagesVisited.append("training")
print("\n1. Training and Education"
"\n2. IHelp Desk"
"\n3. Business Analysis and Strategy"
"\n4. Security"
"\n\nEnter 0 to go back")
selection = menu.user_input(4)
if selection == 1:
print("\nTraining and Education\n\n"
"\n1. Training in programming"
"\n2. Training in engineering"
"\n3. Learning mathematics"
"\n4. Learning science"
"\n\nEnter 0 to go back")
Slection = menu.user_input(4)
if selection == 1:
print("Under construction")
training()
elif selection == 2:
print("Under construction")
training()
elif selection == 3:
print("Under construction")
training()
elif selection == 4:
print("Under construction")
training()
elif selection == 0:
training()
elif selection == 2:
print("Coming Soon!")
training()
elif selection == 3:
while True:
print("\nBusiness Analysis and Strateg\n\n"
"\n1. How to use In College learnin"
"\n2. Train the trainer"
"\n3. Gamification of learning"
"\nNot seeing what you’re looking for? Sign in to see all 7,609 results. (Enter 4 to login)"
"\n\nEnter 0 to go back")
selection = menu.user_input(4, True)
if selection >= 1 and selection <= 4:
reg.login()
elif selection == 0:
training()
break
else:
print("Invalid Entry!")
continue
elif selection == 4:
print("Coming Soon!")
training()
# ---------------------------------MAINPAGE--------------------------------------------------------------
def mainPage():
if not pagesVisited:
pagesVisited.append("mainpage")
elif pagesVisited[-1] != "mainpage":
pagesVisited.append("mainpage")
#prints pending friends
if friend.pending_friend(reg.username) == True:
print("You have a pending friend request")
else:
print("no friend requests :(")
if job.job_deleted(reg.username) == True:
print("A job you have saved or applied for has been Deleted.")
if messages.inboxNotification():
print("\nYou have messages in your inbox.")
menu.print_options_menu()
selection = menu.user_input(11)
# added code
# sub_selection = None
if selection == 1:
profilePage()
# goTo jobs
elif selection == 2:
job.jobPage()
# goTo friends
elif selection == 3:
friend.friendsPage()
elif selection == 4:
friend.view_pending_requests()
elif selection == 5:
show_network()
elif selection == 6:
msg.messagesPage(reg.username)
# goTo skills
elif selection == 7:
skillsPage()
elif selection == 8:
usefulLinksPage()
elif selection == 9:
importantLinksPage()
elif selection == 10:
train.inCollegeLearningPage()
elif selection == 11:
homepage()
#_-----friends--------
def show_network():
connections = None
result = db.cursor.execute("SELECT firstName, lastName, username, status FROM friends "
"NATURAL JOIN users WHERE friends_user = '{}'".format(reg.username)).fetchall()
if len(result) == 0:
print("\nYou have no connections yet.")
conections = False
while(True):
count = 1
for i in result:
print("{}. {} {} Username: {} Status: {}" .format(count, i[0], i[1], i[2], i[3]))
count += 1
connections = True
print("\n0. GO BACK\n")
selection = input("Please enter line number to view connection options:")
if int (selection) == 0:
mainPage()
return
if int(selection) < 1 or int(selection) > len(result):
print("\nInvalid entry please re-enter.")
continue
else:
friendConnection = result[int(selection) - 1][2]
print("1. View user's profile\n"
"2. Disconnect from friend\n"
"0. Go back\n")
print("\nEnter Selection: ")
selection = menu.user_input(2)
if int(selection) == 1:
pf.viewProfilePage(friendConnection, True)
elif int(selection) == 2:
db.cursor.execute("DELETE FROM friends WHERE username = '{}' AND friends_user = '{}'".format(reg.username, friendConnection))
db.cursor.execute("DELETE FROM friends WHERE username = '{}' AND friends_user = '{}'".format(friendConnection, reg.username))
db.con.commit()
mainPage()
elif int(selection) == 0:
mainPage()
break
#--------------profile page--------------
def profilePage():
if pagesVisited[-1] != "profile":
pagesVisited.append("profile")
menu.profileMenu()
selection = menu.user_input(5)
if selection == 1:
pf.aboutProfilePage(reg.username)
elif selection == 2:
pf.experiencePage(reg.username)
elif selection == 3:
pf.educationPage(reg.username)
elif selection == 4:
pf.viewProfilePage(reg.username)
elif selection == 5:
msg.messagesPage(reg.username)
#SKILL PAGE
# FUNCTIONS TO IMPLEMENT LATER
def pythonPage():
if pagesVisited[-1] != "python":
pagesVisited.append("python")
print("\nThis page is currently under construction. Come back soon!")
pv.previous()
def javaPage():
if pagesVisited[-1] != "java":
pagesVisited.append("java")
print("\nThis page is currently under construction. Come back soon!")
pv.previous()
def cPage():
if pagesVisited[-1] != "c":
pagesVisited.append("c")
print("\nThis page is currently under construction. Come back soon!")
pv.previous()
def cppPage():
if pagesVisited[-1] != "c++":
pagesVisited.append("c++")
print("\nThis page is currently under construction. Come back soon!")
pv.previous()
def rubyPage():
if pagesVisited[-1] != "ruby":
pagesVisited.append("ruby")
print("\nThis page is currently under construction. Come back soon!")
pv.previous()
def skillsPage():
if pagesVisited[-1] != "skills":
pagesVisited.append("skills")
menu.print_skills_menu()
selection = menu.user_input(6)
if selection == 1:
pythonPage()
elif selection == 2:
javaPage()
elif selection == 3:
cPage()
elif selection == 4:
cppPage()
elif selection == 5:
rubyPage()
# -------------------------usefulLinksPage---------------------------------------------------------------
def usefulLinksPage():
if pagesVisited[-1] != "useful links":
pagesVisited.append("useful links")
menu.print_useful_links()
selection = menu.user_input(4)
if selection == 1:
generalPage()
elif selection == 2:
browseInCollegePage()
elif selection == 3:
businessSolutionsPage()
elif selection == 4:
directories()
#-----------------LINKS PAGE--------------------#
def generalPage():
if pagesVisited[-1] != "general":
pagesVisited.append("general")
menu.print_general_menu()
selection = menu.user_input(7)
if selection == 1:
reg.signup()
elif selection == 2:
helpCenterPage()
elif selection == 3:
about()
elif selection == 4:
pressPage()
elif selection == 5:
BlogPage()
elif selection == 6:
carrierPage()
elif selection == 7:
devPage()
def helpCenterPage():
if pagesVisited[-1] != "help center":
pagesVisited.append("help center")
print("We're here to help. ")
pv.previous()
def pressPage():
if pagesVisited[-1] != "press":
pagesVisited.append("press")
print("In College Pressroom: Stay on top of the latest news, updates, and reports")
pv.previous()
def BlogPage():
if pagesVisited[-1] != "blog":
pagesVisited.append("blog")
print("In College Pressroom: Stay on top of the latest news, updates, and reports")
pv.previous()
def carrierPage():
if pagesVisited[-1] != "carrier":
pagesVisited.append("carrier")
print("Under Construction")
pv.previous()
def devPage():
if pagesVisited[-1] != "developer":
pagesVisited.append("developer")
print("Under Construction")
pv.previous()
# delete pv.previous() menu is complete
# pv.previous()
def browseInCollegePage():
if pagesVisited[-1] != "browse in college":
pagesVisited.append("browse in college")
pv.previous()
def businessSolutionsPage():
if pagesVisited[-1] != "business solutions":
pagesVisited.append("business solutions")
pv.previous()
def directories():
if pagesVisited[-1] != "directories":
pagesVisited.append("directories")
pv.previous()
# -----------------important Links---------------------
def importantLinksPage():
if pagesVisited[-1] != "important links":
pagesVisited.append("important links")
menu.print_important_links()
selection = menu.user_input(9)
if selection == 1:
copyrightNotice()
elif selection == 2:
about()
elif selection == 3:
accessibility()
elif selection == 4:
userAgreement()
elif selection == 5:
privacyPolicy()
elif selection == 6:
cookiePolicy()
elif selection == 7:
copyRightPolicy()
elif selection == 8:
brandPolicy()
elif selection == 9:
guestControls()
def copyrightNotice():
if pagesVisited[-1] != "copyright notice":
pagesVisited.append("copyright notice")
print("Copyright 2021 inCollege LLC All rights reserved. "
"\ninCollege© 4202 E Fowler Ave, Tampa, FL 33620")
pv.previous()
def about():
if pagesVisited[-1] != "about":
pagesVisited.append("about")
print(
"\nIn College: Welcome to In College, the world's largest college student network "
"with many users in many countries and territories worldwide.")
pv.previous()
def accessibility():
if pagesVisited[-1] != "accessibility":
pagesVisited.append("accessibility")
print(
"\nWe’re committed to accessibility. It is our policy to ensure that everyone, including persons "
"with disabilities, has full and equal access to our digital offerings.")
pv.previous()
def userAgreement():
if pagesVisited[-1] != "user agreement":
pagesVisited.append("user agreement")
print("\nUsing inCollege you agree to follow and behave with in the policies of dictated "
"in the inCollege software. ")
pv.previous()
def privacyPolicy():
#if pagesVisited[-1] != "privacy policy":
# pagesVisited.append("privacy policy")
print("\nPrivacy Policy"
"\nLast updated: October 1, 2021"
"\ninCollege collects personal information and usage data of the user. "
"Information recorded from the user is private and secure. "
"\nIf you have any questions, reach out to privacy@inCollege.com "
"\ninCollege© 4202 E Fowler Ave, Tampa, FL 33620")
guestControls()
#pv.previous()
def cookiePolicy():
if pagesVisited[-1] != "cookie policy":
pagesVisited.append("cookie policy")
print(
"\nUsing inCollege you agree to share data may use cookies, web beacons, "
"tracking pixels, and other tracking technologies when you visit our website, "
"including any other media form, media channel, mobile website, or mobile application "
"related or connected.")
pv.previous()
def copyRightPolicy():
if pagesVisited[-1] != "copy right policy":
pagesVisited.append("copy right policy")
print("\nThe InCollege program reserves all the rights and may not be copied or "
"duplicated without prior agreement")
pv.previous()
def brandPolicy():
if pagesVisited[-1] != "brand policy":
pagesVisited.append("brand policy")
print("\nThe InCollege program aims to connect every college student to flourish "
"relationships and network")
pv.previous()
def guestControls():
global login_flag
if pagesVisited[-1] != "guest controls":
pagesVisited.append("guest controls")
if login_flag == True:
loginControl(reg.username)
pv.previous()
else:
menu.guestControlMenu()
selection = menu.user_input(1)
if selection == 1:
pv.previous()
def loginControl(uName):
tmpcon = db.sqlite3.connect('inCollege.db')
tmpcursor = tmpcon.cursor()
tmpcursor.execute("SELECT * FROM settings WHERE username = ?", (uName,))
settings = tmpcursor.fetchone()
print("\nSETTINGS BY {}: "
"\ninCollegeEmail -> {}"
"\nSMS -> {}"
"\nads -> {}"
"\nLanguage -> {}".format(settings[0], settings[1], settings[2], settings[3], settings[4]))
print("Would you like to change the default settings? \n1.Yes\n2.No")
selection = menu.user_input(2)
if selection == 1:
print("Please ON or OFF for the following settings")
my_email = on_off_mail()
my_sms = on_off_sms()
my_ads = on_off_ads()
my_language = language()
tmpcursor.execute("UPDATE settings SET email = ?, SMS = ? , ads = ?, language = ? where username = ?",
(my_email, my_sms, my_ads, my_language, reg.username))
tmpcon.commit()
tmpcon.close()
print("\nChanges were successfully")
elif selection == 2:
pv.previous()
def on_off_mail():
print("\ninCollegeEmail \n1.ON \n2.OFF ")
selection = menu.user_input(2)
if selection == 1:
my_email = "ON"
return my_email
else:
my_email = "OFF"
return my_email
def on_off_sms():
print("\nSMS \n1.ON \n2.OFF ")
selection = menu.user_input(2)
if selection == 1:
my_sms = "ON"
return my_sms
else:
my_sms = "OFF"
return my_sms
def on_off_ads():
print("\nAds \n1.ON \n2.OFF ")
selection = menu.user_input(2)
if selection == 1:
my_ads = "ON"
return my_ads
else:
my_ads = "OFF"
return my_ads
def language():
print("\nLanguage \n1.English \n2.Spanish ")
selection = menu.user_input(2)
if selection == 1:
my_lang = "English"
return my_lang
else:
my_lang = "Spanish"
return my_lang