i don't know how or even if it is possible have this code work peginated. right now all the data comes in one page but it would be nice to have it in multiple pages let say 40 per page
would you be able to help? i know it is a lot to ask but i cannot pay someone now to do it.
many thanks
function viewallusers_run_action_user_template() {
switch ($_GET['action']) {
case 'addon_viewallusers_showpage1':
$data = viewallusers_display_addon_page();
break;
default:
$data = '';
break;
} // End switch ($_GET['action'])
return $data;
}
/**
* run_action_admin_template()
* This function handles administrative $_GET[] actions related to the addon. Function must be named using this method: addon_addonname_description.
* @return string Should return all contents that should be displayed when a addon specific $_GET['action'] is called.
**/
function viewallusers_run_action_admin_template() {
}
/**
* run_template_user_fields()
* This function handles all the replacement of {template_tags} with the actual content. All tags setup here must also be added to teh load_template function in order for open-realty to parse them.
* @param string $tag
* @return string Should return all contents that should be displayed when a addon specific $tag is called.
**/
function viewallusers_run_template_user_fields($tag = '') {
switch ($tag) {
case 'addon_viewallusers_link':
$data = viewallusers_display_addon_link();
break;
default:
$data = '';
break;
} // End switch ($_GET['action'])
return $data;
}
// Addon Specific Function
function viewallusers_display_addon_link() {
// Show the link for the menu
$display = '<a href="index.php?action=addon_viewallusers_showpage1">View All Agents</a>';
return $display;
}
function viewallusers_display_addon_page() {
// display all the users in columns, pictures and names
global $conn, $lang, $config, $style;
require_once($config['basepath'].'/include/misc.inc.php');
$misc = new misc();
$display = '<table border="1" cellspacing="10" cellpadding="3" width="$style[admin_table_width]" class="form_main" align="center">';
$var_reset = 1; // Reset the var (counter) (DO NOT CHANGE)
// How Many To show Per Row
$user_col_max = 4; // Change this to suit your needs
// pull the user information from the table
$sql = "SELECT userdb_user_name, userdb_id, userdb_user_first_name, userdb_user_last_name FROM " . $config[table_prefix] . "userdb where userdb_is_agent = 'yes' order by userdb_user_name";
$recordSet1 = $conn->Execute($sql);
if ($recordSet1 === false) {
$misc->log_error($sql);
}
while (!$recordSet1->EOF) {
// loop through our users
$name = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_name]);
$first = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_first_name]);
$last = $misc->make_db_unsafe ($recordSet1->fields[userdb_user_last_name]);
$userID = $misc->make_db_unsafe ($recordSet1->fields[userdb_id]);
if ($var_reset == 0) {
$display .= "<tr>";
}
$display .= "<td align=\"center\" valign=\"top\"><a href=\"$config[baseurl]/index.php?action=view_user&user=$userID\">";
// get our image data using the userid
$user = $misc->make_db_unsafe($userID);
$sql = "SELECT userimages_id, userimages_caption, userimages_file_name, userimages_thumb_file_name FROM " . $config[table_prefix] . "userimages WHERE (userdb_id = $user) ";
$recordSet = $conn->SelectLimit($sql, 1, 0 );
if ($recordSet === false) {
$misc->log_error($sql);
}
$num_images = $recordSet->RecordCount();
if ($num_images > 0) {
// while (!$recordSet->EOF) {
$caption = $misc->make_db_unsafe ($recordSet->fields[userimages_caption]);
$thumb_file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_thumb_file_name] );
$file_name = $misc->make_db_unsafe ($recordSet->fields[userimages_file_name]);
$imageID = $misc->make_db_unsafe ($recordSet->fields[userimages_id]);
$imagedata = GetImageSize("$config[user_upload_path]/$thumb_file_name" );
$imagewidth = $imagedata[0];
$imageheight = $imagedata[1];
$shrinkage = $config[thumbnail_width]/$imagewidth;
$displaywidth = $imagewidth * $shrinkage;
$displayheight = $imageheight * $shrinkage;
$display .= "<img src=\"$config[user_view_images_path]/$thumb_file_name\" height=\"$displayheight\" width=\"$displaywidth\"><br> ";
// $recordSet->MoveNext();
// }
} else {
$display .= "<img src=\"images/nophoto_1.gif\"><br>";
}
$display .= "<br>$first $last</a><br>";
$display .= "</td>";
if ($var_reset == $user_col_max) {
$display .= "</tr>";
$var_reset = 1;
} else {
$var_reset++;
}
$recordSet1->MoveNext();
} // end While loop
$display .= "</td></table><br>";
return $display;
} // end viewallusers_display_addon_page