Example #1
0
 static function salvar()
 {
     return function ($req, $res, $svc, $app) {
         $newCliente = $req->paramsPost();
         $isNew = empty($req->id);
         if ($isNew) {
             $cliente = $app->db->cadcliente->create();
             $cliente->set_expr('data', 'now()');
         } else {
             $cliente = $app->db->cadcliente->find_one($req->id);
         }
         $cliente->cidade = $newCliente->cidade;
         $cliente->status = $newCliente->status;
         $cliente->contrato = $newCliente->contrato;
         $cliente->designacao = $newCliente->designacao;
         $cliente->cliente = $newCliente->cliente;
         $cliente->velocidade = $newCliente->velocidade;
         $cliente->operadora = $newCliente->operadora;
         $cliente->endereco = $newCliente->endereco;
         $cliente->equipamento = $newCliente->equipamento;
         $cliente->save();
         $id = $isNew ? $cliente->id() : $req->id;
         Flash::success('Salvo com sucesso');
         $res->redirect("/cliente/{$id}");
     };
 }
Example #2
0
 static function salvar()
 {
     return function ($req, $res, $svc, $app) {
         $newVelocidade = $req->paramsPost();
         $velocidade = $app->db->velocidade->create();
         $velocidade->velocidade = $newVelocidade->velocidade;
         $velocidade->save();
         Flash::success('Velocidade cadastrada com sucesso');
         $res->redirect("/cadastro");
     };
 }
Example #3
0
 static function autenticar()
 {
     return function ($req, $res, $svc, $app) {
         $app->user->authorizeGoogleUser($req->paramsPost()->token);
         if (!$app->user->isLoggedIn()) {
             Flash::warning('Usuário não autorizado');
             return $res->redirect('/entrar');
         }
         $res->redirect('/');
     };
 }
Example #4
0
 static function salvar()
 {
     return function ($req, $res, $svc, $app) {
         $newEquipamento = $req->paramsPost();
         $equipamento = $app->db->equipamento->create();
         $equipamento->cidade = $newEquipamento->cidade;
         $equipamento->fabricante = $newEquipamento->fabricante;
         $equipamento->ident = $newEquipamento->ident;
         $equipamento->equipamento = $newEquipamento->equipamento;
         $equipamento->localizacao = $newEquipamento->localizacao;
         $equipamento->tipo_acesso = $newEquipamento->tipo_acesso;
         $equipamento->ip = $newEquipamento->ip;
         $equipamento->ip_interno = $newEquipamento->ip_interno;
         $equipamento->login = $newEquipamento->login;
         $equipamento->senha = $newEquipamento->senha;
         $equipamento->save();
         Flash::success('Equipamento cadastrado com sucesso');
         $res->redirect("/equipamentos");
     };
 }
Example #5
0
 function render($screen, $data = [])
 {
     require_once 'assets.php';
     $layoutAssets = empty($assets[$screen]) ? pageAssets() : $assets[$screen];
     $layoutAssets['css'] = array_merge($assets['css'], isset($layoutAssets['css']) ? $layoutAssets['css'] : []);
     $layoutAssets['js'] = array_merge($assets['js'], isset($layoutAssets['js']) ? $layoutAssets['js'] : []);
     $data = array_merge($layoutAssets, $data);
     $data['messages'] = Flash::all();
     Flash::clear();
     $data['user'] = $this->user;
     $data['pathInfo'] = rtrim($_SERVER['PATH_INFO'], '/');
     $data['queryString'] = empty($_SERVER['QUERY_STRING']) ? '' : $_SERVER['QUERY_STRING'];
     if ($this->user->isLoggedIn()) {
         $data['pages'] = $this->getPages();
         $data['pages'][] = (object) ['url' => '/sair', 'name' => 'Logout'];
     } else {
         $data['pages'] = [(object) ['url' => '/entrar', 'name' => 'Login']];
     }
     $data['google'] = $this->config->google;
     return $this->engine->renderToString("templates/{$screen}.latte", $data);
 }
Example #6
0
?>
admin/template/js/notify/pnotify.buttons.js"></script>
    <script type="text/javascript" src="<?php 
echo $config['http_base_url'];
?>
admin/template/js/notify/pnotify.nonblock.js"></script>

<?php 
foreach (Flash::all() as $flash) {
    ?>
<script>

     new PNotify({
            type:"<?php 
    echo $flash['type'] == 'notice' ? 'warning' : $flash['type'];
    ?>
",
            text: '<?php 
    echo $flash['message'];
    ?>
'
        });
</script>
<?php 
}
Flash::clear();
?>

</body>

</html>
Example #7
0
    }
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST["MM_insert"]) && $_POST["MM_insert"] == "form1") {
    $insertSQL = sprintf("INSERT INTO sys_users (user_name, user_pwd, user_role_ids, user_fullname, user_email, user_mobile, user_photo, user_state, user_sex, user_created_by) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['user_name'], "text"), GetSQLValueString($_POST['user_pwd'], "text"), GetSQLValueString($_POST['user_role_ids'], "text"), GetSQLValueString($_POST['user_fullname'], "text"), GetSQLValueString($_POST['user_email'], "text"), GetSQLValueString($_POST['user_mobile'], "text"), GetSQLValueString($_POST['user_photo'], "text"), GetSQLValueString(isset($_POST['user_state']) ? "true" : "", "defined", "1", "0"), GetSQLValueString($_POST['user_sex'], "text"), GetSQLValueString($_SESSION['User_id'], "int"));
    mysql_select_db($database_dares_conn, $dares_conn);
    $Result1 = mysql_query($insertSQL, $dares_conn) or die(mysql_error());
    $insertGoTo = "index.php";
    if (isset($_SERVER['QUERY_STRING'])) {
        $insertGoTo .= strpos($insertGoTo, '?') ? "&" : "?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    Flash::success($ecss_lang['sys']['User']['ADD_SUCCESS']);
    header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_dares_conn, $dares_conn);
$query_get_role = "SELECT * FROM sys_role";
$get_role = mysql_query($query_get_role, $dares_conn) or die(mysql_error());
$row_get_role = mysql_fetch_assoc($get_role);
$totalRows_get_role = mysql_num_rows($get_role);
// html page title
$pageTitle = $ecss_lang['sys']['User']['LIST_USER'];
// require page header
require_once $config['base_url'] . '/admin/template/includes/header.php';
?>
<!-- page content -->
    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="x_panel" style="min-height:600px;">
Example #8
0
    }
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST["MM_update"]) && $_POST["MM_update"] == "form1") {
    $updateSQL = sprintf("UPDATE subject_lesson SET lesson_name=%s, lesson_order=%s, lesson_type=%s, lesson_state=%s WHERE lesson_id=%s", GetSQLValueString($_POST['lesson_name'], "text"), GetSQLValueString($_POST['lesson_order'], "int"), GetSQLValueString($_POST['lesson_type'], "int"), GetSQLValueString($_POST['lesson_state'], "int"), GetSQLValueString($_POST['lesson_id'], "int"));
    mysql_select_db($database_dares_conn, $dares_conn);
    $Result1 = mysql_query($updateSQL, $dares_conn) or die(mysql_error());
    $updateGoTo = "index.php";
    if (isset($_SERVER['QUERY_STRING'])) {
        $updateGoTo .= strpos($updateGoTo, '?') ? "&" : "?";
        $updateGoTo .= $_SERVER['QUERY_STRING'];
    }
    Flash::success($ecss_lang['Subject']['Lesson']['EDIT_SUCCESS']);
    header(sprintf("Location: %s", $updateGoTo));
}
$colname_get_lesson_by_lesid = "-1";
if (isset($_GET['lesid'])) {
    $colname_get_lesson_by_lesid = $_GET['lesid'];
}
mysql_select_db($database_dares_conn, $dares_conn);
$query_get_lesson_by_lesid = sprintf("SELECT * FROM subject_lesson WHERE lesson_id = %s", GetSQLValueString($colname_get_lesson_by_lesid, "int"));
$get_lesson_by_lesid = mysql_query($query_get_lesson_by_lesid, $dares_conn) or die(mysql_error());
$row_get_lesson_by_lesid = mysql_fetch_assoc($get_lesson_by_lesid);
$totalRows_get_lesson_by_lesid = mysql_num_rows($get_lesson_by_lesid);
?>

<?php 
// html page title
Example #9
0
require_once '../../../config/boot.php';
use McKay\Flash;
$input = array_merge($_GET, $_POST);
$faculty_id = $input['faculty_id'];
/**  start pagination */
$pagination_per_page = 10;
$pagination_target = 'index.php';
$page = 0;
if (isset($_GET['page'])) {
    $page = $_GET['page'];
}
$pagination_start = $page * $pagination_per_page;
/** end pagination */
// check if the faculty exists first
if (!($facultyRow = db_row_exists('academy_structure_faculty', 'faculty_id', $faculty_id, ['faculty_name']))) {
    Flash::warning(trans('ACADEMY_STRUCTURE.YEAR.FACULTY_DONT_EXIST'));
    header('location:../faculties/index.php');
    exit;
}
$query_get_year = sprintf("SELECT year_name,user_fullname ,year_id,year_name,year_created_date,\n    year_faculty_id FROM academy_structure_year asy \n  LEFT JOIN academy_structure_faculty asf ON asy.year_faculty_id=asf.faculty_id \n  LEFT JOIN sys_users su ON asy.year_created_by=su.user_id \n  WHERE year_faculty_id = %s GROUP BY asy.year_id", GetSQLValueString($faculty_id, "int"));
$query_get_year_limit = sprintf("%s LIMIT %d, %d", $query_get_year, $pagination_start, $pagination_per_page);
$get_year_recordset = mysql_query($query_get_year, $dares_conn) or die(mysql_error());
$get_year_recordset_limit = mysql_query($query_get_year_limit, $dares_conn) or die(mysql_error());
$row_get_year = mysql_fetch_assoc($get_year_recordset_limit);
$total = mysql_num_rows($get_year_recordset_limit);
$pagination_total = mysql_num_rows($get_year_recordset_limit);
// html page title
$pageTitle = 'السنوات الدراسية';
// require page header
require_once $config['base_url'] . '/admin/template/includes/header.php';
?>
Example #10
0
require_once '../../../config/boot.php';
use McKay\Flash;
$input = array_merge($_GET, $_POST);
$action = $input['action'];
if (empty($action)) {
    header('location:index.php');
}
if ($action == 'delete') {
    $faculty_id = GetSQLValueString($input['faculty_id'], "int");
    $delete = sprintf("DELETE FROM academy_structure_faculty WHERE faculty_id=%s", $faculty_id);
    mysql_select_db($database_dares_conn, $dares_conn);
    $result = mysql_query($delete, $dares_conn) or die(mysql_error());
    if ($result) {
        Flash::success($ecss_lang['ACADEMY_STRUCTURE']['FACULTY']['DELETE_SUCCESS']);
    } else {
        Flash::success($ecss_lang['ACADEMY_STRUCTURE']['FACULTY']['DELETE_ERROR']);
    }
}
if ($action == 'mass-delete') {
    mysql_select_db($database_dares_conn, $dares_conn);
    $ids = implode(",", $input['table_records']);
    $delete = sprintf('DELETE FROM academy_structure_faculty WHERE faculty_id IN(%s)', $ids);
    $query = mysql_query($delete);
    if ($query) {
        Flash::success($ecss_lang['ACADEMY_STRUCTURE']['FACULTY']['MASS_DELETE_SUCCESS']);
    } else {
        Flash::error($ecss_lang['ACADEMY_STRUCTURE']['FACULTY']['MASS_DELETE_ERROR']);
    }
}
header('location:index.php');
exit;
Example #11
0
    exit;
}
$createFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $createFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($input["MM_insert"]) && $input["MM_insert"] == "form1") {
    $year_name = GetSQLValueString($input['year_name'], "text");
    if (empty($year_name)) {
        header('location: edit.php?year_id=' . $yearRow['year_name']);
        exit;
    }
    $insert = sprintf("UPDATE academy_structure_year SET year_name=%s WHERE year_id=%s", $year_name, $yearRow['year_id']);
    $result = mysql_query($insert, $dares_conn) or die(mysql_error());
    if ($result) {
        Flash::success($ecss_lang['ACADEMY_STRUCTURE']['YEAR']['UPDATE_SUCCESS']);
        header('location: index.php?faculty_id=' . $facultyRow['faculty_id']);
        exit;
    }
}
// html page title
$pageTitle = 'تعديل سنة ' . $yearRow['year_name'];
// require page header
require_once $config['base_url'] . '/admin/template/includes/header.php';
?>
<!-- page content -->

    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="x_panel" style="min-height:600px;">
        <div class="x_title">
          <h2><?php 
Example #12
0
 static function salvar()
 {
     return function ($req, $res, $svc, $app) {
         $newTicket = $req->paramsPost();
         $isNew = empty($req->id);
         if ($isNew) {
             $ticket = $app->db->ticket->create();
             $ticket->criado_em = date('Y-m-d H:i:s');
             $ticket->protocolo = date('YmdHis');
             $ticket->operadora = $newTicket->operadora;
             $ticket->cidade = $newTicket->cidade;
             $ticket->tipo_problema = $newTicket->tipo_problema;
             $ticket->cliente_final = $newTicket->cliente_final;
             $ticket->designacao = $newTicket->designacao;
         } else {
             $ticket = $app->db->ticket->find_one($req->id);
         }
         $ticket->previsao = $newTicket->previsao;
         $ticket->status = $newTicket->status;
         $ticket->telefone = $newTicket->telefone;
         $ticket->obs = $newTicket->obs;
         $ticket->save();
         $id = $isNew ? $ticket->id() : $req->id;
         Flash::success('Salvo com sucesso');
         $res->redirect("/ticket/{$id}");
     };
 }
Example #13
0
 static function removeEmail()
 {
     return function ($req, $res, $svc, $app) {
         $app->db->user_email->find_one($req->id)->delete();
         Flash::success('Email removido com sucesso');
         $res->code(204)->header('X-Location', $req->headers()->referer)->send();
     };
 }
Example #14
0
                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "long":
            case "int":
                $theValue = $theValue != "" ? intval($theValue) : "NULL";
                break;
            case "double":
                $theValue = $theValue != "" ? doubleval($theValue) : "NULL";
                break;
            case "date":
                $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
                break;
            case "defined":
                $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
                break;
        }
        return $theValue;
    }
}
if (isset($_GET['lesid']) && $_GET['lesid'] != "") {
    $deleteSQL = sprintf("DELETE FROM subject_lesson WHERE lesson_id=%s", GetSQLValueString($_GET['lesid'], "int"));
    mysql_select_db($database_dares_conn, $dares_conn);
    $Result1 = mysql_query($deleteSQL, $dares_conn) or die(mysql_error());
    $deleteGoTo = "index.php";
    if (isset($_SERVER['QUERY_STRING'])) {
        $deleteGoTo .= strpos($deleteGoTo, '?') ? "&" : "?";
        $deleteGoTo .= $_SERVER['QUERY_STRING'];
    }
    Flash::success($ecss_lang['Subject']['Lesson']['DELETE_SUCCESS']);
    header(sprintf("Location: %s", $deleteGoTo));
}
Example #15
0
$createFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
    $createFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if (isset($_POST["MM_insert"]) && $_POST["MM_insert"] == "form1") {
    $faculty_name = GetSQLValueString($_POST['faculty_name'], "text");
    $user_id = GetSQLValueString($_SESSION['User_id'], "int");
    if (empty($faculty_name)) {
        header('location: create.php');
        exit;
    }
    $insert = sprintf("INSERT INTO academy_structure_faculty (faculty_name, faculty_created_by) VALUES (%s, %s)", $faculty_name, $user_id);
    mysql_select_db($database_dares_conn, $dares_conn);
    $result = mysql_query($insert, $dares_conn) or die(mysql_error());
    if ($result) {
        Flash::success($ecss_lang['ACADEMY_STRUCTURE']['FACULTY']['ADD_SUCCESS']);
        header('location: index.php');
        exit;
    }
}
// html page title
$pageTitle = 'إضافة كلية';
// require page header
require_once $config['base_url'] . '/admin/template/includes/header.php';
?>
<!-- page content -->

    <div class="col-md-12 col-sm-12 col-xs-12">
      <div class="x_panel" style="min-height:600px;">
        <div class="x_title">
          <h2>الكليات</h2>