ProjektyPrzedmiarKosztorys.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. Lib::loadClass('RouteBase');
  3. Lib::loadClass('ProjectKosztorysSchema');
  4. Lib::loadClass('ProjectKosztorysModel');
  5. Lib::loadClass('ProjectKosztorysCennik');
  6. Lib::loadClass('UI');
  7. Lib::loadClass('Response');
  8. Lib::loadClass('Route_ProjektyKosztorysBase');
  9. class Route_UrlAction_ProjektyPrzedmiarKosztorys extends Route_ProjektyKosztorysBase {
  10. public $_model = array();
  11. public function defaultAction() {
  12. // TODO: check if user is allowed to run this action
  13. UI::gora();
  14. if (1 != V::get('_print', '', $_GET)) UI::menu();
  15. try {
  16. $idProject = V::get('ID_PROJECT', 0, $_REQUEST, 'int');
  17. if (!$idProject) throw new Exception("Wrong param in 'ID_PROJECT' - expected integer!");
  18. $this->panel($idProject);
  19. if (1 != V::get('_print', '', $_GET)) {
  20. UI::startContainer(['style'=>'text-align:right']);
  21. UI::link('link', "<i class=\"glyphicon glyphicon-print\"></i> Drukuj", Request::getPathUri() . "index.php?_route=UrlAction_ProjektyPrzedmiarKosztorys&ID_PROJECT={$idProject}&_print=1");
  22. UI::endContainer();
  23. }
  24. $this->przedmiar($idProject);
  25. } catch (Exception $e) {
  26. UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
  27. }
  28. UI::dol();
  29. }
  30. public function przedmiar($idProject) {
  31. $idCompany = 0;
  32. $admin = false;
  33. $companyAdmin = false;
  34. $model = $this->getModel($idProject);
  35. //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
  36. $schema = ProjectKosztorysSchema::getSchema();
  37. DBG::log($schema, 'array', "\$schema");
  38. $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
  39. //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  40. $hidePrices = true;
  41. $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'hidePrices');
  42. UI::setTitleJsTag("Przedmiar robót telekomunikacyjnych [{$idProject}]");
  43. ?>
  44. <div class="container">
  45. <h1>Przedmiar robót telekomunikacyjnych</h1>
  46. <table class="table">
  47. <tr>
  48. <th><?php echo $schema['nr']; ?></th>
  49. <th><?php echo $schema['title']; ?></th>
  50. </tr>
  51. <tr>
  52. <td><?php echo $model->idProject; ?></td>
  53. <td><?php echo $model->title; ?></td>
  54. </tr>
  55. </table>
  56. <?php $this->viewLayersData($viewLayerDataArgs); ?>
  57. </div>
  58. <?php
  59. DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
  60. DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  61. }
  62. }