Example #1
0
 /**
  * Lists all models.
  */
 public function actionIndex()
 {
     $model = new Domain('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Domain'])) {
         $model->attributes = $_GET['Domain'];
     }
     $userId = Yii::app()->user->getId();
     $user = User::model()->findByPK($userId);
     $this->render('index', array('model' => $model, 'user' => $user));
 }
Example #2
0
 /**
  * Manages all models.
  */
 public function actionAdmin()
 {
     $model = new Domain('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Domain'])) {
         $model->attributes = $_GET['Domain'];
     }
     $this->render('admin', array('model' => $model));
 }
 public function actionDomain()
 {
     $application = new ApplicationDomainMentor();
     $domains = new Domain();
     if (Yii::app()->getRequest()->isPostRequest) {
         $user = User::model()->getCurrentUser();
         $application->attributes = $_POST['ApplicationDomainMentor'];
         $application->status = 'Admin';
         $application->user_id = $user->id;
         $application->date_created = new CDbExpression('NOW()');
         $application->save(false);
         $picks = $_POST['domPicks'];
         $picks = explode(',', $picks);
         foreach ($picks as $pick) {
             $dbpick = new ApplicationDomainMentorPick();
             $dbpick->app_id = $application->id;
             $temp = explode(':', $pick);
             $dbpick->domain_id = $temp[0];
             $dbpick->proficiency = $temp[1];
             $dbpick->approval_status = 'Proposed by Mentor';
             $dbpick->save(false);
         }
         $picks = $_POST['subPicks'];
         if (isset($picks) && $picks != "") {
             $picks = explode(',', $picks);
             foreach ($picks as $pick) {
                 $dbpick = new ApplicationSubdomainMentorPick();
                 $dbpick->app_id = $application->id;
                 $temp = explode(':', $pick);
                 $dbpick->subdomain_id = $temp[0];
                 $dbpick->proficiency = $temp[1];
                 $dbpick->approval_status = 'Proposed by Mentor';
                 $dbpick->save(false);
             }
         }
         $this->redirect("/coplat/index.php/application/portal");
     } else {
         // on initial load
         $domains->unsetAttributes();
         $domain = Domain::model()->getDomainsForApp($domains->searchNoPagination());
     }
     $error = '';
     $this->render('domain', array('application' => $application, 'domain' => $domain, 'error' => $error));
 }