fields('textbook_companion_aicte');
$query->condition('status', 0);
$query->condition('selected', 0);
$result = $query->execute();
$form = array();
$form["wrapper"] = array(
"#type" => "fieldset",
"#prefix" => "
";
$num_rows = $result->rowCount();
if ($num_rows > 0)
{
$i = 1;
while ($row = $result->fetchObject())
{
/* fixing title string */
$title = "";
$edition = "";
$year = "";
$title = "{$row->book} by {$row->author}";
if ($row->edition)
{
$edition = "
ed: {$row->edition}";
} //$row->edition
if ($row->year)
{
if ($row->edition)
{
$year = ",
pub: {$row->year}";
} //$row->edition
else
{
$year = "
pub: {$row->year}";
}
} //$row->year
if ($edition or $year)
{
$title .= "({$edition} {$year})";
} //$edition or $year
$page_content .= "
{$i}) {$title}
";
$i++;
} //$row = $result->fetchObject()
} //$num_rows > 0
$page_content .= "
";
/* adding aicte report form */
//$page_content .= drupal_get_form("textbook_companion_aicte_report_form");
return $page_content;
} //!$user->uid
/* check if user has already submitted a proposal */
$query = db_select('textbook_companion_proposal');
$query->fields('textbook_companion_proposal');
$query->condition('uid', $user->uid);
$query->orderBy('id', 'DESC');
$query->range(0, 1);
$proposal_q = $query->execute();
if ($proposal_q)
{
if ($proposal_data = $proposal_q->fetchObject())
{
switch ($proposal_data->proposal_status)
{
case 0:
drupal_set_message(t('We have already received your proposal. We will get back to you soon.'), 'status');
drupal_goto('');
return;
break;
case 1:
drupal_set_message(t('Your proposal has been approved. Please go to ' . l('Code Submission', 'textbook_companion/code') . ' to upload your code'), 'status');
drupal_goto('');
return;
break;
case 2:
drupal_set_message(t('Your proposal has been dis-approved. Please create another proposal below.'), 'error');
break;
case 3:
drupal_set_message(t('Congratulations! You have completed your last book proposal. You can create another proposal below.'), 'status');
break;
default:
drupal_set_message(t('Invalid proposal state. Please contact site administrator for further information.'), 'error');
drupal_goto('');
return;
break;
} //$proposal_data->proposal_status
} //$proposal_data = $proposal_q->fetchObject()
} //$proposal_q
variable_del("aicte_" . $user->uid);
$page_content .= "