1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71: 72: 73: 74: 75: 76: 77: 78: 79: 80: 81: 82: 83: 84: 85: 86: 87: 88: 89: 90: 91: 92: 93: 94: 95: 96: 97: 98: 99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621: 622: 623: 624: 625: 626: 627: 628: 629: 630: 631: 632: 633: 634: 635: 636: 637: 638: 639: 640: 641: 642: 643: 644: 645: 646: 647: 648: 649: 650: 651: 652: 653: 654: 655: 656: 657: 658: 659: 660: 661: 662: 663: 664: 665: 666: 667: 668: 669: 670: 671: 672: 673: 674: 675: 676: 677: 678: 679: 680: 681: 682: 683: 684: 685: 686: 687: 688: 689: 690: 691: 692: 693: 694: 695: 696: 697: 698: 699: 700: 701: 702: 703: 704: 705: 706: 707: 708: 709: 710: 711: 712: 713: 714: 715: 716: 717: 718: 719: 720: 721: 722: 723: 724: 725: 726: 727: 728: 729: 730: 731: 732: 733: 734: 735: 736: 737: 738: 739: 740: 741: 742: 743: 744: 745: 746: 747: 748: 749: 750: 751: 752: 753: 754: 755: 756: 757: 758: 759: 760: 761: 762: 763: 764: 765: 766: 767: 768: 769: 770: 771: 772: 773: 774: 775: 776: 777: 778: 779: 780: 781: 782: 783: 784: 785: 786: 787: 788: 789: 790: 791: 792: 793: 794: 795: 796: 797: 798: 799: 800: 801: 802: 803: 804: 805: 806: 807: 808: 809: 810: 811: 812: 813: 814: 815: 816: 817: 818: 819: 820: 821: 822: 823: 824: 825: 826: 827: 828: 829: 830: 831: 832: 833: 834: 835: 836: 837: 838: 839: 840: 841: 842: 843: 844: 845: 846: 847: 848: 849: 850: 851: 852: 853: 854: 855: 856: 857: 858: 859: 860: 861: 862: 863: 864: 865: 866: 867: 868: 869: 870: 871: 872: 873: 874: 875: 876: 877: 878: 879: 880: 881: 882: 883: 884: 885: 886: 887: 888: 889: 890: 891: 892: 893: 894: 895: 896: 897: 898: 899: 900: 901: 902: 903: 904: 905: 906: 907: 908: 909: 910: 911: 912: 913: 914: 915: 916: 917: 918: 919: 920: 921: 922: 923: 924: 925: 926: 927: 928: 929: 930: 931: 932: 933: 934: 935: 936: 937: 938: 939: 940: 941: 942: 943: 944: 945: 946: 947: 948: 949: 950: 951: 952: 953: 954: 955: 956: 957: 958: 959: 960: 961: 962: 963: 964: 965: 966: 967: 968: 969: 970: 971: 972: 973: 974: 975: 976: 977: 978: 979: 980: 981: 982: 983: 984: 985: 986: 987: 988: 989: 990: 991: 992: 993: 994: 995: 996: 997: 998: 999: 1000: 1001: 1002: 1003: 1004: 1005: 1006: 1007: 1008: 1009: 1010: 1011: 1012: 1013: 1014: 1015: 1016: 1017: 1018: 1019: 1020: 1021: 1022: 1023: 1024: 1025: 1026: 1027: 1028: 1029: 1030: 1031: 1032: 1033: 1034: 1035: 1036: 1037: 1038: 1039: 1040: 1041: 1042: 1043: 1044: 1045: 1046: 1047: 1048: 1049: 1050: 1051: 1052: 1053: 1054: 1055: 1056: 1057: 1058: 1059: 1060: 1061: 1062: 1063: 1064: 1065: 1066: 1067: 1068: 1069: 1070: 1071: 1072: 1073: 1074: 1075: 1076: 1077: 1078: 1079: 1080: 1081: 1082: 1083: 1084: 1085: 1086: 1087: 1088: 1089: 1090: 1091: 1092: 1093: 1094: 1095: 1096: 1097: 1098: 1099: 1100: 1101: 1102: 1103: 1104: 1105: 1106: 1107: 1108: 1109: 1110: 1111: 1112: 1113: 1114: 1115: 1116: 1117: 1118: 1119: 1120: 1121: 1122: 1123: 1124: 1125: 1126: 1127: 1128: 1129: 1130: 1131: 1132: 1133: 1134: 1135: 1136: 1137: 1138: 1139: 1140: 1141: 1142: 1143: 1144: 1145: 1146: 1147: 1148: 1149: 1150: 1151: 1152: 1153: 1154: 1155: 1156: 1157: 1158: 1159: 1160: 1161: 1162: 1163: 1164: 1165: 1166: 1167: 1168: 1169: 1170: 1171: 1172: 1173: 1174: 1175: 1176: 1177: 1178: 1179: 1180: 1181: 1182: 1183: 1184: 1185: 1186: 1187: 1188: 1189: 1190: 1191: 1192: 1193: 1194: 1195: 1196: 1197: 1198: 1199: 1200: 1201: 1202: 1203: 1204: 1205: 1206: 1207: 1208: 1209: 1210: 1211: 1212: 1213: 1214: 1215: 1216: 1217: 1218: 1219: 1220: 1221: 1222: 1223: 1224: 1225: 1226: 1227: 1228: 1229: 1230: 1231: 1232: 1233: 1234: 1235: 1236: 1237: 1238: 1239: 1240: 1241: 1242: 1243: 1244: 1245: 1246: 1247: 1248: 1249: 1250: 1251: 1252: 1253: 1254: 1255: 1256: 1257: 1258: 1259: 1260: 1261: 1262: 1263: 1264: 1265: 1266: 1267: 1268: 1269: 1270: 1271: 1272: 1273: 1274: 1275: 1276: 1277: 1278: 1279: 1280: 1281: 1282: 1283: 1284: 1285: 1286: 1287: 1288: 1289: 1290: 1291: 1292: 1293: 1294: 1295: 1296: 1297: 1298: 1299: 1300: 1301: 1302: 1303: 1304: 1305: 1306: 1307: 1308: 1309: 1310: 1311: 1312: 1313: 1314: 1315: 1316: 1317: 1318: 1319: 1320: 1321: 1322: 1323: 1324: 1325: 1326: 1327: 1328: 1329: 1330: 1331: 1332: 1333: 1334: 1335: 1336: 1337: 1338: 1339: 1340: 1341: 1342: 1343: 1344: 1345: 1346: 1347: 1348: 1349: 1350: 1351: 1352: 1353: 1354: 1355: 1356: 1357: 1358: 1359: 1360: 1361: 1362: 1363: 1364: 1365: 1366: 1367: 1368: 1369: 1370: 1371: 1372: 1373: 1374: 1375: 1376: 1377: 1378: 1379: 1380: 1381: 1382: 1383: 1384: 1385: 1386: 1387: 1388: 1389: 1390: 1391: 1392: 1393: 1394: 1395: 1396: 1397: 1398: 1399: 1400: 1401: 1402: 1403: 1404: 1405: 1406: 1407: 1408: 1409: 1410: 1411: 1412: 1413: 1414: 1415: 1416: 1417: 1418: 1419: 1420: 1421: 1422: 1423: 1424: 1425: 1426: 1427: 1428: 1429: 1430: 1431: 1432: 1433: 1434: 1435: 1436: 1437: 1438: 1439: 1440: 1441: 1442: 1443: 1444: 1445: 1446: 1447: 1448: 1449: 1450: 1451: 1452: 1453: 1454: 1455: 1456: 1457: 1458: 1459: 1460: 1461: 1462: 1463: 1464: 1465: 1466: 1467: 1468: 1469: 1470: 1471: 1472: 1473: 1474: 1475: 1476: 1477: 1478: 1479: 1480: 1481: 1482: 1483: 1484: 1485: 1486: 1487: 1488: 1489: 1490: 1491: 1492: 1493: 1494: 1495: 1496: 1497: 1498: 1499: 1500: 1501: 1502: 1503: 1504: 1505: 1506: 1507: 1508: 1509: 1510: 1511: 1512: 1513: 1514: 1515: 1516: 1517: 1518: 1519: 1520: 1521: 1522: 1523: 1524: 1525: 1526: 1527: 1528: 1529: 1530: 1531: 1532: 1533: 1534: 1535: 1536: 1537: 1538: 1539: 1540: 1541: 1542: 1543: 1544: 1545: 1546: 1547: 1548: 1549: 1550: 1551: 1552: 1553: 1554: 1555: 1556: 1557: 1558: 1559: 1560: 1561: 1562: 1563: 1564: 1565: 1566: 1567: 1568: 1569: 1570: 1571: 1572: 1573: 1574: 1575: 1576: 1577: 1578: 1579: 1580: 1581: 1582: 1583: 1584: 1585: 1586: 1587: 1588: 1589: 1590: 1591: 1592: 1593: 1594: 1595: 1596: 1597: 1598: 1599: 1600: 1601: 1602: 1603: 1604: 1605: 1606: 1607: 1608: 1609: 1610: 1611: 1612: 1613: 1614: 1615: 1616: 1617: 1618: 1619: 1620: 1621: 1622: 1623: 1624: 1625: 1626: 1627: 1628: 1629: 1630: 1631: 1632: 1633: 1634: 1635: 1636: 1637: 1638: 1639: 1640: 1641: 1642: 1643: 1644: 1645: 1646: 1647: 1648: 1649: 1650: 1651: 1652: 1653: 1654: 1655: 1656: 1657: 1658: 1659: 1660: 1661: 1662: 1663: 1664: 1665: 1666: 1667: 1668: 1669: 1670: 1671: 1672: 1673: 1674: 1675: 1676: 1677: 1678: 1679: 1680: 1681: 1682: 1683: 1684: 1685: 1686: 1687: 1688: 1689: 1690: 1691: 1692: 1693: 1694: 1695: 1696: 1697: 1698: 1699: 1700: 1701: 1702: 1703: 1704: 1705: 1706: 1707: 1708: 1709: 1710: 1711: 1712: 1713: 1714: 1715: 1716: 1717: 1718: 1719: 1720: 1721: 1722: 1723: 1724: 1725: 1726: 1727: 1728: 1729: 1730: 1731: 1732: 1733: 1734: 1735: 1736: 1737: 1738: 1739: 1740: 1741: 1742: 1743: 1744: 1745: 1746: 1747: 1748: 1749: 1750: 1751: 1752: 1753: 1754: 1755: 1756: 1757: 1758: 1759: 1760: 1761: 1762: 1763: 1764: 1765: 1766: 1767: 1768: 1769: 1770: 1771: 1772: 1773: 1774: 1775: 1776: 1777: 1778: 1779: 1780: 1781: 1782: 1783: 1784: 1785: 1786: 1787: 1788: 1789: 1790: 1791: 1792: 1793: 1794: 1795: 1796: 1797: 1798: 1799: 1800: 1801: 1802: 1803: 1804: 1805: 1806: 1807: 1808: 1809: 1810: 1811: 1812: 1813: 1814: 1815: 1816: 1817: 1818: 1819: 1820: 1821: 1822: 1823: 1824: 1825: 1826: 1827: 1828: 1829: 1830: 1831: 1832: 1833: 1834: 1835: 1836: 1837: 1838: 1839: 1840: 1841: 1842: 1843: 1844: 1845: 1846: 1847: 1848: 1849: 1850: 1851: 1852: 1853: 1854: 1855: 1856: 1857: 1858: 1859: 1860: 1861: 1862: 1863: 1864: 1865: 1866: 1867: 1868: 1869: 1870: 1871: 1872: 1873: 1874: 1875: 1876: 1877: 1878: 1879: 1880: 1881: 1882: 1883: 1884: 1885: 1886: 1887: 1888: 1889: 1890: 1891: 1892: 1893: 1894: 1895: 1896: 1897: 1898: 1899: 1900: 1901: 1902: 1903: 1904: 1905: 1906: 1907: 1908: 1909: 1910: 1911: 1912: 1913: 1914: 1915: 1916: 1917: 1918: 1919: 1920: 1921: 1922: 1923: 1924: 1925: 1926: 1927: 1928: 1929: 1930: 1931: 1932: 1933: 1934: 1935: 1936: 1937: 1938: 1939: 1940: 1941: 1942: 1943: 1944: 1945: 1946: 1947: 1948: 1949: 1950: 1951: 1952: 1953:
<?php
class PHPShopGUI {
var $css;
var $dir = '../';
var $includeJava;
var $includeCss;
var $padding = 5;
var $margin = 5;
var $tab_pre = '_';
var $form_enabled = true;
var $sidebarLeftCell = 2;
var $sidebarLeftRight = 2;
var $dropdown_action_form = true;
var $tab_key = 0;
function __construct() {
PHPShopObj::loadClass("lang");
}
function setGrid() {
$Arg = func_get_args();
$dis = '<div class="row">';
foreach ($Arg as $val) {
if (is_array($val))
$dis.='<div class="col-md-' . $val[1] . '">' . $val[0] . '</div>';
}
$dis.='</div>';
return $dis;
}
function i($img, $class = null) {
return '<span class="glyphicon glyphicon-' . $img . ' ' . $class . '"></span> ';
}
function setIcon($data, $id = "icon_new", $alt = true, $option = array('load' => true, 'server' => true, 'url' => true, 'multi' => false), $width = false) {
if (!empty($data)) {
$name = '<span data-icon="' . $id . '">' . $data . '</span>';
if (!empty($width))
$width = 'style="max-width:' . $width . 'px"';
$icon = '<img src="' . $data . '" data-thumbnail="' . $id . '" onerror="imgerror(this)" class="img-thumbnail" ' . $width . '>';
$icon_hide = $drag = '';
} else {
$icon = '<img class="img-thumbnail img-thumbnail-dashed" data-thumbnail="' . $id . '" src="images/no_photo.gif">';
$name = '<span data-icon="' . $id . '';
$icon_hide = 'hide';
$drag = '<input type="file" name="file" data-target="' . $id . '">';
}
$add = $help = null;
if (!empty($option['load']))
$add.='' . $id . '"></span>';
if (!empty($option['multi']))
$add.='';
if (!empty($option['server']))
$add.='<button type="button" class="btn btn-default" data-return="return=' . $id . '';
if (!empty($option['url']))
$add.='<button type="button" class="btn btn-default" id="promtUrl" data-target="' . $id . '">URL</button>
<input type="hidden" name="furl" id="furl" value="0">';
$dis = '
<div class="row">
<div class="col-md-2 btn-file"><a href="#" class="link-thumbnail">' . $icon . '</a>' . $drag . '</span>';
if ($alt)
$dis.='<div class="input-group" style="margin-top:10px">
<input class="form-control input-sm" name="info_' . $id . '" value="' . $alt . '" placeholder="Alt" type="text">
</div>';
$dis.='
</div>
<div class="col-md-10">
<p><span class="remove glyphicon glyphicon-remove-sign ' . $icon_hide . '" data-return="' . $id . '' . $name . '</p><input type="hidden" name="' . $id . '" value="' . $data . '">
<div class="btn-group btn-group-sm" role="group" aria-label="...">
' . $add . '
</div>
</div>
</div>';
return $dis;
}
function setFile($data = null, $id = "lfile", $option = array('load' => true, 'server' => 'file', 'url' => true)) {
if (!empty($data)) {
$name = '<span data-icon="' . $id . '">' . $data . '</span>';
$icon_hide = '';
} else {
$name = '<span data-icon="' . $id . '';
$icon_hide = 'hide';
}
$add = null;
if (!empty($option['load']))
$add.='' . $id . '"></span>';
if (!empty($option['server']))
$add.='<button type="button" class="btn btn-default" id="server" data-return="return=' . $id . '" data-toggle="modal" data-target="#elfinderModal" data-path="' . $option['server'] . '';
if (!empty($option['url']))
$add.='<button type="button" class="btn btn-default" id="promtUrl" data-target="' . $id . '">URL</button><input type="hidden" name="furl" id="furl" value="0">';
$dis.='
<p><span class="remove glyphicon glyphicon-remove-sign ' . $icon_hide . '" data-return="' . $id . '' . $name . '</p><input type="hidden" name="' . $id . '" id="' . $id . '" value="' . $data . '" >
<div class="btn-group btn-group-sm" role="group" aria-label="...">
' . $add . '
</div>
';
return $dis;
}
function setAlert($text, $type = 'success') {
return '<div class="alert alert-' . $type . ' alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
' . $text . '</div>';
}
function setProgress($title, $class = false, $width = '100%') {
return '
<div class="progress ' . $class . '"><div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="5" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width . '">' . $title . '</div></div> ';
}
function setSidebarLeft($data = array(), $cell = 2, $hide_mobile = false) {
$dis = null;
$i = 1;
if (is_array($data))
foreach ($data as $key => $val)
if (is_array($val)) {
$dis.='<div class="sidebar-data ' . $hide_mobile . ' ' . $val['class'] . '" id="' . $val['id'] . '">';
if (!empty($val['title-icon']))
$dis.='<span class="pull-right title-icon">' . $val['title-icon'] . '</span>';
$dis.='<h6>' . $val['title'] . '</h6>';
$dis.='<div class="row">';
if (!empty($val['icon'])) {
$cell_icon = 1;
$cell_info = 10;
} else {
$cell_icon = 0;
$cell_info = 12;
$icon_class = 'hide';
}
$dis.='<div class="col-md-' . $cell_icon . ' ' . $icon_class . ' "><span class="glyphicon glyphicon-' . $val['icon'] . '"></span></div>';
$dis.='<div class="col-md-' . $cell_info . '"><adress>';
if (is_array($val['name'])) {
$dis.='<strong><a href="' . $val['name']['link'] . '" class="sidebar-data-0">' . $val['name']['caption'] . '</a></strong><br>';
} elseif (!empty($val['name']))
$dis.='<strong class="sidebar-data-0">' . $val['name'] . '</strong><br>';
if (is_array($val['content']))
foreach ($val['content'] as $key => $list) {
if (is_array($list)) {
$dis.='<a href="' . $list['link'] . '" class="sidebar-data-' . ($key + 1) . '">' . $list['caption'] . '</a><br>';
}
else
$dis.='<span class="sidebar-data-' . ($key + 1) . '">' . $list . '</span><br>';
}
else
$dis.=$val['content'];
$dis.='</adress>
</div>
</div>
</div>';
if ($i < count($data))
$dis.='<hr>';
$i++;
}
if ($hide_mobile)
$hide_mobile = 'hidden-xs';
$this->sidebarLeft = '<div class="col-md-' . $cell . ' sidebar-left ' . $hide_mobile . '">' . $dis . '</div>';
}
function setSidebarRight($data = array(), $cell = 2) {
$dis = null;
$i = 1;
if (is_array($data))
foreach ($data as $key => $val)
if (is_array($val)) {
$dis.='<div class="sidebar-data" id="' . $val['idelement'] . '">';
$dis.='<h6>' . $val['title'] . '</h6>';
$dis.='<div class="row">';
if (!empty($val['icon'])) {
$cell_icon = 2;
$cell_info = 10;
} else {
$cell_icon = 0;
$cell_info = 12;
$icon_class = 'hide';
}
$dis.='<div class="col-md-' . $cell_icon . ' ' . $icon_class . '"><span class="glyphicon glyphicon-' . $val['icon'] . '"></span></div>';
$dis.='<div class="col-md-' . $cell_info . '"><adress>';
if (is_array($val['name'])) {
$dis.='<strong><a href="' . $val['name']['link'] . '">' . $val['name']['caption'] . '</a></strong><br>';
} elseif (!empty($val['name']))
$dis.='<strong>' . $val['name'] . '</strong><br>';
if (is_array($val['content']))
foreach ($val['content'] as $list) {
if (is_array($list)) {
$dis.='<a href="' . $list['link'] . '">' . $list['caption'] . '</a><br>';
}
else
$dis.=$list;
}
else
$dis.=$val['content'];
$dis.='</adress>
</div>
</div>
</div>';
if ($i < count($data))
$dis.='<hr>';
$i++;
}
$this->sidebarRight = '<div class="col-md-' . $cell . ' sidebar-right">' . $dis . '</div>';
}
function setActionPanel($title, $action = array(), $button = array()) {
global $subpath;
if (empty($GLOBALS['isFrame'])) {
if ($subpath[0] != 'modules') {
$xs_class = ' hidden-xs';
$xs_btn_name = '';
$addFrameLink = null;
} else {
$xs_class = null;
$xs_btn_name = '';
$addFrameLink = '&frame=true';
}
$btnBack = '';
} else {
$addFrameLink = '&frame=true';
$btnBack = '';
}
$this->action_button[''] = array(
'name' => '',
'action' => 'editID',
'class' => 'btn btn-default btn-sm navbar-btn',
'type' => 'submit',
'icon' => 'glyphicon glyphicon-floppy-saved'
);
$this->action_button[''] = array(
'name' => '',
'action' => 'saveID',
'class' => 'btn btn-default btn-sm navbar-btn',
'type' => 'submit',
'icon' => 'glyphicon glyphicon-floppy-saved'
);
$this->action_button[''] = array(
'name' => $xs_btn_name,
'action' => 'saveID',
'class' => 'btn btn-default btn-sm navbar-btn' . $xs_class . $GLOBALS['isFrame'],
'type' => 'submit',
'icon' => 'glyphicon glyphicon-ok'
);
$this->action_button[''] = array(
'name' => '',
'action' => '',
'class' => 'btn btn-default btn-sm navbar-btn btn-action-back',
'type' => 'button',
'icon' => 'glyphicon glyphicon-remove'
);
$this->action_button[''] = array(
'name' => '',
'action' => 'addNew',
'class' => 'btn btn-default btn-sm navbar-btn',
'type' => 'button',
'icon' => 'glyphicon glyphicon-plus',
'tooltip' => '' . $title . '"'
);
$this->action_select[''] = array(
'name' => '',
'action' => 'select',
'class' => 'disabled',
'url' => '#'
);
$this->action_select['CSV'] = array(
'name' => '',
'action' => 'export-select',
'class' => 'disabled'
);
$this->action_select[''] = array(
'name' => '',
'action' => 'edit',
'url' => '#'
);
$this->action_select[''] = array(
'name' => '',
'action' => 'deleteone',
'url' => '#'
);
$this->action_select[''] = array(
'name' => '',
'action' => 'reset',
'url' => '#'
);
$this->action_select[''] = array(
'name' => '',
'action' => 'new' . $GLOBALS['isFrame'],
'url' => '#'
);
$this->action_select['Export'] = array(
'name' => '',
'action' => 'export',
'url' => '#'
);
$this->action_select['|'] = array(
'action' => 'divider' . $GLOBALS['isFrame'],
);
$this->action_select[''] = array(
'name' => '',
'url' => '?path=' . $_GET['path'] . '&action=new&id=' . $_GET['id'] . $addFrameLink,
'action' => $GLOBALS['isFrame']
);
if (!empty($_GET['return'])) {
$back['url'] = $_GET['return'];
}
else
$back['url'] = $_GET['path'];
if (empty($_GET['id']))
$back['class'] = 'back';
else
$back['class'] = null;
$CODE = '
<!-- Action panell -->
<div class="navbar-header">
<a type="button" class="btn btn-default btn-sm navbar-btn pull-left ' . $back['class'] . ' check-frame" href="?path=' . $back['url'] . '">
<span class="glyphicon glyphicon-arrow-left"></span> ' . $btnBack . '</a>
<span class="navbar-brand hidden-xs ">' . $title . '</span>
</div>
<ul class="nav navbar-nav navbar-right pull-right">';
if (is_array($button)) {
foreach ($button as $val) {
if (!empty($this->action_button[$val]['type']))
$CODE.='<li><button ' . $this->action_button[$val]['tooltip'] . ' type="' . $this->action_button[$val]['type'] . '" name="' . $this->action_button[$val]['action'] . '" class="' . $this->action_button[$val]['class'] . '" value="' . $this->action_button[$val]['name'] . '"><span class="' . $this->action_button[$val]['icon'] . '"></span> ' . $this->action_button[$val]['name'] . '</button> </li>';
}
}
if (is_array($action)) {
$CODE.='<li class="hidden-xs"><button class="btn btn-default btn-sm navbar-btn" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-cog"></span> <span class="caret"></span></button>
<ul class="dropdown-menu select-action" role="menu">';
foreach ($action as $val) {
if (empty($this->action_select[$val]['name']))
$CODE.='<li class="' . $this->action_select[$val]['action'] . '"></li>';
else {
if (empty($this->action_select[$val]['target']))
$this->action_select[$val]['target'] = '_self';
$CODE.='<li class="' . $this->action_select[$val]['class'] . '"><a href="' . $this->action_select[$val]['url'] . '" class="' . $this->action_select[$val]['action'] . '" data-option="' . $this->action_select[$val]['data'] . '" target="' . $this->action_select[$val]['target'] . '"><span class="' . $this->action_select[$val]['icon'] . '"></span> ' . $this->action_select[$val]['name'] . '</a></li>';
}
}
$CODE.=' </ul>
</li>';
}
$CODE.=' </ul>';
$this->actionPanel = '<nav class="navbar-action">
<div class="container" style="' . $GLOBALS['frameWidth'] . '">' . $CODE . '</div>
</nav>
<!-- /.Action panell -->
<div id="fix-check" class="visible-lg"></div>
';
}
function setDropdown($Arg = array(), $expand = 'dropdown', $align = 'right', $passive = false) {
global $subpath;
$name = $Arg['caption'][$Arg['enable']];
if (empty($passive) and empty($Arg['enable']))
$passive = 'text-muted';
else
$passive = null;
$CODE = '<div class="' . $expand . '">
<a href="#" class="dropdown-toggle ' . $passive . '" data-toggle="' . $expand . '" style="color:' . $Arg['color'] . '" role="button" aria-expanded="false"><span id="dropdown_status_' . $Arg['id'] . '">' . $name . '</span> <span class="caret hidden-xs"></span></a>
<ul class="dropdown-menu dropdown-menu-' . $align . '" role="menu">';
if (is_array($Arg['caption']))
foreach ($Arg['caption'] as $key => $val) {
if ($key == $Arg['enable'])
$class = 'class="disabled"';
else
$class = null;
$CODE.='<li ' . $class . '><a href="#" data-id="' . $Arg['id'] . '" data-val="' . $key . '" class="status">' . $val . '</a></li>';
}
if (empty($this->path))
$this->path = $_GET['path'];
$CODE.= '</ul>
</div>';
if ($this->dropdown_action_form)
$CODE.='<form method="post" action="?path=' . $this->path . '&id=' . $Arg['id'] . '" class="status_edit_' . $Arg['id'] . '">
<input type="hidden" value="actionUpdate.' . $subpath[0] . '.edit" name="actionList[editID]">
<input type="hidden" value="1" name="ajax">
<input type="hidden" value="0" name="enabled_new">
<input type="hidden" value="0" name="flag_new">
<input type="hidden" value="0" name="statusi_new">
<input type="hidden" value="' . $Arg['id'] . '" name="rowID">
</form>
';
return $CODE;
}
function setDropdownAction($Arg = array()) {
global $subpath;
$this->action_title['edit'] = '';
$this->action_title['delete'] = '';
$this->action_title['view'] = '';
$this->action_title['copy'] = '';
$this->action_title['option'] = '';
$this->action_title['on'] = '';
$this->action_title['off'] = '';
$this->action_title['email'] = '';
$this->action_title['|'] = '|';
$CODE = '
<div class="dropdown none hidden-sm hidden-xs" id="dropdown_action">
<a href="#" class="dropdown-toggle btn btn-default btn-sm" data-toggle="dropdown" role="button" aria-expanded="false"><span class="glyphicon glyphicon-cog"></span> <span class="caret"></span></a>
<ul class="dropdown-menu dropdown-menu-right" role="menu" >';
foreach ($Arg as $val) {
if ($val != $Arg['id']) {
if (is_array($val)) {
$CODE.='<li><a href="' . $val['url'] . '">' . $val['name'] . '</a></li>';
} else {
if ($this->action_title[$val] == '|')
$CODE.='<li class="divider"></li>';
else
$CODE.='<li><a href="#" data-id="' . $Arg['id'] . '" class="' . $val . '">' . $this->action_title[$val] . '</a></li>';
}
}
}
if (empty($this->path))
$this->path = $_GET['path'];
$CODE.= '</ul>
</div>';
if ($this->dropdown_action_form)
$CODE.= '
<form method="post" action="?path=' . $this->path . '&id=' . $Arg['id'] . '" class="list_edit_' . $Arg['id'] . '">
<input type="hidden" value="actionDelete.' . $subpath[0] . '.edit" name="actionList[delID]">
<input type="hidden" value="1" name="ajax">
<input type="hidden" value="' . $Arg['id'] . '" name="rowID">
</form>
';
return $CODE;
}
function loadLib($file, $data, $path = false, $option = false) {
if (empty($path))
$path = $_GET['path'] . '/';
$class_path = $path . 'gui/' . $file . '.gui.php';
if (file_exists($class_path)) {
require_once($class_path);
return $file($data, $option);
}
else
echo "" . $class_path;
}
function setForm($value, $action = false, $name = "product_edit", $style = false, $target = false, $class = 'form-horizontal') {
$CODE.='<form method="get" target="' . $target . '" enctype="multipart/form-data" action="' . $action . '" name="' . $name . '" id="' . $name . '" style="' . $style . '" class="' . $class . '">
' . $value . '</form>';
return $CODE;
}
function Compile($form = true) {
$cell = 12;
if (!empty($this->sidebarLeft))
$cell = $cell - $this->sidebarLeftCell;
if (!empty($this->sidebarRight))
$cell = $cell - $this->sidebarLeftRight;
if (!empty($_GET['return']))
$path = $_GET['return'];
else
$path = $_GET['path'];
if ($form)
echo '<form method="post" enctype="multipart/form-data" name="product_edit" id="product_edit" class="form-horizontal" role="form" data-toggle="validator">';
echo $this->actionPanel . '
<div class="container row sidebarcontainer" style="' . $GLOBALS['frameWidth'] . '">
' . $this->sidebarLeft . '
<div class="col-md-' . $cell . ' main">
' . $this->_CODE . '
</div>
' . $this->sidebarRight . '
</div>
<input type="hidden" value="' . $path . '" name="path" id="path">';
if ($form)
echo '</form> ';
echo $this->includeJava . $this->includeCss;
}
function setEditor($editor = false, $mod_enabled = false) {
if (!in_array($editor, array('ace', 'none', 'default','tinymce')))
$editor = 'default';
if (empty($editor))
$editor = 'default';
if ($mod_enabled)
$editor_path = $this->dir . "editors/" . $editor . "/editor.php";
else
$editor_path = "./editors/" . $editor . "/editor.php";
if (is_file($editor_path))
include($editor_path);
else {
$this->setEditor($editor);
}
}
function setLine($value = false, $padding_top = false) {
$CODE = '
<div style="clear:both;padding-top:' . $this->chekSize($padding_top) . '">' . $value . '</div>';
return $CODE;
}
function setField($title, $content, $size = 1, $help = null, $class = null, $label = 'control-label') {
if (!strpos($title, ':') and !empty($title))
$title.=':';
$old_size = array(
'none' => 1,
'left' => 1,
'right' => 1
);
if (is_string($size))
$size = $old_size[$size];
if (!empty($this->field_col))
$size = $this->field_col;
if (!empty($help))
$help = $this->setHelpIcon($help);
$CODE = '
<div class="form-group form-group-sm ' . $class . '">
<label class="col-sm-' . intval($size) . ' ' . $label . '">' . $title . $help . '</label><div class="col-sm-' . (12 - intval($size)) . '">' . $content . '</div>
</div>';
return $CODE;
}
function setInputColor($name, $value, $size = 200, $id = false, $opt = false) {
$add_option = null;
if (!is_array($opt) and !empty($opt))
$option['option'] = $opt;
else
$option = $opt;
if (is_array($option))
foreach ($option as $k => $v)
$add_option.=' data-' . $k . '="' . $v . '" ';
$CODE = '<div class="input-group color" style="width:' . $this->chekSize($size) . '">
<input type="text" id="' . $id . '" name="' . $name . '" value="' . $value . '" class="form-control input-sm color-value" ' . $add_option . '>
<span class="input-group-addon input-sm"><i></i></span></div>';
return $CODE;
}
function setInput($type, $name, $value, $float = null, $size = false, $onclick = false, $class = false, $action = false, $caption = false, $description = false, $title = false) {
static $passN;
$class_array = array(
'text' => 'form-control input-sm',
'password' => 'form-control input-sm',
'email' => 'form-control input-sm',
'submit' => 'btn btn-primary',
'button' => 'btn btn-default',
'hidden' => 'hidden-edit',
'reset' => 'btn btn-warning',
);
$style = null;
if ($size)
$style.= 'width:' . $this->chekSize($size) . ';';
if ($float)
$style.= 'float:' . $float . ';';
if ($onclick)
$onclick = 'onclick="' . $onclick . '"';
if (strpos($type, '.')) {
$type_array = explode(".", $type);
$type = $type_array[0];
$required = ' required ';
if (!empty($type_array[2]))
$required.=' data-minlength="' . intval($type_array[2]) . '" ';
}
if ($type == 'password') {
if ($passN > 0)
$data['match'] = ' data-match="#inputPassword" ';
$id = 'inputPassword' . $passN;
$passN++;
}
if (!empty($description) or !empty($caption)) {
$CODE = ' <div class="input-group" style="' . $style . '">';
if (!empty($caption))
$CODE.= ' <div class="input-group-addon input-sm">' . $caption . '</div>';
$CODE.= '<input class="' . $class_array[$type] . ' ' . $class . '" type="' . $type . '" value="' . $value . '" name="' . $name . '" id="' . $name . '" placeholder="' . $title . '">';
if (!empty($description))
$CODE.='<div class="input-group-addon input-sm">' . $description . '</div>';
$CODE.='</div>';
}
else
$CODE = '<input class="' . $class_array[$type] . ' ' . $class . '" type="' . $type . '" value="' . $value . '" name="' . $name . '" id="' . $id . '" style="' . $style . '" ' . $onclick . $data['match'] . ' placeholder="' . $title . '" ' . $required . '>';
if ($action == true) {
$this->action[$name] = $action;
}
return $CODE;
}
function setInputText($caption, $name, $value, $size = false, $description = false, $float = false, $class = false, $placeholder = false) {
$value = str_replace('+', '+', $value);
return $this->setInput('text', $name, htmlentities($value, ENT_COMPAT, 'cp1251'), $float, $size, false, $class, false, $caption, $description, $placeholder);
}
function setPanel($header, $content, $class = 'panel-default', $body = true) {
$result = '<div class="panel ' . $class . '">
<div class="panel-heading">' . $header . '</div>';
if ($body)
$result.= '<div class="panel-body">';
$result.=$content;
if ($body)
$result.= '</div>';
$result.= '</div>';
return $result;
}
function setInputArg($arg = array()) {
if (is_array($arg)) {
if ($arg['type'] == 'textarea')
return $this->setTextarea($arg['name'], htmlentities($arg['value'], ENT_COMPAT, 'cp1251'), $arg['float'], $arg['width'], $arg['height'], $arg['description'], $arg['placeholder']);
elseif ($arg['type'] == 'checkbox')
return $this->setRadio($arg['name'], 1, $arg['caption'], $arg['value']) . $this->setRadio($arg['name'], 0, '', 1);
else
return $this->setInput($arg['type'], $arg['name'], htmlentities($arg['value'], ENT_COMPAT, 'cp1251'), $arg['float'], $arg['size'], false, $arg['class'], false, $arg['caption'], $arg['description'], $arg['placeholder']);
}
}
function setInputDate($name, $value, $style = null, $class = 'col-md-2', $tooltip = false) {
if ($tooltip)
$tooltip = 'data-toggle="tooltip" data-placement="top" title="' . $tooltip . '"';
return '
<div class="input-group date ' . $class . '" style="' . $style . '">
<input class="form-control input-sm" type="text" name="' . $name . '" value="' . $value . '" ' . $tooltip . '>
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-remove"></span></span>
<span class="input-group-addon input-sm"><span class="glyphicon glyphicon-calendar"></span></span>
</div> ';
}
function addTab() {
$Arg = func_get_args();
foreach ($Arg as $val) {
if (!empty($val[2]))
$val[1] = '<hr>' . $val[1];
$this->addTabName.='<li role="presentation"><a href="#tabs-' . $this->tab_key . '" aria-controls="tabs-' . $this->tab_key . '" role="tab" data-toggle="tab" data-id="' . $val[0] . '">' . $val[0] . '</a></li>';
$this->addTabContent.='<div role="tabpanel" class="tab-pane fade" id="tabs-' . $this->tab_key . '">' . $val[1] . '</div>';
$this->tab_key++;
}
}
function setTab() {
$Arg = func_get_args();
$name = $content = null;
foreach ($Arg as $key => $val) {
if ($key == intval($_GET['tab']))
$active = 'active in';
else
$active = null;
if (!empty($val[2]) and !is_numeric($val[2]) and !is_bool($val[2])) {
$toggle = null;
$href = $val[2];
} else {
$toggle = 'data-toggle="tab"';
$href = '#tabs-' . $this->tab_key;
}
if (is_bool($val[2])) {
$hr = '<hr>';
} else {
$hr = null;
}
$name.='<li role="presentation" class="' . $active . '"><a href="' . $href . '" aria-controls="tabs-' . $this->tab_key . '" role="tab" ' . $toggle . ' data-id="' . $val[0] . '">' . $val[0] . '</a></li>';
$content.='<div role="tabpanel" class="tab-pane ' . $active . ' fade" id="tabs-' . $this->tab_key . '">' . $hr . $val[1] . '</div>';
$this->tab_key++;
}
$this->_CODE = '
<div role="tabpanel">
<ul class="nav nav-pills" role="tablist">' . $name . $this->addTabName . '</ul>
<div class="tab-content"><p>' . $content . $this->addTabContent . '</p></div>
</div>';
}
function chekSize($size) {
if (!strpos($size, '%') and !strpos($size, 'px'))
$size.='px';
return $size;
}
function addJSFiles() {
$Arg = func_get_args();
foreach ($Arg as $val) {
$this->includeJava.='<script src="' . $val . '"></script>';
}
}
function addCSSFiles() {
$Arg = func_get_args();
foreach ($Arg as $val) {
$this->includeCss.='<link href="' . $val . '" rel="stylesheet">';
}
}
function setDiv($align, $code, $style = false, $name = 'div1') {
$CODE = '
<div align="' . $align . '" style="' . $style . '" name="' . $name . '" id="' . $name . '">
' . $code . '
</div>
';
return $CODE;
}
function setFooter($code) {
$this->_CODE.=$this->setDiv("right", $code, false, 'footer');
if (is_array($this->action))
foreach ($this->action as $name => $function)
$this->_CODE.=$this->setInput("hidden", "actionList[$name]", $function);
}
function setHelp($text, $icon = 'glyphicon-question-sign') {
return '<span class="help-block"><span class="glyphicon ' . $icon . '"></span> ' . $text . '</span>';
}
function setHelpIcon($text) {
return ' <span class="glyphicon glyphicon-question-sign" data-toggle="tooltip" data-placement="top" title="' . $text . '" style="cursor:pointer;"></span> ';
}
function setTextarea($name, $value, $float = "none", $width = false, $height = false, $description = false, $placeholder = false) {
if (strpos($name, '.')) {
$type_array = explode(".", $name);
$name = $type_array[0];
$required = ' required ';
if (!empty($type_array[2]))
$required.=' data-minlength="' . intval($type_array[2]) . '" ';
}
else
$required = null;
if (!empty($description))
$description = '<span class="help-block"><span class="glyphicon glyphicon-question-sign"></span> ' . $description . '</span>';
$style = null;
if (empty($width))
$style.='width:100%;';
else
$style.='width:' . $this->chekSize($width) . ';';
if (empty($height))
$style.='height:50px;';
else
$style.='height:' . $this->chekSize($height) . ';';
$CODE = '<textarea style="' . $style . '" name="' . $name . '" id="' . $name . '" class="form-control" placeholder="' . $placeholder . '" ' . $required . '>' . $value . '</textarea>' . $description;
return $CODE;
}
function setCollapse($title, $content, $collapse = 'in', $line = true, $icons = true) {
static $collapseID;
$datatoggle = 'data-toggle="collapse"';
if ($collapse == 'in')
$icon = 'bottom';
elseif ($collapse == 'none') {
$collapse = 'in';
$datatoggle = null;
}
else
$icon = 'right';
if ($line) {
$CODE = '<hr>';
}
if ($icons)
$icons = '<span class="glyphicon glyphicon-triangle-' . $icon . '"></span>';
$CODE.= '<a name="set' . $collapseID . '"></a><div class="collapse-block"><h4 ' . $datatoggle . ' data-target="#collapseExample' . $collapseID . '" aria-expanded="true" aria-controls="collapseExample">' . $title . ' ' . $icons . '</h4>
<div class="collapse ' . $collapse . '" id="collapseExample' . $collapseID . '">' . $content . '</div></div>';
$collapseID++;
return $CODE;
}
function setInfo($value) {
return '<p><div class="panel panel-default"><div class="panel-body">' . $value . '</div></div></p>';
}
function setSelect($name, $value, $width = '', $float = "none", $caption = false, $search = false, $height = false, $size = 1, $multiple = false, $id = false, $class = 'selectpicker', $onchange = null) {
if ($search)
$search = 'data-live-search="true" data-placeholder="123"';
if ($multiple)
$multiple = 'multiple';
if (empty($id))
$id = $name;
$CODE = $caption . '<select class="' . $class . ' show-menu-arrow hidden-edit" ' . $search . ' data-container="" data-style="btn btn-default btn-sm" data-width="' . $width . '" name="' . $name . '" id="' . $id . '" size="' . $size . '" onchange="' . $onchange . '" ' . $multiple . '>';
if (is_array($value))
foreach ($value as $val) {
if ($val[2] == $val[1])
$val[2] = "selected";
elseif ($val[2] != "selected")
$val[2] = null;
if (is_array($val[1])) {
$CODE.='<optgroup label="' . $val[0] . '">';
foreach ($val[1] as $group_val) {
if ($group_val[2] == $group_val[1])
$group_val[2] = "selected";
$CODE.='<option value="' . $group_val[1] . '" ' . $group_val[2] . '>' . $group_val[0] . '</option>';
}
$CODE.='</optgroup>';
}
else
$CODE.='<option value="' . $val[1] . '" ' . $val[2] . ' ' . $val[3] . '>' . $val[0] . '</option>';
}
$CODE.='</select>
';
return $CODE;
}
function setSelectValue($n, $max = 10) {
$i = 1;
while ($i <= $max) {
if ($n == $i)
$s = "selected";
else
$s = "";
$select[] = array($i, $i, $s);
$i++;
}
return $select;
}
function setCheckbox($name, $value, $caption, $checked = 1, $disabled = null) {
if ($checked == 1)
$checked = "checked";
elseif ($checked == 0)
$checked = null;
if (!empty($caption))
$CODE = '<div class="checkbox-inline"><label><input type="checkbox" value="' . $value . '" name="' . $name . '" id="' . $name . '" ' . $checked . ' ' . $disabled . '> ' . $caption . '</label></div> ';
else
$CODE.='<input type="checkbox" value="' . $value . '" name="' . $name . '" id="' . $name . '" ' . $checked . ' ' . $disabled . '>';
return $CODE;
}
function setRadio($name, $value, $caption, $checked = "checked", $onchange = "return true", $class = false) {
if ($value == $checked)
$checked = "checked";
$CODE = '
<div class="radio-inline ' . $class . '"><label><input type="radio" value="' . $value . '" name="' . $name . '" id="' . $name . '" ' . $checked . ' onchange="' . $onchange . '">' . $caption . '<i class="fa fa-circle-o small"></i></label></div>
';
return $CODE;
}
function setText($value, $float = "left", $style = false) {
$CODE = '<div style="float:' . $float . ';padding:' . $this->padding . 'px;' . $style . '">' . $value . '</div>';
return $CODE;
}
function setImage($src, $width, $height, $align = 'absmiddle', $hspace = "5", $style = false, $onclick = false, $alt = false, $class = false) {
if (!empty($width))
$width = 'width="' . $width . '"';
if (!empty($height))
$height = 'height="' . $height . '"';
$CODE = '<img src="' . $src . '" ' . $width . ' ' . $height . ' alt="' . $alt . '" title="' . $alt . '" border="0" align="' . $align . '" hspace="' . $hspace . '" style="' . $style . '" onclick="' . $onclick . '" class="' . $class . '">';
return $CODE;
}
function setLink($href, $caption, $target = '_blank', $style = false, $title = false) {
if (empty($title))
$title = $caption;
$CODE = '<a href="' . $href . '" target="' . $target . '" title="' . $title . '" style="' . $style . '">' . $caption . '</a>';
return $CODE;
}
function setError($name, $action) {
$this->_CODE.='' . $name . '()</strong>
<br><em>' . $action . '</em></p>';
}
function setFrame($name, $src, $width, $height, $float = 'none', $border = 1, $scrolling = 'yes') {
$CODE = '<iframe src="' . $src . '" height="' . $this->chekSize($height) . '" width="' . $this->chekSize($width) . '" scrolling="' . $scrolling . '" frameborder="' . $border . '" name="' . $name . '" id="' . $name . '" style="margin:' . $this->margin . 'px;background-color:#ffffff;float:' . $float . '"></iframe>';
return $CODE;
}
function setAction($name, $function) {
if (!empty($_POST)) {
foreach ($_POST as $k => $v) {
if (is_array($v)) {
foreach ($v as $kk => $vv) {
if (is_array($vv)) {
$v = str_replace('+', '+', $vv);
$_POST[$kk] = @array_map("urldecode", $vv);
} else {
$v = str_replace('+', '+', $v);
$_POST[$k] = @array_map("urldecode", $v);
}
}
} else {
$v = str_replace('+', '+', $v);
$_POST[$k] = urldecode($v);
}
}
}
if (!empty($name)) {
if (function_exists($function)) {
$action = call_user_func($function);
if (!$action)
$this->setError($function, $action);
else {
if (is_array($action)) {
exit(json_encode($action));
return true;
}
else
$this->Compile();
}
}
else
$this->setError($function, "function do not exists");
}
}
function setLoader($name, $function) {
if (empty($name))
if (function_exists($function)) {
$action = call_user_func($function);
if (!$action)
$this->setError($function, $action);
else {
$this->Compile();
}
}
else
$this->setError($function, "function do not exists");
}
function setTable() {
$td = '';
$Arg = func_get_args();
foreach ($Arg as $val) {
$td.='<td valign="top">' . $val . '</td>';
}
$CODE = '<table id="gui-' . strtolower(__FUNCTION__) . '"><tr>' . $td . '</tr></table>';
return $CODE;
}
function getAction() {
global $PHPShopBase;
if (!empty($_REQUEST['actionList']) and is_array($_REQUEST['actionList'])) {
foreach ($_REQUEST['actionList'] as $action => $function)
if (isset($_REQUEST[$action])) {
if (strpos($function, '.')) {
$function_array = explode(".", $function);
$function_name = $function_array[0];
$rule_path = $function_array[1];
$rule_do = $function_array[2];
if ($PHPShopBase->Rule->CheckedRules($rule_path, $rule_do))
$this->setAction($action, $function_name);
else {
if (isset($_REQUEST['ajax'])) {
exit(json_encode(array("success" => false)));
}
else
return $PHPShopBase->Rule->BadUserFormaWindow();
}
}
else
$this->setAction($action, $function);
}
}
}
function setButton($value, $img, $class = null, $option = false) {
$CODE = '
<button class="btn btn-default btn-sm ' . $class . '" data-option="' . $option . '" type="button">
<span class="glyphicon glyphicon-' . $img . '"></span>
' . $value . '
</button>
';
return $CODE;
}
function set_($count = 1) {
$i = 0;
$disp = null;
while ($i < $count) {
$disp.=' ';
$i++;
}
return '<span style="float:left;">' . $disp . '</span>';
}
function setHeader() {
return false;
}
function setHistory() {
}
function setPay($serial = false, $pay = false, $version = false, $update = false) {
global $PHPShopModules;
$mes = null;
$path = $PHPShopModules->path;
PHPShopObj::loadClass("date");
$CODE = '<table class="table table-striped table-bordered">
<tr>
</tr>';
$db = $PHPShopModules->getXml("../modules/" . $path . "/install/module.xml");
if ($db['version'] > $version and !empty($update)) {
PHPShopObj::loadClass('text');
$version_info = PHPShopText::notice('' . $db['version'] . '' . $version);
$version_info.=$this->setInput("submit", "modupdate", "", "center", null, "", "btn-sm pull-right", "actionBaseUpdate");
}
else
$version_info = $db['version'];
if (!empty($db['status']))
$status = ' <span class="label label-default">' . $db['status'] . '</span>';
else
$status = null;
$CODE.='<tr>
<td>' . $db['name'] . '</td>
<td>' . $version_info . $status . '</td>
<td>' . $db['description'] . $mes . '</td>
</tr>
</table>';
if (empty($db['reformal']))
$db['reformal'] = $path;
$CODE.=$this->setButton(__('') . $db['name'], 'question-sign', 'idea', "http://idea.phpshop.ru/proj/?ia=" . $db['reformal']);
if (!$pay)
return $CODE;
$CODE.=$this->setLine('<br>');
if ($PHPShopModules->checkKey($serial, $path)) {
$CODE.=$this->setField('', $this->setInputText('EEM-', 'serial_new', $serial, $size = 110, '', false, 'serial_done'));
$this->TrialOff = false;
$PHPShopModules->setKeyBase($path);
return $CODE;
}
$status_serial_img = null;
$status_serial = null;
if (!empty($serial)) {
$status_serial = 'serial_fail';
$status_serial_img = $this->setImage('error.gif', 16, 16, $align = 'absmiddle', 0);
}
$CODE.=$this->setField('', $this->setInputText('EEM-', 'serial_new', $serial, 110, $status_serial_img . '', false, $status_serial));
if (!$PHPShopModules->checkKey($serial, $path) and !empty($db['base']))
$CODE.=$this->setButton("" . $db['price'], '../../../admpanel/icon/key.png', 200, false, $float = "none", $onclick = "window.open('http://www.phpshop.ru/order/?bay_mod=" . $db['base'] . "')");
return $CODE;
}
}
class PHPShopInterface extends PHPShopGUI {
var $padding = 5;
var $margin = 5;
var $checkbox_action = true;
var $sort_action = true;
function __construct($tab_pre = false) {
$this->n = 1;
$this->numRows = 0;
if ($tab_pre)
$this->tab_pre = $tab_pre;
}
function setField($title, $content, $size = 1, $help = false, $class = false, $label = 'control-label') {
if (!strpos($title, ':') and !empty($title))
$title.=':';
$old_size = array(
'none' => 1,
'left' => 1,
'right' => 1
);
if (is_string($size))
$size = $old_size[$size];
if (!empty($this->field_col))
$size = $this->field_col;
if (!empty($help))
$help = $this->setHelpIcon($help);
$CODE = '
<div class="form-group form-group-sm">
<label class="col-sm-' . intval($size) . ' ' . $label . ' ' . $class . '">' . $title . $help . '</label><div class="col-sm-' . (12 - intval($size)) . '">' . $content . '</div>
</div>';
return $CODE;
}
function Compile($cell_left = 1, $cell_right = 2) {
$compile = $this->actionPanel;
$cell = 12;
if (!empty($this->sidebarLeft))
$cell = $cell - $cell_left;
if (!empty($this->sidebarRight))
$cell = $cell - $cell_right;
if ($this->sort_action)
$id = 'data';
else
$id = null;
$compile.='
<div class="container row sidebarcontainer">
' . $this->sidebarLeft . '
<div class="col-md-' . $cell . ' main">
<table class="table table-hover " id="' . $id . '">
' . $this->_CODE . '
</tbody>
</table>
</div>
' . $this->sidebarRight . '
</div>' . $this->includeJava . $this->includeCss;
$compile.='
';
echo $compile;
}
function getContent() {
return $this->_CODE;
}
function setCaption() {
$Arg = func_get_args();
$CODE = null;
$option['align'] = 'left';
foreach ($Arg as $key => $val) {
$class = null;
if ($key == 0 && $this->checkbox_action) {
$id = $val[0];
$CODE.='<th width="' . $val[1] . '" class="sorting-hide hidden-xs"><input type="checkbox" value="all" id="select_all"></th>';
} else {
if (is_array($val[2])) {
if (!empty($val[2]['align'])) {
$option['align'] = $val[2]['align'];
}
if (!empty($val[2]['tooltip'])) {
$tooltip = 'data-toggle="tooltip" data-placement="top" title="' . $val[2]['tooltip'] . '"';
}
else
$tooltip = null;
if (!empty($val[2]['sort']) && $val[2]['sort'] == 'none') {
$class = 'sorting-hide';
}
if (!empty($val[2]['class'])) {
$class.= 'sorting-hide';
}
if (isset($val[2]['view']) and $val[2]['view'] == 0) {
continue;
}
}
if (empty($val[0]))
$class = 'sorting-hide';
$CODE.='<th width="' . $val[1] . '" class="text-' . $option['align'] . ' ' . $class . '" ' . $tooltip . '>' . $val[0] . '</th>';
}
}
$this->_CODE.='<thead><tr>' . $CODE . '</tr>
</thead>
<tbody>
';
}
function setRow() {
$CODE = null;
$Arg = func_get_args();
foreach ($Arg as $key => $val) {
if ($key == 0 && $this->checkbox_action) {
$id = $val;
$CODE.='<td class="hidden-xs"><input type="checkbox" value="' . $val . '" name="items" data-id="' . $val . '"><span class="data-row-order">' . $key . '</span><span class="hide">' . $val . '</span></td>';
} else {
if (is_array($val)) {
if (isset($val['view']) and $val['view'] == 0) {
continue;
}
if (isset($val['link'])) {
if (!empty($val['popover'])) {
$popover = 'data-toggle="popover" title="' . $val['popover-title'] . '" data-content="' . $val['popover'] . '"';
}
else
$popover = null;
if (!empty($val['modal']))
$modal = 'data-toggle="modal" data-target="' . $val['modal'] . '"';
else
$modal = null;
if (empty($val['name']))
$val['name'] = '#' . $id;
if (empty($val['target']))
$val['target'] = '_self';
$row = '<a href="' . $val['link'] . '" ' . $popover . ' ' . $modal . ' class="' . $val['class'] . '" target="' . $val['target'] . '">' . $val['name'] . '</a>' . $val['addon'];
}
else
$row = $val['name'];
if (isset($val['status'])) {
$row = $this->setDropdown(array_merge(array('id' => $id), $val['status']), 'dropdown', $val['status']['align'], $val['status']['passive']);
$val['align'] = $val['status']['align'];
}
if (is_array($val['action'])) {
$row = $this->setDropdownAction($val['action']);
}
if (empty($val['class'])) {
$val['class'] = null;
}
if (empty($val['align'])) {
$val['align'] = 'left';
}
if (!empty($val['id']))
$id = $val['id'];
if (!empty($val['editable'])) {
$row = '<input style="width:100%" data-id="' . $id . '" class="editable input-hidden form-control input-sm" data-edit="' . $val['editable'] . '" value="' . $row . '"><span class="hide">' . $row . '</span>';
}
if (!empty($val['order']))
$order = ' data-order="' . $val['order'] . '" ';
else
$order = null;
if (!empty($val['search']))
$order.= ' data-search="' . $val['search'] . '" ';
$CODE.='<td style="text-align:' . $val['align'] . '" class="' . $val['class'] . '" ' . $order . '>' . $row . '</td>';
} else {
$CODE.='<td>' . $val . '</td>';
}
}
}
$this->_CODE.='<tr class="data-row" data-row="' . $this->numRows . '">' . $CODE . '</tr>';
$this->numRows++;
$this->n++;
}
function setAddItem($link) {
$this->_CODE_ADD_BUTTON = '
<span class="pull-right">
<a class="btn btn-default " href="' . $link . '
</span>
';
}
function icon($flag) {
if (empty($flag))
$imgchek = '<span class="fa fa-toggle-off"></span>';
else
$imgchek = '<span class="fa fa-toggle-on"></span>';
return $imgchek;
}
}
class PHPShopFrontInterface extends PHPShopInterface {
var $css;
var $js;
function Compile($id = false, $form = false, $style = false) {
if ($this->numRows > 10 and !$this->razmer)
$this->razmer = "height:450px;";
if (!empty($this->css))
$compile.='<LINK href="' . $this->css . '" type="text/css" rel="stylesheet">';
if (!empty($this->js))
$compile.='<SCRIPT language="JavaScript" src="' . $this->js . '"></SCRIPT>';
$compile.='<div style="' . $this->razmer . ';overflow:auto;">
<table cellpadding="0" class="phpshop-gui" cellspacing="1" border="0">' . $this->_CODE . '</table></div>';
return $compile;
}
function getContent() {
return $this->_CODE;
}
}
?>