diff options
author | prashant | 2015-10-16 11:09:43 +0530 |
---|---|---|
committer | prashant | 2015-10-16 11:09:43 +0530 |
commit | 4c37658ead0218b14d733b4e2b45085cddace766 (patch) | |
tree | 1d3c9931b6ee3d7a9771b9553fc23ccc62cde482 | |
parent | 47570c981648d285053586a598556ec72a754c4b (diff) | |
download | DWSIM_lab_migration_module-4c37658ead0218b14d733b4e2b45085cddace766.tar.gz DWSIM_lab_migration_module-4c37658ead0218b14d733b4e2b45085cddace766.tar.bz2 DWSIM_lab_migration_module-4c37658ead0218b14d733b4e2b45085cddace766.zip |
code formatted and added message for no rows
-rwxr-xr-x | lab_details.inc | 91 |
1 files changed, 60 insertions, 31 deletions
diff --git a/lab_details.inc b/lab_details.inc index 217c4b6..9c4db1e 100755 --- a/lab_details.inc +++ b/lab_details.inc @@ -1,43 +1,72 @@ <?php - function lab_migration_completed_labs_all() { - $page_content = ""; - //$query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 3"; - $query = db_select('lab_migration_proposal'); - $query->fields('lab_migration_proposal'); - $query->condition('approval_status', 3); - $result = $query->execute(); - //$result = db_query($query); +function lab_migration_completed_labs_all() +{ + $output = ""; + //$query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 3"; + $query = db_select('lab_migration_proposal'); + $query->fields('lab_migration_proposal'); + $query->condition('approval_status', 3); + $result = $query->execute(); + //$result = db_query($query); + + if ($result->rowCount() == 0) { + + $output .= "We will in process to update lab migration data"; + + } else { $preference_rows = array(); - $i=1; - while($row = $result->fetchObject()) { - $approval_date = date("Y", $row->approval_date); - $preference_rows[] = array($i, $row->university , l($row->lab_title,"lab-migration-run/".$row->id),$approval_date); - $i++; - } - $preference_header = array('No','Institute', 'Lab', 'Year'); - $output = theme('table', array('header' => $preference_header, 'rows' => $preference_rows)); - return $output; - } - - function lab_migration_labs_progress_all() { - $page_content = ""; - //$query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 1 and solution_status = 2"; - $query = db_select('lab_migration_proposal'); - $query->fields('lab_migration_proposal'); - $query->condition('approval_status', 1); - $query->condition('solution_status', 2); - $result = $query->execute(); + $i = 1; + while ($row = $result->fetchObject()) { + $approval_date = date("Y", $row->approval_date); + $preference_rows[] = array( + $i, + $row->university, + l($row->lab_title, "lab-migration-run/" . $row->id), + $approval_date + ); + $i++; + } + $preference_header = array( + 'No', + 'Institute', + 'Lab', + 'Year' + ); + $output .= theme('table', array( + 'header' => $preference_header, + 'rows' => $preference_rows + )); + } + + return $output; +} + +function lab_migration_labs_progress_all() +{ + $page_content = ""; + //$query = "SELECT * FROM {lab_migration_proposal} WHERE approval_status = 1 and solution_status = 2"; + $query = db_select('lab_migration_proposal'); + $query->fields('lab_migration_proposal'); + $query->condition('approval_status', 1); + $query->condition('solution_status', 2); + $result = $query->execute(); + + if ($result->rowCount() == 0) { + + $page_content .= "We will in process to update lab migration data"; + + } else { //$result = db_query($query); $page_content .= "<ol>"; - while($row = $result->fetchObject()) { + while ($row = $result->fetchObject()) { $page_content .= "<li>"; $page_content .= $row->university . " ({$row->lab_title})"; $page_content .= "</li>"; } $page_content .= "</ol>"; - return $page_content; } - - + return $page_content; +} + ?> |