wigglesby Posted May 14, 2009 Share Posted May 14, 2009 Hi I've got a form, which has drop down menus, and can be used to search my db and then return graphs using jpgraphs to display the results between the dates searched. The site is using JPGrpahs on Drupal v4.7.x and I've upgraded to v5.x and now I'm hainvg some major issues displaying the graphs and also a form. Using the same code from the previous versions, gives me a timeout error message. The code is from the jpgraphs.module file: function jpgraph_detail($op = NULL, $op2 = NULL, $op3 = NULL) { $today = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d'),date('Y'))); $last_week = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d')-7,date('Y'))); $last2_weeks = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d')-14,date('Y'))); $last_month = strftime('%d-%m-%Y',mktime(0,0,0,date('m')-1,date('d'),date('Y'))); $last6_months = strftime('%d-%m-%Y',mktime(0,0,0,date('m')-6,date('d'),date('Y'))); $last12_months = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d'),date('Y')-1)); $last12_months = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d'),date('Y')-1)); $last24_months = strftime('%d-%m-%Y',mktime(0,0,0,date('m'),date('d'),date('Y')-2)); if(($op && $op2)) { $datesURL = '&dateI='.$op.'&dateF='.$op2; $dateI_arr = explode('-',$op); $dateF_arr = explode('-',$op2); $dateI_det = $op; $dateF_det = $op2; } else { $datesURL = ''; $dateI_arr = array(); $dateF_arr = array(); $dateI_det = $last24_months; $dateF_det = $today; } $form = array(); $form['jpgraph_detail'] = array( '#type' => 'fieldset', '#title' => t('Dates'), '#collapsible' => FALSE, ); $form['jpgraph_detail']['jpgraph_date_F'] = array( '#type' => 'date', '#title' => t('to'), '#default_value' => array( 'year' => $dateF_arr[2] , //changes 'day' => $dateF_arr[0], 'month' => $dateF_arr[1]), '#required' => TRUE, '#weight' => -5, '#after_build' => array('set_year_range'), ); $form['jpgraph_detail']['jpgraph_date_I'] = array( '#type' => 'date', '#title' => t('from'), '#default_value' => array( 'year' => $dateI_arr[2] , 'day' => $dateI_arr[0], 'month' => $dateI_arr[1]), '#required' => TRUE, '#weight' => -5, '#after_build' => array('set_year_range'), ); $page_content = t('Select dates to view market price graphs for Electricity, Gas & Oil (<em>Max date range: 4 Years</em>)'); $page_content .= drupal_get_form('jpgraph_detail', $form); $page_content .= '<ul id="graph_links">'; $page_content .= "<li>".l(t('Last week'),'dailyupdate/'.$last_week.'/'.$today)."</li>"; $page_content .= "<li>".l('Last 2 weeks','dailyupdate/'.$last2_weeks.'/'.$today)."</li>"; $page_content .= "<li>".l('Last month','dailyupdate/'.$last_month.'/'.$today)."</li>"; $page_content .= "<li>".l('Last 6 months','dailyupdate/'.$last6_months.'/'.$today)."</li>"; $page_content .= "<li class=\"last\">".l('Last 12 months','dailyupdate/'.$last12_months.'/'.$today)."</li>"; $page_content .= "</ul>"; $getGraphs = db_query('SELECT title,id,comments FROM {jpgraph_graphs} WHERE published = 1 ORDER BY id'); while($graph = db_fetch_object($getGraphs)) { $page_content .= t('<h2 class="title">'.$graph->title.'</h2>'); // $page_content .= '<a href=# onclick="window.open(\'modules/jpgraph/details.php?graph_id='.$graph->id.'&dateI='.$dateI_det.'&dateF='.$dateF_det.'\',\'Details\',\'width=730,height=500,scrollbars=NO\')">'; $page_content .= '<a href="'.base_path().'modules/jpgraph/rendergraph.php?graph_id='.$graph->id.'&dateI='.$dateI_det.'&dateF='.$dateF_det.'&detail=2" rel="lightbox">'; $page_content .= theme_image('modules/jpgraph/rendergraph.php?graph_id='.$graph->id.'&detail=1'.$datesURL, $graph->title, $graph->title,'',FALSE) ."</a>"; $page_content .= t('<div class="graph_comments">'.$graph->comments.'</div>'); } //$page_content .= t('<p>Note: All information was obtained from wholesale market data sources. Energy Services accepts no liability for the accuracy of any third party market information</p>'); return $page_content; } When I comment out the following line, I can get the graphs to display: $page_content .= drupal_get_form('jpgraph_detail', $form); But I can't get the form to display. I know the modules are written differently between v4 and v5, but I can't find anything in my code that is wrong. Does anyone have any ideas? It seems like the drupal_get_form method is killing the whole page. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/158093-drupal-jpgraphs-and-get_drupal_form-upgrade-problem/ Share on other sites More sharing options...
wigglesby Posted May 14, 2009 Author Share Posted May 14, 2009 Has anyone seen this before? A module working perfectly in version4, but on upgrading the module doesn't work? I'm completely lost at why when I have the drupal_get_form fuunction, the page dies. Quote Link to comment https://forums.phpfreaks.com/topic/158093-drupal-jpgraphs-and-get_drupal_form-upgrade-problem/#findComment-834129 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.