浏览代码

后台结婚

linwu 2 年之前
父节点
当前提交
c5367e2258

+ 23 - 0
app/love/controller/LotteryController.php

@@ -0,0 +1,23 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\controller;
+
+use cmf\controller\HomeBaseController;
+
+class LotteryController extends HomeBaseController
+{
+
+    public function index()
+    {
+        return $this->fetch();
+    }
+
+}

+ 14 - 0
app/love/controller/LoveBaseController.php

@@ -12,6 +12,7 @@ namespace app\love\controller;
 
 use app\common\Wechat;
 use app\love\model\ActiveApplyModel;
+use app\love\model\UserLotteryModel;
 use app\love\model\UserMatingModel;
 use app\love\model\UserModel;
 use cmf\controller\HomeBaseController;
@@ -45,6 +46,19 @@ class LoveBaseController extends HomeBaseController
             Session::destroy();
             $this->redirect(cmf_url("love/Login/index"));
         }
+        //已婚
+        if ($this->user['is_marry'] == 1) {
+            if ($this->user['sex'] == 2) {
+                $lottery = UserLotteryModel::where('user_id1|user_id2',$userId)->find();
+                if (empty($lottery)) {
+                    $this->redirect(cmf_url('love/lottery/index'));
+                }
+                if ($lottery['status'] == 2) {
+                    $this->redirect(cmf_url('love/lottery/log'));
+                }
+            }
+            $this->redirect(cmf_url('love/register/marry'));
+        }
         //拉黑
         if ($this->user['user_status'] == 0) {
             $this->redirect(cmf_url('love/register/ban'));

+ 35 - 6
app/love/controller/MyController.php

@@ -11,10 +11,12 @@
 namespace app\love\controller;
 
 use app\common\Constant;
+use app\common\Fun;
 use app\love\model\UserFavoriteModel;
 use app\love\model\UserFriendModel;
 use app\love\model\UserGiftModel;
 use app\love\model\UserInviteModel;
+use app\love\model\UserMarryModel;
 use app\love\model\UserMatingModel;
 use app\love\model\UserMessageModel;
 use app\love\model\UserModel;
@@ -166,7 +168,7 @@ class MyController extends LoveBaseController
             'native'     => Constant::NATIVE,
             'education'  => $education,
             'income'     => Constant::COND_INCOME,
-            'id_type'    => array_merge(Constant::ID_TYPE,['不限']),
+            'id_type'    => array_merge(Constant::ID_TYPE, ['不限']),
             'smoke'      => Constant::SMOKE,
             'drink'      => Constant::DRINK,
             'tinyint'    => Constant::COND_TINYINT,
@@ -371,7 +373,7 @@ class MyController extends LoveBaseController
                 $uid = $select['user_id'];
             }
             $user        = UserModel::get($uid);
-            $user['age'] = empty($user['birthday']) ? 0 : date('Y') - date('Y', $user['birthday']);
+            $user['age'] = Fun::getAgeByBirth($user['birthday']);
             $this->assign('user', $user);
             $this->assign('list1', '[]');
             $this->assign('list2', '[]');
@@ -452,11 +454,11 @@ class MyController extends LoveBaseController
         $user_id = cmf_get_current_user_id();
         $user    = UserSelectModel::get(['user_id' => $user_id, 'uid' => $id]);
         //20230423增加两个userid对调的查询,因为双方都有权利取消
-        if(empty($user)){
-            $user    = UserSelectModel::get(['user_id' => $id, 'uid' => $user_id]);
+        if (empty($user)) {
+            $user = UserSelectModel::get(['user_id' => $id, 'uid' => $user_id]);
         }
         if (!empty($user)) {
-            UserSelectLogModel::where('user_id1|user_id2', $id)->where('update_time',0)->order('id','desc')->update(['update_time'=>time()]);
+            UserSelectLogModel::where('user_id1|user_id2', $id)->where('update_time', 0)->order('id', 'desc')->delete();
             $user->delete();
         }
 
@@ -471,7 +473,7 @@ class MyController extends LoveBaseController
         $id      = $this->request->post('id');
         $user_id = cmf_get_current_user_id();
         $user    = UserSelectModel::get(['user_id' => $id, 'uid' => $user_id]);
-        $check   = UserSelectLogModel::where('user_id1|user_id2', $id)->where('update_time',0)->find();
+        $check   = UserSelectLogModel::where('user_id1|user_id2', $id)->find();
         if (!empty($check)) {
             $this->error('对方已被选择!');
         }
@@ -546,6 +548,33 @@ class MyController extends LoveBaseController
         $this->success('操作成功');
     }
 
+    /**
+     * 结婚
+     */
+    public function marry()
+    {
+        $id      = $this->request->post('id');
+        $user_id = cmf_get_current_user_id();
+        $marry   = UserMarryModel::where(function ($query) use ($user_id, $id) {
+            $query->where([
+                ['user_id1', '=', $user_id],
+                ['user_id2', '=', $id],
+            ]);
+        })->whereOr(function ($query) use ($user_id, $id) {
+            $query->where([
+                ['user_id2', '=', $user_id],
+                ['user_id1', '=', $id],
+            ]);
+        })->find();
+        //20230423增加两个userid对调的查询,因为双方都有权利取消
+        if (empty($marry)) {
+            UserMarryModel::create(['user_id1' => $user_id, 'user_id2' => $id, 'create_time' => time()]);
+            UserModel::where('id','in',[$id,$user_id])->update(['is_marry'=>1]);
+        }
+
+        $this->success('操作成功');
+    }
+
     /**
      * 收到的礼物
      */

+ 1 - 1
app/love/controller/UserwallController.php

@@ -126,7 +126,7 @@ class UserwallController extends LoveBaseController
         //信息处理
         $user->star++;
         $user->save();
-        $user['age'] = empty($user['birthday']) ? 0 : date('Y') - date('Y', $user['birthday']);
+        $user['age'] = Fun::getAgeByBirth($user['birthday']);
         $user['have_house'] = Constant::COND_TINYINT[$user['have_house']];
         $user['have_car'] = Constant::COND_TINYINT[$user['have_car']];
         $user['with_parent_live'] = Constant::COND_TINYINT[$user['with_parent_live']];

+ 18 - 0
app/love/model/LotteryModel.php

@@ -0,0 +1,18 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\model;
+
+use think\Model;
+
+class LotteryModel extends Model
+{
+
+}

+ 27 - 0
app/love/model/UserLotteryModel.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\model;
+
+use think\Model;
+
+class UserLotteryModel extends Model
+{
+
+    public function user()
+    {
+        return $this->hasOne(UserModel::class,'id','user_id');
+    }
+
+    public function lottery()
+    {
+        return $this->hasOne(LotteryModel::class,'id','lottery_id');
+    }
+}

+ 27 - 0
app/love/model/UserMarryModel.php

@@ -0,0 +1,27 @@
+<?php
+// +----------------------------------------------------------------------
+// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
+// +----------------------------------------------------------------------
+// | Copyright (c) 2013-2019 http://www.thinkcmf.com All rights reserved.
+// +----------------------------------------------------------------------
+// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
+// +----------------------------------------------------------------------
+// | Author: 老猫 <thinkcmf@126.com>
+// +----------------------------------------------------------------------
+namespace app\love\model;
+
+use think\Model;
+
+class UserMarryModel extends Model
+{
+
+    public function user1()
+    {
+        return $this->hasOne(UserModel::class,'id','user_id1');
+    }
+
+    public function user2()
+    {
+        return $this->hasOne(UserModel::class,'id','user_id2');
+    }
+}

+ 2 - 1
app/test/controller/IndexController.php

@@ -2,6 +2,7 @@
 
 namespace app\test\controller;
 
+use app\common\Fun;
 use QL\QueryList;
 use think\Db;
 use cmf\controller\HomeBaseController;
@@ -33,7 +34,7 @@ class IndexController extends HomeBaseController
             $v['post_name']     = $posts[$v['post_id']]['name'];
             $v['recruits_name'] = $recruits[$v['rid']];
             $v['family']        = empty($families[$v['id']]) ? '' : $families[$v['id']];
-            $v['birthday']      = empty($v['birthday']) ? '' : date('Y-m-d', $v['birthday']);
+            $v['birthday']      = Fun::getAgeByBirth($v['birthday']);
             $v['status_text']   = $v['status'] == 1 ? '审核中或报名成功' : '暂存或审核失败';
             $v['word_url']      = empty($v['word_url']) ? '' : 'http://www.jucai.gov.cn' . $v['word_url'];
             $v['front_card']    = $this->_dealImage($v['front_card']);

+ 1 - 0
app/user/controller/AdminIndexController.php

@@ -81,6 +81,7 @@ class AdminIndexController extends AdminBaseController
             ->where(function (Query $query) {
                 $data = $this->request->param();
                 $query->where('user_type', 2);
+                $query->where('is_complete', 1);
                 if (!empty($data['uid'])) {
                     $query->where('id', intval($data['uid']));
                 }

+ 6 - 8
public/themes/admin_simpleboot3/user/admin_index/index.html

@@ -18,12 +18,12 @@
             <option value="1" <eq name="sex" value="1">selected</eq>>男</option>
             <option value="2" <eq name="sex" value="2">selected</eq>>女</option>
         </select>
-        是否完善:
-        <select class="form-control" name="is_complete">
-            <option value="0" <eq name="is_complete" value="0">selected</eq>>全部</option>
-            <option value="1" <eq name="is_complete" value="1">selected</eq>>是</option>
-            <option value="2" <eq name="is_complete" value="2">selected</eq>>否</option>
-        </select>
+        <!--是否完善:-->
+        <!--<select class="form-control" name="is_complete">-->
+            <!--<option value="0" <eq name="is_complete" value="0">selected</eq>>全部</option>-->
+            <!--<option value="1" <eq name="is_complete" value="1">selected</eq>>是</option>-->
+            <!--<option value="2" <eq name="is_complete" value="2">selected</eq>>否</option>-->
+        <!--</select>-->
         审核状态:
         <select class="form-control" name="check_status">
             <option value="0" <eq name="check_status" value="0">selected</eq>>全部</option>
@@ -39,7 +39,6 @@
             <thead>
             <tr>
                 <th>ID</th>
-                <th>{:lang('USERNAME')}</th>
                 <th>真实姓名</th>
                 <th>电话号码</th>
                 <th>{:lang('AVATAR')}</th>
@@ -57,7 +56,6 @@
             <foreach name="list" item="vo">
                 <tr>
                     <td>{$vo.id}</td>
-                    <td>{$vo['username']}</td>
                     <td>{$vo['realname']}</td>
                     <td>{$vo['mobile']}</td>
                     <td><img width="25" height="25" src="{:url('user/public/avatar',array('id'=>$vo['id']))}"/></td>

+ 22 - 0
public/themes/simpleboot3/love/my/select.html

@@ -90,6 +90,10 @@
                 <van-button type="danger" size="mini" @click.stop="cancel(user.id)">取消互选</van-button>
             </div>
             <div class="clear"></div>
+            <div class="fr mr20">
+                <van-button type="info" size="mini" @click.stop="marry(user.id)">确认结婚</van-button>
+            </div>
+            <div class="clear"></div>
         </div>
     </div>
 </block>
@@ -185,6 +189,24 @@
                     });
                     return false;
                 },
+                marry() {
+                    this.$dialog.confirm({
+                        title: '确认结婚',
+                        message: '确认结婚可进行抽奖,但是无法继续使用此平台',
+                    }).then(() => {
+                        var that = this;
+                        $.post("{:url('marry')}",{id:id},function (json) {
+                            if(json.code == 1){
+                                location.href = "{:url('love/lottery/index')}";
+                            }else{
+                                that.$toast(json.msg);
+                            }
+                        });
+                    }).catch(() => {
+                        // on cancel
+                    });
+                    return false;
+                },
             },
         });
     </script>

+ 33 - 0
public/themes/simpleboot3/love/register/marry.html

@@ -0,0 +1,33 @@
+<extend name="public@base"/>
+<block name="css">
+    <style>
+    </style>
+</block>
+<block name="body">
+    <van-nav-bar>
+        <template #title>
+            <span>系统通知</span>
+        </template>
+    </van-nav-bar>
+    <h1 style="text-align:center;margin-top:20px;" class="text-pink">您已结婚,无法再进入本平台</h1>
+</block>
+<block name="script">
+    <script>
+        new Vue({
+            el: '#app',
+            data() {
+                return {
+
+                };
+            },
+            methods: {
+                onBack() {
+                    history.back();
+                },
+            },
+            computed: {
+
+            }
+        });
+    </script>
+</block>

+ 51 - 0
public/themes/simpleboot3/public/assets/css/lottery.css

@@ -0,0 +1,51 @@
+/* 大转盘样式 */
+.banner {
+    display: block;
+    width: 100%;
+    bottom: 0;
+    padding: 8px 0 20px 0;
+    position:relative;
+}
+
+.banner .turnplate {
+    display: block;
+    width: 90vw;
+    position: relative;
+    margin: 0 auto;
+    padding: 5vw;
+    background-image: url(../images/lottery/bg_turntable_gold.png);
+    background-size: 100% 100%;
+
+}
+
+.banner .turnplate canvas.item {
+    width: 100%;
+}
+
+.banner .turnplate img.pointer {
+    position: absolute;
+    width: 34%;
+    height: 34%;
+    left: 33%;
+    top: 34%;
+}
+
+.tabBox {
+    position: relative
+}
+
+/* tab切换 */
+.bgbox {
+    /* width: 500px; */
+    color: #FFFFFF;
+    margin: 0 auto;
+}
+
+.tabbox .boxlist {
+    margin-top: 10px;
+
+}
+
+.clearfix {
+    clear: both;
+}

二进制
public/themes/simpleboot3/public/assets/images/lottery/bg_turntable_gold.png


+ 302 - 0
public/themes/simpleboot3/public/assets/js/awardRotate.js

@@ -0,0 +1,302 @@
+(function($) {
+    var supportedCSS,styles=document.getElementsByTagName("head")[0].style,toCheck="transformProperty WebkitTransform OTransform msTransform MozTransform".split(" ");
+    for (var a=0;a<toCheck.length;a++) if (styles[toCheck[a]] !== undefined) supportedCSS = toCheck[a];
+// Bad eval to preven google closure to remove it from code o_O
+// After compresion replace it back to var IE = 'v' == '\v'
+    var IE = eval('"v"=="\v"');
+
+    jQuery.fn.extend({
+        rotate:function(parameters)
+        {
+            if (this.length===0||typeof parameters=="undefined") return;
+            if (typeof parameters=="number") parameters={angle:parameters};
+            var returned=[];
+            for (var i=0,i0=this.length;i<i0;i++)
+            {
+                var element=this.get(i);
+                if (!element.Wilq32 || !element.Wilq32.PhotoEffect) {
+
+                    var paramClone = $.extend(true, {}, parameters);
+                    var newRotObject = new Wilq32.PhotoEffect(element,paramClone)._rootObj;
+
+                    returned.push($(newRotObject));
+                }
+                else {
+                    element.Wilq32.PhotoEffect._handleRotation(parameters);
+                }
+            }
+            return returned;
+        },
+        getRotateAngle: function(){
+            var ret = [];
+            for (var i=0,i0=this.length;i<i0;i++)
+            {
+                var element=this.get(i);
+                if (element.Wilq32 && element.Wilq32.PhotoEffect) {
+                    ret[i] = element.Wilq32.PhotoEffect._angle;
+                }
+            }
+            return ret;
+        },
+        stopRotate: function(){
+            for (var i=0,i0=this.length;i<i0;i++)
+            {
+                var element=this.get(i);
+                if (element.Wilq32 && element.Wilq32.PhotoEffect) {
+                    clearTimeout(element.Wilq32.PhotoEffect._timer);
+                }
+            }
+        }
+    });
+
+// Library agnostic interface
+
+    Wilq32=window.Wilq32||{};
+    Wilq32.PhotoEffect=(function(){
+
+        if (supportedCSS) {
+            return function(img,parameters){
+                img.Wilq32 = {
+                    PhotoEffect: this
+                };
+
+                this._img = this._rootObj = this._eventObj = img;
+                this._handleRotation(parameters);
+            }
+        } else {
+            return function(img,parameters) {
+                // Make sure that class and id are also copied - just in case you would like to refeer to an newly created object
+                this._img = img;
+
+                this._rootObj=document.createElement('span');
+                this._rootObj.style.display="inline-block";
+                this._rootObj.Wilq32 =
+                    {
+                        PhotoEffect: this
+                    };
+                img.parentNode.insertBefore(this._rootObj,img);
+
+                if (img.complete) {
+                    this._Loader(parameters);
+                } else {
+                    var self=this;
+                    // TODO: Remove jQuery dependency
+                    jQuery(this._img).bind("load", function()
+                    {
+                        self._Loader(parameters);
+                    });
+                }
+            }
+        }
+    })();
+
+    Wilq32.PhotoEffect.prototype={
+        _setupParameters : function (parameters){
+            this._parameters = this._parameters || {};
+            if (typeof this._angle !== "number") this._angle = 0 ;
+            if (typeof parameters.angle==="number") this._angle = parameters.angle;
+            this._parameters.animateTo = (typeof parameters.animateTo==="number") ? (parameters.animateTo) : (this._angle);
+
+            this._parameters.step = parameters.step || this._parameters.step || null;
+            this._parameters.easing = parameters.easing || this._parameters.easing || function (x, t, b, c, d) { return -c * ((t=t/d-1)*t*t*t - 1) + b; }
+            this._parameters.duration = parameters.duration || this._parameters.duration || 1000;
+            this._parameters.callback = parameters.callback || this._parameters.callback || function(){};
+            if (parameters.bind && parameters.bind != this._parameters.bind) this._BindEvents(parameters.bind);
+        },
+        _handleRotation : function(parameters){
+            this._setupParameters(parameters);
+            if (this._angle==this._parameters.animateTo) {
+                this._rotate(this._angle);
+            }
+            else {
+                this._animateStart();
+            }
+        },
+
+        _BindEvents:function(events){
+            if (events && this._eventObj)
+            {
+                // Unbinding previous Events
+                if (this._parameters.bind){
+                    var oldEvents = this._parameters.bind;
+                    for (var a in oldEvents) if (oldEvents.hasOwnProperty(a))
+                    // TODO: Remove jQuery dependency
+                        jQuery(this._eventObj).unbind(a,oldEvents[a]);
+                }
+
+                this._parameters.bind = events;
+                for (var a in events) if (events.hasOwnProperty(a))
+                // TODO: Remove jQuery dependency
+                    jQuery(this._eventObj).bind(a,events[a]);
+            }
+        },
+
+        _Loader:(function()
+        {
+            if (IE)
+                return function(parameters)
+                {
+                    var width=this._img.width;
+                    var height=this._img.height;
+                    this._img.parentNode.removeChild(this._img);
+
+                    this._vimage = this.createVMLNode('image');
+                    this._vimage.src=this._img.src;
+                    this._vimage.style.height=height+"px";
+                    this._vimage.style.width=width+"px";
+                    this._vimage.style.position="absolute"; // FIXES IE PROBLEM - its only rendered if its on absolute position!
+                    this._vimage.style.top = "0px";
+                    this._vimage.style.left = "0px";
+
+                    /* Group minifying a small 1px precision problem when rotating object */
+                    this._container =  this.createVMLNode('group');
+                    this._container.style.width=width;
+                    this._container.style.height=height;
+                    this._container.style.position="absolute";
+                    this._container.setAttribute('coordsize',width-1+','+(height-1)); // This -1, -1 trying to fix ugly problem with small displacement on IE
+                    this._container.appendChild(this._vimage);
+
+                    this._rootObj.appendChild(this._container);
+                    this._rootObj.style.position="relative"; // FIXES IE PROBLEM
+                    this._rootObj.style.width=width+"px";
+                    this._rootObj.style.height=height+"px";
+                    this._rootObj.setAttribute('id',this._img.getAttribute('id'));
+                    this._rootObj.className=this._img.className;
+                    this._eventObj = this._rootObj;
+                    this._handleRotation(parameters);
+                }
+            else
+                return function (parameters)
+                {
+                    this._rootObj.setAttribute('id',this._img.getAttribute('id'));
+                    this._rootObj.className=this._img.className;
+
+                    this._width=this._img.width;
+                    this._height=this._img.height;
+                    this._widthHalf=this._width/2; // used for optimisation
+                    this._heightHalf=this._height/2;// used for optimisation
+
+                    var _widthMax=Math.sqrt((this._height)*(this._height) + (this._width) * (this._width));
+
+                    this._widthAdd = _widthMax - this._width;
+                    this._heightAdd = _widthMax - this._height;	// widthMax because maxWidth=maxHeight
+                    this._widthAddHalf=this._widthAdd/2; // used for optimisation
+                    this._heightAddHalf=this._heightAdd/2;// used for optimisation
+
+                    this._img.parentNode.removeChild(this._img);
+
+                    this._aspectW = ((parseInt(this._img.style.width,10)) || this._width)/this._img.width;
+                    this._aspectH = ((parseInt(this._img.style.height,10)) || this._height)/this._img.height;
+
+                    this._canvas=document.createElement('canvas');
+                    this._canvas.setAttribute('width',this._width);
+                    this._canvas.style.position="relative";
+                    this._canvas.style.left = -this._widthAddHalf + "px";
+                    this._canvas.style.top = -this._heightAddHalf + "px";
+                    this._canvas.Wilq32 = this._rootObj.Wilq32;
+
+                    this._rootObj.appendChild(this._canvas);
+                    this._rootObj.style.width=this._width+"px";
+                    this._rootObj.style.height=this._height+"px";
+                    this._eventObj = this._canvas;
+
+                    this._cnv=this._canvas.getContext('2d');
+                    this._handleRotation(parameters);
+                }
+        })(),
+
+        _animateStart:function()
+        {
+            if (this._timer) {
+                clearTimeout(this._timer);
+            }
+            this._animateStartTime = +new Date;
+            this._animateStartAngle = this._angle;
+            this._animate();
+        },
+        _animate:function()
+        {
+            var actualTime = +new Date;
+            var checkEnd = actualTime - this._animateStartTime > this._parameters.duration;
+
+            // TODO: Bug for animatedGif for static rotation ? (to test)
+            if (checkEnd && !this._parameters.animatedGif)
+            {
+                clearTimeout(this._timer);
+            }
+            else
+            {
+                if (this._canvas||this._vimage||this._img) {
+                    var angle = this._parameters.easing(0, actualTime - this._animateStartTime, this._animateStartAngle, this._parameters.animateTo - this._animateStartAngle, this._parameters.duration);
+                    this._rotate((~~(angle*10))/10);
+                }
+                if (this._parameters.step) {
+                    this._parameters.step(this._angle);
+                }
+                var self = this;
+                this._timer = setTimeout(function()
+                {
+                    self._animate.call(self);
+                }, 10);
+            }
+
+            // To fix Bug that prevents using recursive function in callback I moved this function to back
+            if (this._parameters.callback && checkEnd){
+                this._angle = this._parameters.animateTo;
+                this._rotate(this._angle);
+                this._parameters.callback.call(this._rootObj);
+            }
+        },
+
+        _rotate : (function()
+        {
+            var rad = Math.PI/180;
+            if (IE)
+                return function(angle)
+                {
+                    this._angle = angle;
+                    this._container.style.rotation=(angle%360)+"deg";
+                }
+            else if (supportedCSS)
+                return function(angle){
+                    this._angle = angle;
+                    this._img.style[supportedCSS]="rotate("+(angle%360)+"deg)";
+                }
+            else
+                return function(angle)
+                {
+                    this._angle = angle;
+                    angle=(angle%360)* rad;
+                    // clear canvas
+                    this._canvas.width = this._width+this._widthAdd;
+                    this._canvas.height = this._height+this._heightAdd;
+
+                    // REMEMBER: all drawings are read from backwards.. so first function is translate, then rotate, then translate, translate..
+                    this._cnv.translate(this._widthAddHalf,this._heightAddHalf);	// at least center image on screen
+                    this._cnv.translate(this._widthHalf,this._heightHalf);			// we move image back to its orginal
+                    this._cnv.rotate(angle);										// rotate image
+                    this._cnv.translate(-this._widthHalf,-this._heightHalf);		// move image to its center, so we can rotate around its center
+                    this._cnv.scale(this._aspectW,this._aspectH); // SCALE - if needed ;)
+                    this._cnv.drawImage(this._img, 0, 0);							// First - we draw image
+                }
+
+        })()
+    }
+
+    if (IE)
+    {
+        Wilq32.PhotoEffect.prototype.createVMLNode=(function(){
+            document.createStyleSheet().addRule(".rvml", "behavior:url(#default#VML)");
+            try {
+                !document.namespaces.rvml && document.namespaces.add("rvml", "urn:schemas-microsoft-com:vml");
+                return function (tagName) {
+                    return document.createElement('<rvml:' + tagName + ' class="rvml">');
+                };
+            } catch (e) {
+                return function (tagName) {
+                    return document.createElement('<' + tagName + ' xmlns="urn:schemas-microsoft.com:vml" class="rvml">');
+                };
+            }
+        })();
+    }
+})(jQuery);