⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tech.php

📁 jsp程序开发系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:

	$table[] = table_midheader('General Permissions');

	$bit = form_radio_yn('p_add_announcements', '', $tech[p_add_announcements]);
	$table[] = array('<b>PERMISSION: can add announcements</b><br />Can your technician add announcements?', $bit);

	$bit = form_radio_yn('p_delete_announcements', '', $tech[p_delete_announcements]);
	$table[] = array('<b>PERMISSION: can edit announcements</b><br />Can your technician edit announcements?', $bit);

	$bit = form_radio_yn('p_edit_announcements', '', $tech[p_edit_announcements]);
	$table[] = array('<b>PERMISSION: delete announcements</b><br />Can your technician delete announcements?', $bit);

	$bit = form_radio_yn('p_quickedit', '', $tech[p_quickedit]);
	$table[] = array('<b>PERMISSION: edit quick responses</b><br />Can your technician add, edit, delete, and categorize quick responses?', $bit);

	$bit = form_radio_yn('p_html_tech', '', $tech[p_html_tech]);
	$table[] = array('<b>PERMISSION: can use unquoted HTML for techs</b><br />Is unquoted HTML submitted by this technician for objects viewed by other technicians allowed?', $bit);

	$bit = form_radio_yn('p_html_user', '', $tech[p_html_user]);
	$table[] = array('<b>PERMISSION: can use unquoted HTML for users</b><br />Is unquoted HTML submitted by this technician for objects viewed by users allowed?', $bit);

	$table[] = table_midheader('User Permissions');

	$bit = form_radio_yn('p_create_users', '', $tech[p_create_users]);
	$table[] = array('<b>PERMISSION: create Users</b><br />Can your technician create users?', $bit);

	$bit = form_radio_yn('p_edit_users', '', $tech[p_edit_users]);
	$table[] = array('<b>PERMISSION: edit user details</b><br />Can your technician edit the user fields set as editable in the user field settings?', $bit);

	$bit = form_radio_yn('p_delete_users', '', $tech[p_delete_users]);
	$table[] = array('<b>PERMISSION: delete users</b><br />Can your technician delete users?', $bit);

	$bit = form_radio_yn('p_approve_new_registrations', '', $tech[p_approve_new_registrations]);
	$table[] = array('<b>PERMISSION: approve new registrations</b><br />Can your technician approve new pending user registrations?', $bit);

	$bit = form_radio_yn('p_user_expire', '', $tech[p_user_expire]);
	$table[] = array('<b>PERMISSION: edit user expiration</b><br />Can your technician set and update user expirations?', $bit);

	$bit = form_radio_yn('p_global_note', '', $tech[p_global_note]);
	$table[] = array('<b>PERMISSION: edit global user notes</b><br />Can your technician create, edit, and delete global user notes that all technicians can see?', $bit);

	$table[] = table_midheader('Ticket Permissions');

	$bit = form_radio_yn('p_delete_own', '', $tech[p_delete_own]);
	$table[] = array('<b>PERMISSION: delete own tickets</b><br />Can your technician delete their own tickets?', $bit);

	$bit = form_radio_yn('p_delete_other', '', $tech[p_delete_other]);
	$table[] = array('<b>PERMISSION: delete techs tickets</b><br />Can your technician delete other techs tickets?', $bit);

	$bit = form_radio_yn('p_close_ticket', '', $tech[p_close_ticket]);
	$table[] = array('<b>PERMISSION: close and re-open tickets</b><br />Can your technician close and re-open tickets?', $bit);

	$bit = form_radio_yn('p_tech_view', '', $tech[p_tech_view]);
	$table[] = array('<b>PERMISSION: view techs tickets</b><br />Can your technician view other techs tickets?', $bit);

	$bit = form_radio_yn('p_tech_edit', '', $tech[p_tech_edit]);
	$table[] = array('<b>PERMISSION: edit techs tickets</b><br />Can your technician edit other techs tickets?', $bit);

	$table[] = table_midheader('FAQ Permissions');
	
	$bit = form_radio_yn('p_add_k', '', $tech[p_add_k]);
	$table[] = array('<b>PERMISSION: add to knowledgebase</b><br />Can your technician add entries to the knowledgebase?', $bit);

	$bit = form_radio_yn('p_edit_k', '', $tech[p_edit_k]);
	$table[] = array('<b>PERMISSION: edit knowledge base entry</b><br />Can your technician edit entries in the knowledgebase?', $bit);

	$bit = form_radio_yn('p_delete_k', '', $tech[p_delete_k]);
	$table[] = array('<b>PERMISSION: delete knowledgebase entry</b><br />Can your technician delete entries in the knowledgebase?', $bit);

	$bit = form_radio_yn('p_add_c_k', '', $tech[p_add_c_k]);
	$table[] = array('<b>PERMISSION: add knowledgebase category</b><br />Can your technician add new categories to the knowledgebase?', $bit);

	$bit = form_radio_yn('p_delete_c_k', '', $tech[p_delete_c_k]);
	$table[] = array('<b>PERMISSION: delete knowledgebase category</b><br />Can your technician delete categories in the knowlegebase?', $bit);

	$bit = form_radio_yn('p_edit_c_k', '', $tech[p_edit_c_k]);
	$table[] = array('<b>PERMISSION: edit knowledgebase category</b><br />Can your technician edit categories in the knowlegebase?', $bit);

	if ($_REQUEST['do'] == "add2" OR $_REQUEST['do'] == "redo") {
	
		table_header('Your new technician', 'tech.php', array('do' => 'submit'));
		table_content('', $table);
		table_footer('Create Technician');
		unset($table);

	} else {

		table_header('Edit your technician', 'tech.php', array('do' => 'update', 'id' => $tech[id]));
		table_content('', $table);
		table_footer('Update Technician');
		unset($table);

	}
}

############################### DELETE TECH ###############################

if ($_REQUEST['do'] == "delete") {

	if ($id != $user['id']) {
		$db->query("DELETE FROM tech WHERE id = '$id'");
		$db->query("DELETE FROM tech_attachments WHERE techid = '$id'");
		$db->query("DELETE FROM tech_bookmarks WHERE techid = '$id'");
		$db->query("DELETE FROM tech_email WHERE techid = '$id'");
		$db->query("DELETE FROM tech_notes WHERE techid = '$id'");
		$db->query("DELETE FROM tech_session WHERE techid = '$id'");
		$db->query("DELETE FROM tech_start_tickets WHERE techid = '$id'");
		$db->query("DELETE FROM tech_ticket_save WHERE techid = '$id'");
		$db->query("DELETE FROM tech_ticket_watch WHERE techid = '$id'");
		$db->query("DELETE FROM tech_timelog WHERE techid = '$id'");
		$db->query("DELETE FROM calendar_task_tech WHERE techid = '$id'");

		$db->query("SELECT id FROM ticket WHERE tech = '$id'");
		while ($logs = $db->row_array()) { // Add entries to ticket logs for each affected ticket
			ticketlog($logs[id], 'tech', $id, 0);
		}

		$db->query("UPDATE ticket SET tech = '0' WHERE tech = '$id'");

		jump('tech.php', 'Tech Deleted');
	
	} else {
		mistake("You cannot delete your own account!");
	}

}

############################### DISABLE TECH ###############################

if ($_REQUEST['do'] == "disable") {

	if ($id != $user['id']) {
		$db->query("SELECT id FROM ticket WHERE tech = '$id'");
		while ($logs = $db->row_array()) { // Add entries to ticket logs for each affected ticket
			ticketlog($logs[id], 12, $id, 0);
		}
		$db->query("UPDATE ticket SET tech = '0' WHERE tech = '$id'");
		$db->query("UPDATE tech SET disabled = '1' WHERE id = '$id'");

		jump('tech.php', 'Tech Disabled');
	} else {
		mistake('You cannot disable your own account!');
	}

}

############################### ENABLE TECH ###############################

if ($_REQUEST['do'] == "enable") {

	$db->query("UPDATE tech SET disabled = '0' WHERE id = '$id'");

	jump('tech.php', 'Tech Enabled');

}

############################### VIEW TECHS ###############################
	
if ($_REQUEST['do'] == "view") {

	admin_header('Technicians', 'View Technicians');
	
	$db->query("SELECT id, disabled, username, cats_admin from tech");
	while ($tech = $db->row_array()) {

		// check current category restrictions
		if (strlen($tech[cats_admin])) {
			$pbit = "Category restrictions <font color=\"red\">enabled</font>";
		} else {
			$pbit = "No Category restrictions";
		}
		
		$table[] = array(
			iff($tech[disabled], "<b>DISABLED</b> <i><a href=\"tech.php?do=edit&id=$tech[id]\">" . $tech[username] . "</a></i>", "<b><a href=\"tech.php?do=edit&id=$tech[id]\">" . $tech[username] . "</a></b>"),
			"$pbit - <a href=\"tech.php?do=cats&id=$tech[id]\"><b>Edit</b></a>", 
			"<a href=\"tech.php?do=edit&id=$tech[id]\">Edit</a>",

			iff($tech[disabled], 

				jprompt("Re-enable technician $tech[username]", 
					"tech.php?do=enable&id=$tech[id]", 
					'Enable', 
					1), 
				jprompt("Confirm disabling of technician $tech[username]\\nThe technician\'s tickets will be set as unassigned.", 
					"tech.php?do=disable&id=$tech[id]",
					'Disable', 
					1)
				),
			jprompt("Confirm deletion of technician $tech[username]\\nThe technician\'s tickets will be set as unassigned\\nDeleting a technician (instead of disabling) will result in loss of information\\nin reports and in the ticket log. Where ever possible, disable the technician instead.", 
				"tech.php?do=delete&id=$tech[id]", 
				'Delete', 
				1)
		);

	}

	$table[] = array('<CENTER><A HREF="tech.php?do=add">Add a Technician</A></center>');
	$cols = array('Technician\'s Name', 'Edit Category Permissions', 'Edit', 'Disable', 'Delete');
	table_header('Edit your technician');
	table_content($cols, $table);
	table_footer();

}

############################### VIEW TECHS ###############################

if ($_REQUEST['do'] == "cats") {

	admin_header('Technicians', 'Technician Categories');

	$tech = $db->query_return("SELECT cats_admin FROM tech WHERE id = '$id'");
	$restrictions = explode(',', $tech[cats_admin]);

	$table[] = array('<b>No Category Specified</b>', form_radio_yn(0, 'categories', in_array('0', $restrictions)));
	
	$db->query("SELECT id, name FROM ticket_cat");

	while ($result = $db->row_array()) {

		$table[] = array('<b>' .$result[name] . '</b>', form_radio_yn($result[id], 'categories', in_array($result[id], $restrictions)));

	}

	$cols = array('Category Name', 'Select YES to disable tech\'s access to this category');
	table_header('Update Category Access', 'tech.php', array('do' => 'cats2', 'id' => $id));
	table_content($cols, $table);
	table_footer('Update Category Access');

}

############################### VIEW TECHS ###############################

if ($_REQUEST['do'] == "cats2") {

	foreach ($_REQUEST['categories'] AS $key => $var) {

		if ($var == '1') {
			$disabled .= $key . ',';
		}
	}
	$disabled = substr($disabled, 0, -1);
	
	$db->query("UPDATE tech SET cats_admin = '$disabled' WHERE id = '$id'");

	jump('tech.php', 'Selected categories disabled to this technician');

}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -