ProjektyPrzedmiarKosztorys.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. $this->przedmiar($idProject);
  20. } catch (Exception $e) {
  21. UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
  22. }
  23. UI::dol();
  24. }
  25. public function przedmiar($idProject) {
  26. $idCompany = 0;
  27. $admin = false;
  28. $companyAdmin = false;
  29. $model = $this->getModel($idProject);
  30. //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
  31. $schema = ProjectKosztorysSchema::getSchema();
  32. $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
  33. //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  34. $hidePrices = true;
  35. $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'hidePrices');
  36. UI::setTitleJsTag("Przedmiar robót telekomunikacyjnych [{$idProject}]");
  37. ?>
  38. <div class="container">
  39. <h1>Przedmiar robót telekomunikacyjnych</h1>
  40. <table class="table">
  41. <tr>
  42. <th><?php echo $schema['nr']; ?></th>
  43. <th><?php echo $schema['title']; ?></th>
  44. </tr>
  45. <tr>
  46. <td><?php echo $model->idProject; ?></td>
  47. <td><?php echo $model->title; ?></td>
  48. </tr>
  49. </table>
  50. <?php $this->viewLayersData($viewLayerDataArgs); ?>
  51. </div>
  52. <?php
  53. DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
  54. DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  55. }
  56. }