public function customizeControlCunfigure($customizeUrl, $normalUrl)
 {
     if ($this->allowCustomize) {
         $js = new UTIL_JsGenerator();
         $js->newVariable('dndCustomizeUrl', $customizeUrl);
         $js->newVariable('dndNormalUrl', $normalUrl);
         $js->jQueryEvent('#goto_customize_btn', 'click', 'if(dndCustomizeUrl) window.location.href=dndCustomizeUrl;');
         $js->jQueryEvent('#goto_normal_btn', 'click', 'if(dndNormalUrl) window.location.href=dndNormalUrl;');
         OW::getDocument()->addOnloadScript($js);
     }
 }
Exemple #2
0
 /**
  * Action cropping avatar
  */
 public function crop()
 {
     $language = OW::getLanguage();
     $avatarService = BOL_AvatarService::getInstance();
     $userService = BOL_UserService::getInstance();
     $userId = OW_Auth::getInstance()->getUserId();
     $hasAvatar = $avatarService->userHasAvatar($userId);
     $this->assign('hasAvatar', $hasAvatar);
     if ($hasAvatar) {
         $this->assign('avatar', $avatarService->getAvatarUrl($userId, 2));
         $this->assign('original', $avatarService->getAvatarUrl($userId, 3));
     } else {
         $this->assign('default', $avatarService->getDefaultAvatarUrl(2));
     }
     $staticJsUrl = OW::getPluginManager()->getPlugin('base')->getStaticJsUrl();
     $staticCssUrl = OW::getPluginManager()->getPlugin('base')->getStaticCssUrl();
     OW::getDocument()->addScript($staticJsUrl . 'jquery.Jcrop.js');
     OW::getDocument()->addStyleSheet($staticCssUrl . 'jquery.Jcrop.css');
     OW::getDocument()->addScript($staticJsUrl . 'crop_avatar.js');
     $objParams = array('ajaxResponder' => $this->ajaxResponder, 'previewSize' => 100);
     $script = "\$(document).ready(function(){\n                var crop = new cropAvatar( " . json_encode($objParams) . ");\n                crop.initCrop();\n            }); ";
     OW::getDocument()->addOnloadScript($script);
     $profileEditUrl = OW::getRouter()->urlForRoute('base_edit');
     $js = new UTIL_JsGenerator();
     $js->newVariable('profileEditUrl', $profileEditUrl);
     $js->jQueryEvent('#button-profile-edit', 'click', 'window.location.href=profileEditUrl;');
     OW::getDocument()->addOnloadScript($js);
 }