public function returncddepartmentbycompanyAction() { $departmentModel = new DepartmentModel(); $nmdepartmentparentorcompany = 0; $cdcompany = '0'; $idelement = $_SESSION['idelement']; if ($_SESSION['cddepartment'] == '0') { $cddepartment = ''; } else { $cddepartment = $_SESSION['cddepartment']; $departmentData = $departmentModel->fetchRow('cddepartment = ' . $cddepartment); $nmdepartmentparentorcompany = $departmentData->nmdepartment; } if (!isset($_SESSION['cdcompany'])) { $cdcompany = 0; } else { if ($nmdepartmentparentorcompany == '0') { $cdcompany = $_SESSION['cdcompany']; $companyModel = new CompanyModel(); $companyData = $companyModel->fetchRow('cdcompany=' . $cdcompany); $nmdepartmentparentorcompany = $companyData->nmcompany; } } $responce->rows[0]['cell'] = array($cdcompany, $cddepartment, $nmdepartmentparentorcompany, $idelement); $this->view->returncddepartmentbycompany = $responce; }