PageRenderTime 47ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/system-before-change-by-server/application/libraries/checkpoint.php

https://github.com/mr-mark/mark-1
PHP | 1054 lines | 924 code | 120 blank | 10 comment | 64 complexity | f4ecbe79c31c7ebe7bff8bbb534fb69a MD5 | raw file
Possible License(s): MIT
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Checkpoint extends MY_cls
  3. {
  4. var $id;
  5. var $race_id;
  6. var $name = "";
  7. var $city = "";
  8. var $kilometer = 0;
  9. var $max_speed = 0;
  10. /*
  11. Road situation:
  12. 0: normal
  13. 1: sloppy
  14. 2: slippery
  15. 3: rainy
  16. 4: foggy
  17. 5: snowy
  18. */
  19. var $road_situation = 0;
  20. var $question_type = 0;
  21. var $distance = 50000; //Meters
  22. function Checkpoint($instant = FALSE)
  23. {
  24. if($instant) {
  25. parent::instant_maker($instant);
  26. }
  27. }
  28. function register($checkpoints) {
  29. $sql = "INSERT INTO `checkpoints` (`race_id`, `name`, `city`, `kilometer`, `max_speed`, `road_situation`, `question_type`) VALUES ";
  30. foreach($checkpoints as $x => $k) {
  31. $sql .= "(" . $this->db->escape($k->race_id) . ", " . $this->db->escape($k->name) . ", " . $this->db->escape($k->city) . ", " . $this->db->escape($k->kilometer) . ", " . $this->db->escape($k->max_speed) . ", " . $this->db->escape($k->road_situation) . ", " . $this->db->escape($k->question_type) . ") , ";
  32. }
  33. $sql = rtrim($sql, ", ");
  34. if($this->db->query($sql)) {
  35. return TRUE;
  36. }
  37. return FALSE;
  38. }
  39. function add_checkpoint($main_checkpoint, $road_situation, $city, $kilometer, $max_speed = "", $name = "") {
  40. if(!is_object($main_checkpoint)) {
  41. return FALSE;
  42. }
  43. $checkpoint = new Checkpoint($main_checkpoint);
  44. $checkpoint->road_situation = $road_situation;
  45. $checkpoint->city = $city;
  46. $checkpoint->kilometer = $kilometer;
  47. if($max_speed != "") {
  48. $checkpoint->max_speed = $max_speed;
  49. }
  50. if($name != "") {
  51. $checkpoint->name = $name;
  52. }
  53. return $checkpoint;
  54. }
  55. function create_checkpoints($race) {
  56. $checkpoint = array(); //Array of checkpoints
  57. switch($race->type) {
  58. case 111:
  59. $cities = array("بندرعباس",
  60. "بندرخمیر",
  61. "لار",
  62. "خنج",
  63. "بندردیر",
  64. "برازجان",
  65. "بوشهر");
  66. $kilometers = array("0",
  67. "300",
  68. "450",
  69. "550",
  70. "650",
  71. "750",
  72. "800");
  73. $checkpoint[0] = new Checkpoint();
  74. $checkpoint[0]->race_id = $race->id;
  75. $checkpoint[0]->name = "";
  76. $checkpoint[0]->city = $cities[0];
  77. $checkpoint[0]->max_speed = $race->max_speed;
  78. $checkpoint[0]->road_situation = mt_rand(0, 3);
  79. foreach($cities as $x => $k) {
  80. if($x == 0) {
  81. continue;
  82. }
  83. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  84. }
  85. break;
  86. case 112:
  87. $cities = array("ایلام",
  88. "مریوان",
  89. "دهلران",
  90. "دزفول",
  91. "اهواز",
  92. "آبادان",
  93. "امیدیه");
  94. $kilometers = array("0",
  95. "300",
  96. "450",
  97. "550",
  98. "650",
  99. "750",
  100. "800");
  101. $checkpoint[0] = new Checkpoint();
  102. $checkpoint[0]->race_id = $race->id;
  103. $checkpoint[0]->name = "";
  104. $checkpoint[0]->city = $cities[0];
  105. $checkpoint[0]->max_speed = $race->max_speed;
  106. $checkpoint[0]->road_situation = mt_rand(0, 3);
  107. foreach($cities as $x => $k) {
  108. if($x == 0) {
  109. continue;
  110. }
  111. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  112. }
  113. break;
  114. case 113:
  115. $cities = array("تهران",
  116. "قزوین",
  117. "گلپایگان",
  118. "اراک",
  119. "سمنان",
  120. "شاهرود",
  121. "مشهد");
  122. $kilometers = array("0",
  123. "300",
  124. "450",
  125. "550",
  126. "650",
  127. "750",
  128. "800");
  129. $checkpoint[0] = new Checkpoint();
  130. $checkpoint[0]->race_id = $race->id;
  131. $checkpoint[0]->name = "";
  132. $checkpoint[0]->city = $cities[0];
  133. $checkpoint[0]->max_speed = $race->max_speed;
  134. $checkpoint[0]->road_situation = mt_rand(0, 3);
  135. foreach($cities as $x => $k) {
  136. if($x == 0) {
  137. continue;
  138. }
  139. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  140. }
  141. break;
  142. case 121:
  143. $cities = array("مریوان",
  144. "ایلام",
  145. "دهلران",
  146. "دزفول",
  147. "اهواز",
  148. "آبادان",
  149. "امیدیه",
  150. "بندرگناوه",
  151. "کازرون");
  152. $kilometers = array("0",
  153. "300",
  154. "600",
  155. "800",
  156. "950",
  157. "1100",
  158. "1200",
  159. "1350",
  160. "1500");
  161. $checkpoint[0] = new Checkpoint();
  162. $checkpoint[0]->race_id = $race->id;
  163. $checkpoint[0]->name = "";
  164. $checkpoint[0]->city = $cities[0];
  165. $checkpoint[0]->max_speed = $race->max_speed;
  166. $checkpoint[0]->road_situation = mt_rand(0, 3);
  167. foreach($cities as $x => $k) {
  168. if($x == 0) {
  169. continue;
  170. }
  171. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  172. }
  173. break;
  174. case 122:
  175. $cities = array("اصفهان",
  176. "کاشان",
  177. "شاهرود",
  178. "سمنان",
  179. "گلپایگان",
  180. "اراک",
  181. "زنجان",
  182. "قزوین",
  183. "تهران");
  184. $kilometers = array("0",
  185. "300",
  186. "600",
  187. "800",
  188. "950",
  189. "1100",
  190. "1200",
  191. "1350",
  192. "1500");
  193. $checkpoint[0] = new Checkpoint();
  194. $checkpoint[0]->race_id = $race->id;
  195. $checkpoint[0]->name = "";
  196. $checkpoint[0]->city = $cities[0];
  197. $checkpoint[0]->max_speed = $race->max_speed;
  198. $checkpoint[0]->road_situation = mt_rand(0, 3);
  199. foreach($cities as $x => $k) {
  200. if($x == 0) {
  201. continue;
  202. }
  203. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  204. }
  205. break;
  206. case 123:
  207. $cities = array("یزد",
  208. "کاشان",
  209. "اصفهان",
  210. "شاهرود",
  211. "سمنان",
  212. "گلپایگان",
  213. "زنجان",
  214. "اراک",
  215. "قزوین");
  216. $kilometers = array("0",
  217. "300",
  218. "600",
  219. "800",
  220. "950",
  221. "1100",
  222. "1200",
  223. "1350",
  224. "1500");
  225. $checkpoint[0] = new Checkpoint();
  226. $checkpoint[0]->race_id = $race->id;
  227. $checkpoint[0]->name = "";
  228. $checkpoint[0]->city = $cities[0];
  229. $checkpoint[0]->max_speed = $race->max_speed;
  230. $checkpoint[0]->road_situation = mt_rand(0, 3);
  231. foreach($cities as $x => $k) {
  232. if($x == 0) {
  233. continue;
  234. }
  235. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 3), $k, $kilometers[$x]);
  236. }
  237. break;
  238. case 131:
  239. $cities = array("تهران",
  240. "سمنان",
  241. "شاهرود",
  242. "مشهد",
  243. "گناباد",
  244. "یزد",
  245. "کاشان",
  246. "اصفهان",
  247. "گلپایگان",
  248. "اراک",
  249. "قزوین",
  250. "تهران");
  251. $kilometers = array("0",
  252. "300",
  253. "600",
  254. "800",
  255. "950",
  256. "1100",
  257. "1300",
  258. "1450",
  259. "1600",
  260. "1750",
  261. "1900",
  262. "2000");
  263. $checkpoint[0] = new Checkpoint();
  264. $checkpoint[0]->race_id = $race->id;
  265. $checkpoint[0]->name = "";
  266. $checkpoint[0]->city = $cities[0];
  267. $checkpoint[0]->max_speed = $race->max_speed;
  268. $checkpoint[0]->road_situation = mt_rand(1, 5);
  269. foreach($cities as $x => $k) {
  270. if($x == 0) {
  271. continue;
  272. }
  273. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  274. }
  275. break;
  276. case 211:
  277. $cities = array("شهرکرد",
  278. "اردل",
  279. "بروجن",
  280. "لردگان",
  281. "سمیرم",
  282. "یاسوج",
  283. "میبد");
  284. $kilometers = array("0",
  285. "300",
  286. "450",
  287. "550",
  288. "650",
  289. "750",
  290. "800");
  291. $checkpoint[0] = new Checkpoint();
  292. $checkpoint[0]->race_id = $race->id;
  293. $checkpoint[0]->name = "";
  294. $checkpoint[0]->city = $cities[0];
  295. $checkpoint[0]->max_speed = $race->max_speed;
  296. $checkpoint[0]->road_situation = mt_rand(1, 5);
  297. foreach($cities as $x => $k) {
  298. if($x == 0) {
  299. continue;
  300. }
  301. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  302. }
  303. break;
  304. case 212:
  305. $cities = array("فیروزکوه",
  306. "دماوند",
  307. "تهران",
  308. "قزوین",
  309. "بلده",
  310. "آسارا",
  311. "طالقان");
  312. $kilometers = array("0",
  313. "300",
  314. "450",
  315. "550",
  316. "650",
  317. "750",
  318. "800");
  319. $checkpoint[0] = new Checkpoint();
  320. $checkpoint[0]->race_id = $race->id;
  321. $checkpoint[0]->name = "";
  322. $checkpoint[0]->city = $cities[0];
  323. $checkpoint[0]->max_speed = $race->max_speed;
  324. $checkpoint[0]->road_situation = mt_rand(1, 5);
  325. foreach($cities as $x => $k) {
  326. if($x == 0) {
  327. continue;
  328. }
  329. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  330. }
  331. break;
  332. case 213:
  333. $cities = array("کرمانشاه",
  334. "سنقر",
  335. "کنگاور",
  336. "نهاوند",
  337. "بروجرد",
  338. "الیگودرز",
  339. "خرم آباد");
  340. $kilometers = array("0",
  341. "300",
  342. "450",
  343. "550",
  344. "650",
  345. "750",
  346. "800");
  347. $checkpoint[0] = new Checkpoint();
  348. $checkpoint[0]->race_id = $race->id;
  349. $checkpoint[0]->name = "";
  350. $checkpoint[0]->city = $cities[0];
  351. $checkpoint[0]->max_speed = $race->max_speed;
  352. $checkpoint[0]->road_situation = mt_rand(1, 5);
  353. foreach($cities as $x => $k) {
  354. if($x == 0) {
  355. continue;
  356. }
  357. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  358. }
  359. break;
  360. case 221:
  361. $cities = array("دماوند",
  362. "فیروزکوه",
  363. "بلده",
  364. "آسارا",
  365. "طالقان",
  366. "الوند",
  367. "کوهین",
  368. "خرمدره",
  369. "زنجان");
  370. $kilometers = array("0",
  371. "300",
  372. "600",
  373. "800",
  374. "950",
  375. "1100",
  376. "1200",
  377. "1350",
  378. "1500");
  379. $checkpoint[0] = new Checkpoint();
  380. $checkpoint[0]->race_id = $race->id;
  381. $checkpoint[0]->name = "";
  382. $checkpoint[0]->city = $cities[0];
  383. $checkpoint[0]->max_speed = $race->max_speed;
  384. $checkpoint[0]->road_situation = mt_rand(1, 5);
  385. foreach($cities as $x => $k) {
  386. if($x == 0) {
  387. continue;
  388. }
  389. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  390. }
  391. break;
  392. case 222:
  393. $cities = array("خرم آباد",
  394. "کنگاور",
  395. "بروجرد",
  396. "نهاوند",
  397. "دورود",
  398. "الیگودرز",
  399. "فریدونشهر",
  400. "چلگرد",
  401. "شلمزار");
  402. $kilometers = array("0",
  403. "300",
  404. "600",
  405. "800",
  406. "950",
  407. "1100",
  408. "1200",
  409. "1350",
  410. "1500");
  411. $checkpoint[0] = new Checkpoint();
  412. $checkpoint[0]->race_id = $race->id;
  413. $checkpoint[0]->name = "";
  414. $checkpoint[0]->city = $cities[0];
  415. $checkpoint[0]->max_speed = $race->max_speed;
  416. $checkpoint[0]->road_situation = mt_rand(1, 5);
  417. foreach($cities as $x => $k) {
  418. if($x == 0) {
  419. continue;
  420. }
  421. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  422. }
  423. break;
  424. case 223:
  425. $cities = array("نهاوند",
  426. "بروجرد",
  427. "خرم آباد",
  428. "دورود",
  429. "الیگودرز",
  430. "فریدونشهر",
  431. "چلگرد",
  432. "فریدونشهر",
  433. "الیگودرز");
  434. $kilometers = array("0",
  435. "300",
  436. "600",
  437. "800",
  438. "950",
  439. "1100",
  440. "1200",
  441. "1350",
  442. "1500");
  443. $checkpoint[0] = new Checkpoint();
  444. $checkpoint[0]->race_id = $race->id;
  445. $checkpoint[0]->name = "";
  446. $checkpoint[0]->city = $cities[0];
  447. $checkpoint[0]->max_speed = $race->max_speed;
  448. $checkpoint[0]->road_situation = mt_rand(1, 5);
  449. foreach($cities as $x => $k) {
  450. if($x == 0) {
  451. continue;
  452. }
  453. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  454. }
  455. break;
  456. case 231:
  457. $cities = array("همدان",
  458. "سنقر",
  459. "کرمانشاه",
  460. "کنگاور",
  461. "نهاوند",
  462. "بروجرد",
  463. "خرم آباد",
  464. "دورود",
  465. "الیگودرز",
  466. "فریدونشهر",
  467. "چلگرد",
  468. "شلمزار");
  469. $kilometers = array("0",
  470. "300",
  471. "600",
  472. "800",
  473. "950",
  474. "1100",
  475. "1300",
  476. "1450",
  477. "1600",
  478. "1750",
  479. "1900",
  480. "2000");
  481. $checkpoint[0] = new Checkpoint();
  482. $checkpoint[0]->race_id = $race->id;
  483. $checkpoint[0]->name = "";
  484. $checkpoint[0]->city = $cities[0];
  485. $checkpoint[0]->max_speed = $race->max_speed;
  486. $checkpoint[0]->road_situation = mt_rand(1, 5);
  487. foreach($cities as $x => $k) {
  488. if($x == 0) {
  489. continue;
  490. }
  491. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(1, 5), $k, $kilometers[$x]);
  492. }
  493. break;
  494. case 311:
  495. $cities = array("آستارا",
  496. "بندرانزلی",
  497. "لاهیجان",
  498. "رودبار",
  499. "فومن",
  500. "تالش",
  501. "اردبیل");
  502. $kilometers = array("0",
  503. "300",
  504. "450",
  505. "550",
  506. "650",
  507. "750",
  508. "800");
  509. $checkpoint[0] = new Checkpoint();
  510. $checkpoint[0]->race_id = $race->id;
  511. $checkpoint[0]->name = "";
  512. $checkpoint[0]->city = $cities[0];
  513. $checkpoint[0]->max_speed = $race->max_speed;
  514. $checkpoint[0]->road_situation = mt_rand(2, 4);
  515. foreach($cities as $x => $k) {
  516. if($x == 0) {
  517. continue;
  518. }
  519. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  520. }
  521. break;
  522. case 312:
  523. $cities = array("بابلسر",
  524. "نور",
  525. "رامسر",
  526. "نوشهر",
  527. "کلاردشت",
  528. "تنکابن",
  529. "لنگرود");
  530. $kilometers = array("0",
  531. "300",
  532. "450",
  533. "550",
  534. "650",
  535. "750",
  536. "800");
  537. $checkpoint[0] = new Checkpoint();
  538. $checkpoint[0]->race_id = $race->id;
  539. $checkpoint[0]->name = "";
  540. $checkpoint[0]->city = $cities[0];
  541. $checkpoint[0]->max_speed = $race->max_speed;
  542. $checkpoint[0]->road_situation = mt_rand(2, 4);
  543. foreach($cities as $x => $k) {
  544. if($x == 0) {
  545. continue;
  546. }
  547. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  548. }
  549. break;
  550. case 313:
  551. $cities = array("گرگان",
  552. "ساری",
  553. "نور",
  554. "رامسر",
  555. "لوشان",
  556. "خلخال",
  557. "سراب");
  558. $kilometers = array("0",
  559. "300",
  560. "450",
  561. "550",
  562. "650",
  563. "750",
  564. "800");
  565. $checkpoint[0] = new Checkpoint();
  566. $checkpoint[0]->race_id = $race->id;
  567. $checkpoint[0]->name = "";
  568. $checkpoint[0]->city = $cities[0];
  569. $checkpoint[0]->max_speed = $race->max_speed;
  570. $checkpoint[0]->road_situation = mt_rand(2, 4);
  571. foreach($cities as $x => $k) {
  572. if($x == 0) {
  573. continue;
  574. }
  575. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  576. }
  577. break;
  578. case 321:
  579. $cities = array("گنبدکاووس",
  580. "بندرترکمن",
  581. "بابلسر",
  582. "نوشهر",
  583. "کلاردشت",
  584. "تنکابن",
  585. "لنگرود",
  586. "صومعه سرا",
  587. "رودبار");
  588. $kilometers = array("0",
  589. "300",
  590. "600",
  591. "800",
  592. "950",
  593. "1100",
  594. "1200",
  595. "1350",
  596. "1500");
  597. $checkpoint[0] = new Checkpoint();
  598. $checkpoint[0]->race_id = $race->id;
  599. $checkpoint[0]->name = "";
  600. $checkpoint[0]->city = $cities[0];
  601. $checkpoint[0]->max_speed = $race->max_speed;
  602. $checkpoint[0]->road_situation = mt_rand(2, 4);
  603. foreach($cities as $x => $k) {
  604. if($x == 0) {
  605. continue;
  606. }
  607. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  608. }
  609. break;
  610. case 322:
  611. $cities = array("ساری",
  612. "نور",
  613. "رامسر",
  614. "لوشان",
  615. "خلخال",
  616. "سراب",
  617. "تبریز",
  618. "سلماس",
  619. "ارومیه");
  620. $kilometers = array("0",
  621. "300",
  622. "600",
  623. "800",
  624. "950",
  625. "1100",
  626. "1200",
  627. "1350",
  628. "1500");
  629. $checkpoint[0] = new Checkpoint();
  630. $checkpoint[0]->race_id = $race->id;
  631. $checkpoint[0]->name = "";
  632. $checkpoint[0]->city = $cities[0];
  633. $checkpoint[0]->max_speed = $race->max_speed;
  634. $checkpoint[0]->road_situation = mt_rand(2, 4);
  635. foreach($cities as $x => $k) {
  636. if($x == 0) {
  637. continue;
  638. }
  639. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  640. }
  641. break;
  642. case 323:
  643. $cities = array("نور",
  644. "رامسر",
  645. "لوشان",
  646. "خلخال",
  647. "سراب",
  648. "تبریز",
  649. "سلماس",
  650. "ارومیه",
  651. "سقز");
  652. $kilometers = array("0",
  653. "300",
  654. "600",
  655. "800",
  656. "950",
  657. "1100",
  658. "1200",
  659. "1350",
  660. "1500");
  661. $checkpoint[0] = new Checkpoint();
  662. $checkpoint[0]->race_id = $race->id;
  663. $checkpoint[0]->name = "";
  664. $checkpoint[0]->city = $cities[0];
  665. $checkpoint[0]->max_speed = $race->max_speed;
  666. $checkpoint[0]->road_situation = mt_rand(2, 4);
  667. foreach($cities as $x => $k) {
  668. if($x == 0) {
  669. continue;
  670. }
  671. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  672. }
  673. break;
  674. case 331:
  675. $cities = array("شاهرود",
  676. "گرگان",
  677. "ساری",
  678. "نور",
  679. "رامسر",
  680. "لوشان",
  681. "خلخال",
  682. "سراب",
  683. "تبریز",
  684. "سلماس",
  685. "ارومیه",
  686. "سقز");
  687. $kilometers = array("0",
  688. "300",
  689. "600",
  690. "800",
  691. "950",
  692. "1100",
  693. "1300",
  694. "1450",
  695. "1600",
  696. "1750",
  697. "1900",
  698. "2000");
  699. $checkpoint[0] = new Checkpoint();
  700. $checkpoint[0]->race_id = $race->id;
  701. $checkpoint[0]->name = "";
  702. $checkpoint[0]->city = $cities[0];
  703. $checkpoint[0]->max_speed = $race->max_speed;
  704. $checkpoint[0]->road_situation = mt_rand(2, 4);
  705. foreach($cities as $x => $k) {
  706. if($x == 0) {
  707. continue;
  708. }
  709. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(2, 4), $k, $kilometers[$x]);
  710. }
  711. break;
  712. case 411:
  713. $cities = array("دلیجان",
  714. "بادرود",
  715. "نایین",
  716. "انارک",
  717. "خور",
  718. "خوانق",
  719. "اردکان");
  720. $kilometers = array("0",
  721. "300",
  722. "450",
  723. "550",
  724. "650",
  725. "750",
  726. "800");
  727. $checkpoint[0] = new Checkpoint();
  728. $checkpoint[0]->race_id = $race->id;
  729. $checkpoint[0]->name = "";
  730. $checkpoint[0]->city = $cities[0];
  731. $checkpoint[0]->max_speed = $race->max_speed;
  732. $checkpoint[0]->road_situation = mt_rand(0, 1);
  733. foreach($cities as $x => $k) {
  734. if($x == 0) {
  735. continue;
  736. }
  737. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  738. }
  739. break;
  740. case 412:
  741. $cities = array("جیرفت",
  742. "بافت",
  743. "کرمان",
  744. "راور",
  745. "دیهوک",
  746. "کاشمر",
  747. "فردوس");
  748. $kilometers = array("0",
  749. "300",
  750. "450",
  751. "550",
  752. "650",
  753. "750",
  754. "800");
  755. $checkpoint[0] = new Checkpoint();
  756. $checkpoint[0]->race_id = $race->id;
  757. $checkpoint[0]->name = "";
  758. $checkpoint[0]->city = $cities[0];
  759. $checkpoint[0]->max_speed = $race->max_speed;
  760. $checkpoint[0]->road_situation = mt_rand(0, 1);
  761. foreach($cities as $x => $k) {
  762. if($x == 0) {
  763. continue;
  764. }
  765. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  766. }
  767. break;
  768. case 413:
  769. $cities = array("کرمان",
  770. "بافت",
  771. "راور",
  772. "دیهوک",
  773. "فردوس",
  774. "کاشمر",
  775. "نیشابور");
  776. $kilometers = array("0",
  777. "300",
  778. "450",
  779. "550",
  780. "650",
  781. "750",
  782. "800");
  783. $checkpoint[0] = new Checkpoint();
  784. $checkpoint[0]->race_id = $race->id;
  785. $checkpoint[0]->name = "";
  786. $checkpoint[0]->city = $cities[0];
  787. $checkpoint[0]->max_speed = $race->max_speed;
  788. $checkpoint[0]->road_situation = mt_rand(0, 1);
  789. foreach($cities as $x => $k) {
  790. if($x == 0) {
  791. continue;
  792. }
  793. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  794. }
  795. break;
  796. case 421:
  797. $cities = array("بم",
  798. "جیرفت",
  799. "بافت",
  800. "کرمان",
  801. "راور",
  802. "دیهوک",
  803. "فردوس",
  804. "کاشمر",
  805. "نیشابور");
  806. $kilometers = array("0",
  807. "300",
  808. "600",
  809. "800",
  810. "950",
  811. "1100",
  812. "1200",
  813. "1350",
  814. "1500");
  815. $checkpoint[0] = new Checkpoint();
  816. $checkpoint[0]->race_id = $race->id;
  817. $checkpoint[0]->name = "";
  818. $checkpoint[0]->city = $cities[0];
  819. $checkpoint[0]->max_speed = $race->max_speed;
  820. $checkpoint[0]->road_situation = mt_rand(0, 1);
  821. foreach($cities as $x => $k) {
  822. if($x == 0) {
  823. continue;
  824. }
  825. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  826. }
  827. break;
  828. case 422:
  829. $cities = array("زابل",
  830. "زاهدان",
  831. "محمدآباد",
  832. "ایرانشهر",
  833. "خاش",
  834. "زابلی",
  835. "راسک",
  836. "نیکشهر",
  837. "چابهار");
  838. $kilometers = array("0",
  839. "300",
  840. "600",
  841. "800",
  842. "950",
  843. "1100",
  844. "1200",
  845. "1350",
  846. "1500");
  847. $checkpoint[0] = new Checkpoint();
  848. $checkpoint[0]->race_id = $race->id;
  849. $checkpoint[0]->name = "";
  850. $checkpoint[0]->city = $cities[0];
  851. $checkpoint[0]->max_speed = $race->max_speed;
  852. $checkpoint[0]->road_situation = mt_rand(0, 1);
  853. foreach($cities as $x => $k) {
  854. if($x == 0) {
  855. continue;
  856. }
  857. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  858. }
  859. break;
  860. case 423:
  861. $cities = array("بیرجند",
  862. "نهبندان",
  863. "زابل",
  864. "زاهدان",
  865. "محمدآباد",
  866. "ایرانشهر",
  867. "خاش",
  868. "راسک",
  869. "نیکشهر");
  870. $kilometers = array("0",
  871. "300",
  872. "600",
  873. "800",
  874. "950",
  875. "1100",
  876. "1200",
  877. "1350",
  878. "1500");
  879. $checkpoint[0] = new Checkpoint();
  880. $checkpoint[0]->race_id = $race->id;
  881. $checkpoint[0]->name = "";
  882. $checkpoint[0]->city = $cities[0];
  883. $checkpoint[0]->max_speed = $race->max_speed;
  884. $checkpoint[0]->road_situation = mt_rand(0, 1);
  885. foreach($cities as $x => $k) {
  886. if($x == 0) {
  887. continue;
  888. }
  889. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  890. }
  891. break;
  892. case 431:
  893. $cities = array("طبس",
  894. "بیرجند",
  895. "نهبندان",
  896. "زابل",
  897. "زاهدان",
  898. "محمدآباد",
  899. "ایرانشهر",
  900. "خاش",
  901. "زابلی",
  902. "راسک",
  903. "نیکشهر",
  904. "چابهار");
  905. $kilometers = array("0",
  906. "300",
  907. "600",
  908. "800",
  909. "950",
  910. "1100",
  911. "1300",
  912. "1450",
  913. "1600",
  914. "1750",
  915. "1900",
  916. "2000");
  917. $checkpoint[0] = new Checkpoint();
  918. $checkpoint[0]->race_id = $race->id;
  919. $checkpoint[0]->name = "";
  920. $checkpoint[0]->city = $cities[0];
  921. $checkpoint[0]->max_speed = $race->max_speed;
  922. $checkpoint[0]->road_situation = mt_rand(0, 1);
  923. foreach($cities as $x => $k) {
  924. if($x == 0) {
  925. continue;
  926. }
  927. $checkpoint[] = Checkpoint::add_checkpoint($checkpoint[0], mt_rand(0, 1), $k, $kilometers[$x]);
  928. }
  929. break;
  930. }
  931. return $checkpoint;
  932. }
  933. }