formWizard.php 17.3 KB
Newer Older
Clément Damiens's avatar
 
Clément Damiens committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
<?php 
$cssJS = array(
    '/plugins/jQuery-Knob/js/jquery.knob.js',
    '/plugins/jQuery-Smart-Wizard/js/jquery.smartWizard.js',
    //'/plugins/jQuery-Smart-Wizard/styles/smart_wizard.css',
  // SHOWDOWN
  '/plugins/showdown/showdown.min.js',
  // MARKDOWN
  '/plugins/to-markdown/to-markdown.js'
);
HtmlHelper::registerCssAndScriptsFiles($cssJS, Yii::app()->request->baseUrl);
$poiList = array();

if(isset(Yii::app()->session["costum"]["contextType"]) && isset(Yii::app()->session["costum"]["contextId"])){
    $poiList = PHDB::find(Poi::COLLECTION, 
                    array( "parent.".Yii::app()->session["costum"]["contextId"] => array('$exists'=>1), 
                           "parent.".Yii::app()->session["costum"]["contextId"].".type"=>Yii::app()->session["costum"]["contextType"],
                           "type"=>"cms") );
} 
?>

<style type="text/css">
  @font-face{
      font-family: "montserrat";
       src: url("<?php echo Yii::app()->getModule("costum")->getAssetsUrl() ?>/font/co/montserrat-regular.woff") format("woff"),
       url("<?php echo Yii::app()->getModule("costum")->getAssetsUrl() ?>/font/co/montserrat-regular.ttf") format("ttf")
  }.mst{font-family: 'montserrat'!important;}

  @font-face{
      font-family: "CoveredByYourGrace";
      src: url("<?php echo Yii::app()->getModule("costum")->getAssetsUrl() ?>/font/co/CoveredByYourGrace.ttf")
  }.cbyg{font-family: 'CoveredByYourGrace'!important;}
    
    
  #customHeader{
    margin-top: 0px;
  }
  #costumBanner{
   /* max-height: 375px; */
  }
  #costumBanner h1{
    position: absolute;
    color: white;
    background-color: rgba(0,0,0,0.4);
    font-size: 29px;
    bottom: 0px;
    padding: 20px;
  }
  #costumBanner h1 span{
    color: #eeeeee;
    font-style: italic;
  }
  #costumBanner img{
    min-width: 100%;
  }
  .btn-main-menu{
    background: <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>;
    border-radius: 10px;
    padding: 10px !important;
    color: white;
    cursor: pointer;
    border:3px solid transparent;
    font-size: 1.5em
    /*min-height:100px;*/
  }
  .btn-main-menuW{
    background: white;
    color: <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>;
    border:none;
    cursor:text ;
  }
  .btn-main-menu:hover{
    border:2px solid <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>;
    background-color: white;
    color: <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>;
  }
  .btn-main-menuW:hover{
    border:none;
  }
  @media screen and (min-width: 450px) and (max-width: 1024px) {
    .logoDescription{
      width: 60%;
      margin:auto;
    }
  }

  @media (max-width: 1024px){
    #customHeader{
      margin-top: -1px;
    }
  }
  @media (max-width: 768px){
    h1, h2, h3, h4, h5, h6 {
        display: block;
        font-size: 1.9em;
    }
  }
  #customHeader #newsstream .loader{
    display: none;
  }

</style>

<?php
	$params = [  "tpl" => Yii::app()->session["costum"]["slug"],
				"slug"=>$el["slug"],
				"canEdit"=>$canEdit,
				"el"=>$el  ];
	echo $this->renderPartial("survey.views.tpls.acceptAndAdmin", $params, true ); 
?>  

<div class="col-xs-12 no-padding" id="customHeader" style="background-color: white">

  <div id="costumBanner" class="col-xs-12 col-sm-12 col-md-12 no-padding">
 <!--  <h1>L'entraide<br/><span class="small">Une interface numérique pour échanger</span></h1>-->
    
    <?php 
    $banner = Yii::app()->getModule("co2")->assetsUrl."/images/banniere-Campagne-Acoeur.jpg";
    if(@Yii::app()->session["costum"]["metaImg"]){
    	//ex this.profilBannerUrl
		if(substr_count(Yii::app()->session["costum"]["metaImg"], 'this.') > 0 && isset($el)){
			$field = explode(".", Yii::app()->session["costum"]["metaImg"]);
			if( isset( $el[ $field[1] ] ) )
			  	$banner = Yii::app()->getRequest()->getBaseUrl(true).$el[$field[1]] ;
		}
		else if(strrpos(Yii::app()->session["costum"]["metaImg"], "http" ) === false && strrpos(Yii::app()->session["costum"]["metaImg"], "/upload/" ) === false ) {
			$banner = Yii::app()->getModule("co2")->getAssetsUrl().Yii::app()->session["costum"]["metaImg"] ;
        }
		else 
			$banner = Yii::app()->session["costum"]["metaImg"];
    }
    ?>
    <img class="img-responsive"  style="margin:auto;background-color: black;" src='<?php echo $banner ?>'/> 

  </div>
<?php
$color1 = "#E63458";
if(isset(Yii::app()->session["costum"]["cms"]["color1"]))
	$color1 = Yii::app()->session["costum"]["cms"]["color1"];
if($canEdit)
	echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='color1' data-type='color'  data-path='costum.cms.color1' data-label='Couleur Principale '><i class='fa fa-pencil'></i></a>";
?>

  <div class="col-sm-12 col-md-12 col-xs-12 no-padding" style="background-color:<?php echo Yii::app()->session["costum"]["colors"]["grey"]; ?>; max-width:100%;">

    <div class="col-xs-12 no-padding" style=""> 
      
      <?php if( !isset(Yii::app()->session["userId"])){ ?>
      <div class="col-xs-12 no-padding">
        <div class="col-md-12 col-sm-12 col-xs-12 padding-20" style="padding-left:100px;background-color: <?php echo Yii::app()->session["costum"]["colors"]["grey"]; ?>; ">
          <div class="col-xs-12 col-sm-10 col-sm-offset-1 pull-left padding-20 shadow2" style="font-family: montserrat; margin-top:-200px;background-color: #fff;font-size: 14px;z-index: 5;">
            <div class="col-xs-12  ourvalues" style="text-align:center;">
              <h2 class="mst col-xs-12 text-center">
                <br>
                <?php 
                  if(isset(Yii::app()->session["costum"]["cms"]["title1"])){
                    echo htmlentities(Yii::app()->session["costum"]["cms"]["title1"]);
                  } else { ?> Open Form Wizard (With steps)<?php } 
                  if($canEdit)
                    echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='title1' data-path='costum.cms.title1'><i class='fa fa-pencil'></i></a>";
                  ?>
                </h2>

                <p class="mst" style="color:<?php echo Yii::app()->session["costum"]["colors"]["dark"]; ?>">
                  <?php 
                  if(isset(Yii::app()->session["costum"]["cms"]["subtitle1"])){
                    echo htmlentities(Yii::app()->session["costum"]["cms"]["subtitle1"]);
                  } else { ?>
                  Votre questionnaire contient des sections ou des étapes
                  <br/>Vous etes au bon endroit.<br/>
                  <?php } 
                  if($canEdit)
                    echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='subtitle1' data-path='costum.cms.subtitle1'><i class='fa fa-pencil'></i></a>";
                  ?>
                 <br/>
                </p>

                <h2 class="mst" style="color:<?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>" >JE PARTICIPE</h2>
                  
              
              <br/>
                <div class="col-xs-12" style="margin-bottom:40px;">
                  <div class="col-xs-12 col-sm-4">
                        <?php if( Person::logguedAndValid() ){ ?>
                    <span class="col-xs-12 text-center btn-main-menu btn-main-menuW ">Je suis Connecté !! <br>et je veux l'utopie</span>
                        <?php } else { ?>
                        <button  data-toggle="modal" data-target="#modalLogin" class="col-xs-12 btn-main-menu text-center" styl >JE PARTICIPE</button>
                        <?php } ?>
                </div>

                <div class="col-xs-12 col-sm-4">
                    <a href="alert('open share it panel')" class="col-xs-12 btn-main-menu btn-main-menuW text-red" style="font-size: 1.5em; padding-top: 20px;"  >En partageant <br>ce sondage</a>
                </div>

                <div class="col-xs-12 col-sm-4">
                    <a href="#results" class="col-xs-12 btn-main-menu">Voir les résultats</a>
                </div>
              </div>

            </div>


          </div>

          <div class="col-xs-12 text-center " style="font-size: 1.5em; padding-top: 20px;" >
          <?php 
                if(isset(Yii::app()->session["costum"]["cms"]["textIntro"])){
                  echo htmlentities(Yii::app()->session["costum"]["cms"]["textIntro"]);
                } else { ?> <b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 
                <br/><br/>
                <b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                <br/><br/>
                <b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 
                <br/><br/>
                <b>Lorem ipsum dolor sit amet</b>, consectetur adipisicing elit, sed do eiusmod
                tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
                quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
                consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
                cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
                proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                <?php } 
                if($canEdit)
                  echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='textIntro' data-type='textarea' data-markdown='1'  data-path='costum.cms.textIntro' data-label='Expliquez les objectifs de ce formulaire ? '><i class='fa fa-pencil'></i></a>";
                ?>
          </div>
          
        </div><br/>

      </div>
      <?php } else { ?>

		
        <style type="text/css">
        	.monTitle{
        		border-top: 1px dashed <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>; 
        		border-bottom: 1px dashed <?php echo Yii::app()->session["costum"]["colors"]["pink"]; ?>;
                margin-top: -20px;
        	}
        </style>
        <?php $formSmallSize =  12; ?>
    	<div class="col-md-12 col-lg-<?php echo $formSmallSize?> no-padding "><br/>
    		<div class="col-md-12 col-sm-12 col-xs-12 " style="background-color: white; ">
    		  <h1 class="margin-top-20 monTitle  padding-20 text-center cbyg" style="color:<?php echo $color1  ?>">
            <?php 
            if(isset(Yii::app()->session["costum"]["cms"]["sec1Title"])){
              echo htmlentities(Yii::app()->session["costum"]["cms"]["sec1Title"]);
            } else { ?> Sondage <?php } 
            if($canEdit)
              echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='sec1Title' data-type='text'  data-path='costum.cms.sec1Title' data-label='Titre '><i class='fa fa-pencil'></i></a>";
            ?>
          </h1>
          <div class="text-center">
          <?php if(isset(Yii::app()->session["costum"]["form"]["startDate"])){ ?>
            Démarrage : <?php echo Yii::app()->session["costum"]["form"]["startDate"]; ?>
            <?php } 

            if(isset(Yii::app()->session["costum"]["form"]["endDate"])){ ?>
            et se termine : <?php echo Yii::app()->session["costum"]["form"]["endDate"]; ?>
            <?php } ?>
            </div>
    		</div>

          <div class="row margin-top-20   padding-20" style="background-color: white; ">

            <div class="col-xs-12">

              <div class="padding-20 btnParticiper margin-top-20 Montserrat text-center" style="font-size:1.2em ">
                  <?php 
                if(isset(Yii::app()->session["costum"]["cms"]["textIntro"])){
                  echo htmlentities(Yii::app()->session["costum"]["cms"]["textIntro"]);
                } else { ?> Quelle est votre objectif avec ce formulaire <?php } 
                if($canEdit)
                  echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='textIntro' data-type='textarea' data-markdown='1'  data-path='costum.cms.textIntro' data-label='Expliquez les objectifs de ce formulaire ? '><i class='fa fa-pencil'></i></a>";
                ?>
              </div> 


<script type="text/javascript">
var formInputs = {};
var answerObj = <?php echo (!empty($answer)) ? json_encode( $answer ) : "null"; ?>;
</script>
              <div class="col-xs-12 margin-top-20">
              <?php 
              $wizardUid = "wizardForm";
Clément Damiens's avatar
 
Clément Damiens committed
300 301 302 303 304 305 306 307 308 309
              if($showAnswerActions){
                $params = [
                      "el" => $el,
                      "color1" => $color1,
                      "canEdit" => $canEdit,
                      "allAnswers"=>@$allAnswers,
                      "what" => "dossiers"
                  ];
                  echo $this->renderPartial("survey.views.tpls.answers.allAnswers",$params); 
              }
Clément Damiens's avatar
 
Clément Damiens committed
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405
              if($showForm){
                $params = [
                    "formList"=>$formList,
                    "el" => $el,
                    "active" => "all",
                    "color1" => $color1,
                    "canEdit" => $canEdit,
                    "answer"=>$answer,
                    "showForm" => $showForm,
                    "wizid"=> $wizardUid
                ];
                echo $this->renderPartial("survey.views.tpls.forms.wizard",$params); 

              } else {
                  echo "<h4 class='text-center' style='color:".$color1."'><i class='fa fa-warning'></i> Une seul réponse n'est possible.</h4>";
                  echo "<a class='btn btn-primary' href='/costum/co/index/slug/".$el["slug"]."/answer/".$myAnswers[0]."'>Votre réponse</a>";
              }
                ?>

            </div>
	        </div>
        </div>

        <div class="col-md-12" style="color:#293A46; background-color: #dfe7e9; float:left; width:100%;">
          <center>
            <i class="fa fa-caret-down" style="color:#fff"></i>
            <div class="col-xs-12 margin-top-10 margin-bottom-25">
              <h4>
              <?php 
                if(isset(Yii::app()->session["costum"]["cms"]["sec2Title"])){
                  echo htmlentities(Yii::app()->session["costum"]["cms"]["sec2Title"]);
                } else { ?> Communauté <?php } 
                if($canEdit)
                  echo "<a class='btn btn-xs btn-danger editBtn' href='javascript:;' data-key='sec2Title' data-type='text' data-path='costum.cms.sec2Title' data-label='Votre texte '><i class='fa fa-pencil'></i></a>";
                ?>
              </h4>
              <div id="community"></div>
            </div>
          </center>
        </div>


        <div class="col-xs-12 margin-top-20">
              <?php 
              $params = array(
                  "poiList"=>$poiList,
                  "listSteps" => array("1","2","3","4"),
                  "el" => $el,
                  "color1" => Yii::app()->session["costum"]["colors"]["pink"],
                    "wizid"=> "wizardInfo"
              );
              echo $this->renderPartial("survey.views.tpls.wizard",$params); ?>
          </div>
		</div>

	<?php }  ?>
		
    </div>
  </div>


</div>

<script type="text/javascript">
//to edit costum page pieces 
 var configDynForm = <?php echo json_encode(Yii::app()->session['costum']['dynForm']); ?>;
//information and structure of the form in this page  
var tplCtx = {};

jQuery(document).ready(function() {

  mylog.log("render","/modules/costum/views/custom/co/formWizard.php");
  contextData = {
      id : "<?php echo Yii::app()->session["costum"]["contextId"] ?>",
      type : "<?php echo Yii::app()->session["costum"]["contextType"] ?>",
      name : '<?php echo htmlentities($el['name']) ?>',
      profilThumbImageUrl : "http://127.0.0.1/ph/themes/CO2/assets/img/LOGOS/CO2/logo-min.png"
  };
  getAjax("community", baseUrl+"/"+moduleId+"/element/getdatadetail/type/"+costum.contextType+"/id/"+costum.contextId+"/dataName/members",
        function(data){
          //displayInTheContainer(data,"members","group",null,true);
          mylog.log("#community",data);
        },
        "html");

  $('#showAnswerBtn').on("click",function() { 
    $("#allAnswersContainer").toggleClass("hide");
    $('#<?php echo "wizardForm" ?>').toggleClass("hide");
    //getAjax(".pageContent", baseUrl+"/costum/co/index/slug/<?php echo $el['slug'] ?>/page/answerList",null,"html");
   })

});


</script>