public function generarTurnos($agenda_id = NULL)
 {
     $errores = true;
     if (empty($agenda_id)) {
         $agendas = Agenda::whereNotIn('id', function ($query) {
             $query->select('agenda_id')->from('turnos');
         })->where('habilitado_turnos', '=', 1)->get();
     } else {
         $agendas = Agenda::where('id', $agenda_id)->get();
     }
     foreach ($agendas as $agenda) {
         $coe = $agenda->centroOdontologoEspecialidad;
         $horario_desde = date('H:i', strtotime(substr_replace($coe->horario_desde, ':', 2, 0)));
         $horario_hasta = date('H:i', strtotime(substr_replace($coe->horario_hasta, ':', 2, 0)));
         $duracion = $coe->duracion_turno;
         $hora = $horario_desde;
         $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         $turnos = array();
         while (strtotime($hora) < strtotime($horario_hasta)) {
             $turno = array();
             $turno["agenda_id"] = $agenda->id;
             $turno["hora_desde"] = str_replace(":", "", $hora);
             $turno["hora_hasta"] = str_replace(":", "", $hora_hasta);
             $turno["tipo_turno"] = 'T';
             // turno
             $turno["estado"] = 'L';
             // libre
             $turno["created_at"] = date("Y-m-d H:i:s");
             $turno["updated_at"] = date("Y-m-d H:i:s");
             $turnos[] = $turno;
             $hora = $hora_hasta;
             $hora_hasta = date('H:i', strtotime("+" . $duracion . " minutes", strtotime($hora)));
         }
         $e = Turno::insert($turnos);
         if (!$e) {
             $errores = false;
         }
     }
     return $errores;
 }
Exemplo n.º 2
0
 /**
  * Class constructor
  * Creates the page
  */
 function __construct()
 {
     parent::__construct();
     try {
         TTransaction::open("sample");
         $evento = new Agenda(R);
         $evento->nome = "Curso Adianti framework";
         $evento->lugar = "Progs Scholl alterado";
         $evento->descricao = "Curso basico";
         $evento->data_ev = date("Y-m-d");
         $evento->hora_ev = date("h:m:");
         $evento->store();
         TTransaction::close();
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     TPage::include_css('app/resources/styles.css');
     $this->html = new THtmlRenderer('app/resources/wellcome.html');
     // define replacements for the main section
     $replace = array();
     // replace the main section variables
     $this->html->enableSection('main', $replace);
     // add the template to the page
     parent::add($this->html);
 }
Exemplo n.º 3
0
 public function actionCadastrar()
 {
     if ($this->request->isPostRequest) {
         $cadastrarAgenda = new Agenda();
         $cadastrarAgenda->agenda = $this->request->getPost('agenda');
         $cadastrarAgenda->save();
     }
 }
Exemplo n.º 4
0
 public function excluir()
 {
     $agenda = new Agenda();
     $agenda->setCodigoAge(toNumero(GetVar('EventId')));
     $agendaDAO = new AgendaDAO();
     $return = $agendaDAO->excluir($agenda);
     $result = $return ? 'Registro Excluido com sucesso.' : 'Erro ao Excluir Registro.';
     echo json_encode(array("success" => is_string($return) ? false : $return, "msg" => is_string($return) ? $return : $result));
 }
 public function insert($param)
 {
     switch ($_SERVER['REQUEST_METHOD']) {
         case 'GET':
             if (isset($_SESSION['user'])) {
                 $this->load->model("Activite");
                 $jour = substr($param, 0, 2);
                 $mois = substr($param, 2, 2);
                 $annee = substr($param, 4, 4);
                 $heureDebut = substr($param, 8, 2)[0] == '0' ? substr($param, 9, 1) . 'h' : substr($param, 8, 2) . 'h';
                 $heureFin = substr($param, 10, 2)[0] == '0' ? substr($param, 11, 1) . 'h' : substr($param, 10, 2) . 'h';
                 $activites = Activite::getAll();
                 $date = new \DateTime($annee . '-' . $mois . '-' . $jour);
                 setlocale(LC_TIME, 'fr_FR.utf8', 'fra');
                 $titre = ucfirst(strftime("%A", $date->getTimestamp())) . ' ' . $date->format('d') . ' ' . ucfirst(strftime("%B", $date->getTimestamp())) . ' - ' . $heureDebut . '-' . $heureFin;
                 $data['titre'] = $titre;
                 $data["hidden"] = $date->format('Y-m-d') . '|' . $heureDebut . ':' . $heureFin;
                 $data['activites'] = $activites;
                 $this->load->view("ajoutActiviteAgenda", $data);
             } else {
                 $_SESSION['messagee'] = "Erreur, accès refusé";
                 header('Location: ' . BASEURL);
                 exit;
             }
             break;
         case 'POST':
             if (isset($_SESSION['user']) && isset($_POST['redondance']) && $_POST['redondance'] != null) {
                 $this->load->model("Agenda");
                 $dateHeure = preg_split('/[|]/', $_POST['dateDebut']);
                 $dateDebut = new \DateTime($dateHeure[0] . '00:00:01');
                 $redondance = $_POST['redondance'];
                 $dateFin = date_modify(new \DateTime($dateHeure[0] . '23:59:59'), "+ " . $redondance . ' week');
                 $hDebut = preg_split('/[:]/', $dateHeure[1])[0];
                 $heureMinuteSecondeDebut = preg_split('/h/', $hDebut);
                 $hFin = preg_split('/[:]/', $dateHeure[1])[1];
                 $heureMinuteSecondeFin = preg_split('/h/', $hFin);
                 $heureDebut = $heureMinuteSecondeDebut[1] != "" ? $heureMinuteSecondeDebut[0] . ':' . $heureMinuteSecondeDebut[1] . ':00' : $heureMinuteSecondeDebut[0] . ':00:00';
                 $heureFin = $heureMinuteSecondeFin[1] != "" ? $heureMinuteSecondeFin[0] . ':' . $heureMinuteSecondeFin[1] . ':00' : $heureMinuteSecondeFin[0] . ':00:00';
                 $idActivite = $_POST['activite'];
                 $jour = $dateDebut->format('N');
                 $ajoutActivite = new Agenda(null, $idActivite, $dateDebut->format("Y-m-d H:i:s"), $dateFin->format("Y-m-d H:i:s"), $jour, $heureDebut, $heureFin);
                 $ajoutActivite->create();
                 header('Location: ' . base_url() . '/index.php/agendaActivite/gestion');
                 exit;
             }
             break;
     }
 }
 public function gestionAgendaActivite()
 {
     $this->load->model("Activite");
     $this->load->model("Agenda");
     $data['listAgenda'] = Agenda::getAll();
     $this->load->view("gestionAgendaActivite", $data);
 }
 public function emploiDuTemps($id)
 {
     $this->load->helper("Date_helper");
     $semaines = week2period(date("Y"), date("W"));
     $this->load->model("Agenda");
     $x = Agenda::getById($id);
     $data['listAgenda'] = $x;
     $tab = [];
     foreach ($x as $y) {
         $z = true;
         $date = date('d-m-Y', strtotime($y->dateDebutActivite()));
         $dateFin = date('d-m-Y', strtotime($y->dateFinActivite()));
         while ($z == true) {
             if ($date == $dateFin) {
                 $z = false;
             }
             $p = new \DateTime($date);
             if ($p->format('N') == $y->jour()) {
                 $tab[] = str_replace('-', '', $date) . substr($y->horaireDebutActivite(), 0, 2) . substr($y->horaireFinActivite(), 0, 2);
             }
             //jddayofweek(gregoriantojd($mois,$jour,$annee));
             $date = date('d-m-Y', strtotime($date . ' + 1 days'));
         }
         //            $tab[]=$date;
         //            $date=date('d-m-Y', strtotime($date. ' + 1 days'));
         //            $tab[]=$date;
         //            $tab[]=$dateFin;
     }
     $data['semaines'] = $semaines;
     $data['test'] = $tab;
     $this->load->view("gestionInscription enfant", $data);
 }
 /**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function show($id)
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $agenda = Agenda::where('doctor_id', $id)->first();
     $CustomDay = CustomDay::where('agenda_id', $agenda->id)->get();
     return View::make('clinic.doctors.customDay')->with('customddays', $CustomDay)->with('agendaID', $agenda->id);
 }
Exemplo n.º 9
0
 public static function getVeryAgenda($agenda_id)
 {
     $user = Sentry::getUser();
     $doctor = Doctor::where('user_id', $user->id)->first();
     $agenda = Agenda::find($agenda_id);
     if ($agenda->doctor_id == $doctor->id) {
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 10
0
 public function update($id)
 {
     $data = array("first_name" => Input::get("first_name"), "last_name" => Input::get("last_name"), "email" => Input::get("email"), "phone" => Input::get("phone"), "picture" => Input::file("picture"), "specialty_id" => Input::get("specialty_id"), "dating_duration" => Input::get("dating_duration"));
     $rules = array("first_name" => 'required|min:1|max:255', "last_name" => 'required|min:1|max:100', "email" => 'required|min:1', "phone" => 'required|min:1|max:100', "specialty_id" => 'required|min:3|max:255', "dating_duration" => 'required|min:1|max:3', "picture" => 'mimes:jpeg,gif,png');
     $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
     $validation = Validator::make(Input::all(), $rules, $messages);
     //si la validación falla redirigimos al formulario de registro con los errores
     //y con los campos que nos habia llenado el usuario
     if ($validation->fails()) {
         return Redirect::to('/doctor/profile')->withErrors($validation)->withInput();
     } else {
         $doctor = Doctor::find($id);
         $agenda = Agenda::where('doctor_id', $doctor->id)->first();
         $agenda->dating_duration = Input::get("dating_duration");
         $agenda->save();
         $espes = explode(',', Input::get("specialty_id"));
         $espeuok = '';
         foreach ($espes as $espe) {
             $very = Specialty::where('name_es', $espe)->first();
             if ($very) {
                 $espeuok = $espeuok . ',' . $very->id;
             }
         }
         $doctor->specialty_id = $espeuok;
         $doctor->save();
         $user = User::find($doctor->user_id);
         $user->first_name = $data['first_name'];
         $user->last_name = $data['last_name'];
         $user->save();
         $profile = Profile::where('user_id', $doctor->user_id)->first();
         if (Input::file('picture') != NULL) {
             //agrega imagen de logo
             $file_logo = Input::file('picture');
             $ext = Input::file('picture')->getClientOriginalExtension();
             $nameIMG = date('YmdHis');
             $logo = $nameIMG . '.' . $ext;
             $logo = 'assets/doctor/images/profile_pic/profile_' . $logo;
             $profile->picture = $logo;
         }
         $profile->phone = Input::get("phone");
         $profile->save();
         if ($profile) {
             if (Input::file('picture') != NULL) {
                 $file_logo->move("assets/doctor/images/profile_pic/", $logo);
             }
             return Redirect::to('/doctor/profile')->withFlash_message("Guardado Exitosamente");
         } else {
             return Redirect::to('/doctor/profile')->withErrors("Error")->withInput();
         }
     }
 }
Exemplo n.º 11
0
 public function getConfigDay()
 {
     if (Payment::VeryPayment() == false) {
         return View::make('clinic.payment.renews-payment');
     }
     $doctor = Doctor::doctorLogin();
     $agenda = Agenda::where('doctor_id', $doctor)->first()->id;
     $configDay = Configday::where('agenda_id', $agenda)->get();
     if ($configDay->isEmpty()) {
         return View::make('clinic.doctor.config.ConfigDay')->with('agenda', $agenda);
     } else {
         return View::make('clinic.doctor.config.ConfigDay')->with('agenda', $agenda)->with('configDay', $configDay);
     }
 }
Exemplo n.º 12
0
 static function init()
 {
     $prefix = '_pan_';
     // Array com os elementos que serão preenchidos
     self::$custom_meta_fields = array(array('label' => __('Theme', 'panamazonica'), 'id' => $prefix . 'tema', 'type' => 'text', 'description' => '', 'context' => array('evento', 'reuniao')), array('label' => __('Start Date', 'panamazonica'), 'id' => $prefix . 'data_inicial', 'type' => 'text', 'description' => '', 'context' => array('evento', 'reuniao')), array('label' => __('End Date', 'panamazonica'), 'id' => $prefix . 'data_final', 'type' => 'text', 'description' => '', 'context' => array('evento')), array('label' => __('Time', 'panamazonica'), 'id' => $prefix . 'horario', 'type' => 'text', 'description' => '', 'context' => array('reuniao')), array('label' => __('Place', 'panamazonica'), 'id' => $prefix . 'local', 'type' => 'text', 'description' => '', 'context' => array('evento', 'reuniao')), array('label' => __('Speaker(s)', 'panamazonica'), 'id' => $prefix . 'autor', 'type' => 'text', 'description' => '', 'context' => array('evento')), array('label' => __('Organizer', 'panamazonica'), 'id' => $prefix . 'organizadores', 'type' => 'text', 'description' => '', 'context' => array('evento')), array('label' => __('Event website', 'panamazonica'), 'id' => $prefix . 'url_evento', 'type' => 'url', 'description' => '', 'context' => array('evento')), array('label' => __('Participants', 'panamazonica'), 'id' => $prefix . 'participantes', 'type' => 'text', 'description' => '', 'context' => array('reuniao')), array('label' => __('Record link', 'panamazonica'), 'id' => $prefix . 'link_ata', 'type' => 'upload', 'description' => 'Fill in the field with a link or upload a file.', 'context' => array('reuniao')));
     add_action('init', array(__CLASS__, 'register'), 0);
     add_action('add_meta_boxes', array(__CLASS__, 'add_custom_box'));
     add_action('save_post', array(__CLASS__, 'save_postdata'));
     add_action('pre_get_posts', array(__CLASS__, 'pre_get_posts'));
     add_action('admin_enqueue_scripts', array(__CLASS__, 'enqueue_scripts'));
     // Adiciona as colunas ao edit.php
     add_filter('manage_agenda_posts_columns', array(__CLASS__, 'manage_posts_columns'), 9);
     add_action('manage_agenda_posts_custom_column', array(__CLASS__, 'manage_agenda_columns'), 10, 2);
     // Cria o select com o filtro para os tipos da agenda
     add_action('restrict_manage_posts', array(__CLASS__, 'restrict_manage_posts'));
 }
Exemplo n.º 13
0
 public function agendas()
 {
     if (isset($_SESSION['user'])) {
         if (Utilisateur::is_admin($_SESSION['user'])) {
             $a = Agenda::get_all();
             $users = array();
             for ($i = 0; $i < count($a); $i++) {
                 $users[] = Utilisateur::get_by_id($a[$i]->idUtilisateur());
             }
             include 'views/adminAgenda.php';
         } else {
             $_SESSION['message']['type'] = 'error';
             $_SESSION['message']['text'] = "Vous n'êtes pas administrateur";
             include 'views/home.php';
         }
     } else {
         $_SESSION['message']['type'] = 'error';
         $_SESSION['message']['text'] = "You aren't connected";
         include 'views/connexion.php';
     }
 }
Exemplo n.º 14
0
function mailCreation($nom, $time, $idEvent)
{
    include '../../../core/model/Mail.php';
    $date = Agenda::timeToDate($time);
    $nomSite = Config::getVal('nom');
    $adresseSite = Config::getVal('adresse');
    $expediteur = '"' . $nomSite . '"<robot@' . $adresseSite . '>';
    $sujet = "Nouvel evenement sur " . $nomSite;
    $arch = new Archiviste();
    $user = new User();
    $users = $arch->restituer($user);
    foreach ($users as $user) {
        $mail = $user->get('mail');
        $notif = $user->get('notifEvent');
        $login = $user->get('login');
        if ($mail && $notif != 'n') {
            $message = 'Bonjour ' . $login . ', <br />' . PHP_EOL . '<br />' . PHP_EOL . 'L\'évenement <b>' . $nom . '</b> a été ajouté sur le site ' . $nomSite . '. Il aura lieu le ' . $date . '<br />' . PHP_EOL . '<br />' . PHP_EOL . 'Pour y accéder, cliquez sur le lien suivant : <a href="http://' . $adresseSite . '/?mod=raidplanner&action=event&id=' . $idEvent . '">' . $nom . '</a><br />' . PHP_EOL . '<br />' . PHP_EOL . '<br />' . PHP_EOL . 'Si vous ne souhaitez plus recevoir ces notifications, consultez vos <a href="http://' . $adresseSite . '/?mod=raidplanner&action=options">options</a>.' . PHP_EOL . '<br />' . PHP_EOL . 'Ceci est un message automatique. Merci de ne pas y repondre. ';
            Mail::envoyer($mail, $expediteur, $sujet, $message);
        }
    }
}
Exemplo n.º 15
0
 /**
  * Adds an announcement to the database
  * @param string Title of the announcement
  * @param string Content of the announcement
  * @param string Start date (YYYY-MM-DD HH:II: SS)
  * @param string End date (YYYY-MM-DD HH:II: SS)
  * @param int    Whether the announcement should be visible to teachers (1) or not (0)
  * @param int    Whether the announcement should be visible to students (1) or not (0)
  * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
  * @param string The language for which the announvement should be shown. Leave null for all langages
  * @param int    Whether to send an e-mail to all users (1) or not (0)
  * @return mixed  insert_id on success, false on failure
  */
 public static function add_announcement($title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $add_to_calendar = false, $sendEmailTest = false)
 {
     $original_content = $content;
     $a_dateS = explode(' ', $date_start);
     $a_arraySD = explode('-', $a_dateS[0]);
     $a_arraySH = explode(':', $a_dateS[1]);
     $date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
     $a_dateE = explode(' ', $date_end);
     $a_arrayED = explode('-', $a_dateE[0]);
     $a_arrayEH = explode(':', $a_dateE[1]);
     $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
     $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
     if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidStartDate'));
         return false;
     }
     if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidEndDate'));
         return false;
     }
     if (strlen(trim($title)) == 0) {
         Display::display_normal_message(get_lang('InvalidTitle'));
         return false;
     }
     $start = api_get_utc_datetime($date_start);
     $end = api_get_utc_datetime($date_end);
     //Fixing urls that are sent by email
     $content = str_replace('src=\\"/home/', 'src=\\"' . api_get_path(WEB_PATH) . 'home/', $content);
     $content = str_replace('file=/home/', 'file=' . api_get_path(WEB_PATH) . 'home/', $content);
     $lang = is_null($lang) ? 'NULL' : $lang;
     $current_access_url_id = 1;
     if (api_is_multiple_url_enabled()) {
         $current_access_url_id = api_get_current_access_url_id();
     }
     $params = ['title' => $title, 'content' => $content, 'date_start' => $start, 'date_end' => $end, 'visible_teacher' => $visible_teacher, 'visible_student' => $visible_student, 'visible_guest' => $visible_guest, 'lang' => $lang, 'access_url_id' => $current_access_url_id];
     $resultId = Database::insert($db_table, $params);
     if ($resultId) {
         if ($sendEmailTest) {
             SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang, true);
         } else {
             if ($send_mail == 1) {
                 SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang);
             }
         }
         if ($add_to_calendar) {
             $agenda = new Agenda();
             $agenda->setType('admin');
             $agenda->addEvent($date_start, $date_end, false, $title, $original_content);
         }
         return $resultId;
     }
     return false;
 }
Exemplo n.º 16
0
 $conteudo .= ' <span';
 if ($compromissos[$currentDay][$hora]["marcador"] != 0) {
     $conteudo .= ' class="m' . Agenda::getMarcador($compromissos[$currentDay][$hora]["marcador"]) . '"';
 }
 $conteudo .= '>';
 $conteudo .= compactaTexto($nomePaciente, 22);
 $conteudo .= '</span>';
 $conteudo .= '<div class="info">';
 if ($compromissos[$currentDay][$hora]["marcador"] != 0) {
     $conteudo .= '<p>';
     $conteudo .= Agenda::getMarcador($compromissos[$currentDay][$hora]["marcador"]);
     $conteudo .= '</p>';
 }
 $conteudo .= '<small>';
 $conteudo .= '<time datetime="' . $timestamp . '">' . $compromissos[$currentDay][$hora]["hora"] . '</time>';
 $conteudo .= ' <span>' . Agenda::getTipo($compromissos[$currentDay][$hora]["tipo"]) . '</span>';
 $conteudo .= '</small>';
 $conteudo .= '<span>' . $compromissos[$currentDay][$hora]["nomePaciente"] . '</span>';
 $telefones = array();
 if (!empty($compromissos[$currentDay][$hora]["telefoneResidencial"])) {
     $telefones[] = $compromissos[$currentDay][$hora]["telefoneResidencial"];
 }
 if (!empty($compromissos[$currentDay][$hora]["telefoneCelular"])) {
     $telefones[] = $compromissos[$currentDay][$hora]["telefoneCelular"];
 }
 if (count($telefones) > 0) {
     $conteudo .= '<br />';
     $conteudo .= '<small>' . implode(" | ", $telefones) . '</small>';
 }
 if (!empty($compromissos[$currentDay][$hora]["lembrete"])) {
     $conteudo .= '<br /><strong>Lembrete:</strong> ' . $compromissos[$currentDay][$hora]["lembrete"];
Exemplo n.º 17
0
// setting the name of the tool
$nameTools = get_lang('MyAgenda');
// the variables for the days and the months
// Defining the shorts for the days
$DaysShort = api_get_week_days_short();
// Defining the days of the week to allow translation of the days
$DaysLong = api_get_week_days_long();
// Defining the months of the year to allow translation of the months
$MonthsLong = api_get_months_long();
if (empty($_GET['id'])) {
    api_not_allowed();
}
$id = explode('_', $_GET['id']);
$type = $id[0];
$id = $id[1];
$agenda = new Agenda();
$agenda->type = $type;
//course,admin or personal
if (isset($_GET['course_id'])) {
    $course_info = api_get_course_info_by_id($_GET['course_id']);
    if (!empty($course_info)) {
        $agenda->set_course($course_info);
    }
}
$event = $agenda->get_event($id);
if (!empty($event)) {
    define('ICAL_LANG', api_get_language_isocode());
    $ical = new vcalendar();
    $ical->setConfig('unique_id', api_get_path(WEB_PATH));
    $ical->setProperty('method', 'PUBLISH');
    $ical->setConfig('url', api_get_path(WEB_PATH));
Exemplo n.º 18
0
include 'cabecera.php';
include 'clases/Consejero.class.php';
include 'clases/Agenda.class.php';
include 'menuIzquierda.php';
?>


<!-- info ================================================== -->
<div class="row">
<div class="page-header" style="text-align: center">
    <h1>Postponer Sesión</h1>
</div>
        <?php 
$fecha = date('Y\\-m\\-d');
$agenda = new Agenda();
$sesiones = $agenda->buscarCreadasPendientes($_SESSION['usuario']);
if (count($sesiones) > 0) {
    echo '<table class="table-condensed span7" style="margin: 0 10%">
            <thead>
                <tr>
                    <td><b>N°</b></td>
                    <td><b>Proximas sesiones:</b></td>
                </tr>
            </thead>
            <tbody>';
    for ($i = 0; $i < count($sesiones); $i++) {
        $agenda->setId($sesiones[$i]['id_agenda']);
        $resul = $agenda->obtenerDatos();
        $consecutivo = $agenda->consecutivo($resul[0]['id_dependencia'], $resul[0]['id_tipo_consejo'], $resul[0]['fecha'], $resul[0]['anio'], $resul[0]['extraordinaria']);
        echo '
Exemplo n.º 19
0
/**
 * Get a list of events between two dates for the given username
 * Function registered as service. Returns strings in UTF-8.
 * @param string Username
 * @param string User's API key (the user's API key)
 * @param int    Start date, in YYYYMMDD format
 * @param int    End date, in YYYYMMDD format
 * @return array Events list
 */
function WSEventsList($username, $signature, $datestart = 0, $dateend = 0)
{
    if (empty($username) or empty($signature)) {
        return -1;
    }
    global $_configuration;
    $info = api_get_user_info_from_username($username);
    $user_id = $info['user_id'];
    $list = UserManager::get_api_keys($user_id, 'dokeos');
    $key = '';
    foreach ($list as $key) {
        break;
    }
    $local_key = $username . $key;
    if (!api_is_valid_secret_key($signature, $local_key)) {
        return -1;
        // The secret key is incorrect.
    }
    $events_list = array();
    $user_id = UserManager::get_user_id_from_username($username);
    if ($user_id === false) {
        return $events_list;
    }
    // Error in user id recovery.
    $ds = substr($datestart, 0, 4) . '-' . substr($datestart, 4, 2) . '-' . substr($datestart, 6, 2) . ' 00:00:00';
    $de = substr($dateend, 0, 4) . '-' . substr($dateend, 4, 2) . '-' . substr($dateend, 6, 2) . ' 00:00:00';
    $events_list = Agenda::get_personal_agenda_items_between_dates($user_id, $ds, $de);
    return $events_list;
}
 /**
  * Filter the query by a related Agenda object
  *
  * @param   Agenda|PropelObjectCollection $agenda The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   ProcedimientregrogramadoQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByAgenda($agenda, $comparison = null)
 {
     if ($agenda instanceof Agenda) {
         return $this->addUsingAlias(ProcedimientregrogramadoPeer::AGENDA_ID, $agenda->getId(), $comparison);
     } elseif ($agenda instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(ProcedimientregrogramadoPeer::AGENDA_ID, $agenda->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByAgenda() only accepts arguments of type Agenda or PropelCollection');
     }
 }
Exemplo n.º 21
0
    static function change_menu_label($stuff)
    {
        global $menu, $submenu;
        foreach ($menu as $i => $mi) {
            if ($mi[0] == self::NAME) {
                $menu[$i][0] = self::MENU_NAME;
            }
        }
        return $stuff;
    }
    static function custom_menu_order()
    {
        return true;
    }
}
Agenda::init();
add_action('pre_get_posts', 'sbc_agenda_query');
function sbc_agenda_query($wp_query)
{
    if (is_admin()) {
        return;
    }
    if (isset($wp_query->query_vars['post_type']) && $wp_query->query_vars['post_type'] === 'agenda' && is_post_type_archive('agenda')) {
        if (!is_array($wp_query->query_vars['meta_query'])) {
            $wp_query->query_vars['meta_query'] = array();
        }
        $wp_query->query_vars['orderby'] = 'meta_value';
        $wp_query->query_vars['order'] = 'ASC';
        $wp_query->query_vars['meta_key'] = '_data_inicial';
        if ($wp_query->query_vars['paged'] > 0 || $_GET['eventos'] == 'passados') {
            array_push($wp_query->query_vars['meta_query'], array('key' => '_data_final', 'value' => date('Y-m-d'), 'compare' => '<=', 'type' => 'DATETIME'));
Exemplo n.º 22
0
 /**
  * Fills the course database with some required content and example content.
  * @param int Course (int) ID
  * @param string Course directory name (e.g. 'ABC')
  * @param string Language used for content (e.g. 'spanish')
  * @param bool Whether to fill the course with example content
  * @return bool False on error, true otherwise
  * @version 1.2
  * @assert (null, '', '', null) === false
  * @assert (1, 'ABC', null, null) === false
  * @assert (1, 'TEST', 'spanish', true) === true
  */
 public static function fill_db_course($course_id, $course_repository, $language, $fill_with_exemplary_content = null)
 {
     if (is_null($fill_with_exemplary_content)) {
         $fill_with_exemplary_content = api_get_setting('course.example_material_course_creation') != 'false';
     }
     $course_id = intval($course_id);
     if (empty($course_id)) {
         return false;
     }
     $entityManager = Database::getManager();
     $course = $entityManager->getRepository('ChamiloCoreBundle:Course')->find($course_id);
     $tools = array();
     $settingsManager = CourseManager::getCourseSettingsManager();
     $settingsManager->setCourse($course);
     $toolList = CourseManager::getToolList();
     $toolList = $toolList->getTools();
     /** @var Chamilo\CourseBundle\Tool\BaseTool $tool */
     foreach ($toolList as $tool) {
         $visibility = self::string2binary(api_get_setting_in_list('course.active_tools_on_create', $tool->getName()));
         $toolObject = new CTool();
         $toolObject->setName($tool->getName())->setCategory($tool->getCategory())->setLink($tool->getLink())->setImage($tool->getImage())->setVisibility($visibility)->setAdmin(0)->setTarget($tool->getTarget());
         $tools[] = $toolObject;
         $settings = $settingsManager->loadSettings($tool->getName());
         $settingsManager->saveSettings($tool->getName(), $settings);
     }
     $course->setTools($tools);
     $entityManager->persist($course);
     $entityManager->flush($course);
     $courseInfo = api_get_course_info_by_id($course_id);
     $now = api_get_utc_datetime(time());
     $tbl_course_homepage = Database::get_course_table(TABLE_TOOL_LIST);
     $TABLEINTROS = Database::get_course_table(TABLE_TOOL_INTRO);
     $TABLEGROUPCATEGORIES = Database::get_course_table(TABLE_GROUP_CATEGORY);
     $TABLEITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
     $TABLETOOLAGENDA = Database::get_course_table(TABLE_AGENDA);
     $TABLETOOLANNOUNCEMENTS = Database::get_course_table(TABLE_ANNOUNCEMENT);
     $TABLETOOLDOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
     $TABLETOOLLINK = Database::get_course_table(TABLE_LINK);
     $TABLEQUIZ = Database::get_course_table(TABLE_QUIZ_TEST);
     $TABLEQUIZQUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
     $TABLEQUIZQUESTIONLIST = Database::get_course_table(TABLE_QUIZ_QUESTION);
     $TABLEQUIZANSWERSLIST = Database::get_course_table(TABLE_QUIZ_ANSWER);
     $TABLESETTING = Database::get_course_table(TABLE_COURSE_SETTING);
     $TABLEFORUMCATEGORIES = Database::get_course_table(TABLE_FORUM_CATEGORY);
     $TABLEFORUMS = Database::get_course_table(TABLE_FORUM);
     $TABLEFORUMTHREADS = Database::get_course_table(TABLE_FORUM_THREAD);
     $TABLEFORUMPOSTS = Database::get_course_table(TABLE_FORUM_POST);
     $TABLEGRADEBOOK = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
     $TABLEGRADEBOOKLINK = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
     $TABLEGRADEBOOKCERT = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
     $visible_for_all = 1;
     $visible_for_course_admin = 0;
     $visible_for_platform_admin = 2;
     /*    Course tools  */
     $alert = api_get_setting('exercise.email_alert_manager_on_new_quiz');
     if ($alert === 'true') {
         $defaultEmailExerciseAlert = 1;
     } else {
         $defaultEmailExerciseAlert = 0;
     }
     /* course_setting table (courseinfo tool)   */
     $settings = ['email_alert_manager_on_new_doc' => ['default' => 0, 'category' => 'work'], 'email_alert_on_new_doc_dropbox' => ['default' => 0, 'category' => 'dropbox'], 'allow_user_edit_agenda' => ['default' => 0, 'category' => 'agenda'], 'allow_user_edit_announcement' => ['default' => 0, 'category' => 'announcement'], 'email_alert_manager_on_new_quiz' => ['default' => $defaultEmailExerciseAlert, 'category' => 'quiz'], 'allow_user_image_forum' => ['default' => 1, 'category' => 'forum'], 'course_theme' => ['default' => '', 'category' => 'theme'], 'allow_learning_path_theme' => ['default' => 1, 'category' => 'theme'], 'allow_open_chat_window' => ['default' => 1, 'category' => 'chat'], 'email_alert_to_teacher_on_new_user_in_course' => ['default' => 0, 'category' => 'registration'], 'allow_user_view_user_list' => ['default' => 1, 'category' => 'user'], 'display_info_advance_inside_homecourse' => ['default' => 1, 'category' => 'thematic_advance'], 'email_alert_students_on_new_homework' => ['default' => 0, 'category' => 'work'], 'enable_lp_auto_launch' => ['default' => 0, 'category' => 'learning_path'], 'pdf_export_watermark_text' => ['default' => '', 'category' => 'learning_path'], 'allow_public_certificates' => ['default' => api_get_setting('course.allow_public_certificates') === 'true' ? 1 : '', 'category' => 'certificates'], 'documents_default_visibility' => ['default' => 'visible', 'category' => 'document']];
     /*$counter = 1;
       foreach ($settings as $variable => $setting) {
           Database::query(
               "INSERT INTO $TABLESETTING (id, c_id, variable, value, category)
                VALUES ($counter, $course_id, '".$variable."', '".$setting['default']."', '".$setting['category']."')"
           );
           $counter++;
       }*/
     /* Course homepage tools for platform admin only */
     /* Group tool */
     Database::query("INSERT INTO {$TABLEGROUPCATEGORIES}  (c_id, id, title , description, max_student, self_reg_allowed, self_unreg_allowed, groups_per_user, display_order)\n             VALUES ({$course_id}, '2', '" . self::lang2db(get_lang('DefaultGroupCategory')) . "', '', '8', '0', '0', '0', '0');");
     /*    Example Material  */
     $language_interface = !empty($language_interface) ? $language_interface : api_get_setting('language.platform_language');
     // Example material should be in the same language as the course is.
     $language_interface_original = $language_interface;
     $now = api_get_utc_datetime();
     $files = [['path' => '/shared_folder', 'title' => get_lang('UserFolders'), 'filetype' => 'folder', 'size' => 0], ['path' => '/chat_files', 'title' => get_lang('ChatFiles'), 'filetype' => 'folder', 'size' => 0]];
     $counter = 1;
     foreach ($files as $file) {
         self::insertDocument($course_id, $counter, $file);
         $counter++;
     }
     $sys_course_path = api_get_path(SYS_COURSE_PATH);
     $perm = api_get_permissions_for_new_directories();
     $perm_file = api_get_permissions_for_new_files();
     $chat_path = $sys_course_path . $course_repository . '/document/chat_files';
     if (!is_dir($chat_path)) {
         @mkdir($chat_path, api_get_permissions_for_new_directories());
     }
     /*    Documents   */
     if ($fill_with_exemplary_content) {
         $files = [['path' => '/images', 'title' => get_lang('Images'), 'filetype' => 'folder', 'size' => 0], ['path' => '/images/gallery', 'title' => get_lang('DefaultCourseImages'), 'filetype' => 'folder', 'size' => 0], ['path' => '/audio', 'title' => get_lang('Audio'), 'filetype' => 'folder', 'size' => 0], ['path' => '/flash', 'title' => get_lang('Flash'), 'filetype' => 'folder', 'size' => 0], ['path' => '/video', 'title' => get_lang('Video'), 'filetype' => 'folder', 'size' => 0], ['path' => '/certificates', 'title' => get_lang('Certificates'), 'filetype' => 'folder', 'size' => 0]];
         foreach ($files as $file) {
             self::insertDocument($course_id, $counter, $file);
             $counter++;
         }
         // FILL THE COURSE DOCUMENT WITH DEFAULT COURSE PICTURES
         $folders_to_copy_from_default_course = array('images', 'audio', 'flash', 'video', 'certificates');
         $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document/';
         $default_document_array = array();
         foreach ($folders_to_copy_from_default_course as $folder) {
             $default_course_folder_path = $default_course_path . $folder . '/';
             $files = self::browse_folders($default_course_folder_path, array(), $folder);
             $sorted_array = self::sort_pictures($files, 'dir');
             $sorted_array = array_merge($sorted_array, self::sort_pictures($files, 'file'));
             $default_document_array[$folder] = $sorted_array;
         }
         //Light protection (adding index.html in every document folder)
         $htmlpage = "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\">\n <title>Not authorized</title>\n  </head>\n  <body>\n  </body>\n</html>";
         $example_cert_id = 0;
         if (is_array($default_document_array) && count($default_document_array) > 0) {
             foreach ($default_document_array as $media_type => $array_media) {
                 $path_documents = "/{$media_type}/";
                 //hack until feature #5242 is implemented
                 if ($media_type == 'images') {
                     $media_type = 'images/gallery';
                     $images_folder = $sys_course_path . $course_repository . "/document/images/";
                     if (!is_dir($images_folder)) {
                         //Creating index.html
                         mkdir($images_folder, $perm);
                         $fd = fopen($images_folder . 'index.html', 'w');
                         fwrite($fd, $htmlpage);
                         @chmod($images_folder . 'index.html', $perm_file);
                     }
                 }
                 $course_documents_folder = $sys_course_path . $course_repository . "/document/{$media_type}/";
                 $default_course_path = api_get_path(SYS_CODE_PATH) . 'default_course_document' . $path_documents;
                 if (!is_dir($course_documents_folder)) {
                     // Creating index.html
                     mkdir($course_documents_folder, $perm);
                     $fd = fopen($course_documents_folder . 'index.html', 'w');
                     fwrite($fd, $htmlpage);
                     @chmod($course_documents_folder . 'index.html', $perm_file);
                 }
                 if (is_array($array_media) && count($array_media) > 0) {
                     foreach ($array_media as $key => $value) {
                         if (isset($value['dir']) && !empty($value['dir'])) {
                             if (!is_dir($course_documents_folder . $value['dir'])) {
                                 //Creating folder
                                 mkdir($course_documents_folder . $value['dir'], $perm);
                                 //Creating index.html (for light protection)
                                 $index_html = $course_documents_folder . $value['dir'] . '/index.html';
                                 $fd = fopen($index_html, 'w');
                                 fwrite($fd, $htmlpage);
                                 @chmod($index_html, $perm_file);
                                 //Inserting folder in the DB
                                 $folder_path = substr($value['dir'], 0, strlen($value['dir']) - 1);
                                 $temp = explode('/', $folder_path);
                                 $title = $temp[count($temp) - 1];
                                 //hack until feature #5242 is implemented
                                 if ($title == 'gallery') {
                                     $title = get_lang('DefaultCourseImages');
                                 }
                                 if ($media_type == 'images/gallery') {
                                     $folder_path = 'gallery/' . $folder_path;
                                 }
                                 Database::query("INSERT INTO {$TABLETOOLDOCUMENT} (c_id, path,title,filetype,size)\n                                        VALUES ({$course_id},'{$path_documents}" . $folder_path . "','" . $title . "','folder','0')");
                                 $image_id = Database::insert_id();
                                 Database::query("INSERT INTO {$TABLEITEMPROPERTY} (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)\n                                        VALUES ({$course_id},'document',1,'{$now}','{$now}',{$image_id},'DocumentAdded',1,NULL,NULL,0)");
                             }
                         }
                         if (isset($value['file']) && !empty($value['file'])) {
                             if (!file_exists($course_documents_folder . $value['file'])) {
                                 //Copying file
                                 copy($default_course_path . $value['file'], $course_documents_folder . $value['file']);
                                 chmod($course_documents_folder . $value['file'], $perm_file);
                                 //echo $default_course_path.$value['file']; echo ' - '; echo $course_documents_folder.$value['file']; echo '<br />';
                                 $temp = explode('/', $value['file']);
                                 $file_size = filesize($course_documents_folder . $value['file']);
                                 //hack until feature #5242 is implemented
                                 if ($media_type == 'images/gallery') {
                                     $value["file"] = 'gallery/' . $value["file"];
                                 }
                                 //Inserting file in the DB
                                 Database::query("INSERT INTO {$TABLETOOLDOCUMENT} (c_id, path,title,filetype,size)\n                                        VALUES ({$course_id},'{$path_documents}" . $value["file"] . "','" . $temp[count($temp) - 1] . "','file','{$file_size}')");
                                 $image_id = Database::insert_id();
                                 if ($image_id) {
                                     $sql = "UPDATE {$TABLETOOLDOCUMENT} SET id = iid WHERE iid = {$image_id}";
                                     Database::query($sql);
                                     if ($path_documents . $value['file'] == '/certificates/default.html') {
                                         $example_cert_id = $image_id;
                                     }
                                     Database::query("INSERT INTO {$TABLEITEMPROPERTY} (c_id, tool,insert_user_id,insert_date,lastedit_date,ref,lastedit_type,lastedit_user_id,to_group_id,to_user_id,visibility)\n                                            VALUES ({$course_id},'document',1,'{$now}','{$now}',{$image_id},'DocumentAdded',1,NULL,NULL,1)");
                                     $docId = Database::insert_id();
                                     if ($docId) {
                                         $sql = "UPDATE {$TABLEITEMPROPERTY} SET id = iid WHERE iid = {$docId}";
                                         Database::query($sql);
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $agenda = new Agenda();
         $agenda->setType('course');
         $agenda->set_course($courseInfo);
         $agenda->addEvent($now, $now, 0, get_lang('AgendaCreationTitle'), get_lang('AgendaCreationContenu'));
         /*  Links tool */
         $link = new Link();
         $link->setCourse($courseInfo);
         $links = [['c_id' => $course_id, 'url' => 'http://www.google.com', 'title' => 'Google', 'description' => get_lang('Google'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0], ['c_id' => $course_id, 'url' => 'http://www.wikipedia.org', 'title' => 'Wikipedia', 'description' => get_lang('Wikipedia'), 'category_id' => 0, 'on_homepage' => 0, 'target' => '_self', 'session_id' => 0]];
         foreach ($links as $params) {
             $link->save($params);
         }
         /* Announcement tool */
         AnnouncementManager::add_announcement(get_lang('AnnouncementExampleTitle'), get_lang('AnnouncementEx'), ['everyone' => 'everyone'], null, null, $now);
         $manager = Database::getManager();
         /* Introduction text */
         $intro_text = '<p style="text-align: center;">
                         <img src="' . api_get_path(REL_CODE_PATH) . 'img/mascot.png" alt="Mr. Chamilo" title="Mr. Chamilo" />
                         <h2>' . self::lang2db(get_lang('IntroductionText')) . '</h2>
                      </p>';
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_COURSE_HOMEPAGE)->setSessionId(0)->setIntroText($intro_text);
         $manager->persist($toolIntro);
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_STUDENTPUBLICATION)->setSessionId(0)->setIntroText(get_lang('IntroductionTwo'));
         $manager->persist($toolIntro);
         $toolIntro = new Chamilo\CourseBundle\Entity\CToolIntro();
         $toolIntro->setCId($course_id)->setId(TOOL_WIKI)->setSessionId(0)->setIntroText(get_lang('IntroductionWiki'));
         $manager->persist($toolIntro);
         $manager->flush();
         /*  Exercise tool */
         $exercise = new Exercise($course_id);
         $exercise->exercise = get_lang('ExerciceEx');
         $html = '<table width="100%" border="0" cellpadding="0" cellspacing="0">
                     <tr>
                     <td width="110" valign="top" align="left">
                         <img src="' . api_get_path(WEB_CODE_PATH) . 'default_course_document/images/mr_dokeos/thinking.jpg">
                     </td>
                     <td valign="top" align="left">' . get_lang('Antique') . '</td></tr>
                 </table>';
         $exercise->type = 1;
         $exercise->setRandom(0);
         $exercise->active = 1;
         $exercise->results_disabled = 0;
         $exercise->description = $html;
         $exercise->save();
         $exercise_id = $exercise->id;
         $question = new MultipleAnswer();
         $question->question = get_lang('SocraticIrony');
         $question->description = get_lang('ManyAnswers');
         $question->weighting = 10;
         $question->position = 1;
         $question->course = $courseInfo;
         $question->save($exercise_id);
         $questionId = $question->id;
         $answer = new Answer($questionId, $courseInfo['real_id']);
         $answer->createAnswer(get_lang('Ridiculise'), 0, get_lang('NoPsychology'), -5, 1);
         $answer->createAnswer(get_lang('AdmitError'), 0, get_lang('NoSeduction'), -5, 2);
         $answer->createAnswer(get_lang('Force'), 1, get_lang('Indeed'), 5, 3);
         $answer->createAnswer(get_lang('Contradiction'), 1, get_lang('NotFalse'), 5, 4);
         $answer->save();
         /* Forum tool */
         require_once api_get_path(SYS_CODE_PATH) . 'forum/forumfunction.inc.php';
         $params = ['forum_category_title' => get_lang('ExampleForumCategory'), 'forum_category_comment' => ''];
         $forumCategoryId = store_forumcategory($params, $courseInfo, false);
         $params = ['forum_category' => $forumCategoryId, 'forum_title' => get_lang('ExampleForum'), 'forum_comment' => '', 'default_view_type_group' => ['default_view_type' => 'flat']];
         $forumId = store_forum($params, $courseInfo, true);
         $forumInfo = get_forum_information($forumId, $courseInfo['real_id']);
         $params = ['post_title' => get_lang('ExampleThread'), 'forum_id' => $forumId, 'post_text' => get_lang('ExampleThreadContent'), 'calification_notebook_title' => '', 'numeric_calification' => '', 'weight_calification' => '', 'forum_category' => $forumCategoryId, 'thread_peer_qualify' => 0];
         store_thread($forumInfo, $params, $courseInfo, false);
         /* Gradebook tool */
         $course_code = $courseInfo['code'];
         // father gradebook
         Database::query("INSERT INTO {$TABLEGRADEBOOK} (name, description, user_id, course_code, parent_id, weight, visible, certif_min_score, session_id, document_id)\n                VALUES ('{$course_code}','',1,'{$course_code}',0,100,0,75,NULL,{$example_cert_id})");
         $gbid = Database::insert_id();
         Database::query("INSERT INTO {$TABLEGRADEBOOK} (name, description, user_id, course_code, parent_id, weight, visible, certif_min_score, session_id, document_id)\n                VALUES ('{$course_code}','',1,'{$course_code}',{$gbid},100,1,75,NULL,{$example_cert_id})");
         $gbid = Database::insert_id();
         Database::query("INSERT INTO {$TABLEGRADEBOOKLINK} (type, ref_id, user_id, course_code, category_id, created_at, weight, visible, locked)\n                VALUES (1,{$exercise_id},1,'{$course_code}',{$gbid},'{$now}',100,1,0)");
     }
     //Installing plugins in course
     $app_plugin = new AppPlugin();
     $app_plugin->install_course_plugins($course_id);
     $language_interface = $language_interface_original;
     return true;
 }
Exemplo n.º 23
0
$current_course_tool = TOOL_CALENDAR_EVENT;
$this_section = SECTION_MYAGENDA;
/*$htmlHeadXtra[] = api_get_jquery_libraries_js(array('jquery-ui','jquery-ui-i18n'));
$htmlHeadXtra[] = api_get_js('qtip2/jquery.qtip.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/fullcalendar.min.js');
$htmlHeadXtra[] = api_get_js('fullcalendar/gcal.js');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).'fullcalendar/fullcalendar.css');
$htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).'qtip2/jquery.qtip.min.css');*/
if (api_is_platform_admin() && ($type == 'admin' || $type == 'platform')) {
    $type = 'admin';
}
//if (api_get_course_id() != -1 && $type == 'course') {
if (isset($_REQUEST['cidReq']) && !empty($_REQUEST['cidReq'])) {
    $type = 'course';
}
$agenda = new Agenda();
$agenda->type = $type;
$is_group_tutor = false;
$session_id = api_get_session_id();
$group_id = api_get_group_id();
if (!empty($group_id)) {
    $is_group_tutor = GroupManager::is_tutor_of_group(api_get_user_id(), $group_id);
    $group_properties = GroupManager::get_group_properties($group_id);
    $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group.php?" . api_get_cidreq(), "name" => get_lang('Groups'));
    $interbreadcrumb[] = array("url" => api_get_path(WEB_CODE_PATH) . "group/group_space.php?" . api_get_cidreq(), "name" => get_lang('GroupSpace') . ' ' . $group_properties['name']);
}
$app['title'] = get_lang('Agenda');
$tpl = Container::getTwig();
$tpl->addGlobal('use_google_calendar', 0);
$can_add_events = 0;
switch ($type) {
Exemplo n.º 24
0
 /**
  * Exclude object from result
  *
  * @param   Agenda $agenda Object to remove from the list of results
  *
  * @return AgendaQuery The current query, for fluid interface
  */
 public function prune($agenda = null)
 {
     if ($agenda) {
         $this->addUsingAlias(AgendaPeer::ID, $agenda->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 25
0
 /**
  * Filter the query by a related Agenda object
  *
  * @param   Agenda|PropelObjectCollection $agenda  the related object to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   EventoqxQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByAgenda($agenda, $comparison = null)
 {
     if ($agenda instanceof Agenda) {
         return $this->addUsingAlias(EventoqxPeer::ID, $agenda->getEventoqxId(), $comparison);
     } elseif ($agenda instanceof PropelObjectCollection) {
         return $this->useAgendaQuery()->filterByPrimaryKeys($agenda->getPrimaryKeys())->endUse();
     } else {
         throw new PropelException('filterByAgenda() only accepts arguments of type Agenda or PropelCollection');
     }
 }
 public function postaddPatient()
 {
     if (Request::ajax()) {
         $data = array("agenda_id" => Input::get("agenda_id"), "first_name" => Input::get("first_name"), "last_name" => Input::get("last_name"), "email" => Input::get("email"));
         $rules = array("agenda_id" => 'required', "first_name" => 'required|min:2|max:50', "last_name" => 'required|min:2|max:50', "email" => 'required|email|min:1|max:50');
         $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'numeric' => 'El campo :attribute debe contener solo numeros', 'mimes' => 'El formato de la imagen logo debe ser jpg, git, png');
         $validation = Validator::make(Input::all(), $rules, $messages);
         //si la validación falla redirigimos al formulario de registro con los errores
         if ($validation->fails()) {
             return Response::json(array('success' => false, 'errors' => $validation->getMessageBag()->toArray()));
         } else {
             $password = $this->generaPass();
             $agenda = Agenda::find(Input::get('agenda_id'));
             $user = new User();
             $user->first_name = Input::get("first_name");
             $user->last_name = Input::get("last_name");
             $user->email = Input::get("email");
             $user->password = $password;
             $user->username = Input::get("first_name") . Input::get("last_name");
             $user->activated = 1;
             $user->save();
             if ($user) {
                 $doctorUser = Sentry::getUserProvider()->findByLogin($user->email);
                 $doctorsyGroup = Sentry::getGroupProvider()->findByName('Patients');
                 $doctorUser->addGroup($doctorsyGroup);
                 $profile = new Profile();
                 $profile->user_id = $user->id;
                 $profile->save();
                 $patient = new Patient();
                 $patient->user_id = $user->id;
                 $patient->save();
                 $docPatient = new DoctorPatient();
                 $docPatient->patient_id = $patient->id;
                 $docPatient->doctor_id = $agenda->doctor_id;
                 $docPatient->save();
                 $subject = 'Registro por Clinica | smartdoctorappointments.com';
                 $name = $user->first_name;
                 $email = $user->email;
                 $data = array('name' => $user->first_name . " " . $user->last_name, 'password' => $password, 'email' => $user->email);
                 Mail::send('email.userpatiendadd', $data, function ($message) use($name, $email, $subject) {
                     $message->to($email, $name);
                     $message->subject($subject);
                 });
                 return Response::json(array('success' => true, 'email' => Input::get("email")));
             } else {
                 return Response::json(array('success' => false, 'errors' => 'Error al registrar este usuario.'));
             }
         }
     }
 }
Exemplo n.º 27
0
 /**
  * @param string $file
  * @param bool   $moveFile
  *
  * @return int
  */
 private function importCalendarStatic($file, $moveFile = true)
 {
     $data = Import::csv_to_array($file);
     if (!empty($data)) {
         $this->logger->addInfo(count($data) . " records found.");
         $eventsToCreate = array();
         $errorFound = false;
         foreach ($data as $row) {
             $sessionId = null;
             $externalSessionId = null;
             if (isset($row['external_sessionID'])) {
                 $externalSessionId = $row['external_sessionID'];
                 $sessionId = SessionManager::get_session_id_from_original_id($externalSessionId, $this->extraFieldIdNameList['session']);
             }
             $courseCode = null;
             if (isset($row['coursecode'])) {
                 $courseCode = $row['coursecode'];
             }
             $courseInfo = api_get_course_info($courseCode);
             if (empty($courseInfo)) {
                 $this->logger->addInfo("Course '{$courseCode}' does not exists");
             }
             if (empty($sessionId)) {
                 $this->logger->addInfo("external_sessionID: " . $externalSessionId . " does not exists.");
             }
             $teacherId = null;
             if (!empty($sessionId) && !empty($courseInfo)) {
                 $courseIncluded = SessionManager::relation_session_course_exist($sessionId, $courseInfo['code']);
                 if ($courseIncluded == false) {
                     $this->logger->addInfo("Course '{$courseCode}' is not included in session: {$sessionId}");
                     $errorFound = true;
                 } else {
                     $teachers = CourseManager::get_coach_list_from_course_code($courseInfo['code'], $sessionId);
                     // Getting first teacher.
                     if (!empty($teachers)) {
                         $teacher = current($teachers);
                         $teacherId = $teacher['user_id'];
                     } else {
                         $sessionInfo = api_get_session_info($sessionId);
                         $teacherId = $sessionInfo['id_coach'];
                     }
                 }
             } else {
                 $errorFound = true;
             }
             if (empty($teacherId)) {
                 $errorFound = true;
                 $this->logger->addInfo("No teacher found in course code : '{$courseCode}' and session: '{$sessionId}'");
             }
             $date = $row['date'];
             $startTime = $row['time_start'];
             $endTime = $row['time_end'];
             $title = $row['title'];
             $comment = $row['comment'];
             $color = isset($row['color']) ? $row['color'] : '';
             $startDateYear = substr($date, 0, 4);
             $startDateMonth = substr($date, 4, 2);
             $startDateDay = substr($date, 6, 8);
             $startDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $startTime . ":00";
             $endDate = $startDateYear . '-' . $startDateMonth . '-' . $startDateDay . ' ' . $endTime . ":00";
             if (!api_is_valid_date($startDate) || !api_is_valid_date($endDate)) {
                 $this->logger->addInfo("Verify your dates:  '{$startDate}' : '{$endDate}' ");
                 $errorFound = true;
             }
             // If old events do nothing.
             /*if (api_strtotime($startDate) < time()) {
                   continue;
               }*/
             if ($errorFound == false) {
                 $eventsToCreate[] = array('start' => $startDate, 'end' => $endDate, 'title' => $title, 'sender_id' => $teacherId, 'course_id' => $courseInfo['real_id'], 'session_id' => $sessionId, 'comment' => $comment, 'color' => $color, $this->extraFieldIdNameList['calendar_event'] => $row['external_calendar_itemID']);
             }
         }
         if (empty($eventsToCreate)) {
             $this->logger->addInfo("No events to add");
             return 0;
         }
         $this->logger->addInfo("Ready to insert events");
         $agenda = new Agenda();
         $extraFieldValue = new ExtraFieldValue('calendar_event');
         $extraFieldName = $this->extraFieldIdNameList['calendar_event'];
         $externalEventId = null;
         $extraField = new ExtraField('calendar_event');
         $extraFieldInfo = $extraField->get_handler_field_info_by_field_variable($extraFieldName);
         if (empty($extraFieldInfo)) {
             $this->logger->addInfo("No calendar event extra field created: {$extraFieldName}");
             return 0;
         }
         foreach ($eventsToCreate as $event) {
             $update = false;
             $item = null;
             if (!isset($event[$extraFieldName])) {
                 $this->logger->addInfo("No external_calendar_itemID found. Skipping ...");
                 continue;
             } else {
                 $externalEventId = $event[$extraFieldName];
                 if (empty($externalEventId)) {
                     $this->logger->addInfo("external_calendar_itemID was set but empty. Skipping ...");
                     continue;
                 }
                 $items = $extraFieldValue->get_item_id_from_field_variable_and_field_value($extraFieldName, $externalEventId, false, false, true);
                 $item = null;
                 foreach ($items as $tempItem) {
                     if ($tempItem['c_id'] == $event['course_id']) {
                         $item = $tempItem;
                     }
                 }
                 if (!empty($item)) {
                     $this->logger->addInfo("Event #{$externalEventId} was already added. Updating ...");
                     $update = true;
                     //continue;
                 }
             }
             $courseInfo = api_get_course_info_by_id($event['course_id']);
             $agenda->set_course($courseInfo);
             $agenda->setType('course');
             $agenda->setSessionId($event['session_id']);
             $agenda->setSenderId($event['sender_id']);
             $agenda->setIsAllowedToEdit(true);
             $eventComment = $event['comment'];
             $color = $event['color'];
             // To use the event comment you need
             // ALTER TABLE c_calendar_event ADD COLUMN comment TEXT;
             // add in configuration.php allow_agenda_event_comment = true
             if (empty($courseInfo)) {
                 $this->logger->addInfo("No course found for added: #" . $event['course_id'] . " Skipping ...");
                 continue;
             }
             if (empty($event['sender_id'])) {
                 $this->logger->addInfo("No sender found: #" . $event['sender_id'] . " Skipping ...");
                 continue;
             }
             $content = '';
             if ($update && isset($item['calendar_event_id'])) {
                 //the event already exists, just update
                 $eventId = $agenda->edit_event($item['calendar_event_id'], $event['start'], $event['end'], false, $event['title'], $content, array('everyone'), array(), null, $eventComment, $color);
                 if ($eventId !== false) {
                     $this->logger->addInfo("Event updated: #{$eventId}");
                 } else {
                     $this->logger->addInfo("Error while updating event.");
                 }
             } else {
                 // New event. Create it.
                 $eventId = $agenda->add_event($event['start'], $event['end'], false, $event['title'], $content, array('everyone'), false, null, array(), null, $eventComment, $color);
                 if (!empty($eventId)) {
                     $extraFieldValue->is_course_model = true;
                     $extraFieldValue->save(array('field_value' => $externalEventId, 'field_id' => $extraFieldInfo['id'], 'calendar_event_id' => $eventId, 'c_id' => $event['course_id']));
                     $this->logger->addInfo("Event added: #{$eventId}");
                 } else {
                     $this->logger->addInfo("Error while creating event.");
                 }
             }
         }
     }
     if ($moveFile) {
         $this->moveFile($file);
     }
 }
 /**
  * Adds an announcement to the database
  * @param string Title of the announcement
  * @param string Content of the announcement
  * @param string Start date (YYYY-MM-DD HH:II: SS)
  * @param string End date (YYYY-MM-DD HH:II: SS)
  * @param int    Whether the announcement should be visible to teachers (1) or not (0)
  * @param int    Whether the announcement should be visible to students (1) or not (0)
  * @param int    Whether the announcement should be visible to anonymous users (1) or not (0)
  * @param string The language for which the announvement should be shown. Leave null for all langages
  * @param int    Whether to send an e-mail to all users (1) or not (0)
  * @return mixed  insert_id on success, false on failure
  */
 public static function add_announcement($title, $content, $date_start, $date_end, $visible_teacher = 0, $visible_student = 0, $visible_guest = 0, $lang = null, $send_mail = 0, $add_to_calendar = false)
 {
     $original_content = $content;
     $a_dateS = explode(' ', $date_start);
     $a_arraySD = explode('-', $a_dateS[0]);
     $a_arraySH = explode(':', $a_dateS[1]);
     $date_start_to_compare = array_merge($a_arraySD, $a_arraySH);
     $a_dateE = explode(' ', $date_end);
     $a_arrayED = explode('-', $a_dateE[0]);
     $a_arrayEH = explode(':', $a_dateE[1]);
     $date_end_to_compare = array_merge($a_arrayED, $a_arrayEH);
     $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS);
     if (!checkdate($date_start_to_compare[1], $date_start_to_compare[2], $date_start_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidStartDate'));
         return false;
     }
     if (($date_end_to_compare[1] || $date_end_to_compare[2] || $date_end_to_compare[0]) && !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0])) {
         Display::display_normal_message(get_lang('InvalidEndDate'));
         return false;
     }
     if (strlen(trim($title)) == 0) {
         Display::display_normal_message(get_lang('InvalidTitle'));
         return false;
     }
     $start = api_get_utc_datetime($date_start);
     $end = api_get_utc_datetime($date_end);
     $title = Database::escape_string($title);
     $content = Database::escape_string($content);
     //Fixing urls that are sent by email
     $content = str_replace('src=\\"/home/', 'src=\\"' . api_get_path(WEB_PATH) . 'home/', $content);
     $content = str_replace('file=/home/', 'file=' . api_get_path(WEB_PATH) . 'home/', $content);
     $langsql = is_null($lang) ? 'NULL' : "'" . Database::escape_string($lang) . "'";
     global $_configuration;
     $current_access_url_id = 1;
     if ($_configuration['multiple_access_urls']) {
         $current_access_url_id = api_get_current_access_url_id();
     }
     $sql = "INSERT INTO " . $db_table . " (title,content,date_start,date_end,visible_teacher,visible_student,visible_guest, lang, access_url_id)\n\t\t\t\tVALUES ('" . $title . "','" . $content . "','" . $start . "','" . $end . "','" . $visible_teacher . "','" . $visible_student . "','" . $visible_guest . "'," . $langsql . ", " . $current_access_url_id . ")";
     if ($send_mail == 1) {
         SystemAnnouncementManager::send_system_announcement_by_email($title, $content, $visible_teacher, $visible_student, $lang);
     }
     $res = Database::query($sql);
     if ($res === false) {
         Debug::log_s(mysql_error());
         return false;
     }
     if ($add_to_calendar) {
         $agenda = new Agenda();
         $agenda->setType('admin');
         $agenda->add_event($date_start, $date_end, false, null, $title, $original_content);
     }
     return Database::insert_id();
 }
Exemplo n.º 29
0
 private function calcTotalSalary()
 {
     $salaryPeriod = Agenda::getSalary($this->terms['date']);
     $sum = $salaryPeriod['sum'];
     $this->totalSalary = $this->totalMinutes / 60 * $sum;
 }
Exemplo n.º 30
0
 /**
  * @param	Agenda $agenda The agenda object to add.
  */
 protected function doAddAgenda($agenda)
 {
     $this->collAgendas[] = $agenda;
     $agenda->setAtencion($this);
 }