summaryrefslogtreecommitdiff
path: root/general_deletion.inc
diff options
context:
space:
mode:
authorSashi202020-04-09 17:46:45 +0530
committerSashi202020-04-09 17:46:45 +0530
commit6a4784cd6611bc3bc0a40445ea6f56b1bb46856c (patch)
treef483e0eecdf6d48a9dc99cc4b25e8ae63ed7007c /general_deletion.inc
parentc26aba203bc67d38719fcae85882cd82fe54be54 (diff)
downloadarduino_projects_blog-6a4784cd6611bc3bc0a40445ea6f56b1bb46856c.tar.gz
arduino_projects_blog-6a4784cd6611bc3bc0a40445ea6f56b1bb46856c.tar.bz2
arduino_projects_blog-6a4784cd6611bc3bc0a40445ea6f56b1bb46856c.zip
Add code for proposal form and edit own proposal
Diffstat (limited to 'general_deletion.inc')
-rwxr-xr-xgeneral_deletion.inc48
1 files changed, 48 insertions, 0 deletions
diff --git a/general_deletion.inc b/general_deletion.inc
new file mode 100755
index 0000000..b6527ae
--- /dev/null
+++ b/general_deletion.inc
@@ -0,0 +1,48 @@
+<?php
+/******************************************************************************/
+/****************************** DELETION FUNCTIONS ****************************/
+/******************************************************************************/
+function arduino_projects_blog_abstract_delete_project($proposal_id)
+{
+ $status = TRUE;
+ $root_path = arduino_projects_blog_path();
+ $query = db_select('arduino_projects_blog_proposal');
+ $query->fields('arduino_projects_blog_proposal');
+ $query->condition('id', $proposal_id);
+ $proposal_q = $query->execute();
+ $proposal_data = $proposal_q->fetchObject();
+ if (!$proposal_data)
+ {
+ drupal_set_message('Invalid power system simulation Project.', 'error');
+ return FALSE;
+ } //!$proposal_data
+ $query = db_select('arduino_projects_blog_submitted_abstracts_file');
+ $query->fields('arduino_projects_blog_submitted_abstracts_file');
+ $query->condition('proposal_id', $proposal_id);
+ $abstract_q = $query->execute();
+ $dir_project_files = $root_path . $proposal_data->directory_name . '/project_files';
+ while ($abstract_data = $abstract_q->fetchObject())
+ {
+ if (is_dir($dir_project_files)){
+
+ unlink($root_path . $proposal_data->directory_name . '/project_files/' . $abstract_data->filepath);
+ }
+ else
+ {
+ drupal_set_message('Invalid power system simulation project abstract.', 'error');
+ }
+ db_delete('arduino_projects_blog_submitted_abstracts_file')->condition('proposal_id', $proposal_id)->execute();
+ //!arduino_projects_blog_delete_abstract_file($abstract_data->id)
+ }
+ $res = rmdir($root_path . $proposal_data->directory_name . '/project_files');
+ $dir_path_udc = $root_path . $proposal_data->directory_name;
+ if (is_dir($dir_path_udc))
+ {
+ unlink($root_path . $proposal_data->samplefilepath);
+ $res = rmdir($dir_path_udc);
+ } //is_dir($dir_path_udc)
+ db_delete('arduino_projects_blog_proposal')->condition('id', $proposal_data->id)->execute();
+
+ db_delete('arduino_projects_blog_submitted_abstracts')->condition('proposal_id', $proposal_id)->execute();
+ return $status;
+} \ No newline at end of file