[903] | 1 | <?php |
---|
| 2 | /**************************************************************************\ |
---|
| 3 | * eGroupWare - Webpage news admin * |
---|
| 4 | * http://www.egroupware.org * |
---|
| 5 | * -------------------------------------------- * |
---|
| 6 | * This program is free software; you can redistribute it and/or modify it * |
---|
| 7 | * under the terms of the GNU General Public License as published by the * |
---|
| 8 | * Free Software Foundation; either version 2 of the License, or (at your * |
---|
| 9 | * option) any later version. * |
---|
| 10 | * -------------------------------------------- * |
---|
| 11 | * This program was sponsered by Golden Glair productions * |
---|
| 12 | * http://www.goldenglair.com * |
---|
| 13 | \**************************************************************************/ |
---|
| 14 | |
---|
| 15 | |
---|
| 16 | $phpgw_info = array(); |
---|
| 17 | $GLOBALS['phpgw_info']['flags'] = array( |
---|
| 18 | 'currentapp' => 'news_admin', |
---|
| 19 | 'enable_nextmatchs_class' => True |
---|
| 20 | ); |
---|
| 21 | if($submit) |
---|
| 22 | { |
---|
| 23 | $GLOBALS['phpgw_info']['flags']['noheader'] = True; |
---|
| 24 | $GLOBALS['phpgw_info']['flags']['nonavbar'] = True; |
---|
| 25 | } |
---|
| 26 | include('../header.inc.php'); |
---|
| 27 | |
---|
| 28 | $GLOBALS['phpgw']->sbox = CreateObject('phpgwapi.sbox'); |
---|
| 29 | |
---|
| 30 | if($submit) |
---|
| 31 | { |
---|
| 32 | // Its possiable that this could get messed up becuase of there timezone offset |
---|
| 33 | if($date_ap == 'pm') |
---|
| 34 | { |
---|
| 35 | $date_hour = $date_hour + 12; |
---|
| 36 | } |
---|
| 37 | $date = mktime($date_hour,$date_min,$date_sec,$date_month,$date_day,$date_year); |
---|
| 38 | $GLOBALS['phpgw']->db->query("UPDATE phpgw_news SET news_subject='" . addslashes($subject) . "'," |
---|
| 39 | . "news_content='" . addslashes($content) . "',news_status='$status',news_date='$date' " |
---|
| 40 | . "WHERE news_id='$news_id'",__LINE__,__FILE__); |
---|
| 41 | Header('Location: ' . $GLOBALS['phpgw']->link('/news_admin/index.php')); |
---|
| 42 | $GLOBALS['phpgw']->common->phpgw_exit(); |
---|
| 43 | } |
---|
| 44 | |
---|
| 45 | $GLOBALS['phpgw']->template->set_file(array( |
---|
| 46 | 'form' => 'form.tpl', |
---|
| 47 | 'row' => 'form_row.tpl' |
---|
| 48 | )); |
---|
| 49 | |
---|
| 50 | $GLOBALS['phpgw']->db->query("select * from phpgw_news where news_id='$news_id'",__LINE__,__FILE__); |
---|
| 51 | $GLOBALS['phpgw']->db->next_record(); |
---|
| 52 | |
---|
| 53 | $GLOBALS['phpgw']->template->set_var('th_bg',$GLOBALS['phpgw_info']['theme']['th_bg']); |
---|
| 54 | $GLOBALS['phpgw']->template->set_var('bgcolor',$GLOBALS['phpgw_info']['theme']['bgcolor']); |
---|
| 55 | |
---|
| 56 | $GLOBALS['phpgw']->template->set_var('lang_header',lang('Edit news item')); |
---|
| 57 | $GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/news_admin/edit.php','news_id=' . $GLOBALS['phpgw']->db->f('news_id'))); |
---|
| 58 | $GLOBALS['phpgw']->template->set_var('form_button','<input type="submit" name="submit" value="' . lang("Edit") . '">'); |
---|
| 59 | |
---|
| 60 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); |
---|
| 61 | $GLOBALS['phpgw']->template->set_var('label',lang('subject') . ':'); |
---|
| 62 | $GLOBALS['phpgw']->template->set_var('value','<input name="subject" size="60" value="' . $GLOBALS['phpgw']->db->f('news_subject') . '">'); |
---|
| 63 | $GLOBALS['phpgw']->template->parse('rows','row',True); |
---|
| 64 | |
---|
| 65 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); |
---|
| 66 | $GLOBALS['phpgw']->template->set_var('label',lang('Content') . ':'); |
---|
| 67 | $GLOBALS['phpgw']->template->set_var('value','<textarea cols="60" rows="6" name="content" wrap="virtual">' . stripslashes($GLOBALS['phpgw']->db->f('news_content')) . '</textarea>'); |
---|
| 68 | $GLOBALS['phpgw']->template->parse('rows','row',True); |
---|
| 69 | |
---|
| 70 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); |
---|
| 71 | $GLOBALS['phpgw']->template->set_var('label',lang('Status') . ':'); |
---|
| 72 | $s[$GLOBALS['phpgw']->db->f('news_status')] = ' selected'; |
---|
| 73 | $GLOBALS['phpgw']->template->set_var("value",'<select name="status"><option value="Active"' . $s['Active'] . '>' |
---|
| 74 | . lang('active') . '</option><option value="Disabled"' . $s['Disabled'] . '>' |
---|
| 75 | . lang('Disabled') . '</option></select>'); |
---|
| 76 | $GLOBALS['phpgw']->template->parse('rows','row',True); |
---|
| 77 | |
---|
| 78 | $GLOBALS['phpgw']->template->set_var('tr_color',$GLOBALS['phpgw']->nextmatchs->alternate_row_color()); |
---|
| 79 | $GLOBALS['phpgw']->template->set_var('label',lang('Date') . ':'); |
---|
| 80 | |
---|
| 81 | $d_html = $GLOBALS['phpgw']->common->dateformatorder($GLOBALS['phpgw']->sbox->getYears('date_year', date('Y',$GLOBALS['phpgw']->db->f('news_date'))), |
---|
| 82 | $GLOBALS['phpgw']->sbox->getMonthText('date_month', date('m',$GLOBALS['phpgw']->db->f('news_date'))), |
---|
| 83 | $GLOBALS['phpgw']->sbox->getDays('date_day', date('d',$GLOBALS['phpgw']->db->f('news_date'))) |
---|
| 84 | ); |
---|
| 85 | $d_html .= " - "; |
---|
| 86 | $d_html .= $GLOBALS['phpgw']->sbox->full_time('date_hour',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'h'), |
---|
| 87 | 'date_min',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'i'), |
---|
| 88 | 'date_sec',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'s'), |
---|
| 89 | 'date_ap',$GLOBALS['phpgw']->common->show_date($GLOBALS['phpgw']->db->f('news_date'),'a') |
---|
| 90 | ); |
---|
| 91 | $GLOBALS['phpgw']->template->set_var('value',$d_html); |
---|
| 92 | |
---|
| 93 | $h = '<select name="status"><option value="Active"' . $s['Active'] . '>' |
---|
| 94 | . lang('Active') . '</option><option value="Disabled"' . $s['Disabled'] . '>' |
---|
| 95 | . lang('Disabled') . '</option></select>'; |
---|
| 96 | $GLOBALS['phpgw']->template->parse('rows','row',True); |
---|
| 97 | |
---|
| 98 | $GLOBALS['phpgw']->template->pparse('out','form'); |
---|
| 99 | $GLOBALS['phpgw']->common->phpgw_footer(); |
---|
| 100 | ?> |
---|