public function insert() { $data = array('render' => 'Exemple/views/forms/insert', 'title' => 'Inserir', 'styles' => ['/css/main.css', '/css/exemple-forms.css']); $data['employee'] = ['name' => 'Nome do funcionário', 'job' => 'Nome da profissão', 'payment' => '00.00']; $params = $this->get('params'); if (count($params) > 0) { $data['employee'] = $params; $this->model('exemple'); foreach ($params as $field => $value) { $this->exemple->{$field} = $value; } $data['message'] = $this->exemple->save(); } Tools::contents($data['message']); $this->view('Exemple/views/index', $data); }
public function ordenarByAjax(array $datos = array()) { $post = \core\HTTP_Requerimiento::post(); $datos['filas'] = json_decode($post['rows'], true); if ($post['ordenType'] == 'asc') { $ordenType = true; } else { $ordenType = false; } $juegosOrdenados = \core\Tools::ordenarArray($datos['filas'], $post['field'], $ordenType); echo json_encode($juegosOrdenados); //echo json_encode($datos['filas']); }
<?php if (isset($employee)) { \core\Tools::contents($employee); ?> <form id="exemple-edit" class="form exemple-edit" action="/exemple/action/edit" method="post"> <fieldset class="form-fieldset"> <legend class="form-legend">Cadastro de trabalhadores</legend> <input id="exemple-id" type="hidden" name="exemple-id" value="<?php echo $employee['id']; ?> "> <div class="form-conteiner form-conteiner-fields"> <label class="form-label" for="exemple-name">Nome</label> <input id="exemple-name" class="form-text exemple-name" type="text" name="exemple-name" value="<?php echo ucwords($employee['name']); ?> "> </div> <div class="form-conteiner form-conteiner-fields"> <label class="form-label" for="exemple-job">Emprego</label> <input id="exemple-job" class="form-text exemple-job" type="text" name="exemple-job" value="<?php echo ucwords($employee['job']); ?> "> </div> <div class="form-conteiner form-conteiner-fields"> <label class="form-label" for="exemple-payment">Salário</label> <input id="exemple-payment" class="form-text exemple-payment" type="text" name="exemple-payment" value="<?php echo $employee['payment']; ?>
public static function hook_mod_arkeogis_export_database($hookname, $userdata, $matches) { $dbId = (int) $matches[1]; if (!\mod\user\Main::userIsLoggedIn() || (!\mod\user\Main::userBelongsToGroup('Admin') && !\mod\arkeogis\ArkeoGIS::isDatabaseOwner($dbId, \mod\user\Main::getUserId($_SESSION['login'])) || !$dbId)) { return false; } $q = "SELECT si_id, si_code, si_name, si_description, si_city_name, si_city_code, ST_AsGeoJSON(si_geom) as coords, si_centroid, si_occupation, si_creation, si_modification"; // ark_site $q .= ", da_name, da_description, da_creation, da_modification"; // ark_database $q .= ", sp_id, sp_knowledge_type, sp_comment, sp_bibliography"; // ark_site_period $q .= ", (SELECT node_path FROM ark_period WHERE pe_id=sp_period_start) AS period_start"; $q .= ", (SELECT node_path FROM ark_period WHERE pe_id=sp_period_end) AS period_end"; $q .= " FROM ark_site s LEFT JOIN ark_database d ON s.si_database_id = d.da_id LEFT JOIN ark_site_period sp ON s.si_id = sp.sp_site_id"; $q .= " WHERE da_id = ?"; $q .= " GROUP BY si_id, sp_id, da_id"; $q .= " ORDER BY si_code, si_id, sp_id"; $infos = \mod\arkeogis\ArkeoGIS::getFullDatabaseInfos($dbId); $name = str_replace(' ', '_', \core\Tools::removeAccents($infos[0]['name'])); $author = str_replace(' ', '_', \core\Tools::removeAccents($infos[0]['author'])); $filename = 'ArkeoGIS-export-' . date("d-m-Y-H-i") . '-' . $name . '-' . $author; \mod\arkeogis\ArkeoGIS::sitesToCsv(\core\Core::$db->fetchAll($q, array((int) $dbId)), $filename); }