ProjektyPrzedmiarKosztorys.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
  38. //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  39. $hidePrices = true;
  40. $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'hidePrices');
  41. UI::setTitleJsTag("Przedmiar robót telekomunikacyjnych [{$idProject}]");
  42. ?>
  43. <div class="container">
  44. <h1>Przedmiar robót telekomunikacyjnych</h1>
  45. <table class="table">
  46. <tr>
  47. <th><?php echo $schema['nr']; ?></th>
  48. <th><?php echo $schema['title']; ?></th>
  49. </tr>
  50. <tr>
  51. <td><?php echo $model->idProject; ?></td>
  52. <td><?php echo $model->title; ?></td>
  53. </tr>
  54. </table>
  55. <?php $this->viewLayersData($viewLayerDataArgs); ?>
  56. </div>
  57. <?php
  58. DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
  59. DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  60. }
  61. }