1
neda_barna
working with combo box and switch
  • 2007/10/6 5:17

  • neda_barna

  • Just popping in

  • Posts: 63

  • Since: 2007/9/5 4


hi all
i have this code
that have one combobox and switch and case
but when i chose a combobox this working and case main working
but case update dont work please view my code and tell me why the case update dont work
$combo '
           
          
           _________ 
           '
._REF_LIST_ALLA.'
           '
._REF_LIST_KOL.'
           '
._REF_LIST_REF.'
             '
;
 
$combo .=' ._REF_BUTTON_GO.'" />
          
          '
;

echo 
$combo;

elseif ($_POST['referee']=='C')
{







switch ( 
$case ) {

case 
'main':
    
echo 
$w;
/////////////kodom ghesmat ra dashte bashim masalan ghesmate reeferee
     
$query ="status='REFEREE'";

    if ( 
is_http_var'search' ) ) {

        
$tid is_http_var'tid' ) ? get_http_var'tid' ) : NULL;

        
$sid is_http_var'sid' ) ? get_http_var'sid' ) : NULL;

        
$key is_http_var'key' ) ? get_http_var'key' ) : NULL;

        

        

        }

        

    

    

    
$caption = !empty( $caption ) ? $caption _REF_LIST_REF;

    

    
$where_r trim$query ) ? preg_split "/[,]+/"trim$query ) ) : NULL// query string must be comma seperated 

    //echo '
'; print_r( $where_r ); echo '
'; // !!!!!!!!!! DEBUG !!!!!!!!!!!!!

    

    
$order is_http_var'order' ) ? get_http_var'order' ) : "date";

    
$order_pre is_http_var'order_pre' ) ? get_http_var'order_pre' ) : "";

    
$dir = ( $isDir OR $isSec ) ? 'DESC' 'ASC';

    
$order makeOrder $order$order_pre$dir );

    
$order is_http_var'order_force' ) ? get_http_var'order_force' ) : $order;

    
$start is_http_var'start' ) ? get_http_var'start' ) : 0;

    
$start = ( $start ) ? $start;

    
$limit $xoopsModuleConfig'list_rows' ];



    
$op $op $op 'AND';

    

if ( 
is_array$categoryArr ) and count $categoryArr ) ) {

        foreach ( 
$categoryArr as $cat )

            
$categoryCriteriaArr[] = "category = '$cat'";

        
$categoryCriteria ' ( '.implode(' OR ',$categoryCriteriaArr).' ) ';



        if ( 
count$where_r ) )

            
$whereStr ' ( '.implode' '.$op.' '$where_r ).' ) ';

            
$where_r = array( $whereStr$categoryCriteria );

            
$op 'AND';

            

        unset( 
$whereStr );

        unset( 
$categoryCriteriaArr );

        unset( 
$categoryCriteria );

}



    
$papers RefereePaper::getAll$where_rTRUE$order$limit$start$op );

    
$total RefereePaper::getAll$where_r'COUNT'$order00$op );

        
$next_start $start $limit;

        
$back_start $start $limit;

    
$pages ceil$total $limit );

    
$page ceil( ( $start ) / $limit );

    

    
$categoriesArr JournalUser::getCategories();

    

    

        

    
$caption '

            

        
'.$caption.' '._REF_STAT_COUNT.' '.$total.'
'
;

    

    

    

    
$arrows NULL;

    if ( 
$total $limit ) {

        
$arrows.= '';

                if ( 
$start ) {

                                    
$arrows .= '

        .$case.'" />
                .$w.'" />

        .$query.'" />

        .$order.'" />

        .$back_start.'" />

        .$op.'" />

        .htmlspecialchars  $category ).'" />

        

        .$filter_var.'" />

        .$filter_op.'" />

        .$filter_value.'" />

        .REFER_URL.'/images/back_on.png">

        '
;

                       

                } else {

                        
$arrows.= '.REFER_URL.'/images/back_off.png">';

                }

                
$arrows.= '
'

            ._REF_STAT_PAGE.' '.$page.' '._REF_STAT_OF.' '.$pages

            
.' ';

        for( 
$myCounter max(1$page 5); $myCounter <= min($pages$page 5); $myCounter++ )

        {

            
$arrows .= '
';

        }

        
$arrows .= '
';

            if( 
$page == $myCounter )

                
$arrows .= '';

            else

                
$arrows .= '

                .$case.'" />
 .$w.'" />

                .$query.'" />

                .$order.'" />

                .(($myCounter 1)*$limit).'" />

                .$op.'" />

                .htmlspecialchars  $category ).'" />

                

                .$filter_var.'" />

                .$filter_op.'" />

                .$filter_value.'" />

                .$myCounter.'" />

                '
;

            
$arrows .= '
'
;

                if ( 
$total $next_start ) {

                                
$arrows .= '

            .$case.'" />
.$w.'" />

                   .$query.'" />

               .$order.'" />

               .$next_start.'" />

               .$op.'" />

               .htmlspecialchars  $category ).'" />

            

               .$filter_var.'" />

            .$filter_op.'" />

            .$filter_value.'" />

            .REFER_URL.'/images/next_on.png">

                                                '
;

                                                     

                } else {

                        
$arrows.= '.REFER_URL.'/images/next_off.png">';

                }

                
$arrows.= '';

    }

        

    
$list '

    

    .$case.'&order=sid&order_pre='.$order.'&start='.$start.'

        &query_pre='
.$query.'&op='.$op.'">'._REF_ID.'

    .$case.'&order=title&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$query.'&op='.$op.'">'._REF_TITLE.'

    .$case.'&order=author&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$query.'&op='.$op.'">'._REF_AUTHORS.'

    .$case.'&order=date&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$query.'&op='.$op.'">'._REF_DATE.'

    .$case.'&order=status&order_pre='.$order.'&start='.$start.'

            &query_pre='
.$query.'&op='.$op.'">'._REF_STATUS.'

        '
._REF_RECORD_STAT.'

                    '

                    
.'._REF_RECORD_STAT_INREV.' |

                       '
._REF_RECORD_STAT_ACCPT.' |

                   '
._REF_RECORD_STAT_REJ.' |

                  '    
._REF_RECORD_STAT_EXPD.' |

                 '
._REF_RECORD_STAT_TOT.

                

    

    
';

    

    
$class 'even';

    

    foreach ( 
$papers as $paper ){

        

        
$sid $paper->getVar'sid' );

        
$title substr_words $myts->makeTboxData4Show$paper->getVar'title' ) ), );

            
$authors substr_words $paper->getAuthors() );

            
$date formatTimestamp $paper->getVar'date' ), 's' );

            
$status strtoupper$paper->getVar'status' ) );



        
$class = ($class == 'odd') ? 'even' 'odd';

        

        
$STATUS constant'_REF_STATUS_'.strtoupper$status ) );

        

        

        

    

        

        
$list.= '

        .$sid.'"

        .$class.'">'.$sid.'

        .$class.'">'.$title.'

        .$class.'">'.$authors.'

        .$class.'" nowrap>'.$date.'

        .$class.'" nowrap>'.$STATUS.'';

        

        
$criteria_r = array();

        
$criteria_r[] = 'sid = '.$sid;

        
$records RefereeRecord::getAll($criteria_rTRUE);

        
$expired 0;

        
$accepted 0;

        
$rejected 0;

        
$inreview 0;

        
$countAll count$records );

        

        
$list .= '.$class.'" nowrap > 

            '
.$inreview.'  |  

            '
.$accepted.'  |  

            '
.$rejected.'  |  

            '
.$expired.'  |  

            '
.$countAll.' ';


            

        
$list .= '
';


                    

    }
     

    
$list.= '
                .$order.'">

        .$case.'">

        
.$w.'" />
                
 


        

        '._REF_EXP.':

        


        
._REF_SAVE.'"class="update">
'
;

    

    
/*  Generating Output :) */

    

    

    
echo '';

        echo 
$caption;

    echo 
'';

    echo 
$arrows;

    echo 
'';

    echo 
$list;

    echo 
'';

    echo 
$arrows;     


break;

case 
'update':

    

    

    
$check = array ( );

    
$count 0;

        
$case_pre is_http_var'case_pre' ) ? get_http_var'case_pre' ) : 'main';

        
$check     is_http_var'check' ) ? get_http_var'check' ) : array ( );

    

    foreach ( 
$_POST['check'] as $chk1 ) {

echo 
"hello";

$word1=$_POST['key2'];
$word2=$word 86400;
$query2="UPDATE ".$xoopsDB->prefix referee )." SET exp_date = exp_date + '$word2' WHERE sid='.$chk1.'  ";
$xoopsDB->query($query2);
$count++;

    }

        

    if ( 
$count ) {

        
redirect_header REFER_URL."/extended_expire.php?case=".$case_pre2$count." "._REF_SAVE1 );

    } else {

        
redirect_header REFER_URL."/extended_expire.php?case=".$case_pre2_REF_SAVE_NOPAPER );

    }



    break;



}

}

2
Catzwolf
Re: working with combo box and switch
  • 2007/10/6 13:32

  • Catzwolf

  • Home away from home

  • Posts: 1392

  • Since: 2007/9/30


Hiya,

I have looked over your code and I can see one small issue that could be the source of your problem.

You have an if statement that uses your post var (referee) and in side that if statement you have two 'cases' but I do not see where you have defined the '$case' switch for them. So the scipt just runs right by the two case statements (ignoring them).

You need to tell the script which case statement to use. either 'main' or 'main' using the $case var (Seems that is empty by your script)

Catz

Login

Who's Online

354 user(s) are online (78 user(s) are browsing Support Forums)


Members: 0


Guests: 354


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits