live.php 9.11 KB
Newer Older
Kgneo's avatar
Kgneo committed
1
<?php 
Clément Damiens's avatar
 
Clément Damiens committed
2
    $cssAnsScriptFilesModule = array(
Clément Damiens's avatar
 
Clément Damiens committed
3
        '/js/default/search.js',
Clément Damiens's avatar
 
Clément Damiens committed
4 5 6
        //'/js/default/live.js',
    );
    HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, $this->module->assetsUrl);
Kgneo's avatar
Kgneo committed
7

Tristan Goguet's avatar
up live  
Tristan Goguet committed
8 9
    $page = "live";
    
Kgneo's avatar
Kgneo committed
10 11 12 13 14
    $layoutPath = 'webroot.themes.'.Yii::app()->theme->name.'.views.layouts.';
    //header + menu
    $this->renderPartial($layoutPath.'header', 
                        array(  "layoutPath"=>$layoutPath ,
                                "type" => @$type,
15 16
                                "page" => $page,
                                "dontShowMenu"=>true,
Clément Damiens's avatar
 
Clément Damiens committed
17
                                //"explain"=> "Live public : retrouvez tous les messages publics selon vos lieux favoris") 
Clément Damiens's avatar
 
Clément Damiens committed
18
                                ));
Tristan Goguet's avatar
up live  
Tristan Goguet committed
19
    $page = "live";
Kgneo's avatar
Kgneo committed
20
    //$randImg = 1;
21
$filliaireCategories = CO2::getContextList("filliaireCategories"); 
Clément Damiens's avatar
 
Clément Damiens committed
22
  
Kgneo's avatar
Kgneo committed
23
?>
24

Kgneo's avatar
Kgneo committed
25
<style>
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
     
	
   /* #formCreateNewsTemp .form-create-news-container{
    max-width: inherit !important;
	}
	.item-globalscope-checker.inactive{
        color:#DBBCC1 !important;
        border-bottom:0px;
        margin(top:-6px;)
    }
    .item-globalscope-checker:hover,
    .item-globalscope-checker:active,
    .item-globalscope-checker:focus{
        color:#e6344d !important;
        border-bottom:1px solid #e6344d;
        text-decoration: none !important;
    }
   


@media (min-width: 991px) {
    .subModuleTitle{
        width: 100% !important;
        margin-left: 11% !important;
    }
}*/
Clément Damiens's avatar
 
Clément Damiens committed
52 53 54 55 56 57 58 59
 #noMoreNews {
        position: relative;
        padding: 0px 40px;
        bottom: 0px;
        width: 100%;
        text-align: center;
        background: white;
    }
Tristan Goguet's avatar
Tristan Goguet committed
60 61 62 63 64 65 66 67 68
    #newsstream .loader,
    #noMoreNews{
       border-radius: 50px;
        margin-left: auto;
        margin-right: auto;
        display: table;
        padding: 15px;
        margin-top: 15px;
    }
Kgneo's avatar
Kgneo committed
69
</style>
Kgneo's avatar
Kgneo committed
70
<div class="row padding-10 bg-white live-container">
Kgneo's avatar
up  
Kgneo committed
71
<?php 
Clément Damiens's avatar
 
Clément Damiens committed
72 73 74 75
        //$CO2DomainName = Yii::app()->params["CO2DomainName"];
       // if($CO2DomainName == "kgougle"){ 
           //$this->renderPartial($layoutPath.'headers/pod/'.$CO2DomainName.'/dayQuestion', array());
        //} 
Kgneo's avatar
up  
Kgneo committed
76 77 78 79 80
    ?>

    <div class="col-md-12 col-sm-12 col-xs-12 bg-white top-page" id="" style="padding-top:0px!important;">
    	<div class="col-lg-1 col-md-1 hidden-sm hidden-xs text-right hidden-xs" id="sub-menu-left"></div>

Clément Damiens's avatar
 
Clément Damiens committed
81
    	<div class="col-lg-10 col-md-12 col-sm-12 col-xs-12 margin-top-10">
Kgneo's avatar
up  
Kgneo committed
82 83 84
    		<div id="newsstream"></div>
    	</div>	
    </div>
Kgneo's avatar
Kgneo committed
85 86 87
</div>


Tristan Goguet's avatar
up live  
Tristan Goguet committed
88
<?php $this->renderPartial($layoutPath.'footer.'.Yii::app()->params["CO2DomainName"], array("subdomain"=>$page)); ?>
Kgneo's avatar
up  
Kgneo committed
89

Kgneo's avatar
Kgneo committed
90 91 92

<script type="text/javascript" >

93
searchObject.initType="news";
Clément Damiens's avatar
 
Clément Damiens committed
94
var titlePage = "<?php echo @Yii::app()->session['paramsConfig']["pages"]["#".$page]["subdomainName"]; ?>";
95
var filliaireCategories = <?php echo json_encode( $filliaireCategories ) ?>;
Clément Damiens's avatar
 
Clément Damiens committed
96
var liveParams =<?php echo json_encode(@Yii::app()->session['paramsConfig']["pages"]["#".$page]); ?>;
Clément Damiens's avatar
 
Clément Damiens committed
97
//var loadContent = '<?php echo @$_GET["content"]; ?>';
Kgneo's avatar
Kgneo committed
98 99 100

jQuery(document).ready(function() {
	$(".subsub").hide();
Tristan Goguet's avatar
Tristan Goguet committed
101

Clément Damiens's avatar
Clément Damiens committed
102
	//initFilterLive();
Kgneo's avatar
Kgneo committed
103
	//showTagsScopesMin("#list_tags_scopes");
Clément Damiens's avatar
 
Clément Damiens committed
104 105 106
	//$("#btn-slidup-scopetags").click(function(){
     // slidupScopetagsMin();
    //});
Kgneo's avatar
Kgneo committed
107
	$('#btn-start-search').click(function(e){
Tristan Goguet's avatar
up live  
Tristan Goguet committed
108
		startNewsSearch(true);
Kgneo's avatar
Kgneo committed
109 110 111
    });
		
	
Clément Damiens's avatar
 
Clément Damiens committed
112
    
Clément Damiens's avatar
 
Clément Damiens committed
113
    //searchPage = true;
Clément Damiens's avatar
 
Clément Damiens committed
114
    initSearchObject();
Clément Damiens's avatar
 
Clément Damiens committed
115
	startNewsSearch(true);
Kgneo's avatar
Kgneo committed
116

Clément Damiens's avatar
 
Clément Damiens committed
117
    initKInterface({"affixTop":200});
Clément Damiens's avatar
 
Clément Damiens committed
118
    
Kgneo's avatar
Kgneo committed
119 120
    Sig.restartMap(Sig.map);

Clément Damiens's avatar
 
Clément Damiens committed
121 122 123 124
    $(".theme-header-filter").off().on("click",function(){
            if(!$("#filter-thematic-menu").is(":visible") || $(this).hasClass("toogle-filter"))
                $("#filter-thematic-menu").toggle();
    });
125 126
    $(".btn-news-type-filters").off().on("click", function(){
        keyType=$(this).data("key");
Clément Damiens's avatar
 
Clément Damiens committed
127 128 129 130
        searchObject.types= (keyType!="all") ? [keyType] : [];
        $(".btn-news-type-filters").removeClass("active"); 
        if(keyType!="all");
            $(this).addClass("active");
Clément Damiens's avatar
 
Clément Damiens committed
131
        if(keyType=="all")
Clément Damiens's avatar
Clément Damiens committed
132
            $(".dropdown-types .dropdown-toggle").removeClass("active").html(trad.type+" <i class='fa fa-angle-down'></i>");
Clément Damiens's avatar
 
Clément Damiens committed
133 134
        else    
            $(".dropdown-types .dropdown-toggle").addClass("active").html(tradCategory[$(this).data("label")]+" <i class='fa fa-angle-down'></i>");       
135 136 137
        startNewsSearch(true);
        KScrollTo("#content-social");
    });
Clément Damiens's avatar
 
Clément Damiens committed
138 139 140 141
    $(".btn-select-filliaire").off().on("click",function(){
        mylog.log(".btn-select-filliaire");
        var fKey = $(this).data("fkey");
        myMultiTags = {};
142
        tagsArray=[];
Clément Damiens's avatar
 
Clément Damiens committed
143 144
        $.each(filliaireCategories[fKey]["tags"], function(key, tag){
            tag=(typeof tradTags[tag] != "undefined") ? tradTags[tag] : tag;
145
            tagsArray.push(tag);
Clément Damiens's avatar
 
Clément Damiens committed
146
        });
147 148 149 150 151 152 153 154 155 156 157
        $('#tagsFilterInput').val(tagsArray).trigger("change");
    });
    $(".btn-tags-start-search").off().on("click", function(){
        searchObject.tags=($('#tagsFilterInput').val()!="") ? $('#tagsFilterInput').val().split(",") : [];
        searchObject.page=0;
        pageCount=true;
        searchObject.count=true;
        if(typeof searchObject.ranges != "undefined") searchAllEngine.initSearch();
        $(".dropdown-tags").removeClass("open");
        activeTagsFilter();
        startNewsSearch(true);
Clément Damiens's avatar
 
Clément Damiens committed
158
    });
159 160 161 162 163 164 165 166 167 168
    $(".btn-tags-refresh").off().on("click", function(){
        searchObject.tags=[];
        $('#tagsFilterInput-xs').val("").trigger("change");
        searchObject.page=0;
        pageCount=true;
        searchObject.count=true;
        $(".dropdown-tags").removeClass("open");
        activeTagsFilter();
        startNewsSearch(true);
    });
Clément Damiens's avatar
Clément Damiens committed
169 170
    if(searchObject.text != "") $(".main-search-bar, #second-search-bar").val(searchObject.text);

Clément Damiens's avatar
 
Clément Damiens committed
171
    $("#main-search-bar").keyup(function(e){
Kgneo's avatar
up live  
Kgneo committed
172
        $("#second-search-bar").val($(this).val());
Clément Damiens's avatar
 
Clément Damiens committed
173
        $("#main-search-xs-bar").val($(this).val());
Kgneo's avatar
up live  
Kgneo committed
174
        $("#input-search-map").val($(this).val());
Clément Damiens's avatar
 
Clément Damiens committed
175
        
Clément Damiens's avatar
 
Clément Damiens committed
176
        searchObject.text=$(this).val();
Clément Damiens's avatar
 
Clément Damiens committed
177
        if(e.keyCode == 13 || $(this).val() == ""){
Clément Damiens's avatar
Clément Damiens committed
178
            spinSearchAddon(true);
Tristan Goguet's avatar
Tristan Goguet committed
179
            startNewsSearch(true); 
Kgneo's avatar
up live  
Kgneo committed
180 181 182
            KScrollTo("#content-social");
        }
    });
Clément Damiens's avatar
 
Clément Damiens committed
183
    $("#main-search-xs-bar").keyup(function(e){
Kgneo's avatar
up live  
Kgneo committed
184
        $("#second-search-bar").val($(this).val());
Clément Damiens's avatar
 
Clément Damiens committed
185 186 187 188 189 190 191 192 193
        $("#main-search-bar").val($(this).val());
        $("#input-search-map").val($(this).val());
        searchObject.text=$(this).val();
        if(e.keyCode == 13 || $(this).val() == ""){
            spinSearchAddon(true);
            startNewsSearch(true); 
            KScrollTo("#content-social");
        }
    })
Kgneo's avatar
up live  
Kgneo committed
194
    $("#second-search-bar").keyup(function(e){
Clément Damiens's avatar
Clément Damiens committed
195
        $(".main-search-bar").val($(this).val());
Kgneo's avatar
up live  
Kgneo committed
196
        $("#input-search-map").val($(this).val());
Clément Damiens's avatar
 
Clément Damiens committed
197
        searchObject.text=$(this).val();
Clément Damiens's avatar
 
Clément Damiens committed
198
        if(e.keyCode == 13 || $(this).val() == ""){            
Tristan Goguet's avatar
up live  
Tristan Goguet committed
199
            startNewsSearch(true);
Kgneo's avatar
up live  
Kgneo committed
200 201 202 203 204 205
            KScrollTo("#content-social");
         }
    });

    $("#input-search-map").keyup(function(e){
        $("#second-search-bar").val($("#input-search-map").val());
Clément Damiens's avatar
Clément Damiens committed
206
        $(".main-search-bar").val($("#input-search-map").val());
Clément Damiens's avatar
 
Clément Damiens committed
207
        searchObject.text=$(this).val();
Kgneo's avatar
up live  
Kgneo committed
208
        if(e.keyCode == 13){
Tristan Goguet's avatar
up live  
Tristan Goguet committed
209
            startNewsSearch(true);
Kgneo's avatar
up live  
Kgneo committed
210 211
         }
    });
212
    /*, .menu-btn-start-search*/
Clément Damiens's avatar
Clément Damiens committed
213 214 215 216 217 218 219 220 221 222 223
    $("#main-btn-start-search, #main-search-bar-addon, #main-search-xs-bar-addon").click(function(){
        spinSearchAddon(true);
        if($(this).hasClass("menu-btn-start-search"))
            searchObject.text=$("#second-search-bar").val();
        else if ($(this).hasClass("input-group-addon-xs"))   
            searchObject.text=$("#main-search-xs-bar").val();
        else if ($(this).hasClass("input-group-addon"))   
            searchObject.text=$("#main-search-bar").val();
        else
            searchObject.text=$("#input-search-map").val();
        $("#second-search-bar, .main-search-bar, #input-search-map").val(searchObject.text);
Tristan Goguet's avatar
Tristan Goguet committed
224 225 226
        startNewsSearch(true);
    });
    $(".subModuleTitle .btn-refresh").click(function(){
Clément Damiens's avatar
Clément Damiens committed
227
        $(".main-search-bar").val("");
Tristan Goguet's avatar
Tristan Goguet committed
228
        $("#second-search-bar").val("");
Tristan Goguet's avatar
up live  
Tristan Goguet committed
229
        startNewsSearch(true);
Kgneo's avatar
up live  
Kgneo committed
230
    });
231 232 233 234 235 236
    $('.dropdown-menu[aria-labelledby="dropdownTags"]').on('click', function(event){
        // The event won't be propagated up to the document NODE and 
        // therefore delegated events won't be fired
        event.stopPropagation();
    });
    
Kgneo's avatar
Kgneo committed
237
    setTitle(titlePage, "stack-exchange", titlePage);
Clément Damiens's avatar
 
Clément Damiens committed
238 239
    //KScrollTo(".main-btn-scopes");
});
Clément Damiens's avatar
 
Clément Damiens committed
240 241
function startNewsSearch(isFirst){
    var urlCtrl = "/news/co/index/type/city/isLive/true";
Clément Damiens's avatar
 
Clément Damiens committed
242
    if(typeof liveParams != "undefined"){
Clément Damiens's avatar
 
Clément Damiens committed
243
       if(typeof liveParams.slug != "undefined" && notNull(costum))
244
            urlCtrl = "/news/co/index/type/"+costum.contextType+"/id/"+costum.contextId; 
Clément Damiens's avatar
 
Clément Damiens committed
245 246 247
       if(typeof liveParams.formCreate != "undefined")
            urlCtrl += "/formCreate/false";
    }
Clément Damiens's avatar
 
Clément Damiens committed
248 249 250 251 252 253
    var loading = "<div class='loader bold letter-blue shadow2 text-center'>"+
                    "<i class='fa fa-spin fa-circle-o-notch'></i> "+
                    "<span>"+trad.currentlyloading+" ...</span>" + 
                "</div>";
    $("#newsstream").html(loading);
    simpleScroll(0, 500);
254
    ajaxPost("#newsstream",baseUrl+"/"+urlCtrl,{search:true}, function(news){ spinSearchAddon();}, "html");
Clément Damiens's avatar
 
Clément Damiens committed
255
}
Kgneo's avatar
Kgneo committed
256 257

</script>