PageRenderTime 62ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/src/controller/mteDBTableManager.class.php

https://github.com/pabloeuy/motte
PHP | 2168 lines | 1066 code | 224 blank | 878 comment | 160 complexity | 7f37cc7c20e4596b29c13abda2034f32 MD5 | raw file
Possible License(s): GPL-3.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. /**
  3. * Table management class
  4. *
  5. * @filesource
  6. * @package motte
  7. * @subpackage controller
  8. * @version 1.0
  9. * @license GPLv2 http://opensource.org/licenses/gpl-license.php GNU Public license
  10. * @author Pedro Gauna (pgauna@gmail.com) /
  11. * Carlos Gagliardi (carlosgag@gmail.com) /
  12. * Braulio Rios (braulioriosf@gmail.com) /
  13. * Pablo Erartes (pabloeuy@gmail.com) /
  14. * GBoksar/Perro (gustavo@boksar.info)
  15. */
  16. class mteDBTableManager {
  17. /**
  18. *
  19. * @access private
  20. * @var string
  21. */
  22. private $_tplDir;
  23. /**
  24. *
  25. * @access private
  26. * @var string
  27. */
  28. private $_tplCacheDir;
  29. /**
  30. *
  31. * @access private
  32. * @var mteCnx
  33. */
  34. private $_cnx;
  35. /**
  36. * @access private
  37. * @var array
  38. */
  39. private $_params;
  40. /**
  41. * @access private
  42. * @var mteTableSql
  43. */
  44. private $_model;
  45. /**
  46. * @access private
  47. * @var mteView
  48. */
  49. private $_view;
  50. /**
  51. *
  52. * @access private
  53. * @var string
  54. */
  55. private $_error;
  56. /**
  57. *
  58. * @access private
  59. * @var string
  60. */
  61. private $_typeView;
  62. /**
  63. * @access private
  64. * @var integer
  65. */
  66. private $_rows;
  67. /**
  68. *
  69. * @access private
  70. * @var string
  71. */
  72. private $_requestMethod;
  73. /**
  74. *
  75. * @access private
  76. * @var string
  77. */
  78. private $_templateGrid;
  79. /**
  80. *
  81. * @access private
  82. * @var string
  83. */
  84. private $_templateForm;
  85. /**
  86. *
  87. * @access private
  88. * @var string
  89. */
  90. private $_templateBrowser;
  91. /**
  92. *
  93. * @access private
  94. * @var string
  95. */
  96. private $_warning;
  97. /**
  98. *
  99. * @access private
  100. * @var string
  101. */
  102. private $_notify;
  103. /**
  104. *1
  105. * @access private
  106. * @var string
  107. */
  108. private $_legend;
  109. /**
  110. *
  111. * @access private
  112. * @var string
  113. */
  114. private $_urlClose;
  115. /**
  116. *
  117. * @access privateName
  118. * @var string
  119. */
  120. private $_urlPost;
  121. /**
  122. *
  123. * @access private
  124. * @var string
  125. */
  126. private $_title;
  127. /**
  128. *
  129. * @access private
  130. * @var string
  131. */
  132. private $_action;
  133. /**
  134. *
  135. * @access private1
  136. * @var array
  137. */
  138. private $_templateFormField;
  139. /**
  140. *
  141. * @access private
  142. * @var boolean
  143. */
  144. private $_browser;
  145. /**
  146. *
  147. * @access private
  148. * @var string
  149. */
  150. private $_methodGrid;
  151. /**
  152. *
  153. * @access private
  154. * @var string
  155. */
  156. private $_methodForm;
  157. /**
  158. *
  159. * @access private
  160. * @var string
  161. */
  162. private $_methodFilter;
  163. /**
  164. *
  165. * @access private
  166. * @var string
  167. */
  168. private $_methodExport;
  169. /**
  170. *
  171. * @access private
  172. * @var string
  173. */
  174. private $_defaultFilter;
  175. /**
  176. *
  177. *
  178. * @access private
  179. * @var string
  180. *
  181. */
  182. private $_whereUpdate;
  183. /**
  184. *
  185. * @access private
  186. * @var string
  187. */
  188. private $_gridActions;
  189. /**
  190. *
  191. * @access private
  192. * @var string
  193. */
  194. private $_exportFormat;
  195. /**
  196. *
  197. * @access private
  198. * @var string
  199. */
  200. private $_exportOrientation;
  201. /**
  202. *
  203. * @access private
  204. * @var string
  205. */
  206. private $_exportFont;
  207. /**
  208. *
  209. * @access private
  210. * @var string
  211. */
  212. private $_exportFontSize;
  213. /**
  214. *
  215. * @access private
  216. * @var string
  217. */
  218. private $_exportSubtitle;
  219. /**
  220. *
  221. * @access private
  222. * @var boolean
  223. */
  224. private $_exportHeader;
  225. /**
  226. *
  227. * @access private
  228. * @var string
  229. */
  230. private $_exportHeaderSize;
  231. /**
  232. *
  233. * @access private
  234. * @var string
  235. */
  236. private $_exportHeaderTitle;
  237. /**
  238. *
  239. * @access private
  240. * @var string
  241. */
  242. private $_exportHeaderComment1;
  243. /**
  244. *
  245. * @access private
  246. * @var string
  247. */
  248. private $_exportHeaderComment2;
  249. /**
  250. *
  251. * @access private
  252. * @var boolean
  253. */
  254. private $_exportFooter;
  255. /**
  256. *
  257. * @access private
  258. * @var string
  259. */
  260. private $_exportFooterLeft;
  261. /**
  262. *
  263. * @access private
  264. * @var string
  265. */
  266. private $_exportFooterRigth;
  267. /**
  268. *
  269. * @access private
  270. * @var string
  271. */
  272. private $_exportCalcColumSize;
  273. /**
  274. * Margin Left
  275. *
  276. * @var integer
  277. */
  278. private $_exportMarginLeft;
  279. /**
  280. * Margin Rigth
  281. *
  282. * @var integer
  283. */
  284. private $_exportMarginRigth;
  285. /**
  286. * Margin Top
  287. * @var integer
  288. *
  289. */
  290. private $_exportMarginTop;
  291. /**
  292. * Margin Bottom
  293. *
  294. * @var integer
  295. */
  296. private $_exportMarginBottom;
  297. /**
  298. * Constructor
  299. *
  300. * @access public
  301. * @return mteDBTableManager
  302. */
  303. public function __construct($cnx, $tplCacheDir, $tplDir, $params, $ctr = '', $model = '', $view = '') {
  304. // inicialize
  305. $this->_action = array();
  306. $this->_action[mteConst::MTE_ACT_INSERT] = '';
  307. $this->_action[mteConst::MTE_ACT_UPDATE] = '';
  308. $this->_action[mteConst::MTE_ACT_DELETE] = '';
  309. $this->_action[mteConst::MTE_ACT_VIEW] = '';
  310. $this->_action[mteConst::MTE_ACT_EXPORT] = '';
  311. $this->_action[mteConst::MTE_ACT_FILTER] = '';
  312. // templates
  313. $this->setTemplateDir($tplDir);
  314. $this->setTplCacheDir($tplCacheDir);
  315. $this->setTemplateGrid();
  316. $this->setTemplateForm();
  317. $this->setTemplateBrowser();
  318. $this->setTemplateFormField(mteConst::MTE_FIELD_TEXT);
  319. $this->setTemplateFormField(mteConst::MTE_FIELD_NUMBER);
  320. $this->setTemplateFormField(mteConst::MTE_FIELD_TEXTAREA);
  321. $this->setTemplateFormField(mteConst::MTE_FIELD_CHECKBOX);
  322. $this->setTemplateFormField(mteConst::MTE_FIELD_SELECT);
  323. $this->setTemplateFormField(mteConst::MTE_FIELD_MULTISELECT);
  324. $this->setTemplateFormField(mteConst::MTE_FIELD_FILE);
  325. $this->setTemplateFormField(mteConst::MTE_FIELD_IMAGE);
  326. $this->setTemplateFormField(mteConst::MTE_FIELD_HIDDEN);
  327. $this->setTemplateFormField(mteConst::MTE_FIELD_PASSWORD);
  328. $this->setTemplateFormField(mteConst::MTE_FIELD_SUBMIT);
  329. $this->setTemplateFormField(mteConst::MTE_FIELD_DATE);
  330. $this->setTemplateFormField(mteConst::MTE_FIELD_TIME);
  331. $this->setTemplateFormField(mteConst::MTE_FIELD_CODE);
  332. $this->setTemplateFormField(mteConst::MTE_FIELD_SUBTITLE);
  333. $this->setTemplateFormField(mteConst::MTE_FIELD_DESCRIPTION);
  334. $this->setTemplateFormField(mteConst::MTE_FIELD_CAPTCHATEXT);
  335. // properties
  336. $this->setCnx($cnx);
  337. $this->setParams($params);
  338. $this->setTypeView();
  339. $this->setRequestMethod();
  340. $this->setGridRows(MTE_GRID_ROWS);
  341. $this->setTitle();
  342. $this->setNotify();
  343. $this->setWarning();
  344. $this->setLegend();
  345. $this->setUrlClose();
  346. $this->setUrlPost();
  347. $this->setViewMethodFilter();
  348. $this->setViewMethodGrid();
  349. $this->setViewMethodForm();
  350. $this->setWhereUpdate();
  351. // Export
  352. $this->setExportFormat();
  353. $this->setExportOrientation();
  354. $this->setExportFont();
  355. $this->setExportFontSize();
  356. $this->setExportSubtitle();
  357. $this->setExportHeader();
  358. $this->setExportFooter();
  359. $this->setExportCalcColumSize();
  360. $this->setExportMargin();
  361. // defult where
  362. $this->setDefaultFilter();
  363. // add default action
  364. $this->addActionInsert();
  365. $this->addActionUpdate();
  366. $this->addActionDelete();
  367. $this->addActionExport();
  368. $this->addActionView();
  369. $this->addActionFilter();
  370. // Browser
  371. $this->activeBrowser();
  372. $this->activeFooter();
  373. // Parametros
  374. if ($model != ''){
  375. $this->_params->setParamClassModel($model);
  376. }
  377. if ($view != '') {
  378. $this->_params->setParamClassView($view);
  379. }
  380. $file = $this->_params->getParamClassModel();
  381. // Object model
  382. if (file_exists(MTE_MODEL."/$file.model.php")){
  383. include_once(MTE_MODEL."/$file.model.php");
  384. $class = 'tbl_'.$file;
  385. $this->_model = new $class($this->getCnx());
  386. }
  387. // object view
  388. $file = $this->_params->getParamClassView();
  389. if (file_exists(MTE_VIEW."/$file.view.php")){
  390. include_once(MTE_VIEW."/$file.view.php");
  391. $class = 'vw_'.$file;
  392. $this->_view = new $class($ctr);
  393. }
  394. if ( !$this->_model instanceof mteTableSql || !$this->_view instanceof mteView ) {
  395. $excep = new mteException();
  396. $excep->setTitle(__('Class Definition Error'));
  397. $excep->setProblem(__('Problems detected while Motte try to create an object.'));
  398. $excep->setExplanation(__('Either needed classes were not found (check model and view path) or something just went wrong during the procudre.'));
  399. $excep->setVeredict(__('If this problem persist, please contact your developer team.'));
  400. $pag = new mtePage();
  401. $pag->setContent($excep->fetchHtml());
  402. $pag->showHtml();
  403. exit;
  404. }
  405. // field names
  406. $columns = $this->_view->getFields();
  407. foreach ($columns as $field){
  408. $this->_view->setFieldName($field, $this->_model->getFieldName($field));
  409. }
  410. // clear errorstype filter
  411. $this->_clearError();
  412. }
  413. /**
  414. * Destructor
  415. *
  416. * @access public
  417. */
  418. public function __destruct(){
  419. }
  420. /**
  421. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  422. * P R O P E R T I E S
  423. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  424. */
  425. /**
  426. *
  427. *
  428. * @access public
  429. * @param string $value
  430. */
  431. public function setTitle($value = ''){
  432. $this->_title = $value;
  433. }
  434. /**
  435. *
  436. *
  437. * @access public
  438. * @param string $value
  439. */
  440. public function setNotify($value = ''){
  441. $this->_notify = $value;
  442. }
  443. /**
  444. *
  445. *
  446. * @access public
  447. * @param string $value
  448. */
  449. public function setWarning($value = ''){
  450. $this->_warning = $value;
  451. }
  452. /**
  453. *
  454. *
  455. * @access public
  456. * @param string $value
  457. */
  458. public function setUrlClose($value = ''){
  459. $this->_urlClose = $value;
  460. }
  461. /**
  462. *
  463. *
  464. * @access public
  465. * @param string $value
  466. */
  467. public function setUrlPost($value = ''){
  468. $this->_urlPost = $value;
  469. }
  470. public function setLegend($value = ''){
  471. $this->_legend = $value;
  472. }
  473. /**
  474. *
  475. * @access public
  476. * @return string
  477. */
  478. public function getTitle(){
  479. $result = $this->_title;
  480. if ($result == ''){
  481. $result = $this->_view->getTitle();
  482. }
  483. return $result;
  484. }
  485. /**
  486. *
  487. *
  488. * @access public
  489. * @return string
  490. */
  491. public function getWarning(){
  492. return $this->_warning;
  493. }
  494. /**
  495. *
  496. *
  497. * @access public
  498. * @return string
  499. */
  500. public function getNotify(){
  501. return $this->_notify;
  502. }
  503. /**
  504. *
  505. *
  506. * @access public
  507. * @return string
  508. */
  509. public function getUrlClose(){
  510. return $this->_urlClose;
  511. }
  512. /**
  513. *
  514. *type filter s
  515. * @access public
  516. * @return string
  517. */
  518. public function getUrlPost(){
  519. return $this->_urlPost;
  520. }
  521. /**
  522. *
  523. *
  524. * @access public
  525. * @return string
  526. */
  527. public function getLegend(){
  528. return $this->_legend;
  529. }
  530. /**
  531. *
  532. *
  533. * @access public
  534. * @return string
  535. */
  536. public function getViewMethodGrid(){
  537. return $this->_methodGrid;
  538. }
  539. /**
  540. *
  541. *
  542. * @access public
  543. * @return string
  544. */
  545. public function getViewMethodForm(){
  546. return $this->_methodForm;
  547. }
  548. /**
  549. *
  550. *
  551. * @access public
  552. * @return string
  553. */
  554. public function getViewMethodFilter(){
  555. return $this->_methodFilter;
  556. }
  557. /**
  558. *
  559. *
  560. * @access public
  561. * @return string
  562. */
  563. public function getViewMethodExport(){
  564. return $this->_methodExport;
  565. }
  566. /**
  567. *
  568. *
  569. * @access public
  570. * @param string $value
  571. */
  572. public function setViewMethodGrid($value = ''){
  573. if ($value == ''){
  574. $value = 'getGrid';
  575. }
  576. $this->_methodGrid = $value;
  577. }
  578. /**
  579. *
  580. *
  581. * @access public
  582. * @param string $value
  583. */
  584. public function setViewMethodForm($value = ''){
  585. if ($value == ''){
  586. $value = 'getForm';
  587. }
  588. $this->_methodForm = $value;
  589. }
  590. /**
  591. *
  592. *
  593. * @access public
  594. * @param string $value
  595. */
  596. public function setViewMethodFilter($value = ''){
  597. if ($value == ''){
  598. $value = 'getFilter';
  599. }
  600. $this->_methodFilter = $value;
  601. }
  602. /**
  603. *
  604. *
  605. * @access public
  606. * @param string $value
  607. */
  608. public function setViewMethodExport($value = ''){
  609. if ($value == ''){
  610. $value = 'getExport';
  611. }
  612. $this->_methodExport = $value;
  613. }
  614. /**
  615. *
  616. *
  617. * @access public
  618. * @param string $value
  619. */
  620. public function setTemplateGrid($value = ''){
  621. $this->_templateGrid = $value;
  622. }
  623. /**
  624. *
  625. *
  626. * @access public
  627. * @param string $value
  628. */
  629. public function setTemplateForm($value = ''){
  630. $this->_templateForm = $value;
  631. }
  632. /**
  633. *
  634. *
  635. * @access public
  636. * @param string $value
  637. */
  638. public function setTemplateBrowser($value = ''){
  639. $this->_templateBrowser = $value;
  640. }
  641. /**
  642. *
  643. *
  644. * @access public
  645. * @return string
  646. */
  647. public function getTemplateGrid(){
  648. return $this->_templateGrid;
  649. }
  650. /**
  651. *
  652. *
  653. * @access public
  654. * @return string
  655. */
  656. public function getTemplateForm(){
  657. return $this->_templateForm;
  658. }
  659. /**
  660. *
  661. *
  662. * @access public
  663. * @return string
  664. */
  665. public function getTemplateBrowser(){
  666. return $this->_templateBrowser;
  667. }
  668. /**
  669. *
  670. *
  671. * @param string $type
  672. * @param string $value
  673. */
  674. public function setTemplateFormField($type, $value = ''){
  675. $this->_templateFormField[$type] = $value;
  676. }
  677. /**
  678. *
  679. *
  680. * @param string $type
  681. * @return string
  682. */
  683. public function getTemplateFormField($type){
  684. return $this->_templateFormField[$type];
  685. }
  686. /**
  687. *
  688. *
  689. * @access public
  690. * @param string $value
  691. */
  692. public function setRequestMethod($value = ''){
  693. if ($value == ''){
  694. $value = 'POST';
  695. }
  696. $this->_requestMethod = $value;
  697. }
  698. /**
  699. *
  700. *
  701. * @access public
  702. * @return string
  703. */
  704. public function getRequestMethod(){
  705. return $this->_requestMethod;
  706. }
  707. /**
  708. *
  709. *
  710. * @access public
  711. * @param string $dir
  712. */
  713. public function setTemplateDir($dir = ''){
  714. $this->_tplDir = $dir;
  715. }
  716. /**
  717. *
  718. *
  719. * @access public
  720. * @return string
  721. */
  722. public function getTemplateDir(){
  723. return $this->_tplDir;
  724. }
  725. /**
  726. *
  727. *
  728. * @access public
  729. * @param string $type
  730. */
  731. public function setTypeView($type = ''){
  732. if ($type == ''){
  733. $type = 'HTML';
  734. }
  735. $this->_typeView = $type;
  736. }
  737. /**
  738. *
  739. *
  740. * @access public
  741. * @return string
  742. */
  743. public function getTypeView(){
  744. return $this->_typeView;
  745. }
  746. /**
  747. *
  748. * @access public
  749. * @param string $tplCacheDir
  750. */
  751. public function setTplCacheDir($tplCacheDir = ''){
  752. $this->_tplCacheDir = $tplCacheDir;
  753. }
  754. /**
  755. *
  756. * @access public
  757. * @return string
  758. */
  759. public function getTplCacheDir(){
  760. return $this->_tplCacheDir;
  761. }
  762. /**
  763. *
  764. *
  765. * @access public
  766. * @param mteCnx $Cnx
  767. */
  768. public function setCnx($Cnx){
  769. $this->_cnx = $Cnx;
  770. }
  771. /**
  772. *
  773. *
  774. * @access public
  775. * @return mteCnx
  776. */
  777. public function getCnx(){
  778. return $this->_cnx;
  779. }
  780. /**
  781. *
  782. *
  783. * @access public
  784. * @param mteUrl $params
  785. */
  786. public function setParams($params){
  787. $this->_params = $params;
  788. }
  789. /**
  790. *
  791. *
  792. * @access public
  793. * @return mteUrl
  794. */
  795. public function getParams(){
  796. return $this->_params;
  797. }
  798. /**
  799. *
  800. *
  801. * @access public
  802. * @param mteTableSql $tbl
  803. */
  804. public function setModel($tbl){
  805. $this->_model = $tbl;
  806. }
  807. /**
  808. *
  809. *
  810. * @access public
  811. * @return mteTableSql
  812. */
  813. public function getModel(){
  814. return $this->_model;
  815. }
  816. /**
  817. *
  818. *
  819. * @access public
  820. * @param mteView
  821. *
  822. */
  823. public function setView($view){
  824. $this->_view = $view;
  825. }
  826. /**
  827. *
  828. *
  829. * @access public
  830. * @return mteTableSql
  831. */
  832. public function getView(){
  833. return $this->_view;
  834. }
  835. /**
  836. *
  837. * @access public
  838. * @param string $lang
  839. */
  840. public function setGridRows($nro=''){
  841. if ($nro == ''){
  842. $nro = 20;
  843. }
  844. $this->_rows = $nro;
  845. }
  846. /**
  847. *
  848. * @access public
  849. * @return string
  850. */
  851. public function getGridRows(){
  852. return $this->_rows;
  853. }
  854. /**
  855. *
  856. * @access public
  857. * @return string
  858. */
  859. public function setDefaultFilter($value = ''){
  860. $this->_defaultFilter = $value;
  861. }
  862. /**
  863. *
  864. * @access public
  865. * @return string
  866. */
  867. public function getDefaultFilter(){
  868. return $this->_defaultFilter;
  869. }
  870. /**
  871. *
  872. * @access public
  873. * @return string
  874. */
  875. public function getWhereUpdate(){
  876. return $this->_whereUpdate;
  877. }
  878. /**
  879. *
  880. * @access public
  881. * @return string
  882. */
  883. public function setWhereUpdate($value = ''){
  884. $this->_whereUpdate = $value;
  885. }
  886. public function activeBrowser(){
  887. $this->_browser = true;
  888. }
  889. public function desactiveBrowser(){
  890. $this->_browser = false;
  891. }
  892. public function activeFooter(){
  893. $this->_footer = true;
  894. }
  895. public function desactiveFooter(){
  896. $this->_footer = false;
  897. }
  898. /**
  899. *
  900. * @access public
  901. */
  902. public function addActionInsert(){
  903. $this->_action[mteConst::MTE_ACT_INSERT] = true;
  904. }
  905. /**
  906. *
  907. * @access public
  908. */
  909. public function addActionUpdate(){
  910. $this->_action[mteConst::MTE_ACT_UPDATE] = true;
  911. }
  912. /**
  913. *
  914. * @access public
  915. */
  916. public function addActionDelete(){
  917. $this->_action[mteConst::MTE_ACT_DELETE] = true;
  918. }
  919. /**
  920. *
  921. * @access public
  922. */
  923. public function addActionExport(){
  924. $this->_action[mteConst::MTE_ACT_EXPORT] = true;
  925. }
  926. /**
  927. *
  928. * @access public
  929. */
  930. public function addActionView(){
  931. $this->_action[mteConst::MTE_ACT_VIEW] = true;
  932. }
  933. /**
  934. *
  935. * @access public
  936. */
  937. public function addActionFilter(){
  938. $this->_action[mteConst::MTE_ACT_FILTER] = true;
  939. }
  940. /**
  941. *
  942. *
  943. * @access public
  944. */
  945. public function removeActionInsert(){
  946. $this->_action[mteConst::MTE_ACT_INSERT] = false;
  947. }
  948. /**
  949. *
  950. * @access public
  951. */
  952. public function removeActionUpdate(){
  953. $this->_action[mteConst::MTE_ACT_UPDATE] = false;
  954. }
  955. /**
  956. *
  957. * @access public
  958. */
  959. public function removeActionDelete(){
  960. $this->_action[mteConst::MTE_ACT_DELETE] = false;
  961. }
  962. /**
  963. *
  964. * @access public
  965. */
  966. public function removeActionExport(){
  967. $this->_action[mteConst::MTE_ACT_EXPORT] = false;
  968. }
  969. /**
  970. *
  971. * @access public
  972. */
  973. public function removeActionView(){
  974. $this->_action[mteConst::MTE_ACT_VIEW] = false;
  975. }
  976. /**
  977. *
  978. * @access public
  979. */
  980. public function removeActionFilter(){
  981. $this->_action[mteConst::MTE_ACT_FILTER] = false;
  982. }
  983. /**
  984. *
  985. * @access private
  986. */
  987. private function _isActiveActionInsert(){
  988. return $this->_action[mteConst::MTE_ACT_INSERT];
  989. }
  990. /**
  991. *
  992. * @access private
  993. */
  994. private function _isActiveActionUpdate(){
  995. return $this->_action[mteConst::MTE_ACT_UPDATE];
  996. }
  997. /**
  998. *
  999. * @access private
  1000. */
  1001. private function _isActiveActionDelete(){
  1002. return $this->_action[mteConst::MTE_ACT_DELETE];
  1003. }
  1004. /**
  1005. *
  1006. * @access private
  1007. */
  1008. private function _isActiveActionExport(){
  1009. return $this->_action[mteConst::MTE_ACT_EXPORT];
  1010. }
  1011. /**
  1012. *
  1013. * @access private
  1014. */
  1015. private function _isActiveActionView(){
  1016. return $this->_action[mteConst::MTE_ACT_VIEW];
  1017. }
  1018. /**
  1019. *
  1020. * @access private
  1021. */
  1022. private function _isActiveActionFilter(){
  1023. return $this->_action[mteConst::MTE_ACT_FILTER];
  1024. }
  1025. /**
  1026. *
  1027. * @access private
  1028. */
  1029. private function _isActiveBrowser(){
  1030. return $this->_browser;
  1031. }
  1032. /**
  1033. *
  1034. * @access private
  1035. */
  1036. private function _isActiveFooter(){
  1037. return $this->_footer;
  1038. }
  1039. /**
  1040. *
  1041. * @param string $value
  1042. */
  1043. public function setExportFormat($value = ''){
  1044. if ($value == ''){
  1045. $value = mteConst::MTE_PDF_FORMAT_A4;
  1046. }
  1047. $this->_exportFormat = $value;
  1048. }
  1049. /**
  1050. *
  1051. * @param string $value
  1052. */
  1053. public function setExportOrientation($value = ''){
  1054. if ($value == ''){
  1055. $value = mteConst::MTE_PDF_PORTRAIT;
  1056. }
  1057. $this->_exportOrientation = $value;
  1058. }
  1059. /**
  1060. *
  1061. * @param string $value
  1062. */
  1063. public function setExportFont($value = ''){
  1064. if ($value == ''){
  1065. $value = 'Arial';
  1066. }
  1067. $this->_exportFont = $value;
  1068. }
  1069. /**
  1070. *
  1071. * @param string $value
  1072. */
  1073. public function setExportFontSize($value = ''){
  1074. if ($value == ''){
  1075. $value = 'small';
  1076. }
  1077. $this->_exportFontSize = $value;
  1078. }
  1079. /**
  1080. *
  1081. * @param string $value
  1082. */
  1083. public function setExportSubtitle($value = ''){
  1084. $this->_exportSubtitle = $value;
  1085. }
  1086. /**
  1087. *
  1088. * @param string $value
  1089. */
  1090. public function setExportHeader($visible = true, $size = 0, $title = '', $com1 = '', $com2 = ''){
  1091. if ($size == 0){
  1092. $size = 22;
  1093. }
  1094. if ($title == ''){
  1095. $title = MTE_EXPORT_TITLE;
  1096. }
  1097. if ($com1 == ''){
  1098. $com1 = MTE_EXPORT_COMMENT;
  1099. }
  1100. if ($com2 == ''){
  1101. $com2 = MTE_EXPORT_DATA;
  1102. }
  1103. $this->_exportHeader = $visible;
  1104. $this->_exportHeaderTitle = $title;
  1105. $this->_exportHeaderComment1 = $com1;
  1106. $this->_exportHeaderComment2 = $com2;
  1107. $this->_exportHeaderSize = $size;
  1108. }
  1109. /**
  1110. *
  1111. * @param string $value
  1112. */
  1113. public function setExportFooter($visible = true, $left = '', $rigth = ''){
  1114. // parameters
  1115. if ($left == ''){
  1116. $left = MTE_SYSTEM_TITLE;
  1117. }
  1118. if ($rigth == ''){
  1119. $rigth = mteConst::MTE_PDF_VAR_CURRENTDATETIME;
  1120. }
  1121. $this->_exportFooter = $visible;
  1122. $this->_exportFooterLeft = $left;
  1123. $this->_exportFooterRigth = $rigth;
  1124. }
  1125. /**
  1126. * set Margins
  1127. *
  1128. * @param integer $left
  1129. * @param integer $top
  1130. * @param integer $rigth
  1131. * @param integer $bottom
  1132. */
  1133. public function setExportMargin($left = 0, $top = 0, $rigth = 0, $bottom = 0){
  1134. // parameters
  1135. if ($left == 0){
  1136. $left = 15;
  1137. }
  1138. if ($top == 0){
  1139. $top = 5;
  1140. }
  1141. if ($rigth == 0){
  1142. $rigth = 5;
  1143. }
  1144. if ($bottom == 0){
  1145. $bottom = 10;
  1146. }
  1147. // Set margins
  1148. $this->_exportMarginLeft = $left;
  1149. $this->_exportMarginTop = $top;
  1150. $this->_exportMarginRigth = $rigth;
  1151. $this->_exportMarginBottom = $bottom;
  1152. }
  1153. /**
  1154. *
  1155. * @param string $value
  1156. */
  1157. public function setExportCalcColumSize($value = true){
  1158. $this->_exportCalcColumSize = $value;
  1159. }
  1160. /**
  1161. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1162. * A C T I O N S
  1163. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1164. */
  1165. /**
  1166. *
  1167. * @access public
  1168. * @param string $action
  1169. * @return array
  1170. */
  1171. public function getActiveRecord($action){
  1172. $activeRecord = $this->_model->getEmptyRecord();
  1173. if (($action == mteConst::MTE_ACT_DELETE) ||
  1174. ($action == mteConst::MTE_ACT_UPDATE) ||
  1175. ($action == mteConst::MTE_ACT_VIEW)){
  1176. // if exist param id
  1177. if ($this->_params->existsParamActionId()){
  1178. // parameters
  1179. $params = $this->_params->getParamActionId();
  1180. $where = new mteWhereSql();
  1181. foreach ($this->_model->getFieldsKey() as $element){
  1182. $where->addAND($this->_model->getTableName().'.'.$element, '=', "'".$params[$element]."'");
  1183. }
  1184. $auxWhere = $where->fetch();
  1185. // default filter
  1186. if ($this->getDefaultFilter() != ''){
  1187. if ($auxWhere != ''){
  1188. $auxWhere .= ' AND ';
  1189. }
  1190. $auxWhere .= $this->getDefaultFilter();
  1191. }
  1192. // search record
  1193. if ($this->_model->exists($auxWhere)){
  1194. $activeRecord = $this->_model->getRecord($auxWhere, $this->_view->getAutoCalcFields());
  1195. }
  1196. }
  1197. }
  1198. return $activeRecord;
  1199. }
  1200. /**
  1201. *
  1202. * @access public
  1203. * @param array $activeRecord
  1204. * @return array
  1205. */
  1206. public function toRecord($activeRecord) {
  1207. switch ($this->getRequestMethod()) {
  1208. case 'POST':
  1209. $activeRecord = $this->_model->toRecord($activeRecord, $_POST);
  1210. break;
  1211. case 'GET':
  1212. $activeRecord = $this->_model->toRecord($activeRecord, $_GET);
  1213. break;
  1214. }
  1215. if ((method_exists($this->_model, 'onCalcFields')) && ($this->_view->getAutoCalcFields())){
  1216. $error = $this->_model->onCalcFields($activeRecord);
  1217. if ($error != ''){
  1218. $this->_addError($error);
  1219. }
  1220. }
  1221. return $activeRecord;
  1222. }
  1223. /**
  1224. *
  1225. * @access private
  1226. * @return variant
  1227. */
  1228. private function _grid(){
  1229. $auxMethod = $this->getViewMethodGrid();
  1230. if (method_exists($this->_view, $auxMethod)){
  1231. $result = $this->_view->$auxMethod();
  1232. }
  1233. else{
  1234. $result = $this->_mteGrid();
  1235. }
  1236. return $result;
  1237. }
  1238. /**
  1239. *
  1240. * @access private
  1241. * @return variant
  1242. */
  1243. private function _filter(){
  1244. $auxMethod = $this->getViewMethodFilter();
  1245. if (method_exists($this->_view, $auxMethod)){
  1246. $result = $this->_view->$auxMethod();
  1247. }
  1248. else{
  1249. $result = $this->_mteGridFilter();
  1250. }
  1251. return $result;
  1252. }
  1253. /**
  1254. *
  1255. * @access private
  1256. * @param string $action
  1257. * @param array $record
  1258. * @param boolean $readOnly
  1259. * @param string $error
  1260. * @return variant
  1261. */
  1262. private function _form($action, $record, $readOnly, $error){
  1263. $auxMethod = $this->getViewMethodForm();
  1264. if (method_exists($this->_view, $auxMethod)){
  1265. $result = $this->_view->$auxMethod($action,
  1266. $record,
  1267. $readOnly,
  1268. $error,
  1269. $this->_params,
  1270. $this->getTplCacheDir(),
  1271. $this->getTemplateDir(),
  1272. $this->getTemplateForm(),
  1273. $this->_getUrlClose(mteConst::MTE_ACT_GRID),
  1274. $this->_getUrlPost($action));
  1275. }
  1276. else{
  1277. $result = $this->_mteForm($action, $record, $readOnly, $error);
  1278. }
  1279. return $result;
  1280. }
  1281. /**
  1282. *
  1283. * @access private
  1284. * @param string $action
  1285. * @param array $activeRecord
  1286. * @return boolean
  1287. */
  1288. private function _insert_update($action, &$activeRecord, $whereUpdate = ''){
  1289. $this->_clearError();
  1290. $genForm = true;
  1291. $activeRecord = $this->toRecord($activeRecord);
  1292. if ($_SERVER["REQUEST_METHOD"] == $this->getRequestMethod()){
  1293. // Alta registro que viene por Post o por Get
  1294. if ($action == mteConst::MTE_ACT_INSERT){
  1295. $error = $this->_model->insertRecord($this->toRecord($activeRecord));
  1296. }
  1297. if ($action == mteConst::MTE_ACT_UPDATE){
  1298. $error = $this->_model->updateRecord($this->toRecord($activeRecord), $whereUpdate);
  1299. }
  1300. if ($error != ''){
  1301. $this->_addError($error);
  1302. }
  1303. if (method_exists($this->_model, 'onUpload')){
  1304. $error = $this->_model->onUpload($activeRecord);
  1305. if ($error != ''){
  1306. $this->_addError($error);
  1307. }
  1308. }
  1309. $genForm = ($this->_countError() > 0);
  1310. }
  1311. return $genForm;
  1312. }
  1313. /**
  1314. *
  1315. * @access private
  1316. * @param array $activeRecord
  1317. * @return boolean
  1318. */
  1319. private function _delete($activeRecord){
  1320. $this->_clearError();
  1321. $genForm = true;
  1322. if ($_SERVER["REQUEST_METHOD"] == $this->getRequestMethod()){
  1323. $error = $this->_model->deleteRecord($activeRecord);
  1324. if ($error != ''){
  1325. $this->_addError($error);
  1326. }
  1327. $genForm = ($this->_countError() > 0);
  1328. }
  1329. return $genForm;
  1330. }
  1331. /**
  1332. *
  1333. *
  1334. * @access private
  1335. */
  1336. private function _mteGridFilter(){
  1337. $filterField = '';
  1338. $filterText = '';
  1339. if ($_SERVER["REQUEST_METHOD"] == 'POST'){
  1340. $filterField = $_POST['mteGridNavField'];
  1341. $filterText = $_POST['mteGridNavKeyword'];
  1342. }
  1343. $this->_params->setParamGridFilterField($filterField);
  1344. $this->_params->setParamGridFilterText($filterText);
  1345. $this->_params->setParamGridPage(1);
  1346. }
  1347. /**
  1348. *
  1349. *
  1350. * @return string
  1351. */
  1352. private function _getUrlClose($action = ''){
  1353. $result = $this->getUrlClose();
  1354. if ($this->getUrlClose() == ''){
  1355. $url = clone $this->_params;
  1356. // Si accion es grid
  1357. if ($url->getParamAction() == mteConst::MTE_ACT_GRID){
  1358. $result = basename($_SERVER['PHP_SELF']);
  1359. }
  1360. else{
  1361. $url->setParamAction($action);
  1362. $url->setParamGridPage();
  1363. $url->setParamGridOrderField();
  1364. $url->setParamGridOrderDir();
  1365. $url->setParamGridFilterField();
  1366. $url->setParamGridFilterText();
  1367. $result = $url->getUrl();
  1368. }
  1369. }
  1370. return $result;
  1371. }
  1372. /**
  1373. *
  1374. *
  1375. * @access private
  1376. * @return string
  1377. */
  1378. private function _export(){
  1379. $auxMethod = $this->getViewMethodExport();
  1380. if (method_exists($this->_view, $auxMethod)){
  1381. $result = $this->_view->$auxMethod($this);
  1382. }
  1383. else{
  1384. $result = $this->_mteExport();
  1385. }
  1386. return $result;
  1387. }
  1388. /**
  1389. *
  1390. *
  1391. * @access private
  1392. * @return string
  1393. */
  1394. private function _mteExport(){
  1395. // ----------------------------------------------
  1396. // DATA
  1397. // ----------------------------------------------
  1398. $where = '';
  1399. if ($this->_params->getParamGridFilterText() <> ''){
  1400. $oWhere = new mteWhereSql();
  1401. $oWhere->addAND($this->_params->getParamGridFilterField(), mteConst::MTE_LIKE_IN, $this->_params->getParamGridFilterText());
  1402. $where = $oWhere->fetch();
  1403. }
  1404. if ($this->getDefaultFilter() != ''){
  1405. if ($where != ''){
  1406. $where .= ' AND ';
  1407. }
  1408. $where .= '('.$this->getDefaultFilter().')';
  1409. }
  1410. if ($this->_params->getParamGridOrderField() == ''){
  1411. $this->_params->setParamGridOrderField($this->_view->getOrderDefaultField());
  1412. $this->_params->setParamGridOrderDir($this->_view->getOrderDir($this->_view->getOrderDefaultField()));
  1413. }
  1414. $oOrder = new mteOrderSql();
  1415. if (strtoupper($this->_params->getParamGridOrderDireccion()) == 'DESC'){
  1416. $oOrder->addDesc($this->_params->getParamGridOrderField());
  1417. }
  1418. else{
  1419. $oOrder->addAsc($this->_params->getParamGridOrderField());
  1420. }
  1421. $order = $oOrder->fetch();
  1422. // Asks model for data
  1423. $fieldsAux = $this->_view->getGridFields();
  1424. $fieldsAux = implode(', ', $fieldsAux);
  1425. $data = array();
  1426. $recordSet = $this->_model->getRecordSet($fieldsAux, $where, $order, -1, -1, $this->_view->getAutoCalcFields());
  1427. if ($recordSet instanceof mteRecordSet){
  1428. $data = $recordSet->getArray();
  1429. }
  1430. // ----------------------------------------------
  1431. // EXPORT
  1432. // ----------------------------------------------
  1433. switch (MTE_EXPORT_TYPE) {
  1434. case mteconst::MTE_EXPORT_PDF:
  1435. {
  1436. $exportPDF = new mteExportListPdf();
  1437. // Add data
  1438. $exportPDF->setColumns($this->_view->getExportFields(), $this->_view->getExportHeader());
  1439. $exportPDF->addData($data);
  1440. // Cfg
  1441. $exportPDF->setFormat($this->_exportFormat);
  1442. $exportPDF->setOrientation($this->_exportOrientation);
  1443. $exportPDF->setFontFamily($this->_exportFont, $this->_exportFontSize);
  1444. $exportPDF->setTitle($this->getTitle());
  1445. $exportPDF->setSubtitle($this->_exportSubtitle);
  1446. $exportPDF->setHeaderContent($this->_exportHeader, $this->_exportHeaderSize, MTE_EXPORT_LOGO, MTE_EXPORT_LOGO_WIDTH, $this->_exportHeaderTitle, $this->_exportHeaderComment1, $this->_exportHeaderComment2);
  1447. $exportPDF->setFooterContent($this->_exportFooter, $this->_exportFooterLeft, $this->_exportFooterRigth);
  1448. $exportPDF->setMargin($this->_exportMarginLeft, $this->_exportMarginTop, $this->_exportMarginRigth, $this->_exportMarginBottom);
  1449. $exportPDF->autoCalcColumSize($this->_exportCalcColumSize);
  1450. // Export
  1451. $exportPDF->export(mteConst::MTE_EXPORT_SEND);
  1452. break;
  1453. }
  1454. case mteconst::MTE_EXPORT_TEXT:
  1455. {
  1456. $exportTXT = new mteExportListText();
  1457. // Add data
  1458. $exportTXT->setColumns($this->_view->getExportFields(), $this->_view->getExportHeader());
  1459. $exportTXT->addData($data);
  1460. // Exporto
  1461. $exportTXT->export(mteConst::MTE_EXPORT_SEND);
  1462. break;
  1463. }
  1464. }
  1465. }
  1466. /**
  1467. *
  1468. *
  1469. * @access private
  1470. * @return string
  1471. */
  1472. private function _mteGrid(){
  1473. $where = '';
  1474. if ($this->_params->getParamGridFilterText() <> ''){
  1475. $oWhere = new mteWhereSql();
  1476. $oWhere->addAND($this->_params->getParamGridFilterField(), mteConst::MTE_LIKE_IN, $this->_params->getParamGridFilterText());
  1477. $where = $oWhere->fetch();
  1478. }
  1479. if ($this->getDefaultFilter() != ''){
  1480. if ($where != '')
  1481. $where .= ' AND ';
  1482. $where .= '('.$this->getDefaultFilter().')';
  1483. }
  1484. if ($this->_params->getParamGridOrderField() == ''){
  1485. $this->_params->setParamGridOrderField($this->_view->getOrderDefaultField());
  1486. $this->_params->setParamGridOrderDir($this->_view->getOrderDir($this->_view->getOrderDefaultField()));
  1487. }
  1488. $oOrder = new mteOrderSql();
  1489. if (strtoupper($this->_params->getParamGridOrderDireccion()) == 'DESC'){
  1490. $oOrder->addDesc($this->_params->getParamGridOrderField());
  1491. }
  1492. else{
  1493. $oOrder->addAsc($this->_params->getParamGridOrderField());
  1494. }
  1495. $order = $oOrder->fetch();
  1496. $page = $this->_params->getParamGridPage();
  1497. $rows = $this->getGridRows();
  1498. $url = clone $this->_params;
  1499. $maxPage = $this->_model->getTotalPages($rows, $where);
  1500. $maxRows = $this->_model->recordCount($where);
  1501. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1502. // G R I D B R O W S I N G O P T I O N S
  1503. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1504. $resultBrowser = '';
  1505. if ($this->_isActiveBrowser()){
  1506. // Create Browser object
  1507. $browser = new mteBrowser($this->getTplCacheDir(), $this->getTemplateDir(), $this->getTemplateBrowser());
  1508. $browser->setName('brw');
  1509. $browser->setPage($page);
  1510. // Actions
  1511. if ($this->_isActiveActionInsert()){
  1512. $url->setParamAction(mteConst::MTE_ACT_INSERT);
  1513. $url->setParamActionId();
  1514. $browser->addAction(mteConst::MTE_ACT_INSERT, $url->getUrl());
  1515. }
  1516. if ($this->_isActiveActionExport()){
  1517. $url->setParamAction(mteConst::MTE_ACT_EXPORT);
  1518. $browser->addAction(mteConst::MTE_ACT_EXPORT, $url->getUrl());
  1519. }
  1520. // Filters
  1521. if ($this->_isActiveActionFilter()){
  1522. $browser->showFilter(true);
  1523. $browser->addFilterFields($this->_view->getFilterField());
  1524. $url->setParamAction(mteConst::MTE_ACT_FILTER);
  1525. $browser->setFilterUrl($url->getUrl());
  1526. $browser->setFilterSelected($this->_params->getParamGridFilterField());
  1527. $browser->setFilterKeyword($this->_params->getParamGridFilterText());
  1528. }
  1529. // first page button
  1530. $url->setParamAction(mteConst::MTE_ACT_GRID);
  1531. $url->setParamGridPage(1);
  1532. $browser->setPagesUrlFirst($url->getUrl());
  1533. // previous page button
  1534. if ($page-1 > 1){
  1535. $url->setParamGridPage($page-1);
  1536. }
  1537. $browser->setPagesUrlPrev($url->getUrl());
  1538. // last page button
  1539. $url->setParamGridPage($maxPage);
  1540. $browser->setPagesUrlLast($url->getUrl());
  1541. // next page button
  1542. if ($page+1 < $maxPage){
  1543. $url->setParamGridPage($page+1);
  1544. }
  1545. $browser->setPagesUrlNext($url->getUrl());
  1546. // page combo
  1547. for ($i=1; $i<=$maxPage; $i++){
  1548. $url->setParamGridPage($i);
  1549. $browser->addNavPageItem($i, $url->getUrl());
  1550. }
  1551. // Generate HTML
  1552. if ($this->getTypeView() == 'HTML'){
  1553. $resultBrowser = $browser->fetchHtml();
  1554. }
  1555. }
  1556. else{
  1557. // Display all rows
  1558. $page = 1;
  1559. $rows = $maxRows;
  1560. }
  1561. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1562. // D A T A G R I D
  1563. // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  1564. // Create Grid object
  1565. $grid = new mteGrid($this->getTplCacheDir(), $this->getTemplateDir(), $this->getTemplateGrid());
  1566. $grid->setTitle($this->getTitle());
  1567. $grid->setNotify($this->getNotify());
  1568. $grid->setWarning($this->getWarning());
  1569. // first page button
  1570. $url->setParamAction(mteConst::MTE_ACT_GRID);
  1571. $url->setParamGridPage(1);
  1572. $grid->gridSetPagesUrlFirst($url->getUrl());
  1573. // previous page button
  1574. if ($page-1 > 1){
  1575. $url->setParamGridPage($page-1);
  1576. }
  1577. $grid->gridSetPagesUrlPrev($url->getUrl());
  1578. // last page button
  1579. $url->setParamGridPage($maxPage);
  1580. $grid->gridSetPagesUrlLast($url->getUrl());
  1581. // next page button
  1582. if ($page+1 < $maxPage){
  1583. $url->setParamGridPage($page+1);
  1584. }
  1585. $grid->gridSetPagesUrlNext($url->getUrl());
  1586. // page combo
  1587. for ($i=1; $i<=$maxPage; $i++){
  1588. $url->setParamGridPage($i);
  1589. $grid->gridAddNavPageItem($i, $url->getUrl());
  1590. }
  1591. // Close Button
  1592. $grid->setUrlClose($this->_getUrlClose());
  1593. // Add columns declared at table view
  1594. $grid->addColumns($this->_view->getGridColumns());
  1595. $grid->setColumnOrder($this->_params->getParamGridOrderField(), $this->_params->getParamGridOrderDireccion());
  1596. // Add grid actions
  1597. $mteConst = new mteConst();
  1598. if ($this->_isActiveActionView()){
  1599. $grid->addMteAction(mteConst::MTE_ACT_VIEW, $mteConst->getActionName(mteConst::MTE_ACT_VIEW));
  1600. }
  1601. if ($this->_isActiveActionUpdate()){
  1602. $grid->addMteAction(mteConst::MTE_ACT_UPDATE, $mteConst->getActionName(mteConst::MTE_ACT_UPDATE));
  1603. }
  1604. if ($this->_isActiveActionDelete()){
  1605. $grid->addMteAction(mteConst::MTE_ACT_DELETE, $mteConst->getActionName(mteConst::MTE_ACT_DELETE));
  1606. }
  1607. // Asks model for data
  1608. $fieldsAux = $this->_view->getGridFields();
  1609. $fieldsAux = implode(', ', $fieldsAux);
  1610. $recordSet = $this->_model->getRecordSet($fieldsAux, $where, $order, $rows, $rows*($page-1), $this->_view->getAutoCalcFields());
  1611. if ($recordSet instanceof mteRecordSet){
  1612. $grid->addData($recordSet->getArray());
  1613. // Record legend
  1614. $canRec = $recordSet->recordCount();
  1615. $fromRec = $rows*($page-1);
  1616. if ($canRec > 0){
  1617. $fromRec++;
  1618. }
  1619. $toRec = $fromRec+$canRec;
  1620. if ($fromRec > 0){
  1621. $toRec--;
  1622. }
  1623. if ($this->_isActiveFooter()){
  1624. $grid->setRecordLegend($this->getLegend()."$fromRec - $toRec / $maxRows");
  1625. }
  1626. }
  1627. // Generate Grid
  1628. $resultGrid = '';
  1629. if ($this->getTypeView() == 'HTML'){
  1630. $resultGrid = $grid->fetchHtml($this->_params, $this->_model->getFieldsKey());
  1631. }
  1632. return $resultBrowser.$resultGrid;
  1633. }
  1634. /**
  1635. *
  1636. * @access private
  1637. * @param string $action
  1638. * @return string
  1639. */
  1640. private function _getUrlPost($action = ''){
  1641. $result = $this->getUrlPost();
  1642. if ($this->getUrlPost() == ''){
  1643. $url = clone $this->_params;
  1644. $url->setParamAction($action);
  1645. $url->setParamGridPage();
  1646. $url->setParamGridOr

Large files files are truncated, but you can click here to view the full file