[ PHPXref.com ] [ Generated: Sun Jul 20 19:41:04 2008 ] [ phpGroupWare 0.9.16.010 ]
[ Index ]     [ Variables ]     [ Functions ]     [ Classes ]     [ Constants ]     [ Statistics ]

title

Body

[close]

/comic/ -> admin_comics.php (source)

   1  <?php
   2      /**************************************************************************\
   3      * phpGroupWare - Daily Comic Admin Link Data                               *
   4      * http://www.phpgroupware.org                                              *
   5      * This file written by Sam Wynn <neotexan@wynnsite.com>                    *
   6      * --------------------------------------------                             *
   7      *  This program is free software; you can redistribute it and/or modify it *
   8      *  under the terms of the GNU General Public License as published by the   *
   9      *  Free Software Foundation; either version 2 of the License, or (at your  *
  10      *  option) any later version.                                              *
  11      \**************************************************************************/
  12  
  13      /* $Id: admin_comics.php,v 1.1.4.4.2.2 2004/07/15 00:01:23 skwashd Exp $ */
  14  
  15      $phpgw_info['flags'] = Array(
  16          'currentapp' => 'comic',
  17          'enable_nextmatchs_class' => True,
  18          'admin_header' => True
  19      );
  20  
  21      include('../header.inc.php');
  22      include ('inc/comic_data.inc.php');
  23  
  24      if(!$GLOBALS['phpgw_info']['user']['apps']['comic'])
  25      {
  26          Header('Location: '. $GLOBALS['phpgw']->link('/home.php') );
  27          exit;
  28      }
  29  
  30      $title             = lang('Daily Comics Data');
  31  
  32      $done_label        = lang('Done');
  33      $doneurl           = $GLOBALS['phpgw']->link('/admin/index.php') . '#comic';
  34  
  35      $message           = '';
  36  
  37      $act        = get_var('act', array('POST', 'GET'), '');
  38      $order        = get_var('order', array('POST', 'GET'), 'data_title');
  39      $sort        = get_var('sort', array('POST', 'GET'), 'ASC');
  40      $start        = get_var('start', array('POST', 'GET'), 0);
  41      $query        = get_var('query', array('POST', 'GET'), '');
  42      $qfield        = get_var('qfield', array('POST', 'GET'), 'data_title');
  43      $filter        = get_var('filter', array('POST', 'GET'), '');
  44      $con        = get_var('con', array('POST', 'GET'), 0);
  45      $submit        = get_var('submit', array('POST'), false);
  46      $comic_name    = get_var('comic_name', array('POST'), '');
  47      $data_id    = intval( get_var('data_id', array('POST'), 0) );
  48      
  49      if ($submit)
  50      {
  51          switch($act)
  52          {
  53              case 'edit':
  54                  $message = 'modification';
  55                  break;
  56              case 'delete':
  57                  $message = 'deletion';
  58                  break;
  59              case 'add':
  60                  $message = 'addition';
  61                  break;
  62          }
  63          $message = lang('Performed %1 of element', lang($message) );
  64      }
  65  
  66      $other_c           = '';
  67      
  68      switch($act)
  69      {
  70          case 'edit':
  71              if ($submit)
  72              {
  73                  $GLOBALS['phpgw']->db->lock('phpgw_comic_data');
  74                  $GLOBALS['phpgw']->db->query('UPDATE phpgw_comic_data'
  75                          . " SET data_title = '".$GLOBALS['phpgw']->db->db_addslashes($comic_name)."'"
  76                          . " WHERE data_id = $data_id",__LINE__,__FILE__);
  77                  $GLOBALS['phpgw']->db->unlock();
  78  
  79                  comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
  80                  comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
  81              }
  82              else
  83              {
  84                  comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
  85                  //comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
  86                  comic_entry($con,$act,$order,$sort,$filter,$start,$query,$qfield,$other_c);
  87              }
  88              break;
  89          case 'delete':
  90              if ($submit)
  91              {
  92                  $GLOBALS['phpgw']->db->lock('phpgw_comic_data');
  93                  $GLOBALS['phpgw']->db->query('DELETE FROM phpgw_comic_data'
  94                      . " WHERE data_id =  $data_id",__LINE__,__FILE__);
  95                  $GLOBALS['phpgw']->db->unlock();
  96  
  97                  comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
  98                  comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
  99              }
 100              else
 101              {
 102                  comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
 103                  //comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
 104                  comic_entry($con,$act,$order,$sort,$filter,$start,$query,$qfield,$other_c);
 105              }
 106              break;
 107          case 'add':
 108              if ($submit)
 109              {
 110                  $GLOBALS['phpgw']->db->lock('phpgw_comic_data');
 111                  $GLOBALS['phpgw']->db->query('INSERT INTO phpgw_comic_data(data_name) '
 112                      . " VALUES ('".$GLOBALS['phpgw']->db->db_addslashes($comic_name)."')",__LINE__,__FILE__);
 113                  $GLOBALS['phpgw']->db->unlock();
 114              }
 115              comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
 116              comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
 117              break;
 118          default:
 119              comic_table($order,$sort,$filter,$start,$query,$qfield,$table_c);
 120              comic_entry('','add',$order,$sort,$filter,$start,$query,$qfield,$add_c);
 121              break;
 122      }
 123      
 124      $comics_tpl = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('comic'));
 125      $comics_tpl->set_unknowns('remove');
 126      $comics_tpl->set_file(
 127          Array(
 128              'message'   => 'message.common.tpl',
 129              'comics'    => 'admin.datalist.tpl'
 130          )
 131      );
 132      $comics_tpl->set_var(
 133          Array(
 134              'messagename'      => $message,
 135              'title'            => $title,
 136              'done_url'         => $doneurl,
 137              'done_label'       => $done_label,
 138              'data_table'       => $table_c,
 139              'add_form'         => $add_c,
 140              'other_form'       => $other_c
 141          )
 142      );
 143  
 144      $comics_tpl->parse('message_part','message');
 145      $message_c = $comics_tpl->get('message_part');
 146  
 147      $comics_tpl->parse('body_part','comics');
 148      $body_c = $comics_tpl->get('body_part');
 149      
 150      /**************************************************************************
 151       * pull it all together
 152       *************************************************************************/
 153      $body_tpl = CreateObject('phpgwapi.Template',$GLOBALS['phpgw']->common->get_tpl_dir('comic'));
 154      $body_tpl->set_unknowns('remove');
 155      $body_tpl->set_file('body','admin.common.tpl');
 156      $body_tpl->set_var(
 157          Array(
 158              'admin_message' => $message_c,
 159              'admin_body'    => $body_c
 160          )
 161      );
 162      $body_tpl->parse('BODY','body');
 163      $body_tpl->p('BODY');
 164  
 165      $GLOBALS['phpgw']->common->phpgw_footer();
 166  ?>


[ Powered by PHPXref - Served by Debian GNU/Linux ]