diff options
| author | Joseph Hunkeler <jhunkeler@gmail.com> | 2013-08-19 09:41:19 -0400 | 
|---|---|---|
| committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2013-08-19 09:41:19 -0400 | 
| commit | c5eb569f5122d4140952bd5cc7ad4fdc5fbf8a23 (patch) | |
| tree | 37024ec14fde9fef92eef8e9f997f72731e5155d /admin/rudi/views | |
| parent | 41d7bde950d6166a6cc414a48d0fa57f3fd9a512 (diff) | |
| parent | 50f14f6bee7e1efaac5971579fc2e76c728ecad6 (diff) | |
| download | bayonetcms-master.tar.gz | |
Some more stuff
Diffstat (limited to 'admin/rudi/views')
| -rw-r--r-- | admin/rudi/views/view.awards.add.php | 5 | ||||
| -rw-r--r-- | admin/rudi/views/view.awards.php | 2 | ||||
| -rw-r--r-- | admin/rudi/views/view.members.delete.php | 31 | ||||
| -rw-r--r-- | admin/rudi/views/view.members.new.php | 381 | ||||
| -rw-r--r-- | admin/rudi/views/view.members.php | 24 | ||||
| -rw-r--r-- | admin/rudi/views/view.members.profile.php | 11 | 
6 files changed, 266 insertions, 188 deletions
| diff --git a/admin/rudi/views/view.awards.add.php b/admin/rudi/views/view.awards.add.php index 9c97c54..71f6a91 100644 --- a/admin/rudi/views/view.awards.add.php +++ b/admin/rudi/views/view.awards.add.php @@ -6,12 +6,13 @@  		global $db;  		$name = $form->request['name'];  		$text = $form->request['text']; +		decho("INSERT INTO `rudi_awards` SET `class_id` = '$class_id', `name` = '$name', `description` = '$text'");  		$db->Query("INSERT INTO `rudi_awards` SET `class_id` = '$class_id', `name` = '$name', `image` = '', `description` = '$text'"); -		PageRedirect(1, "?op=rudi&show=awards&cid={$class_id}"); +		PageRedirect(1, "?op=rudi&show=awards&cid=".$class_id);  		return;		  	} -	echo LinkInternal("Cancel","?op=rudi&show=awards&cid={$class_id}"); +	echo LinkInternal("Cancel","?op=rudi&show=awards&cid=".$class_id);  	OpenTable();  ?> diff --git a/admin/rudi/views/view.awards.php b/admin/rudi/views/view.awards.php index 3a5729f..4902577 100644 --- a/admin/rudi/views/view.awards.php +++ b/admin/rudi/views/view.awards.php @@ -23,7 +23,7 @@  				$class_id = $_GET['cid'];  				$awards = getAwardsByClass($class_id);  				echo "<h3>Awards</h3>"; -				echo LinkInternal('<img src="images/add.png" /> Add New Award','?op=rudi&show=awards&cid={$class_id}&add=true'); +				echo LinkInternal('<img src="images/add.png" /> Add New Award','?op=rudi&show=awards&cid='.$class_id.'&add=true');  				OpenTable();  				foreach($awards as $award){  					echo "<tr><td>".$award['name']."</td> diff --git a/admin/rudi/views/view.members.delete.php b/admin/rudi/views/view.members.delete.php new file mode 100644 index 0000000..e0adf5e --- /dev/null +++ b/admin/rudi/views/view.members.delete.php @@ -0,0 +1,31 @@ +<?php +  global $db; +   +  $result = $db->Query("SELECT CONCAT(last_name,', ',first_name) AS name FROM `rudi_unit_members` WHERE `member_id` = '$member_id' LIMIT 1"); +  $member = $db->FetchRow($result); +  $form = new BayonetForm("", "POST"); +   +  if(isset($_POST['proceed'])) +  { +    //echo "Soldier '{$member['name']}', was deleted."; +    ReportError("This is not completed yet."); +    // DELETE unit_members, service_record, award_record FOR member_id +    //DeleteMember($member_id); +    PageRedirect(2, "?op=rudi&show=members"); +    return; +  } +  if(isset($_POST['cancel'])) +  { +    echo "User cancelled deletion of soldier: '{$member['name']}'"; +    PageRedirect(2, "?op=rudi&show=members&profile={$member_id}"); +    return; +  } +   +  OpenTable(); +?> +  <th>Are you <u>SURE</u> you want to delete soldier: '<?php echo $member['name'];?>'?<br />All records for this soldier will be permenantly removed.</th> +  <tr><th><button name="proceed">Yes</button>   <button name="cancel">No</button></th></tr> +<?php +	CloseTable(); +	$form->__destruct(); +?>
\ No newline at end of file diff --git a/admin/rudi/views/view.members.new.php b/admin/rudi/views/view.members.new.php index cbc086f..ab309ea 100644 --- a/admin/rudi/views/view.members.new.php +++ b/admin/rudi/views/view.members.new.php @@ -1,179 +1,204 @@ -<?php
 -		 global $db;
 -		 
 -		 if(isset($_POST['processed'])){
 -		 	
 -	 		echo "Please wait while the information is processed...";
 -		 	
 -		 	$rank_id = $_POST['rank'];
 -		 	$country_id = $_POST['country'];
 -		 	$status_id = $_POST['status'];
 -		 	$role_id = $_POST['role'];
 -		 	$unit_id = $_POST['unit'];
 -			$weapon_id = $_POST['weapon'];
 -		 	$first_name = addslashes($_POST['first']);
 -		 	$last_name = addslashes($_POST['last']);
 -		 	$username = addslashes($_POST['username']);
 -		 	$city = addslashes($_POST['city']);
 -		 	$province = addslashes($_POST['province']);
 -		 	$primary_mos = addslashes($_POST['primmos']);		 	
 -		 	$enlisted = addslashes($_POST['enlist']);
 -		 	$promoted = addslashes($_POST['promote']);
 -		 	$discharged = addslashes($_POST['discharge']);
 -		 	$xfire = addslashes($_POST['xfire']);
 -		 	$email = addslashes($_POST['email']);
 -		 	$bio = addslashes($_POST['bio']);
 -		 	
 -		 	//$discharged = empty($discharged) ? NULL : "'{$discharged}'";
 -
 - 			$query = "INSERT INTO `rudi_unit_members` SET"
 -			 		." `rank_id` = '$rank_id',"
 -			 		." `country_id` = '$country_id',"
 -					." `status_id` = '$status_id',"
 -					." `cunit_id` = '$unit_id',"
 -					." `weapon_id` = '$weapon_id',"
 -					." `username` = '$username',"
 -					." `email` = '$email',"
 -					." `xfire` = '$xfire',"
 -					." `first_name` = '$first_name',"
 -					." `last_name` = '$last_name',"
 -					." `location_city` = '$city',"
 -					." `location_province` = '$province',"
 -					." `bio` = '$bio',"
 -					." `date_enlisted` = '$enlisted',"
 -					." `date_promotion` = '$promoted',"
 -					." `primary_mos` = '$primary_mos',";
 -			if(empty($discharged))
 -				$query = $query." `date_discharged` = null";
 -			else
 -				$query = $query." `date_discharged` = '$discharged'";	
 -			decho($query);
 -		 	$db->Query($query);
 -		 	
 -		 	$member_id = $db->InsertID();
 -		 	decho($member_id);
 -		 	$db->Query("INSERT INTO `rudi_roles_container` SET `role_id` = '$role_id', `member_id` = '$member_id'");
 -		 	
 -		 	PageRedirect(1, "?op=rudi&show=members");
 -		 	return;		 
 -		 } 	
 -?>
 -		<a href="?op=rudi&show=members">Cancel</a><br />
 -		<form method="POST" action="">
 -		<table width="100%" style="text-align:center;">
 -		<tr><th colspan="2" style="background-color:#c4c4c4;">Personnel File of <?php echo $member['first_name']." ".$member['last_name']; ?></th></tr>
 -		<tr><td class="right" width="50%">Rank:</td><td class="left">
 -			<select name="rank">
 -<?php		$ranks = GetRanks();
 -			foreach($ranks as $rank){
 -				echo "<option value=\"{$rank['rank_id']}\">{$rank['longname']}</option>";			
 -			}
 -?>
 -			</select>
 -		</td></tr>
 -		<tr><td class="right">Country:</td><td class="left">
 -			<select name="country">
 -<?php		$countries = GetCountry();
 -			foreach($countries as $country){
 -				echo "<option value=\"{$country['country_id']}\">{$country['name']}</option>";			
 -			}
 -?>
 -			</select>
 -		</td></tr>
 -		</table>
 -		<table width="100%" style="text-align:center;">
 -		<tr><th colspan="2" style="background-color:#c4c4c4;">Vital Statistics</th></tr>
 -		<tr>
 -			<td class="right" width="50%">First:</td>
 -			<td class="left"><input type="text" name="first" value="" /></td>
 -		</tr>
 -		<tr>
 -			<td class="right">Last:</td>
 -			<td class="left"><input type="text" name="last" value="" /></td>
 -		</tr>
 -		<tr><td class="right">Username:</td><td class="left"><input type="text" name="username" value="" /></td></tr>
 -		<tr><td class="right">City:</td><td class="left"><input type="text" name="city" value=""/></td></tr>
 -		<tr><td class="right">Province:</td><td class="left"><input type="text" name="province" value="" /></td></tr>
 -		<tr><td class="right">Status:</td><td class="left">
 -			<select name="status">
 -<?php		$statuses = GetStatuses();
 -			foreach($statuses as $status){
 -				echo "<option value=\"{$status['status_id']}\">{$status['name']}</option>";			
 -			}
 -?>
 -		</select>
 -		</td></tr>
 -		<tr><td class="right">Primary MOS:</td><td class="left"><input type="text" name="primmos" value="" /></td></tr>
 -		<tr>
 -			<td class="right">Role:</td>
 -			<td class="left">
 -			<select name="role">
 -<?php
 -			$roles = GetRoles();	
 -			foreach($roles as $role){
 -				echo "<option value=\"{$role['role_id']}\">{$role['name']}</option>";			
 -			}
 -?>
 -				</select>
 -			</td>
 -		</tr>
 -		<tr>
 -			<td class="right" style="font-weight:bold;">Unit:</td>
 -			<td class="left">
 -			<select name="unit">
 -		    	<option value="0">N/A</option>
 -<?php
 -					$result = $db->Query("SELECT `unit_id`, `name` FROM `rudi_combat_units` WHERE `detachment` = 0 ");
 -	    			$row = $db->Fetch($result);
 -	    			foreach($row as $unit){
 -	    				$unit_name = $unit['name'];
 -	    				$unit_id = $unit['unit_id'];
 -						if($member['cunit_id']==$unit_id)
 -	    					echo '<option value="'.$unit_id.'" selected>'.$unit_name.'</option>';
 -	       				else
 - 							echo '<option value="'.$unit_id.'">'.$unit_name.'</option>';
 -						selectUnits($unit_id, 0, $member['cunit_id']);
 -					}
 -?>
 -		    	</select>
 -			</td>
 -		</tr>
 -		<tr><td class="right">Weapons:</td><td class="left">
 -			<select name="weapon">
 -<?php		$weapons = GetWeapons();
 -			foreach($weapons as $weapon){
 -				echo "<option value=\"{$weapon['weapon_id']}\">{$weapon['model']}</option>";			
 -			}
 -?>
 -		</select>
 -		</td></tr>
 -		<tr>
 -			<td class="right">Enlisted Date:</td>
 -			<td class="left"><input type="text" name="enlist" value="" /></td>
 -		</tr>
 -		<tr>
 -			<td class="right">Promotion Date:</td>
 -			<td class="left">
 -				<input type="text" name="promote" value="" />
 -			</td>
 -		</tr>
 -		<tr>
 -			<td class="right">Discharge Date:</td>
 -			<td class="left"><input type="text" name="discharge" value="" /></td>
 -		</tr>
 -		<tr>	
 -			<td class="right">Xfire:</td>
 -			<td class="left"><input type="text" name="xfire" value=""/></td>
 -		</tr>
 -		<tr>
 -			<td class="right">E-Mail:</td>
 -			<td class="left"><input type="text" name="email" value=""/></td>
 -		</tr>
 -		</table>
 -		<br />
 -		<table width="100%" style="text-align:center;">
 -		<tr><th colspan="2" style="background-color:#c4c4c4;">Personal Bio</th></tr>
 -		<tr><td><textarea rows="7" name="bio" cols="60"></textarea></td></tr>
 -		<tr><td colspan="2"><input type="submit" value="Submit" name="processed" /></td>
 -		</table>
 +<?php +		 global $db; +		  +		 if(isset($_POST['processed'])){ +		 	 +	 		echo "Please wait while the information is processed..."; +		 	 +		 	$rank_id = $_POST['rank']; +		 	$country_id = $_POST['country']; +		 	$status_id = $_POST['status']; +		 	$role_id = $_POST['role']; +		 	$unit_id = $_POST['unit']; +			$a2_id = $_POST['a2_id']; +		 	$oa_id = $_POST['oa_id']; +			$weapon_id = $_POST['weapon']; +			$weapon2_id = $_POST['weapon2']; +		 	$first_name = addslashes($_POST['first']); +		 	$last_name = addslashes($_POST['last']); +		 	$username = addslashes($_POST['username']); +		 	$city = addslashes($_POST['city']); +		 	$province = addslashes($_POST['province']); +		 	$primary_mos = addslashes($_POST['primmos']);		 	 +		 	$enlisted = addslashes($_POST['enlist']); +		 	$promoted = addslashes($_POST['promote']); +		 	$discharged = addslashes($_POST['discharge']); +		 	$xfire = addslashes($_POST['xfire']); +		 	$email = addslashes($_POST['email']); +		 	$bio = addslashes($_POST['bio']); +		 	 +		 	//$discharged = empty($discharged) ? NULL : "'{$discharged}'"; + + 			$query = "INSERT INTO `rudi_unit_members` SET" +			 		." `rank_id` = '$rank_id'," +			 		." `country_id` = '$country_id'," +			 		." `role_id` = '$role_id', " +					." `status_id` = '$status_id'," +					." `cunit_id` = '$unit_id'," +					." `weapon_id` = '$weapon_id'," +					." `weapon2_id` = '$weapon2_id'," +					." `a2_id` = '$a2_id'," +					." `oa_id` = '$oa_id'," +					." `username` = '$username'," +					." `email` = '$email'," +					." `xfire` = '$xfire'," +					." `first_name` = '$first_name'," +					." `last_name` = '$last_name'," +					." `location_city` = '$city'," +					." `location_province` = '$province'," +					." `bio` = '$bio'," +					." `date_enlisted` = '$enlisted'," +					." `date_promotion` = '$promoted'," +					." `primary_mos` = '$primary_mos',"; +			if(empty($discharged)) +				$query = $query." `date_discharged` = null"; +			else +				$query = $query." `date_discharged` = '$discharged'";	 +			decho($query); +		 	$db->Query($query); +		 	 +		 	$member_id = $db->InsertID(); +		 	decho($member_id); +		 	//$db->Query("INSERT INTO `rudi_roles_container` SET `role_id` = '$role_id', `member_id` = '$member_id'"); +		 	 +		 	PageRedirect(1, "?op=rudi&show=members&profile=$member_id"); +		 	return;		  +		 } 	 +?> +		<a href="?op=rudi&show=members">Cancel</a><br /> +		<form method="POST" action=""> +		<table width="100%" style="text-align:center;"> +		<tr><th colspan="2" style="background-color:#c4c4c4;">Personnel File of <?php echo $member['first_name']." ".$member['last_name']; ?></th></tr> +		<tr><td class="right" width="50%">Rank:</td><td class="left"> +			<select name="rank"> +<?php		$ranks = GetRanks(); +			foreach($ranks as $rank){ +				echo "<option value=\"{$rank['rank_id']}\">{$rank['longname']}</option>";			 +			} +?> +			</select> +		</td></tr> +		<tr><td class="right">Country:</td><td class="left"> +			<select name="country"> +<?php		$countries = GetCountry(); +			foreach($countries as $country){ +				echo "<option value=\"{$country['country_id']}\">{$country['name']}</option>";			 +			} +?> +			</select> +		</td></tr> +		<tr><td class="right" width="50%">ArmA2 ID</td><td class="left"><input type="text" name="a2_id" value="<?php echo $member['a2_id']; ?>"/></td></tr> +		<tr><td class="right" width="50%">ArmA2:OA ID</td><td class="left"><input type="text" name="oa_id" value="<?php echo $member['oa_id']; ?>"/></td></tr> +		</table> +		<table width="100%" style="text-align:center;"> +		<tr><th colspan="2" style="background-color:#c4c4c4;">Vital Statistics</th></tr> +		<tr> +			<td class="right" width="50%">First:</td> +			<td class="left"><input type="text" name="first" value="" /></td> +		</tr> +		<tr> +			<td class="right">Last:</td> +			<td class="left"><input type="text" name="last" value="" /></td> +		</tr> +		<tr><td class="right">Username:</td><td class="left"><input type="text" name="username" value="" /></td></tr> +		<tr><td class="right">City:</td><td class="left"><input type="text" name="city" value=""/></td></tr> +		<tr><td class="right">Province:</td><td class="left"><input type="text" name="province" value="" /></td></tr> +		<tr><td class="right">Status:</td><td class="left"> +			<select name="status"> +<?php		$statuses = GetStatuses(); +			foreach($statuses as $status){ +				echo "<option value=\"{$status['status_id']}\">{$status['name']}</option>";			 +			} +?> +		</select> +		</td></tr> +		<tr><td class="right">Primary MOS:</td><td class="left"><input type="text" name="primmos" value="" /></td></tr> +		<tr> +			<td class="right">Role:</td> +			<td class="left"> +			<select name="role"> +				<option value="0">---SELECT-POSITION---</option> +<?php +			$groups = GetRoles(); +			decho($groups);	 +			foreach($groups as $group){	 +				echo "<optgroup label=\"{$group['name']}\">"; +				foreach($group['roles'] as $role){ +					echo "<option value=\"{$role['role_id']}\">{$role['name']}</option>";			 +				} +				echo "</optgroup>"; +			} +?> +				</select> +			</td> +		</tr> +		<tr> +			<td class="right" style="font-weight:bold;">Unit:</td> +			<td class="left"> +			<select name="unit"> +		    	<option value="0">N/A</option> +<?php +					$result = $db->Query("SELECT `unit_id`, `name` FROM `rudi_combat_units` WHERE `detachment` = 0 "); +	    			$row = $db->Fetch($result); +	    			foreach($row as $unit){ +	    				$unit_name = $unit['name']; +	    				$unit_id = $unit['unit_id']; +						if($member['cunit_id']==$unit_id) +	    					echo '<option value="'.$unit_id.'" selected>'.$unit_name.'</option>'; +	       				else + 							echo '<option value="'.$unit_id.'">'.$unit_name.'</option>'; +						selectUnits($unit_id, 0, $member['cunit_id']); +					} +?> +		    	</select> +			</td> +		</tr> +		<tr><td class="right">Primary Weapon:</td><td class="left"> +			<select name="weapon"> +<?php		$weapons = GetWeapons(); +			foreach($weapons as $weapon){ +				echo "<option value=\"{$weapon['weapon_id']}\">{$weapon['model']}</option>";			 +			} +?> +		</select> +		</td></tr> +		<tr><td class="right">Secondary Weapon:</td><td class="left"> +			<select name="weapon2"> +				<option value="0">None</option> +<?php +			foreach($weapons as $weapon){ +				echo "<option value=\"{$weapon['weapon_id']}\">{$weapon['model']}</option>";			 +			} +?> +		</select> +		</td></tr> +		<tr> +			<td class="right">Enlisted Date:</td> +			<td class="left"><input type="text" name="enlist" value="" /></td> +		</tr> +		<tr> +			<td class="right">Promotion Date:</td> +			<td class="left"> +				<input type="text" name="promote" value="" /> +			</td> +		</tr> +		<tr> +			<td class="right">Discharge Date:</td> +			<td class="left"><input type="text" name="discharge" value="" /></td> +		</tr> +		<tr>	 +			<td class="right">Xfire:</td> +			<td class="left"><input type="text" name="xfire" value=""/></td> +		</tr> +		<tr> +			<td class="right">E-Mail:</td> +			<td class="left"><input type="text" name="email" value=""/></td> +		</tr> +		</table> +		<br /> +		<table width="100%" style="text-align:center;"> +		<tr><th colspan="2" style="background-color:#c4c4c4;">Personal Bio</th></tr> +		<tr><td><textarea rows="7" name="bio" cols="60"></textarea></td></tr> +		<tr><td colspan="2"><input type="submit" value="Submit" name="processed" /></td> +		</table>  		</form>
\ No newline at end of file diff --git a/admin/rudi/views/view.members.php b/admin/rudi/views/view.members.php index 9013b8e..7aabb89 100644 --- a/admin/rudi/views/view.members.php +++ b/admin/rudi/views/view.members.php @@ -1,17 +1,31 @@  <?php  		include $basedir.'rudi/includes/functions.members.php'; -		if(isset($_GET['profile'])){ +		if(isset($_GET['profile'])) +		{  			$member_id = $_GET['profile'];  			include 'view.members.profile.php';	 -		}else if(isset($_GET['service'])){ +		} +		else if(isset($_GET['delete'])) +		{ +			$member_id = $_GET['delete']; +			include 'view.members.delete.php'; +		} +		else if(isset($_GET['service'])) +		{  			$member_id = $_GET['service'];  			include 'view.members.service.php'; -		}else if(isset($_GET['award'])){ +		} +		else if(isset($_GET['award'])) +		{  			$member_id = $_GET['award'];  			include 'view.members.award.php'; -		}else if(isset($_GET['create']) && $_GET['create'] == "soldier"){ +		} +		else if(isset($_GET['create']) && $_GET['create'] == "soldier") +		{  			include 'view.members.new.php'; -		}else{ +		} +		else +		{  			 global $db; diff --git a/admin/rudi/views/view.members.profile.php b/admin/rudi/views/view.members.profile.php index 6355d2e..31bbb2d 100644 --- a/admin/rudi/views/view.members.profile.php +++ b/admin/rudi/views/view.members.profile.php @@ -219,7 +219,14 @@  		<br />  		<table width="100%" style="text-align:center;">  		<tr><th colspan="2" style="background-color:#c4c4c4;">Personal Bio</th></tr> -		<tr><td><textarea rows="7" name="bio" cols="60"><?php echo $member['bio'];?></textarea></td></tr> -		<tr><td colspan="2"><input type="submit" value="Submit" name="processed" /></td> +		<tr><td colspan="2"><textarea rows="7" name="bio" cols="60"><?php echo $member['bio'];?></textarea></td></tr> +		<tr> +			<td class="right" width="55%"><input type="submit" value="Submit" name="processed" /></td> +			<td class="right"> +				<a href="?op=rudi&show=members&delete=<?php echo $member_id; ?>"> +					<input type="button" value="Delete Soldier" /> +				</a> +			</td> +		</tr>  		</table>  		</form>
\ No newline at end of file | 
