<tr>
	<td>Production:</td>
	<td>';
if ($countProduction > 0) {
    $appointments_table .= '<a href="appointment_search.php?stage=1&action=advanced_search&keyword=^' . $dea_id . '&type=Production&searchLink=' . $_SERVER['SCRIPT_NAME'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=5') . '">' . $countProduction . '</a>';
} else {
    $appointments_table .= "0";
}
$appointments_table .= '</td>
	<td><a href="production_add.php?stage=vendor&dea_id=' . $dea_id . '">[ New ]</a></td>
  </tr>
  <tr>
	<td>Inspections:</td>
	<td>';
if ($countInspection > 0) {
    $appointments_table .= '<a href="appointment_search.php?stage=1&action=advanced_search&keyword=^' . $dea_id . '&type=Inspection&searchLink=' . $_SERVER['SCRIPT_NAME'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=5') . '">' . $countInspection . '</a>';
} else {
    $appointments_table .= "0";
}
$appointments_table .= '</td>
	<td><a href="inspection_add.php?dea_id=' . $dea_id . '">[ New ]</a></td>
  </tr>
</table>
<table id="detailTable" width="50%" style="margin-left:10px">
  <tr>
    <td>' . $dea_hits . '</td>
  </tr>
</table>';
// build data arrays for editable tabs
// summary page, no array
/*
function renderNotes($not_type, $not_row, $options = array())
{
    if ($options["label"]) {
        $label = $options["label"];
    } else {
        $label = 'Notes';
    }
    if ($options["order"] == "ASC") {
        $order = $options["order"];
    } else {
        $order = 'DESC';
    }
    $querystring = $_SERVER['QUERY_STRING'];
    if ($options["viewform"]) {
        $querystring = replaceQueryString($querystring, 'viewForm');
        $querystring .= '&viewForm=' . $options["viewform"];
    }
    $return = $_SERVER['PHP_SELF'] . urlencode('?' . $querystring);
    $_sql = "SELECT note.*,\n\tDATE_FORMAT(note.not_edited,'%d/%m/%y') AS date,\n\tCONCAT(use_fname,' ',use_sname) AS use_name\n\tFROM note,user\n\tWHERE not_type = '{$not_type}' AND not_row = {$not_row} AND not_user = user.use_id\n\tORDER BY not_status, not_edited {$order} ";
    $_result = mysql_query($_sql);
    $numRows = mysql_num_rows($_result);
    if (!$_result) {
        die("MySQL Error:  " . mysql_error() . "<pre>db_query: " . $_sql . "</pre>");
    }
    while ($row = mysql_fetch_array($_result)) {
        if ($row["not_status"] == 'Deleted') {
            $class = 'note_deleted';
        } else {
            $class = 'note';
        }
        // wrap each note in a div for mouseover highlight
        if ($options["layout"] == "readonly") {
            $notes .= '<div class="noteOff" onMouseOver="this.className=\'noteOn\';" onMouseOut="this.className=\'noteOff\';">';
            $notes .= '
			<div class="noteInfo"><img src="/images/sys/admin/icons/note.gif" />' . $row["use_name"] . ' ' . $row["date"] . '</div>
			<div class="' . $class . '">' . nl2br($row["not_blurb"]) . '</div>
			';
        } elseif ($options["layout"] == "simple") {
            $notes .= '<div class="noteOff" onMouseOver="this.className=\'noteOn\';" onMouseOut="this.className=\'noteOff\';">';
            $notes .= '
			<div class="' . $class . '">' . nl2br($row["not_blurb"]) . '</div>
			';
        } else {
            $notes .= '<div class="noteOff" onMouseOver="this.className=\'noteOn\';" onMouseOut="this.className=\'noteOff\';" onClick="document.location.href = \'note.php?not_id=' . $row["not_id"] . '&amp;return=' . $return . '\'">';
            $notes .= '
			<div class="noteInfo"><a href="note.php?not_id=' . $row["not_id"] . '&amp;return=' . $return . '"><img src="/images/sys/admin/icons/note.gif" />' . $row["use_name"] . ' &nbsp;edited: ' . $row["date"] . '</a></div>
			<div class="' . $class . '">' . nl2br($row["not_blurb"]) . '</div>
			';
        }
        $notes .= '</div>';
    }
    if ($notes) {
        if ($numRows > 0) {
            $numRows = ' (' . $numRows . ')';
        }
        $notes = '
		<div class="noteLabel">' . $label . $numRows . '</div>
		<div class="noteWrapper">' . $notes . '</div>
		';
    }
    return $notes;
}
$numRows = $q->numRows();
while ($row = $q->fetchRow()) {
    if ($row["use_colour"]) {
        $use_colour = '<span class="use_col" style="background-color: #' . $row["use_colour"] . ';"><img src="/images/sys/admin/blank.gif" width="10" height="10" alt="' . $row["use_name"] . '"></span>&nbsp;';
    } else {
        // unnassigned
        $use_colour = '<span class="use_col" style="background-color: #FFFFFF;"><img src="/images/sys/admin/blank.gif" width="10" height="10" alt="' . $row["use_name"] . '"></span>&nbsp;';
    }
    $use_name = $use_colour . $row["use_initial"];
    $appointments .= '
  <tr>
	<td width="15%" valign="top">' . $row["app_date"] . '</td>
	<td valign="top"><strong>' . $row["pro_addr"] . '</strong></td>
	<td width="10%" valign="top">' . $use_name . '</td>
	<td width="5%" align="right" valign="top">
	  <a href="appointment_edit.php?app_id=' . $row["app_id"] . '&searchLink=' . $_SERVER['SCRIPT_NAME'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=0') . '"><img src="/images/sys/admin/icons/edit-icon.png" width="16" height="16" border="0" alt="View/Edit Appointment"/></a>
	  </td>
  </tr>';
}
if ($appointments) {
    $render_summary .= '
<hr />
<table cellpadding="2" cellspacing="2" border="0" width="95%" align="center">

  <tr>
	<td><table width="100%">' . $appointments . '</table></td>
  </tr>
</table>';
}
#overwrite database values with POST values (probably empty)
foreach ($_POST as $key => $val) {
     $terms["cli_email"] = trim($_GET["cli_email"]);
 }
 $sql_2 = $sql;
 $sql = '';
 # build data arrays
 $formData1 = array('cli_salutation' => array('type' => 'select', 'group' => 'Full Name', 'label' => 'Salutation', 'value' => $cli_salutation, 'required' => 2, 'options' => db_enum("client", "cli_salutation", "array"), 'attributes' => array('style' => 'width:60px')), 'cli_fname' => array('type' => 'text', 'group' => 'Full Name', 'label' => 'Forename', 'value' => $cli_fname, 'init' => 'Forename(s)', 'required' => 2, 'attributes' => array('style' => 'width:100px', 'onFocus' => 'javascript:clearField(this,\'Forename(s)\')'), 'function' => 'format_name'), 'cli_sname' => array('type' => 'text', 'group' => 'Full Name', 'last_in_group' => 1, 'label' => 'Surname', 'value' => $cli_sname, 'init' => 'Surname', 'required' => 2, 'attributes' => array('style' => 'width:152px', 'onFocus' => 'javascript:clearField(this,\'Surname\')'), 'function' => 'format_name'), 'cli_tel' => array('type' => 'tel', 'label' => 'Telephone 1', 'required' => 2, 'value' => $_GET["telnew"]), 'cli_email' => array('type' => 'text', 'label' => 'Email', 'value' => $cli_email, 'required' => 3, 'attributes' => array('style' => 'width:320px', 'maxlength' => 255)), 'cli_preferred' => array('type' => 'radio', 'label' => 'Preferred Contact', 'value' => $cli_preferred, 'required' => 2, 'options' => db_enum("client", "cli_preferred", "array")));
 // we will only have a pro_pro_id in the GET when returning from error message
 // so build a form that is read-only populated with the data, and give button to change, which shows ajax screen again
 if ($_GET["pro_pro_id"]) {
     $sqlP = "SELECT * FROM property WHERE pro_id = " . $_GET["pro_pro_id"] . " LIMIT 1";
     $qP = $db->query($sqlP);
     if (DB::isError($qP)) {
         die("db error: " . $q->getMessage() . "sqlP<br>" . $sqlP);
     }
     while ($row = $qP->fetchRow()) {
         $formData2 = array('pro_pro_id' => array('type' => 'hidden', 'value' => $row["pro_id"]), 'pro_pcid' => array('type' => 'hidden', 'value' => $row["pro_pcid"]), 'pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $row["pro_addr1"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $row["pro_addr2"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $row["pro_addr3"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $row["pro_addr5"], 'required' => 1, 'attributes' => array('class' => 'addr', 'readonly' => 'readonly'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $row["pro_postcode"], 'required' => 1, 'attributes' => array('class' => 'pc', 'maxlength' => 9, 'readonly' => 'readonly'), 'function' => 'format_postcode', 'group' => 'Postcode'), 'pro_postcode_change' => array('type' => 'button', 'label' => 'Postcode', 'value' => 'Change Address', 'group' => 'Postcode', 'attributes' => array('class' => 'button', 'onClick' => 'javascript:document.location.href = \'' . $_SERVER['SCRIPT_NAME'] . '?' . replaceQueryString($_SERVER['QUERY_STRING'], 'pro_pro_id') . '\';'), 'last_in_group' => 1));
     }
     // manually inputted address
 } else {
     $formData2 = array('pro_addr1' => array('type' => 'text', 'label' => 'House Number', 'value' => $pro_addr1, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr2' => array('type' => 'text', 'label' => 'Building Name', 'value' => $pro_addr2, 'required' => 1, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr3' => array('type' => 'text', 'label' => 'Street', 'value' => $pro_addr3, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr4' => array('type' => 'text', 'label' => 'Town or Area', 'value' => $pro_addr4, 'required' => 3, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_addr5' => array('type' => 'text', 'label' => 'City or County', 'value' => $pro_addr5, 'required' => 2, 'attributes' => array('class' => 'addr'), 'function' => 'format_street'), 'pro_postcode' => array('type' => 'text', 'label' => 'Postcode', 'value' => $pro_postcode, 'required' => 2, 'attributes' => array('class' => 'pc', 'maxlength' => 9), 'function' => 'format_postcode'), 'pro_country' => array('type' => 'select', 'label' => 'Country', 'value' => $pro_country, 'required' => 2, 'options' => db_lookup("cli_country", "country", "array"), 'attributes' => array('class' => 'addr')));
 }
 if (!$_POST["action"]) {
     $sql_1 = remove_lastchar(trim($sql_1), "OR");
     $sql_2 = remove_lastchar(trim($sql_2), "OR");
     if (!$_GET["return"]) {
         $return = $_SERVER['SCRIPT_NAME'] . '?' . http_build_query(array('cli_name' => $_GET["cli_name"], 'cli_email' => $_GET["cli_email"], 'dest' => $_GET["dest"], 'dea_id' => $_GET["dea_id"]));
     } else {
         $return = $_GET["return"];
     }
     if ($sql_1) {
         // first, match both first AND surnames and put at top of list
                        // cancelled overwrites above feedback text
                        if ($row["app_status"] == 'Cancelled') {
                            $feedback = '(cancelled)';
                        }
                        if ($row["use_colour"]) {
                            $use_colour = '<span class="use_col" style="background-color: #' . $row["use_colour"] . ';"><img src="' . GLOBAL_URL . 'img/blank.gif" width="10" height="10" alt="' . $row["use_name"] . '"></span>&nbsp;';
                        }
                        $use_name = $use_colour . $row["use_initial"];
                        $viewings_table .= '
  <tr>
	<td width="13%" valign="top">' . $row["app_date"] . '</td>
	<td width="10%" valign="top">' . $use_name . '</td>
	<td width="57%" valign="top">' . $row["pro_addr"] . '</td>
	<td width="15%" valign="top">' . $feedback . '</td>
	<td width="5%" align="right" valign="top">
	  <a href="appointment_edit.php?app_id=' . $row["app_id"] . '&searchLink=' . $_SERVER['PHP_SELF'] . urlencode('?' . replaceQueryString($_SERVER['QUERY_STRING'], 'viewForm') . '&viewForm=3.1') . '"><img src="' . GLOBAL_URL . '/img/icons/page_edit.gif" width="16" height="16" border="0" alt="View/Edit Appointment"/></a>
	  </td>
  </tr>';
                    }
                }
                $appointments_table = '
<div style="width:97%;height:210px;overflow:auto;margin-left:10px">
<table id="detailTable" width="97%" cellpadding="2" cellspacing="2" align="center">
  <tr>
    <th>Date</th>
    <th>Neg</th>
    <th>Property</th>
    <th colspan="2">Feedback</th>
  </tr>
' . $viewings_table . '
</table>';
                 //$special_background = '  background-image:url(img/anibg.gif)';
                 $div['colour'] = 'FFFFFF';
             } else {
                 //$special_background = '';
             }
             // private appointments are only visible to bookedby
             //if ($div['private'] == 'Yes' && $_SESSION['auth']['use_id'] <> $div['bookedby']) {
             //	} else {
             // variable style values from database, rest is in css class
             if ($div['DIT']) {
                 $class .= ' DIT-property';
             }
             $render .= '  <div id="app' . $div['id'] . '" class="' . $class . '" style="position: absolute; height: ' . $app_height . 'px; left: ' . $left . 'px; top:' . $div['start_pixel'] . 'px; width:' . ($width - 18) . 'px;  border: 1px solid #' . $div['colour'] . '; border-left: 10px solid #' . $div['colour'] . '; z-index:1; overflow: hidden;' . $special_background . '" ';
             // href targetted at parent of parent. remove hightlight var from querystring
             // parent.parent.frames[\'mainFrame\'].window.location.href=
             $render .= 'onClick="javascript:parent.window.location.href=\'' . GLOBAL_URL . 'appointment_edit.php?app_id=' . $div['id'] . '&amp;searchLink=calendar.php?' . urlencode(replaceQueryString($_SERVER['QUERY_STRING'], 'app_highlight')) . '\'" ';
             // js actions
             $render .= 'onMouseOver="' . $div_mouseover . '" onMouseOut="' . $div_mouseout . '" onMouseDown="nd();">' . "\n";
             // text displayed within appointment
             $render .= $title . "\n" . '  </div>' . "\n";
             //	}
         }
         // the current appointment ends in this interval
         if ($div['end_stamp'] >= $interval && $div['end_stamp'] < $interval + $default_calendar_interval) {
             // remove column reference from master array
             unset($divs[$div_id]['column']);
         }
     }
 }
 unset($left, $column);
 $counter++;
function source($_source = NULL, $_querystring)
{
    // if a source is supplied, don't show the muti drop downs.
    if ($_source) {
        $ref = '?' . replaceQueryString($_querystring, 'cli_source');
        $sql = "SELECT sou_id,sou_title,sou_type FROM source WHERE sou_id = {$_source} LIMIT 1";
        $_result = mysql_query($sql);
        if (!$_result) {
            die("MySQL Error:  " . mysql_error() . "<pre>source: " . $sql . "</pre>");
        }
        while ($row = mysql_fetch_array($_result)) {
            $output['dd1'] = '<input type="text" readonly="readonly" value="' . $row["sou_title"] . ' (' . $row["sou_type"] . ')" class="inputInvisible">' . "\n";
            $output['dd1'] .= '<input type="button" value="Change" class="button" onClick="javascript:document.location.href=\'' . $ref . '\';">' . "\n";
            $output['dd1'] .= '<input type="hidden" name="cli_source" value="' . $row["sou_id"] . '">';
        }
    } else {
        // only add onload statement if source is not specified
        $output['onload'] = 'init(document.forms[0].cli_source)';
        // get source types to populate javascript drop downs
        $sql = "SELECT sou_id,sou_title,sou_type FROM source ORDER BY sou_title";
        $_result = mysql_query($sql);
        if (!$_result) {
            die("MySQL Error:  " . mysql_error() . "<pre>source: " . $sql . "</pre>");
        }
        while ($row = mysql_fetch_array($_result)) {
            if (!$row["sou_type"]) {
                $render_source .= '<option value="' . $row["sou_id"] . '"';
                if ($cli_source1 == $row["sou_id"]) {
                    $render_source .= ' selected';
                }
                $render_source .= '>' . $row["sou_title"] . '</option>' . "\n";
                // array of types to loop through later
                $types[] = $row["sou_id"];
            } else {
                ${'_js' . $row["sou_type"]} .= "'" . $row["sou_title"] . "','" . $row["sou_id"] . "',";
            }
            /*~
            		elseif ($row["sou_type"] == "Portal") {
            			$_js1 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
            			}
            		elseif ($row["sou_type"] == "Press") {
            			$_js2 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
            			}
            		elseif ($row["sou_type"] == "Search Engine") {
            			$_js3 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
            			}
            		elseif ($row["sou_type"] == "Referral") {
            			$_js4 .= "'".$row["sou_title"]."','".$row["sou_id"]."',";
            			}*/
        }
        // create master type drop down
        $output['dd1'] = '<select name="cli_source1" style="width:200px" onchange="populate(document.forms[0].cli_source1,document.forms[0].cli_source)">' . "\n";
        $output['dd1'] .= '<option value="0">(click here)</option>' . "\n";
        $output['dd1'] .= $render_source;
        $output['dd1'] .= '</select>' . "\n";
        $output['dd2'] = '<select name="cli_source" style="width:200px;display:none;">' . "\n";
        $output['dd2'] .= '<option></option>' . "\n";
        $output['dd2'] .= '</select>' . "\n";
        // format javascript arrays (add "other" option to each?)
        foreach ($types as $type) {
            if (${'_js' . $type}) {
                ${'_js' . $type} = "'(select)',''," . remove_lastchar(${'_js' . $type}, ",");
                $render_js .= 'thelist[' . $type . '] = new Array(' . ${'_js' . $type} . ');' . "\n";
            }
        }
        $output['js'] = '
var thelist = new Array();
thelist[0] = new Array();
' . $render_js . '
	
function init(dd1) 	{
	optionTest = true;
	lgth = dd1.options.length;
	dd1.options[lgth] = null;
	if (dd1.options[lgth]) optionTest = false;
	}
	
// dd1 is the first drop down, dd2 is the second
function populate(dd1,dd2) 	{
	if (!optionTest) return;
	dd2.style.display = "";
	/* dd1.style.display = "none"; */
	var box = dd1;
	var number = box.options[box.selectedIndex].value;
	if (!number) return;
	var list = thelist[number];
	var box2 = dd2;
	box2.options.length = 0;
	for(i=0;i<list.length;i+=2) {
		box2.options[i/2] = new Option(list[i],list[i+1]);
		}
	dd2.focus();
	}		
';
    }
    return $output;
}
    $width = round(100 / $perRow);
    $allDayDivHeight = ceil($numRowsAllDay / $perRow) * $allDayDivHeight;
    $alldayapps = '<table width="100%"><tr>';
    while ($row = $q->fetchRow()) {
        // trim subject
        if (strlen($row["app_subject"]) > 25) {
            $subject = substr($row["app_subject"], 0, 25) . "...";
        } else {
            $subject = $row["app_subject"];
        }
        // variable style values from database, rest is in css class
        $alldayapps .= '<td style="white-space: nowrap;width:' . $width . '%;border:1px solid #' . $row["use_colour"] . ';border-left: 10px solid #' . $row["use_colour"] . ';background-color: #FFFFFF; cursor:pointer; font-size:9px; overflow: hidden;" ';
        //<div style="width:300px;border:1px solid #'.$row["use_colour"].';display:block;" ';  display:inline;  margin: 2px; border: 1px solid #'.$row["use_colour"].';
        // href targetted at parent of parent. remove hightlight var from querystring
        // parent.parent.frames[\'mainFrame\'].window.location.href=
        $alldayapps .= 'onClick="javascript:window.location.href=\'appointment_edit.php?app_id=' . $row["app_id"] . '&amp;searchLink=calendar.php?' . urlencode(replaceQueryString($_SERVER['QUERY_STRING'], 'app_highlight')) . '\'" ';
        // js actions
        $alldayapps .= 'onMouseOver="return overlib(\'' . $row["app_subject"] . '<br />' . format_overdiv($row["note"]) . '<br /><br />' . $row["use_name"] . '\',CAPTION,\'' . $row["app_type"] . '\');" onMouseOut="nd();" onMouseDown="nd();"';
        // text displayed within appointment
        $alldayapps .= '>' . $subject . '</td>' . "\n";
        //' - '.$row["use_name"].
        if ($counter % $perRow == 0) {
            $alldayapps .= '
		</tr>
		<tr>';
        }
        $counter++;
    }
    $alldayapps .= '</tr></table>';
}
if ($alldayapps) {
Exemple #9
0
<p>
<a href="http://angeles-print/condorwiki/" title="Get help on Condor">Wiki</a> | 
<a href="../rrdtool/" title="Visualize pool usage" target="main">Usage</a> 
<?php 
if (isset($_REQUEST['admin']) && !empty($_REQUEST['admin'])) {
    ?>
	| <a href="index.php?<?php 
    echo replaceQueryString("admin", "");
    ?>
" target="_top" title="Toggle to simple mode">Simple</a> 
<?php 
} else {
    ?>
	| <a href="index.php?<?php 
    echo replaceQueryString("admin", "1");
    ?>
" target="_top" title="Toggle to advanced mode">Advanced</a> 
<?php 
}
?>
</p>

<hr>

<p>
<a href="condor_status.php?value=" target="main">condor_status</a>
<ul>
<li><a href="command.php?command=condor_status -submitters" target="main">-submitters</a></li>
<li><a href="command.php?command=condor_status -schedd" target="main">-schedd</a></li>
<li><a href="command.php?command=condor_status -master" target="main">-master</a></li>
Exemple #10
0
    $next = "&raquo;";
} else {
    $next = $links['next'];
}
if (!$links['last']) {
    $last = "&raquo;";
} else {
    $last = $links['last'];
}
if ($n_pages) {
    $results .= '<div id="loading"><h1 style="padding-left: 20px;"><img src="/images/sys/admin/ajax-loader.gif" /> Loading</h1></div>';
    for ($i = 1; $i <= $n_pages; ++$i) {
        $pageNum = $i;
        $results .= '<div class="page" id="page' . $pageNum . '" style="display: none">';
        $nav[$pageNum] = str_replace(array('<b><u>1</u></b>', '>' . $pageNum . '</a>', "&nbsp;&nbsp;&nbsp;", "page"), array('<a href="javascript:showResultPage(1)" title="page 1">1</a>', '><b>' . $pageNum . '</b></a>', "&nbsp;", "Page"), $links["pages"]);
        $return = 'property_search.php?' . replaceQueryString($_SERVER['QUERY_STRING'], 'action');
        $results .= '

<div id="header">
<table>
  <tr>
	<td>' . $numRows . ' records found';
        if ($nav[$pageNum]) {
            $results .= ' - Page: ' . $nav[$pageNum];
        }
        $results .= '</td>
  </tr>
</table>
</div>

	';
            </form>';
            */
            //$links is an ordered+associative array with 'back'/'pages'/'next'/'first'/'last'/'all' links.
            //(page '.$pager->getCurrentPageID().' of '.$pager->numPages().')
            if (!$links['back']) {
                $back = "&laquo;";
            } else {
                $back = $links['back'];
            }
            if (!$links['next']) {
                $next = "&raquo;";
            } else {
                $next = $links['next'];
            }
            if ($pager->numItems()) {
                $return = 'appointment_search.php?' . replaceQueryString($_SERVER['QUERY_STRING'], 'action');
                $header = '
<div id="header">
<table>
  <tr>
    <td>' . $pager->numItems() . ' records found';
                if ($pager->numPages() > 1) {
                    $header .= ' - Page: ' . $back . ' ' . str_replace("&nbsp;&nbsp;&nbsp;", "&nbsp;", $links['pages']) . ' ' . $next . '';
                }
                $header .= '</td>
	<td align="right"><a href="' . $return . '">Modify Search</a> / <a href="appointment_search.php">New Search</a></td>
  </tr>
</table>
</div>
';
                $results = '
    $page->addBodyContent('<div id="content">');
    $page->addBodyContent($navbar);
    $page->addBodyContent($form->renderForm());
    $page->addBodyContent('</div>');
    $page->display();
    exit;
} else {
    if ($_POST["med_measurement"] == "feet") {
        $_POST["med_dims"] = ft2mtr($_POST["med_dims"]);
    }
    unset($_POST["med_measurement"]);
    $result = new Validate();
    $results = $result->process($formData, $_POST);
    $db_data = $results['Results'];
    if ($results['Errors']) {
        if (is_array($results['Results'])) {
            $return .= http_build_query($results['Results']);
        }
        echo error_message($results['Errors'], urlencode($return));
        exit;
    }
    $med_id = db_query($db_data, "UPDATE", "media", "med_id", $med_id);
    #header("Location:".urldecode($_POST["searchLink"]));
    if ($_POST["searchLink"]) {
        $tmpurl = $_POST["searchLink"];
    } else {
        $tmpurl = $_GET["searchLink"];
    }
    header("Location:" . replaceQueryString(urldecode($tmpurl), 'viewForm') . '&viewForm=' . $viewForm);
    exit;
}
Exemple #13
0
function columnHeader($column_headers, $query_string)
{
    global $global_url;
    /*
    order by requires two variables, the field name and direction.
    to make querystring we ned to remove both varbailes from the given query string
    and replace them with new values.
    */
    # get existing values (orderby and direction) or set defaults
    parse_str($query_string, $qs);
    // order by first column in array
    if (!$qs['orderby']) {
        $orderby = $column_headers[0]['column'];
    } else {
        $orderby = $qs['orderby'];
    }
    if (!$qs['direction']) {
        $direction = "ASC";
    } else {
        $direction = $qs['direction'];
    }
    # remove values from querystring
    $query_string = replaceQueryString($query_string, '&orderby');
    $query_string = replaceQueryString($query_string, '&direction');
    /*
    if current direction is ASC, we need to show icon and link to DESC, and visa-versa
    only show the icons on the column we are sorting on
    */
    foreach ($column_headers as $column_title => $column_params) {
        # $column_params['title']
        # $column_params['column']
        # $column_params['direction']
        // default direction
        if (!$column_params['direction']) {
            $column_params['direction'] = "ASC";
        }
        if ($column_params['column']) {
            if ($direction == "ASC") {
                $column_direction = "DESC";
                $direction_image = '<img src="/images/sys/admin/asc.gif" width="16" height="16" border="0" align="absmiddle">';
            } else {
                $column_direction = "ASC";
                $direction_image = '<img src="/images/sys/admin/desc.gif" width="16" height="16" border="0" align="absmiddle">';
            }
            $title = '<a href="?' . $query_string . '&orderby=' . $column_params['column'] . '&direction=';
            if ($orderby == $column_params['column']) {
                $title .= $column_direction;
            } else {
                $title .= 'ASC';
            }
            $title .= '" title="Sort by ' . $column_params['title'] . '">' . $column_params['title'] . '</a>';
            // only show image on column we are sorting by
            if ($orderby == $column_params['column']) {
                $title .= $direction_image;
            }
            $column_params['title'] = $title;
        }
        if ($column_params['colspan']) {
            $colspan = ' colspan="' . $column_params['colspan'] . '"';
        }
        $columns .= '<th' . $colspan . '>' . $column_params['title'] . '</th>
	';
        $colspan = '';
        $column_links = '';
        $direction_image = '';
        $column_title = '';
        $title = '';
    }
    # end array loop
    return $columns;
}
            } else {
                $new_order[$comparison_key] = array('id' => $row["med_id"], 'title' => $row["med_title"]);
            }
        }
    }
    ksort($new_order);
    //print_r($new_order);
    //echo "<hr>";
    $count = 1;
    foreach ($new_order as $key => $val) {
        $sql = "UPDATE media SET med_order = {$count} WHERE med_id = " . $val["id"];
        $q = $db->query($sql);
        $count++;
    }
    //exit;
    header("Location:" . replaceQueryString(urldecode($_GET["return"]), 'viewForm') . '&viewForm=' . $viewForm);
} elseif ($_GET["do"] == "feature_add") {
    $dea_id = $_GET["dea_id"];
    $featureId = $_GET["featureId"];
    $sql = "DELETE FROM link_instruction_to_feature WHERE dealId = {$dea_id} AND featureId = {$featureId}";
    $q = $db->query($sql);
    $db_data["dealId"] = $dea_id;
    $db_data["featureId"] = $featureId;
    db_query($db_data, "INSERT", "link_instruction_to_feature", "f2d_id");
    header("Location:" . $_GET["return"] . "&viewForm=" . str_replace('form', '', $_GET["viewForm"]));
} elseif ($_GET["do"] == "feature_remove") {
    $dea_id = $_GET["dea_id"];
    $featureId = $_GET["featureId"];
    $sql = "DELETE FROM link_instruction_to_feature WHERE dealId = {$dea_id} AND featureId = {$featureId}";
    $q = $db->query($sql);
    header("Location:" . $_GET["return"] . "&viewForm=" . str_replace('form', '', $_GET["viewForm"]));
function source($_source = NULL, $_querystring, $_readonly = NULL)
{
    $otherText = '>> create new';
    // if a source is supplied, don't show the muti drop downs.
    if ($_source && $_source != 'x') {
        $ref = '?' . replaceQueryString($_querystring, 'cli_source');
        $sql = "SELECT \n\t\tsource.sou_id,source.sou_title,source.sou_type,source2.sou_title AS sou_title2 \n\t\tFROM source \n\t\tLEFT JOIN  source AS source2 ON source2.sou_id = source.sou_type\n\t\tWHERE source.sou_id = {$_source} LIMIT 1";
        $_result = mysql_query($sql);
        if (!$_result) {
            die("MySQL Error:  " . mysql_error() . "<pre>source: " . $sql . "</pre>");
        }
        while ($row = mysql_fetch_array($_result)) {
            $output['dd1'] = '<input type="text" readonly="readonly" value="' . $row["sou_title"] . ' (' . $row["sou_title2"] . ')" class="inputInvisible">' . "\n";
            if (!$_readonly) {
                $output['dd1'] .= '<input type="button" value="Change" class="button" onClick="javascript:document.location.href=\'' . $ref . '\';">' . "\n";
            }
            $output['dd1'] .= '<input type="hidden" name="cli_source" value="' . $row["sou_id"] . '">';
        }
    } else {
        // only add onload statement if source is not specified
        $output['onload'] = 'init(document.forms[0].cli_source)';
        // get source types to populate javascript drop downs
        $sql = "SELECT sou_id,sou_title,sou_type FROM source ORDER BY sou_title";
        $_result = mysql_query($sql);
        if (!$_result) {
            die("MySQL Error:  " . mysql_error() . "<pre>source: " . $sql . "</pre>");
        }
        while ($row = mysql_fetch_array($_result)) {
            if ($row["sou_type"] == 0) {
                // types
                $render_source .= '<option value="' . $row["sou_id"] . '"';
                if ($cli_source1 == $row["sou_id"]) {
                    $render_source .= ' selected';
                }
                $render_source .= '>' . $row["sou_title"] . '</option>' . "\n";
                // array of types to loop through later
                $types[] = $row["sou_id"];
            } else {
                // sub-types
                ${'_js' . $row["sou_type"]} .= "'" . $row["sou_title"] . "','" . $row["sou_id"] . "',";
            }
        }
        // create master type drop down
        $output['dd1'] = '<select name="cli_source1" id="source1" onchange="populate(document.forms[0].cli_source1,document.forms[0].cli_source)">' . "\n";
        $output['dd1'] .= '<option value="0"></option>' . "\n";
        $output['dd1'] .= $render_source;
        $output['dd1'] .= '</select>' . "\n";
        $output['dd2'] = '<select name="cli_source" id="source" style="width:200px" onChange="sourceOther(this);">' . "\n";
        $output['dd2'] .= '<option></option>' . "\n";
        $output['dd2'] .= '</select>' . "\n";
        $output['dd2'] .= '<input type="text" name="sourceNew" id="sourceNew" style="display:none" />' . "\n";
        // format javascript arrays (add "other" option to each?)
        foreach ($types as $type) {
            if (${'_js' . $type}) {
                ${'_js' . $type} .= "'{$otherText}','x',";
                ${'_js' . $type} = "'(select)',''," . remove_lastchar(${'_js' . $type}, ",");
                $render_js .= 'thelist[' . $type . '] = new Array(' . ${'_js' . $type} . ');' . "\n";
            }
        }
        $output['js'] = '
var thelist = new Array();
thelist[0] = new Array();
' . $render_js . '
	
function init(dd1) 	{
	optionTest = true;
	lgth = dd1.options.length;
	dd1.options[lgth] = null;
	if (dd1.options[lgth]) optionTest = false;
	}
	
// dd1 is the first drop down, dd2 is the second
function populate(dd1,dd2) 	{

	
	
	
	
	if (!optionTest) return;
	var box = dd1;
	var number = box.options[box.selectedIndex].value;
	if (!number) return;
	var list = thelist[number];
	var box2 = dd2;
	
	// make sure dd2 is visible
	if (box2.style.display == "none") {
		box2.style.display = "";
		var sourceNew = document.getElementById(\'sourceNew\');
		sourceNew.style.display = "none";
		}
	box2.options.length = 0;
	for(i=0;i<list.length;i+=2) {
		box2.options[i/2] = new Option(list[i],list[i+1]);
		}
	dd2.focus();
	}	

// replaced dd2 with text field and hidden field for type	
function sourceOther(selectedItem) {

	if (selectedItem.value == \'x\') {
		var source = document.getElementById(\'source\');
		source.style.display = "none";
		var sourceNew = document.getElementById(\'sourceNew\');
		sourceNew.style.display = "";
		sourceNew.focus();
		}
	}	
';
    }
    return $output;
}