/**
  * Create a select input and populate it with project options from the database
  */
 public static function create_project_select($projectId = null, $editable = true)
 {
     $editable ? $disabled = '' : ($disabled = 'disabled');
     $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
     echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
     if (sizeof($userProjects) > 0) {
         foreach ($userProjects as $project) {
             if ($project->projectID == $projectId) {
                 $selected = 'selected';
             } else {
                 $selected = '';
             }
             echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>';
         }
     }
     echo '</select>';
 }
 /**
  * Create a select input and populate it with project options from the database
  */
 public static function create_project_select($projectId = null, $editable = true)
 {
     $editable ? $disabled = '' : ($disabled = 'disabled');
     $userProjects = ProjectUtilities::get_all_user_projects(Session::get("gateway_id"), Session::get('username'));
     echo '<select class="form-control" name="project" id="project" required ' . $disabled . '>';
     if (sizeof($userProjects) > 0) {
         foreach ($userProjects as $project) {
             if ($project->projectID == $projectId) {
                 $selected = 'selected';
             } else {
                 $selected = '';
             }
             echo '<option value="' . $project->projectID . '" ' . $selected . '>' . $project->name . '</option>';
         }
     }
     echo '</select>';
     if (sizeof($userProjects) == 0) {
         CommonUtilities::print_warning_message('<p>You must create a project before you can create an experiment.
             Click <a href="' . URL::to('/') . '/project/create">here</a> to create a project.</p>');
     }
 }
 private function initializeWithAiravata($username)
 {
     //Check Airavata Server is up
     try {
         //creating a default project for user
         $projects = ProjectUtilities::get_all_user_projects(Config::get('pga_config.airavata')['gateway-id'], $username);
         if ($projects == null || count($projects) == 0) {
             //creating a default project for user
             ProjectUtilities::create_default_project($username);
         }
     } catch (Exception $ex) {
         CommonUtilities::print_error_message("Unable to Connect to the Airavata Server Instance!");
         return View::make('home');
     }
     return Redirect::to("admin/dashboard");
 }