diff options
Diffstat (limited to 'manage_proposal.inc')
-rwxr-xr-x | manage_proposal.inc | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc index fe013cc..8f89158 100755 --- a/manage_proposal.inc +++ b/manage_proposal.inc @@ -1108,6 +1108,18 @@ function lab_migration_proposal_edit_form_submit($form, &$form_state) // ":solution_display" => $solution_display, // ":id" => $proposal_id, // ); + + $lab_title = $v['lab_title']; + $proposar_name = $v['name_title']. ' ' . $v['name']; + $university = $v['university']; + $directory_names = _lm_dir_name($lab_title, $proposar_name, $university); + if (LM_RenameDir($proposal_id, $directory_names)) + { + $directory_name = $directory_names; + }else{ + return; + } + $query = db_update('lab_migration_proposal')->fields(array( 'name_title' => $v['name_title'], 'name' => $v['name'], @@ -1118,9 +1130,10 @@ function lab_migration_proposal_edit_form_submit($form, &$form_state) 'pincode' => $v['pincode'], 'state' => $v['all_state'], 'lab_title' => $v['lab_title'], - 'solution_display' => $solution_display - ))->condition('id', $proposal_id); - $result1 = $query->execute(); + 'solution_display' => $solution_display, + 'directory_name' => $directory_name + ))->condition('id', $proposal_id); + $result1 = $query->execute(); //$result=db_query($query, $args); /* updating existing experiments */ $query = db_select('lab_migration_experiment'); @@ -1446,3 +1459,20 @@ function CreateReadmeFileLabMigration($proposal_id) fclose($readme_file); return $txt; } + function LM_RenameDir($proposal_id,$dir_name){ + $query = db_query("SELECT directory_name FROM lab_migration_proposal WHERE id = :proposal_id", array(':proposal_id' => $proposal_id)); + $result = $query->fetchObject(); + $new_directory_name = rename(lab_migration_path().$result->directory_name, lab_migration_path().$dir_name) or drupal_set_message("Unable to rename folder"); + + return $new_directory_name; + +} +function _lm_dir_name($lab, $name, $university) + { + $lab_title = ucname($lab); + $proposar_name = ucname($name); + $university_name = ucname($university); + $dir_name = $lab_title . " " . "by". " " . $proposar_name . ' ' . $university_name; + $directory_name = str_replace("__", "_", str_replace(" ", "_", $dir_name)); + return $directory_name; + } |