Example #1
0
 static function create_list_new_version($query_num, $certain_kp_id = FALSE)
 {
     global $mysqli;
     global $user_id;
     // шаблон ряда таблицы списка КП
     $tpl_name = 'skins/tpl/client_folder/business_offers/list_table_rows.tpl';
     $fd = fopen($tpl_name, 'r');
     $rows_template = fread($fd, filesize($tpl_name));
     fclose($fd);
     // echo $query_num;
     $rows = '';
     if ((int) $query_num > 0) {
         // $query="SELECT*FROM `".KP_LIST."` WHERE `query_num` = '".$query_num."'";
         $query = "SELECT `" . KP_LIST . "`.*,`" . RT_LIST . "`.`theme` FROM `" . KP_LIST . "` INNER JOIN `" . RT_LIST . "` ON `" . RT_LIST . "`.`query_num` = `" . KP_LIST . "`.`query_num` WHERE `" . KP_LIST . "`.`query_num` = '" . $_GET['query_num'] . "'";
     } else {
         if (isset($_GET['client_id'])) {
             // $query = "SELECT*FROM `".KP_LIST."` WHERE `client_id` = '".$_GET['client_id']."'";
             $query = "SELECT `" . KP_LIST . "`.*,`" . RT_LIST . "`.`theme` FROM `" . KP_LIST . "` INNER JOIN `" . RT_LIST . "` ON `" . RT_LIST . "`.`query_num` = `" . KP_LIST . "`.`query_num` WHERE `" . KP_LIST . "`.`client_id` = '" . $_GET['client_id'] . "'";
         }
     }
     if ($certain_kp_id) {
         $query .= " AND `" . KP_LIST . "`.`id` = '" . $certain_kp_id . "'";
     }
     $query .= " ORDER BY id DESC";
     $result = $mysqli->query($query) or die($mysqli->error);
     if ($result->num_rows > 0) {
         ob_start();
         while ($row = $result->fetch_assoc()) {
             //
             $client_id = $row['client_id'];
             if ($row['send_time'] != '0000-00-00 00:00:00') {
                 $send_time_arr = explode("-", substr($row['send_time'], 0, 10));
                 $send_time = implode(".", array_reverse($send_time_arr));
             } else {
                 $send_time = 'не отправленно';
             }
             include_once ROOT . "/libs/php/classes/client_class.php";
             $cont_face_data = Client::get_cont_face_details($row['recipient_id']);
             $recipient = '<div class="client_faces_select1" sourse="kp" row_id="' . $row['id'] . '" client_id="' . $client_id . '" onclick="openCloseMenu(event,\'clientManagerMenu\');">' . ($row['recipient_id'] == 0 ? 'не установлен' : $cont_face_data['last_name'] . ' ' . $cont_face_data['name'] . ' ' . $cont_face_data['surname']) . '</div>';
             //$recipient = $row['recipient'];контакт:
             $date_arr = explode("-", substr($row['create_time'], 0, 10));
             $date = implode(".", array_reverse($date_arr));
             $query_num = $row['query_num'];
             $comment = 'добавьте свой комментарий';
             $comment = !empty($row['comment']) ? $row['comment'] : 'добавьте свой комментарий';
             $comment_style = trim($comment) == 'добавьте свой комментарий' ? 'italic grey' : '';
             eval(' ?>' . $rows_template . '<?php ');
         }
         $rows .= ob_get_contents();
         ob_get_clean();
     }
     return $rows;
 }
Example #2
0
 static function fetch_query_client_face($query_num)
 {
     global $mysqli;
     $query = "SELECT client_face_id FROM `" . RT_LIST . "` WHERE query_num ='" . $query_num . "'";
     $result = $mysqli->query($query) or die($mysqli->error);
     $row = $result->fetch_assoc();
     $data['id'] = $row['client_face_id'];
     if ($data['id'] != 0) {
         include_once ROOT . "/libs/php/classes/client_class.php";
         $data['details'] = Client::get_cont_face_details($data['id']);
     }
     return $data;
 }