<?php
\n
\ndefined('BASEPATH') OR exit('No direct script access allowed');
\n
\nclass Ygg {
\n
\n    public static function manager_view($path, $data = array(), $pageTitle = '') 
\n\t{
\n\t\t$ci = &get_instance();
\n
\n\t    $components = array(
\n\t        'header' => $ci->load->view('manager/layout/components/header.inc.php', null, true),
\n\t        'footer'   => $ci->load->view('manager/layout/components/footer.inc.php', null, true),
\n\t        'content' => $ci->load->view('manager/'.$path, $data, true),
\n\t        'pageTitle' => $pageTitle
\n        );
\n
\n        $ci->load->view('manager/layout/layout', $components);
\n\t}
\n
\n\tpublic static function get_automatic_messages()
\n\t{
\n\t\t$ci = &get_instance();
\n
\n\t\t$messages = $ci->db->select('id, type, name, instant_publish, publish_date, periodicity, instant_publish')->get('messages_auto')->result();
\n
\n\t\treturn $messages;
\n\t}
\n
\n
\n\tpublic static function get_ascent_timetamp($periodicity)
\n\t{
\n\t\t$arr = explode('|', $periodicity);\t\t\t
\n  \t\t$days = [null, 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];  \t\t
\n    \t$date_str  =  date('Y-m-d', strtotime('previous '.$days[$arr[0]], strtotime('tomorrow'))) . ' '.$arr[1];
\n    \t$dtime \t   = DateTime::createFromFormat("Y-m-d G:i", $date_str);
\n\t\t
\n\t\treturn $dtime->getTimestamp();
\n\t}
\n
\n\tpublic function get_friendly_ascent_format($periodicity)
\n\t{
\n\t\t$arr = explode('|', $periodicity);\t\t\t
\n  \t\t$days = [null, 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche'];  \t
\n
\n  \t\treturn $days[$arr[0]].' à '.$arr[1];
\n\t}
\n}