42 const SHOULD_SLIDE_TO_FIRST_PANEL_KEY_NAME =
'slideToFirstPanel';
68 if (static::resolveShouldSlideToSecondPanel($portletId))
70 $slideToSecond =
true;
74 $slideToSecond =
false;
76 static::registerSlidingPanelsScript($portletId);
79 $label = static::getSlideToSecondPanelLabel();
80 $extraClass =
' slide-to-second-panel';
84 $label = static::getSlideToFirstPanelLabel();
87 $content = ZurmoHtml::tag(
'span', array(), $label);
88 $content = ZurmoHtml::link($content,
'#', array(
'id' =>
'sliding-panel-toggle',
89 'class' =>
'vertical-forward-pager' . $extraClass));
93 public static function setShouldSlideToSecondPanelForCurrentUser($portletId, $shouldSlideToSecondPanel)
95 assert(
'is_bool($shouldSlideToSecondPanel)');
110 protected static function registerSlidingPanelsScript($portletId)
113 $('#sliding-panel-toggle').click(function()
115 $('.sliding-panel').slideToggle();
116 $('.sliding-panel').toggleClass('showing-panel');
117 if ($(this).hasClass('slide-to-second-panel'))
119 $(this).removeClass('slide-to-second-panel');
120 $(this).addClass('slide-to-first-panel');
121 $(this).find('span').text('" . static::getSlideToFirstPanelLabel() .
"');
122 " . static::getAjaxSubmitScript($portletId,
false) .
"
126 $(this).removeClass('slide-to-first-panel');
127 $(this).addClass('slide-to-second-panel');
128 $(this).find('span').text('" . static::getSlideToSecondPanelLabel() .
"');
129 " . static::getAjaxSubmitScript($portletId,
true) .
"
134 Yii::app()->getClientScript()->registerScript(
'slidingPanelsScript', $script);
144 assert(
'is_bool($shouldSlideToSecondPanel)');
145 $urlScript =
'js:$.param.querystring("' . static::getAjaxUpdateSlidingPanelShowingByDefaultUrl() .
'", "' .
146 'portletId=' . $portletId .
'&shouldSlideToSecondPanel=' . $shouldSlideToSecondPanel .
'")';
147 return ZurmoHtml::ajax(array(
'type' =>
'GET',
'url' => $urlScript));
150 protected static function getAjaxUpdateSlidingPanelShowingByDefaultUrl()
152 return Yii::app()->createUrl(
'/zurmo/default/ajaxUpdateSlidingPanelShowingByDefault');
static renderToggleLinkContent($portletId)
static setForCurrentUserByPortletIdAndKey($portletId, $keyName, $value)
static getSlideToSecondPanelLabel()
static getSlideToFirstPanelLabel()
static resolveShouldSlideToSecondPanel($portletId)
static getForCurrentUserByPortletIdAndKey($portletId, $keyName, $returnBoolean=false)
static getAjaxSubmitScript($portletId, $shouldSlideToSecondPanel)