From e9ed6cf562bebc6e013af48d43674320124995d2 Mon Sep 17 00:00:00 2001
From: diptighosalkar
Date: Tue, 4 Oct 2016 21:47:06 +0530
Subject: Dynamic PDF Generator
---
fossee_stats.module | 3388 ++++++++++++++++++++++++++++++++-------------------
1 file changed, 2101 insertions(+), 1287 deletions(-)
(limited to 'fossee_stats.module')
diff --git a/fossee_stats.module b/fossee_stats.module
index 5406323..163c49f 100755
--- a/fossee_stats.module
+++ b/fossee_stats.module
@@ -15,15 +15,15 @@ function fossee_stats_permission()
"title" => t("Manage Workshop"),
"description" => t("Allows users to manage workshop.")
),
- "view postalcampaign" => array(
+ "view postalcampaign" => array(
"title" => t("View postalcampaign"),
"description" => t("Allows users to view postalcampaign.")
),
- "manage postalcampaign" => array(
+ "manage postalcampaign" => array(
"title" => t("Manage Postalcampaign"),
"description" => t("Allows users to manage postalcampaign.")
),
- "view tutorial" => array(
+ "view tutorial" => array(
"title" => t("View Spoken Tutorial"),
"description" => t("Allows users to view spoken tutorial.")
),
@@ -39,11 +39,11 @@ function fossee_stats_permission()
"title" => t("Manage Events"),
"description" => t("Allows users to manage events.")
),
- "administer events" => array(
+ "administer events" => array(
"title" => t("Events upload setting"),
"description" => t("Allows users to manage postalcampaign.")
)
-
+
);
}
@@ -76,26 +76,26 @@ function fossee_stats_menu()
);
//Fetch the list of self workshop with all detail after filter is applied and count is received
$items['completed-workshops-list'] = array(
- 'title' => '',
+ 'title' => '',
'page callback' => 'completed_workshops_list',
- 'page arguments' => array(
+ 'page arguments' => array(
5
),
"access arguments" => array(
- "access fossee_stats"
+ "access fossee_stats"
),
- //'access callback' => TRUE,
- "type" => MENU_CALLBACK
- );
- //Fetch the Details of self workshop
- $items['view-completed-workshop'] = array(
- 'title' => 'Workshop Details',
- 'page callback' => 'view_completed_workshop',
- 'access callback' => TRUE,
- );
-
+ //'access callback' => TRUE,
+ "type" => MENU_CALLBACK
+ );
+ //Fetch the Details of self workshop
+ $items['view-completed-workshop'] = array(
+ 'title' => 'Workshop Details',
+ 'page callback' => 'view_completed_workshop',
+ 'access callback' => TRUE
+ );
+
//Following are menu of Events (Workshop, Conference along with testimonial and images and speakers)
-
+
$items["events/add"] = array(
"title" => "Add Events",
"page callback" => "workshop_display_all",
@@ -104,7 +104,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- //To edit existing events detail
+ //To edit existing events detail
$items["events/edit"] = array(
"title" => "Edit Events",
"page callback" => "workshop_edit_all",
@@ -113,7 +113,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- //To delete existing events
+ //To delete existing events
$items["events/delete"] = array(
"title" => "Delete Events",
"page callback" => "workshop_delete_all",
@@ -131,7 +131,17 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- //List of images added to particular event
+ //Generate PDF
+ $items["events/pdfgenerate"] = array(
+ "title" => "Generate PDF of Selected Event",
+ "page callback" => "generate_pdf",
+ "access arguments" => array(
+ "view workshop"
+ ),
+ "type" => MENU_CALLBACK
+ );
+
+ //List of images added to particular event
$items["events/images"] = array(
"title" => "Event's Images",
"page callback" => "workshop_view_image_all",
@@ -140,7 +150,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- //For changing image
+ //For changing image
$items["events/images/change"] = array(
"title" => "Event's Images",
"page callback" => "workshop_view_image_change",
@@ -167,7 +177,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
-
+
$items["events"] = array(
"title" => "Events",
"page callback" => "event_seminar_view_all",
@@ -176,7 +186,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
-
+
$items["testconf"] = array(
"title" => "Activities",
"page callback" => "event_activities_all",
@@ -186,9 +196,9 @@ function fossee_stats_menu()
"type" => MENU_CALLBACK
);
-
- // List of all Postal Campaign
- $items["postalcampaign"] = array(
+
+ // List of all Postal Campaign
+ $items["postalcampaign"] = array(
"title" => "Postal Campaign",
"page callback" => "postalcampaign_view_withoutfilter",
"access arguments" => array(
@@ -196,7 +206,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- // Add Postal Campaign
+ // Add Postal Campaign
$items["postalcampaign/add"] = array(
"title" => "Add Postal Campaign",
"page callback" => "postalcampaign_display_all",
@@ -205,8 +215,8 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- // Edit Postal Campaign
- $items["postalcampaign/edit"] = array(
+ // Edit Postal Campaign
+ $items["postalcampaign/edit"] = array(
"title" => "Edit Postal Campaign",
"page callback" => "postalcampaign_edit_all",
"access arguments" => array(
@@ -214,7 +224,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- // Delete Postal Campaign
+ // Delete Postal Campaign
$items["postalcampaign/delete"] = array(
"title" => "Delete Postal Campaign",
"page callback" => "postalcampaign_delete_all",
@@ -223,7 +233,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- // View detail of selected Postal Campaign
+ // View detail of selected Postal Campaign
$items["postalcampaign/view_details"] = array(
"title" => "Postal Campaign Detail",
"page callback" => "postalcampaign_view_details_all",
@@ -232,8 +242,8 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
- //To download postal campaign poster in zip format
- $items["postalcampaign/download"] = array(
+ //To download postal campaign poster in zip format
+ $items["postalcampaign/download"] = array(
"title" => "Download Postal Campaign",
"page callback" => "createZipOfPosterMaterial",
"access arguments" => array(
@@ -241,11 +251,11 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
-
+
/*Spoken Tutorial*/
-
- //Add Spoken Tutorial
-
+
+ //Add Spoken Tutorial
+
$items["spokentutorial/add"] = array(
"title" => "Add Spoken Tutorial",
"page callback" => "spokentutorial_display_all",
@@ -254,7 +264,7 @@ function fossee_stats_menu()
),
"type" => MENU_CALLBACK
);
-
+
/* ADMIN SETTINGS */
//For mentioning extension allowed for image and pdf
$items['admin/settings/events'] = array(
@@ -275,21 +285,22 @@ function fossee_stats_menu()
//Folder path to save all uploaded images of events
function events_images_path()
- {
- return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'events_images/';
- }
+{
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'events_images/';
+}
//Folder path to save all uploaded images/PDF of postal campaign
-function posters_path() {
-
- return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'campaign_posters/';
+function posters_path()
+{
+
+ return $_SERVER['DOCUMENT_ROOT'] . base_path() . 'campaign_posters/';
}
//Main Page Form
function fossee_stats_form($form, &$form_state)
{
/* First Dropdown for Foss type */
-
+
$options_first = _ajax_example_get_first_dropdown_options();
if (isset($form_state['values']['foss_sub_project']) && isset($form_state['values']['foss_type']) && isset($form_state['values']['foss_sub_project_status'])) {
$foss_project = isset($form_state['values']['foss_type']) ? $form_state['values']['foss_type'] : key($options_first);
@@ -313,8 +324,8 @@ function fossee_stats_form($form, &$form_state)
)
)
);
- /* Second Dropdown for Activities like TBC, LM and other */
-
+ /* Second Dropdown for Activities like TBC, LM and other */
+
if (isset($form_state['values']['foss_sub_project']) && isset($form_state['values']['foss_type']) && isset($form_state['values']['foss_sub_project_status'])) {
$foss_sub_project = isset($form_state['values']['foss_sub_project']) ? $form_state['values']['foss_sub_project'] : key(get_activities_list($foss_project));
} else {
@@ -344,8 +355,8 @@ function fossee_stats_form($form, &$form_state)
)
)
);
-
- /* third Dropdown for Status like Completed and In Progress */
+
+ /* third Dropdown for Status like Completed and In Progress */
if (isset($form_state['values']['foss_sub_project']) && isset($form_state['values']['foss_type']) && isset($form_state['values']['foss_sub_project_status'])) {
$foss_sub_project_status = isset($form_state['values']['$foss_sub_project_status']) ? $form_state['values']['$foss_sub_project_status'] : '';
} else {
@@ -378,7 +389,7 @@ function fossee_stats_form($form, &$form_state)
)
)
);
- /* Start Date for Filter */
+ /* Start Date for Filter */
$form['start_date'] = array(
'#type' => 'date_popup',
'#title' => t('From Date:'),
@@ -401,7 +412,7 @@ function fossee_stats_form($form, &$form_state)
)
)
);
- /* End Date for Filter */
+ /* End Date for Filter */
$form['end_date'] = array(
'#type' => 'date_popup',
'#title' => t('To Date:'),
@@ -424,7 +435,7 @@ function fossee_stats_form($form, &$form_state)
)
)
);
- /* Country list for Filter */
+ /* Country list for Filter */
if (isset($form_state['values']['countryname']) && isset($form_state['values']['statename']) && isset($form_state['values']['cityname'])) {
$countryname = isset($form_state['values']['countryname']) ? $form_state['values']['countryname'] : key(get_country_list($foss_project, $foss_sub_project));
} else {
@@ -466,7 +477,7 @@ function fossee_stats_form($form, &$form_state)
)
);
- /* State list for Filter */
+ /* State list for Filter */
if (isset($form_state['values']['countryname']) && isset($form_state['values']['statename']) && isset($form_state['values']['cityname'])) {
$statename = isset($form_state['values']['statename']) ? $form_state['values']['statename'] : key(get_state_list($foss_project, $foss_sub_project, $countryname));
} else {
@@ -510,7 +521,7 @@ function fossee_stats_form($form, &$form_state)
)
);
-/* City list for Filter */
+ /* City list for Filter */
if (isset($form_state['values']['countryname']) && isset($form_state['values']['statename']) && isset($form_state['values']['cityname'])) {
$cityname = isset($form_state['values']['cityname']) ? $form_state['values']['cityname'] : key(get_city_list($foss_project, $foss_sub_project, $countryname, $statename));
} else {
@@ -553,13 +564,13 @@ function fossee_stats_form($form, &$form_state)
'message' => ''
)
),
- '#value' => t('Filter'),
+ '#value' => t('Filter'),
'#prefix' => '
-
' . get_tabledata_TBC_or_LM("TBC", "1960/01/01", "").'
+
' . get_tabledata_TBC_or_LM("TBC", "1960/01/01", "") . '
' . drupal_render($TBC_getchart) . '
-
' . get_tabledata_TBC_or_LM("LM", "1960/01/01", "").'
+
' . get_tabledata_TBC_or_LM("LM", "1960/01/01", "") . '
' . drupal_render($LM_getchart) . '
-
' . workshop_view_all(0,1960-01-01, date("Y-m-d")).'
+
' . workshop_view_all(0, 1960 - 01 - 01, date("Y-m-d")) . '
-
'.getselfworkshoplcount(0,1960-01-01, date("Y-m-d"),"","").'
+
' . getselfworkshoplcount(0, 1960 - 01 - 01, date("Y-m-d"), "", "") . '
-
' . conference_seminar_view_all(0, "", "").'
+
' . conference_seminar_view_all(0, "", "") . '
-
'.spokentutorial_view_all("").'
+
' . spokentutorial_view_all("") . '
'
);
$form['lastdiv'] = array(
@@ -619,7 +630,7 @@ function getchart($sub_type)
{
$title = "";
if ($sub_type == "TBC") {
- $title = "Textbook Companion Statictics";
+ $title = "Textbook Companion Statistics";
} else {
$title = "Lab Migration Statistics";
}
@@ -649,7 +660,7 @@ function getchartforselectedProject($foss_type, $sub_type, $startdate, $enddate,
$title = "";
if ($sub_type == "TBC") {
- $title = $foss_type . "" . "'s Completed Textbook Companion Statictics";
+ $title = $foss_type . "" . "'s Completed Textbook Companion Statistics";
} else {
$title = $foss_type . "" . "'s Completed Lab Migration Statistics";
}
@@ -662,7 +673,7 @@ function getchartforselectedProject($foss_type, $sub_type, $startdate, $enddate,
'#legend_position' => 'bottom',
'#data_labels' => TRUE,
'#tooltips' => TRUE,
- '#width' => 800,
+ '#width' => 800,
'#height' => 300
);
$chart['pie_data'] = array(
@@ -681,7 +692,7 @@ function getpiechartforselectedProject($foss_type, $sub_type, $startdate, $endda
$title = "";
if ($sub_type == "TBC") {
- $title = $foss_type . "" . "'s Textbook Companion Statictics";
+ $title = $foss_type . "" . "'s Textbook Companion Statistics";
} else {
$title = $foss_type . "" . "'s Lab Migration Statistics";
}
@@ -693,7 +704,7 @@ function getpiechartforselectedProject($foss_type, $sub_type, $startdate, $endda
'#legend_position' => 'right',
'#data_labels' => TRUE,
'#tooltips' => TRUE,
- '#width' => 700,
+ '#width' => 700,
'#height' => 300
);
$chart['pie_data'] = array(
@@ -929,7 +940,7 @@ function list_tbc_and_lm_detail($String, $foss_type, $sub_type, $status, $startd
$page_content .= "
";
$i = 1;
while ($preference_data = $query2->fetchObject()) {
- $page_content .= "- " . $i++ . ". ";
+ $page_content .= "
- ";
$page_content .= "id . " target='_blank'>" . $preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year . "";
@@ -942,7 +953,7 @@ function list_tbc_and_lm_detail($String, $foss_type, $sub_type, $status, $startd
$page_content .= "
";
$i = 1;
while ($preference_data = $query2->fetchObject()) {
- $page_content .= "- " . $i++ . ". ";
+ $page_content .= "
- ";
$page_content .= $preference_data->book . " by " . $preference_data->author . ", " . $preference_data->publisher . ", " . $preference_data->year;
$page_content .= "
";
}
@@ -990,7 +1001,7 @@ function list_tbc_and_lm_detail($String, $foss_type, $sub_type, $status, $startd
$page_content .= "";
$i = 1;
while ($row = $query2->fetchObject()) {
- $page_content .= "- " . $i++ . ". ";
+ $page_content .= "
- ";
$approval_date = date("Y", $row->approval_date);
$page_content .= "id . " target='_blank'>" . $row->lab_title . " " . $approval_date . " (Proposed by " . $row->name . ") ";
//$page_content .= l($row->lab_title . " " . $approval_date,$foss_detail->lm_run."/". $row->id);
@@ -1002,7 +1013,7 @@ function list_tbc_and_lm_detail($String, $foss_type, $sub_type, $status, $startd
$page_content .= "
";
$i = 1;
while ($row = $query2->fetchObject()) {
- $page_content .= "- " . $i++ . ". ";
+ $page_content .= "
- ";
$approval_date = date("Y", $row->approval_date);
$page_content .= $row->lab_title . " " . $approval_date . " (Proposed by " . $row->name . ")";
$page_content .= "
";
@@ -1230,12 +1241,12 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
':startdate' => $startdate,
':enddate' => $enddate
));
- /* $query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND pe.category>0 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate", array(
- ':city' => $cityname,
- ':state' => $statename,
- ':country' => $countryname,
- ':startdate' => $startdate,
- ':enddate' => $enddate
+ /* $query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND pe.category>0 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate", array(
+ ':city' => $cityname,
+ ':state' => $statename,
+ ':country' => $countryname,
+ ':startdate' => $startdate,
+ ':enddate' => $enddate
));*/
} else {
$query2 = db_query("SELECT COUNT( pe.book ) AS book_count ,FROM_UNIXTIME(po.completion_date, '%Y') AS year FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status =3 AND pe.approval_status =1 AND pe.category>0 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate Group by FROM_UNIXTIME(po.completion_date, '%Y')", array(
@@ -1245,12 +1256,12 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
':startdate' => $startdate,
':enddate' => $enddate
));
- /* $query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND pe.category>0 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate", array(
- ':city' => $cityname,
- ':state' => $statename,
- ':country' => $countryname,
- ':startdate' => $startdate,
- ':enddate' => $enddate
+ /* $query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND pe.category>0 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate", array(
+ ':city' => $cityname,
+ ':state' => $statename,
+ ':country' => $countryname,
+ ':startdate' => $startdate,
+ ':enddate' => $enddate
));*/
}
} else {
@@ -1262,49 +1273,49 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
':enddate' => $enddate
));
/*$query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND po.city LIKE :city AND po.state LIKE :state AND po.country LIKE :country AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate", array(
- ':city' => $cityname,
- ':state' => $statename,
- ':country' => $countryname,
- ':startdate' => $startdate,
- ':enddate' => $enddate
+ ':city' => $cityname,
+ ':state' => $statename,
+ ':country' => $countryname,
+ ':startdate' => $startdate,
+ ':enddate' => $enddate
));*/
}
db_set_active('default'); // We need to call the main (drupal) db back
db_set_active();
-
+
$result = $query2->fetchAll();
-
+
foreach ($result as $tbc_yearwise_count) {
-
- $completedbookcount= $tbc_yearwise_count->book_count;
- $option1 = array(
- $tbc_yearwise_count->year,
- (int) $completedbookcount
- );
- array_push($rows, $option1);
- }
- /* while ($tbc_yearwise_count = $result->fetchObject()) {
- $completedbookcount= $tbc_yearwise_count->book_count;
- $option1 = array(
- $tbc_yearwise_count->year,
- (int) $completedbookcount
+
+ $completedbookcount = $tbc_yearwise_count->book_count;
+ $option1 = array(
+ $tbc_yearwise_count->year,
+ (int) $completedbookcount
+ );
+ array_push($rows, $option1);
+ }
+ /* while ($tbc_yearwise_count = $result->fetchObject()) {
+ $completedbookcount= $tbc_yearwise_count->book_count;
+ $option1 = array(
+ $tbc_yearwise_count->year,
+ (int) $completedbookcount
);
array_push($rows, $option1);
-
- }*/
-
-
+
+ }*/
+
+
//$completedbookcount = $query2->fetchObject()->book_count;
-
+
//$pendingbookcount = $query3->fetchObject()->book_count;
/*$option1 = array(
- "Completed TBC",
- (int) $completedbookcount
+ "Completed TBC",
+ (int) $completedbookcount
);
array_push($rows, $option1);*/
- /* $option2 = array(
- "In Progress TBC",
- (int) $pendingbookcount
+ /* $option2 = array(
+ "In Progress TBC",
+ (int) $pendingbookcount
);
array_push($rows, $option2);*/
} else {
@@ -1315,7 +1326,7 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
//$query2->condition('author', '%'.$extrafilter.'%', 'LIKE');
$query2->condition('approved', 1);
$result2 = $query2->execute();
-
+
/*$query3 = db_select('tbc_book');
$query3->addExpression('count(*)', 'count');
//$query3->condition('author', '%'.$extrafilter.'%', 'LIKE');
@@ -1331,8 +1342,8 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
);
array_push($rows, $option1);
/*$option2 = array(
- "In Progress TBC",
- (int) $pendingbookcount
+ "In Progress TBC",
+ (int) $pendingbookcount
);
array_push($rows, $option2);*/
}
@@ -1363,50 +1374,50 @@ function get_data_for_chart_selectedproject($foss_type, $sub_type, $startdate, $
':startdate' => $startdate,
':enddate' => $enddate
));
- /* $query4 = db_query("SELECT COUNT(*) AS count from lab_migration_proposal WHERE approval_status=1 AND city LIKE :city AND state LIKE :state AND country LIKE :country AND FROM_UNIXTIME(approval_date) >=:startdate AND FROM_UNIXTIME(approval_date) <=:enddate", array(
- ':city' => $cityname,
- ':state' => $statename,
- ':country' => $countryname,
- ':startdate' => $startdate,
- ':enddate' => $enddate
+ /* $query4 = db_query("SELECT COUNT(*) AS count from lab_migration_proposal WHERE approval_status=1 AND city LIKE :city AND state LIKE :state AND country LIKE :country AND FROM_UNIXTIME(approval_date) >=:startdate AND FROM_UNIXTIME(approval_date) <=:enddate", array(
+ ':city' => $cityname,
+ ':state' => $statename,
+ ':country' => $countryname,
+ ':startdate' => $startdate,
+ ':enddate' => $enddate
));*/
db_set_active('default'); // We need to call the main (drupal) db back
db_set_active();
-
+
$result = $query3->fetchAll();
-
- foreach ($result as $lm_yearwise_count) {
-
- $completedlabcount= $lm_yearwise_count->count;
- $option1 = array(
- $lm_yearwise_count->year,
- (int) $completedlabcount
- );
- array_push($rows, $option1);
- }
- /*$result = $query3->execute();
-
- while ($lm_yearwise_count = $result->fetchObject()) {
- $completedlabcount= $lm_yearwise_count->count;
- $option1 = array(
+ foreach ($result as $lm_yearwise_count) {
+
+ $completedlabcount = $lm_yearwise_count->count;
+ $option1 = array(
$lm_yearwise_count->year,
(int) $completedlabcount
);
array_push($rows, $option1);
-
- }*/
-
+ }
+
+ /*$result = $query3->execute();
+
+ while ($lm_yearwise_count = $result->fetchObject()) {
+ $completedlabcount= $lm_yearwise_count->count;
+ $option1 = array(
+ $lm_yearwise_count->year,
+ (int) $completedlabcount
+ );
+ array_push($rows, $option1);
+
+ }*/
+
/*$completedlabcount = $query3->fetchObject()->count;
//$pendinglabcount = $query4->fetchObject()->count;
$option1 = array(
- "Completed Labs",
- (int) $completedlabcount
+ "Completed Labs",
+ (int) $completedlabcount
);
array_push($rows, $option1);*/
/*$option2 = array(
- "In Progress labs",
- (int) $pendinglabcount
+ "In Progress labs",
+ (int) $pendinglabcount
);
array_push($rows, $option2);*/
}
@@ -1446,55 +1457,55 @@ function _ajax_example_get_first_dropdown_options()
//List of option to fill secong drop down ie. Activities
/*function _ajax_example_get_second_dropdown_options($foss_project = '')
{
- if ($foss_project != NULL) {
- $query = db_select('foss_type');
- $query->fields('foss_type', array(
- 'tbc',
- 'lab_migration',
- 'workshop',
- 'self_workshop',
- 'conference'
- ));
- $query->fields('foss_type', array(
- 'spoken_tutorial',
- 'postal_campaigns'
- ));
- $query->condition('id', $foss_project);
- $result = $query->execute();
- $subproject_detail = $result->fetchObject();
- $optiondata = array(
- "tbc",
- "lab_migration",
- "workshop",
- "self_workshop",
- "conference",
- "spoken_tutorial",
- "postal_campaigns"
- );
- $optionvalue = array(
- " ",
- "Textbook Companion",
- "Lab Migration",
- "Workshop",
- "Self Workshop",
- "Conference",
- "Spoken Tutorial",
- "Postal Campaigns"
- );
- $options = array();
- $options[0] = "--------------";
- $i = 0;
- foreach ($optiondata as $value) {
- $i++;
- if (($subproject_detail->$value) != 0) {
- $options[$i] = $optionvalue[$i];
- }
- }
- return $options;
- } else {
- $options[0] = "--------------";
- return $options;
- }
+if ($foss_project != NULL) {
+$query = db_select('foss_type');
+$query->fields('foss_type', array(
+'tbc',
+'lab_migration',
+'workshop',
+'self_workshop',
+'conference'
+));
+$query->fields('foss_type', array(
+'spoken_tutorial',
+'postal_campaigns'
+));
+$query->condition('id', $foss_project);
+$result = $query->execute();
+$subproject_detail = $result->fetchObject();
+$optiondata = array(
+"tbc",
+"lab_migration",
+"workshop",
+"self_workshop",
+"conference",
+"spoken_tutorial",
+"postal_campaigns"
+);
+$optionvalue = array(
+" ",
+"Textbook Companion",
+"Lab Migration",
+"Workshop",
+"Self Workshop",
+"Conference",
+"Spoken Tutorial",
+"Postal Campaigns"
+);
+$options = array();
+$options[0] = "--------------";
+$i = 0;
+foreach ($optiondata as $value) {
+$i++;
+if (($subproject_detail->$value) != 0) {
+$options[$i] = $optionvalue[$i];
+}
+}
+return $options;
+} else {
+$options[0] = "--------------";
+return $options;
+}
}*/
//List of option to fill secong drop down ie. Activities
@@ -1605,7 +1616,7 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
' . get_tabledata_TBC_or_LM("TBC", $startdate, $enddate) . '
-
' . drupal_render(getchart("TBC")). '
+
' . drupal_render(getchart("TBC")) . '
' . get_tabledata_TBC_or_LM("LM", $startdate, $enddate) . '
@@ -1614,11 +1625,11 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
' . workshop_view_all(0, $startdate, $enddate) . '
-
'.getselfworkshoplcount(0,$startdate,$enddate,"","").'
+
' . getselfworkshoplcount(0, $startdate, $enddate, "", "") . '
-
' . conference_seminar_view_all(0, $startdate, $enddate) .'
+
' . conference_seminar_view_all(0, $startdate, $enddate) . '
-
'.spokentutorial_view_all("").'
+
' . spokentutorial_view_all("") . '
';
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
$form['load_city']['#markup'] = "";
@@ -1635,7 +1646,7 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
$commands[] = ajax_command_html("#dropdown-third-replace", "");
} else if ($foss_sub_project == '3') {
-
+
$form['startdate']['#markup'] = "";
$commands[] = ajax_command_html("#startdate", "");
$form['enddate']['#markup'] = "";
@@ -1646,11 +1657,11 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
$commands[] = ajax_command_html("#load_state", "");
$form['load_country']['#markup'] = "";
$commands[] = ajax_command_html("#load_country", "");
- $form['dropdown-second-replace']['#markup'] = "";
+ $form['dropdown-second-replace']['#markup'] = "";
$commands[] = ajax_command_html("#dropdown-second-replace", "");
$form['dropdown-third-replace']['#markup'] = "";
$commands[] = ajax_command_html("#dropdown-third-replace", "");
-
+
}
@@ -1679,9 +1690,9 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
'maxDate' => 0
);
$commands[] = ajax_command_html("#enddate", drupal_render($form['end_date']));
-
-
- $form['load_city']['#markup'] = "";
+
+
+ $form['load_city']['#markup'] = "";
$commands[] = ajax_command_html("#load_city", "");
$form['load_state']['#markup'] = "";
$commands[] = ajax_command_html("#load_state", "");
@@ -1695,18 +1706,18 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
if ($foss_sub_project != "" && ($foss_sub_project_activities == 1 || $foss_sub_project_activities == 2)) {
-
- if($foss_sub_project==3){
- $foss_sub_project_activities="";
- $form['dropdown-third-replace']['#markup'] = "";
- $commands[] = ajax_command_html("#dropdown-third-replace", "");
- }else{
- $form['foss_sub_project_status']['#type'] = "select";
- $form['foss_sub_project_status']['#title'] = t("Status");
- $form['foss_sub_project_status']['#options'] = _ajax_example_get_third_dropdown_options($foss_sub_project_activities);
- $commands[] = ajax_command_html("#dropdown-third-replace", drupal_render($form['foss_sub_project_status']));
- }
-
+
+ if ($foss_sub_project == 3) {
+ $foss_sub_project_activities = "";
+ $form['dropdown-third-replace']['#markup'] = "";
+ $commands[] = ajax_command_html("#dropdown-third-replace", "");
+ } else {
+ $form['foss_sub_project_status']['#type'] = "select";
+ $form['foss_sub_project_status']['#title'] = t("Status");
+ $form['foss_sub_project_status']['#options'] = _ajax_example_get_third_dropdown_options($foss_sub_project_activities);
+ $commands[] = ajax_command_html("#dropdown-third-replace", drupal_render($form['foss_sub_project_status']));
+ }
+
} else {
$form['dropdown-third-replace']['#markup'] = "";
$commands[] = ajax_command_html("#dropdown-third-replace", "");
@@ -1720,156 +1731,156 @@ function ajax_foss_type_dependent_dropdown_callback($form, &$form_state)
//this is ajax callback method for second dropdown ie Activities type
function ajax_foss_sub_project_dependent_dropdown_callback($form, &$form_state)
{
- $foss_project = $form_state['values']['foss_sub_project'];
- $foss_type = $form_state['values']['foss_type'];
-
-
-
+ $foss_project = $form_state['values']['foss_sub_project'];
+ $foss_type = $form_state['values']['foss_type'];
+
+
+
if ($foss_type != "" && $foss_project != 0 && $foss_type != 3) {
-
- if($foss_project==7){
- $form['load_city']['#markup'] = "";
- $commands[] = ajax_command_html("#load_city", "");
- $form['load_country']['#markup'] = "";
- $commands[] = ajax_command_html("#load_country", "");
- $form['load_state']['#markup'] = "";
- $commands[] = ajax_command_html("#load_state", "");
-
- }else if($foss_project==6){
- $form['load_city']['#markup'] = "";
- $commands[] = ajax_command_html("#load_city", "");
- $form['load_country']['#markup'] = "";
- $commands[] = ajax_command_html("#load_country", "");
- $form['load_state']['#markup'] = "";
- $commands[] = ajax_command_html("#load_state", "");
- $form['end_date']['#markup'] = "";
- $commands[] = ajax_command_html("#enddate", "");
- $form['start_date']['#markup'] = "";
- $commands[] = ajax_command_html("#startdate", "");
-
- }else{
-
- $form['countryname']['#type'] = "select";
- $form['countryname']['#title'] = t("Select Country");
- $form['countryname']['#option'] = get_country_list($foss_type, $foss_project);
- $form['countryname']['#prefix'] = "
";
- $form['countryname']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_country", drupal_render($form['countryname']));
- $country_value = $form_state['values']['countryname'];
-
- $form['statename']['#type'] = "select";
- $form['statename']['#title'] = t("State Name");
- $form['statename']['#options'] = get_state_list($foss_type, $foss_project, $country_value);
- $form['statename']['#prefix'] = "
";
- $form['statename']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_state", drupal_render($form['statename']));
- $state_value = $form_state['values']['statename'];
-
- $form['cityname']['#type'] = "select";
- $form['cityname']['#title'] = t("City Name");
- $form['cityname']['#options'] = get_city_list($foss_type, $foss_project, $country_value, $state_value);
- $form['cityname']['#prefix'] = "
";
- $form['cityname']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_city", drupal_render($form['cityname']));
-
- }
+
+ if ($foss_project == 7) {
+ $form['load_city']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_city", "");
+ $form['load_country']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_country", "");
+ $form['load_state']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_state", "");
+
+ } else if ($foss_project == 6) {
+ $form['load_city']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_city", "");
+ $form['load_country']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_country", "");
+ $form['load_state']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_state", "");
+ $form['end_date']['#markup'] = "";
+ $commands[] = ajax_command_html("#enddate", "");
+ $form['start_date']['#markup'] = "";
+ $commands[] = ajax_command_html("#startdate", "");
+
+ } else {
+
+ $form['countryname']['#type'] = "select";
+ $form['countryname']['#title'] = t("Select Country");
+ $form['countryname']['#option'] = get_country_list($foss_type, $foss_project);
+ $form['countryname']['#prefix'] = "
";
+ $form['countryname']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_country", drupal_render($form['countryname']));
+ $country_value = $form_state['values']['countryname'];
+
+ $form['statename']['#type'] = "select";
+ $form['statename']['#title'] = t("State Name");
+ $form['statename']['#options'] = get_state_list($foss_type, $foss_project, $country_value);
+ $form['statename']['#prefix'] = "
";
+ $form['statename']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_state", drupal_render($form['statename']));
+ $state_value = $form_state['values']['statename'];
+
+ $form['cityname']['#type'] = "select";
+ $form['cityname']['#title'] = t("City Name");
+ $form['cityname']['#options'] = get_city_list($foss_type, $foss_project, $country_value, $state_value);
+ $form['cityname']['#prefix'] = "
";
+ $form['cityname']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_city", drupal_render($form['cityname']));
+
+ }
} else {
- if ($foss_project == 3 || $foss_project == 4 || $foss_project == 5) {
-
- $form['start_date']['#type'] = "date_popup";
- $form['start_date']['#title'] = t('From Date:');
- $form['start_date']['#date_label_position'] = '';
- $form['start_date']['#description'] = '';
- $form['start_date']['#default_value'] = '';
- $form['start_date']['#date_format'] = 'Y-m-d';
- $form['start_date']['#date_increment'] = 0;
- $form['start_date']['#date_year_range'] = '2011:+0';
- $form['start_date']['#datepicker_options'] = array(
- 'maxDate' => 0
- );
- $commands[] = ajax_command_html("#startdate", drupal_render($form['start_date']));
- $form['end_date']['#type'] = "date_popup";
- $form['end_date']['#title'] = t('To Date:');
- $form['end_date']['#date_label_position'] = '';
- $form['end_date']['#description'] = '';
- $form['end_date']['#default_value'] = '';
- $form['end_date']['#date_format'] = 'Y-m-d';
- $form['end_date']['#date_increment'] = 0;
- $form['end_date']['#date_year_range'] = '2011:+0';
- $form['end_date']['#datepicker_options'] = array(
- 'maxDate' => 0
- );
- $commands[] = ajax_command_html("#enddate", drupal_render($form['end_date']));
-
- $form['countryname']['#type'] = "select";
- $form['countryname']['#title'] = t("Select Country");
- $form['countryname']['#option'] = get_country_list($foss_type, $foss_project);
- $form['countryname']['#prefix'] = "
";
- $form['countryname']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_country", drupal_render($form['countryname']));
-
- $country_value = $form_state['values']['countryname'];
-
- $form['statename']['#type'] = "select";
- $form['statename']['#title'] = t("State Name");
- $form['statename']['#options'] = get_state_list($foss_type, $foss_project, $country_value);
- $form['statename']['#prefix'] = "
";
- $form['statename']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_state", drupal_render($form['statename']));
- $state_value = $form_state['values']['statename'];
-
- $form['cityname']['#type'] = "select";
- $form['cityname']['#title'] = t("City Name");
- $form['cityname']['#options'] = get_city_list($foss_type, $foss_project, $country_value, $state_value);
- $form['cityname']['#prefix'] = "
";
- $form['cityname']['#suffix'] = "
";
- $commands[] = ajax_command_html("#load_city", drupal_render($form['cityname']));
-
-
- }else if($foss_project == 7){
- $form['start_date']['#type'] = "date_popup";
- $form['start_date']['#title'] = t('From Date:');
- $form['start_date']['#date_label_position'] = '';
- $form['start_date']['#description'] = '';
- $form['start_date']['#default_value'] = '';
- $form['start_date']['#date_format'] = 'Y-m-d';
- $form['start_date']['#date_increment'] = 0;
- $form['start_date']['#date_year_range'] = '2011:+0';
- $form['start_date']['#datepicker_options'] = array(
- 'maxDate' => 0
- );
- $commands[] = ajax_command_html("#startdate", drupal_render($form['start_date']));
- $form['end_date']['#type'] = "date_popup";
- $form['end_date']['#title'] = t('To Date:');
- $form['end_date']['#date_label_position'] = '';
- $form['end_date']['#description'] = '';
- $form['end_date']['#default_value'] = '';
- $form['end_date']['#date_format'] = 'Y-m-d';
- $form['end_date']['#date_increment'] = 0;
- $form['end_date']['#date_year_range'] = '2011:+0';
- $form['end_date']['#datepicker_options'] = array(
- 'maxDate' => 0
- );
- $commands[] = ajax_command_html("#enddate", drupal_render($form['end_date']));
- $form['load_city']['#markup'] = "";
- $commands[] = ajax_command_html("#load_city", "");
- $form['load_country']['#markup'] = "";
- $commands[] = ajax_command_html("#load_country", "");
- $form['load_state']['#markup'] = "";
- $commands[] = ajax_command_html("#load_state", "");
- }else if($foss_project == 6){
- $form['load_city']['#markup'] = "";
- $commands[] = ajax_command_html("#load_city", "");
- $form['load_country']['#markup'] = "";
- $commands[] = ajax_command_html("#load_country", "");
- $form['load_state']['#markup'] = "";
- $commands[] = ajax_command_html("#load_state", "");
- $form['end_date']['#markup'] = "";
- $commands[] = ajax_command_html("#enddate", "");
- $form['start_date']['#markup'] = "";
- $commands[] = ajax_command_html("#startdate", "");
- }
+ if ($foss_project == 3 || $foss_project == 4 || $foss_project == 5) {
+
+ $form['start_date']['#type'] = "date_popup";
+ $form['start_date']['#title'] = t('From Date:');
+ $form['start_date']['#date_label_position'] = '';
+ $form['start_date']['#description'] = '';
+ $form['start_date']['#default_value'] = '';
+ $form['start_date']['#date_format'] = 'Y-m-d';
+ $form['start_date']['#date_increment'] = 0;
+ $form['start_date']['#date_year_range'] = '2011:+0';
+ $form['start_date']['#datepicker_options'] = array(
+ 'maxDate' => 0
+ );
+ $commands[] = ajax_command_html("#startdate", drupal_render($form['start_date']));
+ $form['end_date']['#type'] = "date_popup";
+ $form['end_date']['#title'] = t('To Date:');
+ $form['end_date']['#date_label_position'] = '';
+ $form['end_date']['#description'] = '';
+ $form['end_date']['#default_value'] = '';
+ $form['end_date']['#date_format'] = 'Y-m-d';
+ $form['end_date']['#date_increment'] = 0;
+ $form['end_date']['#date_year_range'] = '2011:+0';
+ $form['end_date']['#datepicker_options'] = array(
+ 'maxDate' => 0
+ );
+ $commands[] = ajax_command_html("#enddate", drupal_render($form['end_date']));
+
+ $form['countryname']['#type'] = "select";
+ $form['countryname']['#title'] = t("Select Country");
+ $form['countryname']['#option'] = get_country_list($foss_type, $foss_project);
+ $form['countryname']['#prefix'] = "
";
+ $form['countryname']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_country", drupal_render($form['countryname']));
+
+ $country_value = $form_state['values']['countryname'];
+
+ $form['statename']['#type'] = "select";
+ $form['statename']['#title'] = t("State Name");
+ $form['statename']['#options'] = get_state_list($foss_type, $foss_project, $country_value);
+ $form['statename']['#prefix'] = "
";
+ $form['statename']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_state", drupal_render($form['statename']));
+ $state_value = $form_state['values']['statename'];
+
+ $form['cityname']['#type'] = "select";
+ $form['cityname']['#title'] = t("City Name");
+ $form['cityname']['#options'] = get_city_list($foss_type, $foss_project, $country_value, $state_value);
+ $form['cityname']['#prefix'] = "
";
+ $form['cityname']['#suffix'] = "
";
+ $commands[] = ajax_command_html("#load_city", drupal_render($form['cityname']));
+
+
+ } else if ($foss_project == 7) {
+ $form['start_date']['#type'] = "date_popup";
+ $form['start_date']['#title'] = t('From Date:');
+ $form['start_date']['#date_label_position'] = '';
+ $form['start_date']['#description'] = '';
+ $form['start_date']['#default_value'] = '';
+ $form['start_date']['#date_format'] = 'Y-m-d';
+ $form['start_date']['#date_increment'] = 0;
+ $form['start_date']['#date_year_range'] = '2011:+0';
+ $form['start_date']['#datepicker_options'] = array(
+ 'maxDate' => 0
+ );
+ $commands[] = ajax_command_html("#startdate", drupal_render($form['start_date']));
+ $form['end_date']['#type'] = "date_popup";
+ $form['end_date']['#title'] = t('To Date:');
+ $form['end_date']['#date_label_position'] = '';
+ $form['end_date']['#description'] = '';
+ $form['end_date']['#default_value'] = '';
+ $form['end_date']['#date_format'] = 'Y-m-d';
+ $form['end_date']['#date_increment'] = 0;
+ $form['end_date']['#date_year_range'] = '2011:+0';
+ $form['end_date']['#datepicker_options'] = array(
+ 'maxDate' => 0
+ );
+ $commands[] = ajax_command_html("#enddate", drupal_render($form['end_date']));
+ $form['load_city']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_city", "");
+ $form['load_country']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_country", "");
+ $form['load_state']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_state", "");
+ } else if ($foss_project == 6) {
+ $form['load_city']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_city", "");
+ $form['load_country']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_country", "");
+ $form['load_state']['#markup'] = "";
+ $commands[] = ajax_command_html("#load_state", "");
+ $form['end_date']['#markup'] = "";
+ $commands[] = ajax_command_html("#enddate", "");
+ $form['start_date']['#markup'] = "";
+ $commands[] = ajax_command_html("#startdate", "");
+ }
}
if ($foss_project == 1 || $foss_project == 2) {
$form['foss_sub_project_status']['#type'] = "select";
@@ -1879,7 +1890,7 @@ function ajax_foss_sub_project_dependent_dropdown_callback($form, &$form_state)
} else {
$form['dropdown-third-replace']['#markup'] = "";
$commands[] = ajax_command_html("#dropdown-third-replace", "");
-
+
}
return array(
'#type' => 'ajax',
@@ -1941,38 +1952,38 @@ function ajax_example_submit_driven_callback($form, &$form_state)
-
' . get_tabledata_TBC_or_LM("TBC", $startdate, $enddate) .'
+
' . get_tabledata_TBC_or_LM("TBC", $startdate, $enddate) . '
' . drupal_render(getchart("TBC")) . '
-
' . get_tabledata_TBC_or_LM("LM", $startdate, $enddate) .'
+
' . get_tabledata_TBC_or_LM("LM", $startdate, $enddate) . '
' . drupal_render(getchart("LM")) . '
-
' . workshop_view_all(0, $startdate, $enddate) .'
+
' . workshop_view_all(0, $startdate, $enddate) . '
-
' . getselfworkshoplcount(0,$startdate,$enddate,"","").'
+
' . getselfworkshoplcount(0, $startdate, $enddate, "", "") . '
-
' . conference_seminar_view_all(0, "", "") .'
+
' . conference_seminar_view_all(0, "", "") . '
-
'.spokentutorial_view_all("").'
+
' . spokentutorial_view_all("") . '
';
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
} else if ($foss_type != '--------------' && (($foss_sub_project == "--------------") || ($foss_sub_project == "No Sub-Project Available"))) {
-
- $tbcdatacheck="";
- $tbcchartcheck="";
- $lmdatacheck="";
- $lmchartcheck="";
- $workshopdatacheck="";
- $self_workshopdatacheck="";
- $conferencedatacheck="";
- $spoken_tutorialdatacheck="";
-
-
-
-
+
+ $tbcdatacheck = "";
+ $tbcchartcheck = "";
+ $lmdatacheck = "";
+ $lmchartcheck = "";
+ $workshopdatacheck = "";
+ $self_workshopdatacheck = "";
+ $conferencedatacheck = "";
+ $spoken_tutorialdatacheck = "";
+
+
+
+
$form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
$commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
db_set_active('default'); // We need to call the main (drupal) db back
@@ -2013,146 +2024,146 @@ function ajax_example_submit_driven_callback($form, &$form_state)
);
$i = 0;
$pagecontent = "";
- // foreach ($optiondata as $value) {
- // $i++;
- // //$options[$i]=$optionvalue[$i];
- // if (($subproject_detail->$value) != 0) {
- // if ($value == "tbc") {
- // $pagecontent .= "
- //
- //
- //
" . get_tabledata_selectedFoss_TBC_LM($foss_type, 'TBC', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag) . "
" . drupal_render(getchartforselectedProject($foss_type, "TBC", $startdate, $enddate, $countryname, $statename, $cityname)) . "
";
- // } else if ($value == "lab_migration") {
- // $pagecontent .= "
- //
- //
- //
- //
" . get_tabledata_selectedFoss_TBC_LM($foss_type, 'LM', "all", $startdate, $enddate, $countryname, $statename, $cityname, $link_flag) . "
- //
" . drupal_render(getchartforselectedProject($foss_type, "LM", $startdate, $enddate, $countryname, $statename, $cityname)) . "
";
- // } else if ($value == "workshop") {
-
- // $event_type = "Workshop";
- // $pagecontent .= "
- //
- //
- //
" . events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname) . "
";
- // } else if ($value == "self_workshop") {
- // $pagecontent .= "
- //
- //
- //
".getselfworkshoplcount($foss_type,$startdate,$enddate, $statename, $cityname)."
";
- // } else if ($value == "conference") {
- // $event_type = "Conference";
- // $pagecontent .= "
- //
- //
- //
" . events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname) . "
";
- // } else if ($value == "spoken_tutorial") {
- // $pagecontent .= "
- //
- //
- //
".spokentutorial_view_all($foss_type)."
";
- // }
-
-
- // } else {
- // if ($value == "tbc") {
- // $pagecontent .= "
- //
- //
- //
" . t("
- //
TextBook Companion Project Not Present
") . "";
- // } else if ($value == "lab_migration") {
- // $pagecontent .= "
- //
- //
- //
- //
" . t("
- //
Lab Migration Project Not Present
") . "
";
- // } else if ($value == "workshop") {
- // $pagecontent .= "
- //
- //
- //
" . t("
- //
No Workshop were conducted
") . "";
- // } else if ($value == "self_workshop") {
- // $pagecontent .= "
- //
- //
- //
" . t("
- //
No Self Workshop were conducted
") . "";
- // } else if ($value == "conference") {
- // $pagecontent .= "
- //
- //
- //
" . t("
- //
No Conference were conducted
") . "";
- // } else if ($value == "spoken_tutorial") {
- // $pagecontent .= "
- //
- //
- //
" . t("
- //
Spoken Tutorial Not Present
") . "";
- // }
- // }
- // }
- // $form['default_load']['#markup'] = $pagecontent;
-
-
-foreach ($optiondata as $value) {
- $i++;
+ // foreach ($optiondata as $value) {
+ // $i++;
+ // //$options[$i]=$optionvalue[$i];
+ // if (($subproject_detail->$value) != 0) {
+ // if ($value == "tbc") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . get_tabledata_selectedFoss_TBC_LM($foss_type, 'TBC', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag) . "
" . drupal_render(getchartforselectedProject($foss_type, "TBC", $startdate, $enddate, $countryname, $statename, $cityname)) . "
";
+ // } else if ($value == "lab_migration") {
+ // $pagecontent .= "
+ //
+ //
+ //
+ //
" . get_tabledata_selectedFoss_TBC_LM($foss_type, 'LM', "all", $startdate, $enddate, $countryname, $statename, $cityname, $link_flag) . "
+ //
" . drupal_render(getchartforselectedProject($foss_type, "LM", $startdate, $enddate, $countryname, $statename, $cityname)) . "
";
+ // } else if ($value == "workshop") {
+
+ // $event_type = "Workshop";
+ // $pagecontent .= "
+ //
+ //
+ //
" . events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname) . "
";
+ // } else if ($value == "self_workshop") {
+ // $pagecontent .= "
+ //
+ //
+ //
".getselfworkshoplcount($foss_type,$startdate,$enddate, $statename, $cityname)."
";
+ // } else if ($value == "conference") {
+ // $event_type = "Conference";
+ // $pagecontent .= "
+ //
+ //
+ //
" . events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname) . "
";
+ // } else if ($value == "spoken_tutorial") {
+ // $pagecontent .= "
+ //
+ //
+ //
".spokentutorial_view_all($foss_type)."
";
+ // }
+
+
+ // } else {
+ // if ($value == "tbc") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . t("
+ //
TextBook Companion Project Not Present
") . "";
+ // } else if ($value == "lab_migration") {
+ // $pagecontent .= "
+ //
+ //
+ //
+ //
" . t("
+ //
Lab Migration Project Not Present
") . "
";
+ // } else if ($value == "workshop") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . t("
+ //
No Workshop were conducted
") . "";
+ // } else if ($value == "self_workshop") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . t("
+ //
No Self Workshop were conducted
") . "";
+ // } else if ($value == "conference") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . t("
+ //
No Conference were conducted
") . "";
+ // } else if ($value == "spoken_tutorial") {
+ // $pagecontent .= "
+ //
+ //
+ //
" . t("
+ //
Spoken Tutorial Not Present
") . "";
+ // }
+ // }
+ // }
+ // $form['default_load']['#markup'] = $pagecontent;
+
+
+ foreach ($optiondata as $value) {
+ $i++;
//$options[$i]=$optionvalue[$i];
- if (($subproject_detail->$value) != 0) {
- if ($value == "tbc") {
- $tbcdatacheck=get_tabledata_selectedFoss_TBC_LM($foss_type, 'TBC', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag);
-
- $tbcchartcheck=drupal_render(getchartforselectedProject($foss_type, 'TBC', $startdate, $enddate, $countryname, $statename, $cityname));
-
- } else if ($value == "lab_migration") {
- $lmdatacheck= get_tabledata_selectedFoss_TBC_LM($foss_type, 'LM', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag) ;
- $lmchartcheck=drupal_render(getchartforselectedProject($foss_type, 'LM', $startdate, $enddate, $countryname, $statename, $cityname));
- } else if ($value == "workshop") {
- $event_type = "Workshop";
- $workshopdatacheck= events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname);
- } else if ($value == "self_workshop") {
- $self_workshopdatacheck=getselfworkshoplcount($foss_type,$startdate,$enddate, $statename, $cityname);
- } else if ($value == "conference") {
- $event_type = "Conference";
- $conferencedatacheck= events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname);
- } else if ($value == "spoken_tutorial") {
- $spoken_tutorialdatacheck= spokentutorial_view_all($foss_type);
- }
-
-
- } else {
- if ($value == "tbc") {
- $tbcdatacheck="
TextBook Companion Project Not Present
";
- $tbcchartcheck="";
- } else if ($value == "lab_migration") {
- $lmdatacheck="
Lab Migration Project Not Present
";
- $lmchartcheck="";
- } else if ($value == "workshop") {
- $workshopdatacheck= "
No Workshop were conducted
";
- } else if ($value == "self_workshop") {
- $self_workshopdatacheck="
No Self Workshop were conducted
";
- } else if ($value == "conference") {
- $conferencedatacheck="
No Conference were conducted
";
- } else if ($value == "spoken_tutorial") {
-
- $spoken_tutorialdatacheck="
Spoken Tutorial Not Present
";
- }
- }
- }
-
- // var_dump($tbcdatacheck."::::::".$lmdatacheck."::::::".$workshopdatacheck.":::::::".$self_workshopdatacheck.":::::::".$conferencedatacheck."::::::".$spoken_tutorialdatacheck);
-//die;
-
-
-
-
- $form['default_load']['#markup'] = '
+ if (($subproject_detail->$value) != 0) {
+ if ($value == "tbc") {
+ $tbcdatacheck = get_tabledata_selectedFoss_TBC_LM($foss_type, 'TBC', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag);
+
+ $tbcchartcheck = drupal_render(getchartforselectedProject($foss_type, 'TBC', $startdate, $enddate, $countryname, $statename, $cityname));
+
+ } else if ($value == "lab_migration") {
+ $lmdatacheck = get_tabledata_selectedFoss_TBC_LM($foss_type, 'LM', 'all', $startdate, $enddate, $countryname, $statename, $cityname, $link_flag);
+ $lmchartcheck = drupal_render(getchartforselectedProject($foss_type, 'LM', $startdate, $enddate, $countryname, $statename, $cityname));
+ } else if ($value == "workshop") {
+ $event_type = "Workshop";
+ $workshopdatacheck = events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname);
+ } else if ($value == "self_workshop") {
+ $self_workshopdatacheck = getselfworkshoplcount($foss_type, $startdate, $enddate, $statename, $cityname);
+ } else if ($value == "conference") {
+ $event_type = "Conference";
+ $conferencedatacheck = events_view_filter($foss_type, $event_type, $startdate, $enddate, $countryname, $statename, $cityname);
+ } else if ($value == "spoken_tutorial") {
+ $spoken_tutorialdatacheck = spokentutorial_view_all($foss_type);
+ }
+
+
+ } else {
+ if ($value == "tbc") {
+ $tbcdatacheck = "TextBook Companion Project Not Present
";
+ $tbcchartcheck = "";
+ } else if ($value == "lab_migration") {
+ $lmdatacheck = "Lab Migration Project Not Present
";
+ $lmchartcheck = "";
+ } else if ($value == "workshop") {
+ $workshopdatacheck = " No Workshop were conducted
";
+ } else if ($value == "self_workshop") {
+ $self_workshopdatacheck = "No Self Workshop were conducted
";
+ } else if ($value == "conference") {
+ $conferencedatacheck = "No Conference were conducted
";
+ } else if ($value == "spoken_tutorial") {
+
+ $spoken_tutorialdatacheck = "Spoken Tutorial Not Present
";
+ }
+ }
+ }
+
+ // var_dump($tbcdatacheck."::::::".$lmdatacheck."::::::".$workshopdatacheck.":::::::".$self_workshopdatacheck.":::::::".$conferencedatacheck."::::::".$spoken_tutorialdatacheck);
+ //die;
+
+
+
+
+ $form['default_load']['#markup'] = '
-
' . $tbcdatacheck .'
-
' . $tbcchartcheck. '
+
' . $tbcdatacheck . '
+
' . $tbcchartcheck . '
' . $lmdatacheck . '
-
' . $lmchartcheck. '
+
' . $lmchartcheck . '
- '. $workshopdatacheck. '
-
' . $self_workshopdatacheck.'
-
' . $conferencedatacheck.'
+ ' . $workshopdatacheck . '
+
' . $self_workshopdatacheck . '
+
' . $conferencedatacheck . '
-
' .$spoken_tutorialdatacheck.'
+
' . $spoken_tutorialdatacheck . '
';
-
+
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
} else if ($foss_type != '--------------' && $foss_sub_project == "Textbook Companion" && $foss_sub_project_status == "--------------") {
-
+
$form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
$commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
$pagecontent = "";
@@ -2219,7 +2230,7 @@ foreach ($optiondata as $value) {
- Workshop
-
' .events_view_filter($foss_type, $foss_sub_project, $startdate, $enddate, $countryname, $statename, $cityname) .'
';
+
' . events_view_filter($foss_type, $foss_sub_project, $startdate, $enddate, $countryname, $statename, $cityname) . '
';
$form['default_load']['#markup'] = $pagecontent;
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
@@ -2228,18 +2239,18 @@ foreach ($optiondata as $value) {
$form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
$commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
-
+
$pagecontent = "";
$pagecontent .= '
-
' . getselfworkshoplcount($foss_type,$startdate,$enddate, $statename, $cityname).'
';
+
' . getselfworkshoplcount($foss_type, $startdate, $enddate, $statename, $cityname) . '
';
$form['default_load']['#markup'] = $pagecontent;
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
- }else if ($foss_type != '--------------' && $foss_sub_project == "Conference") {
+ } else if ($foss_type != '--------------' && $foss_sub_project == "Conference") {
$form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
$commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
@@ -2250,12 +2261,12 @@ foreach ($optiondata as $value) {
- Conference
-
' . events_view_filter($foss_type, $foss_sub_project, $startdate, $enddate, $countryname, $statename, $cityname).'
';
+
' . events_view_filter($foss_type, $foss_sub_project, $startdate, $enddate, $countryname, $statename, $cityname) . '
';
$form['default_load']['#markup'] = $pagecontent;
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
- }else if ($foss_type != '--------------' && $foss_sub_project == "Spoken Tutorial") {
+ } else if ($foss_type != '--------------' && $foss_sub_project == "Spoken Tutorial") {
$form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
$commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
@@ -2266,30 +2277,30 @@ foreach ($optiondata as $value) {
- Spoken Tutorial
-
'.spokentutorial_view_all($foss_type) .'
';
-
- $form['default_load']['#markup'] = $pagecontent;
- $commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
-}
-
-/* else if ($foss_type != '--------------' && $foss_sub_project == "Postal Campaigns") {
-
- $form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
- $commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
-
-
- $pagecontent = "";
- $pagecontent .= "
-
-
-
" . postalcampaign_view_all($foss_type, $startdate, $enddate) . "
";
+ ' . spokentutorial_view_all($foss_type) . '
';
$form['default_load']['#markup'] = $pagecontent;
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
-
+ }
+
+ /* else if ($foss_type != '--------------' && $foss_sub_project == "Postal Campaigns") {
+
+ $form['displaytext']['#markup'] = "Statistic of project : " . $foss_type;
+ $commands[] = ajax_command_html("#displaytext", drupal_render($form['displaytext']));
+
+
+ $pagecontent = "";
+ $pagecontent .= "
+
+
+
" . postalcampaign_view_all($foss_type, $startdate, $enddate) . "
";
+
+ $form['default_load']['#markup'] = $pagecontent;
+ $commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
+
}*/
-
- else if ($foss_type != '--------------' && ($foss_sub_project == "Textbook Companion" || $foss_sub_project == "Lab Migration") && $foss_sub_project_status != "--------------") {
+
+ else if ($foss_type != '--------------' && ($foss_sub_project == "Textbook Companion" || $foss_sub_project == "Lab Migration") && $foss_sub_project_status != "--------------") {
if ($foss_sub_project == "Textbook Companion" && $foss_sub_project_status == "Completed Books") {
$title = "Textbook Companion";
$datatable = get_tabledata_selectedFoss_TBC_LM($foss_type, 'TBC', "completed", $startdate, $enddate, $countryname, $statename, $cityname, $link_flag);
@@ -2308,7 +2319,7 @@ foreach ($optiondata as $value) {
$form['default_load']['#markup'] = '
-
'. $datatable . '
+
' . $datatable . '
';
$commands[] = ajax_command_html("#default_load", drupal_render($form['default_load']));
@@ -2407,10 +2418,10 @@ function get_tabledata_TBC_or_LM($sub_type, $startdate, $enddate)
$clink = "
" . $completedbookcount . "";
$completedbookcount = $clink;
}
-
- /* For setting completion date for pending TBC and LM more */
- $pending_enddate = date('Y-m-d', strtotime("+5 months", strtotime( $enddate)));
-
+
+ /* For setting completion date for pending TBC and LM more */
+ $pending_enddate = date('Y-m-d', strtotime("+5 months", strtotime($enddate)));
+
if ($foss_detail->foss_name != 'eSim' && $foss_detail->foss_name != 'OpenFOAM' && $foss_detail->foss_name != 'OR-Tools') {
if ($foss_detail->foss_name != 'DWSIM') {
$query3 = db_query("SELECT COUNT( pe.book ) AS book_count FROM textbook_companion_preference pe LEFT JOIN textbook_companion_proposal po ON pe.proposal_id = po.id WHERE po.proposal_status !=3 AND pe.approval_status =1 AND FROM_UNIXTIME(po.completion_date) >= :startdate AND FROM_UNIXTIME(po.completion_date) <= :enddate ", array(
@@ -3044,170 +3055,169 @@ function ajax_state_list_dependent_dropdown_callback($form, &$form_state)
$foss_type = $form['foss_type']['#options'][$form_state['values']['foss_type']];
$foss_sub_project = $form['foss_sub_project']['#options'][$form_state['values']['foss_sub_project']];
$country = $form['countryname']['#options'][$form_state['values']['countryname']];
-
+
$options = array();
- if($country!="--------------"){
+ if ($country != "--------------") {
+ if ($foss_sub_project == "Textbook Companion") {
+ $sub_project = "textbook_companion_proposal";
+
+ db_set_active($foss_type); //Active other database
+
+ $options[0] = '--------------';
+ $query = "
+ SELECT * FROM " . $sub_project . "
+ WHERE country = :country
+ ";
+ $args = array(
+ ":country" => $country
+ );
+ $result = db_query($query, $args);
+ while ($state_detail = $result->fetchObject()) {
+ $options[$state_detail->state] = $state_detail->state;
+ }
+
+ } else if ($foss_sub_project == "Lab Migration") {
+ $sub_project = "lab_migration_proposal";
+
+ db_set_active($foss_type); //Active other database
+ //$options = array();
+ $options[0] = '--------------';
+ $query = "
+ SELECT * FROM " . $sub_project . "
+ WHERE country = :country
+ ";
+ $args = array(
+ ":country" => $country
+ );
+ $result = db_query($query, $args);
+ while ($state_detail = $result->fetchObject()) {
+ $options[$state_detail->state] = $state_detail->state;
+ }
+
+ } else if ($foss_sub_project == "Workshop") {
+ $sub_project = "workshop";
+ $foss_type_db = 'default';
+
+ db_set_active($foss_type_db); //Active other database
+ //$options = array();
+ $options[0] = '--------------';
+ $query = "
+ SELECT * FROM " . $sub_project . "
+ WHERE country = :country and foss_name = :foss_name
+ ";
+ $args = array(
+ ":country" => $country,
+ ":foss_name" => $foss_type
+ );
+ $result = db_query($query, $args);
+ while ($state_detail = $result->fetchObject()) {
+ $options[$state_detail->state] = $state_detail->state;
+ }
+ } else if ($foss_sub_project == "Conference") {
+ $sub_project = "workshop";
+ $foss_type_db = 'default';
+
+ db_set_active($foss_type_db); //Active other database
+ //$options = array();
+ $options[0] = '--------------';
+ $query = "
+ SELECT * FROM " . $sub_project . "
+ WHERE country = :country and foss_name = :foss_name
+ ";
+ $args = array(
+ ":country" => $country,
+ ":foss_name" => $foss_type
+ );
+ $result = db_query($query, $args);
+ while ($state_detail = $result->fetchObject()) {
+ $options[$state_detail->state] = $state_detail->state;
+ }
+ } else if ($foss_sub_project == "Self Workshop") {
+
+
+ //Get self workshop foss number for spoken
+
+ $query = db_select('foss_type');
+ $query->fields('foss_type', array(
+ 'id'
+ ));
+ $query->fields('foss_type', array(
+ 'foss_name'
+ ));
+ $query->fields('foss_type', array(
+ 'foss_selfworkshop_no'
+ ));
+ $query->condition('foss_name', $foss_type);
+ $result = $query->execute();
+ $foss_detail = $result->fetchObject();
+ $foss_selfworkshop_no = $foss_detail->foss_selfworkshop_no;
+
+ db_set_active('selfworkshop'); //Active other database
+ $options[0] = '--------------';
+ $query = "SELECT distinct (s.name) as state FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id )
+ ";
+ $args = array(
+ ":foss_id" => $foss_selfworkshop_no
+ );
+ $result = db_query($query, $args);
+
+ while ($state_detail = $result->fetchObject()) {
+ $options[$state_detail->state] = $state_detail->state;
+
+ }
+
+ }
+ } else {
+ $options[0] = '--------------';
+ }
+
+ db_set_active('default'); // We need to call the main (drupal) db back
+
+ $form['statename']['#options'] = $options;
+ $commands[] = ajax_command_replace("#load_state", drupal_render($form['statename']));
+
+ $optionscity = array();
+ $optionscity[0] = '--------------';
+ $form['cityname']['#options'] = $optionscity;
+ $commands[] = ajax_command_replace("#load_city", drupal_render($form['cityname']));
+
+ return array(
+ '#type' => 'ajax',
+ '#commands' => $commands
+ );
+}
+
+//Get the list of City according to country selection .It is ajax method for state
+function ajax_city_list_dependent_dropdown_callback($form, &$form_state)
+{
+ $foss_type = $form['foss_type']['#options'][$form_state['values']['foss_type']];
+ $foss_sub_project = $form['foss_sub_project']['#options'][$form_state['values']['foss_sub_project']];
+ $country = $form['countryname']['#options'][$form_state['values']['countryname']];
+ $state = $form['statename']['#options'][$form_state['values']['statename']];
if ($foss_sub_project == "Textbook Companion") {
$sub_project = "textbook_companion_proposal";
db_set_active($foss_type); //Active other database
-
+ $options = array();
$options[0] = '--------------';
$query = "
SELECT * FROM " . $sub_project . "
- WHERE country = :country
+ WHERE country = :country and state = :state
";
$args = array(
- ":country" => $country
+ ":country" => $country,
+ ":state" => $state
);
$result = db_query($query, $args);
- while ($state_detail = $result->fetchObject()) {
- $options[$state_detail->state] = $state_detail->state;
+ while ($city_detail = $result->fetchObject()) {
+ $options[$city_detail->city] = $city_detail->city;
}
} else if ($foss_sub_project == "Lab Migration") {
$sub_project = "lab_migration_proposal";
db_set_active($foss_type); //Active other database
- //$options = array();
- $options[0] = '--------------';
- $query = "
- SELECT * FROM " . $sub_project . "
- WHERE country = :country
- ";
- $args = array(
- ":country" => $country
- );
- $result = db_query($query, $args);
- while ($state_detail = $result->fetchObject()) {
- $options[$state_detail->state] = $state_detail->state;
- }
-
- } else if ($foss_sub_project == "Workshop") {
- $sub_project = "workshop";
- $foss_type_db = 'default';
-
- db_set_active($foss_type_db); //Active other database
- //$options = array();
- $options[0] = '--------------';
- $query = "
- SELECT * FROM " . $sub_project . "
- WHERE country = :country and foss_name = :foss_name
- ";
- $args = array(
- ":country" => $country,
- ":foss_name" => $foss_type
- );
- $result = db_query($query, $args);
- while ($state_detail = $result->fetchObject()) {
- $options[$state_detail->state] = $state_detail->state;
- }
- }else if ($foss_sub_project == "Conference") {
- $sub_project = "workshop";
- $foss_type_db = 'default';
-
- db_set_active($foss_type_db); //Active other database
- //$options = array();
- $options[0] = '--------------';
- $query = "
- SELECT * FROM " . $sub_project . "
- WHERE country = :country and foss_name = :foss_name
- ";
- $args = array(
- ":country" => $country,
- ":foss_name" => $foss_type
- );
- $result = db_query($query, $args);
- while ($state_detail = $result->fetchObject()) {
- $options[$state_detail->state] = $state_detail->state;
- }
- }
-else if ($foss_sub_project == "Self Workshop"){
-
-
- //Get self workshop foss number for spoken
-
- $query = db_select('foss_type');
- $query->fields('foss_type', array(
- 'id'
- ));
- $query->fields('foss_type', array(
- 'foss_name'
- ));
- $query->fields('foss_type', array(
- 'foss_selfworkshop_no'
- ));
- $query->condition('foss_name', $foss_type);
- $result = $query->execute();
- $foss_detail = $result->fetchObject();
- $foss_selfworkshop_no=$foss_detail->foss_selfworkshop_no;
-
- db_set_active('selfworkshop'); //Active other database
- $options[0] = '--------------';
- $query = "SELECT distinct (s.name) as state FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id )
- ";
- $args = array(
- ":foss_id" => $foss_selfworkshop_no,
- );
- $result = db_query($query, $args);
-
- while ($state_detail = $result->fetchObject()) {
- $options[$state_detail->state] = $state_detail->state;
-
- }
-
- }
- }else{
- $options[0] = '--------------';
- }
-
- db_set_active('default'); // We need to call the main (drupal) db back
-
- $form['statename']['#options'] = $options;
- $commands[] = ajax_command_replace("#load_state", drupal_render($form['statename']));
-
- $optionscity = array();
- $optionscity[0] = '--------------';
- $form['cityname']['#options'] = $optionscity;
- $commands[] = ajax_command_replace("#load_city", drupal_render($form['cityname']));
-
- return array(
- '#type' => 'ajax',
- '#commands' => $commands
- );
-}
-
-//Get the list of City according to country selection .It is ajax method for state
-function ajax_city_list_dependent_dropdown_callback($form, &$form_state)
-{
- $foss_type = $form['foss_type']['#options'][$form_state['values']['foss_type']];
- $foss_sub_project = $form['foss_sub_project']['#options'][$form_state['values']['foss_sub_project']];
- $country = $form['countryname']['#options'][$form_state['values']['countryname']];
- $state = $form['statename']['#options'][$form_state['values']['statename']];
- if ($foss_sub_project == "Textbook Companion") {
- $sub_project = "textbook_companion_proposal";
-
- db_set_active($foss_type); //Active other database
- $options = array();
- $options[0] = '--------------';
- $query = "
- SELECT * FROM " . $sub_project . "
- WHERE country = :country and state = :state
- ";
- $args = array(
- ":country" => $country,
- ":state" => $state
- );
- $result = db_query($query, $args);
- while ($city_detail = $result->fetchObject()) {
- $options[$city_detail->city] = $city_detail->city;
- }
-
- } else if ($foss_sub_project == "Lab Migration") {
- $sub_project = "lab_migration_proposal";
-
- db_set_active($foss_type); //Active other database
- $options = array();
+ $options = array();
$options[0] = '--------------';
$query = "
SELECT * FROM " . $sub_project . "
@@ -3242,7 +3252,7 @@ function ajax_city_list_dependent_dropdown_callback($form, &$form_state)
while ($city_detail = $result->fetchObject()) {
$options[$city_detail->city] = $city_detail->city;
}
- }else if ($foss_sub_project == "Conference") {
+ } else if ($foss_sub_project == "Conference") {
$sub_project = "workshop";
$foss_type_db = 'default';
@@ -3262,41 +3272,41 @@ function ajax_city_list_dependent_dropdown_callback($form, &$form_state)
while ($city_detail = $result->fetchObject()) {
$options[$city_detail->city] = $city_detail->city;
}
- }else if ($foss_sub_project == "Self Workshop"){
-
- //Get self workshop foss number for spoken
-
- $query = db_select('foss_type');
+ } else if ($foss_sub_project == "Self Workshop") {
+
+ //Get self workshop foss number for spoken
+
+ $query = db_select('foss_type');
$query->fields('foss_type', array(
'id'
));
$query->fields('foss_type', array(
'foss_name'
));
- $query->fields('foss_type', array(
+ $query->fields('foss_type', array(
'foss_selfworkshop_no'
));
$query->condition('foss_name', $foss_type);
$result = $query->execute();
$foss_detail = $result->fetchObject();
- $foss_selfworkshop_no=$foss_detail->foss_selfworkshop_no;
- db_set_active('selfworkshop'); //Active other database
+ $foss_selfworkshop_no = $foss_detail->foss_selfworkshop_no;
+ db_set_active('selfworkshop'); //Active other database
$options[0] = '--------------';
-
- $query="SELECT distinct (c.name) as city FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id ) and s.name LIKE :statename";
-
- $args = array(
- ":foss_id" => $foss_selfworkshop_no,
- ":statename"=>$state,
- );
- $result = db_query($query, $args);
-
- while ($city_detail = $result->fetchObject()) {
- $options[$city_detail->city] = $city_detail->city;
-
- }
-
- }
+
+ $query = "SELECT distinct (c.name) as city FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id ) and s.name LIKE :statename";
+
+ $args = array(
+ ":foss_id" => $foss_selfworkshop_no,
+ ":statename" => $state
+ );
+ $result = db_query($query, $args);
+
+ while ($city_detail = $result->fetchObject()) {
+ $options[$city_detail->city] = $city_detail->city;
+
+ }
+
+ }
db_set_active('default'); // We need to call the main (drupal) db back
@@ -3314,7 +3324,7 @@ function ajax_city_list_dependent_dropdown_callback($form, &$form_state)
function get_country_list($foss_type, $foss_sub_project)
{
- if ($foss_type!= 0) {
+ if ($foss_type != 0) {
if ($foss_sub_project != 0) {
$query = db_select('foss_type');
@@ -3330,8 +3340,8 @@ function get_country_list($foss_type, $foss_sub_project)
$foss_type_name = $foss_detail->foss_name;
$options = array();
- if ($foss_sub_project == 1 && $foss_type!=3) {
-
+ if ($foss_sub_project == 1 && $foss_type != 3) {
+
$sub_project = "textbook_companion_proposal";
db_set_active($foss_type_name); //Active other database
@@ -3345,9 +3355,9 @@ function get_country_list($foss_type, $foss_sub_project)
while ($country_detail = $result->fetchObject()) {
$options[$country_detail->country] = $country_detail->country;
}
-
- } else if ($foss_sub_project == 2 && $foss_type!=3) {
+
+ } else if ($foss_sub_project == 2 && $foss_type != 3) {
$sub_project = "lab_migration_proposal";
db_set_active($foss_type_name); //Active other database
@@ -3362,7 +3372,7 @@ function get_country_list($foss_type, $foss_sub_project)
$options[$country_detail->country] = $country_detail->country;
}
- } else if ($foss_sub_project == 3||$foss_sub_project == 5) {
+ } else if ($foss_sub_project == 3 || $foss_sub_project == 5) {
$sub_project = "workshop";
$foss_type_db = 'default';
@@ -3381,11 +3391,11 @@ function get_country_list($foss_type, $foss_sub_project)
$options[$country_detail->country] = $country_detail->country;
}
- }else if ($foss_sub_project == 4) {
+ } else if ($foss_sub_project == 4) {
$options[0] = '--------------';
$options[1] = 'India';
-
+
}
@@ -3404,7 +3414,7 @@ function get_country_list($foss_type, $foss_sub_project)
//Get list of state
function get_state_list($foss_type, $foss_sub_project, $country)
{
- if (($foss_type != 0) && $foss_sub_project != 0 && $country != "") {
+ if (($foss_type != 0) && $foss_sub_project != 0 && $country != "") {
$query = db_select('foss_type');
$query->fields('foss_type', array(
@@ -3413,18 +3423,18 @@ function get_state_list($foss_type, $foss_sub_project, $country)
$query->fields('foss_type', array(
'foss_name'
));
- $query->fields('foss_type', array(
+ $query->fields('foss_type', array(
'foss_selfworkshop_no'
));
$query->condition('id', $foss_type);
$result = $query->execute();
$foss_detail = $result->fetchObject();
$foss_type_name = $foss_detail->foss_name;
- $foss_selfworkshop_no=$foss_detail->foss_selfworkshop_no;
+ $foss_selfworkshop_no = $foss_detail->foss_selfworkshop_no;
$options = array();
-
- if ($foss_sub_project == 1 && $foss_type!=3) {
- $options = array();
+
+ if ($foss_sub_project == 1 && $foss_type != 3) {
+ $options = array();
$sub_project = "textbook_companion_proposal";
db_set_active($foss_type_name); //Active other database
@@ -3442,11 +3452,11 @@ function get_state_list($foss_type, $foss_sub_project, $country)
$options[$state_detail->state] = $state_detail->state;
}
- } else if ($foss_sub_project == 2 && $foss_type!=3) {
+ } else if ($foss_sub_project == 2 && $foss_type != 3) {
$sub_project = "lab_migration_proposal";
$options = array();
db_set_active($foss_type_name); //Active other database
-
+
$options[0] = '--------------';
$query = "
SELECT * FROM " . $sub_project . "
@@ -3460,13 +3470,13 @@ function get_state_list($foss_type, $foss_sub_project, $country)
$options[$state_detail->state] = $state_detail->state;
}
- } else if ($foss_sub_project == 3||$foss_sub_project == 5) {
-$options = array();
+ } else if ($foss_sub_project == 3 || $foss_sub_project == 5) {
+ $options = array();
$sub_project = "workshop";
$foss_type_db = 'default';
db_set_active($foss_type_db); //Active other database
-
+
$options[0] = '--------------';
$query = "SELECT * FROM " . $sub_project . "
WHERE country = :country and foss_name = :foss_name
@@ -3481,21 +3491,21 @@ $options = array();
}
} else if ($foss_sub_project == 4) {
-
+
db_set_active('selfworkshop'); //Active other database
$options[0] = '--------------';
$query = "SELECT distinct (s.name) as state FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id )
";
$args = array(
- ":foss_id" => $foss_selfworkshop_no,
+ ":foss_id" => $foss_selfworkshop_no
);
$result = db_query($query, $args);
-
+
while ($state_detail = $result->fetchObject()) {
$options[$state_detail->state] = $state_detail->state;
-
+
}
-
+
}
db_set_active('default'); // We need to call the main (drupal) db back
@@ -3510,8 +3520,8 @@ $options = array();
function get_city_list($foss_type, $foss_sub_project, $country, $state)
{
- if (($foss_type != 0 ) && $foss_sub_project != 0 && $country != "" && $state != "") {
-
+ if (($foss_type != 0) && $foss_sub_project != 0 && $country != "" && $state != "") {
+
$query = db_select('foss_type');
$query->fields('foss_type', array(
'id'
@@ -3519,15 +3529,15 @@ function get_city_list($foss_type, $foss_sub_project, $country, $state)
$query->fields('foss_type', array(
'foss_name'
));
- $query->fields('foss_type', array(
+ $query->fields('foss_type', array(
'foss_selfworkshop_no'
));
$query->condition('id', $foss_type);
$result = $query->execute();
$foss_detail = $result->fetchObject();
$foss_type = $foss_detail->foss_name;
- $foss_selfworkshop_no=$foss_detail->foss_selfworkshop_no;
- if ($foss_sub_project == 1 && $foss_type!="Python") {
+ $foss_selfworkshop_no = $foss_detail->foss_selfworkshop_no;
+ if ($foss_sub_project == 1 && $foss_type != "Python") {
$sub_project = "textbook_companion_proposal";
db_set_active($foss_type); //Active other database
$options = array();
@@ -3545,7 +3555,7 @@ function get_city_list($foss_type, $foss_sub_project, $country, $state)
$options[$city_detail->city] = $city_detail->city;
}
- } else if ($foss_sub_project == 2 && $foss_type!="Python") {
+ } else if ($foss_sub_project == 2 && $foss_type != "Python") {
$sub_project = "lab_migration_proposal";
db_set_active($foss_type); //Active other database
$options = array();
@@ -3564,7 +3574,7 @@ function get_city_list($foss_type, $foss_sub_project, $country, $state)
}
- } else if ($foss_sub_project == 3||$foss_sub_project == 5) {
+ } else if ($foss_sub_project == 3 || $foss_sub_project == 5) {
$sub_project = "workshop";
$foss_type_db = 'default';
@@ -3585,25 +3595,25 @@ function get_city_list($foss_type, $foss_sub_project, $country, $state)
$options[$city_detail->city] = $city_detail->city;
}
} else if ($foss_sub_project == 4) {
-
-
- db_set_active('selfworkshop'); //Active other database
- $options[0] = '--------------';
-
- $query="SELECT distinct (c.name) as city FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id ) and s.name LIKE :statename";
-
- $args = array(
+
+
+ db_set_active('selfworkshop'); //Active other database
+ $options[0] = '--------------';
+
+ $query = "SELECT distinct (c.name) as city FROM events_training t, events_academiccenter ac, events_city c, events_state s WHERE t.academic_id=ac.id and ac.city_id=c.id and c.state_id=s.id and (t.status = 4 AND t.foss_id = :foss_id ) and s.name LIKE :statename";
+
+ $args = array(
":foss_id" => $foss_selfworkshop_no,
- ":statename"=>$state,
+ ":statename" => $state
);
$result = db_query($query, $args);
-
+
while ($city_detail = $result->fetchObject()) {
$options[$city_detail->city] = $city_detail->city;
-
+
}
-
- }
+
+ }
@@ -3618,13 +3628,13 @@ function get_city_list($foss_type, $foss_sub_project, $country, $state)
}
}
-/*Add Event form (Workshop and seminar aling with photos testimonials and speakers)
- Same form is used for editing existing events
+/*Add Event form (Workshop and seminar along with photos testimonials and speakers)
+Same form is used for editing existing events
*/
function workshop_add_form($form, &$form_state, $workshop_id = 0, $no_js_use = FALSE)
{
-
-$query = "
+
+ $query = "
SELECT * FROM workshop
WHERE w_id = :workshop_id
";
@@ -3634,7 +3644,7 @@ $query = "
$result = db_query($query, $args);
$row = $result->fetchObject();
$form = array();
-
+
if ($workshop_id == 0) {
$form['foss_select'] = array(
'#type' => 'select',
@@ -3642,7 +3652,7 @@ $query = "
'#options' => get_first_dropdown_options_foss_name(),
'#default_value' => '',
"#required" => TRUE
- );
+ );
$form['type'] = array(
'#type' => 'select',
'#title' => t('Selected Type'),
@@ -3796,6 +3806,12 @@ $query = "
"#default_value" => '',
"#required" => TRUE
);
+
+ $form["event_link"] = array(
+ "#type" => "textfield",
+ "#title" => "Link to event's website",
+ "#default_value" => ''
+ );
$form["body"] = array(
"#type" => "textarea",
"#title" => "Details",
@@ -3820,17 +3836,17 @@ $query = "
);
$form['speakers_fieldset'][$i]["speakername"] = array(
"#type" => "textfield",
- "#title" => "Name",
+ "#title" => "Name: ",
"#default_value" => ""
);
$form['speakers_fieldset'][$i]["institute"] = array(
"#type" => "textfield",
- "#title" => "Institute",
+ "#title" => "Institute: ",
"#default_value" => ""
);
$form['speakers_fieldset'][$i]["place"] = array(
"#type" => "textfield",
- "#title" => "Place",
+ "#title" => "Place: ",
"#default_value" => ""
);
}
@@ -3870,6 +3886,10 @@ $query = "
}
unset($form['speakers_fieldset']['add_speakers']['#ajax']);
}
+
+
+ // adding testimonial fieldset
+
$form['testimonial_fieldset'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
@@ -3888,22 +3908,22 @@ $query = "
);
$form['testimonial_fieldset'][$i]["t_name"] = array(
"#type" => "textfield",
- "#title" => "Name",
+ "#title" => "Name: ",
"#default_value" => ""
);
$form['testimonial_fieldset'][$i]["t_department"] = array(
"#type" => "textfield",
- "#title" => "Department",
+ "#title" => "Department: ",
"#default_value" => ""
);
$form['testimonial_fieldset'][$i]["t_university"] = array(
"#type" => "textfield",
- "#title" => "University",
+ "#title" => "University: ",
"#default_value" => ""
);
$form['testimonial_fieldset'][$i]["t_body"] = array(
"#type" => "textarea",
- "#title" => "Testimonial"
+ "#title" => "Testimonial: "
);
}
$form["testimonial_count"] = array(
@@ -3942,6 +3962,76 @@ $query = "
}
unset($form['testimonial_fieldset']['add_testimonial']['#ajax']);
}
+
+
+ //Adding video link with title
+
+ $form['videolink_fieldset'] = array(
+ '#type' => 'fieldset',
+ '#tree' => TRUE,
+ '#prefix' => '
',
+ '#suffix' => '
'
+ );
+ if (empty($form_state['num_videolink'])) {
+ $form_state['num_videolink'] = 1;
+ }
+ $temp = 0;
+ for ($i = 0; $i < $form_state['num_videolink']; $i++) {
+ $temp1 = $i;
+ $form['videolink_fieldset'][$i]["v_text"] = array(
+ "#type" => "item",
+ "#markup" => "
"
+ );
+ $form['videolink_fieldset'][$i]["videolink_title"] = array(
+ "#type" => "textfield",
+ "#title" => "Title: ",
+ "#default_value" => ""
+ );
+ $form['videolink_fieldset'][$i]["videolink_link"] = array(
+ "#type" => "textfield",
+ "#title" => "Link: ",
+ "#default_value" => ""
+ );
+
+ }
+ $form["videolink_count"] = array(
+ "#type" => "hidden",
+ "#value" => $temp1
+ );
+ $form['videolink_fieldset']['add_videolink'] = array(
+ '#type' => 'submit',
+ '#value' => t('Add Video Link'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'videolink_add_more_add_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'videolink_add_more_callback',
+ 'wrapper' => 'videolink-fieldset-wrapper'
+ )
+ );
+ if ($form_state['num_videolink'] > 1) {
+ $form['videolink_fieldset']['remove_videolink'] = array(
+ '#type' => 'submit',
+ '#value' => t('Remove Video Link'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'videolink_add_more_remove_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'videolink_add_more_callback',
+ 'wrapper' => 'videolink-fieldset-wrapper'
+ )
+ );
+ }
+ if ($no_js_use) {
+ if (!empty($form['videolink_fieldset']['remove_videolink']['#ajax'])) {
+ unset($form['videolink_fieldset']['remove_videolink']['#ajax']);
+ }
+ unset($form['videolink_fieldset']['add_videolink']['#ajax']);
+ }
+
+
$form['names_fieldset'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
@@ -4162,6 +4252,14 @@ $query = "
"#default_value" => $row->no_of_participant,
"#required" => TRUE
);
+
+ $form["event_link"] = array(
+ "#type" => "textfield",
+ "#title" => "Link to event's website",
+ "#default_value" => $row->event_link
+
+ );
+
$form["body"] = array(
"#type" => "textarea",
"#title" => "Details",
@@ -4169,12 +4267,250 @@ $query = "
"#required" => TRUE
);
/*Edit Speakers*/
- /*Edit Testimonial*/
- $query_t = db_select('testimonials');
- $query_t->fields('testimonials');
- $query_t->condition('w_id', $workshop_id);
- $result_t = $query_t->execute();
- $num_of_results = $result_t->rowCount();
+
+ $query_s = db_select('speakers');
+ $query_s->fields('speakers');
+ $query_s->condition('w_id', $workshop_id);
+ $result_s = $query_s->execute();
+ $num_of_speakerresults = $result_s->rowCount();
+
+ $form['speakers_fieldset'] = array(
+ '#type' => 'fieldset',
+ '#tree' => TRUE,
+ '#prefix' => '
',
+ '#suffix' => '
'
+ );
+
+ if ($num_of_speakerresults != 0) {
+
+ $form_state['num_speakers'] = $num_of_speakerresults;
+ $temp = 0;
+ $i = 0;
+ while ($row_s = $result_s->fetchObject()) {
+ $temp = $i;
+ $form['speakers_fieldset'][$i]["s_text"] = array(
+ "#type" => "item",
+ "#markup" => "
"
+ );
+ $form['speakers_fieldset'][$i]["s_id"] = array(
+ "#type" => "hidden",
+ "#default_value" => $row_s->s_id
+ );
+ $form['speakers_fieldset'][$i]["speakername"] = array(
+ "#type" => "textfield",
+ "#title" => "Name",
+ "#default_value" => $row_s->name
+ );
+ $form['speakers_fieldset'][$i]["institute"] = array(
+ "#type" => "textfield",
+ "#title" => "Institute",
+ "#default_value" => $row_s->institute
+ );
+ $form['speakers_fieldset'][$i]["place"] = array(
+ "#type" => "textfield",
+ "#title" => "Place",
+ "#default_value" => $row_s->place
+ );
+
+ $i++;
+ }
+
+
+ $form["speakers_count"] = array(
+ "#type" => "hidden",
+ "#value" => $temp
+ );
+
+ } else {
+ if (empty($form_state['num_speakers'])) {
+ $form_state['num_speakers'] = 1;
+ }
+ $temp = 0;
+ for ($i = 0; $i < $form_state['num_speakers']; $i++) {
+ $temp = $i;
+ $form['speakers_fieldset'][$i]["s_text"] = array(
+ "#type" => "item",
+ "#markup" => "
"
+ );
+ $form['speakers_fieldset'][$i]["speakername"] = array(
+ "#type" => "textfield",
+ "#title" => "Name",
+ "#default_value" => ""
+ );
+ $form['speakers_fieldset'][$i]["institute"] = array(
+ "#type" => "textfield",
+ "#title" => "Department",
+ "#default_value" => ""
+ );
+ $form['speakers_fieldset'][$i]["place"] = array(
+ "#type" => "textfield",
+ "#title" => "University",
+ "#default_value" => ""
+ );
+
+ }
+ $form["speakers_count"] = array(
+ "#type" => "hidden",
+ "#value" => $temp
+ );
+ $form['speakers_fieldset']['add_speakers'] = array(
+ '#type' => 'submit',
+ '#value' => t('Add Speaker'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'speakers_add_more_add_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'speakers_add_more_callback',
+ 'wrapper' => 'speakers-fieldset-wrapper'
+ )
+ );
+ if ($form_state['num_speakers'] > 1) {
+ $form['speakers_fieldset']['remove_speakers'] = array(
+ '#type' => 'submit',
+ '#value' => t('Remove'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'speakers_add_more_remove_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'speakers_add_more_callback',
+ 'wrapper' => 'speakers-fieldset-wrapper'
+ )
+ );
+ }
+ if ($no_js_use) {
+ if (!empty($form['speakers_fieldset']['remove_speakers']['#ajax'])) {
+ unset($form['speakers_fieldset']['remove_speakers']['#ajax']);
+ }
+ unset($form['speakers_fieldset']['add_speakers']['#ajax']);
+ }
+ }
+
+
+ /* Edit Video Links */
+
+ $query_v = db_select('workshop_videolinks');
+ $query_v->fields('workshop_videolinks');
+ $query_v->condition('w_id', $workshop_id);
+ $result_v = $query_v->execute();
+ $num_of_videoresults = $result_v->rowCount();
+
+ $form['videolink_fieldset'] = array(
+ '#type' => 'fieldset',
+ '#tree' => TRUE,
+ '#prefix' => '
',
+ '#suffix' => '
'
+ );
+
+ if ($num_of_videoresults != 0) {
+
+ $form_state['num_videolink'] = $num_of_videoresults;
+ $temp = 0;
+ $i = 0;
+ while ($row_v = $result_v->fetchObject()) {
+ $temp = $i;
+ $form['videolink_fieldset'][$i]["v_text"] = array(
+ "#type" => "item",
+ "#markup" => "
"
+ );
+ $form['videolink_fieldset'][$i]["v_id"] = array(
+ "#type" => "hidden",
+ "#default_value" => $row_v->v_id
+ );
+ $form['videolink_fieldset'][$i]["videolink_title"] = array(
+ "#type" => "textfield",
+ "#title" => "Title: ",
+ "#default_value" => $row_v->title
+ );
+ $form['videolink_fieldset'][$i]["videolink_link"] = array(
+ "#type" => "textfield",
+ "#title" => "Institute",
+ "#default_value" => $row_v->link
+ );
+
+ $i++;
+ }
+
+
+ $form["videolink_count"] = array(
+ "#type" => "hidden",
+ "#value" => $temp
+ );
+
+ } else {
+ if (empty($form_state['num_videolink'])) {
+ $form_state['num_videolink'] = 1;
+ }
+ $temp = 0;
+ for ($i = 0; $i < $form_state['num_videolink']; $i++) {
+ $temp = $i;
+ $form['videolink_fieldset'][$i]["v_text"] = array(
+ "#type" => "item",
+ "#markup" => "
"
+ );
+ $form['videolink_fieldset'][$i]["videolink_title"] = array(
+ "#type" => "textfield",
+ "#title" => "Title: ",
+ "#default_value" => ""
+ );
+ $form['videolink_fieldset'][$i]["videolink_link"] = array(
+ "#type" => "textfield",
+ "#title" => "Link: ",
+ "#default_value" => ""
+ );
+
+
+ }
+ $form["videolink_count"] = array(
+ "#type" => "hidden",
+ "#value" => $temp
+ );
+ $form['videolink_fieldset']['add_videolink'] = array(
+ '#type' => 'submit',
+ '#value' => t('Add Video'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'videolink_add_more_add_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'videolink_add_more_callback',
+ 'wrapper' => 'videolink-fieldset-wrapper'
+ )
+ );
+ if ($form_state['num_videolink'] > 1) {
+ $form['videolink_fieldset']['remove_videolink'] = array(
+ '#type' => 'submit',
+ '#value' => t('Remove'),
+ '#limit_validation_errors' => array(),
+ '#submit' => array(
+ 'videolink_add_more_remove_one'
+ ),
+ '#ajax' => array(
+ 'callback' => 'videolink_add_more_callback',
+ 'wrapper' => 'videolink-fieldset-wrapper'
+ )
+ );
+ }
+ if ($no_js_use) {
+ if (!empty($form['videolink_fieldset']['remove_videolink']['#ajax'])) {
+ unset($form['videolink_fieldset']['remove_videolink']['#ajax']);
+ }
+ unset($form['videolink_fieldset']['add_videolink']['#ajax']);
+ }
+ }
+
+
+
+
+
+
+ /*Edit Testimonial*/
+ $query_t = db_select('testimonials');
+ $query_t->fields('testimonials');
+ $query_t->condition('w_id', $workshop_id);
+ $result_t = $query_t->execute();
+ $num_of_results = $result_t->rowCount();
$form['testimonial_fieldset'] = array(
'#type' => 'fieldset',
'#tree' => TRUE,
@@ -4463,6 +4799,29 @@ function speakers_add_more_remove_one($form, &$form_state)
}
+function videolink_add_more_callback($form, $form_state)
+{
+ return $form['videolink_fieldset'];
+}
+
+
+function videolink_add_more_add_one($form, &$form_state)
+{
+ $form_state['num_videolink']++;
+ $form_state['rebuild'] = TRUE;
+ //$form_state['no_redirect'] = TRUE;
+}
+
+
+function videolink_add_more_remove_one($form, &$form_state)
+{
+ if ($form_state['num_videolink'] > 1) {
+ $form_state['num_videolink']--;
+ }
+ $form_state['rebuild'] = TRUE;
+}
+
+
function testimonial_add_more_callback($form, $form_state)
{
return $form['testimonial_fieldset'];
@@ -4576,15 +4935,111 @@ function workshop_add_form_submit($form, &$form_state)
'state' => $v["all_state"],
'city' => $v["city"],
'pincode' => $v["pincode"],
+ 'event_link' => $v["event_link"],
'no_of_participant' => $v["no_of_participant"],
'body' => $v["body"]
));
$query->condition('w_id', $v["workshop_id"]);
$result = $query->execute();
+
+ /*For editing speakers */
+
+ $speakersupload = 0;
+ for ($i = 0; $i <= $v["speakers_count"]; $i++) {
+ $s_id = $v['speakers_fieldset'][$i]["s_id"];
+ if ($s_id != "") {
+ if ($v['speakers_fieldset'][$i]["speakername"] != "") {
+ $query = db_update('speakers');
+ $query->fields(array(
+ 'name' => $v['speakers_fieldset'][$i]["speakername"],
+ 'institute' => $v['speakers_fieldset'][$i]["institute"],
+ 'place' => $v['speakers_fieldset'][$i]["place"]
+ ));
+ $query->condition('s_id', $v['speakers_fieldset'][$i]["s_id"]);
+ $result = $query->execute();
+ if ($result != 0) {
+ $speakersupload++;
+ }
+ }
+ } else {
+ if ($v['speakers_fieldset'][$i]["speakername"] != "") {
+ $speakersquery = "
+ INSERT INTO speakers
+ (w_id,name,institute,place)
+ VALUES
+ (:w_id,:name,:institute,:place)
+ ";
+ $speakersargs = array(
+ ":w_id" => $v["workshop_id"],
+ ":name" => $v['speakers_fieldset'][$i]["speakername"],
+ ":institute" => $v['speakers_fieldset'][$i]["institute"],
+ ":place" => $v['speakers_fieldset'][$i]["place"]
+ );
+ /* storing the row id in $result */
+ $speakersresult = db_query($speakersquery, $speakersargs, array(
+ 'return' => Database::RETURN_INSERT_ID
+ ));
+ if ($speakersresult != 0) {
+ $speakersupload++;
+ }
+ }
+ }
+ }
+
+
+
+ /*For editing video */
+
+ $videolink_upload = 0;
+ for ($i = 0; $i <= $v["videolink_count"]; $i++) {
+ $v_id = $v['videolink_fieldset'][$i]["v_id"];
+ if ($v_id != "") {
+ if ($v['videolink_fieldset'][$i]["videolink_title"] != "") {
+ $query = db_update('workshop_videolinks');
+ $query->fields(array(
+ 'title' => $v['videolink_fieldset'][$i]["videolink_title"],
+ 'link' => $v['videolink_fieldset'][$i]["videolink_link"]
+
+ ));
+ $query->condition('v_id', $v['videolink_fieldset'][$i]["v_id"]);
+ $result = $query->execute();
+ if ($result != 0) {
+ $videolink_upload++;
+ }
+ }
+ } else {
+ if ($v['videolink_fieldset'][$i]["videolink_title"] != "") {
+ $videolinkquery = "
+ INSERT INTO workshop_videolinks
+ (w_id,title,link)
+ VALUES
+ (:w_id,:title,:link)
+ ";
+ $videolinkargs = array(
+ ":w_id" => $v["workshop_id"],
+ ":title" => $v['videolink_fieldset'][$i]["videolink_title"],
+ ":link" => $v['videolink_fieldset'][$i]["videolink_link"]
+
+ );
+ /* storing the row id in $result */
+ $videolinkresult = db_query($videolinkquery, $videolinkargs, array(
+ 'return' => Database::RETURN_INSERT_ID
+ ));
+ if ($videolinkresult != 0) {
+ $videolink_upload++;
+ }
+ }
+ }
+ }
+
+
+
+
/* For editing Testimonials */
$testimonialupload = 0;
for ($i = 0; $i <= $v["testimonial_count"]; $i++) {
- if ($v['testimonial_fieldset'][$i]["t_id"] != "") {
+ $t_id = $v['testimonial_fieldset'][$i]["t_id"];
+ if ($t_id != "") {
if ($v['testimonial_fieldset'][$i]["t_name"] != "") {
$query = db_update('testimonials');
$query->fields(array(
@@ -4631,11 +5086,11 @@ function workshop_add_form_submit($form, &$form_state)
$query_img->fields('workshop_images');
$query_img->condition('w_id', $v["workshop_id"]);
$result_img = $query_img->execute();
- $root_path=events_images_path();
+ $root_path = events_images_path();
while ($row_img = $result_img->fetchObject()) {
if ($form_state['values']['imagecheck@' . $row_img->id] == 1) {
- if (file_exists($root_path.$row_img->path)) {
- unlink($root_path.$row_img->path);
+ if (file_exists($root_path . $row_img->path)) {
+ unlink($root_path . $row_img->path);
$query2 = db_delete('workshop_images');
$query2->condition('id', $row_img->id);
$delete_img = $query2->execute();
@@ -4655,6 +5110,7 @@ function workshop_add_form_submit($form, &$form_state)
if (!is_dir($root_path . $dest_path)) {
mkdir($root_path . $dest_path);
}
+ $imageupload = 0;
/* uploading files */
foreach ($_FILES['files']['name'] as $file_form_name => $file_name) {
if ($file_name) {
@@ -4664,7 +5120,7 @@ function workshop_add_form_submit($form, &$form_state)
)), 'error');
return;
}
- $imageupload = 0;
+
/* uploading file */
if (move_uploaded_file($_FILES['files']['tmp_name'][$file_form_name], $root_path . $dest_path . $_FILES['files']['name'][$file_form_name])) {
$imagequery = "
@@ -4691,7 +5147,7 @@ function workshop_add_form_submit($form, &$form_state)
}
}
}
- if (!$result && $imageupload == 0 && $deletecounter == 0) {
+ if (!$result && $imageupload == 0 && $deletecounter == 0 && $videolink_upload == 0) {
drupal_set_message("Something went wrong, please try again.", "error");
} else {
drupal_set_message("Workshop updated successfully", "status");
@@ -4705,13 +5161,13 @@ function workshop_add_form_submit($form, &$form_state)
} else {
$query = "
INSERT INTO workshop
- (foss_name,type,w_name, startdate, starttime,enddate, endtime, venue, street, country,state,city,pincode,no_of_participant,body)
- VALUES (:foss_name,:type,:w_name, :startdate, :starttime,:enddate, :endtime, :venue, :street, :country, :state, :city, :pincode,
+ (foss_name, type, w_name, startdate, starttime,enddate, endtime, venue, street, country, state, city, pincode, event_link, no_of_participant,body)
+ VALUES (:foss_name, :type, :w_name, :startdate, :starttime,:enddate, :endtime, :venue, :street, :country, :state, :city, :pincode, :event_link,
:no_of_participant, :body)
";
$args = array(
- ":type" => $v["type"],
":foss_name" => $v["foss_select"],
+ ":type" => $v["type"],
":w_name" => $v["name"],
":startdate" => $v["start_date"],
":starttime" => "00:00",
@@ -4723,6 +5179,7 @@ function workshop_add_form_submit($form, &$form_state)
":state" => $v["all_state"],
":city" => $v["city"],
":pincode" => $v["pincode"],
+ ":event_link" => $v["event_link"],
":no_of_participant" => $v["no_of_participant"],
":body" => $v["body"]
);
@@ -4781,6 +5238,34 @@ function workshop_add_form_submit($form, &$form_state)
}
}
}
+
+ /* Adding video links */
+
+ $videolinkupload = 0;
+ for ($i = 0; $i <= $v["videolink_count"]; $i++) {
+ if ($v['videolink_fieldset'][$i]["videolink_title"] != "") {
+ $videolinkquery = "
+ INSERT INTO workshop_videolinks
+ (w_id,title,link)
+ VALUES
+ (:w_id,:title,:link)
+ ";
+ $videolinkargs = array(
+ ":w_id" => $result,
+ ":title" => $v['videolink_fieldset'][$i]["videolink_title"],
+ ":link" => $v['videolink_fieldset'][$i]["videolink_link"]
+ );
+ /* storing the row id in $result */
+ $videolinkresult = db_query($videolinkquery, $videolinkargs, array(
+ 'return' => Database::RETURN_INSERT_ID
+ ));
+ if ($videolinkresult != 0) {
+ $videolinkupload++;
+ }
+ }
+ }
+
+
/* For adding images of events*/
$items = array();
$root_path = events_images_path();
@@ -4838,6 +5323,9 @@ function workshop_add_form_submit($form, &$form_state)
if ($speakerupload != 0) {
drupal_set_message("Speaker's Detail are added successfully", "status");
}
+ if ($videolinkupload != 0) {
+ drupal_set_message("Video links are added successfully", "status");
+ }
}
}
}
@@ -4946,7 +5434,7 @@ function workshop_view_selected_testimonial($id = 0)
function workshop_view_all_testimonials($workshop_id = 0)
{
$page_content = "";
-
+
$query = db_select('testimonials');
$query->fields('testimonials');
$query->condition('w_id', $workshop_id);
@@ -4971,7 +5459,7 @@ function workshop_view_all_testimonials($workshop_id = 0)
";
}
$page_content .= "
";
-
+
$page_content .= theme('pager', array(
'header' => NULL,
'rows' => 4
@@ -5051,7 +5539,7 @@ function workshop_delete_all($workshop_id = 0)
$query3 = db_delete('workshop');
$query3->condition('w_id', $workshop_id);
$result3 = $query3->execute();
-
+
if (!$result3) {
drupal_set_message("Something went wrong, please try again.", "error");
} else {
@@ -5105,10 +5593,9 @@ function workshop_edit_all($workshop_id = 0)
}
-function events_view_filter($foss_name, $event_type, $startdate, $enddate,
- $countryname, $statename, $cityname)
+function events_view_filter($foss_name, $event_type, $startdate, $enddate, $countryname, $statename, $cityname)
{
-
+
$page_content = "";
$headers = array(
"Name",
@@ -5148,7 +5635,7 @@ function events_view_filter($foss_name, $event_type, $startdate, $enddate,
$cityname = trim($cityname);
}
-
+
$rows = array();
$query = db_select('workshop');
$query->fields('workshop');
@@ -5214,7 +5701,7 @@ function workshop_view_all($workshop_id, $startdate, $enddate)
$row->startdate,
$row->venue,
$row->no_of_participant,
-
+
"" . $var . ". " . $speakerrow->name . " " . $speakerrow->institute . ", " . $speakerrow->place . "
";
+ if ($num_of_speakercount != 0) {
+ $textdisplay = "";
+ $counter = 1;
+ while ($speakerrow = $speakerresult->fetchObject()) {
+ $var = $counter++;
+ $textdisplay .= "" . $var . ". " . $speakerrow->name . "