page.php 8.98 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"];
Kgneo's avatar
Kgneo committed
12 13
    if($this->module->id != "network" && 
        ($type!=Product::COLLECTION || 
Clément Damiens's avatar
 
Clément Damiens committed
14
        ($element["creator"]==Yii::app()->session["userId"] && $view != "show")) && !in_array($view, $onepageKey))
Kgneo's avatar
Kgneo committed
15 16
    //le param USEHEADER de params.json sert à afficher ou non le header, 
    //donc normalement pas besoin de faire de IF ici
Raphael's avatar
Raphael committed
17
        $this->renderPartial($layoutPath.'header', 
Kgneo's avatar
Kgneo committed
18
                        array(  "layoutPath"=>$layoutPath , 
19
                                "page" => "page",
Clément Damiens's avatar
 
Clément Damiens committed
20 21
                                "dontShowMenu"=>true,
                                "useFilter"=>false) ); 
Kgneo's avatar
Kgneo committed
22 23 24
?>

<div class="col-md-12 col-sm-12 col-xs-12 no-padding social-main-container">
Kgneo's avatar
Kgneo committed
25
	<div class="" id="onepage">
Raphael's avatar
Raphael committed
26
		<?php 
Kgneo's avatar
Kgneo committed
27
            if($type == Person::COLLECTION  || $type == Event::COLLECTION || 
28 29
               $type == Project::COLLECTION || $type == Organization::COLLECTION || 
               $type == Place::COLLECTION){
Kgneo's avatar
Kgneo committed
30
    			$params = array("element"=>$element , 
Tibor Katelbach's avatar
Tibor Katelbach committed
31 32
                                "id" => @$id,
                                "type" => @$type,
Kgneo's avatar
Kgneo committed
33 34 35 36 37 38 39 40 41 42 43 44
    							"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
45
                //error_log($params);
46
                if(Yii::app()->params["CO2DomainName"] == "terla")
Tibor Katelbach's avatar
Tibor Katelbach committed
47
                    $this->renderPartial('co2.views.element.terla.index', $params );
48
                else if(in_array($view, $onepageKey)) 
Tibor Katelbach's avatar
Tibor Katelbach committed
49
                    $this->renderPartial("co2.views.element.onepage", $params);
Kgneo's avatar
Kgneo committed
50
                else 
Tibor Katelbach's avatar
Tibor Katelbach committed
51
                    $this->renderPartial('co2.views.element.profilSocial', $params ); 
Kgneo's avatar
Kgneo committed
52 53 54 55 56 57 58 59 60 61 62 63
            }

            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
64
                $this->renderPartial('news.views.co.standalone', $params ); 
Kgneo's avatar
Kgneo committed
65 66
            }

67 68 69 70 71 72 73 74 75 76
            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
77
                    $this->renderPartial('co2.views.element.terla.dashboard', $params );
78
                else
Tibor Katelbach's avatar
Tibor Katelbach committed
79
                    $this->renderPartial('co2.views.element.standalone', $params ); 
80 81 82 83 84 85 86
            }
            if($type == Service::COLLECTION){
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );
Kgneo's avatar
up  
Kgneo committed
87

88 89 90
                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
91
                    $this->renderPartial('co2.views.element.terla.dashboard', $params );
92
                else
Tibor Katelbach's avatar
Tibor Katelbach committed
93
                    $this->renderPartial('co2.views.element.standalone', $params ); 
94
            }
Kgneo's avatar
up  
Kgneo committed
95 96 97 98 99 100 101
            if($type == Survey::COLLECTION){
                $params = array("survey"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

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

Kgneo's avatar
Kgneo committed
105
            if($type == Classified::COLLECTION){
Kgneo's avatar
Kgneo committed
106 107 108 109 110 111
                $params = array("element"=>$element , 
                                "page" => "page",
                                "type" => $type,
                                "controller" => $controller,
                                );

Kgneo's avatar
Kgneo committed
112 113 114
                if(@$members) $params["members"] = $members;
                if(@$invitedMe) $params["invitedMe"] = $invitedMe;

Clément Damiens's avatar
 
Clément Damiens committed
115
                $this->renderPartial('eco.views.co.standalone', $params ); 
Kgneo's avatar
Kgneo committed
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
                
            }

            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
139
                $this->renderPartial('co2.views.poi.standalone', $params ); 
Kgneo's avatar
Kgneo committed
140
            }
Raphael's avatar
Raphael committed
141 142
		?>
	</div>
Kgneo's avatar
Kgneo committed
143 144 145 146 147 148 149
</div>


<script type="text/javascript" >

var type = "<?php echo $type; ?>";
var id = "<?php echo $id; ?>";
150
var view = "<?php echo @$view; ?>";
Kgneo's avatar
Kgneo committed
151 152
var indexStepGS = 20;

Kgneo's avatar
Kgneo committed
153
jQuery(document).ready(function() {
154
    
Kgneo's avatar
Kgneo committed
155
	initKInterface({"affixTop":0});
Clément Damiens's avatar
 
Clément Damiens committed
156
	//$("#mainNav").addClass("affix");
Clément Damiens's avatar
Clément Damiens committed
157
	initPageInterface();
Raphael's avatar
Raphael committed
158
    // var tpl = '<?php //echo @$_GET["tpl"] ? $_GET["tpl"] : "profilSocial"; ?>';
Kgneo's avatar
Kgneo committed
159 160 161
	// getAjax('#onepage' ,baseUrl+'/'+moduleId+"/element/detail/type/"+type+"/id/"+id+"/view/"+view+"?tpl="+tpl,function(){ 
	// 	initPageInterface();
	// },"html");
Kgneo's avatar
Kgneo committed
162 163
});

Kgneo's avatar
Kgneo committed
164 165 166 167 168 169 170 171 172

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
173
    $("#second-search-bar").keyup(function(e){ console.log("keyup #second-search-bar");
Kgneo's avatar
Kgneo committed
174
        $("#input-search-map").val($("#second-search-bar").val());
Clément Damiens's avatar
 
Clément Damiens committed
175
        $("#second-search-xs-bar").val($("#second-search-bar").val());
Kgneo's avatar
Kgneo committed
176
        if(e.keyCode == 13){
Clément Damiens's avatar
 
Clément Damiens committed
177
            searchObject.text=$(this).val();
178 179
            myScopes.type="open";
            myScopes.open={};
180 181
            //urlCtrl.loadByHash("#search");
            startGlobalSearch(0, indexStepGS);
Kgneo's avatar
Kgneo committed
182 183
         }
    });
Clément Damiens's avatar
 
Clément Damiens committed
184 185 186 187 188 189 190 191 192 193 194 195
    $("#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(){
196 197 198 199 200 201 202
        $("#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
203
    
Kgneo's avatar
up  
Kgneo committed
204
    $("#input-search-map").keyup(function(e){ console.log("keyup #input-search-map");
Kgneo's avatar
Kgneo committed
205 206 207 208 209 210 211
        $("#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
212
        $("#second-search-bar").val($("#input-search-map").val());
Kgneo's avatar
Kgneo committed
213 214 215 216 217 218 219
        startGlobalSearch(0, indexStepGS);
    });

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

Kgneo's avatar
up  
Kgneo committed
220 221 222 223
    $(".tooltips").tooltip();
   
    $('.sub-menu-social').affix({
      offset: {
Kgneo's avatar
Kgneo committed
224
          top: 320
Kgneo's avatar
up  
Kgneo committed
225 226
      }
    });
Kgneo's avatar
Kgneo committed
227 228 229 230 231
    //$(".dropdown-result-global-search").hide();
    

}

Kgneo's avatar
Kgneo committed
232
</script>