コード例 #1
0
 function printcontact($dept_array, $current_org, $current_area, $current_dept)
 {
     $length = count($dept_array);
     $contact_order = 0;
     if (is_array($dept_array)) {
         foreach ($dept_array as $contact) {
             //Create one form that is just for the priority drop down
             echo "<tr><td><form name='change_order_" . $contact['id'] . "' action='' method='POST'>\n";
             echo "<select name='new_priority' onchange='document.change_order_" . $contact['id'] . ".submit()'>\n";
             for ($i = 0; $i < $length; $i++) {
                 echo "<option value='" . $i . "'";
                 if ($i == $contact_order) {
                     echo " selected";
                 }
                 echo ">" . $i . "</option>\n";
             }
             echo "</select>";
             echo "<input type='hidden' name='current_org' value='" . $current_org . "'>\n";
             echo "<input type='hidden' name='current_area' value='" . $current_area . "'>\n";
             echo "<input type='hidden' name='current_dept' value='" . $current_dept . "'>\n";
             echo "<input type='hidden' name='dept' value='" . $contact['dept_id'] . "'>\n";
             echo "<input type='hidden' name='id' value='" . $contact['id'] . "'>\n";
             echo "<input type='hidden' name='priority' value='" . $contact['priority'] . "'></form></td>\n";
             //Create another form for all the other information
             if ($contact['managerFlag'] == 1) {
                 $flag = 'checked';
             } else {
                 $flag = '';
             }
             echo "\n<form action='' method='POST' onSubmit='return validate_form(this)'>\n";
             echo "<td><input type='text' name='name' value='" . $contact['name'] . "' size='15'></td>\n";
             echo "<td><input type='text' name='phone' value='" . $contact['phone'] . "' size='6'></td>\n";
             echo "<td><input type='text' name='address' value='" . $contact['address'] . "' size='7'></td>\n";
             echo "<td><input type='text' name='position' value='" . $contact['position'] . "' size='35'></td>\n";
             echo "<td align='center'><input type='checkbox' name='managerFlag' " . $flag . " value='1'></td>\n";
             echo "<input type='hidden' name='priority' value='" . $contact['priority'] . "'>\n";
             echo "<td>" . createDDBox(3, $contact['dept_id'], -1) . "</td>";
             echo "<td><input type='Submit' name='edit_contact' value='EDIT'></td>\n";
             echo "<td><input type='submit' name='remove_contact' value='DELETE' onClick='return delete_confirm()'></td>\n";
             echo "<input type='hidden' name='current_org' value='" . $current_org . "'>\n";
             echo "<input type='hidden' name='current_area' value='" . $current_area . "'>\n";
             echo "<input type='hidden' name='current_dept' value='" . $current_dept . "'>\n";
             echo "<input type='hidden' name='id' value='" . $contact['id'] . "'></tr></form>\n";
             $contact_order++;
         }
     }
 }
 function createRow($name, $id, $higherUp, $priority, $order, $length, $indent)
 {
     global $debug;
     echo "\n<tr style='text-align: center;'>";
     for ($i = 0; $i < $indent; $i++) {
         echo "<td style='border: none;'></td>";
     }
     echo "<form action='' method='POST' onSubmit='return validate_form(this)'>\n";
     if ($debug) {
         echo "<td style='border: none;' align=right>" . $id . "</td>\n";
     }
     echo "<td colspan='4' style='border: none;'><input type='text' name='new_group' value='" . $name . "' size='28'></td>\n";
     echo "<input type='hidden' name='dept' value='" . $id . "'>\n";
     echo "<td colspan='4' style='border: none;'>" . createDDBox($order, $higherUp, $id) . "</td>";
     echo "<input type='hidden' name='new_priority' value='" . $priority . "'>\n";
     if ($length != 1 && $priority != $length) {
         echo "<td style='border: none; text-align: right;'><input type='image' src='arrow_down.GIF' name='priority_down' border='1'  width='20' height='20'></td>";
     } else {
         echo "<td style='border: none;'></td>";
     }
     if ($length != 1 && $priority != 1) {
         echo "<td style='border: none; text-align: center;'><input type='image' src='arrow_up.GIF' name='priority_up' border='1' width='20' height='20'></td>";
     } else {
         echo "<td style='border: none;'></td>";
     }
     if ($debug) {
         echo "<td style='border: none;'>" . $priority . "</td>";
     }
     echo "<td style='border: none;'><input type='submit' name='edit_group' value='EDIT' ></td>\n";
     echo "<td style='border: none;'><input type='submit' name='remove_group' value='DELETE' onClick='return delete_confirm()'></td></form></tr>\n";
 }