Exemple #1
0
    public function display_head()
    {
        // Obtenemos parametros
        $page = empty($_GET['page']) ? '' : $_GET['page'];
        $id_tema = empty($_GET['id_tema']) ? '' : $_GET['id_tema'];
        // Seguridad
        if (empty($_SESSION['logged_in'])) {
            $_SESSION['logged_in'] = false;
        }
        $db = new Db();
        $fnc = new Fnc();
        ?>

		<!DOCTYPE html>
		<html lang="es">
	    <head>
	        <meta charset="utf-8">
	        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	        <title><?php 
        echo $this->_title;
        ?>
</title>
	        <?php 
        // Si no tenemos una descripcion para la pagina, omitimos la meta etiqueta
        if (!empty($this->_description)) {
            ?>
        		<meta name="description" content="<?php 
            echo $this->_description;
            ?>
">
        		<?php 
        }
        // Creamos etiquetas meta para los articulos
        if (!empty($id_tema)) {
            // Obtenemos los datos del tema
            $result = $db->mysqli_select("SELECT info,doc,titulo,id_curso FROM temas WHERE id_tema='{$id_tema}' LIMIT 1");
            while ($row = $result->fetch_assoc()) {
                $info = empty($row['info']) ? '' : $row['info'];
                $doc = empty($row['doc']) ? '' : $row['doc'];
                $titulo = $row['titulo'];
                $id_curso = $row['id_curso'];
            }
            $result->close();
            // Obtenemos los detalles del curso
            $result2 = $db->mysqli_select("SELECT categoria,img FROM cursos WHERE id_curso='{$id_curso}'");
            while ($row2 = $result2->fetch_assoc()) {
                $categoria = $row2['categoria'];
                $img = $row2['img'];
            }
            $result2->close();
            ?>
      			<meta name="keywords" content="<?php 
            echo $fnc->keywords(strtolower($fnc->sanear_string($doc)));
            ?>
">

      			<!-- Twitter Card data //-->
				<meta name="twitter:card" value="summary">

      			<!-- Open Graph data //-->
      			<meta property="og:title" content="<?php 
            echo $titulo;
            ?>
 | Codeando.org">
      			<meta property="og:type" content="article">
				<meta property="og:url" content="http://codeando.org/<?php 
            echo strtolower($categoria);
            ?>
/<?php 
            echo strtolower($fnc->Url($titulo));
            ?>
/<?php 
            echo $id_tema;
            ?>
/">
				<meta property="og:image" content="http://codeando.org/img_curso/<?php 
            echo $img;
            ?>
">
				<meta property="og:description" content="<?php 
            echo $this->_description;
            ?>
">

				<link rel="canonical" href="http://codeando.org/<?php 
            echo strtolower($categoria);
            ?>
/<?php 
            echo strtolower($fnc->Url($titulo));
            ?>
/<?php 
            echo $id_tema;
            ?>
/">
      			<?php 
        }
        ?>

        	<meta name="author" content="Paulo.Andrade.1">
			<meta name="owner" content="Codeando">
			<meta name="robots" content="index, follow">

			<link rel="stylesheet" type="text/css" href="/css/min/main.css">
			<?php 
        // Cargamos los archivos css necesarios segun la pagina en la que estemos
        if ($page == 'platform') {
            ?>
<link rel="stylesheet" type="text/css" href="/css/min/platform.css"><?php 
        } else {
            ?>
<link rel="stylesheet" type="text/css" href="/css/min/inicio.css"><?php 
        }
        ?>
			<link rel="SHORTCUT ICON" href="/favicon.ico">
			<base href="/">
	    </head>
	    <body id="<?php 
        echo $this->_page;
        ?>
" ng-app="platform">
		<?php 
        // Mostramos pantalla cargando solo al ingresar a la Plataform
        if ($this->_page == 'plataforma') {
            ?>
			<div id='intro'>
				<div class="loader loader-white"></div>
				<div id="intro_text"><p>Please wait</p><p><span>Loading workspace</span></p></div>
			</div>
			<?php 
        }
        // Si existe un App ID Facebook cargamos el SDK Facebook
        if (!empty($this->_appId)) {
            ?>
	    	<div id="fb-root"></div>
	    	<script>
	    	function checkLoginState(page) {
				FB.login(function(response) {
					if (response.status === 'connected') {
						// Logueado en facebook y en la APP
						testAPI(page);
					}
				},{
					scope: 'email,user_friends,public_profile'
				});
			}	

			window.fbAsyncInit = function() {
				FB.init({
					status     : true,
					appId      : '<?php 
            echo $this->_appId;
            ?>
',
					cookie     : true,
					xfbml      : true,
					version    : 'v2.0'
				});
				/*
				FB.getLoginStatus(function(response) {
					statusChangeCallback(response);
					});
				*/
			};

			(function(d, s, id){
				var js, fjs = d.getElementsByTagName(s)[0];
				if (d.getElementById(id)) {return;}
				js = d.createElement(s); js.id = id;
				js.src = "//connect.facebook.net/es_LA/sdk.js";
				fjs.parentNode.insertBefore(js, fjs);
			}(document, 'script', 'facebook-jssdk'));
			</script>
			<?php 
        }
    }