public function actionIndex() { $this->layout = '/layouts/_stuResumeGridView'; $model = new ViewStudentJobTitle('search'); if (isset($_GET['ajax'])) { if (isset($_GET['ViewStudentJobTitle'])) { $model->attributes = $_GET['ViewStudentJobTitle']; } $this->renderPartial('gridviews/_index', array('model' => $model)); } else { $data = array('previousHired' => $model, 'currentHired' => $model->searchCurrentHiredByStu(Yii::app()->user->id)); $this->render('index', $data); } }
public function actionViewResumeDetails() { if (isset($_POST['id'])) { $data = ViewStudentJobTitle::getStuResumeWithEmployer($_POST['id'], Yii::app()->user->id); //ViewStudentJobTitle::model()->findByPk($_POST['id']); if ($data !== null) { $view = isset($_GET['view']) ? $_GET['view'] : null; $this->renderPartial('gridviews/_resumeGridDetails', array('data' => $data, 'view' => $view)); } else { echo '<div class="alert alert-error"><strong>Error!</strong> Student Resume Not Found!</div>'; } } else { throw new CHttpException(400, 'No Student Resume ID provided.'); } }
public function actionDownloadPortfolioZip() { if (isset($_POST) && isset($_POST['stu_job_id']) && !empty($_POST['stu_job_id'])) { $criteria = new CDbCriteria(); $criteria->addInCondition('stu_job_id', $_POST['stu_job_id']); $criteria->select = 'stu_job_id,student_id,stu_job_id,first_name,last_name,portfolio_file'; $selectedJobs = ViewStudentJobTitle::model()->findAll($criteria); if ($selectedJobs != null) { $tmpZipFile = tempnam(sys_get_temp_dir(), 'zip'); //FileHelper::getFilePath(Yii::getPathOfAlias('site.files').'/resumes/temp/zip/',true); $zip = new ZipArchive(); if ($zip->open($tmpZipFile, ZipArchive::OVERWRITE) === true) { foreach ($selectedJobs as $key => $job) { $student_id = $job['student_id']; $stu_job_id = $job['stu_job_id']; $first_name = $job['first_name']; $last_name = $job['last_name']; $name = $job['portfolio_file']; if (empty($name)) { continue; } $ext = CFileHelper::getExtension($name); $userFilezipName = $first_name . $last_name . '_pf_jobtitle_' . $stu_job_id . '.' . $ext; if ($name !== null) { $userFilePath = Yii::getPathOfAlias('site.files') . '/resumes/' . $student_id; $userFilePath .= '/' . $name; if (file_exists($userFilePath)) { $zip->addFile($userFilePath, $userFilezipName); } } } if ($zip->close()) { if (!FileHelper::outputFile('portfoliosZip' . Randomness::randomString() . '.zip', $tmpZipFile)) { throw new CHttpException(404, 'Download zip failed'); } } } } die; } else { throw new CHttpException(400, "Unable to find the selected filesll"); } }