Example #1
0
 public function __construct()
 {
     action::add('columns', array($this, 'columns'), 1);
     action::add('list', array($this, 'load'), 1, 1);
     action::add('footer', array($this, 'script'), 1, 1);
     filter::add('refresh', array($this, 'refresh'), 1, 2);
     action::add('delete', array($this, 'delete'), 1, 1);
 }
Example #2
0
    }
    ?>
                            <?php 
    if ($v['star'] * 10 % 10 >= 5) {
        ?>
                            <span class="glyphicon glyphicon-star-empty"></span>
                            <?php 
    }
    ?>
                        </label>
                        <?php 
}
?>
                    </td>
                    <?php 
\pt\tool\action::exec('list', $v);
?>
                    <td>
                        <button class="btn-refresh btn btn-default" title="Refresh"><span class="glyphicon glyphicon-refresh"></span></button>
                        <?php 
if ($v['disable']) {
    ?>
                        <button class="btn-status btn btn-default" title="Enable"><span class="glyphicon glyphicon-eye-open"></span></button>
                        <?php 
} else {
    ?>
                        <button class="btn-status btn btn-default" title="Disable"><span class="glyphicon glyphicon-eye-close"></span></button>
                        <?php 
}
?>
                        <button class="btn-delete btn btn-danger" title="Delete"><span class="glyphicon glyphicon-trash"></span></button>
 public function __construct()
 {
     action::add('columns', array($this, 'columns'), 2);
     action::add('list', array($this, 'load'), 1, 2);
     filter::add('refresh', array($this, 'refresh'), 2, 2);
 }
Example #4
0
         json_return(null, 9, 'Operation failed.');
     }
     break;
     // Delete
 // Delete
 case 'delete':
     if ($_POST) {
         $id = (int) $_POST['id'];
         $db = db::init();
         $db->beginTrans();
         $rs = $db->prepare("DELETE FROM `a_good` WHERE `id`=:id")->execute(array(':id' => $id));
         if (false === $rs) {
             $db->rollback();
             json_return(null, 1, 'Operation failed.');
         }
         action::exec('delete', $id);
         if ($db->commit()) {
             json_return(1);
         }
         json_return(null, 9, 'Operation failed.');
     }
     break;
     // List page
 // List page
 case 'default':
 default:
     $keyword = '';
     template::assign('keyword', $keyword);
     $db = db::init();
     $sql = "SELECT * FROM `a_good` WHERE `user`=:uid ORDER BY `id` DESC";
     $list = $db->prepare($sql)->execute(array(':uid' => $uid));
Example #5
0
                            }
                        },
                        error : function(){
                            tr.addClass("danger");
                        },
                        dataType : "json",
                        timeout : <?php 
echo config('web.refresh_timeout') * 1000;
?>
                    });
                },
                first = btnlist.prop("disabled", true).eq(0);
            refresh(first);
        });
    }(".refresh-all", "#list tr:not(.disable) .btn-refresh");


    !function(btn, li){
        $(btn).click(function(){
            $(li).toggle();
        });
    }(".toggle-disabled", "tr.disable");
});
</script>

    <?php 
\pt\tool\action::exec('footer');
?>

</body>
</html>