Plugin Directory

Changeset 945283


Ignore:
Timestamp:
07/08/2014 11:42:39 PM (12 years ago)
Author:
pondol
Message:

Version: 1.1.4

Location:
pondol-bbs/trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • pondol-bbs/trunk/includes/class.pondol.bbs.admin.php

    r944228 r945283  
    105105    }
    106106   
    107    
     107    function print_widget_option($instance){
     108        $categoris  = $this->ctrl->func->get_bbs_categoris();
     109        $tmplList   = $this->ctrl->func->read_dir(PONDOL_BBS_PATH."/templates_widget/");
     110       
     111        $str = '* first check categoris where you want to take items and put a number as listing numbers </br>';
     112        $str .= 'title : <input class="widefat" id="'.$this->ctrl->super->get_field_id('title').'" name="'.$this->ctrl->super->get_field_name('title').'" value="'.$instance['title'].'"/></br>';
     113        $str .= 'category :  </br>';
     114        if(is_array($categoris)) foreach($categoris as $key => $val){
     115            $checked = in_array($val->term_id, $instance['category']) ? " checked":"";
     116            $str .= '<input type="checkbox" name="'.$this->ctrl->super->get_field_name('category][').'" value="'.$val->term_id.'"'.$checked.'>'.$val->name.' </br> ';
     117        }
     118        $str .= '</br>';
     119        $str .= 'list count : </br><input style="width:30px" id="'.$this->ctrl->super->get_field_id('listCnt').'" name="'.$this->ctrl->super->get_field_name('listCnt').'" value="'.$instance['listCnt'].'"/></br>';
     120        $str .='skin : </br>';
     121        $str .='<select name="'.$this->ctrl->super->get_field_name('templates_widget').'">';
     122
     123        foreach($tmplList as $key =>$val){
     124            $selected = $instance['templates_widget']   == $val["name"] ? " selected":"";
     125            $str .= '<option value="'.$val["name"].'"'.$selected.'>'.$val["name"].'</option>';
     126        }
     127        $str .="</select>";
     128        echo $str;
     129    }
    108130}
  • pondol-bbs/trunk/includes/class.pondol.bbs.controller.php

    r943236 r945283  
    99    public $view, $model, $tmpl;
    1010
    11     function __construct() {
     11    function __construct($super=null) {
     12        $this->super    = $super;
    1213        $this->bbs      = new Pondol_BBS($this);   
    1314        $this->model    = new Pondol_BBS_Model($this); 
  • pondol-bbs/trunk/includes/class.pondol.bbs.templates.php

    r943236 r945283  
    219219        get_footer( );
    220220    }
     221   
     222    public function templates_widget_view($instance){
     223        global $wpdb;
     224        $rows = $wpdb->get_results("
     225                                select
     226                                    p.*, t.term_taxonomy_id, b.USER_NAME, b.COUNT
     227                                from
     228                                    ".$this->ctrl->model->get_table_name("board")." b
     229                                left join
     230                                    ".$wpdb->prefix . "posts p
     231                                on
     232                                    b.POST_ID = p.ID
     233                                left join
     234                                    ".$wpdb->prefix . "term_relationships t
     235                                on
     236                                    b.POST_ID = t.object_id
     237                                where
     238                                    t.term_taxonomy_id in ('".implode("','",  $instance[category])."')
     239                                order by
     240                                    FID desc, THREAD asc
     241                                limit
     242                                    0, ".$instance["listCnt"]
     243                                   
     244                                );
     245        //print_r($rows);
     246        @include_once PONDOL_BBS_PATH.'templates_widget/'.$instance["templates_widget"].'/widget_module.php';
     247    }
    221248}
    222249
  • pondol-bbs/trunk/includes/func.bbs.php

    r943236 r945283  
    2929
    3030
    31     function get_bbs_categoris($arg){
    32        
    33        
     31    function get_bbs_categoris($arg=null){
    3432        $args = array(
    3533            'type'                     => 'post',
     
    4341            'include'                  => '',
    4442            'number'                   => '',
    45             'taxonomy'                 => 'board',
     43            'taxonomy'                 => PONDOL_BBS_TAXO,
    4644            'pad_counts'               => false
    4745        );
    4846       
    49         $args = array_replace($args, $arg);
    50        
     47        if($arg) $args = array_replace($args, $arg);
    5148        $categories = get_categories( $args );
     49        //print_r($categories);
    5250        return $categories;
    5351    }
    5452
    5553    function get_bbs_category(){
    56        
    57        
    5854        $categoris = $this->get_bbs_categoris();
    5955        if(is_array($categoris)) foreach($categoris as $key => $val){
  • pondol-bbs/trunk/pondolbbs.php

    r944228 r945283  
    55Description: General BBS Program
    66Author: Pondol
    7 Version: 1.1.3
     7Version: 1.1.4
    88Author URI: http://www.shop-wiz.com/wp/plugins/pondol_bbs
    99License: GPL2
     
    2121define('PONDOL_URL', 'http://www.shop-wiz.com');
    2222define('PONDOL_EMAIL', '[email protected]');
    23 define('PONDOL_BBS_VERSION', '1.1');
     23define('PONDOL_BBS_VERSION', '1.1.4');
    2424define('PONDOL_BBS', 'bbs');
    2525define('PONDOL_BBS_TAXO', 'board');
     
    8383 */
    8484$bbs    = new PondolBBS_Plugin();
     85
     86/**
     87 * PONDOL BBS Widget Start
     88 */
     89class PondolBBS_Widget extends WP_Widget {
     90
     91    function __construct() {
     92        parent::__construct( false, 'pondol bbs widget' );
     93        $this->init();
     94    }
     95   
     96    public function init() {
     97        //$this->ctrl = new PondolWidget_Visitor_Controller($this);
     98        $this->ctrl = new Pondol_BBS_Controller($this);
     99        if ( is_admin() )
     100        {
     101            //$this->ctrl->admin->admin_init();
     102            //add_action( 'wp_ajax_pondol_visitor_saveoption', array($this->ctrl->model, 'save_option'));
     103        }else{
     104           
     105        }
     106    }
     107
     108    function widget( $args, $instance ) {//display to frontend
     109        $this->ctrl->tmpl->templates_widget_view($instance);
     110    }
     111
     112    function update( $new_instance, $old_instance ) {//save widget option
     113        $instance = array();
     114        $instance['title']              = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
     115        $instance['listCnt']            = ( ! empty( $new_instance['listCnt'] ) ) ? strip_tags( $new_instance['listCnt'] ) : '';
     116        $instance["category"]           = $new_instance['category'];
     117        $instance['templates_widget']   = $new_instance['templates_widget'];
     118       
     119       
     120       
     121        //echo "saved..";
     122        return $instance;
     123    }
     124
     125    function form( $instance ) {//back-end widget form this will be shown where admin > widgeht > option
     126        $this->ctrl->admin->print_widget_option($instance);
     127    }
     128}
     129
     130
     131function pondolbbs_register_widgets() {
     132    register_widget( 'PondolBBS_Widget' );
     133}
     134
     135add_action( 'widgets_init', 'pondolbbs_register_widgets' );
  • pondol-bbs/trunk/readme.txt

    r944231 r945283  
    3535
    3636== Changelog ==
     37= 1.1.4 =
     38add widget
     39
     40= 1.1.3 =
     41modify gallery form
     42
    3743= 1.1.2 =
    3844fix bug : when create or edit posts in back-end, did not inserted in bbs database
Note: See TracChangeset for help on using the changeset viewer.