ProjektyPrzedmiarKosztorys.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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->execPostTasks();
  20. if (1 != V::get('_print', '', $_GET)) {
  21. UI::startContainer(['style'=>'text-align:right']);
  22. UI::link('link', "<i class=\"glyphicon glyphicon-print\"></i> Drukuj", Request::getPathUri() . "index.php?_route=UrlAction_ProjektyPrzedmiarKosztorys&ID_PROJECT={$idProject}&_print=1");
  23. UI::endContainer();
  24. }
  25. $this->przedmiar($idProject);
  26. } catch (Exception $e) {
  27. UI::alert('danger', "Error #" . $e->getCode() . "|" . $e->getLine() . ": " . $e->getMessage());
  28. }
  29. UI::dol();
  30. }
  31. public function przedmiar($idProject) {
  32. $idCompany = 0;
  33. $admin = false;
  34. $companyAdmin = false;
  35. $model = $this->getModel($idProject);
  36. //DBG::table("subProjectList", $model->subProjectList, __CLASS__, __FUNCTION__, __LINE__);
  37. $schema = ProjectKosztorysSchema::getSchema();
  38. DBG::log($schema, 'array', "\$schema");
  39. $projCosts = $this->getProjectCostByCennik($idProject, $idCompany);
  40. //DBG::_(true, true, "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  41. $hidePrices = true;
  42. $viewLayerDataArgs = compact('idProject', 'idCompany', 'admin', 'companyAdmin', 'hidePrices');
  43. UI::setTitleJsTag("Przedmiar robót telekomunikacyjnych [{$idProject}]");
  44. ?>
  45. <div class="container">
  46. <h1>Przedmiar robót telekomunikacyjnych</h1>
  47. <table class="table">
  48. <tr>
  49. <th><?php echo $schema['nr']; ?></th>
  50. <th><?php echo $schema['title']; ?></th>
  51. </tr>
  52. <tr>
  53. <td><?php echo $model->idProject; ?></td>
  54. <td><?php echo $model->title; ?></td>
  55. </tr>
  56. </table>
  57. <?php $this->viewLayersData($viewLayerDataArgs); ?>
  58. </div>
  59. <?php
  60. DBG::_('DBG', '>0', "schema", $schema, __CLASS__, __FUNCTION__, __LINE__);
  61. DBG::_('DBG', '>0', "projCosts", $projCosts, __CLASS__, __FUNCTION__, __LINE__);
  62. }
  63. }