Пример #1
0
 public function actioneditCompetencies()
 {
     $companyModel = new Company();
     $companyCompetenciesModel = new CompanyCompetencies();
     $userLoginModel = new UserLogin();
     $userProfileModel = new UserProfile();
     if (isset($_POST['CompanyCompetencies'])) {
         //print_r($_POST['CompanyCompetencies']);
         //die();
         foreach ($_POST['CompanyCompetencies']['CompanyCompetenciesID'] as $key => $companyCompetenciesID) {
             //echo $_POST['CompanyPosition']['Description'][$key];
             //print_r($companyPositionID);
             $companyCompetency = $companyCompetenciesModel->findByPk($companyCompetenciesID);
             $companyCompetency->Name = $_POST['CompanyCompetencies']['Name'][$key];
             $companyCompetency->Description = $_POST['CompanyCompetencies']['Description'][$key];
             $companyCompetency->update();
         }
         $this->redirect(Yii::app()->createUrl('admin/competencies', array('id' => Yii::app()->user->companyID)));
         //$this->render('edit-competencies', array('companyCompetencies' => $companyCompetencies,'companyCompetenciesModel' => $companyCompetenciesModel, 'companyModel' => $companyModel, 'userLoginModel' => $userLoginModel, 'userProfileModel' => $userProfileModel));
         //die();
     }
     $criteria = new CDbCriteria();
     $criteria->condition = 'CompanyID = :CompanyID';
     $criteria->params = array(':CompanyID' => Yii::app()->user->companyID);
     $companyCompetencies = $companyCompetenciesModel->findAllByAttributes(array(), $criteria);
     $this->render('edit-competencies', array('companyCompetencies' => $companyCompetencies, 'companyCompetenciesModel' => $companyCompetenciesModel, 'companyModel' => $companyModel, 'userLoginModel' => $userLoginModel, 'userProfileModel' => $userProfileModel));
 }
Пример #2
0
 public function actionPlanning()
 {
     if (Yii::app()->user->agreeToTerms == 0) {
         $this->redirect(Yii::app()->createUrl('company/terms'));
     }
     if (!isset(Yii::app()->user->userProfileID)) {
         $this->redirect('/user/login');
     }
     $candidateID = Yii::app()->request->getParam('id');
     $fundamentalsModel = new CompanyFundamentals();
     $competenciesModel = new CompanyCompetencies();
     $learningagilityModel = new CompanyLearningAgility();
     $criteria3 = new CDbCriteria();
     $criteria3->condition = 'CompanyID = :CompanyID';
     $criteria3->params = array(':CompanyID' => Yii::app()->user->companyID);
     $fundamentals = $fundamentalsModel->findAllByAttributes(array(), $criteria3);
     $competencies = $competenciesModel->findAllByAttributes(array(), $criteria3);
     $learningagility = $learningagilityModel->findAllByAttributes(array(), $criteria3);
     //Weighting for Readiness Indicator
     $companyModel = new Company();
     $criteria2 = new CDbCriteria();
     $criteria2->with = array('companyPerformances', 'companyPotentials');
     $companyPerformance = $companyModel->findByPk(Yii::app()->user->companyID, $criteria2);
     $currentYear = date('Y');
     $candidateModel = new Candidate();
     $planningModel = new Planning();
     if (isset($_POST['Planning'])) {
         $criteria = new CDbCriteria();
         $criteria->condition = 'CandidateID = :CandidateID and PlanningYear = :PlanningYear';
         $criteria->params = array(':CandidateID' => $_POST['Planning']['CandidateID'], ':PlanningYear' => $currentYear);
         $planning = $planningModel->findByAttributes(array(), $criteria);
         $planning->attributes = $_POST['Planning'];
         $planning->save();
     }
     $criteria = new CDbCriteria();
     //$criteria->select = 'CompanyID, CompanyName';
     $criteria->with = array('ratings', 'performances', 'plannings');
     $criteriax = new CDbCriteria();
     //$criteria->select = 'CompanyID, CompanyName';
     $criteriax->with = array('ratings', 'performances', 'plannings');
     $currentYear = date('Y');
     $criteria->condition = 'plannings.CandidateID = :CandidateID and plannings.PlanningYear = :RatingYear and ratings.RatingYear = :RatingYear';
     $criteria->params = array(':CandidateID' => $candidateID, ':RatingYear' => $currentYear);
     // if no new record insert new record
     $planning = $candidateModel->findByAttributes(array(), $criteria);
     // CHeck to see if new Year Exists
     if (empty($planning) && !isset($_POST['Planning'])) {
         //see if previous year has data
         $criteriax->condition = 'plannings.CandidateID = :CandidateID and plannings.PlanningYear = :RatingYear';
         $criteriax->params = array(':CandidateID' => $candidateID, ':RatingYear' => $currentYear - 1);
         // if no new record insert new record
         $planninglast = $candidateModel->findByAttributes(array(), $criteriax);
         $planningModel->CandidateID = $candidateID;
         $planningModel->PlanningYear = $currentYear;
         if (empty($planninglast)) {
             //no previous year data
             $planningModel->CurrentPositionLevel = 1;
             $planningModel->LongTermPositionLevel = 1;
             $planningModel->NextStepPositionLevel = 1;
             $planningModel->Readiness = 1;
             // Mobility Engagement/Retention
         } else {
             //previous year data
             $planningModel->CurrentPositionLevel = $planninglast->plannings[0]->CurrentPositionLevel;
             $planningModel->LongTermPositionLevel = $planninglast->plannings[0]->LongTermPositionLevel;
             $planningModel->NextStepPositionLevel = $planninglast->plannings[0]->NextStepPositionLevel;
             $planningModel->Readiness = $planninglast->plannings[0]->Readiness;
             $planningModel->Mobility = $planninglast->plannings[0]->Mobility;
             //  Mobility Engagement/Retention
         }
         $newplanning = 1;
         $planningModel->save();
         $planning = $candidateModel->findByAttributes(array(), $criteria);
         //print_r($planning);
     }
     $companyPositions = Helper::getCompanyPositions(Yii::app()->user->companyID);
     $companyReadiness = Helper::getCompanyReadiness(Yii::app()->user->companyID);
     $companyAssessment = Helper::getCompanyAssessment(Yii::app()->user->companyID);
     $this->render('planning', array('companyPerformance' => $companyPerformance, 'planning' => $planning, 'planningModel' => $planningModel, 'companyAssessmentSelect' => $companyAssessment, 'companyPositionSelect' => $companyPositions, 'companyReadinessSelect' => $companyReadiness, 'competencies' => $competencies, 'fundamentals' => $fundamentals, 'learningagility' => $learningagility));
 }