<?php

/**
 * @copyright 0arkcode
 * @author 0arkcode@gmail.com
 * @license 0arkcode
 */


    class series{
        
        public $count = 0;
        public $error = false;
        public $error_step = array();
        public $items = false;
        
        public function __construct( $series ){
            
            $this->items = $series;
            
            if( count( $this->items ) ){
                
                $this->count = count( $this->items );
                
            } else {
                
                $this->error = ( l('Select items. <a href="javascript:;" onclick="window.history.back(-1)" style="color:white">'.( l('Back') ).'</a>') );
                
            }
            
        }
        
        /**
         * Series result display
         * @param mixed $template - Specify tpl file location, Default (false) use ADMIN_DIR/series.tpl
         */
        public function result_display( $template = false ){
            global $tpl;
            
            page::$instance->val( $tpl->fetch( admin::$i->dir .  ( $template ? $template : 'series.tpl' ) ) );
        }
        
        /**
         * Step Errors
         * @param string $error - Error text
         */
        public function add_error( $error ){
            array_push( $this->error_step , $error );
        }
        
        /**
         * Get Errors
         * @param string $step_glue - Example: <br />
         * @param string $step_handler_tag - Example: div OR li OR span etc.
         * Note: Only one params can be used
         */
        public function check_errors( $step_glue = '<br />' , $step_handler_tag = false ){
            
            if( count( $this->error_step ) ){
                
                if( !$step_handler_tag ) $this->error = join( $step_glue ,$this->error_step );
                else {
                    
                    $this->error = '';
                    
                    foreach( $this->error_step as $single_error ){
                        $this->error .= '<'.$step_handler_tag.'>' . $single_error . '</'.$step_handler_tag.'>';
                    }

                    
                }
                
            }
            
        }
        
        public static function actions( $module = 'default' ){
            
            switch( $module ){
                
                case 'user':

                    $actions = array(
                        'ban' => l('BAN'),
                        'activate' => l('Activate'),
                        'delete' => l('Delete')
                    );
                    
                break;
                
                case 'adpack':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;

                case 'ads_exchange':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;
                                
                case 'ads_cashlink':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;

                case 'ads_banner':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;

                case 'ads_login':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;

                case 'ads_start':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;
                
                case 'ads_text':
                    
                    $actions = array(
                        'activate' => l('Activate'),
                        'reject' => l('Reject'),
                        'delete' => l('Delete')
                    );
                    
                break;
                
                case 'monitor':
                
                    $actions = array(
                        'delete' => l('Delete'),
                        'user_ban' => l('Ban user and delete logs'),
                        'user_ban_only' => l('Only ban user')
                    );
                    
                break;
                      
                case 'settings':
                    
                    switch( core::$i->function ){
                        
                        case 'docsver_type':
                        
                            $actions = array(
                                'delete_docsver_type' => l('Delete')
                            );
                            
                        break;
                        
                    }
                    
                break;
                
                case 'adpack_package':
                
                    $actions = array();
                
                break;
                                
                default:
                    
                    $actions = array(
                        'delete' => l('Delete')
                    );
                    
                break;
                
            }
            
            return $actions;
            
        }
        
        public static function available()
        {
            return false;
        }
        
    }
    


?>