public function actionEmployeeFinalViewExportToPdf($id) { $employee_transaction = EmployeeTransaction::model()->findAll(' employee_transaction_id=' . $id); $employee_docs = EmployeeDocsTrans::model()->findAll('employee_docs_trans_user_id=' . $id); $employee_qual = EmployeeAcademicRecordTrans::model()->findAll('employee_academic_record_trans_user_id=' . $id); $employee_exp = EmployeeExperienceTrans::model()->findAll('employee_experience_trans_user_id=' . $id); $html = $this->renderPartial('/employeeTransaction/employeeFinalView', array('employee_docs' => $employee_docs, 'employee_qual' => $employee_qual, 'employee_transaction' => $employee_transaction, 'emp_exp' => $employee_exp), true); $this->exporttopdf('Employee Report', 'Employee.pdf', $html); }
public function actionEmployeeFinalViewExportToPdf($id) { $employee_transaction = EmployeeTransaction::model()->findAll('employee_transaction_id='.$id); $employee_docs = EmployeeDocsTrans::model()->findAll('employee_docs_trans_user_id='.$id); $employee_qual = EmployeeAcademicRecordTrans::model()->findAll('employee_academic_record_trans_user_id='.$id); $employee_exp = EmployeeExperienceTrans::model()->findAll('employee_experience_trans_user_id='.$id); $html = $this->renderPartial('/employeeTransaction/employeeFinalView', array( 'employee_docs'=>$employee_docs, 'employee_qual'=>$employee_qual, 'employee_transaction'=>$employee_transaction, 'emp_exp'=>$employee_exp, ), true); ob_clean(); //$pdf = new TCPDF(); //$pdf->SetCreator(PDF_CREATOR); //$pdf->SetAuthor(Yii::app()->name); //$pdf->SetTitle($title); //$pdf->SetSubject($title); //$pdf->SetKeywords('example, text, report'); //$pdf->SetHeaderData('', 0, $title, ''); //$pdf->setHeaderFont(Array('helvetica', '', 8)); //$pdf->setFooterFont(Array('helvetica', '', 6)); //$pdf->SetMargins(15, 18, 15); //$pdf->SetHeaderMargin(5); //$pdf->SetFooterMargin(10); //$pdf->SetAutoPageBreak(TRUE, 15); //$pdf->SetFont('dejavusans', '', 7); //$resolution= array(150, 150); //$pdf->AddPage('P', $resolution); $html = '<style> table, th, td { border : 1px solid #000;} th {text-align: center;}</style>'.$html; //$pdf->writeHTML($html, true, false, true, false, ''); //$pdf->LastPage(); //$pdf->Output($filename, "I"); $this->exporttopdf('Employee Report','Employee.pdf',$html); }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model=EmployeeDocsTrans::model()->findByPk($id); if($model===null) throw new CHttpException(404,'The requested page does not exist.'); return $model; }
public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request $model = $this->loadModel($id); $employee_info = EmployeeInfo::model()->findByPk($model->employee_transaction_employee_id); if ($model->employee_transaction_emp_address_id != null) { $address = EmployeeAddress::model()->findByPk($model->employee_transaction_emp_address_id); } $emp_photo = EmployeePhotos::model()->findByPk($model->employee_transaction_emp_photos_id); if ($model->employee_transaction_languages_known_id != null) { $lang_known = LanguagesKnown::model()->findByPk($model->employee_transaction_languages_known_id); } //$assign_comp_model = assignCompanyUserTable::model()->findByPk($ass_comp->id); $dir1 = Yii::getPathOfAlias('webroot') . '/college_data/emp_images/'; if ($dh = opendir($dir1)) { if ($emp_photo->employee_photos_path == "no-images") { } else { if (file_exists($dir1 . $emp_photo->employee_photos_path)) { chmod($dir1 . $emp_photo->employee_photos_path, 777); unlink($dir1 . $emp_photo->employee_photos_path); } } } closedir($dh); if ($this->loadModel($id)->delete()) { $use_model = User::model()->findByPk($model->employee_transaction_user_id)->delete(); $emp_photo->delete(); $employee_info->delete(); if ($model->employee_transaction_emp_address_id != null) { $address->delete(); } if ($model->employee_transaction_languages_known_id != null) { $lang_known->delete(); } EmployeeAcademicRecordTrans::model()->deleteAll(" \temployee_academic_record_trans_user_id= :empId", array(':empId' => $id)); EmployeeDocsTrans::model()->deleteAll("employee_docs_trans_user_id = :empId", array(':empId' => $id)); } // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }