noalyss Version-9
mobile.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * PhpCompta is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * PhpCompta is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with PhpCompta; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20// Copyright (2002-2021) Author Dany De Bontridder <danydb@noalyss.eu>
21
22/**
23 * @file
24 * @brief only for mobile device
25 */
26
27require_once '../include/constant.php';
28require_once NOALYSS_INCLUDE.'/lib/ac_common.php';
29MaintenanceMode("block.html");
30
31global $g_user;
32
34$g_user=new \Noalyss_User($cn);
35$g_user->check();
36if ( !defined ("ALLOWED") ) { define ('ALLOWED',true); }
37
38//-----------------------------------------------------------------
39/// if $_REQUEST['gDossier'] is not set then select the folder
40//-----------------------------------------------------------------
42
43$dossier_id=$http->request("gDossier","number",-1);
44if ($dossier_id === -1) {
45 // count the available folder
46 $cnt_folder=$g_user->get_available_folder();
47
48 // if there is no available folder , then exit
49 if ($cnt_folder==0) {
50 echo _("Aucun dossier disponible");
51 redirect(NOALYSS_URL."/index.php", 3);
52 return;
53 }
54 if (count($cnt_folder ) == 1) {
55 // if only one folder available , connect to it
56 $dossier_id=$cnt_folder[0]['dos_id'];
57 put_global(array(['key'=>'gDossier',"value"=>$dossier_id]));
58 } else {
59 $mobile=new \Noalyss\Mobile();
60 //-----------------------------------------------------------------
61 // --- load the javascript and start a page ----------------------
62 //-----------------------------------------------------------------
63 $mobile->page_start();
64 // propose to select the available folder
65 echo '<ul class="nav bg-light flex-column">';
66 foreach ($cnt_folder as $folder)
67 {
68 echo '<li>';
69 echo '<a class="nav-item nav-link " href="mobile.php?gDossier='.$folder['dos_id'].'">';
70 echo $folder['dos_id']." ".$folder['dos_name']." ".$folder["dos_description"];
71 echo '</a>';
72 echo '</li>';
73 }
74 echo '</ul>';
75 return;
76 }
77
78}
79// we are connected to a folder
80global $g_user,$cn;
82$g_user->setDb($cn);
83
86$mobile=new \Noalyss\Mobile();
87
88$ac=trim($http->request("ac","string",""));
89
90//-----------------------------------------------------------------
91/// If a module is selected the execute it
92//-----------------------------------------------------------------
93if ( $ac !== "" && $g_user->check_module($ac) == 1) {
94
95 // if $ac is in the mobile profile then execute it
96 $mobile->execute_menu($ac);
97} else {
98//-----------------------------------------------------------------
99/// inside a folder , propose a menu
100//-----------------------------------------------------------------
101 $mobile->page_start();
102 $mobile->display_menu();
103}
MaintenanceMode($p_file)
When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the message ...
Definition: ac_common.php:1663
put_global($array)
Put in superglobal (get,post,request) the value contained in the parameter field (me_parameter)
Definition: ac_common.php:1233
contains the class for connecting to Noalyss
static connect()
manage the http input (get , post, request) and extract from an array
Class to manage the company parameter (address, name...)
global $g_user
Definition: mobile.php:31
$cn
Definition: mobile.php:33
$mobile
Definition: mobile.php:86
if(!defined("ALLOWED")) $http
if $_REQUEST['gDossier'] is not set then select the folder
Definition: mobile.php:41
$ac
Definition: mobile.php:88
global $g_parameter
Definition: mobile.php:84
$dossier_id
Definition: mobile.php:43
redirect($p_string, $p_time=0)