summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202023-08-28 15:48:46 +0530
committerGitHub2023-08-28 15:48:46 +0530
commitc4697296ac6b689b30694ff2194c6ad167f89ba2 (patch)
tree0628a490905bac695ab5509357d7a79b77220aa1
parent50c0101c00fe620b191d98d449b5732dd7b49db8 (diff)
parent971e7ad3072c31fae16cc165645f4a1e6bbc3b9a (diff)
downloadsoul_science_and_concept_map_project-c4697296ac6b689b30694ff2194c6ad167f89ba2.tar.gz
soul_science_and_concept_map_project-c4697296ac6b689b30694ff2194c6ad167f89ba2.tar.bz2
soul_science_and_concept_map_project-c4697296ac6b689b30694ff2194c6ad167f89ba2.zip
Merge pull request #11 from akshay9085/ncert-books
add textbook fields
-rwxr-xr-xmanage_proposal.inc77
-rwxr-xr-xproposal.inc165
-rwxr-xr-xscience_and_concept_map.module19
-rwxr-xr-xscience_and_concept_map_details.inc15
4 files changed, 246 insertions, 30 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc
index c6a6b26..7d2e601 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -111,6 +111,11 @@ function science_and_concept_map_proposal_approval_form($form, &$form_state)
global $user;
/* get current proposal */
$proposal_id = (int) arg(3);
+ $query = db_select('soul_science_and_concept_map_textbook_details');
+ $query ->fields('soul_science_and_concept_map_textbook_details');
+ $query-> condition('proposal_id', $proposal_id);
+ $book_q = $query->execute();
+ $book_data = $book_q->fetchObject();
$query = db_select('soul_science_and_concept_map_proposal');
$query->fields('soul_science_and_concept_map_proposal');
$query->condition('id', $proposal_id);
@@ -150,6 +155,22 @@ function science_and_concept_map_proposal_approval_form($form, &$form_state)
{
$project_guide_email_id = $proposal_data->project_guide_email_id;
}
+ if ($proposal_data->project_guide_department == "NULL" || $proposal_data->project_guide_department == "")
+ {
+ $project_guide_department = "Not Entered";
+ } //$proposal_data->project_guide_email_id == NULL
+ else
+ {
+ $project_guide_department = $proposal_data->project_guide_department;
+ }
+ if ($proposal_data->project_guide_university == "NULL" || $proposal_data->project_guide_university == "")
+ {
+ $project_guide_university = "Not Entered";
+ } //$proposal_data->project_guide_email_id == NULL
+ else
+ {
+ $project_guide_university = $proposal_data->project_guide_university;
+ }
$query = db_select('soul_science_and_concept_map_software_version');
$query->fields('soul_science_and_concept_map_software_version');
$query->condition('id', $proposal_data->software_version);
@@ -238,22 +259,22 @@ function science_and_concept_map_proposal_approval_form($form, &$form_state)
$form['project_guide_name'] = array(
'#type' => 'item',
'#title' => t('Name of the faculty member of your Institution, if any, who helped you with this project '),
- '#markup' => $proposal_data->project_guide_name
+ '#markup' => $project_guide_name
);
$form['project_guide_department'] = array(
'#type' => 'item',
'#title' => t('Department of the faculty member of your Institution, if any, who helped you with this project '),
- '#markup' => $proposal_data->project_guide_department
+ '#markup' => $project_guide_department
);
$form['project_guide_email_id'] = array(
'#type' => 'item',
'#title' => t('Email id of the faculty member of your Institution, if any, who helped you with this project'),
- '#markup' =>$proposal_data->project_guide_email_id
+ '#markup' =>$project_guide_email_id
);
$form['project_guide_university'] = array(
'#type' => 'item',
'#title' => t('University name of the faculty member of your Institution, if any, who helped you with this project'),
- '#markup' =>$proposal_data->project_guide_university
+ '#markup' =>$project_guide_university
);
$form['options'] = array(
'#type' => 'item',
@@ -290,20 +311,42 @@ function science_and_concept_map_proposal_approval_form($form, &$form_state)
'#markup' => $second_software,
'#title' => t('Second Software Version')
);
- $form['project_guide_name'] = array(
- '#type' => 'item',
- '#title' => t('Project guide'),
- '#markup' => $project_guide_name
- );
- $form['project_guide_email_id'] = array(
- '#type' => 'item',
- '#title' => t('Project guide email'),
- '#markup' => $project_guide_email_id
- );
- $form['project_guide_university'] = array(
+ if($proposal_data->is_ncert_book == 'Yes'){
+ $form['book_name'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->book,
+ '#title' => t('Book name')
+ );
+ $form['author_name'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->author,
+ '#title' => t('Author name')
+ );
+ $form['isbn_no'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->isbn,
+ '#title' => t('ISBN no.')
+ );
+ $form['publisher'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->publisher,
+ '#title' => t('Publisher and place')
+ );
+ $form['edition'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->edition,
+ '#title' => t('Edition of a book')
+ );
+ $form['book_year'] = array(
+ '#type' => 'item',
+ '#markup' => $book_data->book_year,
+ '#title' => t('Year of publication')
+ );
+ }
+ $form['year_of_study'] = array(
'#type' => 'item',
- '#title' => t('Project guide university'),
- '#markup' => $project_guide_university
+ '#markup' => $book_data->year_of_study,
+ '#title' => t('The project is suitable for class (school education)/year of study(college education)')
);
$form['project_title'] = array(
'#type' => 'item',
diff --git a/proposal.inc b/proposal.inc
index df9db83..11915c7 100755
--- a/proposal.inc
+++ b/proposal.inc
@@ -317,6 +317,98 @@ function science_and_concept_map_proposal_form($form, &$form_state, $no_js_use =
'#title' => t('Select Second Software (If applicable)'),
'#options' => _soul_list_of_second_software_version()
);
+ /************** */
+ $form['is_ncert_book'] = array(
+ '#type' => 'radios',
+ '#title' => t('Does the content of this project match any chapter of a textbook'),
+ '#options' => array(
+ 'Yes' => 'Yes',
+ 'No' => 'No'
+ ),
+ '#required' => TRUE
+ );
+ /**************************************** */
+ $form['preference1'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Details of Textbook'),
+ '#collapsible' => TRUE,
+ '#collapsed' => FALSE,
+ '#states' => array(
+ 'visible' => array(
+ ':input[name="is_ncert_book"]' => array(
+ 'value' => 'Yes'
+ )
+ )
+ )
+ );
+ $form['preference1']['book1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Title of the book'),
+ '#size' => 30,
+ '#maxlength' => 100,
+ '#required' => TRUE,
+ '#validated' => TRUE
+ );
+ $form['preference1']['author1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Author Name'),
+ '#size' => 30,
+ '#maxlength' => 100,
+ // '#required' => TRUE
+ //'#value' => $row1->author,
+ //'#disabled' => ($row1->author?TRUE:FALSE),
+ );
+ $form['preference1']['isbn1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('ISBN No'),
+ '#size' => 30,
+ '#maxlength' => 25,
+ '#required' => TRUE,
+ '#validated' => TRUE
+ // '#required' => TRUE
+ // '#value' => $row1->isbn,
+ // '#disabled' => ($row1->isbn?TRUE:FALSE),
+ );
+ $form['preference1']['publisher1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Publisher & Place'),
+ '#size' => 30,
+ '#maxlength' => 50,
+ '#required' => TRUE,
+ '#validated' => TRUE
+ // '#required' => TRUE
+ //'#value' => $row1->publisher,
+ );
+ $form['preference1']['edition1'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Edition'),
+ '#size' => 4,
+ '#maxlength' => 2,
+ '#required' => TRUE,
+ '#validated' => TRUE
+ // '#required' => TRUE
+ //'#value' => $row1->edition,
+ );
+ $form['preference1']['book_year'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Year of publication'),
+ '#size' => 4,
+ '#maxlength' => 4,
+ '#required' => TRUE,
+ '#validated' => TRUE
+ // '#required' => TRUE
+ //'#value' => $row1->year,
+ );
+ $form['year_of_study'] = array(
+ '#type' => 'select',
+ '#title' => t('The project is suitable for class (school education)/year of study(college education) '),
+ // '#options' => '_tbc_list_of_main_categories()',
+ '#options' =>_df_list_of_classes(),
+ '#default_value' => '-select-',
+ '#tree' => TRUE,
+ '#required' => TRUE
+ );
+ /*************************************** */
$form['project_title'] = array(
'#type' => 'textfield',
'#title' => t('Project Title'),
@@ -566,6 +658,35 @@ if (isset($_FILES['files']))
} //$file_name
} //$_FILES['files']['name'] as $file_form_name => $file_name
}
+ //
+ if ($form_state['values']['is_ncert_book'] == 'Yes') {
+ $preference1 = $form_state['values'];
+ if ($preference1['book1'] == '') {
+
+ form_set_error('book1', t('Title of the book is required.'));
+
+ }
+ if ($preference1['isbn1'] == '') {
+
+ form_set_error('isbn1', t('ISBN No is required.'));
+
+ }
+ if ($preference1['publisher1'] == '') {
+
+ form_set_error('publisher1', t('Publisher & Place is required.'));
+
+ }
+ if ($preference1['edition1'] == '') {
+
+ form_set_error('edition1', t('Edition is required.'));
+
+ }
+ if ($preference1['book_year'] == '') {
+
+ form_set_error('book_year', t('Year of publication is required.'));
+
+ }
+ }
return $form_state;
}
function science_and_concept_map_proposal_form_submit($form, &$form_state)
@@ -586,7 +707,7 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
$options = $v['options'];
$category = $v['category'];
$software_version_no =$v['software_version_no'];
- $directory_name = _df_dir_name($project_title, $proposar_name);
+ $directory_name = _scmp_dir_name($project_title, $proposar_name);
if ($category == '3D Modeling Project')
{
$sub_category = $v['sub_category'];
@@ -604,6 +725,7 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
{
$other_software_version_no = 'None';
}
+
$result = "INSERT INTO {soul_science_and_concept_map_proposal}
(
uid,
@@ -638,7 +760,8 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
approval_date,
abstractfilepath,
reference,
- expected_date_of_completion
+ expected_date_of_completion,
+ is_ncert_book
) VALUES
(
:uid,
@@ -673,7 +796,8 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
:approval_date,
:abstractfilepath,
:reference,
- :expected_date_of_completion
+ :expected_date_of_completion,
+ :is_ncert_book
)";
$args = array(
":uid" => $user->uid,
@@ -708,7 +832,8 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
":approval_date" => 0,
":expected_date_of_completion" => strtotime(date($v['expected_date_of_completion'])),
":abstractfilepath" => "",
- ":reference" => $v['reference']
+ ":reference" => $v['reference'],
+ ":is_ncert_book" => $v['is_ncert_book']
);
//var_dump($args);die;
//var_dump($result);die;
@@ -716,6 +841,38 @@ function science_and_concept_map_proposal_form_submit($form, &$form_state)
'return' => Database::RETURN_INSERT_ID
));
//var_dump($args);die;
+$proposal_id = $result1;
+ /* inserting first book preference */
+ if ($form_state['values']['book1'])
+ {
+ $bk1 = trim($form_state['values']['book1']);
+ $auth1 = trim($form_state['values']['author1']);
+ $pref_id = NULL;
+ // $directory_name = _dir_name($bk1, $auth1, $pref_id);
+ $query = "INSERT INTO soul_science_and_concept_map_textbook_details
+ (proposal_id, book, author, isbn, publisher, edition, book_year, year_of_study) VALUES (:proposal_id, :book, :author, :isbn, :publisher, :edition, :book_year, :year_of_study)
+ ";
+ $args = array(
+ ":proposal_id" => $proposal_id,
+ ":book" => trim(ucwords(strtolower($form_state['values']['book1']))),
+ ":author" => trim(ucwords(strtolower($form_state['values']['author1']))),
+ ":isbn" => trim($form_state['values']['isbn1']),
+ ":publisher" => trim(ucwords(strtolower($form_state['values']['publisher1']))),
+ ":edition" => trim($form_state['values']['edition1']),
+ ":book_year" => trim($form_state['values']['book_year']),
+ ":year_of_study" => trim($form_state['values']['year_of_study']),
+ // ":category" => $form_state['values']['category'],
+ // ":approval_status" => 0,
+ // ":directory_name" => $form_state['values']['dir_name1']
+ );
+ $result = db_query($query, $args, array(
+ 'return' => Database::RETURN_INSERT_ID
+ ));
+ if (!$result)
+ {
+ drupal_set_message(t('Error receiving your first book preference.'), 'error');
+ } //!$result
+ } //$form_state['values']['book1']
$dest_path = $directory_name . '/';
$dest_path1 = $root_path . $dest_path;
diff --git a/science_and_concept_map.module b/science_and_concept_map.module
index a592fc1..0949bd2 100755
--- a/science_and_concept_map.module
+++ b/science_and_concept_map.module
@@ -734,6 +734,21 @@ function _df_list_of_states()
} //$states_list_data = $states_list->fetchObject()
return $states;
}
+function _df_list_of_classes()
+{
+ $class_name = array(
+ 0 => '-Select-'
+ );
+ $query = db_select('class_table');
+ $query->fields('class_table');
+ $query->orderBy('id', 'ASC');
+ $class_name_list = $query->execute();
+ while ($class_name_list_data = $class_name_list->fetchObject())
+ {
+ $class_name[$class_name_list_data->class_name] = $class_name_list_data->class_name;
+ }
+ return $class_name;
+}
function _df_list_of_cities()
{
$city = array(
@@ -850,7 +865,7 @@ function _soul_list_of_software_version_details($software_version_id)
return $software_versions;
}
-function _df_dir_name($project, $proposar_name)
+function _scmp_dir_name($project, $proposar_name)
{
$project_title = ucname($project);
$proposar_name = ucname($proposar_name);
@@ -981,4 +996,4 @@ function rrmdir($dir)
reset($objects);
rmdir($dir);
} //is_dir($dir)
-} \ No newline at end of file
+}
diff --git a/science_and_concept_map_details.inc b/science_and_concept_map_details.inc
index 425ecc3..d0ea026 100755
--- a/science_and_concept_map_details.inc
+++ b/science_and_concept_map_details.inc
@@ -13,12 +13,12 @@ function science_and_concept_map_completed_proposals_all()
//var_dump($soul_project_abstract);die;
if ($result->rowCount() == 0)
{
- $output .= "Work has been completed for the following science and concept map. We welcome your contributions." ."<hr>";
+ $output .= "We welcome your contributions." ."<hr>";
} //$result->rowCount() == 0
else
{
- $output .= "Work has been completed for the following science and concept map. We welcome your contributions." . "<hr>";
+ $output .= "Work has been completed for the following Science and Concept Map." . "<hr>";
$preference_rows = array();
$i = $result->rowCount();
while ($row = $result->fetchObject())
@@ -65,13 +65,14 @@ function science_and_concept_map_progress_all()
$result = $query->execute();
if ($result->rowCount() == 0)
{
- $page_content .= "Work is in progress for the following science and concept map under science and concept map Project<hr>";
+ $page_content .= "We welcome your contributions.<hr>";
} //$result->rowCount() == 0
else
{
- $page_content .= "Work is in progress for the following science and concept map under science and concept map Project<hr>";
+ $i = $result->rowCount();
+ $page_content .= "Work is in progress for the following Science and Concept Map<hr>";
$preference_rows = array();
- $i = 1;
+ // $i = 1;
while ($row = $result->fetchObject())
{
$approval_date = date("Y", $row->approval_date);
@@ -82,11 +83,11 @@ function science_and_concept_map_progress_all()
$row->university,
$approval_date
);
- $i++;
+ $i--;
} //$row = $result->fetchObject()
$preference_header = array(
'No',
- 'science and concept map Project',
+ 'Science and Concept Map Project',
'Contributor Name',
'Institute',
'Year'