コード例 #1
0
 public function getUrlReferrer()
 {
     $referrer = parent::getUrlReferrer();
     $host = UrlHelper::getHost($referrer);
     if ($host === $this->getServerName()) {
         return $referrer;
     } else {
         return UrlHelper::createAbsoluteUrl('/shop');
     }
 }
コード例 #2
0
 /**
  * Return the referal url,
  * it's used for the "close" buttons, and the "save and close" buttons
  * So it checks if the referrer url is the same than the current url to avoid looping.
  * If it the case, a paramater can be set to tell what referrer to return.
  * If the referrer is an external url, Yii return by default the current url.
  *
  * To avoid looping between two urls (like simpleStatistics <=> Expert Statistics),
  * it can be necessary to check if the referrer contains a specific word (an action in general)
  * So if you want to forbid a return to a certain page, just provide an alternative url, and the forbidden key world
  *
  * Not all "close" and "save and close" buttons should use it.
  * Only close button for pages that can be accessed since different places.
  * eg: edit question, that can be accessed from question list or question
  *
  *
  * TODO: implement it for all those pages
  * List of pages where it should be implemented :
  * - All pages accessible via the top nav-bar (eg: create a new survey, edit template, etc.)
  * - All pages accessible via quick actions (home page, survey quick actions, question group quick actions, etc.)
  * - All pages accessible via question explorer (only "add question to group" for now)
  * - Edition of question and question group, which are accessible via summary or list
  * - Import question, question group
  *
  * TODO: remove misused of it
  * It should not be used for pages accessible from only one place
  * - Token activation
  * etc.
  *
  * In doubt, just use getUrlReferrer with a default link to home page for full page layout pages,
  * or a link to the survey summary for sidemenu layout pages,
  * with the controller action as forbidden world.
  * So the close button will never loop.
  *
  * TODO : Each time a new quick action or button is added to access an existing page, the "close" & "save and close" button should be updated to use getUrlReferrer()
  *
  * @param $sAlternativeUrl string, the url to return if referrer url is the same than current url.
  * @param $aForbiddenWordsInUrl array, an array containing forbidden words in url
  * @return string if success, else null
  */
 public function getUrlReferrer($sAlternativeUrl = null, $aForbiddenWordsInUrl = array())
 {
     $referrer = parent::getUrlReferrer();
     $baseReferrer = str_replace(Yii::app()->getBaseUrl(true), "", $referrer);
     $baseRequestUri = str_replace(Yii::app()->getBaseUrl(), "", Yii::app()->request->requestUri);
     $referrer = $baseReferrer != $baseRequestUri ? $referrer : null;
     // Checks if the alternative url should be used
     if (isset($sAlternativeUrl)) {
         // Use alternative url if the referrer is equal to current url.
         if (is_null($referrer)) {
             $referrer = $sAlternativeUrl;
         }
         // Use alternative url if a forbidden word appears in the referrer
         foreach ($aForbiddenWordsInUrl as $sForbiddenWord) {
             if (strpos($referrer, $sForbiddenWord) !== false) {
                 $referrer = $sAlternativeUrl;
             }
         }
     }
     return $referrer;
 }
コード例 #3
0
$this->widget('bootstrap.widgets.TbBreadcrumb', array('links' => array('App' => array(), 'Manage Apps' => array(), 'Runs')));
?>




<div class="search-form" style="display:none">
<?php 
$this->renderPartial('_search', array('model' => $model));
?>
</div><!-- search-form -->

<br/><div class="well-button">

              <?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('submit' => CHttpRequest::getUrlReferrer(), 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
            
            
                
        </div>

<div class="group-div">
   <div class="well-cinza">
                      <b><?php 
echo $nomeApp;
?>
</b>
                  </div>
<?php 
コード例 #4
0
<div class="form">
    <?php 
$form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'runs-form', 'enableAjaxValidation' => false));
?>
    <div class="well-button">

              <?php 
echo TbHtml::Button('<i class="fa fa-arrow-left"></i> Back', array('onclick' => 'js:document.location.href="/mtcontrool"', 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'style' => 'color: green;'));
?>
            
             <?php 
echo TbHtml::submitButton('<i class="fa fa-check fa-lg"></i> Create', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'class' => 'btn pull-right', 'style' => 'color: white; margin-left: 4px;', 'title' => 'Create'));
?>
          
                        <?php 
echo TbHtml::button('<i class="fa fa-times fa-lg"></i> Cancel', array('submit' => CHttpRequest::getUrlReferrer(), 'color' => TbHtml::BUTTON_COLOR_DANGER, 'size' => TbHtml::BUTTON_SIZE_SMALL, 'title' => 'Cancel', 'class' => 'btn pull-right', 'style' => 'color: white;'));
?>
            
                
        </div>
    <div class="well">
    <p class="help-block">
		Fields with <span class="required">*</span> are required.
	</p>

        <?php 
$user_Id = Yii::app()->user->id;
?>
    <?php 
echo $form->errorSummary($model);
?>
コード例 #5
0
ファイル: LSHttpRequest.php プロジェクト: mfavetti/LimeSurvey
 /**
  * Method to update the LimeSurvey Navigation Stack to prevent looping
  */
 public function updateNavigationStack()
 {
     $referrer = parent::getUrlReferrer();
     $navStack = App()->session['LSNAVSTACK'];
     if (!is_array($navStack)) {
         $navStack = array();
     }
     array_unshift($navStack, $referrer);
     if (count($navStack) > 5) {
         array_pop($navStack);
     }
     App()->session['LSNAVSTACK'] = $navStack;
 }
コード例 #6
0
            
            
            


        </div>                            
        
</div>

		
	
                       <br/>
                        <div class="well-button">

              <?php 
echo TbHtml::Button($model->isNewRecord ? '<i class="fa fa-arrow-left"></i>' : Share, array('submit' => CHttpRequest::getUrlReferrer(), 'id' => 'b1', 'title' => 'Back', 'color' => TbHtml::BUTTON_COLOR_DEFAULT, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'style' => 'color: green;'));
?>
            
             <?php 
echo TbHtml::submitButton('<i class="fa fa-check fa-lg"></i>', array('color' => TbHtml::BUTTON_COLOR_SUCCESS, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'class' => 'btn pull-right', 'style' => 'color: white; margin-left: 4px;', 'title' => 'Create'));
?>
          
                        <?php 
echo TbHtml::button('<i class="fa fa-times fa-lg"></i>', array('onclick' => 'js:document.location.href="/mtcontrool"', 'color' => TbHtml::BUTTON_COLOR_DANGER, 'size' => TbHtml::BUTTON_SIZE_LARGE, 'title' => 'Cancel', 'class' => 'btn pull-right', 'style' => 'color: white;'));
?>
            
                
        </div>
<?php 
$this->endWidget();
?>