浏览代码

Mobile Twinning - Fix errors and add card and counter divs (#189)

* Fix errors and add card and counter divs

* Update mobile_twinning_edit.php
Alex 5 月之前
父节点
当前提交
ac5eef633b
共有 2 个文件被更改,包括 52 次插入53 次删除
  1. 26 32
      mobile-twinning/mobile_twinning.php
  2. 26 21
      mobile-twinning/mobile_twinning_edit.php

+ 26 - 32
mobile-twinning/mobile_twinning.php

@@ -26,12 +26,13 @@
 */
 
 //includes
-	include "root.php";
-	require_once "resources/require.php";
+	require_once dirname(__DIR__, 2) . "/resources/require.php";
+	require_once "resources/pdo.php";
 	require_once "resources/check_auth.php";
 	require_once "resources/paging.php";
+	require_once "resources/header.php";
 
-//check permissions	
+//check permissions
 	if (permission_exists('mobile_twinning_view')) {
 		//access granted
 	}
@@ -43,7 +44,7 @@
 //add multi-lingual support
 	$language = new text;
 	$text = $language->get();
-	
+
 //get the https values and set as variables
 	$order_by = check_str($_GET["order_by"]);
 	$order = check_str($_GET["order"]);
@@ -89,7 +90,7 @@
 	$sql .= "FROM  v_extensions AS e \n ";
 	$sql .= "LEFT OUTER JOIN v_mobile_twinnings AS m ON m.extension_uuid = e.extension_uuid ";
 	$sql .= "where e.domain_uuid = '$domain_uuid' ";
-	$sql .= $sql_mod; //add search mod from above	
+	$sql .= $sql_mod; //add search mod from above
 	$sql .= "and e.enabled = 'true' ";
 	if (strlen($order_by)> 0) {
 		$sql .= "order by $order_by $order ";
@@ -110,35 +111,27 @@
 	$row_style["1"] = "row_style1";
 
 //begin the content
-	require_once "resources/header.php";
-	echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">\n";
-	echo "  <tr>\n";
-	echo "	<td align='left' width='100%'>\n";
-	echo "		<b>".$text['header-mobile_twinning']." (".$numeric_extensions.")</b><br>\n";
-	echo "	</td>\n";
-	echo "		<td align='right' width='100%' style='vertical-align: top;'>";
+	echo "<div class='action_bar' id='action_bar'>\n";
+	echo "	<div class='heading'><b>".$text['header-mobile_twinning']."</b><div class='count'>".number_format($numeric_extensions)."</div></div>\n";
+	echo "	<div class='actions'>\n";
 	if ((if_group("admin") || if_group("superadmin"))) {
-		echo "		<form method='get' action=''>\n";
-		echo "			<td style='vertical-align: top; text-align: right; white-space: nowrap;'>\n";
-		echo "				<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
-		echo "				<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
+		echo "	<form method='get' action=''>\n";
+		echo "		<input type='text' class='txt' style='width: 150px' name='search' id='search' value='".$search."'>";
+		echo "		<input type='submit' class='btn' name='submit' value='".$text['button-search']."'>";
 		if ($paging_controls_mini != '') {
-			echo 			"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
+			echo 	"<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
 		}
-		echo "			</td>\n";
-		echo "			</td>\n";
-		echo "		</form>\n";	
+		echo "	</form>\n";
 	}
-	echo "  </tr>\n";
-
-	echo "	<tr>\n";
-	echo "		<td colspan='2'>\n";
-	echo "			".$text['description-mobile_twinning']."\n";
-	echo "		</td>\n";
-	echo "	</tr>\n";
-	echo "</table>\n";
-	echo "<br>";
-	
+
+	echo "	</div>\n";
+	echo "	<div style='clear: both;'></div>\n";
+	echo "</div>\n";
+
+	echo $text['description-mobile_twinning']."\n";
+	echo "<br /><br />";
+
+	echo "<div class='card'>\n";
 	echo "<table class='tr_hover' width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 	echo "<tr>\n";
 	echo th_order_by('extension', $text['table-extension'], $order_by,$order);
@@ -155,7 +148,7 @@
 			echo "	<td valign='top' class='row_stylebg' width='40%'>".$row['description']."&nbsp;</td>\n";
 			echo "	<td class='list_control_icons'>";
 			echo "     <a href='mobile_twinning_edit.php?id=".$row['mobile_twinning_uuid']."&extid=".$row['extension_uuid']."'>$v_link_label_edit</a>";
-			echo "  </td>\n";			
+			echo "  </td>\n";
 			echo "</tr>\n";
 			if ($c==0) { $c=1; } else { $c=0; }
 		} //end foreach
@@ -163,12 +156,13 @@
 	} //end if results
 
 	echo "</table>";
+	echo "</div>\n";
 	if (strlen($paging_controls) > 0) {
 		echo "<br />";
 		echo $paging_controls."\n";
 	}
 	echo "<br><br>";
-	
+
 //show the footer
 	require_once "resources/footer.php";
 ?>

+ 26 - 21
mobile-twinning/mobile_twinning_edit.php

@@ -26,12 +26,12 @@
 */
 
 //includes
-	include "root.php";
-	require_once "resources/require.php";
+	require_once dirname(__DIR__, 2) . "/resources/require.php";
+	require_once "resources/pdo.php";
 	require_once "resources/check_auth.php";
 	require_once "resources/paging.php";
 
-//check permissions	
+//check permissions
 	if (permission_exists('mobile_twinning_view')) {
 		//access granted
 	}
@@ -43,7 +43,7 @@
 //add multi-lingual support
 	$language = new text;
 	$text = $language->get();
-	
+
 //get the https values and set as variables
 	$extension_uuid = check_str($_GET["extid"]);
 	$mobile_twinning_uuid = check_str($_GET["id"]);
@@ -56,7 +56,7 @@
 	else {
 		$action = "add";
 	}
-	
+
 //get the http values and set them as php variables
 	if (count($_POST) > 0 && $_POST["persistform"] != "1") {
 		$mobile_twinning_number = check_str($_POST["mobile_twinning_number"]);
@@ -79,13 +79,13 @@
 			$where[0]["value"] = "$mobile_twinning_number";
 			$where[1]["name"] = "mobile_twinning_uuid";
 			$where[1]["operator"] = "!=";
-			$where[1]["value"] = "$mobile_twinning_uuid";			
+			$where[1]["value"] = "$mobile_twinning_uuid";
 			$database->where = $where;
 			$result = $database->count();
 			if ($result > 0) {
 					$msg .= $text['message-warning'].$text['message-duplicate_mobile_twinning_number']."<br>\n";
 				}
-			unset($result,$database);	
+			unset($result,$database);
 
 		//check for a valid 10 digit mobile number
 			if (strlen($mobile_twinning_number) != 10)  {
@@ -93,8 +93,8 @@
 					$msg .= $text['message-warning'].$text['message-invalid_mobile_twinning_number']."<br>\n";
 				}
 			}
-			
-		//display error msg if error found			
+
+		//display error msg if error found
 			if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
 				require_once "resources/header.php";
 				require_once "resources/persist_form_var.php";
@@ -114,7 +114,7 @@
 			$array["mobile_twinnings"][$i]["mobile_twinning_uuid"] = $mobile_twinning_uuid;
 			$array["mobile_twinnings"][$i]["extension_uuid"] = $extension_uuid;
 			$array["mobile_twinnings"][$i]["mobile_twinning_number"] = $mobile_twinning_number;
-			
+
 		//save to the datbase
 			$database = new database;
 			$database->app_name = 'mobile_twinnings';
@@ -124,7 +124,7 @@
 			//echo "<pre>".print_r($message, true)."<pre>\n";
 			//exit;
 	}
-	
+
 //pre-populate the form
 	if (is_array($_GET) && $_POST["persistformvar"] != "true") {
 		$sql = "SELECT e.extension, m.mobile_twinning_number, e.description, m.mobile_twinning_uuid, e.extension_uuid \n";
@@ -139,23 +139,22 @@
 		$prep_statement->execute();
 		$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
 		unset ($prep_statement, $sql);
-	
+
 	//set the variables
 
-	
 		foreach ($result as $row) {
-			$mobile_twinning_number = $row[mobile_twinning_number];
-			$mobile_twinning_uuid = $row[mobile_twinning_uuid];
-			$extension = $row[extension];
-			$description = $row[description];
-			$extension_uuid = $row[extension_uuid];
+			$mobile_twinning_number = $row['mobile_twinning_number'];
+			$mobile_twinning_uuid = $row['mobile_twinning_uuid'];
+			$extension = $row['extension'];
+			$description = $row['description'];
+			$extension_uuid = $row['extension_uuid'];
 		}
 
 		if (strlen($mobile_twinning_uuid) == 0) {
 			$mobile_twinning_uuid = uuid();
-		}			
+		}
 	}
-	
+
 //show the header
 	require_once "resources/header.php";
 
@@ -172,6 +171,10 @@
 	echo "	<input type='submit' class='btn' value='".$text['button-save']."'>";
 	echo "</td>\n";
 	echo "</tr>\n";
+	echo "</table>\n";
+
+	echo "<div class='card'>\n";
+	echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
 
 	//Extension
 	echo "<tr>\n";
@@ -193,7 +196,9 @@
 	echo $text['description-mobile_twinning_number']."\n";
 	echo "</td>\n";
 	echo "</tr>\n";
-	echo "</table>";	
+
+	echo "</table>";
+	echo "</div>";
 	echo "</form>";
 	echo "<br /><br />";