public function showForm($id = -1) { $this->prepareForm($id, array('method' => 'post', 'action' => 'backup/adicionar')); SystemHelper::addHiddenfield('', 'usuario_id_criacao', FUTURI_Session::getUserID()); SystemHelper::addHiddenfield('', 'dt_criacao', date('Y-m-d H:i:s')); echo "<div class='ls-tab-content ls-active' id='infos'>"; echo "<table class='easy-form-table'>"; echo "<tr>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Nome', 'required' => true, 'name' => 'nome_backup')); echo "</td>"; echo "</tr>"; echo "</table>"; echo "<b>Opções do backup</b>"; echo "<div class='ls-box'>"; echo "<table class='easy-form-table'>"; echo "<tr>"; echo "<td>"; SystemHelper::addYesNoToggle(array('label' => 'Banco de dados', 'name' => 'incluir_banco_dados', 'value' => 1, 'checked' => $this->fields['incluir_banco_dados'])); echo "</td>"; echo "<td>"; SystemHelper::addYesNoToggle(array('label' => 'Fotos casting/trabalhos', 'name' => 'incluir_casting_fotos', 'value' => 1, 'checked' => $this->fields['incluir_casting_fotos'])); echo "</td>"; echo "<td>"; SystemHelper::addYesNoToggle(array('label' => 'Documentos', 'name' => 'incluir_documentos', 'value' => 1, 'checked' => $this->fields['incluir_documentos'])); echo "</td>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "</div>"; $this->addButtons(); }
public function afterUpdate() { $this->afterAdd(); if ($this->fields['id'] == FUTURI_Session::getUserID()) { FUTURI_Session::set("user_info", $this->fields); } }
public static function havePermission($permName = '', $user_id = -1) { include_once "application/models/Permission_model.php"; $permModel = new Permission_Model(); if ($user_id > 0) { include_once "User.php"; $user = new User($user_id); $is_admin = $user->fields['administrador']; } else { $is_admin = FUTURI_Session::isUserAdmin(); $user_id = FUTURI_Session::getUserID(); } $have_count = count($permModel->getObjects(array("where" => "usuario_id = '" . $user_id . "' AND nome_permissao = '" . $permName . "'"))); return $have_count || $is_admin; }
public function showForm($id = -1) { $this->prepareForm($id, array('method' => 'post', 'action' => $id > 0 ? 'trabalho/atualizar/' . $id : 'trabalho/adicionar')); if ($this->objectID < 0) { SystemHelper::addHiddenfield('', 'dt_criacao', date('Y-m-d H:i:s')); SystemHelper::addHiddenfield('', 'usuario_id_criacao', FUTURI_Session::getUserID()); } echo "<div id='infos' class='ls-tab-content ls-active' role='tabpanel'>"; echo "<table class='easy-form-table'>"; echo "<tr>"; echo "<td colspan='2'>"; $status_options = array(); $this->load->model("taskstatus_model"); foreach ($this->taskstatus_model->getObjects() as $index => $stInfo) { $status_options[] = array("value" => $stInfo['id'], "label" => $stInfo['nome']); } SystemHelper::addCombobox(array('label' => 'Status', 'name' => 'status', 'options' => $status_options, 'value' => $this->fields['status'])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='5'>"; SystemHelper::addRadioGroup(array('label' => 'Empresa', 'name' => 'empresa_id', 'options' => $this->empresas_options, 'value' => $this->fields['empresa_id'])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='2'>"; SystemHelper::addTextfield(array('label' => 'Nome do evento', 'name' => 'nome_evento', 'required' => true, 'value' => $this->fields['nome_evento'])); echo "</td>"; echo "<td colspan='3'>"; $client_options = array(); $this->load->model("client_model"); foreach ($this->client_model->getObjects() as $index => $cliInfo) { $client_options[] = array("value" => $cliInfo['id'], "label" => $cliInfo['nome_fantasia']); } SystemHelper::addCombobox(array('label' => 'Cliente', 'name' => 'cliente_id', 'required' => true, 'options' => $client_options, 'value' => $this->fields['cliente_id'])); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan='2'>"; SystemHelper::addDatefield(array('label' => 'Data de início', 'name' => 'dt_inicio', 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_inicio']), 'useIcon' => true)); echo "</td>"; echo "<td colspan='3'>"; SystemHelper::addDatefield(array('label' => 'Data de término', 'name' => 'dt_termino', 'width' => '120px', 'value' => SystemHelper::convertDateFromUS($this->fields['dt_termino']), 'useIcon' => true)); echo "</td>"; echo "</tr>"; echo "<tr>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Custo real (R$)', 'name' => 'custo_real', 'mask' => 'ls-mask-money', 'value' => $this->fields['custo_real'])); echo "</td>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Lucro (R$)', 'name' => 'lucro', 'mask' => 'ls-mask-money', 'value' => $this->fields['lucro'])); echo "</td>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Margem Contrib(%)', 'name' => 'margem_contrib', 'mask' => 'ls-mask-percent', 'align' => 'right', 'value' => $this->fields['margem_contrib'])); echo "</td>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Extras (R$)', 'name' => 'despesas_extras', 'mask' => 'ls-mask-money', 'value' => $this->fields['despesas_extras'])); echo "</td>"; echo "<td>"; SystemHelper::addTextfield(array('label' => 'Total (R$)', 'name' => 'valor_total', 'required' => true, 'mask' => 'ls-mask-money', 'value' => $this->fields['valor_total'])); echo "</td>"; echo "</tr>"; echo "</table>"; SystemHelper::addLargeTextfield(array('label' => 'Observações', 'name' => 'observacoes', 'rows' => 8, 'value' => $this->fields['observacoes'])); echo "</div>"; echo "<div id='efetivo' class='ls-tab-content' role='tabpanel'>"; include "TaskCasting.php"; include "Casting.php"; include "BankAccount.php"; $this->task_casting = new TaskCasting(); $add_button = $this->task_casting->getActionOptions()["add"]; $base_url = $add_button["url"]; $add_button["url"] = $base_url . "/promotor"; $promotores = array(); $supervisores = array(); $produtores = array(); $this->load->model("taskcasting_model"); $this->taskcasting_model = new Taskcasting_Model(); $remove_bt = array('icon' => 'ls-ico-close', 'url' => '#', 'label' => '', 'onClick' => '$futuri.removeCastingOrProductTask(this);'); //$this->taskcasting_model->debugMode = true; foreach ($this->taskcasting_model->getObjects(array("where" => "trabalho_id = " . $this->objectID)) as $index => $promInfo) { $this->casting = new Casting($promInfo['promotor_id']); $this->bank_account = new BankAccount($promInfo['promotor_conta_banco_id']); $hidden = "<input type='hidden' name='trabalho_select_casting[]' value='" . $promInfo['promotor_id'] . "'>"; $hidden2 = "<input type='hidden' name='trabalho_select_bank[]' value='" . $promInfo['promotor_conta_banco_id'] . "'>"; $hidden3 = "<input type='hidden' name='trabalho_select_valor[]' value='" . $promInfo['promotor_valor_recebido'] . "'>"; switch ($this->casting->fields['funcao_id']) { case TaskCasting::CASTINGJOB_PROMOTER_ID: $promotores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt)); break; case TaskCasting::CASTINGJOB_SUPERVISOR_ID: $supervisores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt)); break; case TaskCasting::CASTINGJOB_PRODUCER_ID: $produtores[] = array($hidden . $this->casting->fields['nome_completo'], $hidden3 . $promInfo['promotor_valor_recebido'], $hidden2 . $this->bank_account->fields['banco_nome'], $this->bank_account->fields['banco_agencia'], $this->bank_account->fields['banco_conta'], array("remove_button" => $remove_bt)); break; } } $headers = array('Nome', 'Valor recebido', 'Banco', 'Agencia', 'Conta', ''); $this->task_casting->showListPanel(array('title' => 'Promotores', 'hideNoneRowsMsg' => true, 'id' => 'task_promotores', 'headers' => $headers, 'list' => $promotores, 'add_button' => $add_button)); $add_button["url"] = $base_url . "/supervisor"; $this->task_casting->showListPanel(array('title' => 'Supervisores', 'id' => 'task_supervisores', 'hideNoneRowsMsg' => true, 'headers' => $headers, 'list' => $supervisores, 'add_button' => $add_button)); $add_button["url"] = $base_url . "/produtor"; $this->task_casting->showListPanel(array('title' => 'Produtores', 'id' => 'task_produtores', 'hideNoneRowsMsg' => true, 'headers' => $headers, 'list' => $produtores, 'add_button' => $add_button)); echo "<table class='easy-form-table'>"; echo "<tr>"; echo "</tr>"; echo "</table>"; echo "</div>"; echo "<div id='produtos_servicos' class='ls-tab-content' role='tabpanel'>"; include "Product.php"; include "TaskProduct.php"; $this->products = new TaskProduct(); $this->load->model("taskproduct_model"); $produtos = array(); $this->taskproduct_model = new Taskproduct_Model(); foreach ($this->taskproduct_model->getObjects(array("where" => "trabalho_id = '" . $this->objectID . "'")) as $ind => $prodInfo) { $this->product = new Product($prodInfo['produto_id']); $produtos[] = array("<input type='hidden' name='trabalho_select_produto[]' value='" . $prodInfo['produto_id'] . "'>" . $this->product->fields['nome'], "<input type='hidden' name='trabalho_select_quantidade[]' value='" . $prodInfo['produto_quantidade'] . "'>" . $prodInfo['produto_quantidade'], array("remove_button" => $remove_bt)); } $this->products->showListPanel(array('title' => 'Produtos/Serviços', 'hideNoneRowsMsg' => true, 'id' => 'task_produtos', 'list' => $produtos, 'headers' => array('Nome', 'Quantidade', ''), 'add_button' => $this->products->getActionOptions()["add"])); echo "</div>"; $this->addButtons(); }