home.php 14.6 KB
Newer Older
Pierre Goubeaux's avatar
Pierre Goubeaux committed
1
2
3
4
5
6
7
8
9
10
11
12
<?php 
$cssAnsScriptFilesTheme = array(
      // SHOWDOWN
      '/plugins/showdown/showdown.min.js',
      // MARKDOWN
      '/plugins/to-markdown/to-markdown.js'            
    );

	$cssAndScriptFilesModule = array(
		'/js/default/profilSocial.js',
	);

13
14
15
16
17
18
19
20
21
22
23
24
	$cssAnsScriptFilesModuleMap = array( 
		'/leaflet/leaflet.css',
		'/leaflet/leaflet.js',
		'/css/map.css',
		'/markercluster/MarkerCluster.css',
		'/markercluster/MarkerCluster.Default.css',
		'/markercluster/leaflet.markercluster.js',
		'/js/map.js',
	);

	HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModuleMap, Yii::app()->getModule( Map::MODULE )->getAssetsUrl() );

Pierre Goubeaux's avatar
Pierre Goubeaux committed
25
26
    HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesTheme, Yii::app()->request->baseUrl);
     
Pierre Goubeaux's avatar
Pierre Goubeaux committed
27
28
	HtmlHelper::registerCssAndScriptsFiles($cssAndScriptFilesModule, Yii::app()->getModule( "co2" )->getAssetsUrl());

29
30
31
32
33
34
35
36
37
38
39
	$logo = $this->costum["logo"];

	 if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
  		$el = Element::getByTypeAndId($this->costum["contextType"], $this->costum["contextId"] );

  		$poiList = PHDB::find(Poi::COLLECTION, 
                  array( "parent.".$this->costum["contextId"] => array('$exists'=>1), 
                         "parent.".$this->costum["contextId"].".type"=>$this->costum["contextType"],
                         "type"=>"cms") );
  	}

Pierre Goubeaux's avatar
Pierre Goubeaux committed
40
41
42
43
44
45
46
47
48
49
  	if(isset($this->costum["contextType"]) && isset($this->costum["contextId"])){
    $element = Element::getByTypeAndId($this->costum["contextType"], $this->costum["contextId"] );
    $pList = PHDB::findAndSort(Poi::COLLECTION, 
                    array( 
                      //"parent.".$this->costum["contextId"] => array('$exists'=>1), 
                      //"parent.".$this->costum["contextId"].".type"=>$this->costum["contextType"],
                      "source.key"=>$this->costum["slug"],
                      "type"=>"article"), array("updated"=>-1), 3 );
	}

50
51
    $params = [  "tpl" => "alternatiba","slug"=>$this->costum["slug"],"canEdit"=>false,"el"=>$el ];
    echo $this->renderPartial("costum.views.tpls.acceptAndAdmin", $params,true );
Pierre Goubeaux's avatar
Pierre Goubeaux committed
52
53
?>

54
<style type="text/css">
Pierre Goubeaux's avatar
Pierre Goubeaux committed
55
	
56
	@font-face{
Pierre Goubeaux's avatar
Pierre Goubeaux committed
57
58
59
60
	    font-family: "Helvetica";
	    src: url("<?php echo Yii::app()->getModule("costum")->getAssetsUrl() ?>/font/alternatiba/Helvetica.otf")
	}

Pierre Goubeaux's avatar
Pierre Goubeaux committed
61
62
63
64
65
66
67
68
69
  	#dropdown {
	    background-color: whitesmoke;
	    width: 55% !important;
	    z-index: 1000;
	}

	.article-plus {
	    width: 16% !important;
	    margin-left: 1%;
Pierre Goubeaux's avatar
Pierre Goubeaux committed
70
	}
71
72
73
74
75
76
77
78
</style>

<div class="text-center row">
	<!-- Header -->
	<div class="header">
		<div class="one col-xs-12">
			<center>
				<img class="img-responsive img-one" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/logo1.svg">
Pierre Goubeaux's avatar
Pierre Goubeaux committed
79
80
81
82
83
84
85
86
87
88
				<div style="margin-left: 18vw;" class="hidden-xs col-xs-8" id="searchBar">
					<a data-type="filters" href="javascript:;">
            			<span id="second-search-bar-addon-alternatiba" class="text-white input-group-addon pull-left main-search-bar-addon-mednum">
                			<i id="fa-search" class="fa fa-search"></i>
            			</span>
        			</a>
        			<input type="text" class="form-control pull-left text-center main-search-bars" id="second-search-bar" placeholder="Une recherche">
    			</div>

    			<!-- Dropdown -->
Pierre Goubeaux's avatar
Pierre Goubeaux committed
89
			    <div style="margin-left: 22.7vw;margin-top: -0.1%;" id="dropdown" class="hidden-xs dropdown-result-global-search hidden-xs col-sm-5 col-md-5 col-lg-5 no-padding">
Pierre Goubeaux's avatar
Pierre Goubeaux committed
90
			    </div>
91
92
93
94
95
			</center>
		</div>
		<img class="img-responsive seconde-img-one" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/img-01.jpg">
	</div>

Pierre Goubeaux's avatar
Pierre Goubeaux committed
96
	<p style="margin-top: 2vw;margin-bottom: 2vw;" class="text-one col-xs-10 col-lg-5 col-sm-8">Ensemble nous sommes une force</p>
97
	<!-- SearchBar -->
Pierre Goubeaux's avatar
Pierre Goubeaux committed
98
99
100
	

    
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115

    <div class="col-xs-12">
    	<center>
	    	<div class="col-xs-7 col-lg-4 col-sm-7 section-two">
		    	<p class="text-two col-xs-10 col-sm-7">Des alternatives</p>
		    	<br>
		    	<p class="text-two col-xs-10 col-sm-7">à chaque</p>
		    	<br>
		    	<p class="text-two col-xs-10 col-sm-7">coin de rue !!</p>
	    	</div>
		</center>
	    <img class="img-responsive" style="width: 100%;height: auto;" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/photo-01.jpg">
	</div>

    <!-- Actualités -->
Pierre Goubeaux's avatar
Pierre Goubeaux committed
116
	<div style="background-color: #ededed;" class="col-xs-12 text-center">
117
118
119
120
121
		<div>
			<h1 style="font-family:'Helvetica';color: #098048;">
				<i class="fa fa-newspaper-o" aria-hidden="true"></i>  Actualités
			</h1>
		</div>
Pierre Goubeaux's avatar
Pierre Goubeaux committed
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
          
    	<div class="col-sm-10 col-sm-offset-1 col-xs-12">
      		<?php 
			    foreach($pList as $k => $v){ 
			       	$imgPath=(isset($v["profilMediumImageUrl"]) && !empty($v["profilMediumImageUrl"])) ? Yii::app()->createUrl($v["profilMediumImageUrl"]) : Yii::app()->getModule("costum")->assetsUrl."/images/alternatiba/alter.png"; 
			        $desc=(isset($v['shortDescription'])) ? $v['shortDescription'] : "";
			        if(empty($desc) && isset($v["description"])){
			          $desc=/*(strlen($v["description"]) > 200) ? substr($v["description"], 0, 200)."..." :*/ $v["description"];
			        }
        	?>
        	<div id="entity<?php echo $k ?>" class="searchEntityContainer searchEntity shadow2 col-xs-12" style="margin-bottom: 15px !important;padding-top: 5px !important;padding-bottom: 5px !important;">

          		<div class="container-img col-xs-3 col-md-2"><img src="<?php echo $imgPath ?>" class="img-responsive"/>
          		</div>

      			<div class="container-info col-xs-9 col-xs-10">
        			<h3 class="text-left col-xs-8" style="font-size: 25px;text-transform: initial;color:#18a47c;"><?php echo $v["name"] ?></h3>
        			<a href="#page.type.poi.id.<?php echo $k ?>" class="lbh-preview-element col-xs-12 no-padding">
      					<img class="img-responsive article-plus" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/plus-01.svg">
        			</a>
        			<?php if(Authorisation::isInterfaceAdmin()){ ?>
        				<div class="col-xs-12"><button class="btn-primary addForumBtn" onclick="dyFObj.openForm('poi');">Ajouter une actualité</button></div>
        			<?php } ?>
      			</div>
        	</div>
      		<?php } 
		      //var_dump($poiList);exit;
		      /*echo $this->renderPartial( "costum.views.tpls.multiElementBlock", array(
		          "poiList"   => $poiList,
		          "blockName" => "el",
		          "titlecolor"=> "#e6344d",
		          "blockCt"   => count($poiList),
		          "typeApp"=>"forum"
		        ), true );*/
		    ?>
    	</div>
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
	</div>

	<!-- Cartographie -->
	<center>
		<img class="img-responsive illustration" style="" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/illustration-01.svg">
	</center>
	<div style="background-color:#098048;" class="col-xs-12 text-center">
		<h1 style="font-family:'Helvetica';color: white;">
			<i class="fa fa-map-marker" aria-hidden="true"></i>  Cartographie
		</h1>
		<center>
			<img class="img-responsive img-carto" style="" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/carto-01.png">
		</center>

		<div>
			<button style="background: white;border-radius: 10px;margin-bottom: 1vw;font-size: 25px;color:#098048; " id="afficheMap"><i class="fa fa-angle-double-down" aria-hidden="true" id="afficheUp"></i> Afficher la carte</button>
		</div>

		<div style="display: none;" class="col-xs-12 mapBackground no-padding" id="mapAlternatiba">
		</div>
Pierre Goubeaux's avatar
Pierre Goubeaux committed
178
179
	</div>

180
181
182
	<?php $params = array("canEdit"   =>    $canEdit); ?>
   
	<!-- Agenda -->
Pierre Goubeaux's avatar
Pierre Goubeaux committed
183
	<div style="background-color: #ededed;" class="col-xs-12 text-center">
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
		<div>
			<h1 style="font-family:'Helvetica';color: #098048;">
				<i class="fa fa-calendar" aria-hidden="true"></i>  Agenda
			</h1>
		</div>

		<?= $this->renderPartial("costum.views.tpls.events.blockEventDescription", $params); ?>
	</div>

	<!-- Partenaires -->
	<div class="col-xs-12 text-center">
		<div>
			<h1 style="color: #098048;">
				Nos partenaires : 
			</h1>
			<center>
				<img class="img-responsive partenaires" style="" src="<?php echo Yii::app()->getModule('costum')->assetsUrl;?>/images/alternatiba/partenaire-01.jpg">
			</center>
		</div>
	</div>
Pierre Goubeaux's avatar
Pierre Goubeaux committed
204
205
206
207
</div>

<script type="text/javascript">
	jQuery(document).ready(function(){
Pierre Goubeaux's avatar
Pierre Goubeaux committed
208
		
Pierre Goubeaux's avatar
Pierre Goubeaux committed
209
		setTitle("Alternatiba");
Pierre Goubeaux's avatar
Pierre Goubeaux committed
210
211
212
213
214
215
216
217
218
219
		
		$("#afficheMap").click(function(){
	        if (document.getElementById("mapAlternatiba").style.display == "initial") {
	            document.getElementById("mapAlternatiba").style.display = "none";
	            $("#afficheUp").removeClass('fa fa-angle-double-up').addClass('fa fa-angle-double-down');
	        }else{
	            document.getElementById("mapAlternatiba").style.display = "initial";
	            $("#afficheUp").removeClass('fa fa-angle-double-down').addClass('fa fa-angle-double-up');
	        }
    	});
220
221
222
223
224
225

		var mapAlternatibaHome = {};
		var paramsMapAlternatiba  = {};

		initAlternatibaMapView();

Pierre Goubeaux's avatar
Pierre Goubeaux committed
226
		urlNews = "/news/co/index/type/"+costum.contextType+"/id/"+costum.contextId+"/formCreate/false/nbCol/1/scroll/false";
227
228

		ajaxPost("#newsstream",baseUrl+"/"+urlNews,{search:true, formCreate:false, scroll:false,nbCol : 1}, function(news){}, "html");
Pierre Goubeaux's avatar
Pierre Goubeaux committed
229

Pierre Goubeaux's avatar
Pierre Goubeaux committed
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
	});

	$("#second-search-bar").off().on("keyup",function(e){ 
                        $("#input-search-map").val($("#second-search-bar").val());
                        $("#second-search-xs-bar").val($("#second-search-bar").val());
                        if(e.keyCode == 13){
                                mylog.log("searchObject.text",searchObject.text);
                                searchObject.text=$(this).val();
                                searchObject.sourceKey=costum.slug;
                                myScopes.type="open";
                                myScopes.open={};
                                startGlobalSearch(0, indexStepGS);
                                $("#dropdown").css('display','block');
                         }  
});

$("#second-search-xs-bar").off().on("keyup",function(e){ 
                        $("#input-search-map").val($("#second-search-xs-bar").val());
                        $("#second-search-bar").val($("#second-search-xs-bar").val());
                        if(e.keyCode == 13){
                                mylog.log("searchObject.text",searchObject.text);
                                searchObject.text=$(this).val();
                                searchObject.sourceKey=costum.slug;
                                myScopes.type="open";
                                myScopes.open={};
                                startGlobalSearch(0, indexStepGS);
                                $("#dropdown").css('display','block');            
                        }
});

$("#second-search-bar-addon-alternatiba, #second-search-xs-bar-addon").off().on("click", function(){
                        $("#input-search-map").val($("#second-search-bar").val());
                        mylog.log("searchObject.text",searchObject.text);
                        searchObject.text=$("#second-search-bar").val();
                        searchObject.sourceKey=costum.slug;
                        myScopes.type="open";
                        myScopes.open={};
                        startGlobalSearch(0, indexStepGS);
                        $("#dropdown").css('display','block');
});	
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
300
301
302
303
304
305
306
307
308
309
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

	function initAlternatibaMapView(){
	alternatiba.initScopeObj();
	paramsMapAlternatiba = {
		zoom : 5,
		container : "mapAlternatiba",
		activePopUp : true,
		tile : "mapbox",
		menuRight : true,
		mapOpt:{
			latLon : ["-21.115141", "55.536384"],
		}
	};

	mapAlternatibaHome = mapObj.init(paramsMapAlternatiba);
	dataSearchAlternatiba=searchInterface.constructObjectAndUrl();
	dataSearchAlternatiba.searchType = ["organizations","events"];
	dataSearchAlternatiba.indexStep=0;
	alternatiba.mapDefault();
	// dataSearchPossession.searchType = ["NGO","LocalBusiness","Group","GovernmentOrganization"];
	dataSearchAlternatiba.private = true;
	dataSearchAlternatiba.sourceKey = costum.slug;
	ajaxPost(
		null,
		baseUrl+'/'+moduleId+'/search/globalautocomplete',
		dataSearchAlternatiba,
      	function(data){ 
	        mylog.log(">>> success autocomplete search !!!! ", data); //mylog.dir(data);
			if(!data){ 
				toastr.error(data.content); 
			} 
			else{ 
				// $('#mapContent').html('');
				mapAlternatibaHome.addElts(data.results, true);
				setTimeout(function(){
					mapAlternatibaHome.map.panTo([-21.115141,55.536384]);
					mapAlternatibaHome.map.setZoom(10);
				},2000);
			}
      	},
      	function(data){
            mylog.log(">>> error autocomplete search"); 
			mylog.dir(data);   
			$("#dropdown_search").html(data.responseText);  
			//signal que le chargement est terminé
			loadingData = false; 
        }
    );	
	
}

var alternatiba={
	initScopeObj : function(){
		$(".content-input-scope-possession").html(scopeObj);
		var params = {
			subParams : {
				cities : {
					type : ["cities"],
					country : ["RE"]
				}
			}
		}
		scopeObj.initVar(params);
		scopeObj.init();
	},
	mapDefault : function(){
		mapCustom.popup.default = function(data){
			mylog.log("mapCO mapCustom.popup.default", data);
			var id = (typeof data.id != "undefined") ? data.id :  data._id.$id ;

			var imgProfil = mapCustom.custom.getThumbProfil(data) ;

			var popup = "";
			popup += "<div class='padding-5' id='popup"+id+"'>";
				popup += "<img src='" + imgProfil + "' height='30' width='30' class='' style='display: inline; vertical-align: middle; border-radius:100%;'>";
				popup += "<span style='margin-left : 5px; font-size:18px'>" + data.name + "</span>";
				
				if (typeof data.email != "undefined" && data.email != null ){
					popup += "<div id='pop-contacts' class='popup-section'>";
						popup += "<div class='popup-subtitle'>Contact</div>";
							popup += "<div class='popup-info-profil'>";
								popup += "<i class='fa fa-envelope fa_email'></i> <a href='mailto:"+data.email+"'>" + data.email+"</a>";
							popup += "</div>";
						popup += "</div>";
					popup += "</div>";
				}

				if (data.type == "events") {
				popup += "<div class='popup-section'>";
					popup += "<a href='#page.type."+data.type+".id."+id+"' target='_blank' class='item_map_list popup-marker' id='popup"+id+"'>";
						popup += '<div class="btn btn-sm btn-more col-xs-12">';
						popup +=  "Consulter l'évènement";
					popup += '</div></a>';
				popup += '</div>';
				}

				if (data.type == "organizations") {
				popup += "<div class='popup-section'>";
					popup += "<a href='#page.type."+data.type+".id."+id+"' target='_blank' class='item_map_list popup-marker' id='popup"+id+"'>";
						popup += '<div class="btn btn-sm btn-more col-xs-12">';
						popup +=  "Accéder a l'organization";
					popup += '</div></a>';
				popup += '</div>';
				}
			popup += '</div>';
			return popup;
		};
	}
}
Pierre Goubeaux's avatar
Pierre Goubeaux committed
379
</script>