| Server IP : 162.214.74.102 / Your IP : 216.73.217.114 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/hering/application/plugins/module_teammanagement/models/ |
Upload File : |
<?php
include_once __DIR__ . "/../../../autoload/My_Model.php";
include_once __DIR__ . "/../factories/GoalFactory.php";
class GoalModel extends My_Model {
/**
* @var string
*/
public $table = 'module_teammanagement_goal';
public function createGoal($data) {
$category = self::create();
GoalFactory::create($data, $category, true);
$category->save();
return $category;
}
public function updateGoal($data, $category) {
ORM::for_table($this->table)->create($category);
GoalFactory::create($data, $category);
$category->save();
return $category;
}
public function deleteGoal($category) {
ORM::for_table('module_teammanagement_goal_user')->where('module_teammanagement_goal_id', $category->id)->delete_many();
ORM::for_table($this->table)->create($category);
$category->delete();
return $category;
}
public function updateEmployessGoal($id, $users) {
//remove todoso os registros, antes de reinserir
ORM::for_table('module_teammanagement_goal_user')->where('module_teammanagement_goal_id', $id)->delete_many();
for ($i = 0; $i < count($users); $i++) {
$d = ORM::for_table('module_teammanagement_goal_user')->create();
$d->id_user = $users[$i];
$d->module_teammanagement_goal_id = $id;
$d->created_at = date('Y-m-d H:i:s');
$d->updated_at = date('Y-m-d H:i:s');
$d->save();
}
return true;
}
public function getOneWithNames($id)
{
$registers= ORM::for_table($this->table)
->raw_query(" SELECT g.*,s.account as account_branch FROM module_teammanagement_goal g "
. "JOIN crm_accounts s ON(s.id=g.crm_accounts_id) "//pega o nome do funcionário
. "WHERE g.id=".$id)
->find_many();
return count($registers)>0?$registers[0]:false;
}
}