$api = new apiPipeDrive(); $data = $api->getAllUsers(); $data = json_decode($data, true); $user_list_data = array(); $user_list_data = $data["data"]; if (!empty($user_list_data)) { unset($fields); $fields["is_deleted"] = 1; qu("pd_users", $fields, " 1=1 "); foreach ($user_list_data as $each_user) { d($each_user); $user_id = ''; $user_id = trim($each_user["id"]); if ($user_id != '') { $check_user_id = array(); $check_user_id = Call_distribution::CheckMainUserId($user_id); echo $check_user_id . "****" . $each_user["name"]; echo "<br/>"; unset($fields); $fields["name"] = $each_user["name"]; $fields["email"] = $each_user["email"]; $fields["phone"] = $each_user["phone"]; $fields["is_deleted"] = '0'; if ($each_user['active_flag']) { $fields["is_active"] = '1'; } else { $fields["phone"] = ''; $fields["is_active"] = '0'; } if ($check_user_id != '') { $fields = _escapeArray($fields);
$json_user_list = json_encode($user_list); } // list update if data not null // if ($json_user_list != '') { unset($fields); $check_source_id = 0; $check_source_id = Call_distribution::CheckSourceID($source_id); if ($check_source_id > 0) { $fields["pd_user_id"] = $json_user_list; $user_list_update = qu("call_list_by_source", $fields, " pd_source_id = '{$source_id}'"); } else { $user_list_insert = 0; $fields["pd_source_id"] = $source_id; $fields["pd_user_id"] = $json_user_list; $user_list_insert = qi("call_list_by_source", $fields); } } } endforeach; } } */ //$_SESSION['greetings_msg'] = "Call Distribution Has Been Updated"; echo "1"; die; } $source_list = Call_distribution::getSourceList(); $user_list = Call_distribution::getUserList(); _cg("page_title", "Call Distribution"); $jsInclude = "call_distribution.js.php";
<?php if (!empty($source_list)) { ?> <?php foreach ($source_list as $each_source) { ?> <tr> <td style="font-weight:bold;"><?php echo $each_source["source_name"]; ?> </td> <td style=""> <?php $source_user_list = array(); $source_user_list_ids = array(); $source_user_list = Call_distribution::GetSourceUserIdList($each_source["pd_source_id"]); if (!empty($source_user_list)) { if (trim($source_user_list["pd_user_id"]) != '' && trim($source_user_list["pd_user_id"]) != '[]') { $source_user_list_ids = json_decode(trim($source_user_list["pd_user_id"]), true); } } ?> <?php /* if (!empty($user_list)) { ?> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12" style="height:100px;overflow:auto"> <?php foreach ($user_list as $each_user): ?> <div class="col-lg-4 col-md-4 col-sm-6 col-xs-12" style="padding:2px 10px;"> <?php $checcked_user = ''; if (in_array($each_user["pd_id"], $source_user_list_ids)) { $checcked_user = "******";
<?php $user_list = Call_distribution::getUserList(); $source_user_list = array(); $source_user_list_ids = array(); $source_user_list = Call_distribution::GetSourceUserIdList($deal_nm_arr["pd_source_id"]); if (!empty($source_user_list)) { if (trim($source_user_list["pd_user_id"]) != '' && trim($source_user_list["pd_user_id"]) != '[]') { $source_user_list_ids = json_decode(trim($source_user_list["pd_user_id"]), true); } } ?> <div style="float:left; width: 220px;padding:10px;"> <div style="width:100%;text-align:center;font-weight:bold;color:#444;">All Agents</div> <select id="sbOne" multiple="multiple" style="height:250px;width: 200px;"> <?php if (!empty($user_list)) { ?> <?php foreach ($user_list as $each_user) { ?> <?php if (!in_array($each_user['pd_id'], $source_user_list_ids)) { ?> <option value="<?php print $each_user["pd_id"]; ?> "><?php print $each_user["name"]; ?> </option>
$data = $api->getDealField('12463'); $data = json_decode($data, true); $source_list_arr = array(); $source_list_arr = $data["data"]["options"]; d($source_list_arr); //Set Flag is_deleted=1 in all the records unset($fields); $fields["is_deleted"] = 1; qu("pd_sources", $fields, " 1=1 "); if (count($source_list_arr) > 0) { foreach ($source_list_arr as $each_source) { $source_id = ''; $source_id = trim($each_source["id"]); if ($source_id != '') { $check_source_id = array(); $check_source_id = Call_distribution::CheckMainSourceId($source_id); echo $check_source_id . "****" . $each_source["label"]; echo "<br/>"; $data_insert = 1; if (!empty($check_source_id)) { if ($check_source_id["id"] != '') { unset($fields); $fields["source_name"] = trim($each_source["label"]); $fields["is_deleted"] = 0; $fields = _escapeArray($fields); qu("pd_sources", $fields, " id = '{$check_source_id}' "); $data_insert = 0; } } if ($data_insert == 1) { $fields["pd_source_id"] = trim($each_source["id"]);