Re: Implementar calendario en znetdk

35 views
Skip to first unread message
Message has been deleted

Jose Puertas

unread,
Feb 3, 2017, 4:13:01 PM2/3/17
to ZnetDK
Hola Pascal, al final me he decidido por el plugin fullcalendar, pero sigo teniendo el mismo problema a la hora de hacer que znetdk implemente los js y css sin modificar el core(cosa que no voy a hacer), además en el servidor local (localhost), me funciona perfectamente, pero cuando lo pongo en un hosting remoto me da el siguiente error:

"Call to a member function fetch_array() on a non-object - /var/www/vhost/e1valencia.com/home/html/gestion/applications/default/app/view/fisioo.php(47)"

aqui el codigo que estoy usando:

<?php require_once("config.php"); ?>






<link href="css/bootstrap.min.css" rel="stylesheet" />
<link href="css/material-dashboard.css" rel="stylesheet"/>
<!--link href="assets/font-awesome/css/font-awesome.min.css" rel="stylesheet"-->
<!--script src="assets/js/jquery.min.js" type="text/javascript"></script-->


<link href='js/fullcalendar.min.css' rel='stylesheet' />
<link href='js/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='js/moment.min.js'></script>
<script src='js/fullcalendar.min.js'></script>
<script src='js/locale-all.js'></script>
<script src='js/es.js'></script>


<!--body-->
<?php


class ReservasData {


   
public static $tablename = "tcalendario";


   
public function ReservasData() {
        $this
->name = "";
        $this
->lastname = "";
        $this
->email = "";
        $this
->password = "";
        $this
->created_at = "NOW()";
   
}


   
public static function getEvery() {
        $dbhost
= "localhost";


        $dbname
= "clube1";
        $dbuser
= "root";
        $dbpass
= "";
        $db
= new mysqli($dbhost, $dbuser, $dbpass, $dbname);
        $sql
= "select * from " . self::$tablename;
        $query
= array($db->query($sql), $db->insert_id);
       
return self::many($query[0], new ReservasData());
   
}


   
public static function many($query, $aclass) {
        $cnt
= 0;
        $array
= array();
       
while ($r = $query->fetch_array()) {
            $array
[$cnt] = new $aclass;
            $cnt2
= 1;
           
foreach ($r as $key => $v) {
               
if ($cnt2 > 0 && $cnt2 % 2 == 0) {
                    $array
[$cnt]->$key = $v;
               
}
                $cnt2
++;
           
}
            $cnt
++;
       
}
       
return $array;
   
}


}


$thejson
= null;
$events
= ReservasData::getEvery();
foreach ($events as $event) {
    $thejson
[] = array("title" => $event->title, "start" => $event->date_at . "T" . $event->time_at);
}
?>






<script>
    $
(document).ready(function () {


        $
('#calendar').fullCalendar({
         
            header
: {


                left
: 'prev,next today',
                center
: 'title',
                right
: 'month,listMonth'
           
},


            defaultDate
: '<?php echo date('Y-m-d'); ?>',
            defaultView
:'listMonth',
            editable
: false,
            navLinks
: true,
            timeFormat
: 'H(:mm)', // uppercase H for 24-hour clock
            weekNumbers
: true,
            weekNumbersWithinDays
: true,
            weekNumberCalculation
: 'ISO',
            businessHours
: true,
            eventLimit
: true, // allow "more" link when too many events
            events
: <?php echo json_encode($thejson); ?>


       
});


   
});


</script>


<script>
    $
('#refresh_cal').puibutton();
    $
("#zdk_cal_act .bt-refresh_cal").click(function () {
       
 $('#calendar').fullCalendar( 'refetchEvents' );
// aqui estoy intentando hacer que se refresque la vista, pero no lo hace,

   
});
</script>
<div class="card-content table-responsive" id="zdk_cal_act" >
   
<button class="bt-refresh_cal" id="refresh_cal">Actualizar</button>
   
<div id="calendar"></div>
</div>


Saludos

Jose Puertas

unread,
Feb 4, 2017, 12:14:50 PM2/4/17
to ZnetDK
Hola Pascal, ya he solucionado el problema del fetch_array(), necesito que me ayudes para el tema de los js y css y cómo actualizar la vista para que recargue el full calendar, yo lo hago asi:

<script>
    $
('#refresh_cal').puibutton();
    $
("#zdk_cal_act .bt-refresh_cal").click(function () {
        $
('#calendar').fullCalendar( 'refetchEvents' );
// aqui estoy intentando hacer que se refresque la vista, pero no lo hace,

   
});
</script>

Pero no funciona.

Saludos

Jose Puertas

unread,
Mar 31, 2017, 6:28:50 AM3/31/17
to ZnetDK
Solucionado, gracias
Reply all
Reply to author
Forward
0 new messages