phpgroupware-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpgroupware-cvs] sms/inc class.uipolls.inc.php


From: Sigurd Nes
Subject: [Phpgroupware-cvs] sms/inc class.uipolls.inc.php
Date: Wed, 31 May 2006 18:28:28 +0000

CVSROOT:        /sources/phpgroupware
Module name:    sms
Branch:         
Changes by:     Sigurd Nes <address@hidden>     06/05/31 18:28:28

Modified files:
        inc            : class.uipolls.inc.php 

Log message:
        

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/phpgroupware/sms/inc/class.uipolls.inc.php.diff?tr1=1.2&tr2=1.3&r1=text&r2=text

Patches:
Index: sms/inc/class.uipolls.inc.php
diff -u sms/inc/class.uipolls.inc.php:1.2 sms/inc/class.uipolls.inc.php:1.3
--- sms/inc/class.uipolls.inc.php:1.2   Wed May 31 12:42:46 2006
+++ sms/inc/class.uipolls.inc.php       Wed May 31 18:28:28 2006
@@ -8,7 +8,7 @@
        * @internal Development of this application was funded by 
http://www.bergen.kommune.no/bbb_/ekstern/
        * @package sms
        * @subpackage polls
-       * @version $Id: class.uipolls.inc.php,v 1.2 2006/05/31 12:42:46 
sigurdne Exp $
+       * @version $Id: class.uipolls.inc.php,v 1.3 2006/05/31 18:28:28 
sigurdne Exp $
        */
 
        /**
@@ -21,9 +21,10 @@
                var $public_functions = array(
                        'index'         => True,
                        'add'           => True,
-                       'add_yes'               => True,
+                       'add_yes'       => True,
                        'view'          => True,
-                       'delete'                => True,
+                       'edit'          => True,
+                       'delete'        => True,
                        );
 
 
@@ -238,6 +239,135 @@
                        
$GLOBALS['phpgw']->redirect_link('/index.php',$add_data);
                }
 
+
+               function edit()
+               {
+               
+                       if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))
+                       {
+                               $links = 
$this->menu->links('.config.autoreplay');
+                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
True;
+                               $this->bocommon->no_access($links);
+                               return;
+                       }
+                       
+                       
+                       $GLOBALS['phpgw_info']['flags']['app_header'] = 
lang('SMS').' - '.lang('Edit SMS poll');
+                       $GLOBALS['phpgw']->common->phpgw_header();
+
+                       echo parse_navbar();
+
+                       $err    = urldecode(get_var('err',array('POST','GET')));
+
+                       $poll_id        = 
get_var('poll_id',array('POST','GET'));
+
+                       if ($err)
+                       {
+                           $content = "<p><font color=red>$err</font><p>";
+                       }
+
+                       $sql = "SELECT * FROM phpgw_sms_featpoll WHERE 
poll_id='$poll_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+
+                       $poll_title = $this->db->f('poll_title');
+                       $poll_code = $this->db->f('poll_code');
+
+
+                       $edit_data = array(
+                               'menuaction'    => 
$this->currentapp.'.uipolls.edit_yes',
+                               'poll_id' => $poll_id,
+                               'poll_code' => $poll_code,
+                               );
+                               
+                       $edit_url = 
$GLOBALS['phpgw']->link('/index.php',$edit_data);
+
+                       $content .= "
+                           <p>
+                           <form action=$edit_url method=post>
+                           <p>SMS poll code: <b>$poll_code</b>
+                           <p>SMS poll title: <input type=text size=60 
maxlength=200 name=poll_title value=\"$poll_title\">
+                           <p><input type=submit class=button value=\"Save 
Poll\">
+                           </form>
+                           <br>
+                       ";
+                       echo $content;
+                       $content = "
+                           <h2>Edit SMS poll choices</h2>
+                           <p>
+                       ";
+                       $sql = "SELECT choice_id,choice_title,choice_code FROM 
phpgw_sms_featpoll_choice WHERE poll_id='$poll_id' ORDER BY choice_code";
+                       $this->db->query($sql,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                           $choice_id = $this->db->f('choice_id');
+                           $choice_code = $this->db->f('choice_code');
+                           $choice_title = $this->db->f('choice_title');
+                           $content .= "[<a href=" . 
$GLOBALS['phpgw']->link("/index.php','menuaction=sms.uipolls.choice_delete&poll_id=$poll_id&choice_id=$choice_id")
 . ">x</a>] ";
+                           $content .= "<b>Code:</b> $choice_code 
&nbsp;&nbsp;<b>Title:</b> $choice_title<br>";
+                       }
+
+                       $add_data = array('menuaction'  => 
$this->currentapp.'.uipolls.choice_add',
+                                       'poll_id' => $poll_id,
+                                       );
+                       $add_url = 
$GLOBALS['phpgw']->link('/index.php',$add_data);
+
+
+                       $content .= "
+                       <p><b>Add choice to this poll</b>
+                       <form action=\"$add_url\" method=post>
+                       <p>Choice Code: <input type=text size=3 maxlength=10 
name=choice_code>
+                       <p>Choice Title: <input type=text size=60 maxlength=250 
name=choice_title>
+                       <p><input type=submit class=button value=\"Add Choice\">
+                       </form>
+                       <br>";
+                       
+                       echo $content;
+                       $sql = "SELECT poll_enable FROM phpgw_sms_featpoll 
WHERE poll_id='$poll_id'";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+       
+                       $poll_status = "<font color=red><b>Disable</b></font>";
+                       if ($this->db->f('poll_enable'))
+                       {
+                           $poll_status = "<font 
color=green><b>Enable</b></font>";
+                       }
+
+                       $enable_data = array('menuaction'       => 
$this->currentapp.'.uipolls.status',
+                                       'poll_id' => $poll_id,
+                                       'ps' => 1,
+                                       );
+                       $enable_url = 
$GLOBALS['phpgw']->link('/index.php',$enable_data);
+
+                       $disable_data = array('menuaction'      => 
$this->currentapp.'.uipolls.status',
+                                       'poll_id' => $poll_id,
+                                       'ps' => 0,
+                                       );
+                       $disable_url = 
$GLOBALS['phpgw']->link('/index.php',$disable_data);
+
+                       $content = "
+                           <h2>Enable or disable this poll</h2>
+                           <p>
+                           <p>Current status: $poll_status
+                           <p>What do you want to do ?
+                           <p>- <a href=\"$enable_url\">I want to 
<b>enable</b> this poll</a>
+                           <p>- <a href=\"$disable_url\">I want to 
<b>disable</b> this poll</a>
+                           <br>
+                       ";
+
+                       $done_data = array('menuaction' => 
$this->currentapp.'.uipolls.index');
+                       $done_url = 
$GLOBALS['phpgw']->link('/index.php',$done_data);
+
+                       $content .= "
+                           <p>
+                           <a href=\"$done_url\">[ Done ]</a>
+                           <p>
+                       ";
+                       echo $content;
+               }
+
+
                function view()
                {
                        if(!$this->acl->check('run', PHPGW_ACL_READ,'admin'))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]