function hook_slack_ticketuserreply($vars) { $ticketid = $vars['ticketid']; $userid = $vars['userid']; $deptid = $vars['deptid']; $deptname = $vars['deptname']; $subject = $vars['subject']; $message = $vars['message']; $priority = $vars['priority']; $name = get_client_name($userid); $text = "[ID: " . $ticketid . "] " . $subject . "\r\n"; $text .= "User: "******"\r\n"; $text .= "Departemen: " . $deptname . "\r\n"; //$text .= "Priority: ".$priority."\r\n"; $text .= $message . "\r\n"; slack_post($text); }
// palnner_rows $tpl_plan_name = './skins/tpl/planner/planner_table_rows.tpl'; $fd = fopen($tpl_plan_name,'r'); $tpl_plan_row = fread($fd,filesize($tpl_plan_name)); fclose($fd); // history_rows $tpl_history_name = './skins/tpl/planner/history_table_rows.tpl'; $fd = fopen($tpl_history_name,'r'); $tpl_history_row = fread($fd,filesize($tpl_history_name)); fclose($fd); while($item = mysql_fetch_assoc($result)){ extract($item,EXTR_PREFIX_ALL,"pl"); $client_name = get_client_name($pl_client_id); $write_date_in_format = implode('.',array_reverse(explode('-',substr($pl_write_datetime,0,10)))); $write_time_in_format = substr($pl_write_datetime,11,5); $exec_date_in_format = implode('.',array_reverse(explode('-',substr($pl_exec_datetime,0,10)))); $exec_time_in_format = substr($pl_exec_datetime,11,5); // цветовое выделение рядов по отношению к текущей дате $current_date_in_number = intval(date('Ymd')); $exec_date_in_number = intval(str_replace('-','',substr($pl_exec_datetime,0,10))); if($current_date_in_number > $exec_date_in_number) $row_class_name = 'planner_rows_expired'; elseif($current_date_in_number == $exec_date_in_number) $row_class_name = 'planner_rows_today'; elseif(($current_date_in_number < $exec_date_in_number) && ($current_date_in_number+7 > $exec_date_in_number)) $row_class_name = 'planner_rows_nearweek'; else $row_class_name = 'planner_rows';
// are you logged in? if (!isset($_SESSION['username'])) { gohome(); } // are you in the correct group? if ($_SESSION['role_id'] < 2) { errormsg('Your role does not have access to this resource'); } else { if (isset($_POST['domain_name']) && isset($_POST['client_id'])) { // Setup POST data as a new variable $domain_name = $_POST['domain_name']; $client_id = $_POST['client_id']; // find the client name if (get_client_name($client_id, $mysqli)) { // client_name found $client_name = get_client_name($client_id, $mysqli); // check if domain is already in use if (check_domain_name_isfree($domain_name, $mysqli)) { // domain is free, lets add it! if (add_domain($domain_name, $client_id, $mysqli)) { echo "\n\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t<legend>Create Domain</legend>\n\t\t\t\t\t\t\t" . quickalert("success", "New domain '" . $domain_name . "' has been added to the database for client '" . $client_name . "'.") . "\n\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t</div>\n\t\t\t\t\t"; } else { errormsg("Failed to insert new record into the database"); } } else { errormsg("This domain is already in the database!"); } } else { errormsg("This client_id does not exist"); } } elseif (!$_POST) {
public static function show_list($manager_id) { // список невыполненных задач global $mysqli; // массив id-шников клиентов закрепленных за менеджером $clients_ids_arr = self::get_related_clients_ids($manager_id); $query = "SELECT * FROM `" . PLANNER . "` WHERE `client_id` IN('" . implode("','", $clients_ids_arr) . "') AND `manager_id` = '" . (int) $manager_id . "' AND `status` <> 'done'"; $result = $mysqli->query($query) or die($mysqli->error); if ($result->num_rows > 0) { // row_tpl - html шаблон ряда $row_tpl_name = $_SERVER['DOCUMENT_ROOT'] . '/skins/tpl/admin/order_manager/planner/planner_table_rows.tpl'; $fd = fopen($row_tpl_name, 'r'); $row_tpl = fread($fd, filesize($row_tpl_name)); fclose($fd); ob_start(); while ($row = $result->fetch_assoc()) { //echo '<pre>'; print_r($row); echo '<pre>';//echo $row['id']."<br>"; extract($row, EXTR_PREFIX_ALL, "pl"); $client_name = get_client_name($pl_client_id); $write_date_in_format = implode('.', array_reverse(explode('-', substr($pl_write_datetime, 0, 10)))); $write_time_in_format = substr($pl_write_datetime, 11, 5); $remind_date_in_format = implode('.', array_reverse(explode('-', substr($pl_exec_datetime, 0, 10)))); $remind_time_in_format = substr($pl_exec_datetime, 11, 5); // цветовое выделение рядов по отношению к текущей дате $current_date_in_number = intval(date('Ymd')); $remind_date_in_number = intval(str_replace('-', '', substr($pl_remind_datetime, 0, 10))); if ($current_date_in_number > $remind_date_in_number) { $row_class_name = 'planner_rows_expired'; } elseif ($current_date_in_number == $remind_date_in_number) { $row_class_name = 'planner_rows_today'; } elseif ($current_date_in_number < $remind_date_in_number && $current_date_in_number + 7 > $remind_date_in_number) { $row_class_name = 'planner_rows_nearweek'; } else { $row_class_name = 'planner_rows'; } eval('?>' . $row_tpl . '<?php '); } $palnner_rows = ob_get_contents(); ob_get_clean(); require_once ROOT . '/skins/tpl/planner/planner_table.tpl'; } }
// check if the client has attached domains if (get_client_domain_count($client_id, $mysqli) && ($domain_tables = get_domains_table($client_id, $mysqli))) { echo "\n\t\t\t<!-- Begin Content Division -->\n\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("warning", $client_name . " is the owner of one or more domains.") . "\n\t\t\t\t\n\t\t\t\t" . quickalert("info", "To delete this client, you can either delete all \n\t\t\t\t\tassociated domains and their transport maps, or \n\t\t\t\t\tchange the owner of any domain to another client. \n\t\t\t\t\t<a class='alert-link' href=" . SITE_URL . "/?do=list&object=domain&id=" . $client_id . "'>View Domain(s)</a>") . "\n\t\t\t\t\n\t\t\t\t" . $domain_tables . "\n\t\t\t\t\n\t\t\t<!-- End Content Division -->\n\t\t\t</div>\n\t\t\t"; } elseif (get_client_domain_count($client_id, $mysqli)) { errormsg("cannot generate domains table"); } else { // no domains, remove client if (delete_client($client_id, $mysqli)) { echo "\n\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\t\n\t\t\t\t\t" . quickalert("success", "Client '" . $client_name . "' has been removed from the database.") . "\n\t\t\t\t\t\n\t\t\t\t<!-- End Content Division -->\n\t\t\t\t</div>\n\t\t\t\t"; } else { errormsg("Failed to delete record from the database"); } } } elseif (!$_POST) { if (isset($_GET['id'])) { if (get_client_name($_GET['id'], $mysqli)) { $selected_client_id = $_GET['id']; } } echo "\n\t\t<!-- Begin Content Division -->\n\t\t<div id='content'>\n\t\t\t<form class='form-horizontal' action='" . SITE_URL . "/?do=delete&object=client' method='post' name='delete_client'>\n\t\t\t\t<fieldset>\n\t\t\t\t\n\t\t\t\t<legend>Delete Client</legend>\n\t\t\t\t\n\t\t\t\t" . quickalert("info", "Cannot delete clients until all domains and transport maps are removed.") . "\n\t\t\t\t\n\t\t\t\t<div class='form-group'>\n\t\t\t\t\t<label class='col-md-4 control-label' for='selectbasic'>Client</label>\n\t\t\t\t\t<div class='col-md-4'>\n\t\t\t\t\t<select id='client_id' name='client_id' class='form-control'>\n\t\t"; $query = "SELECT client_id,client_name FROM clients ORDER BY client_name"; if ($stmt = $mysqli->prepare($query)) { $stmt->execute(); $stmt->store_result(); if ($stmt->num_rows > 0) { $stmt->bind_result($client_id, $client_name); while ($row = $stmt->fetch()) { if (isset($selected_client_id) && $selected_client_id == $client_id) { echo "<option selected value=" . $client_id . ">" . $client_name . "</option>"; } else { echo "<option value=" . $client_id . ">" . $client_name . "</option>";
errormsg('Your role does not have access to this resource'); } else { // make the change if (isset($_GET['id']) && isset($_GET['client_id'])) { if (get_client_name($_GET['client_id'], $mysqli)) { $newclient = $_GET['client_id']; } else { errormsg("client_id not valid"); } if (get_domain_name($_GET['id'], $mysqli)) { $address_id = $_GET['id']; if ($oldclient = get_client_id_by_address_id($address_id, $mysqli)) { if ($stmt = $mysqli->prepare("UPDATE `addresses` SET client_id= ? WHERE address_id= ?")) { $stmt->bind_param('ii', $newclient, $address_id); if ($stmt->execute()) { echo "\n\t\t\t\t\t\t\t<!-- Begin Content Division -->\n\t\t\t\t\t\t\t<div id='content'>\t\t\t\t\t\n\t\t\t\t\t\t\t\t<legend>Change Domain Owner</legend>\n\t\t\t\t\t\t\t\t" . quickalert("success", "Domain owner of '" . get_domain_name($address_id, $mysqli) . "' changed from '" . get_client_name($oldclient, $mysqli) . "' to '" . get_client_name($newclient, $mysqli) . "'") . "\n\t\t\t\t\t\t\t<!-- End Content Division -->\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t"; } else { errormsg("failed to edit the domain details"); } } } else { errormsg("address_id not valid"); } } else { errormsg("address_id not valid"); } // get some more info } elseif (isset($_GET['id'])) { if (get_domain_name($_GET['id'], $mysqli)) { $address_id = $_GET['id']; if ($client_id = get_client_id_by_address_id($address_id, $mysqli)) {