00001 <?php
00002 if(!defined('__PRAGYAN_CMS'))
00003 {
00004 header($_SERVER['SERVER_PROTOCOL'].' 403 Forbidden');
00005 echo "<h1>403 Forbidden<h1><h4>You are not authorized to access the page.</h4>";
00006 echo '<hr/>'.$_SERVER['SERVER_SIGNATURE'];
00007 exit(1);
00008 }
00016
00017
00018
00019 function isProfileFormCaptchaEnabled() {
00020 $captchaQuery = 'SELECT `form_usecaptcha` FROM `form_desc` WHERE `page_modulecomponentid` = 0';
00021 $captchaResult = mysql_query($captchaQuery);
00022 $captchaRow = mysql_fetch_row($captchaResult);
00023 if($captchaRow && isset($captchaRow[0])) {
00024 return $captchaRow[0] == 1;
00025 }
00026 return false;
00027 }
00028
00029 function profile($userId, $forEditRegistrant = false) {
00030 global $sourceFolder, $moduleFolder;
00031
00032
00033 if(isset($_POST['profileimgaction']) && $_POST['profileimgaction']=='uploadnew')
00034 {
00035 require_once("$sourceFolder/upload.lib.php");
00036
00037 $allowableTypes = array (
00038 'jpeg',
00039 'jpg',
00040 'png',
00041 'gif'
00042 );
00043 $fakeModuleComponentId=$userId;
00044 $uploadSuccess = submitFileUploadForm($fakeModuleComponentId, "profile", $userId, 512*1024, $allowableTypes, 'profileimage');
00045
00046 if(!is_array($uploadSuccess) && $uploadSuccess===false) displayerror("Profile image could not be uploaded. Maximum size should be 512 KB.");
00047 else if(is_array($uploadSuccess))
00048 {
00049
00050 $profileimgnames = getUploadedFiles($fakeModuleComponentId,'profile');
00051
00052 foreach($profileimgnames as $img)
00053 {
00054 if($img['upload_filename']!=$uploadSuccess[0])
00055 deleteFile($fakeModuleComponentId,'profile',$img['upload_filename']);
00056 }
00057 }
00058 }
00059 else if(isset($_POST['profileimgaction']) && $_POST['profileimgaction']=='noimage')
00060 {
00061 require_once("$sourceFolder/upload.lib.php");
00062 $fakeModuleComponentId=$userId;
00063 $profileimgnames = getUploadedFiles($fakeModuleComponentId,'profile');
00064
00065 foreach($profileimgnames as $img)
00066 deleteFile($fakeModuleComponentId,'profile',$img['upload_filename']);
00067 }
00068
00070 $profileQuery = 'SELECT `user_name`, `user_fullname`, `user_password` FROM `' . MYSQL_DATABASE_PREFIX . 'users` WHERE `user_id` = ' . $userId;
00071 $profileResult = mysql_query($profileQuery);
00072 if(!$profileResult) {
00073 displayerror('An error occurred while trying to process your request.<br />' . mysql_error() . '<br />' . $profileQuery);
00074 return '';
00075 }
00076 $profileRow = mysql_fetch_row($profileResult);
00077 $newUserName = $userName = $profileRow[0];
00078 $newUserFullname = $userFullname = $profileRow[1];
00079 $userPassword = $profileRow[2];
00080
00081 require_once("$sourceFolder/$moduleFolder/form/registrationformsubmit.php");
00082 require_once("$sourceFolder/$moduleFolder/form/registrationformgenerate.php");
00084 if(isset($_POST['btnSubmitProfile'])) {
00085 if($forEditRegistrant || !isProfileFormCaptchaEnabled() || submitCaptcha()) {
00086 if(!$forEditRegistrant) {
00087 $passwordValidated = false;
00088 if(isset($_POST['user_password']) && $_POST['user_password'] != '' && md5($_POST['user_password']) == $userPassword) {
00089 $passwordValidated = true;
00090 }
00091 }
00092
00093 $updates = array();
00094
00095 if (isset($_POST['user_name']) && $_POST['user_name'] != '' && $_POST['user_name'] != $userName) {
00096 $updates[] = "`user_name` = '".escape($_POST['user_name'])."'";
00097 $newUserName = escape($_POST['user_name']);
00098 }
00099 if (isset($_POST['user_fullname']) && $_POST['user_fullname'] != '' && $_POST['user_fullname'] != $userFullname) {
00100 $updates[] = "`user_fullname` = '".escape($_POST['user_fullname'])."'";
00101 $newUserFullname = escape($_POST['user_fullname']);
00102 }
00103 $errors = true;
00104 if (!$forEditRegistrant && $_POST['user_newpassword'] != '') {
00105 if(!$passwordValidated) {
00106 displayerror('Error! The current password you entered was incorrect.');
00107 }
00108 elseif ($_POST['user_newpassword'] != $_POST['user_newrepassword']) {
00109 displayerror('Error! The New Password you entered does not match the password you typed in the Confirmation Box.');
00110 }
00111 elseif ($_POST['user_newpassword'] == $_POST['user_password']) {
00112 displayerror('Error! The old and new passwords are the same.');
00113 }
00114 else {
00115 $updates[] = "`user_password` = MD5('".escape($_POST['user_newpassword'])."')";
00116 $errors = false;
00117 }
00118 }
00119 else {
00120 $errors = false;
00121 }
00122
00123 if(count($updates) > 0) {
00124 $profileQuery = 'UPDATE `' . MYSQL_DATABASE_PREFIX . 'users` SET ' . join($updates, ', ') . " WHERE `user_id` = $userId";
00125 $profileResult = mysql_query($profileQuery);
00126 if(!$profileResult) {
00127 displayerror('An error was encountered while attempting to process your request.');
00128 $errors = true;
00129 }
00130 $userName = $newUserName;
00131 $userFullname = $newUserFullname;
00132
00133 if(!$forEditRegistrant)
00134 setAuth($userId);
00135 }
00136
00137 $errors = !submitRegistrationForm(0, $userId, true, true) || $errors;
00138 if(!$errors) {
00139 displayinfo('All fields updated successfully!<br />' .
00140 '<input type="button" onclick="history.go(-2)" value="Go back" />');
00141 }
00142 }
00143 }
00144 return getProfileForm($userId, $userName, $userFullname, $forEditRegistrant);
00145 }
00146
00147
00148 function getProfileForm($userId, $userName, $userFullname, $forEditRegistrant = false) {
00149 global $urlRequestRoot, $moduleFolder, $cmsFolder,$sourceFolder, $templateFolder;
00150 require_once("$sourceFolder/$moduleFolder/form/registrationformsubmit.php");
00151 require_once("$sourceFolder/$moduleFolder/form/registrationformgenerate.php");
00152 require_once("$sourceFolder/upload.lib.php");
00153
00154 $fakeModuleComponentId=$userId;
00155
00156 $profileimgname = getUploadedFiles($fakeModuleComponentId,'profile');
00157 if($profileimgname==NULL)
00158 {
00159 $profileimgname = "$urlRequestRoot/$cmsFolder/$templateFolder/common/images/no-img.jpg";
00160 }
00161 else
00162 {
00163 $profileimgname = "./+profile&fileget={$profileimgname[0]['upload_filename']}";
00164 }
00165
00166
00167 $profileimg= "<img id=profileimg src='$profileimgname' alt='Profile Image' title='Profile Image' height=120 width=100><br/>";
00168
00169 $profileimgupload = getFileUploadField('profileimage','profile',512*1024);
00170
00171 $jsValidationFunctions = array();
00172 $containsFileUploadFields = false;
00173 $dynamicFields = getFormElementsHtmlAsArray(0, $userId, $jsValidationFunctions, $containsFileUploadFields);
00174 $dynamicFields = join($dynamicFields, "</tr>\n<tr>");
00175 if($dynamicFields != '') {
00176 $dynamicFields = "<tr>$dynamicFields</tr>";
00177 }
00178 $jsValidationFunctions = join($jsValidationFunctions, ' && ');
00179
00180 $captchaValidation = '';
00181 if(!$forEditRegistrant) {
00182 $captchaQuery = 'SELECT `form_usecaptcha` FROM `form_desc` WHERE `page_modulecomponentid` = 0';
00183 $captchaResult = mysql_query($captchaQuery);
00184 $captchaRow = mysql_fetch_row($captchaResult);
00185 if(isset($captchaRow[0]) && $captchaRow[0] == 1) {
00186 $captchaValidation = getCaptchaHtml();
00187 }
00188 }
00189
00190 $fValidatorPath = "$urlRequestRoot/$cmsFolder/$templateFolder/common/scripts/formValidator.js";
00191 $abhiValidatorPath = "$urlRequestRoot/$cmsFolder/$moduleFolder/form/validation.js";
00192 $calpath = "$urlRequestRoot/$cmsFolder/$moduleFolder";
00193 $formAction = './+profile';
00194 if($forEditRegistrant) {
00195 $formAction = './+admin&subaction=editsiteregistrants&subsubaction=editregistrant';
00196 }
00197 global $ICONS;
00198 global $STARTSCRIPTS;
00199 $STARTSCRIPTS.="document.getElementsByName('profileimage[]')[0].disabled=true;";
00200 $profileForm =<<<PREF
00201
00202 <script language="javscript" type="text/javascript" src="$abhiValidatorPath"></script>
00203 <script language="javascript" type="text/javascript" src="$fValidatorPath"></script>
00204 <link rel="stylesheet" type="text/css" media="all" href="$calpath/form/calendar/calendar.css" title="Aqua" />
00205 <script language="javascript" type="text/javascript" src="$calpath/form/calendar/calendar.js"></script>
00206
00207 <script language="javascript" type="text/javascript">
00208 window.addEvent("domready", function() {
00209 var exValidatorA = new fValidator("registrationform");
00210 });
00211
00212 function checkPassword(inputhandler) {
00213 inputhandler2=document.getElementById("user_newpassword");
00214 if(inputhandler.value!=inputhandler2.value) {
00215 alert("The password you typed in the New Password field does not match the one in the Confirmation Box.");
00216 inputhandler.value="";
00217 inputhandler2.value="";
00218 inputhandler2.focus();
00219 return false;
00220 }
00221 return true;
00222 }
00223
00224 function checkProfileForm(inputhandler) {
00225 if(inputhandler.user_newpassword.value.length!=0) {
00226 if(inputhandler.user_password.value.length==0) {
00227 alert("Please enter your current password in order to change to a new one.");
00228 return false;
00229 }
00230 }
00231
00232 if(checkPassword(inputhandler.user_newrepassword)==false)
00233 return false;
00234
00235 return $jsValidationFunctions;
00236 }
00237
00238 function toggle_img_upform()
00239 {
00240 var obj1=document.getElementsByName('profileimage[]')[0];
00241 var obj2=document.getElementById('upnewradio');
00242 obj1.disabled=(obj2.checked==true?false:true);
00243 }
00244
00245
00246 </script>
00247 <br />
00248 <div class="cms-registrationform">
00249 <form id="cms-registrationform" class="fValidator-form" method="POST" name="user_profile_usrFrm" onsubmit="return checkProfileForm(this)" action="$formAction" enctype="multipart/form-data">
00250 <fieldset style="width:80%">
00251 <legend>{$ICONS['User Profile']['small']}Profile Preferences</legend>
00252
00253 <table>
00254 <tr>
00255 <td colspan=2 style="text-align:center">$profileimg</td>
00256 </tr>
00257 <tr>
00258 <td><label for="user_name" class="labelrequired">Name</label></td>
00259 <td><input name="user_name" id="user_name" class="fValidate['required']" type="text" value="$userName"></td>
00260 </tr>
00261 <tr>
00262 <td><label for="user_fullname" class="labelrequired">Full Name</label></td>
00263 <td><input name="user_fullname" id="user_fullname" class="fValidate['required']" type="text" value="$userFullname"></td>
00264 </tr>
00265 <tr>
00266 <td>Profile image</td>
00267 <td>
00268 <input type="radio" name="profileimgaction" value="usecurrent" checked onclick="toggle_img_upform()"> Use existing image<br/>
00269 <input id='upnewradio' type="radio" name="profileimgaction" value="uploadnew" onclick="toggle_img_upform()"> Upload new image<br/>
00270 <input type="radio" name="profileimgaction" value="noimage" onclick="toggle_img_upform()"> Remove your image
00271 </td>
00272 <tr>
00273 <td><label for="profileimage">Upload new profile image (maximum size is 512 KB)</td>
00274 <td>$profileimgupload</td>
00275 </tr>
00276 PREF;
00277
00278 if(!$forEditRegistrant) {
00279 $profileForm .= <<<PREF
00280 <tr>
00281 <td><label for="user_password" class="labelrequired">Current Password (Only for changing password)</label></td>
00282 <td><input name="user_password" id="user_password" class="" type="password"></td>
00283 </tr>
00284 <tr>
00285 <td><label for="user_newpassword" class="labelrequired">New Password</label></td>
00286 <td> <input name="user_newpassword" id="user_newpassword" class="fValidate['']" type="password"></td>
00287 </tr>
00288 <tr> <td><label for="user_newrepassword" class="labelrequired">Re-enter New Password</label></td>
00289 <td> <input name="user_newrepassword" id="user_newrepassword" class="fValidate['=user_newpassword']" type="password"></td>
00290 </tr>
00291 PREF;
00292
00293 }
00294
00295 $profileForm .= <<<PREF
00296 $dynamicFields
00297 $captchaValidation
00298 <tr>
00299 <td colspan="2"> </td>
00300 </tr>
00301 <tr>
00302 <td><input type="submit" name="btnSubmitProfile" id="submitbutton" value="Save Profile"></td>
00303 <td></td>
00304 </tr>
00305 </table>
00306 PREF;
00307
00308 if($forEditRegistrant) {
00309 $profileForm .= '<input type="hidden" name="useremail" value="'.getUserEmail($userId).'" />';
00310 }
00311
00312 $profileForm .= <<<PREF
00313 </fieldset>
00314 </form>
00315 </div>
00316 PREF;
00317
00318
00319 return $profileForm . getProfileForms($userId).getProfileGroupsAndFormsList($userId);
00320 }
00321
00322
00323 function getProfileFormEditForm() {
00324 global $sourceFolder, $moduleFolder;
00325 $moduleComponentId = 0;
00326
00327 require_once("$sourceFolder/$moduleFolder/form/editformelement.php");
00328 require_once("$sourceFolder/$moduleFolder/form/editform.php");
00329
00333 if (isset($_GET['subaction'])) {
00334 $subAction = escape($_GET['subaction']);
00335 require_once("$sourceFolder/$moduleFolder/form/editformelement.php");
00336
00337 if (
00338 $_GET['subaction'] == 'editformelement' &&
00339 isset($_POST['elementid']) && ctype_digit($_POST['elementid']) &&
00340 isset($_POST['txtElementDesc']) && isset($_POST['selElementType']) &&
00341 isset($_POST['txtToolTip']) && isset($_POST['txtElementName'])
00342 ) {
00343 submitEditFormElementDescData($moduleComponentId, escape($_POST['elementid']));
00344 }
00345 elseif ( isset($_GET['elementid']) && ctype_digit($_GET['elementid']) ) {
00346 if ($_GET['subaction'] == 'editformelement') {
00347 return generateEditFormElementDescBody($moduleComponentId, escape($_GET['elementid']), 'admin&subsubaction=editprofileform');
00348 }
00349 elseif ($_GET['subaction'] == 'deleteformelement') {
00350 deleteFormElement($moduleComponentId, escape($_GET['elementid']));
00351 }
00352 elseif ($_GET['subaction'] == 'moveUp' || $_GET['subaction'] == 'moveDown') {
00353 moveFormElement($moduleComponentId, escape($_GET['subaction']), escape($_GET['elementid']));
00354 }
00355 }
00356 }
00357 if (isset($_POST['addformelement_descsubmit'])) {
00358 addDefaultFormElement($moduleComponentId);
00359 }
00360
00361 return generateFormElementDescBody($moduleComponentId, 'admin&subsubaction=editprofileform');
00362 }
00363
00364
00365 function deleteUserAccount($userId) {
00367 displayinfo('To be implemented');
00368 }
00369
00370 function getProfileViewRegistrantsForm() {
00371 if(isset($_GET['subsubaction'])) {
00372 if($_GET['subsubaction'] == 'editregistrant' && (isset($_GET['useremail']) || isset($_POST['useremail']))) {
00373 $email = isset($_GET['useremail']) ? escape($_GET['useremail']) : escape($_POST['useremail']);
00374 return profile(getUserIdFromEmail($email), true);
00375 }
00376 elseif($_GET['subsubaction'] == 'deleteregistrant' && isset($_GET['useremail'])) {
00377 deleteUserAccount(getUserIdFromEmail(escape($_GET['useremail'])));
00378 }
00379 }
00380
00381 return getProfileRegistrantsList($_GET['subaction'] == 'editsiteregistrants');
00382 }
00383
00384
00385 function getProfileRegistrantsList($showEditButtons = false) {
00386 global $urlRequestRoot, $cmsFolder, $moduleFolder, $templateFolder,$sourceFolder;
00387 require_once("$sourceFolder/$moduleFolder/form/viewregistrants.php");
00388
00389 $sortField = 'useremail';
00390 $sortOrder = 'asc';
00391 if(isset($_GET['sortfield'])) {
00392 $sortField = escape($_GET['sortfield']);
00393 }
00394 if(isset($_GET['sortorder']) && ($_GET['sortorder'] == 'asc' || $_GET['sortorder'] == 'desc')) {
00395 $sortOrder = escape($_GET['sortorder']);
00396 }
00397
00398 $action = './+admin&subaction=' . escape($_GET['subaction']);
00399
00400 $columnList['useremail'] = 'User Email';
00401 $columnList['username'] = 'Username';
00402 $columnList['userfullname'] = 'User Full Name';
00403 $columnList['registrationdate'] = 'Registration Date';
00404 $columnList['lastupdated'] = 'Last Updated';
00405
00406 $columnList = array_merge($columnList, getColumnList(0, false, false, false, false));
00407
00408 $normalImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/view-refresh.png\" />";
00409 $orderedImage = "<img alt=\"Sort by this field\" height=\"12\" width=\"12\" style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/go-" . ($sortOrder == 'asc' ? 'up' : 'down') . ".png\" />";
00410
00411 $tableCaptions = "<tr>\n<th nowrap=\"nowrap\">S. No.</th>\n";
00412 if($showEditButtons) {
00413 $tableCaptions .= '<th nowrap="nowrap">Edit</th><th nowrap="nowrap">Delete</th>';
00414 }
00415 foreach($columnList as $columnName => $columnTitle) {
00416 $tableCaptions .= "<th nowrap=\"nowrap\">$columnTitle<a href=\"$action&sortfield=$columnName";
00417 if($sortField == $columnName) {
00418 $tableCaptions .= '&sortorder=' . ($sortOrder == 'asc' ? 'desc' : 'asc') . '">'.$orderedImage.'</a>';
00419 }
00420 else {
00421 $tableCaptions .= '">' . $normalImage. '</a>' ;
00422 }
00423 $tableCaptions .= "</th>\n";
00424 $columnNames[] = $columnName;
00425 }
00426 $tableCaptions .= "</tr>\n";
00427
00428 $userIds = getDistinctRegistrants(0, $sortField, $sortOrder);
00429 $userCount = count($userIds);
00430
00431 $editImage = "<img style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/apps/accessories-text-editor.png\" alt=\"Edit\" />";
00432 $deleteImage = "<img style=\"padding:0px\" src=\"$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/edit-delete.png\" alt=\"Delete\" />";
00433
00434 $tableBody = '';
00435 for($i = 0; $i < $userCount; $i++) {
00436 $tableBody .= '<tr><td>'.($i + 1).'</td>';
00437 if($showEditButtons) {
00438 $tableBody .= '<td align="center"><a href="./+admin&subaction=editsiteregistrants&subsubaction=editregistrant&useremail='.getUserEmail($userIds[$i]).'" />' . $editImage . '</a></td>';
00439 $tableBody .= '<td align="center"><a href="./+admin&subaction=editsiteregistrants&subsubaction=deleteregistrant&useremail='.getUserEmail($userIds[$i]).'" />' . $deleteImage . '</a></td>';
00440 }
00441 $tableBody .= '<td>' . join(generateFormDataRow(0, $userIds[$i], $columnNames), '</td><td>') . "</td></tr>\n";
00442 }
00443
00444 return '<br /><br /><br /><table border="1">' . $tableCaptions . $tableBody . '</table>';
00445 }
00446
00447 function getProfileForms($userId) {
00448 global $ICONS,$urlRequestRoot;
00449 $regforms ="<fieldset style=\"padding: 8px\"><legend>{$ICONS['User Groups']['small']}Forms I Have Registered To</legend>";
00450 $regforms .= '<ol>';
00451 $query = "SELECT DISTINCT `page_modulecomponentid` FROM `form_elementdata` WHERE `user_id` = $userId";
00452 $result2 = mysql_query($query);
00453 while($result = mysql_fetch_row($result2)) {
00454 if($result[0]!=0){
00455 $formPath = getPagePath(getPageIdFromModuleComponentId('form', $result[0]));
00456 $formPathLink = $urlRequestRoot . $formPath;
00457 $query1 = "SELECT `form_heading` FROM `form_desc` WHERE `page_modulecomponentid` =". $result[0];
00458 $result1 = mysql_query($query1);
00459 $result1 = mysql_fetch_row($result1);
00460 $regforms .= '<li> <a href="'.$formPathLink.'">'.$result1[0].'</a></li>';
00461 }
00462 }
00463 $regforms .= '</ol></fieldset> ';
00464 return $regforms;
00465 }
00466 function getProfileGroupsAndFormsList($userId) {
00467 global $sourceFolder;
00468 require_once("$sourceFolder/group.lib.php");
00469
00470 $groupRows = getGroupsFromUserId($userId);
00471 $groupRowsCount = count($groupRows);
00472
00473 $associatedGroups = array();
00474 $unassociatedGroups = array();
00475
00476 for($i = 0; $i < $groupRowsCount; $i++) {
00477 if($groupRows[$i]['form_id'] == 0) {
00478 $unassociatedGroups[] = '<tr><td>' . $groupRows[$i]['group_name'] . '</td><td>' . $groupRows[$i]['group_description'] . '</td></tr>';
00479 }
00480 else {
00481 $formPath = getPagePath(getPageIdFromModuleComponentId('form', $groupRows[$i]['form_id']));
00482 global $urlRequestRoot;
00483 $formPathLink = $urlRequestRoot . $formPath;
00484 $associatedGroups[] = '<tr><td><a href="' . $formPathLink . '">' . $formPath . '</a></td><td>' . $groupRows[$i]['group_name'] . '</td><td><a href="' . $formPathLink . '&subaction=unregister" onclick="return confirm(\'Are you sure you wish to unregister from this form?\')">Unregister</a></td></tr>';
00485 }
00486 }
00487
00488 if(count($associatedGroups) == 0 && count($unassociatedGroups) == 0)
00489 return false;
00490 global $ICONS;
00491 $retVal = "<fieldset style=\"padding: 8px\"><legend>{$ICONS['User Groups']['small']}Groups I Belong To</legend>";
00492 if(count($associatedGroups) > 0) {
00493 $retVal .= '<strong>Groups associated with forms:</strong><br /><br /><table style="margin-left: 8px" border="1" cellpadding="4px" cellspacing="4px">' .
00494 '<tr><th>Form Path</th><th>Group Name</th><th>Unregister</th></tr>' .
00495 implode("\n", $associatedGroups) . '</table><br /><br />';
00496 }
00497 if(count($unassociatedGroups) > 0) {
00498 $retVal .= '<strong>Groups not associated with any form:</strong><br /><table style="margin-left: 8px" border="1" cellpadding="4px" cellspacing="4px">' . '<tr><th>Group Name</th><th>Group Description</th></tr>' . implode("\n", $unassociatedGroups) . '</table><br />';
00499 }
00500 $retVal .= '</fieldset>';
00501 return $retVal;
00502 }
00503
00504 function getProfileNewsletterList($userId) {
00505 $retVal = '<fieldset style="padding: 8px"><legend>My Newsletters</legend>';
00506 global $urlRequestRoot, $cmsFolder, $sourceFolder, $moduleFolder, $templateFolder;
00507 include_once("$sourceFolder/$moduleFolder/newsletter.lib.php");
00508 $subscribableLists = newsletter::getSubscribableLists($userId);
00509 $subscribedLists = '';
00510 $unsubscribedLists = '';
00511
00512 for ($i = 0; $i < count($subscribableLists); ++$i) {
00513 if ($subscribableLists[$i][2] === true)
00514 $subscribedLists .= '<span class="newsletterlistitem"><a href="' . $subscribableLists[$i][1] . '" />' . $subscribableLists[$i][0] . '</a></span>';
00515 else
00516 $unsubscribedLists .= '<span class="newsletterlistitem"><a href="' . $subscribableLists[$i][1] . '" />' . $subscribableLists[$i][0] . '</a></span>';
00517 }
00518
00519 $imageDir = "$urlRequestRoot/$cmsFolder/$templateFolder/common/icons/16x16/actions/";
00520 $retVal .= '<table border="0" cellpadding="4" cellspacing="4"><tr><th>Available Lists</th><th></th><th>Lists I\'ve subscribed to</th><tr><td width="45%">';
00521 $retVal .= '<span class="newsletterlist" style="float: left" id="unsubscribedLists">' . $unsubscribedLists . '</span>';
00522 $retVal .= '</td><td style="vertical-align: center; text-align: center"><img src="' . $imageDir .'go-next.gif" /><br /><br /><img src="' . $imageDir . 'go-previous.gif" /></td><td width="45%">';
00523 $retVal .= '<span class="newsletterlist" style="float: right" id="subscribedLists">' . $subscribedLists . '</span>';
00524 $retVal .= '</td></tr></table>';
00525 $retVal .= '</fieldset>';
00526
00527 return $retVal;
00528 }