+++ /dev/null
-<?php\r
-/*\r
-This is the ATutor webcalendar module page. It allows an instructor to synchronize\r
-the ATutor and WebCalendar databases.\r
-*/\r
-define('AT_INCLUDE_PATH', '../../include/');\r
-require (AT_INCLUDE_PATH.'vitals.inc.php');\r
-\r
-if($_REQUEST['webcalendar_sync'] == 1){\r
- //populate the webcal_user table with ATutor members\r
- $sql = "SELECT * from ".TABLE_PREFIX."members";\r
- $result = mysql_query($sql,$db);\r
- if(!$result3 = mysql_query($sql)){\r
- $msg->addError('WEBCALENDAR_UPDATE_MEMBERS_FAILED');\r
- }else{\r
- $msg->addFeedback('WEBCALENDAR_UPDATE_MEMBERS_SAVED');\r
- }\r
- while ($row = mysql_fetch_array($result)){\r
- $sql2 = "REPLACE INTO webcal_user VALUES ('$row[1]','".md5($row[2])."','$row[6]','$row[5]','N','$row[3]')";\r
- $result1 = mysql_query($sql2, $db);\r
- }\r
-\r
- //populate the webcal_group table with ATutor courses\r
- $sql5 = "SELECT * FROM ".TABLE_PREFIX."courses";\r
- $result5 = mysql_query($sql5,$db);\r
- while ($row = mysql_fetch_array($result5)){\r
- $sql2 = "REPLACE INTO webcal_group VALUES ('$row[0]','".$row[1]."','$row[6]','$row[5]')";\r
- $result1 = mysql_query($sql2, $db);\r
- }\r
- if(!$result1 = mysql_query($sql)){\r
- $msg->addError('WEBCALENDAR_UPDATE_GROUPS_FAILED');\r
- }else{\r
- $msg->addFeedback('WEBCALENDAR_UPDATE_GROUPS_SAVED');\r
- }\r
-\r
- //populate webcal_group_users users enrolled courses (i.e. groups) \r
-\r
- $sql6 = "SELECT * FROM ".TABLE_PREFIX."course_enrollment WHERE approved='y'";\r
- $result6 = mysql_query($sql6,$db);\r
- while ($row = mysql_fetch_array($result6)){\r
-\r
- $sql8 = "SELECT login FROM ".TABLE_PREFIX."members WHERE member_id='$row[0]'";\r
- $result8 = mysql_query($sql8,$db);\r
- while($row1 = mysql_fetch_array($result8)){\r
- $at_login_name = $row1[0];\r
- }\r
- $sql2 = "REPLACE INTO webcal_group_user VALUES ('$row[1]','$at_login_name')";\r
- if(!$result7 = mysql_query($sql2)){\r
- $msg->addError('WEBCALENDAR_UPDATE_GROUPMEMS_FAILED');\r
- }else{\r
- $msg->addFeedback('WEBCALENDAR_UPDATE_GROUPMEMS_SAVED');\r
- }\r
- }\r
-\r
-\r
-}\r
-\r
-require (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
-?>\r
- <div class="input-form">\r
- <div class="row">\r
- <p><?php echo _AT('webcalendar_sync'); ?></p>\r
- <p> <strong><?php echo $webcalendar_sync; ?> </strong> </p>\r
- <div class="row buttons">\r
- <form action="<?php $_SERVER['PHP_SELF']; ?>" method="post">\r
- <input type="hidden" name="webcalendar_sync" value="1">\r
- <input type="submit" value="<?php echo _AT('webcalendar_sync_button'); ?>" style="botton">\r
- </form>\r
- </div>\r
- </div>\r
- </div>\r
- \r
-<?php \r
-\r
- require (AT_INCLUDE_PATH.'footer.inc.php'); ?>
\ No newline at end of file