diff options
author | Prashant P. Shah | 2011-07-11 12:06:57 +0530 |
---|---|---|
committer | Prashant P. Shah | 2011-07-11 12:06:57 +0530 |
commit | ded2973add27779689e6f4ebbeb7a23e67ad1245 (patch) | |
tree | d04de8f503bb947a42ab3e9716a7a6cbd220e391 /migrated_labs.inc | |
parent | c72b90c4a23e0d411713789477945bc12182c56c (diff) | |
download | scilab_lab_migration-ded2973add27779689e6f4ebbeb7a23e67ad1245.tar.gz scilab_lab_migration-ded2973add27779689e6f4ebbeb7a23e67ad1245.tar.bz2 scilab_lab_migration-ded2973add27779689e6f4ebbeb7a23e67ad1245.zip |
added list of labs migrated
Signed-off-by: Prashant P. Shah <pshah.mumbai@gmail.com>
Diffstat (limited to 'migrated_labs.inc')
-rw-r--r-- | migrated_labs.inc | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/migrated_labs.inc b/migrated_labs.inc new file mode 100644 index 0000000..334f2f8 --- /dev/null +++ b/migrated_labs.inc @@ -0,0 +1,36 @@ +<?php +// $Id$ + +function migrated_labs() +{ + global $user; + $dl_root_path = 'sites/default/files/lab_migration/'; + + /* get pending proposals to be approved */ + $labs_rows = array(); + $labs_q = db_query("SELECT * FROM {lab_migration_proposal} WHERE approval_status = 1 ORDER BY id DESC"); + while ($labs_data = db_fetch_object($labs_q)) { + /* file attachments */ + $file_links = ''; + $problem_q = db_query("SELECT * FROM {lab_migration_files} WHERE link_id = %d AND filetype = 'P'", $labs_data->id); + $problem_data = db_fetch_object($problem_q); + $file_links .= '<br/>' . l('Problem Statment', $dl_root_path . $problem_data->filepath); + $sup_q = db_query("SELECT * FROM {lab_migration_files} WHERE link_id = %d AND filetype = 'S'", $labs_data->id); + $sup_data = db_fetch_object($sup_q); + if ($sup_data) + $file_links .= '<br/>' . l('Suplementary Files', $dl_root_path . $sup_data->filepath); + + $labs_rows[] = array($labs_data->university, $labs_data->lab_title, $labs_data->problem_topic . $file_links, l($labs_data->name, 'user/' . $labs_data->uid) . '<br/>' . $labs_data->department); + } + + /* check if there are any pending proposals */ + if (!$labs_rows) { + drupal_set_message(t('There are no lab migrations.'), 'status'); + return ''; + } + + $labs_header = array('University', 'Title of the Lab', 'Title of the Problem', 'Professor Name and Dept.'); + $output = theme_table($labs_header, $labs_rows); + return $output; +} + |