Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print "<table cellpadding='1' cellspacing='3' bgcolor='#FFFFFF'>";
- // show row of parameter names
- $query="SELECT * FROM ce_parameters ORDER BY ceparam_position ASC";
- $result=mysql_query($query) or die("Query failed : " . mysql_error());
- print "\n<tr><th>Product Name</th>";
- $colcolors = array();
- $paracolnum = 0;
- while ($line = mysql_fetch_array($result, MYSQL_ASSOC))
- {
- $ceparam_id = $line['ceparam_id'];
- $ceparam_name = stripslashes($line['ceparam_name']);
- $ceparam_description = stripslashes($line['ceparam_description']);
- $ceparam_required = $line['ceparam_required'];
- $ceparam_color = $line['ceparam_color'];
- $colcolors[$paracolnum] = $ceparam_color;
- print "\n<th bgcolor='".$colcolors[$paracolnum]."'><span title='".$ceparam_description."'>".$ceparam_name."</span></th>";
- $paracolnum++;
- }
- print "\n</tr>";
- print "<form method='post' action='intranet_product_matrix.php'>";
- // show list of products along data
- $query="SELECT * FROM ce_products ORDER BY ceprod_name ASC"; //select all from products table
- $result=mysql_query($query) or die("Query failed : " . mysql_error()); //get results of query
- while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) //loop through results
- {
- //set variables
- $ceprod_id =$line['ceprod_id'];
- $ceprod_name =stripslashes($line['ceprod_name']);
- $ceprod_intranet_url=$line['ceprod_intranet_url'];
- print "\n<tr>";
- print "\n<td width='100'><a href=\"".$ceprod_intranet_url."\">".$ceprod_name."</a></td>";
- $query2="SELECT * FROM ce_parameters ORDER BY ceparam_position ASC"; //select all from parameters table
- $result2=mysql_query($query2) or die("Query failed : " . mysql_error()); //get results
- $numcol = 0; //initialise column index
- while ($line2 = mysql_fetch_array($result2, MYSQL_ASSOC)) //loop through results of parameters array
- {
- $ceparam_type = $line2['ceparam_type'];
- $ceparam_id = $line2['ceparam_id'];
- print "\n<td bgcolor='".$colcolors[$numcol]."' width='50'>";
- if ($ceparam_type == "text")
- {
- print "<input type='text' name='prod_matrix[".$ceprod_id."][".$ceparam_id."]'><br>";
- if (isset($_POST['cmd']))
- {
- $cmd = $_POST['cmd'];
- if ($cmd == "editurl")
- {
- print "<br><input type='text' size='1' placeholder='url'>";
- }
- }
- else
- {
- print "<a href='LINK TO INTRANET PAGE HERE' style='text-decoration: none'>x</a>";
- }
- }
- else if ($ceparam_type == "checkbox")
- {
- print "<input type='checkbox'>";
- if (isset($_POST['cmd']))
- {
- $cmd = $_POST['cmd'];
- if ($cmd == "editurl")
- {
- print "<br><input type='text' size='1' placeholder='url'>";
- }
- }
- else
- {
- print "<a href='LINK TO INTRANET PAGE HERE' style='text-decoration: none'>x</a>";
- }
- }
- print "</td>";
- $numcol++;
- }
- print "\n</tr>";
- }
- print "\n</table>";
- if (isset($_POST['cmd']) && ($_POST['cmd'] == "editurl"))
- {
- print "<input type='hidden' name='cmd' value ='addmatrixurl'>";
- print "<input type='submit' value='Submit URL Changes'>";
- print "</form>";
- }
- else
- {
- print "<input type='hidden' name='cmd' value='addmatrix'>";
- print "<input type='submit' value='Submit Changes'>";
- print "</form>";
- }
- if (!(isset($_POST['cmd']) && ($_POST['cmd'] == "editurl")))
- {
- print "<form method='post' action='intranet_product_matrix.php'>";
- print "<input type='submit' value='Edit URLS'>";
- print "<input type='hidden' name='cmd' value='editurl'>";
- print "</form>";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement