formWizard.php 14.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
<?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();

14
if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
Clément Damiens's avatar
 
Clément Damiens committed
15
    $poiList = PHDB::find(Poi::COLLECTION, 
16 17
                    array( "parent.".$this->costum["contextId"] => array('$exists'=>1), 
                           "parent.".$this->costum["contextId"].".type"=>$this->costum["contextType"],
Clément Damiens's avatar
 
Clément Damiens committed
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
                           "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{
57
    background: <?php echo $this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
58 59 60 61 62 63 64 65 66 67
    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;
68
    color: <?php echo $this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
69 70 71 72
    border:none;
    cursor:text ;
  }
  .btn-main-menu:hover{
73
    border:2px solid <?php echo $this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
74
    background-color: white;
75
    color: <?php echo $this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
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
  }
  .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
105
	$params = [  "tpl" => $this->costum["slug"],
Clément Damiens's avatar
 
Clément Damiens committed
106 107 108 109 110 111 112 113
				"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">

Tibor Katelbach's avatar
tweaks  
Tibor Katelbach committed
114
  
Clément Damiens's avatar
 
Clément Damiens committed
115 116
<?php
$color1 = "#E63458";
117 118
if(isset($this->costum["cms"]["color1"]))
	$color1 = $this->costum["cms"]["color1"];
Clément Damiens's avatar
 
Clément Damiens committed
119 120 121 122
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>";
?>

123
  <div class="col-sm-12 col-md-12 col-xs-12 no-padding" style="background-color:<?php echo $this->costum["colors"]["grey"]; ?>; max-width:100%;">
Clément Damiens's avatar
 
Clément Damiens committed
124 125 126 127 128

    <div class="col-xs-12 no-padding" style=""> 
      
      <?php if( !isset(Yii::app()->session["userId"])){ ?>
      <div class="col-xs-12 no-padding">
129
        <div class="col-md-12 col-sm-12 col-xs-12 padding-20" style="padding-left:100px;background-color: <?php echo $this->costum["colors"]["grey"]; ?>; ">
Clément Damiens's avatar
 
Clément Damiens committed
130 131 132 133 134
          <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 
135 136
                  if(isset($this->costum["cms"]["title1"])){
                    echo htmlentities($this->costum["cms"]["title1"]);
Clément Damiens's avatar
 
Clément Damiens committed
137 138 139 140 141 142
                  } 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>

143
                <p class="mst" style="color:<?php echo $this->costum["colors"]["dark"]; ?>">
Clément Damiens's avatar
 
Clément Damiens committed
144
                  <?php 
145 146
                  if(isset($this->costum["cms"]["subtitle1"])){
                    echo htmlentities($this->costum["cms"]["subtitle1"]);
Clément Damiens's avatar
 
Clément Damiens committed
147 148 149 150 151 152 153 154 155 156
                  } 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>

157
                <h2 class="mst" style="color:<?php echo $this->costum["colors"]["pink"]; ?>" >JE PARTICIPE</h2>
Clément Damiens's avatar
 
Clément Damiens committed
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
                  
              
              <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 
186 187
                if(isset($this->costum["cms"]["textIntro"])){
                  echo htmlentities($this->costum["cms"]["textIntro"]);
Clément Damiens's avatar
 
Clément Damiens committed
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
                } 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{
229 230
        		border-top: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>; 
        		border-bottom: 1px dashed <?php echo $this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
231 232 233 234 235 236 237 238
                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 
239 240
            if(isset($this->costum["cms"]["sec1Title"])){
              echo htmlentities($this->costum["cms"]["sec1Title"]);
Clément Damiens's avatar
 
Clément Damiens committed
241 242 243 244 245 246
            } 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">
247 248
          <?php if(isset($parentForm["startDate"])){ ?>
            Démarrage : <?php echo $parentForm["startDate"]; ?>
Clément Damiens's avatar
 
Clément Damiens committed
249 250
            <?php } 

251 252
            if(isset($parentForm["endDate"])){ ?>
            et se termine : <?php echo $parentForm["endDate"]; ?>
Clément Damiens's avatar
 
Clément Damiens committed
253 254 255 256 257 258 259 260 261 262
            <?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 
263 264
                if(isset($this->costum["cms"]["textIntro"])){
                  echo htmlentities($this->costum["cms"]["textIntro"]);
Clément Damiens's avatar
 
Clément Damiens committed
265 266 267 268 269 270 271 272 273 274 275 276 277 278
                } 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";
279
              if(!empty($showAnswerActions)){
Clément Damiens's avatar
 
Clément Damiens committed
280 281 282 283 284 285 286 287 288
                $params = [
                      "el" => $el,
                      "color1" => $color1,
                      "canEdit" => $canEdit,
                      "allAnswers"=>@$allAnswers,
                      "what" => "dossiers"
                  ];
                  echo $this->renderPartial("survey.views.tpls.answers.allAnswers",$params); 
              }
289
              //if($showForm){
Clément Damiens's avatar
 
Clément Damiens committed
290 291 292 293 294 295 296 297 298 299 300 301
                $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); 

302 303 304 305
              // } 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>";
              // }
Clément Damiens's avatar
 
Clément Damiens committed
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
                ?>

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


		</div>

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


</div>

<script type="text/javascript">
//to edit costum page pieces 
325
 var configDynForm = <?php echo json_encode($this->costum['dynForm']); ?>;
Clément Damiens's avatar
 
Clément Damiens committed
326 327 328 329 330 331 332
//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 = {
333 334
      id : "<?php echo $this->costum["contextId"] ?>",
      type : "<?php echo $this->costum["contextType"] ?>",
Clément Damiens's avatar
 
Clément Damiens committed
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355
      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>