page.php 9.81 KB
Newer Older
Kgneo's avatar
Kgneo committed
1
<?php 
Kgneo's avatar
Kgneo committed
2
    
Clément Damiens's avatar
 
Clément Damiens committed
3
    //$this->renderPartial("co2.views.news.newsAssets");
Kgneo's avatar
Kgneo committed
4

Kgneo's avatar
Kgneo committed
5
	HtmlHelper::registerCssAndScriptsFiles( array('/css/default/directory.css') , Yii::app()->theme->baseUrl. '/assets');
Kgneo's avatar
Kgneo committed
6
	//$cssAnsScriptFilesModule = array('');
Kgneo's avatar
Kgneo committed
7
	//HtmlHelper::registerCssAndScriptsFiles($cssAnsScriptFilesModule, $this->module->assetsUrl);
Kgneo's avatar
Kgneo committed
8
    
Kgneo's avatar
Kgneo committed
9 10
    $layoutPath = 'webroot.themes.'.Yii::app()->theme->name.'.views.layouts.';
    //header + menu
Clément Damiens's avatar
 
Clément Damiens committed
11
    $onepageKey = @Yii::app()->session['paramsConfig']["onepageKey"];
Raph El's avatar
Raph El committed
12 13 14 15
    //var_dump($this->module->id); exit;

    //Rest::json(array("view" => $view, "onepageKey" => $onepageKey)); exit ;
    if( $this->module->id != "network" && 
Clément Damiens's avatar
 
Clément Damiens committed
16 17
        /*(   $type!=Product::COLLECTION || 
            ($element["creator"]==Yii::app()->session["userId"] && $view != "show") )*/
Raph El's avatar
Raph El committed
18 19 20 21 22 23 24 25 26 27 28
        !empty($onepageKey) &&
        !in_array($view, $onepageKey) ){
            //le param USEHEADER de params.json sert à afficher ou non le header, 
        //donc normalement pas besoin de faire de IF ici
            $this->renderPartial($layoutPath.'header', 
                            array(  "layoutPath"=>$layoutPath , 
                                    "page" => "page",
                                    "dontShowMenu"=>true,
                                    "useFilter"=>false) ); 
    }

Kgneo's avatar
Kgneo committed
29 30 31
?>

<div class="col-md-12 col-sm-12 col-xs-12 no-padding social-main-container">
Kgneo's avatar
Kgneo committed
32
	<div class="" id="onepage">
Raphael's avatar
Raphael committed
33
		<?php 
Kgneo's avatar
Kgneo committed
34
            if($type == Person::COLLECTION  || $type == Event::COLLECTION || 
35 36
               $type == Project::COLLECTION || $type == Organization::COLLECTION || 
               $type == Place::COLLECTION){
Kgneo's avatar
Kgneo committed
37
    			$params = array("element"=>$element , 
Tibor Katelbach's avatar
Tibor Katelbach committed
38 39
                                "id" => @$id,
                                "type" => @$type,
Kgneo's avatar
Kgneo committed
40 41 42 43 44 45 46 47 48 49 50 51
    							"page" => "page",
    							"edit"=>$edit,
    							"openEdition" => $openEdition,
    							"linksBtn" => $linksBtn,
    							"isLinked" => $isLinked,
    							"controller" => $controller,
    							"countStrongLinks" => $countStrongLinks,
    							"countInvitations" => $countInvitations,
    							"countries" => $countries );

                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;
Raph El's avatar
Raph El committed
52
                //Rest::json(array("view" => $view, "onepageKey" => $onepageKey)); exit ;
53
                if(Yii::app()->params["CO2DomainName"] == "terla")
Tibor Katelbach's avatar
Tibor Katelbach committed
54
                    $this->renderPartial('co2.views.element.terla.index', $params );
Tibor Katelbach's avatar
Tibor Katelbach committed
55 56
                else if(!empty($view) && !empty($onepageKey) && in_array($view, $onepageKey)) {
                    
Tibor Katelbach's avatar
Tibor Katelbach committed
57
                    $this->renderPartial("co2.views.element.onepage", $params);
Tibor Katelbach's avatar
Tibor Katelbach committed
58
                }
Kgneo's avatar
Kgneo committed
59
                else 
Tibor Katelbach's avatar
Tibor Katelbach committed
60
                    $this->renderPartial('co2.views.element.profilSocial', $params ); 
Kgneo's avatar
Kgneo committed
61 62 63 64 65 66 67 68 69 70 71 72
            }

            if($type == News::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;

Clément Damiens's avatar
 
Clément Damiens committed
73
                $this->renderPartial('news.views.co.standalone', $params ); 
Kgneo's avatar
Kgneo committed
74 75
            }

76 77 78 79 80 81 82 83 84 85
            if($type == Product::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;
                if(($element["creator"]==Yii::app()->session["userId"] || @Yii::app()->session["superAdmin"]) && $view != "show")
Tibor Katelbach's avatar
Tibor Katelbach committed
86
                    $this->renderPartial('co2.views.element.terla.dashboard', $params );
87
                else
Tibor Katelbach's avatar
Tibor Katelbach committed
88
                    $this->renderPartial('co2.views.element.standalone', $params ); 
89 90 91 92 93 94 95
            }
            if($type == Service::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );
Kgneo's avatar
up  
Kgneo committed
96

97 98 99
                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;
                if($element["creator"]==Yii::app()->session["userId"] && $view != "show")
Tibor Katelbach's avatar
Tibor Katelbach committed
100
                    $this->renderPartial('co2.views.element.terla.dashboard', $params );
101
                else
Tibor Katelbach's avatar
Tibor Katelbach committed
102
                    $this->renderPartial('co2.views.element.standalone', $params ); 
103
            }
Kgneo's avatar
up  
Kgneo committed
104 105 106 107 108 109 110
            if($type == Survey::COLLECTION){
                $params = array("survey"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

Tibor Katelbach's avatar
Tibor Katelbach committed
111
                $this->renderPartial('co2.views.survey.entryStandalone', $params ); 
Kgneo's avatar
up  
Kgneo committed
112
            }
Kgneo's avatar
Kgneo committed
113

Kgneo's avatar
Kgneo committed
114
            if($type == Classified::COLLECTION){
Kgneo's avatar
Kgneo committed
115 116 117 118 119 120
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

Kgneo's avatar
Kgneo committed
121 122 123
                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;

Clément Damiens's avatar
 
Clément Damiens committed
124
                $this->renderPartial('eco.views.co.standalone', $params ); 
Kgneo's avatar
Kgneo committed
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
                
            }

            if($type == Ressource::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;

                $this->renderPartial('ressources.views.co.standalone', $params ); 
                
            }

            if($type == Poi::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );
Tibor Katelbach's avatar
Tibor Katelbach committed
148
                $this->renderPartial('co2.views.poi.standalone', $params ); 
Kgneo's avatar
Kgneo committed
149
            }
Raphael's avatar
Raphael committed
150 151
		?>
	</div>
Kgneo's avatar
Kgneo committed
152
</div>
Clément Damiens's avatar
 
Clément Damiens committed
153
<?php $this->renderPartial($layoutPath.'footer', 
Clément Damiens's avatar
Clément Damiens committed
154
                            array(  "page" => "page" )); 
Clément Damiens's avatar
 
Clément Damiens committed
155
?>
Kgneo's avatar
Kgneo committed
156 157 158 159
<script type="text/javascript" >

var type = "<?php echo $type; ?>";
var id = "<?php echo $id; ?>";
160
var view = "<?php echo @$view; ?>";
Kgneo's avatar
Kgneo committed
161 162
var indexStepGS = 20;

Kgneo's avatar
Kgneo committed
163
jQuery(document).ready(function() {
164
    
Kgneo's avatar
Kgneo committed
165
	initKInterface({"affixTop":0});
Clément Damiens's avatar
 
Clément Damiens committed
166
	//$("#mainNav").addClass("affix");
Clément Damiens's avatar
Clément Damiens committed
167
	initPageInterface();
Raphael's avatar
Raphael committed
168
    // var tpl = '<?php //echo @$_GET["tpl"] ? $_GET["tpl"] : "profilSocial"; ?>';
Kgneo's avatar
Kgneo committed
169 170 171
	// getAjax('#onepage' ,baseUrl+'/'+moduleId+"/element/detail/type/"+type+"/id/"+id+"/view/"+view+"?tpl="+tpl,function(){ 
	// 	initPageInterface();
	// },"html");
Kgneo's avatar
Kgneo committed
172 173
});

Kgneo's avatar
Kgneo committed
174 175 176 177 178 179 180 181 182

function initPageInterface(){

	$("#second-search-bar").addClass("input-global-search");

    $("#main-btn-start-search, .menu-btn-start-search").click(function(){
        startGlobalSearch(0, indexStepGS);
    });

Clément Damiens's avatar
 
Clément Damiens committed
183
    $("#second-search-bar").keyup(function(e){ console.log("keyup #second-search-bar");
Kgneo's avatar
Kgneo committed
184
        $("#input-search-map").val($("#second-search-bar").val());
Clément Damiens's avatar
 
Clément Damiens committed
185
        $("#second-search-xs-bar").val($("#second-search-bar").val());
Kgneo's avatar
Kgneo committed
186
        if(e.keyCode == 13){
Clément Damiens's avatar
 
Clément Damiens committed
187
            searchObject.text=$(this).val();
188 189
            myScopes.type="open";
            myScopes.open={};
190 191
            //urlCtrl.loadByHash("#search");
            startGlobalSearch(0, indexStepGS);
Kgneo's avatar
Kgneo committed
192 193
         }
    });
Clément Damiens's avatar
 
Clément Damiens committed
194 195 196 197 198 199 200 201 202 203 204 205
    $("#second-search-xs-bar").keyup(function(e){ console.log("keyup #second-search-bar");
        $("#input-search-map").val($("#second-search-xs-bar").val());
        $("#second-search-bar").val($("#second-search-xs-bar").val());
        if(e.keyCode == 13){
            searchObject.text=$(this).val();
            myScopes.type="open";
            myScopes.open={};
            //urlCtrl.loadByHash("#search");
            startGlobalSearch(0, indexStepGS);
         }
    });
     $("#second-search-bar-addon, #second-search-xs-bar-addon").off().on("click", function(){
206 207 208 209 210 211 212
        $("#input-search-map").val($("#second-search-bar").val());
        searchObject.text=$("#second-search-bar").val();
        myScopes.type="open";
        myScopes.open={};
            //urlCtrl.loadByHash("#search");
            startGlobalSearch(0, indexStepGS);
    });
Kgneo's avatar
Kgneo committed
213
    
Kgneo's avatar
up  
Kgneo committed
214
    $("#input-search-map").keyup(function(e){ console.log("keyup #input-search-map");
Kgneo's avatar
Kgneo committed
215 216 217 218 219 220 221
        $("#second-search-bar").val($("#input-search-map").val());
        if(e.keyCode == 13){
            startGlobalSearch(0, indexStepGS);
         }
    });

    $("#menu-map-btn-start-search").click(function(){
Kgneo's avatar
Kgneo committed
222
        $("#second-search-bar").val($("#input-search-map").val());
Kgneo's avatar
Kgneo committed
223 224 225 226 227 228 229
        startGlobalSearch(0, indexStepGS);
    });

    $(".social-main-container").mouseenter(function(){
    	$(".dropdown-result-global-search").hide();
    });

Kgneo's avatar
up  
Kgneo committed
230
    $(".tooltips").tooltip();
Clément Damiens's avatar
 
Clément Damiens committed
231
    affixPageMenu=$("#header-banner").outerHeight()+$("#mainNav").outerHeight()+$("#contentBanner").outerHeight()-$('.sub-menu-social').outerHeight();
Kgneo's avatar
up  
Kgneo committed
232 233
    $('.sub-menu-social').affix({
      offset: {
Clément Damiens's avatar
 
Clément Damiens committed
234
          top: affixPageMenu
Kgneo's avatar
up  
Kgneo committed
235 236
      }
    });
Clément Damiens's avatar
 
Clément Damiens committed
237 238 239 240 241 242
    $(".sub-menu-social").on('affixed.bs.affix', function(){
        $(this).css({"top":$("#mainNav").outerHeight()});
    });
    $(".sub-menu-social").on('affixed-top.bs.affix', function(){
         $(this).css({"top":"initial"});
    });
Kgneo's avatar
Kgneo committed
243 244 245 246 247
    //$(".dropdown-result-global-search").hide();
    

}

Kgneo's avatar
Kgneo committed
248
</script>