formWizard.php 7.4 KB
Newer Older
Clément Damiens's avatar
 
Clément Damiens committed
1 2 3 4 5 6 7 8 9 10 11
<?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);
Clément Damiens's avatar
 
Clément Damiens committed
12 13 14 15
HtmlHelper::registerCssAndScriptsFiles(array( 
  '/js/answer.js',
  ), Yii::app()->getModule( Survey::MODULE )->getAssetsUrl() );

Clément Damiens's avatar
 
Clément Damiens committed
16 17
$poiList = array();

18
if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
Clément Damiens's avatar
 
Clément Damiens committed
19
    $poiList = PHDB::find(Poi::COLLECTION, 
20 21
                    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
22
                           "type"=>"cms") );
Raph El's avatar
Raph El committed
23
}
Clément Damiens's avatar
 
Clément Damiens committed
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
?>

<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{
Raph El's avatar
Raph El committed
61
    background: <?php echo @$this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
62 63 64 65 66 67 68 69 70 71
    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;
Raph El's avatar
Raph El committed
72
    color: <?php echo @$this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
73 74 75 76
    border:none;
    cursor:text ;
  }
  .btn-main-menu:hover{
Raph El's avatar
Raph El committed
77
    border:2px solid <?php echo @$this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
78
    background-color: white;
Raph El's avatar
Raph El committed
79
    color: <?php echo @$this->costum["colors"]["pink"]; ?>;
Clément Damiens's avatar
 
Clément Damiens committed
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100
  }
  .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;
    }
  }
  #customHeader #newsstream .loader{
    display: none;
  }

</style>
Raph El's avatar
Raph El committed
101 102 103 104
<script type="text/javascript">
    var sectionDyf = {};
    
</script>
Clément Damiens's avatar
 
Clément Damiens committed
105
<?php
Raph El's avatar
Raph El committed
106 107 108 109 110
  // $params = [  "tpl" => $this->costum["slug"],
  //       "slug"=>$el["slug"],
  //       "canEdit"=>$canEdit,
  //       "el"=>$el  ];
  // echo $this->renderPartial("survey.views.tpls.acceptAndAdmin", $params, true ); 
Clément Damiens's avatar
 
Clément Damiens committed
111 112 113 114 115
?>  

<div class="col-xs-12 no-padding" id="customHeader" style="background-color: white">
<?php
$color1 = "#E63458";
116
if(isset($this->costum["cms"]["color1"]))
Raph El's avatar
Raph El committed
117 118 119
  $color1 = $this->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>";
Clément Damiens's avatar
 
Clément Damiens committed
120 121
?>

Raph El's avatar
Raph El committed
122 123 124 125 126 127
  <div class="col-xs-12 no-padding" >
    <!-- style="background-color:<?php //echo $this->costum["colors"]["grey"]; ?>; max-width:100%;"> -->

    <div class="col-xs-12 no-padding" style="">
    <style type="text/css">
      .monTitle{
Raph El's avatar
Raph El committed
128 129
        border-top: 1px dashed <?php echo @$this->costum["colors"]["pink"]; ?>; 
        border-bottom: 1px dashed <?php echo @$this->costum["colors"]["pink"]; ?>;
Raph El's avatar
Raph El committed
130 131 132 133 134 135 136 137 138 139 140 141 142
            margin-top: -20px;
      }
    </style>
  <?php $formSmallSize =  12; ?>
      <div class="col-md-12 col-lg-<?php echo $formSmallSize?> no-padding "><br/>

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

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

            <script type="text/javascript">
            var formInputs = {};
            var answerObj = <?php echo (!empty($answer)) ? json_encode( $answer ) : "null"; ?>;
Raph El's avatar
Raph El committed
143
            var form = <?php echo (!empty($form)) ? json_encode( $form ) : "null"; ?>;
Raph El's avatar
Raph El committed
144 145 146 147
            </script>
            <div class="col-xs-12 margin-top-20">
            <?php
            $wizardUid = (String) $form["_id"];
Raph El's avatar
Raph El committed
148
			if($canEdit === true && $mode != "fa" && empty($answer["validated"]) ){
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
				$nameMode = "mode read";
				if($mode == "w")
					$nameMode = "mode write";

				echo '<div class="col-xs-12">'.
						'<div class="col-xs-4 col-xs-offset-4 dropdown">'.
							'<button class="btn btn-default dropdown-toggle col-xs-12" type="button" id="dropdown'.$wizardUid.'" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">'.
								ucfirst (Yii::t('survey',$nameMode) ).' <span class="caret"></span>'.
							'</button>'.
							'<ul class="dropdown-menu col-xs-12" aria-labelledby="dropdown'.$wizardUid.'">'.
								'<li><a href="#answer.index.id.'.(String)$answer['_id'].'.mode.r" class="lbh">'.ucfirst (Yii::t('survey',"read")).'</a></li>'.
								'<li><a href="#answer.index.id.'.(String)$answer['_id'].'.mode.w" class="lbh">'.ucfirst (Yii::t('survey',"write")).'</a></li>'.
							'</ul>'.
						'</div>'.
					'</div>';
			}


			if($mode != "fa" && !empty($parentForm["answersTpl"])){
				$params = [
					"parentForm"=>$parentForm,
					"el" => $el,
					"color1" => $color1,
					"canEdit" => $canEdit,
					"answer"=>$answer,
					"forms"=>$forms,
					"allAnswers"=>@$allAnswers,
					"what" => "dossiers",
					"wizid"=> $wizardUid
				];
				echo $this->renderPartial($parentForm["answersTpl"],$params);
			}

			if( $mode == "fa" && $canEditForm === true ){
				$params = [
					"canEditForm"=>$canEditForm,
					"mode" => $mode,
					"form" => $form,
					"el" => $el
				];
				echo $this->renderPartial("survey.views.tpls.forms.config",$params);
			}
			if( isset($answer) && !empty($showForm) && $showForm === true  ) {
				$params = [
					"parentForm"=>$parentForm,
					"form" => $form,
					"forms"=>$forms,
					"el" => $el,
					"active" => "all",
Raph El's avatar
Raph El committed
198 199
					"color1" => @$this->costum["colors"]["dark"],
					"color2" => @$this->costum["colors"]["pink"],
200 201 202 203 204 205
					"canEdit" => $canEdit,
					"canEditForm" => $canEditForm,
					"canAdminAnswer" => $canAdminAnswer,
					"answer"=>$answer,
					"showForm" => $showForm,
					"mode" => $mode,
206
					"showWizard"=>true,
207 208 209 210 211
					"wizid"=> $wizardUid
				];

				echo $this->renderPartial("survey.views.tpls.forms.wizard",$params); 
			}
Clément Damiens's avatar
 
Clément Damiens committed
212 213 214
            ?>

            </div>
Raph El's avatar
Raph El committed
215
          </div>
Clément Damiens's avatar
 
Clément Damiens committed
216
        </div>
Raph El's avatar
Raph El committed
217
      </div>
Clément Damiens's avatar
 
Clément Damiens committed
218 219 220 221 222 223 224 225
    </div>
  </div>


</div>

<script type="text/javascript">
//to edit costum page pieces 
Tibor Katelbach's avatar
tweaks  
Tibor Katelbach committed
226
var configDynForm = <?php echo json_encode(@$this->costum['dynForm']); ?>;
Raph El's avatar
Raph El committed
227 228 229
var answerId = <?php echo json_encode((String)$answer['_id']); ?>;
var mode = <?php echo json_encode($mode); ?>;
var elTest = <?php echo json_encode($el); ?>;
Clément Damiens's avatar
 
Clément Damiens committed
230 231
//information and structure of the form in this page  
var tplCtx = {};
Raph El's avatar
Raph El committed
232 233 234
if(location.hash.indexOf("#answer.index.id.new")>=0){
    history.replaceState("#answer.index.id.new", "", "#answer.index.id."+answerId+".mode."+mode);
}
Clément Damiens's avatar
 
Clément Damiens committed
235 236

jQuery(document).ready(function() {
Raph El's avatar
Raph El committed
237 238
    mylog.log("render","/modules/costum/views/custom/deal/form.php");
  
Clément Damiens's avatar
 
Clément Damiens committed
239 240 241 242 243
});


</script>