Guest User

Untitled

a guest
Feb 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.64 KB | None | 0 0
  1. <?php
  2. function wp_unexapi_admin_url() {
  3. echo"
  4. <style>
  5. span#ta-ad{font-size:20px;font-weight:bold;color:#009688;}
  6. span#me1-url{color:gray;font-weight:bold;}
  7. span#me-url{color:gray;font-weight:bold;}
  8. input.admin-input{-webkit-border-radius: 5px;
  9. -moz-border-radius: 5px;
  10. border-radius: 5px;}
  11. input.admin-input:focus{border-color: #009688;box-shadow: 0 0 2px rgba(0, 150, 136, 1);}
  12. input.admin-submit{cursor:pointer;border:none;color:white;background-color:#009688;-webkit-transition:all .3s ;
  13. -moz-transition:all .3s ;
  14. -o-transition:all .3s ;
  15. transition:all .3s ;
  16. -webkit-border-radius: 5px;
  17. -moz-border-radius: 5px;
  18. border-radius: 5px;text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);box-shadow:none;}
  19. input.admin-submit:hover{background-color:#006a60;-webkit-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  20. -moz-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  21. box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);border:none;}
  22. .b-box{display:inline-block;padding:3px 6px;border:2px solid #009688;-webkit-border-radius: 5px;
  23. -moz-border-radius: 5px;
  24. border-radius: 5px;}
  25. </style>
  26. ";
  27.  
  28. $aa = get_option( "unexapi-url" );
  29. if(isset($_POST['unexapi-url'])){
  30. update_option( "unexapi-url", $_POST["unex-url"], "no" );
  31. $aa = get_option( "unexapi-url" );
  32. echo '<div class="notice notice-success is-dismissible">
  33. <p>آدرس جدید ذخیره شد.</p>
  34. </div>';
  35. }
  36.  
  37. echo '
  38. <br><br>
  39. <span id="ta-ad">تغییر آدرس</span>
  40. <br><hr><br>
  41. <form name="sea-l-form" class="form-horizontal" method="POST" action="" id="form-l">
  42. آدرس :
  43. <input type="text" class="admin-input" name="unex-url" required> <br>
  44. <input type="hidden" name="unexapi-url" value="1"/>
  45. <input type="submit" style="margin-right:42px;margin-top:7px;" class="admin-submit" value="اعمال تغییرات"/>
  46. </form>
  47. <br>
  48. <div class="b-box">
  49. <span id="me1-url">آدرس فعلی :</span><br><hr>
  50. <span id="me-url">'.$aa.'</span><br>
  51. </div>
  52. ';
  53.  
  54. }
  55.  
  56. function wp_unexapi_admin_auth() {
  57. echo"
  58. <style>
  59. span#ta-ad{font-size:20px;font-weight:bold;color:#009688;}
  60. span#me1-url{color:gray;font-weight:bold;}
  61. span#me-url{color:gray;font-weight:bold;}
  62. input.admin-input{-webkit-border-radius: 5px;
  63. -moz-border-radius: 5px;
  64. border-radius: 5px;}
  65. input.admin-input:focus{border-color: #009688;box-shadow: 0 0 2px rgba(0, 150, 136, 1);}
  66. input.admin-submit{cursor:pointer;border:none;color:white;background-color:#009688;-webkit-transition:all .3s ;
  67. -moz-transition:all .3s ;
  68. -o-transition:all .3s ;
  69. transition:all .3s ;
  70. -webkit-border-radius: 5px;
  71. -moz-border-radius: 5px;
  72. border-radius: 5px;text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);box-shadow:none;}
  73. input.admin-submit:hover{background-color:#006a60;-webkit-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  74. -moz-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  75. box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);border:none;}
  76. .b-box{display:inline-block;padding:3px 6px;border:2px solid #009688;-webkit-border-radius: 5px;
  77. -moz-border-radius: 5px;
  78. border-radius: 5px;}
  79. </style>
  80. ";
  81.  
  82. $aa = get_option( "unexapi-username" );
  83. $bb = get_option( "unexapi-password" );
  84. if(isset($_POST['unexapi-auth'])){
  85. update_option( "unexapi-username", $_POST["unex-auth-user"], "no" );
  86. update_option( "unexapi-password", $_POST["unex-auth-pass"], "no" );
  87. $aa = get_option( "unexapi-username" );
  88. $bb = get_option( "unexapi-password" );
  89. echo '<div class="notice notice-success is-dismissible">
  90. <p>تنظیمات کاربری ذخیره شد.</p>
  91. </div>';
  92. }
  93.  
  94. echo '
  95. <br><br>
  96. <span id="ta-ad">تغییر کاربری</span>
  97. <br><hr><br>
  98. <form name="unex-2-form" method="POST" action="">
  99. username :
  100. <input type="text" class="admin-input" name="unex-auth-user" required> <br>
  101. password :
  102. <input type="text" class="admin-input" name="unex-auth-pass" required> <br>
  103. <input type="hidden" name="unexapi-auth" value="1"/>
  104. <input type="submit" class="admin-submit" style="margin-right:67px;margin-top:7px;" value="اعمال تغییرات"/>
  105. </form>
  106. <br>
  107. <div class="b-box">
  108. <span id="me1-url">اطلاعات کاربری فعلی :</span><br><hr>
  109. <span id="me-url">'.$aa.' : username</span><br>
  110. <span id="me-url">'.$bb.' : password</span>
  111. </div>
  112. ';
  113.  
  114. }
  115.  
  116. function wp_unexapi_admin_sync() {
  117. echo"
  118. <style>
  119. span#ta-ad{font-size:20px;font-weight:bold;color:#009688;}
  120. span#me1-url{color:gray;font-weight:bold;}
  121. span#me-url{color:gray;font-weight:bold;text-align:right;}
  122. input.admin-input{width:50px;-webkit-border-radius: 5px;
  123. -moz-border-radius: 5px;
  124. border-radius: 5px;}
  125. input.admin-input:focus{border-color: #009688;box-shadow: 0 0 2px rgba(0, 150, 136, 1);}
  126. a#admin-submit{font-size: 14px;text-decoration:none;cursor:pointer;border:none;color:white;background-color:#009688;-webkit-transition:all .3s ;
  127. -moz-transition:all .3s ;
  128. -o-transition:all .3s ;
  129. transition:all .3s ;
  130. -webkit-border-radius: 5px;
  131. -moz-border-radius: 5px;
  132. border-radius: 5px;text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);box-shadow:none;padding:4px 6px;}
  133. a#admin-submit:hover{background-color:#006a60;-webkit-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  134. -moz-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  135. box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);border:none;}
  136. .b-box{display:inline-block;padding:3px 6px;border:2px solid #009688;-webkit-border-radius: 5px;
  137. -moz-border-radius: 5px;
  138. border-radius: 5px;}
  139. input.admin-submit{display:inline-block;cursor:pointer;border:none;color:white;background-color:#009688;-webkit-transition:all .3s ;
  140. -moz-transition:all .3s ;
  141. -o-transition:all .3s ;
  142. transition:all .3s ;
  143. -webkit-border-radius: 5px;
  144. -moz-border-radius: 5px;
  145. border-radius: 5px;text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);box-shadow:none;}
  146. input.admin-submit:hover{background-color:#006a60;-webkit-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  147. -moz-box-shadow: 0px 0px 10px 2px rgba(0,0,0,0.75);
  148. box-shadow: 0px 0px 10px 0px rgba(0,0,0,0.5);border:none;}
  149. </style>
  150. ";
  151.  
  152.  
  153. $aa = get_option( "unexapi-sync-hour" );
  154. if(isset($_POST['unexapi-sync'])){
  155. if(is_numeric($_POST["unex-sync-hour"])){
  156. update_option( "unexapi-sync-hour", $_POST["unex-sync-hour"], "no" );
  157. $aa = get_option( "unexapi-sync-hour" );
  158. echo '<div class="notice notice-success is-dismissible">
  159. <p>بازه زمانی ذخیره شد.</p>
  160. </div>';
  161. }else{
  162. echo '<div class="notice notice-error is-dismissible">
  163. <p>لطفا ساعت را با اعداد انگلیسی وارد کنید.</p>
  164. </div>';
  165. }
  166. }
  167.  
  168. if(isset($_POST['unexapi-sync-fast'])){
  169. cron_job_changeprice_fast();
  170. echo '<div class="notice notice-success is-dismissible">
  171. <p>درخواست بروزرسانی با موفقیت ارسال شد.</p>
  172. </div>';
  173. }
  174.  
  175. echo '
  176. <br><br>';
  177.  
  178. if ( get_option( 'unexapi-sync-enable' ) == '0' ) {
  179. echo '<span id="ta-ad">&#1576;&#1585;&#1608;&#1586;&#1585;&#1587;&#1575;&#1606;&#1740; &#1583;&#1608;&#1585;&#1607; &#1575;&#1740;</span>
  180. <form name="unex-88-form" method="POST" action="" style="display: inline;">
  181. <input type="hidden" name="unexapi-sync-enable0" value="1"/>
  182. <input type="submit" class="admin-submit" value="فعال کن" id="admin-submit" style="background-color:#383dff!important;"/>
  183. </form>
  184. <br><hr><br>
  185. <div class="notice notice-error">
  186. <p>&#1576;&#1585;&#1608;&#1586;&#1585;&#1587;&#1575;&#1606;&#1740; &#1583;&#1608;&#1585;&#1607; &#1575;&#1740; &#1594;&#1740;&#1585;&#1601;&#1593;&#1575;&#1604; &#1605;&#1740;&#1576;&#1575;&#1588;&#1583; .</p>
  187. </div>
  188. ';
  189. } elseif (get_option( 'unexapi-sync-enable' ) == '1') {
  190. echo '
  191. <span id="ta-ad">&#1576;&#1585;&#1608;&#1586;&#1585;&#1587;&#1575;&#1606;&#1740; &#1583;&#1608;&#1585;&#1607; &#1575;&#1740;</span>
  192. <form name="unex-77-form" method="POST" action="" style="display: inline;">
  193. <input type="hidden" name="unexapi-sync-enable1" value="1"/>
  194. <input type="submit" class="admin-submit" value="غیر فعال کن" id="admin-submit" style="background-color:#ff3d4e!important;"/>
  195. </form>
  196. <br><hr><br>
  197. <form name="unex-3-form" method="POST" action="">
  198. بروزرسانی سیستم هر
  199. <input type="text" class="admin-input" name="unex-sync-hour" required>
  200. ساعت انجام می گیرد.
  201. <input type="hidden" name="unexapi-sync" value="1"/>
  202. <input type="submit" class="admin-submit" value="اعمال تغییرات"/>
  203. </form>
  204. <br>
  205. <div class="b-box">
  206. <span id="me1-url">زمانبندی فعلی هر</span>&nbsp;' . $aa . '&nbsp;<span id="me1-url">ساعت میباشد.</span>
  207. </div>';
  208. }
  209.  
  210. echo '<br><br><br>
  211. <br>
  212. <br>
  213. <span id="ta-ad">بروزرسانی سریع</span>
  214. <br><hr><br>
  215. جهت بروز رسانی سیستم بدون زمان بندی از این بخش استفاده کنید.<br><br>';
  216.  
  217.  
  218.  
  219. echo '
  220. <form name="unex-6-form" method="POST" action="" id="loader">
  221.  
  222. ';
  223. $args = array(
  224. 'show_option_all' => '&#1578;&#1605;&#1575;&#1605;&#1740; &#1583;&#1587;&#1578;&#1607; &#1576;&#1606;&#1583;&#1740; &#1607;&#1575;',
  225. 'show_option_none' => '',
  226. 'option_none_value' => '-1',
  227. 'orderby' => 'name',
  228. 'order' => 'ASC',
  229. 'show_count' => 0,
  230. 'hide_empty' => 1,
  231. 'child_of' => 0,
  232. 'exclude' => '',
  233. 'include' => '',
  234. 'echo' => 1,
  235. 'selected' => 0,
  236. 'hierarchical' => 1,
  237. 'name' => 'unexcat',
  238. 'id' => '',
  239. 'class' => 'postform',
  240. 'depth' => 0,
  241. 'tab_index' => 0,
  242. 'taxonomy' => 'product_cat',
  243. 'hide_if_empty' => false,
  244. 'value_field' => 'term_id',
  245. );
  246.  
  247. wp_dropdown_categories( $args );
  248.  
  249. echo '<input type="hidden" name="unexapi-sync-fast" value="1"/>
  250. <input type="submit" id="loader" class="admin-submit" value="&#1607;&#1605; &#1575;&#1705;&#1606;&#1608;&#1606; &#1576;&#1585;&#1608;&#1586;&#1585;&#1587;&#1575;&#1606;&#1740; &#1705;&#1606; !"/>
  251. </form>
  252.  
  253. <input type="hidden" name="page_sku" value="1">
  254. <div class="loading"></div>
  255. <div class="alert-loader">
  256.  
  257.  
  258.  
  259. <span id="now"></span> / <span id="all"></span><br>
  260. موفق <span id="accept"></span><br>
  261. ناموفق <span id="not-accept"></span><br>
  262. </div>
  263.  
  264. <script>
  265.  
  266.  
  267.  
  268.  
  269.  
  270.  
  271. jQuery(document).ready(function(){
  272.  
  273.  
  274. function ajax_request(){
  275.  
  276. jQuery.ajax({
  277. url: ajaxurl,
  278. type: \'POST\',
  279. cache: false,
  280. data: {
  281. \'action\':\'loader_check_sku\',
  282. \'page\': parseInt(jQuery("input[name=page_sku]").val()),
  283. \'limit\': 50,
  284. \'accept\': parseInt(jQuery("div.alert-loader span#accept").text()),
  285. \'not-accept\': parseInt(jQuery("div.alert-loader span#not-accept").text()),
  286. },
  287. dataType : "json",
  288. success:function(data) {
  289.  
  290. if(data.end =="YES") {
  291. alert("End");
  292. } else {
  293. jQuery("div.alert-loader span#now").html(data.now);
  294. jQuery("div.alert-loader span#accept").html(data.ac);
  295. jQuery("div.alert-loader span#not-accept").html(data.nac);
  296. jQuery("input[name=page_sku]").val(data.page);
  297. ajax_request();
  298. return false;
  299. }
  300. },
  301. error: function(jqXHR, textStatus, errorThrown){
  302. alert("error");
  303. console.log(jqXHR);
  304. console.log(textStatus);
  305. console.log(errorThrown);
  306.  
  307. }
  308. });
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317. }
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325. jQuery(document).on("submit", "form#loader", function (e) {
  326. e.preventDefault();
  327.  
  328. //show Loadign
  329. jQuery(".loading").html("لطفا کمی صبر کنید ..").hide().fadeIn(1000);
  330.  
  331. var formdata = new FormData($("#loader")[0]);
  332. formdata.append(\'action\', \'loader_check_sku\');
  333. formdata.append(\'page\', jQuery("input[name=page_sku]").val());
  334. formdata.append(\'accept\', \'\');
  335. formdata.append(\'not-accept\', \'\');
  336.  
  337.  
  338.  
  339. jQuery.ajax({
  340. url: ajaxurl,
  341. type: \'POST\',
  342. processData: false,
  343. contentType: false,
  344. cache: false,
  345. data: formdata,
  346. dataType : "json",
  347. success:function(data) {
  348. if(data.end =="YES") {
  349. alert("End");
  350. } else {
  351.  
  352. jQuery("div.alert-loader span#now").html(data.now);
  353. jQuery("div.alert-loader span#all").html(data.all);
  354. jQuery("div.alert-loader span#accept").text(data.ac);
  355. jQuery("div.alert-loader span#not-accept").text(data.nac);
  356. jQuery("input[name=page_sku]").val(data.page);
  357. ajax_request();
  358.  
  359. }
  360.  
  361.  
  362.  
  363. },
  364. error: function(jqXHR, textStatus, errorThrown){
  365. alert("error");
  366. }
  367. });
  368.  
  369. // Do stuff
  370. return false;
  371. });
  372.  
  373. });
  374. </script>
  375.  
  376.  
  377. ';
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386. }
  387.  
  388. define('P_LIMIT', 20);
  389.  
  390. function loader_check_sku(){
  391. global $wpdb, $post;
  392.  
  393. if ( defined('DOING_AJAX') && DOING_AJAX ) {
  394. $page = $_POST['page'];
  395. $limit = P_LIMIT;
  396. $accept = $_POST['accept'];
  397. $not_accept = $_POST['not-accept'];
  398. $t['end'] = 'NO';
  399.  
  400. if($page =="1") {
  401. $args = array(
  402. 'post_type' => array('product', 'product_variation'),
  403. 'post_status' => 'publish',
  404. 'meta_query' => array(
  405. array(
  406. 'key' => '_sku',
  407. 'value' => '',
  408. 'compare' => '!=',
  409. )
  410. )
  411. );
  412. $my_query = new WP_Query( $args );
  413. $t['all'] = $my_query->found_posts;
  414. $t['now'] = P_LIMIT;
  415. }
  416.  
  417.  
  418. //Query
  419. $args = array(
  420. 'post_type' => array('product', 'product_variation'),
  421. 'post_status' => 'publish',
  422. 'meta_query' => array(
  423. array(
  424. 'key' => '_sku',
  425. 'value' => '',
  426. 'compare' => '!=',
  427. )
  428. ),
  429. 'posts_per_page' => $limit,
  430. 'paged' => $page
  431. );
  432. $my_query = new WP_Query( $args );
  433.  
  434.  
  435. if($my_query->post_count >0) {
  436.  
  437. while ( $my_query->have_posts() ) {
  438. $my_query->the_post();
  439.  
  440.  
  441. $client = new SoapClient( get_option( "unexapi-url" ), [ 'encoding' => 'UTF-8' ] );
  442. $result = $client->FindProductByCode(
  443. [
  444. 'userName' => get_option( "unexapi-username" ),
  445. 'password' => get_option( "unexapi-password" ),
  446. 'code' => get_post_meta( get_the_ID(), '_sku', true ),
  447. 'groupName' => "",
  448. ]
  449. );
  450.  
  451. if ( $result->FindProductByCodeResult->Success == "" ) {
  452. $not_accept = $not_accept + 1;
  453. } else {
  454. $accept = $accept + 1;
  455.  
  456. foreach ( $result->FindProductByCodeResult->ProductInfoList as $p ) {
  457.  
  458.  
  459. $toman_price = $p->UnitPrice / 10; // tabdil be toman
  460. $flag = "p";
  461. if ( $_POST['unexcat'] != 0 ) { //for all categories
  462. //$term_list = wp_get_post_terms('16716', 'product_cat', array("fields" => "all"));
  463. //echo '<pre>';
  464. //print_r($term_list);
  465.  
  466.  
  467. $taxonomy = "product_cat";
  468. $args = array( 'fields' => 'all' );
  469.  
  470. $p_id = get_the_ID();
  471. if ( $post->post_parent != 0 ) {
  472. $p_id = wp_get_post_parent_id( get_the_ID() );
  473. }
  474.  
  475. $terms = wp_get_post_terms( $p_id, $taxonomy, $args );
  476. //print_r($terms);
  477. $tr = $terms[0]->term_id;
  478. //echo $terms[0]->term_id;
  479. //echo "<br>";
  480. //exit;
  481. // echo $tr;
  482. $term_children = get_term_children( $_POST['unexcat'], 'product_cat' );
  483. //print_r($term_children);
  484. $term_children[] = $_POST['unexcat'];
  485. // print_r($term_children);
  486.  
  487. if ( ! in_array( $tr, $term_children ) ) {
  488. $flag = "n";
  489. }
  490. }
  491.  
  492. if ( $flag == "p" ) {
  493. if ( get_post_meta( get_the_ID(), '_sale_price', true ) == "" ) {
  494.  
  495. $update_p = update_post_meta( get_the_ID(), '_price', $toman_price );
  496. $update_rp = update_post_meta( get_the_ID(), '_regular_price', $toman_price );
  497.  
  498. if ( ( $update_p == true ) and ( $update_rp == true ) ) {
  499. if ( function_exists( 'rocket_clean_post' ) ) {
  500. //echo get_the_ID();
  501. rocket_clean_post( get_the_ID() );
  502. }
  503.  
  504.  
  505. }
  506. } else {
  507. $update_rp = update_post_meta( get_the_ID(), '_regular_price', $toman_price );
  508. if ( $update_rp == true ) {
  509. if ( function_exists( 'rocket_clean_post' ) ) {
  510. rocket_clean_post( get_the_ID() );
  511. }
  512. }
  513. }
  514. }
  515. }
  516.  
  517.  
  518. }
  519.  
  520. }
  521.  
  522. } else {
  523. $t['end'] ="YES";
  524. }
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533. $t['page'] = $page + 1;
  534. $t['now'] = $_POST['page'] * P_LIMIT;
  535. $t['ac'] = $accept;
  536. $t['nac'] = $not_accept;
  537.  
  538.  
  539.  
  540.  
  541.  
  542. //echo $p->UnitPrice;
  543. //echo the_ID();
  544. //echo "<br>";
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556. wp_send_json($t);
  557. exit;
  558.  
  559.  
  560.  
  561. }
  562. die();
  563. }
  564. add_action( 'wp_ajax_loader_check_sku', 'loader_check_sku' );
  565.  
  566.  
  567.  
  568.  
  569.  
  570.  
  571.  
  572. function wp_unexapi_admin_archive(){
  573. global $wpdb;
  574. echo '
  575. <style>
  576. span#ta-ad{font-size:20px;font-weight:bold;color:#009688;}
  577. table.tmes{margin-top:20px;}
  578. table.tmes tr th, table.tmes tr td{text-align:center;}
  579. tr.list { -webkit-transition:all .3s ;
  580. -moz-transition:all .3s ;
  581. -o-transition:all .3s ;
  582. transition:all .3s }
  583. tr.list:hover { background-color:rgba(204,204,204,0.3); }
  584. .tablenav .tablenav-pages{float:none;}
  585. .tablenav{text-align:center!important;}
  586. #wpbody{margin-left:20px!important;}
  587. span.nog{color:red;}
  588. span.yesg{color:green;}
  589. </style>
  590. ';
  591.  
  592. echo '
  593. <br><br>
  594. <span id="ta-ad">آرشیو بروزرسانی ها</span>
  595. <br><hr><br>';
  596.  
  597. //**********************************pagination
  598. //include pagination
  599. include_once(dirname(__FILE__) . '/pagination.class.php');
  600.  
  601. $items = $wpdb->get_var("SELECT COUNT(*) FROM `".$wpdb->prefix."unexapi_sync_archive");
  602. // $limit = "";
  603. //Show List
  604. if($items > 0) {
  605. $p = new wppagination;
  606. $p->items($items);
  607. $p->limit(PAGINATION_ANY_PAGE);
  608. $p->target('?page=wp-unexapi4');
  609. $p->currentPage($_GET[$p->paging]);
  610. $p->calculate();
  611. $p->parameterName('paging');
  612. $p->adjacents(1);
  613. $p->nextLabel('صفحه بعدی');
  614. $p->prevLabel('صفحه قبلی');
  615. if(!isset($_GET['paging'])) { $p->page = 1;} else { $p->page = $_GET['paging'];}
  616. $limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
  617. }
  618.  
  619. if($items >PAGINATION_ANY_PAGE) {
  620. echo'<div class="tablenav">
  621. <div class="tablenav-pages">';
  622. $p->show();
  623. echo'</div>
  624. </div>
  625. <div style="clear:both; margin-bottom:20px;"></div>';
  626. }
  627. //**********************************pagination
  628.  
  629. echo'
  630. <table class="tmes widefat">
  631. <thead>
  632. <tr>
  633. <th>تاریخ</th>
  634. <th>ساعت</th>
  635. <th>بروزرسانی سریع</th>
  636. <th>بروزرسانی دوره ای</th>
  637. <th>وضعیت</th>
  638. </tr>
  639. </thead>
  640. <tbody>';
  641. $sql = "SELECT * FROM ".$wpdb->prefix."unexapi_sync_archive ORDER BY `id` DESC ".$limit;
  642.  
  643. $Query2 = $wpdb->get_results($sql, ARRAY_A);
  644. $rowcount = count($Query2);
  645.  
  646. if ($rowcount >0) {
  647. $radif = 0;
  648. foreach ( $Query2 as $row2 ) {
  649.  
  650. date_default_timezone_set('Asia/Tehran');
  651. $date1 = jdate( "j F o" , $row2["date"] );
  652. //list($gy,$gm,$gd)=explode('-',date('Y-n-d'));
  653. //$j_date_string=gregorian_to_jalali($gy,$gm,$gd,'/');
  654. $time1 = jdate( "H:i" , $row2["date"] );
  655. $fastsync = "";
  656. $periodsync = "";
  657. if($row2["fast_sync"] == true){
  658. $fastsync = "<span class='yesg'><span class='dashicons dashicons-yes'></span></span>";
  659. }
  660. if($row2["period_sync"] == true){
  661. $periodsync = "<span class='yesg'><span class='dashicons dashicons-yes'></span></span>";
  662. }
  663. if($row2["status"] == true){
  664. $status = "<span class='yesg'><span class='dashicons dashicons-yes'></span>موفق</span>";
  665. } elseif($row2["status"] == false){
  666. $status = "<span class='nog'><span class='dashicons dashicons-no'></span>ناموفق</span>";
  667. }
  668.  
  669.  
  670. echo'<tr class="list">
  671. <th>'.$date1.'</th>
  672. <th>'.$time1.'</th>
  673. <th>'.$fastsync.'</th>
  674. <th>'.$periodsync.'</th>
  675. <th>'.$status.'</th>
  676. </tr>';
  677. }
  678. } else {
  679. echo'
  680. <tr>
  681. <th colspan="8">موردی یافت نشد !</th>
  682. </tr> ';
  683. }
  684. echo'
  685. </tbody>
  686. </table>';
  687.  
  688.  
  689.  
  690.  
  691.  
  692. }
Add Comment
Please, Sign In to add comment