summaryrefslogtreecommitdiff
path: root/manage_proposal.inc
diff options
context:
space:
mode:
authorprashant2015-11-05 10:54:12 +0530
committerprashant2015-11-05 10:54:12 +0530
commit2d0c4265e1a061522d0e4f4d1b5b772c92f3803a (patch)
treea793fc8384796d1e623f5eb01e986f07be932247 /manage_proposal.inc
parent1ba859d4f6b4fc64ac51eadc6bc1a5fa40869590 (diff)
downloadDWSIM_lab_migration-2d0c4265e1a061522d0e4f4d1b5b772c92f3803a.tar.gz
DWSIM_lab_migration-2d0c4265e1a061522d0e4f4d1b5b772c92f3803a.tar.bz2
DWSIM_lab_migration-2d0c4265e1a061522d0e4f4d1b5b772c92f3803a.zip
added rename directory function in lab proposal edit
Diffstat (limited to 'manage_proposal.inc')
-rwxr-xr-xmanage_proposal.inc36
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;
+ }