Пример #1
0
function EditBlock($block_id)
{
    global $db;
    if (isset($_POST['processed'])) {
        //Secure our data to prevent injection attacks.
        $weight = (int) addslashes($_POST['weight']);
        $dir_name = addslashes($_POST['dir_name']);
        $position = (int) addslashes($_POST['position']);
        $active = addslashes($_POST['active']);
        $title = addslashes($_POST['title']);
        if (!is_int($weight) || empty($dir_name) || empty($title) || !is_int($position)) {
            echo "You must fill everything out before proceeding.";
            return;
        }
        //Update the database with the new data.
        $db->Query("UPDATE bayonet_blocks SET title = '{$title}', weight = '{$weight}', dir_name = '{$dir_name}', position = '{$position}', active = '{$active}' WHERE block_id = '{$block_id}'");
        //$isActive = $active ? "IS" : "IS NOT";
        echo "Block, '{$dir_name}', at position '{$weight}'(order) has been edited.\n";
        PageRedirect(3, "?op=blocks");
        //die, because we have completed what we wanted to do.
        return;
    }
    //Grab the page from the database according to the $page_id passed to the function.
    $result = $db->Query("SELECT weight,dir_name,position,active,title FROM bayonet_blocks WHERE block_id = '{$block_id}'");
    $block = $db->FetchRow($result);
    ?>
  You are currently editing the '<?php 
    echo $block['title'];
    ?>
' block<br /><br />
  <form action="<?php 
    $_SERVER['PHP_SELF'];
    ?>
" method="post">
  <table align="center">
  <tr><th>Title</th><td><input type="text" name="title" value="<?php 
    echo $block['title'];
    ?>
" /></td></tr>
  <tr><th>Weight</th><td><input type="text" name="weight" value="<?php 
    echo $block['weight'];
    ?>
" /></td></tr>
  <tr><th>Position</th><td><?php 
    GetPosition($block['position']);
    ?>
</td></tr>
  <tr><th>Directory Name</th><td><input type="text" name="dir_name" value="<?php 
    echo $block['dir_name'];
    ?>
" /></td>
  <tr><th>Active</th><td>
    <select name="active">
      <?php 
    GetActive($block_id, $block['active']);
    ?>
  
    </select>
  </td>
  
  <tr><th colspan="2"><input type="submit" name="processed" value="Submit" /><?php 
    echo LinkInternal('<input type="button" value="Cancel" />', "?op=blocks");
    ?>
</th></tr>
  </table>
  </form>
  <?php 
}
Пример #2
0
function GetPage($res = '')
{
    $image = $res['image'];
    if (empty($image)) {
        $image = '0.jpg';
    }
    $data = '
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>

	    	<table class="dialog-form-table">
				<tr>
					<td style="width: 170px;"><label for="name">სახელი, გვარი</label></td>
					<td>
						<input type="text" id="name" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['name'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="tin">პირადი ნომერი</label></td>
					<td>
						<input type="text" id="tin" class="idle user_id" onblur="this.className=\'idle user_id\'" onfocus="this.className=\'activeField user_id\'" value="' . $res['tin'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="position">თანამდებობა</label></td>
					<td>
						<select id="position" class="idls">' . GetPosition($res['position']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="address">მისამართი</label></td>
					<td>
						<input type="text" id="address" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['address'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="home_number">სახლის ტელ: </label></td>
					<td>
						<input type="text" id="home_number" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['home_number'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="mobile_number">მობილური ტელ: </label></td>
					<td>
						<input type="text" id="mobile_number" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['mobile_number'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="comment">შენიშვნა: </label></td>
					<td valign="top">
						<textarea id="comment" class="idle large" cols="40" rows="4" style="width: 226px !important;">' . $res['comment'] . '</textarea>
					</td>
				</tr>
			</table>
			<!-- ID -->
			<div id="accordion">
			  <h3>მომხმარებელი</h3>
			  <div>
				<div>
					<div style="width: 170px; display: inline;"><label for="user">მომხმარებელი :</label>
						<input type="text" id="user" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['username'] . '" style="display: inline; margin-left: 42px;"/>
					</div>
				</div>
				<div style=" margin-top: 2px; ">
					<div style="width: 170px; display: inline;"><label for="user_password">პაროლი :</label>
						<input type="password" id="user_password" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['user_password'] . '" style="display: inline; margin-left: 84px;"/>
					</div>
				</div>
				<div style=" margin-top: 2px; ">
					<div style="width: 170px; display: inline; margin-top: 5px;"><label for="group_permission">ჯგუფი :</label>
						<select id="group_permission" class="idls" style="display: inline; margin-left: 101px;">' . GetGroupPermission($res['group_id']) . '</select>
					</div>
				</div>
				<div style=" margin-top: 2px; ">
					<button id="add_group" style="outline:none; float: right; margin-right: 20px;">ჯგუფის დამატება</button>
				</div>
			  </div>
			</div>
        </fieldset>
 	    <fieldset>
	    	<legend>ტანამშრომლის სურათი</legend>

	    	<table class="dialog-form-table" width="100%">
	    		<tr>
					<td id="img_colum" colspan="2">
						<img id="upload_img" src="media/uploads/images/worker/' . $image . '">
					</td>
				</tr>
				<tr><!-- Upload Image -->
					<td id="act">
						<span>
							<a href="#" id="view_image" class="complate">View</a> | <a href="#" id="delete_image" class="delete">Delete</a>
						</span>
					</td>
					<td>
						<div class="file-uploader">
							<input id="choose_file" type="file" name="choose_file" class="input" style="display: none;">
							<button id="choose_button" class="center">აირჩიეთ ფაილი</button>
						</div>
					</td>
				</tr>
			</table>
        </fieldset>
		<input type="hidden" id="pers_id" value="' . $res['id'] . '" />
		<input type="hidden" id="is_user" value="' . false . '" />
    </div>
    ';
    return $data;
}
Пример #3
0
function GetPage($res = '')
{
    $image = $res['image'];
    if (empty($image)) {
        $image = '0.jpg';
    } else {
        $disable_img = 'disabled';
    }
    $data = '
	<div id="dialog-form">
	    <fieldset>
	    	<legend>ძირითადი ინფორმაცია</legend>

	    	<table class="dialog-form-table">
				<tr>
					<td style="width: 170px;"><label for="name">სახელი, გვარი</label></td>
					<td>
						<input type="text" id="name" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['name'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="ext">ექსთენშენი</label></td>
					<td>
						<input type="text" id="ext" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['ext'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="tin">პირადი ნომერი</label></td>
					<td>
						<input type="text" id="tin" class="idle user_id" onblur="this.className=\'idle user_id\'" onfocus="this.className=\'activeField user_id\'" value="' . $res['tin'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="position">თანამდებობა</label></td>
					<td>
						<select id="position" class="idls">' . GetPosition($res['position']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="dep_id">დეპარტამენტი</label></td>
					<td>
						<select id="dep_id" class="idls">' . GetDepart($res['dep_id']) . '</select>
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="address">მისამართი</label></td>
					<td>
						<input type="text" id="address" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['address'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="home_number">სახლის ტელ: </label></td>
					<td>
						<input type="text" id="home_number" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['home_number'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="mobile_number">მობილური ტელ: </label></td>
					<td>
						<input type="text" id="mobile_number" class="idle address" onblur="this.className=\'idle address\'" onfocus="this.className=\'activeField address\'" value="' . $res['mobile_number'] . '" />
					</td>
				</tr>
				<tr>
					<td style="width: 170px;"><label for="comment">შენიშვნა: </label></td>
					<td valign="top">
						<textarea id="comment" class="idle"  style="width: 226px !important;resize: vertical;">' . $res['comment'] . '</textarea>
					</td>
				</tr>
			</table>
			<!-- ID -->
			<div id="accordion">
			  <h3>მომხმარებელი</h3>
			  <div>
				<div>
					<div style="width: 170px; display: inline;"><label for="user" style="float:left;">მომხმარებელი :</label>
						<input type="text" id="user" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['username'] . '" style="display: inline; margin-left: 51px;"/>
					</div>
				</div>
				<div style=" margin-top: 2px; ">
					<div style="width: 170px; display: inline;"><label for="user_password" style="float:left;">პაროლი :</label>
						<input type="password" id="user_password" class="idle" onblur="this.className=\'idle\'" onfocus="this.className=\'activeField\'" value="' . $res['user_password'] . '" style="display: inline; margin-left: 87px;"/>
					</div>
				</div>
				<div style=" margin-top: 2px; ">
					<div style="width: 170px; display: inline; margin-top: 5px;"><label for="group_permission" style="float:left;">ჯგუფი :</label>
						<select id="group_permission" class="idls" style="display: inline; margin-left: 101px;">' . GetGroupPermission($res['group_id']) . '</select>
					</div>
				</div>
			  </div>
			</div>
        </fieldset>
 	    <fieldset>
	    	<legend>თანამშრომლის სურათი</legend>

	    	<table class="dialog-form-table" width="100%">
	    		<tr>
					<td id="img_colum">
						<img style="margin-left: 5px;" width="105" height="105" id="upload_img" src="media/uploads/file/' . $image . '" />
					</td>
				</tr>
				<tr>
					<td style="padding-left: 30px;">
						<span>
							<a href="#" onclick="view_image(' . $res[image_id] . ')" class="complate">View</a> | <a href="#" id="delete_image" image_id="' . $res[image_id] . '" class="delete">Delete</a>
						</span>
					</td>
				</tr>
				</tr>
					<td style="padding-left: 5px;">
						<div style="margin-top:10px; width: 127px; margin-left: -5px;" class="file-uploader">
							<input id="choose_file" type="file" name="choose_file" class="input" style="display: none;">
							<button id="choose_button' . $disable_img . '" class="center" >აირჩიეთ ფაილი</button>
						</div>
					</td>
				</tr>
			</table>
        </fieldset>
		<input type="hidden" id="pers_id" value="' . $res['id'] . '" />
		<input type="hidden" id="is_user" value="';
    $incUs = mysql_fetch_array(mysql_query("SELECT id+1 AS `id` FROM users ORDER BY id DESC LIMIT 1"));
    $data .= $incUs[0];
    $data .= '" />
    </div>
    ';
    return $data;
}