remove old readme
[atutor.git] / mods / _standard / social / settings.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2009                                                                              */
6 /* Inclusive Design Institute                                   */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14 $_user_location = 'public';
15
16 define('AT_INCLUDE_PATH', '../../../include/');
17 require (AT_INCLUDE_PATH.'vitals.inc.php');
18 require(AT_SOCIAL_INCLUDE.'constants.inc.php');
19 include(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyObject.class.php');
20 include(AT_SOCIAL_INCLUDE.'classes/PrivacyControl/PrivacyController.class.php');
21 include(AT_SOCIAL_INCLUDE.'classes/Application.class.php');
22 $_custom_css = $_base_path . AT_SOCIAL_BASENAME . 'module.css'; // use a custom stylesheet
23
24 if (!$_SESSION['valid_user']) {
25         require(AT_INCLUDE_PATH.'header.inc.php');
26         $info = array('INVALID_USER', $_SESSION['course_id']);
27         $msg->printInfos($info);
28         require(AT_INCLUDE_PATH.'footer.inc.php');
29         exit;
30 }
31
32 $controller = new PrivacyController();
33 $private_obj = $controller->getPrivacyObject($_SESSION['member_id']);
34
35 //headers start here
36 include(AT_INCLUDE_PATH.'header.inc.php'); 
37 ?>
38 <div class="social-wrapper">
39
40 <?php
41
42 $savant->display('social/pubmenu.tmpl.php');
43 $savant->display('social/settings/settings_menu.tmpl.php');
44 if (isset($_REQUEST['n']) && $_REQUEST['n']=='account_settings'){
45         //TODO
46         //Default to account settings
47         //Page prints from here
48         $savant->display('social/settings/account_settings.tmpl.php');
49 } elseif (isset($_REQUEST['n']) && $_REQUEST['n']=='application_settings'){
50         $app = new Application();
51         //handle application setting updates
52         if (isset($_POST['submit'])){
53                 //Updates
54                 $app->setHomeDisplaySettings($_POST['app']);
55                 //TODO print message/feedback
56                 $msg->addFeedback('SOCIAL_SETTINGS_SAVED');
57                 $msg->printAll();
58         }
59         
60         //initialization
61         $savant->assign('home_display', $app->getHomeDisplaySettings());
62         $savant->assign('my_apps', $list_of_my_apps = $app->listMyApplications());
63         $savant->display('social/settings/application_settings.tmpl.php');
64 } else {
65         //handle privacy setting updates
66         if (isset($_POST['submit'])){
67                 //Updates
68                 $private_obj->setProfile($_POST['profile_prefs']);
69                 $private_obj->setSearch($_POST['search_prefs']);
70                 $private_obj->setActivity($activity_prefs);
71
72                 //update privacy preference
73                 PrivacyController::updatePrivacyPreference($_SESSION['member_id'], $private_obj);
74
75                 //TODO print message/feedback
76                 $msg->addFeedback('SOCIAL_SETTINGS_SAVED');
77                 $msg->printAll();
78         }
79
80         //Page prints from here
81         $savant->assign('controller', $controller);
82         $savant->assign('profile_prefs', $private_obj->getProfile());
83         $savant->assign('search_prefs', $private_obj->getSearch());
84         $savant->assign('application_prefs', $private_obj->getActivity());
85         $savant->display('social/settings/privacy_settings.tmpl.php');
86 }
87 ?>
88 <div style="clear:both;"></div>
89 </div>
90 <?php
91 include(AT_INCLUDE_PATH.'footer.inc.php'); 
92 ?>