├── .github └── workflows │ ├── main.yml │ └── php-lint.yml ├── .gitignore ├── .php_cs.dist ├── .travis.yml ├── LICENSE ├── README.md ├── ajax ├── profile_tabs.php └── room.tabs.php ├── front ├── dropdown1.form.php ├── dropdown1.php ├── profile.form.php ├── room.form.php ├── room.php ├── roomaccesscond.form.php ├── roomaccesscond.php ├── roomtype.form.php └── roomtype.php ├── hook.php ├── inc ├── dropdown1.class.php ├── menu.class.php ├── profile.class.php ├── room.class.php ├── room_computer.class.php ├── roomaccesscond.class.php └── roomtype.class.php ├── index.php ├── locales ├── hr_HR.php ├── hu_HU.mo ├── hu_HU.po ├── it_IT.mo ├── it_IT.po └── room.pot ├── room.png ├── room.xml └── setup.php /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | on: [push, pull_request] 2 | name: Main 3 | jobs: 4 | php-cs-fixer: 5 | name: PHP-CS-Fixer 6 | runs-on: ubuntu-latest 7 | steps: 8 | - uses: actions/checkout@v2 9 | - name: PHP-CS-Fixer 10 | uses: docker://oskarstark/php-cs-fixer-ga 11 | -------------------------------------------------------------------------------- /.github/workflows/php-lint.yml: -------------------------------------------------------------------------------- 1 | name: PHP Linting 2 | on: pull_request 3 | jobs: 4 | phplint: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v1 8 | - uses: michaelw90/PHP-Lint@master 9 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .php_cs -------------------------------------------------------------------------------- /.php_cs.dist: -------------------------------------------------------------------------------- 1 | in(__DIR__) 5 | ; 6 | 7 | $config = PhpCsFixer\Config::create() 8 | ->setRiskyAllowed(true) 9 | ->setRules([ 10 | '@PSR1' => true, // Apply PSR-1 11 | '@PSR2' => true, // Apply PSR-2 12 | 13 | 'align_multiline_comment' => true, // Each line of multi-line DocComments must have an asterisk [PSR-5] and must be aligned with the first one. 14 | 'array_indentation' => true, // Each element of an array must be indented exactly once. 15 | 'array_syntax' => ['syntax' => 'short'], // PHP arrays should be declared using the configured syntax. 16 | 'backtick_to_shell_exec' => true, // Converts backtick operators to shell_exec calls. 17 | 'binary_operator_spaces' => ['default' => 'single_space'], // Binary operators should be surrounded by space as configured. 18 | 'blank_line_after_opening_tag' => true, // Ensure there is no code on the same line as the PHP open tag and it is followed by a blank line. 19 | 'cast_spaces' => true, // A single space or none should be between cast and variable. 20 | 'class_attributes_separation' => true, // Class, trait and interface elements must be separated with one blank line. 21 | 'class_keyword_remove' => true, // Converts ::class keywords to FQCN strings. 22 | 'combine_consecutive_issets' => true, // Converts ::class keywords to FQCN strings. 23 | 'combine_consecutive_unsets' => true, // Calling unset on multiple items should be done in one call. 24 | 'compact_nullable_typehint' => true, // Remove extra spaces in a nullable typehint. 25 | 'concat_space' => ['spacing' => 'one'], // Concatenation should be spaced according configuration. 26 | 'declare_equal_normalize' => ['space' => 'single'], // Equal sign in declare statement should be surrounded by spaces or not following configuration. 27 | 'dir_constant' => true, // Replaces dirname(__FILE__) expression with equivalent __DIR__ constant. 28 | 'ereg_to_preg' => true, // Replace deprecated ereg regular expression functions with preg. 29 | 'explicit_indirect_variable' => true, // Add curly braces to indirect variables to make them clear to understand. Requires PHP >= 7.0. 30 | 'fully_qualified_strict_types' => true, // Transforms imported FQCN parameters and return types in function arguments to short version. 31 | 'function_typehint_space' => true, // Add missing space between function's argument and its typehint. 32 | 'include' => true, // Include/Require and file path should be divided with a single space. File path should not be placed under brackets. 33 | 'increment_style' => ['style' => 'pre'], // Pre- or post-increment and decrement operators should be used if possible. 34 | 'line_ending' => true, // All PHP files must use same line ending. 35 | 'list_syntax' => ['syntax' => 'short'], // List (array destructuring) assignment should be declared using the configured syntax. Requires PHP >= 7.1. 36 | 'logical_operators' => true, // Use && and || logical operators instead of and and or. 37 | 'lowercase_cast' => true, // Cast should be written in lower case. 38 | 'lowercase_static_reference' => true, // Class static references self, static and parent MUST be in lower case. 39 | 'magic_constant_casing' => true, // Magic constants should be referred to using the correct casing. 40 | 'mb_str_functions' => true, // Replace non multibyte-safe functions with corresponding mb function. 41 | 'modernize_types_casting' => true, // Replaces intval, floatval, doubleval, strval and boolval function calls with according type casting operator. 42 | 'multiline_comment_opening_closing' => true, // DocBlocks must start with two asterisks, multiline comments must start with a single asterisk, after the opening slash. Both must end with a single asterisk before the closing slash. 43 | 'multiline_whitespace_before_semicolons' => true, // Forbid multi-line whitespace before the closing semicolon or move the semicolon to the new li ne for chained calls. 44 | 'native_function_casing' => true, // Function defined by PHP should be called using the correct casing. 45 | 'new_with_braces' => true, // All instances created with new keyword must be followed by braces. 46 | 'no_alias_functions' => true, // Master functions shall be used instead of aliases. 47 | 'no_alternative_syntax' => true, // Replace control structure alternative syntax to use braces. 48 | 'no_blank_lines_after_class_opening' => true, // There should be no empty lines after class opening brace. 49 | 'no_empty_comment' => true, // There should not be any empty comments. 50 | 'no_empty_phpdoc' => true, // There should not be empty PHPDoc blocks. 51 | 'no_empty_statement' => true, // Remove useless semicolon statements. 52 | 'no_extra_blank_lines' => ['tokens' => [ // Removes extra blank lines and/or blank lines following configuration. 53 | 'break', 54 | 'case', 55 | 'continue', 56 | 'curly_brace_block', 57 | 'default', 58 | 'extra', 59 | 'parenthesis_brace_block', 60 | 'return', 61 | 'square_brace_block', 62 | 'switch', 63 | 'throw', 64 | 'use', 65 | 'useTrait', 66 | 'use_trait', 67 | ]], 68 | 'no_homoglyph_names' => true, // Replace accidental usage of homoglyphs (non ascii characters) in names. 69 | 'no_leading_import_slash' => true, // Remove leading slashes in use clauses. 70 | 'no_leading_namespace_whitespace' => true, // The namespace declaration line shouldn't contain leading whitespace. 71 | 'no_mixed_echo_print' => ['use' => 'echo'], // Either language construct print or echo should be used. 72 | 'no_multiline_whitespace_around_double_arrow' => true, // Operator => should not be surrounded by multi-line whitespaces. 73 | 'no_null_property_initialization' => true, // Properties MUST not be explicitly initialized with null. 74 | 'no_php4_constructor' => true, // Convert PHP4-style constructors to __construct. 75 | 'no_short_bool_cast' => true, // Short cast bool using double exclamation mark should not be used. 76 | 'no_short_echo_tag' => true, // Replace short-echo true, // Single-line whitespace before closing semicolon are prohibited. 78 | 'no_spaces_around_offset' => true, // There MUST NOT be spaces around offset braces. 79 | 'no_trailing_comma_in_singleline_array' => true, // PHP single-line arrays should not have trailing comma. 80 | 'no_unneeded_control_parentheses' => true, // Removes unneeded parentheses around control statements. 81 | 'no_unneeded_curly_braces' => true, // Removes unneeded curly braces that are superfluous and aren't part of a control structure's body. 82 | 'no_unneeded_final_method' => true, // A final class must not have final methods. 83 | 'no_unreachable_default_argument_value' => true, // In function arguments there must not be arguments with default values before non-default ones. 84 | 'no_unused_imports' => true, // Unused use statements must be removed. 85 | 'no_useless_return' => true, // There should not be an empty return statement at the end of a function. 86 | 'no_whitespace_before_comma_in_array' => true, // In array declaration, there MUST NOT be a whitespace before each comma. 87 | 'no_whitespace_in_blank_line' => true, // Remove trailing whitespace at the end of blank lines. 88 | 'non_printable_character' => true, // Remove Zero-width space (ZWSP), Non-breaking space (NBSP) and other invisible unicode symbols. 89 | 'normalize_index_brace' => true, // Array index should always be written by using square braces. 90 | 'object_operator_without_whitespace' => true, // There should not be space before or after object T_OBJECT_OPERATOR ->. 91 | 92 | 'phpdoc_add_missing_param_annotation' => true, // Phpdoc should contain @param for all params. 93 | 'phpdoc_align' => ['align' => 'left'], // All items of the given phpdoc tags must be either left-aligned or (by default) aligned vertically. 94 | 'phpdoc_indent' => true, // Docblocks should have the same indentation as the documented subject. 95 | 'phpdoc_scalar' => true, // Scalar types should always be written in the same form. int not integer, bool not boolean, float not real or double. 96 | 'phpdoc_separation' => true, // Annotations in phpdocs should be grouped together so that annotations of the same type immediately follow each oth er, and annotations of a different type are separated by a single blank line. 97 | 'phpdoc_single_line_var_spacing' => true, // Single line @var PHPDoc should have proper spacing. 98 | 'phpdoc_to_comment' => true, // Docblocks should only be used on structural elements. 99 | 'phpdoc_types' => true, // The correct case must be used for standard PHP types in PHPDoc. 100 | 'phpdoc_var_without_name' => true, // @var and @type annotations should not contain the variable name. 101 | 102 | 'pow_to_exponentiation' => true, // Converts pow to the ** operator. 103 | 'random_api_migration' => true, // Replaces rand, srand, getrandmax functions calls with their mt_* analogs. 104 | 'return_assignment' => true, // Local, dynamic and directly referenced variables should not be assigned and directly returned by a function or method. 105 | 'return_type_declaration' => true, // There should be one or no space before colon, and one space after it in return type declarations, according to configuration. 106 | 'self_accessor' => true, // Inside class or interface element self should be preferred to the class name itself. 107 | 'semicolon_after_instruction' => true, // Instructions must be terminated with a semicolon. 108 | 'set_type_to_cast' => true, // Cast shall be used, not settype. 109 | 'short_scalar_cast' => true, // Cast (boolean) and (integer) should be written as (bool) and (int), (double) and (real) as (float). 110 | 'single_blank_line_before_namespace' => true, // There should be exactly one blank line before a namespace declaration. 111 | 'single_line_comment_style' => true, // Single-line comments and multi-line comments with only one line of actual content should use the // syntax . 112 | 'single_quote' => true, // Convert double quotes to single quotes for simple strings. 113 | 'space_after_semicolon' => true, // Fix whitespace after a semicolon. 114 | 'standardize_increment' => true, // Increment and decrement operators should be used if possible. 115 | 'standardize_not_equals' => true, // Replace all <> with !=. 116 | 'string_line_ending' => true, // All multi-line strings must use correct line ending. 117 | 'ternary_operator_spaces' => true, // Standardize spaces around ternary operator. 118 | 'trailing_comma_in_multiline_array' => true, // PHP multi-line arrays should have a trailing comma. 119 | 'trim_array_spaces' => true, // Arrays should be formatted like function/method arguments, without leading or trailing single line space. 120 | 'unary_operator_spaces' => true, // Unary operators should be placed adjacent to their operands. 121 | 'whitespace_after_comma_in_array' => true, // In array declaration, there MUST be a whitespace after each comma. 122 | 123 | ]) 124 | ->setFinder( 125 | PhpCsFixer\Finder::create() 126 | ->in(__DIR__) 127 | ) 128 | ; 129 | 130 | return $config; 131 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | script: 2 | - vendor/bin/robo --no-interaction code:cs 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Room Management plugin for [GLPI](www.glpi-project.org) 2 | ======================================================= 3 | 4 | This is a plugin to add room management feature to [**GLPI** assets inventory 5 | software](http://glpi-project.org). 6 | 7 | Description 8 | ----------- 9 | 10 | This plugin allows you to manage the rooms and the elements that are included 11 | in. A room is not the same as a location that already exists in GLPI because it 12 | can not contain items nor be loaned (which a room can be). 13 | 14 | GLPI 9.5.1 compatibility added and tested. Translation fixed (gettext domain). 15 | I also added a basic hungarian translation :) 16 | 17 | Installation 18 | ------------ 19 | 20 | This plugins installs as any other GLPI plugin. 21 | 22 | 1. Place the current source code tree in a directory named `room` and move this 23 | one inside the `plugins` directory of your GLPI installation. 24 | 2. Go to *Setup* > *Plugins*. 25 | 3. Look for the *Room Management* plugin's row. 26 | 4. Click on the *Install* button. 27 | 5. Click on the *Enable* button. 28 | 29 | Uninstallation 30 | -------------- 31 | 32 | This plugins uninstalls as any other GLPI plugin. 33 | 34 | 1. Go to *Setup* > *Plugins*. 35 | 2. Look for the *Room Management* plugin's row. 36 | 3. Click on the *Disable* button. 37 | 4. Click on the *Uninstall* button. 38 | 5. Delete the `plugins/room` directory of your GLPI installation. 39 | 40 | Contributing 41 | ------------ 42 | 43 | Please follow the following rules for contributing: 44 | 45 | * Respect [PSR-1](http://www.php-fig.org/psr/psr-1/) and [PSR-2](http://www.php-fig.org/psr/psr-2/). 46 | * Open an issue for each bug/feature so it can be discussed. 47 | * Follow [development guidelines](http://glpi-developer-documentation.readthedocs.io/en/master/plugins/guidelines.html). 48 | * Refer to [GitFlow](http://git-flow.readthedocs.io) process for branching. 49 | * Work on a new branch on your own fork. 50 | * Open a PR for merging. It will be reviewed by a developer. 51 | 52 | ### Coding standards 53 | 54 | Respect of coding standard is checked by [*PHP Coding Standards Fixer*](http://cs.sensiolabs.org). 55 | The `.php_cs.dist` file contains the standards to conform to. 56 | 57 | Command to list all PHP files with standard issues: 58 | 59 | ```Shell 60 | php php-cs-fixer-v2.phar fix --config .php_cs.dist --dry-run. 61 | ``` 62 | 63 | Same command but includes detail of actual lines with standard issues: 64 | 65 | ```Shell 66 | php php-cs-fixer-v2.phar fix --config .php_cs.dist --dry-run --diff . 67 | ``` 68 | 69 | Command to fix thoses issues: 70 | 71 | ```Shell 72 | php php-cs-fixer-v2.phar fix --config .php_cs.dist . 73 | ``` 74 | -------------------------------------------------------------------------------- /ajax/profile_tabs.php: -------------------------------------------------------------------------------- 1 | showrelationsForm($_POST['ID']); 12 | } 13 | -------------------------------------------------------------------------------- /ajax/room.tabs.php: -------------------------------------------------------------------------------- 1 | 0 && $Room->can($_POST['id'], READ)) { 16 | switch ($_REQUEST['glpi_tab']) { 17 | case -1: // Onglet Tous 18 | $Room->showComputers($_POST['target'], $_POST['id']); 19 | Reservation::showForItem($Room); 20 | break; 21 | default: // Logiquement Onglet Principal 22 | if ($_POST['id']) { 23 | if (!CommonGLPI::displayStandardTab($Room, $_POST['id'], $_REQUEST['glpi_tab'])) { 24 | $Room->showComputers($_POST['target'], $_POST['id']); 25 | } 26 | } 27 | break; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /front/dropdown1.form.php: -------------------------------------------------------------------------------- 1 | update($_POST); 12 | Html::back(); 13 | } 14 | -------------------------------------------------------------------------------- /front/room.form.php: -------------------------------------------------------------------------------- 1 | check(-1, CREATE, $_POST); 26 | 27 | $newID = $room->add($_POST); 28 | Html::back(); 29 | } else { 30 | if (isset($_POST['delete'])) { // Supression d'une salle 31 | $room->check($_POST['id'], DELETE); 32 | 33 | $room->delete($_POST); 34 | Html::redirect($CFG_GLPI['root_doc'] . '/plugins/room/index.php'); 35 | } else { 36 | if (isset($_POST['purge'])) { // Purge de la salle 37 | $room->check($_POST['id'], PURGE); 38 | 39 | $room->delete($_POST, 1); 40 | Html::redirect($CFG_GLPI['root_doc'] . '/plugins/room/index.php'); 41 | } else { 42 | if (isset($_POST['restore'])) { // Restauration de la salle 43 | $room->check($_POST['id'], PURGE); 44 | 45 | $room->restore($_POST); 46 | Html::redirect($CFG_GLPI['root_doc'] . '/plugins/room/index.php'); 47 | } else { 48 | if (isset($_POST['update'])) { // Modification d'une salle 49 | $room->check($_POST['id'], UPDATE); 50 | 51 | $room->update($_POST); 52 | Html::back(); 53 | } else { 54 | if (isset($_POST['additem'])) { // Ajout de la liaison à un ordinateur 55 | $room->check($_POST['room_id'], UPDATE); // Ça devrait pas être rooms_id? 56 | 57 | if ($_POST['room_id'] > 0 && $_POST['computers_id'] > 0) { 58 | $room->plugin_room_AddDevice($_POST['room_id'], $_POST['computers_id']); 59 | } 60 | Html::back(); 61 | } else { 62 | if (isset($_POST['deleteitem'])) { // Suppression de la liaison à un ordinateur 63 | $room->check($_POST['room_id'], UPDATE); 64 | 65 | if (count($_POST['item'])) { 66 | foreach ($_POST['item'] as $key => $val) { 67 | $room->plugin_room_DeleteDevice($key); 68 | } 69 | } 70 | Html::back(); 71 | } else { // Logiquement on passe ici pour visualiser une salle 72 | $room->check($_GET['id'], READ); 73 | 74 | // test l'onglet de départ a afficher à l'ouverture de la fiche 75 | if (!isset($_SESSION['glpi_tab'])) { 76 | $_SESSION['glpi_tab'] = 1; 77 | } 78 | if (isset($_GET['tab'])) { 79 | $_SESSION['glpi_tab'] = $_GET['tab']; 80 | } 81 | 82 | Html::header(__('Room Management', 'room'), '', 'assets', 'pluginroommenu'); 83 | 84 | $room->display($_GET); 85 | 86 | Html::footer(); 87 | } 88 | } 89 | } 90 | } 91 | } 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /front/room.php: -------------------------------------------------------------------------------- 1 | tableExists('glpi_plugin_room_rooms')) { 11 | $query = <<<'EOS' 12 | CREATE TABLE `glpi_plugin_room_rooms` ( 13 | `id` int(11) NOT NULL auto_increment, 14 | `name` varchar(255) collate utf8_unicode_ci default NULL, 15 | `entities_id` int(11) NOT NULL default 0, 16 | `locations_id` int(11) NOT NULL default 0, 17 | `is_recursive` smallint(6) NOT NULL default 0, 18 | `is_deleted` smallint(6) NOT NULL default 0, 19 | `type` int(11) NOT NULL default 0, 20 | `date_mod` datetime default NULL, 21 | `size` smallint(6) NOT NULL default 0, 22 | `count_linked` smallint(6) NOT NULL default 0, 23 | `buy` datetime default NULL, 24 | `access` int(11) NOT NULL default 0, 25 | `printer` smallint(6) NOT NULL default 0, 26 | `videoprojector` smallint(6) NOT NULL default 0, 27 | `wifi` smallint(6) NOT NULL default 0, 28 | `comment` text collate utf8_unicode_ci, 29 | `opening` varchar(255) collate utf8_unicode_ci default NULL, 30 | `limits` varchar(255) collate utf8_unicode_ci default NULL, 31 | `text1` varchar(255) collate utf8_unicode_ci default NULL, 32 | `text2` varchar(255) collate utf8_unicode_ci default NULL, 33 | `dropdown1` int(11) NOT NULL default 0, 34 | `dropdown2` int(11) NOT NULL default 0, 35 | `tech_num` int(11) NOT NULL default 0, 36 | `users_id` int(11) NOT NULL default 0, 37 | `is_template` smallint(6) NOT NULL default 0, # not used / for reservation search engine 38 | `location` smallint(6) NOT NULL default 0, # not used / for reservation search engine 39 | `state` smallint(6) NOT NULL default 0, # not used / for reservation search engine 40 | `manufacturers_id` smallint(6) NOT NULL default 0, # not used / for reservation search engine 41 | `groups_id` smallint(6) NOT NULL default 0, # not used / for reservation search engine 42 | `groups_id_tech` int(11) NOT NULL default 0 COMMENT "Group in charge of the hardware. RELATION to glpi_groups (id)", 43 | PRIMARY KEY (`id`), 44 | KEY `entities_id` (`entities_id`), 45 | KEY `is_deleted` (`is_deleted`), 46 | KEY `type` (`type`), 47 | KEY `name` (`name`), 48 | KEY `buy` (`buy`), 49 | KEY `dropdown1` (`dropdown1`), 50 | KEY `dropdown2` (`dropdown2`), 51 | KEY `tech_num` (`tech_num`), 52 | KEY `users_id` (`users_id`) 53 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 54 | EOS; 55 | $DB->query($query) || die('error adding glpi_plugin_room table ' . __('Error during the database update', 'room') . $DB->error()); 56 | } 57 | 58 | // Table to link Rooms to Computers 59 | if (!$DB->TableExists('glpi_plugin_room_rooms_computers')) { 60 | $query = <<<'EOS' 61 | CREATE TABLE `glpi_plugin_room_rooms_computers` ( 62 | `id` int(11) NOT NULL auto_increment, 63 | `computers_id` int(11) NOT NULL, 64 | `rooms_id` int(11) NOT NULL, 65 | PRIMARY KEY (`id`), 66 | UNIQUE `computers_id` (`computers_id`), 67 | KEY `rooms_id` (`rooms_id`) 68 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 69 | EOS; 70 | $DB->query($query) || die('error adding glpi_plugin_room_rooms_computers table ' . __('Error during the database update', 'room') . $DB->error()); 71 | } 72 | 73 | // Table for Room types 74 | if (!$DB->TableExists('glpi_plugin_room_roomtypes')) { 75 | $query = <<<'EOS' 76 | CREATE TABLE `glpi_plugin_room_roomtypes` ( 77 | `id` int(11) NOT NULL auto_increment, 78 | `name` varchar(255) collate utf8_unicode_ci default NULL, 79 | `comment` text collate utf8_unicode_ci, 80 | PRIMARY KEY (`id`), 81 | KEY `name` (`name`) 82 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 83 | EOS; 84 | $DB->query($query) || die('error adding glpi_plugin_room_roomtypes table ' . __('Error during the database update', 'room') . $DB->error()); 85 | } 86 | 87 | // Table for access conditions 88 | if (!$DB->TableExists('glpi_plugin_room_roomaccessconds')) { 89 | $query = <<<'EOS' 90 | CREATE TABLE `glpi_plugin_room_roomaccessconds` ( 91 | `id` int(11) NOT NULL auto_increment, 92 | `name` varchar(255) collate utf8_unicode_ci default NULL, 93 | `comment` text collate utf8_unicode_ci, 94 | PRIMARY KEY (`id`), 95 | KEY `name` (`name`) 96 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 97 | EOS; 98 | $DB->query($query) || die('error adding glpi_plugin_room_roomaccessconds table ' . __('Error during the database update', 'room') . $DB->error()); 99 | } 100 | 101 | // Table for dropdowns 102 | if (!$DB->TableExists('glpi_plugin_room_dropdown1s')) { 103 | $query = <<<'EOS' 104 | CREATE TABLE `glpi_plugin_room_dropdown1s` ( 105 | `id` int(11) NOT NULL auto_increment, 106 | `name` varchar(255) collate utf8_unicode_ci default NULL, 107 | `comment` text collate utf8_unicode_ci, 108 | PRIMARY KEY (`id`), 109 | KEY `name` (`name`) 110 | ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; 111 | EOS; 112 | $DB->query($query) || die('error adding glpi_plugin_room_roomspecificities table ' . __('Error during the database update', 'room') . $DB->error()); 113 | } 114 | 115 | PluginRoomProfile::createFirstAccess($_SESSION['glpiactiveprofile']['id']); 116 | 117 | return true; 118 | } 119 | 120 | function plugin_room_uninstall() 121 | { 122 | global $DB; 123 | 124 | $tables = [ 125 | 'glpi_plugin_room_rooms_computers', 126 | 'glpi_plugin_room_roomtypes', 127 | 'glpi_plugin_room_roomaccessconds', 128 | 'glpi_plugin_room_dropdown1s', 129 | 'glpi_plugin_room_rooms', 130 | ]; 131 | 132 | foreach ($tables as $table) { 133 | $DB->query("DROP TABLE IF EXISTS `$table`;"); 134 | } 135 | 136 | $tables_glpi = [ 137 | 'glpi_displaypreferences', 138 | 'glpi_documents_items', 139 | 'glpi_logs', 140 | 'glpi_items_tickets', 141 | 'glpi_reservationitems', 142 | 'glpi_savedsearches', 143 | ]; 144 | 145 | foreach ($tables_glpi as $table_glpi) { 146 | $DB->query('DELETE FROM `$table_glpi` WHERE `itemtype` = "PluginRoomRoom";'); 147 | } 148 | 149 | return true; 150 | } 151 | 152 | // Define dropdown relations 153 | function plugin_room_getDatabaseRelations() 154 | { 155 | $plugin = new Plugin(); 156 | 157 | if ($plugin->isActivated('room')) { 158 | return [ 159 | 'glpi_plugin_room_roomtypes' => [ 160 | 'glpi_plugin_room_rooms' => 'type', 161 | ], 162 | 'glpi_plugin_room_roomaccessconds' => [ 163 | 'glpi_plugin_room_rooms' => 'access', 164 | ], 165 | 'glpi_plugin_room_dropdown1s' => [ 166 | 'glpi_plugin_room_rooms' => [ 167 | 'dropdown1', 168 | 'dropdown2', 169 | ], 170 | ], 171 | 'glpi_plugin_room_rooms' => [ 172 | 'glpi_plugin_room_rooms_computers' => 'rooms_id', 173 | ], 174 | 'glpi_computers' => [ 175 | 'glpi_plugin_room_rooms_computers' => 'computers_id', 176 | ], 177 | 'glpi_entities' => [ 178 | 'glpi_plugin_room_rooms' => 'entities_id', 179 | ], 180 | 'glpi_locations' => [ 181 | 'glpi_plugin_room_rooms' => 'locations_id', 182 | ], 183 | 'glpi_profiles' => [ 184 | 'glpi_plugin_room_profiles' => 'profiles_id', 185 | ], 186 | 'glpi_users' => [ 187 | 'glpi_plugin_room_rooms' => [ 188 | 'users_id', 189 | 'tech_num', 190 | ], 191 | ], 192 | ]; 193 | } else { 194 | return []; 195 | } 196 | } 197 | 198 | // Define Dropdown tables to be manage in GLPI : 199 | // Definit les tables qui sont gérables via les intitulés 200 | function plugin_room_getDropdown() 201 | { 202 | $plugin = new Plugin(); 203 | 204 | if ($plugin->isActivated('room')) { 205 | return [ 206 | 'PluginRoomRoomType' => PluginRoomRoomType::getTypeName(2), 207 | 'PluginRoomRoomAccessCond' => PluginRoomRoomAccessCond::getTypeName(2), 208 | 'PluginRoomDropdown1' => PluginRoomDropdown1::getTypeName(2), 209 | ]; 210 | } else { 211 | return []; 212 | } 213 | } 214 | 215 | function plugin_room_addLeftJoin($type, $ref_table, $new_table, $linkfield, &$already_link_tables) 216 | { 217 | // Example of standard LEFT JOIN clause but use it ONLY for specific LEFT JOIN 218 | // No need of the function if you do not have specific cases 219 | 220 | switch ($new_table) { 221 | case 'glpi_computers': 222 | $out = <<<'EOS' 223 | LEFT JOIN glpi_plugin_room_rooms_computers 224 | ON (glpi_plugin_room_rooms.id = glpi_plugin_room_rooms_computers.rooms_id) 225 | EOS; 226 | $out .= <<<'EOS' 227 | LEFT JOIN glpi_computers 228 | ON (glpi_computers.id = glpi_plugin_room_rooms_computers.computers_id) 229 | EOS; 230 | return $out; 231 | break; 232 | case 'glpi_plugin_room_rooms': // From computers 233 | $out = <<<'EOS' 234 | LEFT JOIN glpi_plugin_room_rooms_computers 235 | ON (glpi_computers.id = glpi_plugin_room_rooms_computers.computers_id) 236 | EOS; 237 | $out .= <<<'EOS' 238 | LEFT JOIN glpi_plugin_room_rooms 239 | ON (glpi_plugin_room_rooms.id = glpi_plugin_room_rooms_computers.rooms_id) 240 | EOS; 241 | return $out; 242 | break; 243 | case 'glpi_plugin_room_roomtypes': // From computers 244 | $out = Search::addLeftJoin($type, $ref_table, $already_link_tables, 'glpi_plugin_room_rooms', $linkfield); 245 | $out .= <<<'EOS' 246 | LEFT JOIN glpi_plugin_room_roomtypes 247 | ON (glpi_plugin_room_roomtypes.id = glpi_plugin_room_rooms.type) 248 | EOS; 249 | return $out; 250 | break; 251 | } 252 | return ''; 253 | } 254 | 255 | function plugin_room_forceGroupBy($type) 256 | { 257 | return true; 258 | switch ($type) { 259 | case 'PluginRoomRoom': 260 | // Force add GROUP BY IN REQUEST 261 | return true; 262 | break; 263 | } 264 | return false; 265 | } 266 | 267 | // Define search option for types of the plugins 268 | function plugin_room_getAddSearchOptions($itemtype) 269 | { 270 | $sopt = []; 271 | if ($itemtype == 'Computer') { 272 | if (PluginRoomRoom::canView()) { 273 | $sopt[1050]['table'] = 'glpi_plugin_room_rooms'; 274 | $sopt[1050]['field'] = 'name'; 275 | $sopt[1050]['linkfield'] = ''; 276 | $sopt[1050]['name'] = __('Room Management', 'room') . ' - ' . __('Name', 'room'); 277 | $sopt[1050]['forcegroupby'] = true; 278 | $sopt[1050]['datatype'] = 'itemlink'; 279 | $sopt[1050]['itemlink_type'] = 'PluginRoomRoom'; 280 | 281 | $sopt[1051]['table'] = 'glpi_plugin_room_roomtypes'; 282 | $sopt[1051]['field'] = 'name'; 283 | $sopt[1051]['linkfield'] = ''; 284 | $sopt[1051]['name'] = __('Room Management', 'room') . ' - ' . __('Type of Room', 'room'); 285 | $sopt[1050]['forcegroupby'] = true; 286 | } 287 | } 288 | return $sopt; 289 | } 290 | 291 | // Aucune idee de ce que cela fait 292 | // peut-etre ajouter un critère de recherche ? 293 | 294 | function plugin_room_addSelect($type, $ID, $num) 295 | { 296 | global $SEARCH_OPTION; 297 | 298 | $table = $SEARCH_OPTION[$type][$ID]['table']; 299 | $field = $SEARCH_OPTION[$type][$ID]['field']; 300 | 301 | // Example of standard Select clause but use it ONLY for specific Select 302 | // No need of the function if you do not have specific cases 303 | switch ($table . '.' . $field) { 304 | case 'glpi_computers.count': 305 | return ' COUNT( glpi_computers.ID) AS ITEM_$num, '; 306 | break; 307 | } 308 | return ''; 309 | } 310 | 311 | // Define actions : 312 | function plugin_room_MassiveActions($type) 313 | { 314 | switch ($type) { 315 | case 'Computer': 316 | return [ 317 | 'plugin_room_addComputer' => __('Add a Room', 'room'), 318 | ]; 319 | break; 320 | } 321 | return []; 322 | } 323 | 324 | // How to display specific actions ? 325 | function plugin_room_MassiveActionsDisplay($options = []) 326 | { 327 | $PluginRoomRoom = new PluginRoomRoom(); 328 | switch ($options['itemtype']) { 329 | case 'Computer': 330 | switch ($options['action']) { 331 | case 'plugin_room_addComputer': 332 | Dropdown::show('PluginRoomRoom'); 333 | echo ' '; 334 | break; 335 | } 336 | break; 337 | } 338 | return ''; 339 | } 340 | 341 | // How to process specific actions ? 342 | function plugin_room_MassiveActionsProcess($data) 343 | { 344 | $PluginRoomRoom = new PluginRoomRoom(); 345 | 346 | switch ($data['action']) { 347 | case 'plugin_room_addComputer': 348 | if ($data['itemtype'] == 'Computer' && $data['plugin_room_rooms_id'] > 0) { 349 | foreach ($data['item'] as $key => $val) { 350 | if ($val == 1) { 351 | $PluginRoomRoom->plugin_room_AddDevice($data['plugin_room_rooms_id'], $key); 352 | } 353 | } 354 | } 355 | break; 356 | } 357 | } 358 | 359 | function plugin_room_AssignToTicket($types) 360 | { 361 | if (in_array('PluginRoomRoom', $_SESSION['glpiactiveprofile']['helpdesk_item_type'])) { 362 | $types['PluginRoomRoom'] = __('Room Management', 'room'); 363 | } 364 | return $types; 365 | } 366 | -------------------------------------------------------------------------------- /inc/dropdown1.class.php: -------------------------------------------------------------------------------- 1 | getType() == 'Profile') { 14 | return PluginRoomRoom::getTypeName(2); 15 | } 16 | return ''; 17 | } 18 | 19 | public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) 20 | { 21 | global $CFG_GLPI; 22 | 23 | if ($item->getType() == 'Profile') { 24 | $ID = $item->getID(); 25 | $prof = new self(); 26 | 27 | self::addDefaultProfileInfos($ID, [ 28 | 'plugin_room' => 0, 29 | ]); 30 | $prof->showForm($ID); 31 | } 32 | return true; 33 | } 34 | 35 | public static function createFirstAccess($ID) 36 | { 37 | self::addDefaultProfileInfos( 38 | $ID, 39 | [ 40 | 'plugin_room' => ALLSTANDARDRIGHT | READNOTE | UPDATENOTE, 41 | ], 42 | true 43 | ); 44 | } 45 | 46 | /** 47 | * @param int $profiles_id 48 | * @param array $rights 49 | * @param bool $drop_existing 50 | * 51 | * @return void 52 | */ 53 | public static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) 54 | { 55 | $dbu = new DbUtils(); 56 | $profileRight = new ProfileRight(); 57 | foreach ($rights as $right => $value) { 58 | $count_conditions = ['profiles_id' => $profiles_id, 'name' => $right]; 59 | if ($dbu->countElementsInTable('glpi_profilerights', $count_conditions) && $drop_existing) { 60 | $profileRight->deleteByCriteria([ 61 | 'profiles_id' => $profiles_id, 62 | 'name' => $right, 63 | ]); 64 | } 65 | if (!$dbu->countElementsInTable('glpi_profilerights', $count_conditions)) { 66 | $myright['profiles_id'] = $profiles_id; 67 | $myright['name'] = $right; 68 | $myright['rights'] = $value; 69 | $profileRight->add($myright); 70 | 71 | // Add right to the current session 72 | $_SESSION['glpiactiveprofile'][$right] = $value; 73 | } 74 | } 75 | } 76 | 77 | /** 78 | * Show profile form 79 | * 80 | * @param int $profiles_id 81 | * @param bool $openform 82 | * @param bool $closeform 83 | * 84 | * @return void 85 | */ 86 | public function showForm($profiles_id = 0, $openform = true, $closeform = true) 87 | { 88 | echo '
'; 89 | if ( 90 | ( 91 | $canedit = Session::haveRightsOr( 92 | self::$rightname, 93 | [ 94 | CREATE, 95 | UPDATE, 96 | PURGE, 97 | ] 98 | ) 99 | ) 100 | && $openform 101 | ) { 102 | $profile = new Profile(); 103 | echo '
'; 104 | } 105 | 106 | $profile = new Profile(); 107 | $profile->getFromDB($profiles_id); 108 | if ($profile->getField('interface') == 'central') { 109 | $rights = $this->getAllRights(); 110 | $profile->displayRightsChoiceMatrix( 111 | $rights, 112 | [ 113 | 'canedit' => $canedit, 114 | 'default_class' => 'tab_bg_2', 115 | 'title' => __('General', 'room'), 116 | ] 117 | ); 118 | } 119 | 120 | if ($canedit && $closeform) { 121 | echo '
'; 122 | echo Html::hidden( 123 | 'id', 124 | [ 125 | 'value' => $profiles_id, 126 | ] 127 | ); 128 | echo Html::submit( 129 | _sx('button', 'Save'), 130 | [ 131 | 'name' => 'update', 132 | ] 133 | ); 134 | echo '
\n'; 135 | Html::closeForm(); 136 | } 137 | echo '
'; 138 | } 139 | 140 | public static function getAllRights($all = false) 141 | { 142 | return [ 143 | [ 144 | 'itemtype' => 'PluginRoomRoom', 145 | 'label' => __('Room Management', 'room'), 146 | 'field' => 'plugin_room', 147 | ], 148 | ]; 149 | } 150 | 151 | /** 152 | * Init profiles 153 | * 154 | * @param string $old_right 155 | */ 156 | public static function translateARight($old_right) 157 | { 158 | switch ($old_right) { 159 | case '': 160 | return 0; 161 | case 'r': 162 | return READ; 163 | case 'w': 164 | return ALLSTANDARDRIGHT + READNOTE + UPDATENOTE; 165 | case '0': 166 | case '1': 167 | return $old_right; 168 | default: 169 | return 0; 170 | } 171 | } 172 | 173 | /** 174 | * Initialize profiles, and migrate it necessary 175 | */ 176 | public static function initProfile() 177 | { 178 | global $DB; 179 | $profile = new self(); 180 | $dbu = new DbUtils(); 181 | 182 | // Add new rights in glpi_profilerights table 183 | foreach ($profile->getAllRights(true) as $data) { 184 | if ($dbu->countElementsInTable('glpi_profilerights', ['name' => $data['field']]) == 0) { 185 | ProfileRight::addProfileRights([ 186 | $data['field'], 187 | ]); 188 | } 189 | } 190 | 191 | foreach ($DB->request('SELECT * 192 | FROM `glpi_profilerights` 193 | WHERE `profiles_id` = ' . $_SESSION['glpiactiveprofile']['id'] . ' 194 | AND `name` LIKE "%plugin_room%"') as $prof) { 195 | $_SESSION['glpiactiveprofile'][$prof['name']] = $prof['rights']; 196 | } 197 | } 198 | 199 | public static function removeRightsFromSession() 200 | { 201 | foreach (self::getAllRights(true) as $right) { 202 | if (isset($_SESSION['glpiactiveprofile'][$right['field']])) { 203 | unset($_SESSION['glpiactiveprofile'][$right['field']]); 204 | } 205 | } 206 | } 207 | } 208 | -------------------------------------------------------------------------------- /inc/room.class.php: -------------------------------------------------------------------------------- 1 | 'common', 43 | 'name' => self::getTypeName(2), 44 | ]; 45 | 46 | $tab[] = [ 47 | 'id' => '1', 48 | 'table' => $this->getTable(), 49 | 'field' => 'name', 50 | 'linkfield' => 'name', 51 | 'name' => __('Name', 'room'), 52 | 'datatype' => 'itemlink', 53 | 'itemlink_type' => $this->getType(), 54 | ]; 55 | 56 | $tab[] = [ 57 | 'id' => '2', 58 | 'table' => 'glpi_plugin_room_roomtypes', 59 | 'field' => 'name', 60 | 'linkfield' => 'type', 61 | 'name' => __('Type', 'room'), 62 | ]; 63 | 64 | $tab[] = [ 65 | 'id' => '26', 66 | 'table' => 'glpi_groups', 67 | 'field' => 'completename', 68 | 'linkfield' => 'groups_id_tech', 69 | 'name' => __('Group in charge of the hardware', 'room'), 70 | 'condition' => '`is_assign`', 71 | 'datatype' => 'dropdown', 72 | ]; 73 | 74 | $tab[] = [ 75 | 'id' => '24', 76 | 'table' => 'glpi_users', 77 | 'field' => 'name', 78 | 'linkfield' => 'tech_num', 79 | 'name' => __('Technician in charge of the hardware', 'room'), 80 | ]; 81 | 82 | $tab[] = [ 83 | 'id' => '25', 84 | 'table' => 'glpi_users', 85 | 'field' => 'name', 86 | 'linkfield' => 'users_id', 87 | 'name' => __('Alternate username', 'room'), 88 | ]; 89 | 90 | $tab[] = [ 91 | 'id' => '3', 92 | 'table' => $this->getTable(), 93 | 'field' => 'comment', 94 | 'linkfield' => 'comment', 95 | 'name' => __('Comments', 'room'), 96 | ]; 97 | 98 | $tab += Location::rawSearchOptionsToAdd(); 99 | 100 | $tab[] = [ 101 | 'id' => '5', 102 | 'table' => $this->getTable(), 103 | 'field' => 'size', 104 | 'linkfield' => 'size', 105 | 'name' => __('Seating', 'room'), 106 | ]; 107 | 108 | $tab[] = [ 109 | 'id' => '6', 110 | 'table' => 'glpi_plugin_room_roomaccessconds', 111 | 'field' => 'name', 112 | 'linkfield' => 'access', 113 | 'name' => __('Conditions of Access', 'room'), 114 | ]; 115 | 116 | $tab[] = [ 117 | 'id' => '7', 118 | 'table' => $this->getTable(), 119 | 'field' => 'buy', 120 | 'linkfield' => 'buy', 121 | 'name' => __('Date of purchase', 'room'), 122 | ]; 123 | 124 | $tab[] = [ 125 | 'id' => '8', 126 | 'table' => $this->getTable(), 127 | 'field' => 'printer', 128 | 'linkfield' => 'printer', 129 | 'name' => __('Printer', 'room'), 130 | ]; 131 | 132 | $tab[] = [ 133 | 'id' => '9', 134 | 'table' => $this->getTable(), 135 | 'field' => 'videoprojector', 136 | 'linkfield' => 'videoprojector', 137 | 'name' => __('Video Projector', 'room'), 138 | ]; 139 | 140 | $tab[] = [ 141 | 'id' => '10', 142 | 'table' => $this->getTable(), 143 | 'field' => 'wifi', 144 | 'linkfield' => 'wifi', 145 | 'name' => __('WiFi', 'room'), 146 | ]; 147 | 148 | $tab[] = [ 149 | 'id' => '11', 150 | 'table' => $this->getTable(), 151 | 'field' => 'comment', 152 | 'linkfield' => '', 153 | 'name' => __('Comments', 'room'), 154 | ]; 155 | 156 | $tab[] = [ 157 | 'id' => '13', 158 | 'table' => $this->getTable(), 159 | 'field' => 'opening', 160 | 'linkfield' => '', 161 | 'name' => __('Opening Times', 'room'), 162 | ]; 163 | 164 | $tab[] = [ 165 | 'id' => '12', 166 | 'table' => $this->getTable(), 167 | 'field' => 'limits', 168 | 'linkfield' => '', 169 | 'name' => __('Limitations', 'room'), 170 | ]; 171 | 172 | $tab[] = [ 173 | 'id' => '16', 174 | 'table' => $this->getTable(), 175 | 'field' => 'text1', 176 | 'linkfield' => '', 177 | 'name' => __('Specificity 1', 'room'), 178 | ]; 179 | 180 | $tab[] = [ 181 | 'id' => '17', 182 | 'table' => $this->getTable(), 183 | 'field' => 'text2', 184 | 'linkfield' => '', 185 | 'name' => __('Specificity 2', 'room'), 186 | ]; 187 | 188 | $tab[] = [ 189 | 'id' => '18', 190 | 'table' => 'glpi_plugin_room_dropdown1s', 191 | 'field' => 'name', 192 | 'linkfield' => 'dropdown1', 193 | 'name' => __('Specificity 3', 'room'), 194 | ]; 195 | 196 | $tab[] = [ 197 | 'id' => '19', 198 | 'table' => 'glpi_plugin_room_dropdown1s', 199 | 'field' => 'name', 200 | 'linkfield' => 'dropdown2', 201 | 'name' => __('Specificity 4', 'room'), 202 | ]; 203 | 204 | $tab[] = [ 205 | 'id' => '30', 206 | 'table' => $this->getTable(), 207 | 'field' => 'id', 208 | 'linkfield' => '', 209 | 'name' => __('ID', 'room'), 210 | ]; 211 | 212 | $tab[] = [ 213 | 'id' => '31', 214 | 'table' => $this->getTable(), 215 | 'field' => 'name', 216 | 'linkfield' => '', 217 | 'name' => __('Computers', 'room'), 218 | 'forcegroupby' => true, 219 | 'datatype' => 'itemlink', 220 | 'itemlink_type' => $this->getType(), 221 | ]; 222 | 223 | $tab[] = [ 224 | 'id' => '32', 225 | 'table' => $this->getTable(), 226 | 'field' => 'count_linked', 227 | 'linkfield' => '', 228 | 'name' => __('Number of Computers', 'room'), 229 | 'meta' => 1, 230 | ]; 231 | 232 | $tab[] = [ 233 | 'id' => '80', 234 | 'table' => 'glpi_entities', 235 | 'field' => 'completename', 236 | 'linkfield' => 'entities_id', 237 | 'name' => __('Entity', 'room'), 238 | ]; 239 | 240 | return $tab; 241 | } 242 | 243 | // Cette fonction définie les onglets à afficher sur la fiche de l'objet 244 | // Cette fonction retourne un tableau [id de l'onglet->titre onglet] 245 | public function defineTabs($options = []) 246 | { 247 | $ong = []; 248 | 249 | $this->addDefaultFormTab($ong); 250 | if (Session::haveRight('reservation', READ)) { 251 | // Affiche "Réservations" 252 | $this->addStandardTab('Reservation', $ong, $options); 253 | } 254 | $this->addStandardTab('Ticket', $ong, $options); 255 | $this->addStandardTab('Item_Problem', $ong, $options); 256 | $this->addStandardTab('Document_Item', $ong, $options); 257 | $this->addStandardTab('Notepad', $ong, $options); 258 | $this->addStandardTab('Log', $ong, $options); 259 | 260 | return $ong; 261 | } 262 | 263 | // Cette fonction affiche le formulaire de l'objet (en création ou en édition/consultation) 264 | // Cette fonction est appelée par /front/room.form.php 265 | // showForm(ID de l'objet,tableau pour les options) 266 | public function showForm($ID, $options = []) 267 | { 268 | global $CFG_GLPI; 269 | 270 | if (!self::canView()) { 271 | return false; 272 | } 273 | 274 | if (!$this->canView()) { 275 | return false; 276 | } 277 | 278 | // Si la salle éxiste 279 | if ($ID > 0) { 280 | $this->check($ID, READ); 281 | } else { // C'est une nouvelle salle 282 | $this->check(-1, CREATE); 283 | $this->getEmpty(); 284 | } 285 | 286 | // entete du formulaire avec affichage du type d'objet, de l'entite et de la recursivite 287 | // au niveau affichage la première ligne du tableau 288 | $this->showFormHeader($options); 289 | 290 | // Composition du formulaire de l'objet salle 291 | // seconde ligne du tableau 292 | echo ''; 293 | if ($ID > 0) { // La salle éxiste déjà : affichage de la derniere modif 294 | echo '' . __('Last update', 'room') . ': ' . Html::convDateTime($this->fields['date_mod']) . ''; 295 | } else { // C'est une nouvelle salle 296 | echo ' '; 297 | } 298 | echo ''; 299 | 300 | // Reste du tableau 301 | // Nom de la salle 302 | echo '' . __('Name', 'room') . ': '; 303 | echo ''; 304 | Html::autocompletionTextField($this, 'name'); 305 | echo ''; 306 | echo '' . __('Location', 'room') . ': '; 307 | echo ''; 308 | Dropdown::show( 309 | 'Location', 310 | [ 311 | 'value' => $this->fields['locations_id'], 312 | 'entity' => $this->fields['entities_id'], 313 | ] 314 | ); 315 | echo ''; 316 | 317 | // Dropdown du type 318 | echo '' . __('Type', 'room') . ': '; 319 | echo ''; 320 | Dropdown::show( 321 | 'PluginRoomRoomType', 322 | [ 323 | 'name' => 'type', 324 | 'value' => $this->fields['type'], 325 | ] 326 | ); 327 | echo ''; 328 | 329 | // Dropdown des Conditions d'accès 330 | echo '' . __('Conditions of Access', 'room') . ': '; 331 | echo ''; 332 | Dropdown::show( 333 | 'PluginRoomRoomAccessCond', 334 | [ 335 | 'name' => 'access', 336 | 'value' => $this->fields['access'], 337 | ] 338 | ); 339 | echo ''; 340 | 341 | // Dropdown de l'usager 342 | echo '' . __('Alternate username', 'room') . ': '; 343 | echo ''; 344 | User::Dropdown([ 345 | 'name' => 'users_id', 346 | 'value' => $this->fields['users_id'], 347 | 'entity' => $this->fields['entities_id'], 348 | 'right' => 'all', 349 | ]); 350 | echo ''; 351 | 352 | // Dropdown du Responsable technique 353 | echo '' . __('Technician in charge of the hardware', 'room') . ': '; 354 | echo ''; 355 | User::Dropdown([ 356 | 'name' => 'tech_num', 357 | 'value' => $this->fields['tech_num'], 358 | 'entity' => $this->fields['entities_id'], 359 | 'right' => 'interface', 360 | ]); 361 | echo ''; 362 | 363 | // Nombres de place 364 | echo '' . __('Seating', 'room') . ': '; 365 | echo ''; 366 | Dropdown::showNumber( 367 | 'size', 368 | [ 369 | 'value' => $this->fields['size'], 370 | 'min' => 0, 371 | 'max' => 500, 372 | ] 373 | ); 374 | echo ''; 375 | 376 | // Dropdown du Groupe responsable technique 377 | echo '' . __('Group in charge of the hardware', 'room') . ''; 378 | Group::dropdown([ 379 | 'name' => 'groups_id_tech', 380 | 'value' => $this->fields['groups_id_tech'], 381 | 'entity' => $this->fields['entities_id'], 382 | 'condition' => ['is_assign' => 1], 383 | ]); 384 | echo ''; 385 | 386 | // Date d'achat 387 | echo '' . __('Date of purchase', 'room') . ': '; 388 | echo ''; 389 | Html::showDateField( 390 | 'buy', 391 | [ 392 | 'value' => $this->fields['buy'], 393 | 'maybeempty' => true, 394 | 'canedit' => true, 395 | ] 396 | ); 397 | echo ''; 398 | 399 | // Moyen d'impression 400 | echo '' . __('Whiteboard', 'room') . ': '; 401 | echo ''; 402 | Dropdown::showYesNo('printer', $this->fields['printer']); 403 | echo ''; 404 | 405 | // Videoprojecteur 406 | echo '' . __('Video Projector', 'room') . ': '; 407 | echo ''; 408 | Dropdown::showYesNo('videoprojector', $this->fields['videoprojector']); 409 | echo ''; 410 | 411 | // wifi 412 | echo '' . __('WiFi', 'room') . ': '; 413 | echo ''; 414 | Dropdown::showYesNo('wifi', $this->fields['wifi']); 415 | echo ''; 416 | 417 | // Spécificité 1 418 | echo '' . __('Specificity 1', 'room') . ': '; 419 | echo ''; 420 | Html::autocompletionTextField($this, 'text1'); 421 | echo ''; 422 | 423 | // Spécificité 3 424 | echo '' . __('Specificity 3', 'room') . ': '; 425 | echo ''; 426 | Dropdown::show( 427 | 'PluginRoomDropdown1', 428 | [ 429 | 'name' => 'dropdown1', 430 | 'value' => $this->fields['dropdown1'], 431 | ] 432 | ); 433 | echo ''; 434 | 435 | // Spécificité 2 436 | echo '' . __('Specificity 2', 'room') . ': '; 437 | echo ''; 438 | Html::autocompletionTextField($this, 'text2'); 439 | echo ''; 440 | 441 | // Spécificité 4 442 | echo '' . __('Specificity 4', 'room') . ': '; 443 | echo ''; 444 | Dropdown::show( 445 | 'PluginRoomDropdown1', 446 | [ 447 | 'name' => 'dropdown2', 448 | 'value' => $this->fields['dropdown2'], 449 | ] 450 | ); 451 | echo ''; 452 | 453 | // Horaires d'ouverture 454 | echo '' . __('Opening Times', 'room') . ': '; 455 | echo ''; 456 | Html::autocompletionTextField($this, 'opening'); 457 | echo ''; 458 | 459 | // limitations 460 | echo '' . __('Limitations', 'room') . ': '; 461 | echo ''; 462 | Html::autocompletionTextField($this, 'limits'); 463 | echo ''; 464 | 465 | // Commentaires 466 | echo ''; 467 | echo ''; 468 | echo __('Comments', 'room') . ':'; 469 | echo ''; 470 | echo ''; 471 | echo ''; 472 | echo ''; 473 | 474 | // Affichage des boutons 475 | $this->showFormButtons($options); 476 | 477 | return true; 478 | } 479 | 480 | // cette fonction doit servir à remplir la rubrique ordinateur de la fiche room 481 | public function showComputers($target, $room_id) 482 | { 483 | global $CFG_GLPI, $DB; 484 | 485 | if (!self::canView()) { 486 | return false; 487 | } 488 | 489 | if ($this->getFromDB($room_id)) { 490 | $canedit = $this->can($room_id, UPDATE); 491 | 492 | $query = <<'; 511 | 512 | echo '

'; 513 | echo ''; 514 | if ($canedit) { 515 | echo ''; 516 | } 517 | echo ''; 518 | echo ''; 519 | echo ''; 520 | 521 | if ($result_linked = $DB->query($query)) { 522 | if ($DB->numrows($result_linked)) { 523 | while ($data = $DB->fetchAssoc($result_linked)) { 524 | $ID = ''; 525 | 526 | if ($_SESSION['glpiis_ids_visible'] || empty($data['name'])) { 527 | $ID = ' (' . $data['id'] . ')'; 528 | } 529 | $name = 530 | '' 531 | . $data['name'] . $ID . ''; 532 | 533 | echo ''; 534 | 535 | if ($canedit) { 536 | echo ''; 543 | } 544 | 545 | echo 546 | '' 547 | . $name 548 | . ''; 549 | echo 550 | ''; 553 | 554 | echo ''; 555 | } 556 | } 557 | } 558 | 559 | if ($canedit) { 560 | echo ''; 565 | echo ''; 568 | echo '
' . __('Associated items', 'room') . ':
 ' . __('Name', 'room') . '' . __('Select the desired entity', 'room') . '
'; 537 | $sel = ''; 538 | if (isset($_GET['select']) && $_GET['select'] == 'all') { 539 | $sel = 'checked'; 540 | } 541 | echo ''; 542 | echo '' 551 | . Dropdown::getDropdownName('glpi_entities', $data['entity']) 552 | . '
'; 561 | 562 | echo ''; 563 | Dropdown::show('Computer'); 564 | echo ''; 566 | echo ''; 567 | echo '
'; 569 | 570 | echo '
'; 571 | echo ''; 572 | echo ''; 573 | echo ''; 574 | echo ''; 580 | 581 | echo ''; 582 | echo ''; 588 | echo ''; 591 | echo '
' 575 | . '' 578 | . __('Check All', 'room') . ''; 579 | echo '/' 583 | . '' 586 | . __('Uncheck All', 'room') . ''; 587 | echo ''; 589 | echo ''; 590 | echo '
'; 592 | } else { 593 | echo ''; 594 | } 595 | 596 | Html::closeForm(); 597 | } 598 | } 599 | 600 | // cette fonction sert à remplir la rubrique room de l'onglet ajouté à la fiche ordinateur 601 | public function plugin_room_showComputerRoom($itemtype, $ID, $withtemplate = '') 602 | { 603 | global $DB, $CFG_GLPI; 604 | 605 | $item = new $itemtype(); 606 | $canread = $item->can($ID, READ); 607 | $canedit = $item->can($ID, UPDATE); 608 | 609 | $Room = new self(); 610 | 611 | if ($ID > 0) { 612 | $query = <<query($query); 627 | $number = $DB->numrows($result); 628 | if (Session::isMultiEntitiesMode()) { 629 | $colsup = 1; 630 | } else { 631 | $colsup = 0; 632 | } 633 | echo '
'; 634 | echo ''; 635 | echo ''; 636 | echo ''; 637 | echo ''; 647 | echo ''; 650 | } else { 651 | echo $data['name']; 652 | } 653 | echo ''; 654 | } 655 | } 656 | echo '
' . __('This computer is in room:', 'room') . '
' . __('Room', 'room') . '' . __('Responsible', 'room') . '
'; 638 | if ($result = $DB->query($query)) { 639 | if ($DB->numrows($result) > 0) { 640 | $data = $DB->fetchAssoc($result); 641 | 642 | if (self::canView()) { 643 | echo '' 645 | . $data['name'] . ''; 646 | echo '' 648 | . '' 649 | . $data['resp'] . '
'; 657 | } 658 | } 659 | 660 | public function plugin_room_AddDevice($room_id, $computer_id) 661 | { 662 | global $DB; 663 | if ($room_id > 0 && $computer_id > 0) { 664 | $query = 'SELECT ID FROM glpi_plugin_room_rooms_computers WHERE computers_id = ' . $computer_id; 665 | if ($result = $DB->query($query)) { 666 | if ($DB->numrows($result) == 0) { 667 | $query = <<query($query); 674 | $this->plugin_room_updateCountDevices($room_id); 675 | } 676 | } 677 | } 678 | } 679 | 680 | public function plugin_room_DeleteDevice($ID) 681 | { 682 | global $DB; 683 | $query = 'SELECT rooms_id FROM glpi_plugin_room_rooms_computers WHERE ID = ' . $ID; 684 | if ($result = $DB->query($query)) { 685 | $IDroom = $DB->result($result, 0, 0); 686 | $query = 'DELETE FROM glpi_plugin_room_rooms_computers WHERE ID = ' . $ID; 687 | $result = $DB->query($query); 688 | $this->plugin_room_updateCountDevices($IDroom); 689 | } 690 | } 691 | 692 | public function plugin_room_updateCountDevices($ID) 693 | { 694 | global $DB; 695 | $query = 'SELECT count(ID) FROM glpi_plugin_room_rooms_computers WHERE rooms_id = ' . $ID; 696 | if ($result = $DB->query($query)) { 697 | $query2 = <<result($result, 0, 0)} 702 | WHERE ID = {$ID} 703 | EOS; 704 | $DB->query($query2); 705 | } 706 | } 707 | } 708 | -------------------------------------------------------------------------------- /inc/room_computer.class.php: -------------------------------------------------------------------------------- 1 | , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: GLPI - Room plugin 3.2.0-jb\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2020-11-05 20:46+0100\n" 11 | "PO-Revision-Date: 2020-11-05 20:53+0100\n" 12 | "Language-Team: Lukács Péter \n" 13 | "MIME-Version: 1.0\n" 14 | "Content-Type: text/plain; charset=UTF-8\n" 15 | "Content-Transfer-Encoding: 8bit\n" 16 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 17 | "X-Generator: Poedit 1.8.11\n" 18 | "Last-Translator: \n" 19 | "Language: hu_HU\n" 20 | 21 | #: hook.php:55 hook.php:70 hook.php:84 hook.php:98 hook.php:112 22 | msgid "Error during the database update" 23 | msgstr "Hiba az adatbázis frissítése közben" 24 | 25 | #: hook.php:276 hook.php:284 hook.php:362 front/room.form.php:82 26 | #: front/room.php:11 inc/profile.class.php:145 27 | msgid "Room Management" 28 | msgstr "Helyiség menedzsment" 29 | 30 | #: hook.php:276 inc/room.class.php:51 inc/room.class.php:302 31 | #: inc/room.class.php:517 32 | msgid "Name" 33 | msgstr "Elnevezés" 34 | 35 | #: hook.php:284 36 | msgid "Type of Room" 37 | msgstr "A helyiség típusa" 38 | 39 | #: hook.php:317 40 | msgid "Add a Room" 41 | msgstr "Helyiség hozzáadása" 42 | 43 | #: hook.php:333 44 | msgid "Post" 45 | msgstr "Küldés" 46 | 47 | #: setup.php:46 inc/room.class.php:13 inc/room.class.php:635 48 | msgid "Room" 49 | msgid_plural "Rooms" 50 | msgstr[0] "Helyiség" 51 | msgstr[1] "Helyiségek" 52 | 53 | #: inc/dropdown1.class.php:14 54 | msgid "Room specificities" 55 | msgstr "Helyiség sajátosságai" 56 | 57 | #: inc/profile.class.php:115 58 | msgid "General" 59 | msgstr "Általános" 60 | 61 | #: inc/roomaccesscond.class.php:14 inc/room.class.php:113 62 | #: inc/room.class.php:330 63 | msgid "Conditions of Access" 64 | msgstr "Hozzáférés feltételei" 65 | 66 | #: inc/room.class.php:61 inc/room.class.php:318 67 | msgid "Type" 68 | msgstr "Típus" 69 | 70 | #: inc/room.class.php:69 inc/room.class.php:377 71 | msgid "Group in charge of the hardware" 72 | msgstr "Hardverért felelős csoport" 73 | 74 | #: inc/room.class.php:79 inc/room.class.php:353 75 | msgid "Technician in charge of the hardware" 76 | msgstr "Technikai felelős" 77 | 78 | #: inc/room.class.php:87 inc/room.class.php:342 79 | msgid "Alternate username" 80 | msgstr "Alternatív felhasználónév" 81 | 82 | #: inc/room.class.php:95 inc/room.class.php:153 inc/room.class.php:468 83 | msgid "Comments" 84 | msgstr "Megjegyzések" 85 | 86 | #: inc/room.class.php:105 inc/room.class.php:364 87 | msgid "Seating" 88 | msgstr "Ülőhely" 89 | 90 | #: inc/room.class.php:121 inc/room.class.php:387 91 | msgid "Date of purchase" 92 | msgstr "Vásárlás dátuma" 93 | 94 | #: inc/room.class.php:129 95 | msgid "Printer" 96 | msgstr "Nyomtató" 97 | 98 | #: inc/room.class.php:137 inc/room.class.php:406 99 | msgid "Video Projector" 100 | msgstr "Projektor" 101 | 102 | #: inc/room.class.php:145 inc/room.class.php:412 103 | msgid "WiFi" 104 | msgstr "Wifi" 105 | 106 | #: inc/room.class.php:161 inc/room.class.php:454 107 | msgid "Opening Times" 108 | msgstr "Használható idősáv" 109 | 110 | #: inc/room.class.php:169 inc/room.class.php:460 111 | msgid "Limitations" 112 | msgstr "Korlátozások" 113 | 114 | #: inc/room.class.php:177 inc/room.class.php:418 115 | msgid "Specificity 1" 116 | msgstr "Sajátosság 1" 117 | 118 | #: inc/room.class.php:185 inc/room.class.php:436 119 | msgid "Specificity 2" 120 | msgstr "Sajátosság 2" 121 | 122 | #: inc/room.class.php:193 inc/room.class.php:424 123 | msgid "Specificity 3" 124 | msgstr "Sajátosság 3" 125 | 126 | #: inc/room.class.php:201 inc/room.class.php:442 127 | msgid "Specificity 4" 128 | msgstr "Sajátosság 4" 129 | 130 | #: inc/room.class.php:209 131 | msgid "ID" 132 | msgstr "Azonosító" 133 | 134 | #: inc/room.class.php:217 135 | msgid "Computers" 136 | msgstr "Számítógépek" 137 | 138 | #: inc/room.class.php:228 139 | msgid "Number of Computers" 140 | msgstr "Számítógépek száma" 141 | 142 | #: inc/room.class.php:237 143 | msgid "Entity" 144 | msgstr "Szervezet" 145 | 146 | #: inc/room.class.php:294 147 | msgid "Last update" 148 | msgstr "Utoljára frissítve" 149 | 150 | #: inc/room.class.php:306 151 | msgid "Location" 152 | msgstr "Elhelyezkedés" 153 | 154 | #: inc/room.class.php:400 155 | msgid "Whiteboard" 156 | msgstr "Tábla" 157 | 158 | #: inc/room.class.php:513 159 | msgid "Associated items" 160 | msgstr "Társított elemek" 161 | 162 | #: inc/room.class.php:518 163 | msgid "Select the desired entity" 164 | msgstr "Válassza ki a kívánt szervezetet" 165 | 166 | #: inc/room.class.php:566 167 | msgid "Add" 168 | msgstr "Hozzáad" 169 | 170 | #: inc/room.class.php:578 171 | msgid "Check All" 172 | msgstr "Mindet kijelöl" 173 | 174 | #: inc/room.class.php:586 175 | msgid "Uncheck All" 176 | msgstr "Kijelölést megszüntet" 177 | 178 | #: inc/room.class.php:589 179 | msgid "To delete" 180 | msgstr "A törléshez" 181 | 182 | #: inc/room.class.php:634 183 | msgid "This computer is in room:" 184 | msgstr "Ez a számítógép van a helyiségben:" 185 | 186 | #: inc/room.class.php:636 187 | msgid "Responsible" 188 | msgstr "Felelős" 189 | -------------------------------------------------------------------------------- /locales/it_IT.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/room/58eaca8da28d3fc42437c58adaed336fca6b3493/locales/it_IT.mo -------------------------------------------------------------------------------- /locales/it_IT.po: -------------------------------------------------------------------------------- 1 | # GLPI - Room Management plugin 2 | # Copyright (C) 2020 THE GLPI - Room plugin'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the GLPI - Room plugin package. 4 | # , 2020. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: GLPI - Room plugin 3.2.0-jb\n" 9 | "\n" 10 | "Report-Msgid-Bugs-To: \n" 11 | "POT-Creation-Date: 2020-06-30 18:48+0200\n" 12 | "PO-Revision-Date: 2020-07-28 12:43+0200\n" 13 | "Last-Translator: \n" 14 | "Language-Team: Italian\n" 15 | "Language: it_IT\n" 16 | "MIME-Version: 1.0\n" 17 | "Content-Type: text/plain; charset=UTF-8\n" 18 | "Content-Transfer-Encoding: 8bit\n" 19 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 20 | 21 | #: hook.php:55 hook.php:70 hook.php:84 hook.php:98 hook.php:112 22 | msgid "Error during the database update" 23 | msgstr "Errore durante l'aggiornamento del database" 24 | 25 | #: hook.php:276 hook.php:284 hook.php:362 front/room.form.php:82 26 | #: front/room.php:11 inc/profile.class.php:145 27 | msgid "Room Management" 28 | msgstr "Gestione Locali" 29 | 30 | #: hook.php:276 inc/room.class.php:51 inc/room.class.php:302 31 | #: inc/room.class.php:517 32 | msgid "Name" 33 | msgstr "Nome" 34 | 35 | #: hook.php:284 36 | msgid "Type of Room" 37 | msgstr "Tipologia di Locale" 38 | 39 | #: hook.php:317 40 | msgid "Add a Room" 41 | msgstr "Aggiungi un Locale" 42 | 43 | #: hook.php:333 44 | msgid "Post" 45 | msgstr "" 46 | 47 | #: setup.php:46 inc/room.class.php:13 inc/room.class.php:635 48 | msgid "Room" 49 | msgid_plural "Rooms" 50 | msgstr[0] "Locale" 51 | msgstr[1] "Locali" 52 | 53 | #: inc/dropdown1.class.php:14 54 | msgid "Room specificities" 55 | msgstr "Caratteristica di Locale" 56 | 57 | #: inc/profile.class.php:115 58 | msgid "General" 59 | msgstr "" 60 | 61 | #: inc/roomaccesscond.class.php:14 inc/room.class.php:113 62 | #: inc/room.class.php:330 63 | msgid "Conditions of Access" 64 | msgstr "" 65 | 66 | #: inc/room.class.php:61 inc/room.class.php:318 67 | msgid "Type" 68 | msgstr "" 69 | 70 | #: inc/room.class.php:69 inc/room.class.php:377 71 | msgid "Group in charge of the hardware" 72 | msgstr "" 73 | 74 | #: inc/room.class.php:79 inc/room.class.php:353 75 | msgid "Technician in charge of the hardware" 76 | msgstr "" 77 | 78 | #: inc/room.class.php:87 inc/room.class.php:342 79 | msgid "Alternate username" 80 | msgstr "" 81 | 82 | #: inc/room.class.php:95 inc/room.class.php:153 inc/room.class.php:468 83 | msgid "Comments" 84 | msgstr "" 85 | 86 | #: inc/room.class.php:105 inc/room.class.php:364 87 | msgid "Seating" 88 | msgstr "Posti a sedere" 89 | 90 | #: inc/room.class.php:121 inc/room.class.php:387 91 | msgid "Date of purchase" 92 | msgstr "" 93 | 94 | #: inc/room.class.php:129 95 | msgid "Printer" 96 | msgstr "Stampante" 97 | 98 | #: inc/room.class.php:137 inc/room.class.php:406 99 | msgid "Video Projector" 100 | msgstr "Videoproiettore" 101 | 102 | #: inc/room.class.php:145 inc/room.class.php:412 103 | msgid "WiFi" 104 | msgstr "Servizio WiFi" 105 | 106 | #: inc/room.class.php:161 inc/room.class.php:454 107 | msgid "Opening Times" 108 | msgstr "Orari di apertura" 109 | 110 | #: inc/room.class.php:169 inc/room.class.php:460 111 | msgid "Limitations" 112 | msgstr "Limitazioni" 113 | 114 | #: inc/room.class.php:177 inc/room.class.php:418 115 | msgid "Specificity 1" 116 | msgstr "Caratteristica 1" 117 | 118 | #: inc/room.class.php:185 inc/room.class.php:436 119 | msgid "Specificity 2" 120 | msgstr "Caratteristica 2" 121 | 122 | #: inc/room.class.php:193 inc/room.class.php:424 123 | msgid "Specificity 3" 124 | msgstr "Caratteristica 3" 125 | 126 | #: inc/room.class.php:201 inc/room.class.php:442 127 | msgid "Specificity 4" 128 | msgstr "Caratteristica 4" 129 | 130 | #: inc/room.class.php:209 131 | msgid "ID" 132 | msgstr "" 133 | 134 | #: inc/room.class.php:217 135 | msgid "Computers" 136 | msgstr "Computer presenti in sala" 137 | 138 | #: inc/room.class.php:228 139 | msgid "Number of Computers" 140 | msgstr "Numero Computer" 141 | 142 | #: inc/room.class.php:237 143 | msgid "Entity" 144 | msgstr "" 145 | 146 | #: inc/room.class.php:294 147 | msgid "Last update" 148 | msgstr "" 149 | 150 | #: inc/room.class.php:306 151 | msgid "Location" 152 | msgstr "" 153 | 154 | #: inc/room.class.php:400 155 | msgid "Whiteboard" 156 | msgstr "" 157 | 158 | #: inc/room.class.php:513 159 | msgid "Associated items" 160 | msgstr "" 161 | 162 | #: inc/room.class.php:518 163 | msgid "Select the desired entity" 164 | msgstr "" 165 | 166 | #: inc/room.class.php:566 167 | msgid "Add" 168 | msgstr "" 169 | 170 | #: inc/room.class.php:578 171 | msgid "Check All" 172 | msgstr "" 173 | 174 | #: inc/room.class.php:586 175 | msgid "Uncheck All" 176 | msgstr "" 177 | 178 | #: inc/room.class.php:589 179 | msgid "To delete" 180 | msgstr "" 181 | 182 | #: inc/room.class.php:634 183 | msgid "This computer is in room:" 184 | msgstr "" 185 | 186 | #: inc/room.class.php:636 187 | msgid "Responsible" 188 | msgstr "Responsabile" 189 | -------------------------------------------------------------------------------- /locales/room.pot: -------------------------------------------------------------------------------- 1 | # GLPI - Room Management plugin 2 | # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER 3 | # This file is distributed under the same license as the PACKAGE package. 4 | # FIRST AUTHOR , YEAR. 5 | # 6 | msgid "" 7 | msgstr "" 8 | "Project-Id-Version: GLPI - Room plugin 3.2.0-jb\n\n" 9 | "Report-Msgid-Bugs-To: \n" 10 | "POT-Creation-Date: 2020-06-30 18:48+0200\n" 11 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 12 | "Last-Translator: FULL NAME \n" 13 | "Language-Team: LANGUAGE \n" 14 | "Language: \n" 15 | "MIME-Version: 1.0\n" 16 | "Content-Type: text/plain; charset=CHARSET\n" 17 | "Content-Transfer-Encoding: 8bit\n" 18 | "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" 19 | 20 | #: hook.php:55 hook.php:70 hook.php:84 hook.php:98 hook.php:112 21 | msgid "Error during the database update" 22 | msgstr "" 23 | 24 | #: hook.php:276 hook.php:284 hook.php:362 front/room.form.php:82 25 | #: front/room.php:11 inc/profile.class.php:145 26 | msgid "Room Management" 27 | msgstr "" 28 | 29 | #: hook.php:276 inc/room.class.php:51 inc/room.class.php:302 30 | #: inc/room.class.php:517 31 | msgid "Name" 32 | msgstr "" 33 | 34 | #: hook.php:284 35 | msgid "Type of Room" 36 | msgstr "" 37 | 38 | #: hook.php:317 39 | msgid "Add a Room" 40 | msgstr "" 41 | 42 | #: hook.php:333 43 | msgid "Post" 44 | msgstr "" 45 | 46 | #: setup.php:46 inc/room.class.php:13 inc/room.class.php:635 47 | msgid "Room" 48 | msgid_plural "Rooms" 49 | msgstr[0] "" 50 | msgstr[1] "" 51 | 52 | #: inc/dropdown1.class.php:14 53 | msgid "Room specificities" 54 | msgstr "" 55 | 56 | #: inc/profile.class.php:115 57 | msgid "General" 58 | msgstr "" 59 | 60 | #: inc/roomaccesscond.class.php:14 inc/room.class.php:113 61 | #: inc/room.class.php:330 62 | msgid "Conditions of Access" 63 | msgstr "" 64 | 65 | #: inc/room.class.php:61 inc/room.class.php:318 66 | msgid "Type" 67 | msgstr "" 68 | 69 | #: inc/room.class.php:69 inc/room.class.php:377 70 | msgid "Group in charge of the hardware" 71 | msgstr "" 72 | 73 | #: inc/room.class.php:79 inc/room.class.php:353 74 | msgid "Technician in charge of the hardware" 75 | msgstr "" 76 | 77 | #: inc/room.class.php:87 inc/room.class.php:342 78 | msgid "Alternate username" 79 | msgstr "" 80 | 81 | #: inc/room.class.php:95 inc/room.class.php:153 inc/room.class.php:468 82 | msgid "Comments" 83 | msgstr "" 84 | 85 | #: inc/room.class.php:105 inc/room.class.php:364 86 | msgid "Seating" 87 | msgstr "" 88 | 89 | #: inc/room.class.php:121 inc/room.class.php:387 90 | msgid "Date of purchase" 91 | msgstr "" 92 | 93 | #: inc/room.class.php:129 94 | msgid "Printer" 95 | msgstr "" 96 | 97 | #: inc/room.class.php:137 inc/room.class.php:406 98 | msgid "Video Projector" 99 | msgstr "" 100 | 101 | #: inc/room.class.php:145 inc/room.class.php:412 102 | msgid "WiFi" 103 | msgstr "" 104 | 105 | #: inc/room.class.php:161 inc/room.class.php:454 106 | msgid "Opening Times" 107 | msgstr "" 108 | 109 | #: inc/room.class.php:169 inc/room.class.php:460 110 | msgid "Limitations" 111 | msgstr "" 112 | 113 | #: inc/room.class.php:177 inc/room.class.php:418 114 | msgid "Specificity 1" 115 | msgstr "" 116 | 117 | #: inc/room.class.php:185 inc/room.class.php:436 118 | msgid "Specificity 2" 119 | msgstr "" 120 | 121 | #: inc/room.class.php:193 inc/room.class.php:424 122 | msgid "Specificity 3" 123 | msgstr "" 124 | 125 | #: inc/room.class.php:201 inc/room.class.php:442 126 | msgid "Specificity 4" 127 | msgstr "" 128 | 129 | #: inc/room.class.php:209 130 | msgid "ID" 131 | msgstr "" 132 | 133 | #: inc/room.class.php:217 134 | msgid "Computers" 135 | msgstr "" 136 | 137 | #: inc/room.class.php:228 138 | msgid "Number of Computers" 139 | msgstr "" 140 | 141 | #: inc/room.class.php:237 142 | msgid "Entity" 143 | msgstr "" 144 | 145 | #: inc/room.class.php:294 146 | msgid "Last update" 147 | msgstr "" 148 | 149 | #: inc/room.class.php:306 150 | msgid "Location" 151 | msgstr "" 152 | 153 | #: inc/room.class.php:400 154 | msgid "Whiteboard" 155 | msgstr "" 156 | 157 | #: inc/room.class.php:513 158 | msgid "Associated items" 159 | msgstr "" 160 | 161 | #: inc/room.class.php:518 162 | msgid "Select the desired entity" 163 | msgstr "" 164 | 165 | #: inc/room.class.php:566 166 | msgid "Add" 167 | msgstr "" 168 | 169 | #: inc/room.class.php:578 170 | msgid "Check All" 171 | msgstr "" 172 | 173 | #: inc/room.class.php:586 174 | msgid "Uncheck All" 175 | msgstr "" 176 | 177 | #: inc/room.class.php:589 178 | msgid "To delete" 179 | msgstr "" 180 | 181 | #: inc/room.class.php:634 182 | msgid "This computer is in room:" 183 | msgstr "" 184 | 185 | #: inc/room.class.php:636 186 | msgid "Responsible" 187 | msgstr "" 188 | -------------------------------------------------------------------------------- /room.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pluginsGLPI/room/58eaca8da28d3fc42437c58adaed336fca6b3493/room.png -------------------------------------------------------------------------------- /room.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Room Management 4 | room 5 | stable 6 | https://raw.githubusercontent.com/pluginsGLPI/room/master/room.png 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | https://github.com/pluginsGLPI/room 18 | https://github.com/pluginsGLPI/room/releases 19 | https://github.com/pluginsGLPI/room/issues 20 | https://raw.githubusercontent.com/pluginsGLPI/room/master/README.md 21 | 22 | Julien Dombre 23 | bogucool 24 | Pascal Marier-Dionne 25 | Claude Duvergier 26 | 27 | 28 | 29 | 1.0 30 | 0.71 31 | 32 | 33 | 2.0 34 | 0.72 35 | 36 | 37 | 2.1 38 | 0.72 39 | 40 | 41 | 3.0.1 42 | 0.80 43 | 44 | 45 | 3.0.2 46 | 0.80.7 47 | 48 | 49 | 3.0.3 50 | 0.84 51 | 52 | 53 | 3.0.4b1 54 | 0.85 55 | 56 | 57 | 3.0.4b2 58 | 0.85 59 | 0.90 60 | 61 | 62 | 3.1.0 63 | 0.85 64 | 0.90 65 | 9.1 66 | 9.1.1 67 | 68 | 69 | 3.1.1 70 | 9.2 71 | 72 | 73 | 3.1.2 74 | 9.3.1 75 | 76 | 77 | 3.1.3 78 | 9.3.1 79 | 9.4 80 | 81 | 82 | 3.1.4 83 | 9.5 84 | 85 | 86 | 87 | de_DE 88 | en_GB 89 | fr_FR 90 | it_IT 91 | 92 | GPL v2+ 93 | 94 | 95 | Places 96 | Inventory 97 | Management 98 | Reservation 99 | 100 | 101 | Lieux 102 | Inventaire 103 | Gestion 104 | Réservation 105 | 106 | 107 | 108 | -------------------------------------------------------------------------------- /setup.php: -------------------------------------------------------------------------------- 1 | true, 25 | 'ticket_types' => true, 26 | 'linkgroup_tech_types' => true, 27 | ]); 28 | 29 | $CFG_GLPI['impact_asset_types']['PluginRoomRoom'] = 'plugins/room/room.png'; 30 | 31 | Plugin::registerClass('PluginRoomProfile', [ 32 | 'addtabon' => 'Profile', 33 | ]); 34 | 35 | if (Session::getLoginUserID()) { 36 | $PLUGIN_HOOKS['menu_toadd']['room'] = [ 37 | 'assets' => 'PluginRoomMenu', 38 | ]; 39 | } 40 | } 41 | 42 | // Get the name and the version of the plugin - Needed 43 | function plugin_version_room() 44 | { 45 | return [ 46 | 'name' => _n('Room', 'Rooms', 2, 'room'), 47 | 'version' => PLUGIN_ROOM_VERSION, 48 | 'license' => 'GPLv2+', 49 | 'author' => 'Julien Dombre / Modif bogucool, Pascal Marier-Dionne et Claude Duvergier', 50 | 'homepage' => 'https://github.com/pluginsGLPI/room', 51 | 'minGlpiVersion' => '9.5.0', 52 | ]; 53 | } 54 | 55 | // Optional : check prerequisites before install : may print errors or add to message after redirect 56 | function plugin_room_check_prerequisites() 57 | { 58 | if (version_compare(GLPI_VERSION, '9.5', '>=') && version_compare(GLPI_VERSION, '9.6', '<=')) { 59 | return true; 60 | } else { 61 | if (method_exists('Plugin', 'messageIncompatible')) { 62 | echo Plugin::messageIncompatible('core', '9.5', '9.6'); 63 | } else { 64 | echo 'This plugin requires GLPI >= 9.5 && <= 9.6'; 65 | } 66 | return false; 67 | } 68 | } 69 | 70 | // Incertain de ce que devrais vérifier cette méthode; je n'y touche donc pas 71 | // unsure as to what this function should check for; i wont modify it 72 | function plugin_room_check_config() 73 | { 74 | return true; 75 | } 76 | --------------------------------------------------------------------------------