diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..a67175e --- /dev/null +++ b/.editorconfig @@ -0,0 +1,692 @@ +[*] +charset = utf-8 +end_of_line = lf +indent_size = 4 +indent_style = space +insert_final_newline = true +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 8 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = false +ij_smart_tabs = false +ij_wrap_on_typing = false + +[*.blade.php] +ij_blade_keep_indents_on_empty_lines = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_brace_placement = 0 +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_value_alignment = 0 + +[*.feature] +indent_size = 2 +ij_gherkin_keep_indents_on_empty_lines = false + +[*.less] +indent_size = 2 +ij_less_align_closing_brace_with_properties = false +ij_less_blank_lines_around_nested_selector = 1 +ij_less_blank_lines_between_blocks = 1 +ij_less_brace_placement = 0 +ij_less_hex_color_long_format = false +ij_less_hex_color_lower_case = false +ij_less_hex_color_short_format = false +ij_less_hex_color_upper_case = false +ij_less_keep_blank_lines_in_code = 2 +ij_less_keep_indents_on_empty_lines = false +ij_less_keep_single_line_blocks = false +ij_less_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_less_space_after_colon = true +ij_less_space_before_opening_brace = true +ij_less_value_alignment = 0 + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_brace_placement = 0 +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_properties_order = font,font-family,font-size,font-weight,font-style,font-variant,font-size-adjust,font-stretch,line-height,position,z-index,top,right,bottom,left,display,visibility,float,clear,overflow,overflow-x,overflow-y,clip,zoom,align-content,align-items,align-self,flex,flex-flow,flex-basis,flex-direction,flex-grow,flex-shrink,flex-wrap,justify-content,order,box-sizing,width,min-width,max-width,height,min-height,max-height,margin,margin-top,margin-right,margin-bottom,margin-left,padding,padding-top,padding-right,padding-bottom,padding-left,table-layout,empty-cells,caption-side,border-spacing,border-collapse,list-style,list-style-position,list-style-type,list-style-image,content,quotes,counter-reset,counter-increment,resize,cursor,user-select,nav-index,nav-up,nav-right,nav-down,nav-left,transition,transition-delay,transition-timing-function,transition-duration,transition-property,transform,transform-origin,animation,animation-name,animation-duration,animation-play-state,animation-timing-function,animation-delay,animation-iteration-count,animation-direction,text-align,text-align-last,vertical-align,white-space,text-decoration,text-emphasis,text-emphasis-color,text-emphasis-style,text-emphasis-position,text-indent,text-justify,letter-spacing,word-spacing,text-outline,text-transform,text-wrap,text-overflow,text-overflow-ellipsis,text-overflow-mode,word-wrap,word-break,tab-size,hyphens,pointer-events,opacity,color,border,border-width,border-style,border-color,border-top,border-top-width,border-top-style,border-top-color,border-right,border-right-width,border-right-style,border-right-color,border-bottom,border-bottom-width,border-bottom-style,border-bottom-color,border-left,border-left-width,border-left-style,border-left-color,border-radius,border-top-left-radius,border-top-right-radius,border-bottom-right-radius,border-bottom-left-radius,border-image,border-image-source,border-image-slice,border-image-width,border-image-outset,border-image-repeat,outline,outline-width,outline-style,outline-color,outline-offset,background,background-color,background-image,background-repeat,background-attachment,background-position,background-position-x,background-position-y,background-clip,background-origin,background-size,box-decoration-break,box-shadow,text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_value_alignment = 0 + +[*.twig] +ij_twig_keep_indents_on_empty_lines = false +ij_twig_spaces_inside_delimiters = true +ij_twig_spaces_inside_variable_delimiters = true + +[.editorconfig] +ij_editorconfig_align_group_field_declarations = false +ij_editorconfig_space_after_colon = false +ij_editorconfig_space_after_comma = true +ij_editorconfig_space_before_colon = false +ij_editorconfig_space_before_comma = false +ij_editorconfig_spaces_around_assignment_operators = true + +[{*.ats,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = global +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.bash,*.zsh,*.sh}] +ij_shell_binary_ops_start_line = false +ij_shell_keep_column_alignment_padding = false +ij_shell_minify_program = false +ij_shell_redirect_followed_by_space = false +ij_shell_switch_cases_indented = false + +[{*.ctp,*.phtml,*.module,*.php,*.php5,*.php4,*.hphp,*.inc}] +ij_continuation_indent_size = 4 +ij_php_align_assignments = false +ij_php_align_class_constants = false +ij_php_align_group_field_declarations = false +ij_php_align_inline_comments = false +ij_php_align_key_value_pairs = false +ij_php_align_multiline_array_initializer_expression = false +ij_php_align_multiline_binary_operation = true +ij_php_align_multiline_chained_methods = false +ij_php_align_multiline_extends_list = false +ij_php_align_multiline_for = true +ij_php_align_multiline_parameters = false +ij_php_align_multiline_parameters_in_calls = false +ij_php_align_multiline_ternary_operation = true +ij_php_align_phpdoc_comments = true +ij_php_align_phpdoc_param_names = true +ij_php_api_weight = 28 +ij_php_array_initializer_new_line_after_left_brace = false +ij_php_array_initializer_right_brace_on_new_line = false +ij_php_array_initializer_wrap = on_every_item +ij_php_assignment_wrap = on_every_item +ij_php_author_weight = 28 +ij_php_binary_operation_sign_on_next_line = true +ij_php_binary_operation_wrap = on_every_item +ij_php_blank_lines_after_class_header = 0 +ij_php_blank_lines_after_function = 1 +ij_php_blank_lines_after_imports = 1 +ij_php_blank_lines_after_opening_tag = 0 +ij_php_blank_lines_after_package = 1 +ij_php_blank_lines_around_class = 1 +ij_php_blank_lines_around_constants = 0 +ij_php_blank_lines_around_field = 1 +ij_php_blank_lines_around_method = 1 +ij_php_blank_lines_before_class_end = 0 +ij_php_blank_lines_before_imports = 0 +ij_php_blank_lines_before_method_body = 0 +ij_php_blank_lines_before_package = 1 +ij_php_blank_lines_before_return_statement = 1 +ij_php_block_brace_style = end_of_line +ij_php_call_parameters_new_line_after_left_paren = false +ij_php_call_parameters_right_paren_on_new_line = false +ij_php_call_parameters_wrap = off +ij_php_catch_on_new_line = false +ij_php_category_weight = 28 +ij_php_class_brace_style = next_line +ij_php_comma_after_last_array_element = true +ij_php_concat_spaces = true +ij_php_copyright_weight = 28 +ij_php_deprecated_weight = 28 +ij_php_do_while_brace_force = always +ij_php_else_if_style = combine +ij_php_else_on_new_line = false +ij_php_example_weight = 28 +ij_php_extends_keyword_wrap = off +ij_php_extends_list_wrap = off +ij_php_fields_default_visibility = protected +ij_php_filesource_weight = 28 +ij_php_finally_on_new_line = false +ij_php_for_brace_force = always +ij_php_for_statement_new_line_after_left_paren = false +ij_php_for_statement_right_paren_on_new_line = true +ij_php_for_statement_wrap = normal +ij_php_force_short_declaration_array_style = true +ij_php_global_weight = 28 +ij_php_group_use_wrap = on_every_item +ij_php_if_brace_force = always +ij_php_if_lparen_on_next_line = false +ij_php_if_rparen_on_next_line = true +ij_php_ignore_weight = 28 +ij_php_import_sorting = by_length +ij_php_indent_break_from_case = true +ij_php_indent_case_from_switch = true +ij_php_indent_code_in_php_tags = false +ij_php_internal_weight = 28 +ij_php_keep_blank_lines_after_lbrace = 0 +ij_php_keep_blank_lines_before_right_brace = 0 +ij_php_keep_blank_lines_in_code = 2 +ij_php_keep_blank_lines_in_declarations = 1 +ij_php_keep_control_statement_in_one_line = true +ij_php_keep_first_column_comment = false +ij_php_keep_indents_on_empty_lines = false +ij_php_keep_line_breaks = true +ij_php_keep_rparen_and_lbrace_on_one_line = true +ij_php_keep_simple_methods_in_one_line = false +ij_php_lambda_brace_style = end_of_line +ij_php_license_weight = 28 +ij_php_line_comment_add_space = true +ij_php_line_comment_at_first_column = false +ij_php_link_weight = 28 +ij_php_lower_case_boolean_const = true +ij_php_lower_case_null_const = true +ij_php_method_brace_style = next_line +ij_php_method_call_chain_wrap = on_every_item +ij_php_method_parameters_new_line_after_left_paren = true +ij_php_method_parameters_right_paren_on_new_line = true +ij_php_method_parameters_wrap = on_every_item +ij_php_method_weight = 28 +ij_php_modifier_list_wrap = false +ij_php_multiline_chained_calls_semicolon_on_new_line = false +ij_php_namespace_brace_style = 1 +ij_php_null_type_position = in_the_beginning +ij_php_package_weight = 28 +ij_php_param_weight = 0 +ij_php_parentheses_expression_new_line_after_left_paren = false +ij_php_parentheses_expression_right_paren_on_new_line = true +ij_php_phpdoc_blank_line_before_tags = false +ij_php_phpdoc_blank_lines_around_parameters = true +ij_php_phpdoc_keep_blank_lines = false +ij_php_phpdoc_param_spaces_between_name_and_description = 1 +ij_php_phpdoc_param_spaces_between_tag_and_type = 1 +ij_php_phpdoc_param_spaces_between_type_and_name = 1 +ij_php_phpdoc_use_fqcn = false +ij_php_phpdoc_wrap_long_lines = true +ij_php_place_assignment_sign_on_next_line = false +ij_php_place_parens_for_constructor = 0 +ij_php_property_read_weight = 28 +ij_php_property_weight = 28 +ij_php_property_write_weight = 28 +ij_php_return_type_on_new_line = false +ij_php_return_weight = 2 +ij_php_see_weight = 1 +ij_php_since_weight = 28 +ij_php_sort_phpdoc_elements = true +ij_php_space_after_colon = true +ij_php_space_after_colon_in_return_type = true +ij_php_space_after_comma = true +ij_php_space_after_for_semicolon = true +ij_php_space_after_quest = true +ij_php_space_after_type_cast = false +ij_php_space_after_unary_not = false +ij_php_space_before_array_initializer_left_brace = false +ij_php_space_before_catch_keyword = true +ij_php_space_before_catch_left_brace = true +ij_php_space_before_catch_parentheses = true +ij_php_space_before_class_left_brace = true +ij_php_space_before_closure_left_parenthesis = true +ij_php_space_before_colon = true +ij_php_space_before_colon_in_return_type = false +ij_php_space_before_comma = false +ij_php_space_before_do_left_brace = true +ij_php_space_before_else_keyword = true +ij_php_space_before_else_left_brace = true +ij_php_space_before_finally_keyword = true +ij_php_space_before_finally_left_brace = true +ij_php_space_before_for_left_brace = true +ij_php_space_before_for_parentheses = true +ij_php_space_before_for_semicolon = false +ij_php_space_before_if_left_brace = true +ij_php_space_before_if_parentheses = true +ij_php_space_before_method_call_parentheses = false +ij_php_space_before_method_left_brace = true +ij_php_space_before_method_parentheses = false +ij_php_space_before_quest = true +ij_php_space_before_switch_left_brace = true +ij_php_space_before_switch_parentheses = true +ij_php_space_before_try_left_brace = true +ij_php_space_before_unary_not = false +ij_php_space_before_while_keyword = true +ij_php_space_before_while_left_brace = true +ij_php_space_before_while_parentheses = true +ij_php_space_between_ternary_quest_and_colon = false +ij_php_spaces_around_additive_operators = true +ij_php_spaces_around_arrow = false +ij_php_spaces_around_assignment_in_declare = false +ij_php_spaces_around_assignment_operators = true +ij_php_spaces_around_bitwise_operators = true +ij_php_spaces_around_equality_operators = true +ij_php_spaces_around_logical_operators = true +ij_php_spaces_around_multiplicative_operators = true +ij_php_spaces_around_null_coalesce_operator = true +ij_php_spaces_around_relational_operators = true +ij_php_spaces_around_shift_operators = true +ij_php_spaces_around_unary_operator = false +ij_php_spaces_around_var_within_brackets = false +ij_php_spaces_within_array_initializer_braces = false +ij_php_spaces_within_brackets = false +ij_php_spaces_within_catch_parentheses = false +ij_php_spaces_within_for_parentheses = false +ij_php_spaces_within_if_parentheses = false +ij_php_spaces_within_method_call_parentheses = false +ij_php_spaces_within_method_parentheses = false +ij_php_spaces_within_parentheses = false +ij_php_spaces_within_short_echo_tags = true +ij_php_spaces_within_switch_parentheses = false +ij_php_spaces_within_while_parentheses = false +ij_php_special_else_if_treatment = true +ij_php_subpackage_weight = 28 +ij_php_ternary_operation_signs_on_next_line = true +ij_php_ternary_operation_wrap = on_every_item +ij_php_throws_weight = 3 +ij_php_todo_weight = 4 +ij_php_unknown_tag_weight = 28 +ij_php_upper_case_boolean_const = false +ij_php_upper_case_null_const = false +ij_php_uses_weight = 28 +ij_php_var_weight = 28 +ij_php_variable_naming_style = camel_case +ij_php_version_weight = 5 +ij_php_while_brace_force = always +ij_php_while_on_new_line = false + +[{*.js,*.cjs}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx,node_modules/**/*,@angular/material,@angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = global +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.sht,*.html,*.shtm,*.shtml,*.htm,*.ng}] +ij_html_add_new_line_before_tags = body,div,p,form,h1,h2,h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title,h1,h2,h3,h4,h5,h6,p +ij_html_do_not_indent_children_of_tags = html,body,thead,tbody,tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a,abbr,acronym,b,basefont,bdo,big,br,cite,cite,code,dfn,em,font,i,img,input,kbd,label,q,s,samp,select,small,span,strike,strong,sub,sup,textarea,tt,u,var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span,pre,textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.yml,*.yaml}] +indent_size = 2 +ij_continuation_indent_size = 2 +ij_yaml_keep_indents_on_empty_lines = false +ij_yaml_keep_line_breaks = true + +[{.babelrc,.stylelintrc,.eslintrc,jest.config,*.json,*.jsb3,*.jsb2,*.bowerrc}] +indent_size = 2 +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = true +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{phpunit.xml.dist,*.xslt,*.xul,*.rng,*.xsl,*.xsd,*.ant,*.jhm,*.xml,*.tld,*.fxml,*.wsdl,*.jrxml,*.jnlp}] +ij_xml_block_comment_at_first_column = true +ij_xml_keep_indents_on_empty_lines = false +ij_xml_line_comment_at_first_column = true diff --git a/assets/AppAsset.php b/assets/AppAsset.php index 4935f33..745796d 100644 --- a/assets/AppAsset.php +++ b/assets/AppAsset.php @@ -1,8 +1,8 @@ - * @since 2.0 + * @since 2.0 */ class AppAsset extends AssetBundle { public $basePath = '@webroot'; + public $baseUrl = '@web'; + public $css = [ 'css/site.css', ]; @@ -29,6 +30,7 @@ class AppAsset extends AssetBundle 'fedemotta\datatables\DataTablesAsset', 'raoul2000\bootswatch\BootswatchAsset', ]; + public $jsOptions = ['position' => \yii\web\View::POS_HEAD]; } diff --git a/commands/HelloController.php b/commands/HelloController.php index 20066c4..6aaedf6 100644 --- a/commands/HelloController.php +++ b/commands/HelloController.php @@ -1,28 +1,28 @@ - * @since 2.0 + * @since 2.0 */ class HelloController extends Controller { /** * This command echoes what you have entered as the message. + * * @param string $message the message to be echoed. + * * @return int Exit code */ public function actionIndex($message = 'hello world') diff --git a/common/messages/ru/app.php b/common/messages/ru/app.php index 0b47666..217078a 100644 --- a/common/messages/ru/app.php +++ b/common/messages/ru/app.php @@ -76,7 +76,7 @@ 'false' => 'Нет', // models/ProjectsAll - 'Xlogin' => 'Логин', + 'Xlogin' => 'Логин', 'Final Mark' => 'Финальная оценка', 'Retry' => 'Попыток', 'Status' => 'Статус', diff --git a/components/ChangeThemeAction.php b/components/ChangeThemeAction.php index 05b87ca..a865c26 100644 --- a/components/ChangeThemeAction.php +++ b/components/ChangeThemeAction.php @@ -12,7 +12,7 @@ public function run() { if (ThemesHelper::isDefault()) { ThemesHelper::setDark(); - } else if (ThemesHelper::isDark()) { + } elseif (ThemesHelper::isDark()) { ThemesHelper::setDefault(); } diff --git a/config/console.php b/config/console.php index 1b8d947..b020044 100644 --- a/config/console.php +++ b/config/console.php @@ -10,7 +10,7 @@ 'controllerNamespace' => 'app\commands', 'aliases' => [ '@bower' => '@vendor/bower-asset', - '@npm' => '@vendor/npm-asset', + '@npm' => '@vendor/npm-asset', ], 'components' => [ 'cache' => [ diff --git a/config/db.php b/config/db.php index 0889253..6d90d4a 100644 --- a/config/db.php +++ b/config/db.php @@ -2,7 +2,13 @@ return [ 'class' => 'yii\db\Connection', - 'dsn' => 'mysql:host=' . env('DB_HOST', 'mysql') . ';port=' . env('DB_PORT', '3306') .';dbname=' . env('DB_NAME', 'yii2') . ';', + 'dsn' => 'mysql:host=' + . env('DB_HOST', 'mysql') + . ';port=' + . env('DB_PORT', '3306') + . ';dbname=' + . env('DB_NAME', 'yii2') + . ';', 'username' => env('DB_USERNAME', 'yii2'), 'password' => env('DB_PASSWORD', 'yii2'), 'charset' => 'utf8', diff --git a/config/test.php b/config/test.php index f95bc03..dea41b6 100644 --- a/config/test.php +++ b/config/test.php @@ -10,7 +10,7 @@ 'basePath' => dirname(__DIR__), 'aliases' => [ '@bower' => '@vendor/bower-asset', - '@npm' => '@vendor/npm-asset', + '@npm' => '@vendor/npm-asset', ], 'language' => 'en-US', 'components' => [ diff --git a/config/web.php b/config/web.php index 932732b..05188a3 100644 --- a/config/web.php +++ b/config/web.php @@ -5,13 +5,13 @@ $config = [ 'id' => 'basic', - 'name'=>'cheatera.pp.ua', + 'name' => 'cheatera.pp.ua', 'basePath' => dirname(__DIR__), 'bootstrap' => ['log'], 'sourceLanguage' => 'en', // использовать в качестве ключей переводов 'aliases' => [ '@bower' => '@vendor/bower-asset', - '@npm' => '@vendor/npm-asset', + '@npm' => '@vendor/npm-asset', ], 'modules' => [ 'languages' => [ diff --git a/controllers/CalculatorController.php b/controllers/CalculatorController.php index 4043afe..4186d61 100644 --- a/controllers/CalculatorController.php +++ b/controllers/CalculatorController.php @@ -14,14 +14,15 @@ class CalculatorController extends CommonController /** * actionIndex * - * @param Object $model calculator's model + * @param Object $model calculator's model * * @return String which sends to the View */ public function actionIndex($model = null) { $title = Yii::t('app', 'Experience calculator'); - $description = Yii::t('app', 'Want to know your level after project evaluation -- use our Experience calculator!'); + $description = + Yii::t('app', 'Want to know your level after project evaluation -- use our Experience calculator!'); $this->setMeta($title, $description); if ($model === null) { @@ -35,7 +36,7 @@ public function actionIndex($model = null) 'model' => $model, 'breadcrumbs' => [ 'name' => Yii::t('app', 'Calculator'), - 'url' => 'calculator' + 'url' => 'calculator', ], ]); } @@ -43,29 +44,32 @@ public function actionIndex($model = null) /** * getMarkFromPost * - * @param Object $model reference to Calculator's Model instance - * @param Array $post $post request array + * @param Object $model reference to Calculator's Model instance + * @param Array $post $post request array */ private function getMarkFromPost(&$model, $post) { if ($model && $post - && $model->load($post) && $model->validate() ) { + && $model->load($post) + && $model->validate() + ) { foreach ($model->getTier() as $k => $v) { - if ( array_key_exists($k, $post) ) { + if (array_key_exists($k, $post)) { $tier = $model->tier = $k; } } - if ( isset($tier) - && !is_nan($tier) - && $tier <= 7 - && $tier >= 0 ) { + if (isset($tier) + && !is_nan($tier) + && $tier <= 7 + && $tier >= 0 + ) { $model->lvlstart = $model->getMark(); } } } + /** * actionFormSubmission - * * @return Float to be set into the 'Result' field on the View */ public function actionFormSubmission() diff --git a/controllers/CamsController.php b/controllers/CamsController.php index 2d1cb94..3a86898 100644 --- a/controllers/CamsController.php +++ b/controllers/CamsController.php @@ -27,7 +27,7 @@ public function actionIndex() 'isAccessGaranted' => $isAccessGaranted, 'breadcrumbs' => [ 'name' => Yii::t('app', 'Cams'), - 'url' => 'cams' + 'url' => 'cams', ], ]); } diff --git a/controllers/CommonController.php b/controllers/CommonController.php index 112c069..1fc4e6e 100644 --- a/controllers/CommonController.php +++ b/controllers/CommonController.php @@ -18,9 +18,9 @@ public function behaviors() 'rules' => [ [ 'allow' => true, - 'roles' => ['@'] - ] - ] + 'roles' => ['@'], + ], + ], ], ]; } @@ -29,7 +29,8 @@ public function behaviors() * @param null $title * @param null $description */ - protected function setMeta($title = null, $description = null) { + protected function setMeta($title = null, $description = null) + { $this->view->title = $title; $this->view->registerMetaTag(['name' => 'description', 'content' => "$description"]); } diff --git a/controllers/CorrectSearch.php b/controllers/CorrectSearch.php index ef44a83..f64ef6b 100644 --- a/controllers/CorrectSearch.php +++ b/controllers/CorrectSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\Correct; +use yii\data\ActiveDataProvider; /** * CorrectSearch represents the model behind the search form of `app\models\Correct`. @@ -12,6 +12,7 @@ class CorrectSearch extends Correct { public $dateStart = null; + public $dateEnd = null; public function __construct($login, array $configs = []) @@ -19,6 +20,7 @@ public function __construct($login, array $configs = []) $this->xlogin = $login; parent::__construct($configs); } + /** * {@inheritdoc} */ @@ -63,8 +65,8 @@ public function search($params) 'query' => $query, 'sort' => [ 'defaultOrder' => [ - 'date' => SORT_DESC - ] + 'date' => SORT_DESC, + ], ], 'pagination' => [ 'pageSize' => -1, diff --git a/controllers/CorrectionsController.php b/controllers/CorrectionsController.php index 51f6cfc..1fd3902 100644 --- a/controllers/CorrectionsController.php +++ b/controllers/CorrectionsController.php @@ -3,8 +3,6 @@ namespace app\controllers; use Yii; -use app\models\CorrectionLog; -use app\controllers\CorrectionsSearch; /** * CorrectionLogController implements the CRUD actions for CorrectionLog model. diff --git a/controllers/CorrectionsSearch.php b/controllers/CorrectionsSearch.php index d362af9..464bbb3 100644 --- a/controllers/CorrectionsSearch.php +++ b/controllers/CorrectionsSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\CorrectionLog; +use yii\data\ActiveDataProvider; /** * CorrectionLogSearch represents the model behind the search form of `app\models\CorrectionLog`. @@ -12,7 +12,9 @@ class CorrectionsSearch extends CorrectionLog { public $dateStart = null; + public $dateEnd = null; + /** * {@inheritdoc} */ @@ -56,8 +58,8 @@ public function search($params) 'query' => $query, 'sort' => [ 'defaultOrder' => [ - 'date' => SORT_DESC - ] + 'date' => SORT_DESC, + ], ], 'pagination' => [ 'pageSize' => -1, diff --git a/controllers/FriendController.php b/controllers/FriendController.php index 02dab4f..00bb6fd 100644 --- a/controllers/FriendController.php +++ b/controllers/FriendController.php @@ -4,7 +4,6 @@ use Yii; use app\models\Friend; -use yii\web\Controller; use yii\filters\VerbFilter; /** @@ -70,13 +69,16 @@ public function actionCreate($id, $course) if ($model->save()) { return $this->goBack(); } + return $this->redirect(['error']); } /** * Deletes an existing Friend model. * If deletion is successful, the browser will be redirected to the 'index' page. + * * @param integer $id + * * @return mixed * @throws \Throwable * @throws \yii\db\StaleObjectException @@ -88,9 +90,12 @@ public function actionDelete($id) $friend->status = 0; $friend->save(); } - if (Friend::find()->where(['mylogin' => Yii::$app->user->identity->username, 'xlogin' => $id])->one()->delete() !== null) { + if (Friend::find()->where(['mylogin' => Yii::$app->user->identity->username, 'xlogin' => $id])->one()->delete() + !== null + ) { return $this->goBack(); } + return $this->redirect(['friend/index']); } } diff --git a/controllers/FriendSearch.php b/controllers/FriendSearch.php index 2723ddb..2fe7c9c 100644 --- a/controllers/FriendSearch.php +++ b/controllers/FriendSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\Friend; +use yii\data\ActiveDataProvider; /** * FriendSearch represents the model behind the search form of `app\models\Friend`. @@ -13,12 +13,13 @@ class FriendSearch extends Friend { public $who; + public $friendStatus; /** * FriendSearch constructor. * - * @param $login + * @param $login * @param int $status */ public function __construct($login, $status = 1) @@ -57,12 +58,12 @@ public function scenarios() */ public function search($params, $reverse = false) { - if($reverse === true) { + if ($reverse === true) { $query = Friend::find() ->select([ 'friends.*', 'xlogins.*', - 'cursus_users.level' + 'cursus_users.level', ]) ->innerJoin('xlogins', 'xlogins.login = friends.mylogin') ->innerJoin('cursus_users', 'cursus_users.xlogin = friends.mylogin') @@ -73,7 +74,7 @@ public function search($params, $reverse = false) ->select([ 'friends.*', 'xlogins.*', - 'cursus_users.level' + 'cursus_users.level', ]) ->innerJoin('xlogins', 'xlogins.login = friends.xlogin') ->innerJoin('cursus_users', 'cursus_users.xlogin = friends.xlogin') @@ -109,6 +110,7 @@ public function search($params, $reverse = false) ->andFilterWhere(['like', 'xlogin', $this->xlogin]); $dataProvider->models = $this->onlineSort($dataProvider->models); + return $dataProvider; } @@ -116,6 +118,7 @@ public function search($params, $reverse = false) * Move online friends up * * @param $models + * * @return array */ private function onlineSort($models) @@ -126,9 +129,10 @@ private function onlineSort($models) array_unshift($new, $model); unset($models[$key]); } else { - $new[] = $model; + $new[] = $model; } } + return $new; } } diff --git a/controllers/LocationsSearch.php b/controllers/LocationsSearch.php index a9c9881..5dc163d 100644 --- a/controllers/LocationsSearch.php +++ b/controllers/LocationsSearch.php @@ -3,20 +3,18 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\Locations; +use yii\data\ActiveDataProvider; /** * LocationsSearch represents the model behind the search form of `app\models\Locations`. - * * DELIMITER // * CREATE TRIGGER `locations_upd` BEFORE INSERT ON `locations` * FOR EACH ROW - BEGIN - SET NEW.date = SUBSTRING_INDEX(NEW.begin_at, ' ', 1); - SET NEW.how = (CASE WHEN NEW.end_at > 0 AND LENGTH(NEW.xlogin) > 2 THEN TIMEDIFF (NEW.end_at, NEW.begin_at) ELSE 0 END); - END// - * DELIMITER ; + * BEGIN + * SET NEW.date = SUBSTRING_INDEX(NEW.begin_at, ' ', 1); + * SET NEW.how = (CASE WHEN NEW.end_at > 0 AND LENGTH(NEW.xlogin) > 2 THEN TIMEDIFF (NEW.end_at, NEW.begin_at) ELSE 0 + * END); END// DELIMITER ; */ class LocationsSearch extends Locations { @@ -25,6 +23,7 @@ public function __construct($login, array $configs = []) $this->login = $login; parent::__construct($configs); } + /** * {@inheritdoc} */ @@ -32,7 +31,7 @@ public function rules() { return [ [['id', 'lid', 'campus_id', 'user_id'], 'integer'], - [['host', 'begin_at', 'end_at', 'xlogin', 'date','dateStart', 'dateEnd', 'how'], 'safe'], + [['host', 'begin_at', 'end_at', 'xlogin', 'date', 'dateStart', 'dateEnd', 'how'], 'safe'], ]; } @@ -56,8 +55,7 @@ public function search($params) { $query = Locations::find() ->where(['xlogin' => $this->login]) - ->andWhere('end_at > 0') - ; + ->andWhere('end_at > 0'); $this->load($params); // add conditions that should always apply here @@ -71,8 +69,8 @@ public function search($params) 'query' => $query, 'sort' => [ 'defaultOrder' => [ - 'date' => SORT_DESC - ] + 'date' => SORT_DESC, + ], ], 'pagination' => [ 'pageSize' => -1, diff --git a/controllers/Minus42Controller.php b/controllers/Minus42Controller.php index 50af351..38cbb09 100644 --- a/controllers/Minus42Controller.php +++ b/controllers/Minus42Controller.php @@ -3,10 +3,6 @@ namespace app\controllers; use Yii; -use app\models\Minus42; -use app\controllers\Minus42Search; -use yii\web\Controller; -use yii\web\NotFoundHttpException; /** * Minus42Controller implements the CRUD actions for Minus42 model. @@ -20,7 +16,7 @@ class Minus42Controller extends CommonController public function actionStudents() { $title = Yii::t('app', 'Cheating students members at UNIT Factory'); - $description = Yii::t('app','Full information about cheating from student members at UNIT Factory'); + $description = Yii::t('app', 'Full information about cheating from student members at UNIT Factory'); $this->setMeta($title, $description); $searchModel = new Minus42StudentsSearch(); @@ -32,7 +28,7 @@ public function actionStudents() 'subPage' => 'students', 'breadcrumbs' => [ 'name' => Yii::t('app', 'Students'), - 'url' => 'show/students' + 'url' => 'show/students', ], ]); } @@ -44,7 +40,7 @@ public function actionStudents() public function actionPools() { $title = Yii::t('app', 'Cheating pools members at UNIT Factory'); - $description = Yii::t('app','Full information about cheating from pool members at UNIT Factory'); + $description = Yii::t('app', 'Full information about cheating from pool members at UNIT Factory'); $this->setMeta($title, $description); $searchModel = new Minus42Search(4); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); @@ -55,7 +51,7 @@ public function actionPools() 'subPage' => 'pools', 'breadcrumbs' => [ 'name' => Yii::t('app', 'Pools'), - 'url' => 'show/pools' + 'url' => 'show/pools', ], ]); } diff --git a/controllers/Minus42Search.php b/controllers/Minus42Search.php index a3fb3f0..f546665 100644 --- a/controllers/Minus42Search.php +++ b/controllers/Minus42Search.php @@ -2,8 +2,8 @@ namespace app\controllers; -use app\models\ProjectsAll; use yii\base\Model; +use app\models\ProjectsAll; use yii\data\ActiveDataProvider; /** @@ -15,6 +15,7 @@ class Minus42Search extends ProjectsAll /** * Minus42Search constructor. + * * @param $searchCourse */ public function __construct($searchCourse) @@ -29,7 +30,8 @@ public function __construct($searchCourse) public function rules() { return [ - [['id', 'current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], 'integer'], + [['id', 'current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], + 'integer'], [['xlogin', 'name', 'slug', 'status', 'validated', 'pool_year', 'pool_month'], 'safe'], ]; } @@ -57,10 +59,9 @@ public function search($params) 'projects_users.*', 'xlogins.*', ]) - ->innerJoin('xlogins','projects_users.xlogin = xlogins.login') + ->innerJoin('xlogins', 'projects_users.xlogin = xlogins.login') ->andWhere('final_mark < 0') - ->andWhere("projects_users.cursus_ids = $this->course") - ; + ->andWhere("projects_users.cursus_ids = $this->course"); // add conditions that should always apply here @@ -95,7 +96,6 @@ public function search($params) return $dataProvider; } - private function getSort() { return [ @@ -140,8 +140,8 @@ private function getSort() 'xlogin' => [ 'asc' => ['xlogin' => SORT_ASC], 'desc' => ['xlogin' => SORT_DESC], - ] - ] + ], + ], ]; } diff --git a/controllers/Minus42StudentsSearch.php b/controllers/Minus42StudentsSearch.php index e154b86..7e0aaf7 100644 --- a/controllers/Minus42StudentsSearch.php +++ b/controllers/Minus42StudentsSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\Minus42; +use yii\data\ActiveDataProvider; /** * Minus42StudentsSearch represents the model behind the search form of `app\models\Minus42`. @@ -47,10 +47,9 @@ public function search($params) 'projects_users.name', 'projects_users.slug', ]) - ->innerJoin('projects_users','projects_users.project_id = m42.puid') - ->innerJoin('xlogins','m42.xlogin = xlogins.login') - ->andWhere('m42.xlogin = projects_users.xlogin and projects_users.cursus_ids=1') - ; + ->innerJoin('projects_users', 'projects_users.project_id = m42.puid') + ->innerJoin('xlogins', 'm42.xlogin = xlogins.login') + ->andWhere('m42.xlogin = projects_users.xlogin and projects_users.cursus_ids=1'); // add conditions that should always apply here @@ -78,9 +77,9 @@ public function search($params) ]); $query->andFilterWhere(['like', 'xlogins.login', $this->xlogin]) - ->andFilterWhere(['like', 'name', $this->name]) - ->andFilterWhere(['like', 'pool_year', $this->pool_year]) - ->andFilterWhere(['like', 'pool_month', $this->pool_month]); + ->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'pool_year', $this->pool_year]) + ->andFilterWhere(['like', 'pool_month', $this->pool_month]); return $dataProvider; } @@ -117,8 +116,8 @@ private function getSort() 'name' => [ 'asc' => ['name' => SORT_ASC], 'desc' => ['name' => SORT_DESC], - ] - ] + ], + ], ]; } } diff --git a/controllers/ProjectsAllSearch.php b/controllers/ProjectsAllSearch.php index ce7e5dc..b0d9c8f 100644 --- a/controllers/ProjectsAllSearch.php +++ b/controllers/ProjectsAllSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\ProjectsAll; +use yii\data\ActiveDataProvider; /** * ProjectsAllSearch represents the model behind the search form of `app\models\ProjectsAll`. @@ -14,6 +14,7 @@ class ProjectsAllSearch extends ProjectsAll protected $course; protected $projectSlug; + protected $team = null; public function __construct($searchCourse, $searchSlug, $team) @@ -32,7 +33,8 @@ public function __construct($searchCourse, $searchSlug, $team) public function rules() { return [ - [['id', 'current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], 'integer'], + [['id', 'current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], + 'integer'], [['xlogin', 'name', 'slug', 'status', 'validated', 'pool_year', 'pool_month'], 'safe'], ]; } @@ -57,7 +59,7 @@ public function search($params) { $where = [ 'cursus_ids' => $this->course, - 'slug' => $this->projectSlug + 'slug' => $this->projectSlug, ]; if ($this->team) { $where['current_team_id'] = $this->team; @@ -67,7 +69,7 @@ public function search($params) 'projects_users.*', 'xlogins.*', ]) - ->innerJoin('xlogins','projects_users.xlogin = xlogins.login') + ->innerJoin('xlogins', 'projects_users.xlogin = xlogins.login') ->where($where); // add conditions that should always apply here @@ -77,7 +79,7 @@ public function search($params) 'pagination' => [ 'pageSize' => 42, ], - 'sort'=> ['defaultOrder' => [ + 'sort' => ['defaultOrder' => [ 'final_mark' => SORT_DESC, 'xlogin' => SORT_ASC, ]], diff --git a/controllers/ProjectsController.php b/controllers/ProjectsController.php index b37396f..3689ed2 100644 --- a/controllers/ProjectsController.php +++ b/controllers/ProjectsController.php @@ -3,8 +3,8 @@ namespace app\controllers; use Yii; -use app\models\ProjectsAll; use app\models\Show; +use app\models\ProjectsAll; use yii\web\NotFoundHttpException; /** @@ -13,8 +13,11 @@ class ProjectsController extends CommonController { protected $course; + protected $getId; + protected $forParent; + protected $team = 0; /** @@ -24,17 +27,18 @@ class ProjectsController extends CommonController public function actionStudents() { $title = Yii::t('app', 'Students projects UNIT Factory'); - $description = Yii::t('app','Full information about students projects from UNIT Factory'); + $description = Yii::t('app', 'Full information about students projects from UNIT Factory'); $this->setMeta($title, $description); $searchModel = new ProjectsFilterSearch(['course' => '1', 'parent' => '0']); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); [$months, $years] = self::getPoolsMonthAndYear(); + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'breadcrumbs' => [ 'name' => Yii::t('app', 'Students'), - 'url' => 'show/students' + 'url' => 'show/students', ], 'subPage' => '/students/projects', 'action' => 'students', @@ -50,17 +54,18 @@ public function actionStudents() public function actionPools() { $title = Yii::t('app', 'Pools projects UNIT Factory'); - $description = Yii::t('app','Full information about pools projects from UNIT Factory'); + $description = Yii::t('app', 'Full information about pools projects from UNIT Factory'); $this->setMeta($title, $description); $searchModel = new ProjectsFilterSearch(['course' => 4, 'parent' => 0]); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); [$months, $years] = self::getPoolsMonthAndYear(); + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'breadcrumbs' => [ 'name' => Yii::t('app', 'Pools'), - 'url' => 'show/pools' + 'url' => 'show/pools', ], 'subPage' => '/pools/projects', 'action' => 'pools', @@ -71,7 +76,9 @@ public function actionPools() /** * Displays a single students Projects model. + * * @param integer $id + * * @return string * @throws NotFoundHttpException */ @@ -79,15 +86,18 @@ public function actionStudentsView($id) { $type = self::checkParentAndChildProjects($id); if (isset($type)) { - return $type > 0 ? self::renderSingleProjectChild($id, 'students', 1): self::renderParentProject($id, 'students', 1); + return $type > 0 ? self::renderSingleProjectChild($id, 'students', 1) + : self::renderParentProject($id, 'students', 1); } + return self::renderSingleProject($id, 'students', 1); } - /** * Displays a single Project models. + * * @param integer $id + * * @return string * @throws NotFoundHttpException */ @@ -95,13 +105,16 @@ public function actionPoolsView($id) { $type = self::checkParentAndChildProjects($id); if (isset($type)) { - return $type > 0 ? self::renderSingleProjectChild($id, 'pools', 4) : self::renderParentProject($id, 'pools', 4); + return $type > 0 ? self::renderSingleProjectChild($id, 'pools', 4) + : self::renderParentProject($id, 'pools', 4); } + return self::renderSingleProject($id, 'pools', 4); } /** * @param $id + * * @return int * @throws NotFoundHttpException */ @@ -111,11 +124,13 @@ private function checkParentAndChildProjects($id) if ($model !== null) { if (ProjectsAll::find() ->where(['parent_id' => $model->project_id]) - ->one() !== null) { - return 0; - } else if ($model->parent_id !== 0) { + ->one() !== null + ) { + return 0; + } elseif ($model->parent_id !== 0) { return 1; } + return null; } throw new NotFoundHttpException('The requested page does not exist.'); @@ -127,6 +142,7 @@ private function checkParentAndChildProjects($id) * @param $id * @param $case * @param $course + * * @return string */ private function renderSingleProject($id, $case, $course) @@ -135,6 +151,7 @@ private function renderSingleProject($id, $case, $course) $searchModel = new ProjectsAllSearch($course, $id, $this->team); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); [$months, $years] = self::getPoolsMonthAndYear(); + return $this->render('view', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -160,6 +177,7 @@ private function renderSingleProject($id, $case, $course) * @param $id * @param $case * @param $course + * * @return string */ private function renderSingleProjectChild($id, $case, $course) @@ -168,6 +186,7 @@ private function renderSingleProjectChild($id, $case, $course) $searchModel = new ProjectsAllSearch($course, $id, $this->team); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); [$months, $years] = self::getPoolsMonthAndYear(); + return $this->render('view', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -197,6 +216,7 @@ private function renderSingleProjectChild($id, $case, $course) * @param $id * @param $case * @param $course + * * @return string */ private function renderParentProject($id, $case, $course) @@ -207,6 +227,7 @@ private function renderParentProject($id, $case, $course) $searchModelSubProject = new ProjectsFilterSearch(['course' => $course, 'parent' => $this->getId]); $dataProviderSubProject = $searchModelSubProject->search(Yii::$app->request->queryParams); [$months, $years] = self::getPoolsMonthAndYear(); + return $this->render('view_with_childs', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -219,7 +240,7 @@ private function renderParentProject($id, $case, $course) ], '1' => [ 'name' => Yii::t('app', $case . ' Projects'), -// 'url' => "projects/$case", + // 'url' => "projects/$case", 'url' => "projects/$case", ], ], @@ -233,8 +254,8 @@ private function renderParentProject($id, $case, $course) } /** - * @param $id - * @param $case + * @param $id + * @param $case * @param null $parent */ private function beforeRender($id, $case, $parent = null) @@ -243,7 +264,7 @@ private function beforeRender($id, $case, $parent = null) $this->getId = (ProjectsAll::find()->where("slug = '$id'")->one())->project_id; $project_name = $getName->name; $title = Yii::t('app', '{0} :: {1} project UNIT Factory', [$project_name, $case]); - $description = Yii::t('app','Full information about {0} from UNIT Factory', $project_name); + $description = Yii::t('app', 'Full information about {0} from UNIT Factory', $project_name); $this->setMeta($title, $description); if (isset($parent)) { $parentName = ProjectsAll::find()->where("project_id = '{$getName->parent_id}'")->one(); @@ -267,12 +288,14 @@ public function getPoolsMonthAndYear() $str = "$item->pool_year"; $years[$str] = (string)$item->pool_year; } + return [$months, $years]; } public function actionTeam($course, $name, $id) { $this->team = $id; - return $course === 'students' ? $this->actionStudentsView($name) : $this->actionPoolsView($name) ; + + return $course === 'students' ? $this->actionStudentsView($name) : $this->actionPoolsView($name); } } diff --git a/controllers/ProjectsFilterSearch.php b/controllers/ProjectsFilterSearch.php index ec534c7..e94038b 100644 --- a/controllers/ProjectsFilterSearch.php +++ b/controllers/ProjectsFilterSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\ProjectsAll; +use yii\data\ActiveDataProvider; /** * ProjectsFilterSearch represents the model behind the search form of `app\models\ProjectsAll`. @@ -12,7 +12,9 @@ class ProjectsFilterSearch extends ProjectsAll { public $parent = null; + public $course = null; + public $childs = null; public function __construct(array $configs = []) @@ -30,6 +32,7 @@ public function __construct(array $configs = []) } parent::__construct($configs); } + /** * {@inheritdoc} */ @@ -84,8 +87,7 @@ public function search($params) ]) ->innerJoin('xlogins', 'xlogins.login = projects_users.xlogin') ->where($where) - ->addGroupBy('projects_users.name') - ; + ->addGroupBy('projects_users.name'); // add conditions that should always apply here $this->load($params); @@ -112,10 +114,10 @@ public function search($params) } $query->andFilterWhere(['like', 'name', $this->name]); + return $dataProvider; } - private function getSort() { return [ @@ -165,7 +167,7 @@ private function getSort() 'asc' => ['cg' => SORT_ASC], 'desc' => ['cg' => SORT_DESC], ], - ] + ], ]; } } diff --git a/controllers/ShowController.php b/controllers/ShowController.php index 16aaa1c..26f833f 100644 --- a/controllers/ShowController.php +++ b/controllers/ShowController.php @@ -3,9 +3,9 @@ namespace app\controllers; use Yii; -use app\helpers\SkillsHelper; -use app\models\ProjectsLogin; use app\models\Show; +use app\models\ProjectsLogin; +use app\helpers\SkillsHelper; use yii\web\NotFoundHttpException; /** @@ -22,12 +22,13 @@ class ShowController extends CommonController public function actionStudents() { $title = Yii::t('app', 'Students UNIT Factory'); - $description = Yii::t('app','All student members UNIT Factory'); + $description = Yii::t('app', 'All student members UNIT Factory'); $this->setMeta($title, $description); $this->course = '42'; $searchModel = new ShowSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $this->course); [$months, $years] = ProjectsController::getPoolsMonthAndYear(); + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -45,13 +46,14 @@ public function actionStudents() public function actionPools() { $title = Yii::t('app', 'Pools UNIT Factory'); - $description = Yii::t('app','All pool members UNIT Factory'); + $description = Yii::t('app', 'All pool members UNIT Factory'); $this->setMeta($title, $description); $this->course = 'Piscine C'; $searchModel = new ShowSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $this->course); [$months, $years] = ProjectsController::getPoolsMonthAndYear(); + return $this->render('index', [ 'searchModel' => $searchModel, 'dataProvider' => $dataProvider, @@ -64,13 +66,14 @@ public function actionPools() /** * @param $id + * * @return string * @throws NotFoundHttpException */ public function actionStudentsView($id) { $title = Yii::t('app', '{0} :: student member UNIT Factory', $id); - $description = Yii::t('app','Full information about {0} from UNIT Factory', $id); + $description = Yii::t('app', 'Full information about {0} from UNIT Factory', $id); $this->setMeta($title, $description); $this->course = '42'; $skills = SkillsHelper::getSkills($id, 1); @@ -90,7 +93,7 @@ public function actionStudentsView($id) 'dataProviderCorrections' => $dataProviderCorrections, 'breadcrumbs' => [ 'name' => Yii::t('app', 'Students'), - 'url' => 'show/students' + 'url' => 'show/students', ], 'skills' => $skills, 'switch' => 'pools', @@ -106,13 +109,14 @@ public function actionStudentsView($id) /** * @param $id + * * @return string * @throws NotFoundHttpException */ public function actionPoolsView($id) { $title = Yii::t('app', '{0} :: pool member UNIT Factory', $id); - $description = Yii::t('app','Full information about {0} from UNIT Factory', $id); + $description = Yii::t('app', 'Full information about {0} from UNIT Factory', $id); $this->setMeta($title, $description); $this->course = 'Piscine C'; $skills = SkillsHelper::getSkills($id, 4); @@ -128,7 +132,7 @@ public function actionPoolsView($id) 'model' => $this->findModelLogin($id), 'breadcrumbs' => [ 'name' => Yii::t('app', 'Pools'), - 'url' => 'show/pools' + 'url' => 'show/pools', ], 'searchModelTime' => $searchModelTime, 'dataProviderTime' => $dataProviderTime, @@ -148,6 +152,7 @@ public function actionPoolsView($id) /** * @param $id + * * @return array|\yii\db\ActiveRecord|null * @throws NotFoundHttpException */ @@ -156,21 +161,25 @@ protected function findModelLogin($id) if (($model = Show::find() ->select([ 'xlogins.*', - 'cursus_users.*' + 'cursus_users.*', ]) - ->innerJoin('cursus_users','cursus_users.xlogin = xlogins.login') + ->innerJoin('cursus_users', 'cursus_users.xlogin = xlogins.login') ->where(['login' => $id, 'cursus_users.name' => $this->course]) ->limit(1) - ->one()) !== null) { + ->one()) !== null + ) { return $model; } throw new NotFoundHttpException('The requested page does not exist.'); } + /** * Finds the Show model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. + * * @param integer $id + * * @return array|\yii\db\ActiveRecord[] * @throws NotFoundHttpException if the model cannot be found */ @@ -179,7 +188,8 @@ protected function findProjectsLoginModel($id, $course) if (($model = ProjectsLogin::find() ->where(['xlogin' => $id, 'cursus_ids' => $course]) ->orderBy('puid asc, final_mark desc') - ->all()) !== null) { + ->all()) !== null + ) { return $this->sortedProjects($model); } @@ -188,6 +198,7 @@ protected function findProjectsLoginModel($id, $course) /** * @param array $models + * * @return array */ private function sortedProjects(array $models) @@ -203,12 +214,14 @@ private function sortedProjects(array $models) } $parents = isset($result['withParent']) ? $result['withParent'] : []; unset($result['withParent']); + return ['common' => $result, 'parents' => $parents]; } /** - * @param $parent + * @param $parent * @param array $models + * * @return string */ private function getProjectNameByID($parent, array $models) @@ -218,8 +231,8 @@ private function getProjectNameByID($parent, array $models) return $model->name; } } + return 'no name'; } - } diff --git a/controllers/ShowSearch.php b/controllers/ShowSearch.php index 57557e9..7e62b9d 100644 --- a/controllers/ShowSearch.php +++ b/controllers/ShowSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\Show; +use yii\data\ActiveDataProvider; /** * ShowSearch represents the model behind the search form of `app\models\Show`. @@ -35,19 +35,19 @@ public function scenarios() /** * Creates data provider instance with search query applied * - * @param array $params + * @param array $params * @param string $course + * * @return ActiveDataProvider */ public function search($params, $course) { - $query = Show::find() ->select([ 'xlogins.*', - 'cursus_users.*' + 'cursus_users.*', ]) - ->innerJoin('cursus_users','cursus_users.xlogin = xlogins.login') + ->innerJoin('cursus_users', 'cursus_users.xlogin = xlogins.login') ->where([ 'xlogins.visible' => 1, 'cursus_users.name' => $course, @@ -66,7 +66,7 @@ public function search($params, $course) if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails -// $query->where('0=1'); + // $query->where('0=1'); return $dataProvider; } @@ -78,6 +78,7 @@ public function search($params, $course) ->andFilterWhere(['like', 'pool_year', $this->pool_year]) ->andFilterWhere(['like', 'location', $this->location]) ->andFilterWhere(['like', 'lastloc', $this->lastloc]); + return $dataProvider; } @@ -135,8 +136,8 @@ private function getSort() 'hours' => [ 'asc' => ['hours' => SORT_ASC], 'desc' => ['hours' => SORT_DESC], - ] - ] + ], + ], ]; } diff --git a/controllers/SiteController.php b/controllers/SiteController.php index 3e6344e..77cc371 100644 --- a/controllers/SiteController.php +++ b/controllers/SiteController.php @@ -3,16 +3,16 @@ namespace app\controllers; use Yii; -use yii\helpers\Url; use app\models\Log; +use yii\helpers\Url; use app\models\User; use yii\web\Response; use app\helpers\Auth42; -use yii\filters\AccessControl; +use app\models\LoginForm; use yii\web\HttpException; use yii\filters\VerbFilter; -use app\models\LoginForm; use app\models\ContactForm; +use yii\filters\AccessControl; class SiteController extends CommonController { @@ -60,7 +60,6 @@ public function actions() /** * Page after 42 auth. - * * @return string * @throws HttpException * @throws \yii\base\ExitException @@ -100,7 +99,6 @@ public function actionWelcome() /** * Displays homepage. - * * @return string */ public function actionIndex() @@ -108,12 +106,12 @@ public function actionIndex() $title = Yii::t('app', 'Cheatera of UNIT Factory'); $description = Yii::t('app', 'Cheatera - private social network for students of UNIT Factory'); $this->setMeta($title, $description); + return $this->render('index'); } /** * Login action. - * * @return Response|string */ public function actionLogin() @@ -130,6 +128,7 @@ public function actionLogin() return $this->goBack(); } $model->password = ''; + return $this->render('login', [ 'model' => $model, ]); @@ -137,7 +136,6 @@ public function actionLogin() /** * Logout action. - * * @return Response */ public function actionLogout() @@ -149,7 +147,6 @@ public function actionLogout() /** * Displays contact page. - * * @return Response|string */ public function actionContact() @@ -160,6 +157,7 @@ public function actionContact() return $this->refresh(); } + return $this->render('contact', [ 'model' => $model, ]); @@ -167,7 +165,6 @@ public function actionContact() /** * Displays about page. - * * @return string */ public function actionAbout() diff --git a/controllers/TimeSearch.php b/controllers/TimeSearch.php index 7c78cb6..f3c1f8a 100644 --- a/controllers/TimeSearch.php +++ b/controllers/TimeSearch.php @@ -3,8 +3,8 @@ namespace app\controllers; use yii\base\Model; -use yii\data\ActiveDataProvider; use app\models\TimeInCluster; +use yii\data\ActiveDataProvider; /** * TimeSearch represents the model behind the search form of `app\models\TimeInCluster`. @@ -12,7 +12,9 @@ class TimeSearch extends TimeInCluster { public $login; + public $dateStart = null; + public $dateEnd = null; public function __construct($login, array $configs = []) @@ -33,13 +35,13 @@ public function rules() ]; } /** - SELECT *, - SUBSTRING_INDEX(begin_at, ' ', 1) as begin_at_, - TIMEDIFF (end_at, begin_at) as how - FROM `locations` - WHERE end_at > 0 AND xlogin = "apakhomo" - ORDER BY `begin_at_` ASC - */ + * SELECT *, + * SUBSTRING_INDEX(begin_at, ' ', 1) as begin_at_, + * TIMEDIFF (end_at, begin_at) as how + * FROM `locations` + * WHERE end_at > 0 AND xlogin = "apakhomo" + * ORDER BY `begin_at_` ASC + */ /** * {@inheritdoc} */ @@ -79,8 +81,8 @@ public function search($params) 'query' => $query, 'sort' => [ 'defaultOrder' => [ - 'id' => SORT_DESC - ] + 'id' => SORT_DESC, + ], ], 'pagination' => [ 'pageSize' => -1, diff --git a/helpers/Auth42.php b/helpers/Auth42.php index 1f63d96..f915fff 100644 --- a/helpers/Auth42.php +++ b/helpers/Auth42.php @@ -5,10 +5,10 @@ // use RememberUserInfo\RememberUserInfo; use Yii; -use yii\authclient\InvalidResponseException; -use yii\authclient\OAuth2; use yii\helpers\Url; +use yii\authclient\OAuth2; use yii\web\HttpException; +use yii\authclient\InvalidResponseException; class Auth42 extends OAuth2 { @@ -20,7 +20,6 @@ class Auth42 extends OAuth2 /** * Initializes authenticated user attributes. - * * @return array auth user attributes. */ protected function initUserAttributes() @@ -49,9 +48,9 @@ public function buildAuthUrl(array $params = []) } /** - * @param $token + * @param $token * @param array $params - * + * * @return mixed * @throws \yii\authclient\InvalidResponseException */ @@ -90,21 +89,23 @@ public function fetchMe($params) $profileLink = '/pools/'; if (isset($response['cursus_users'])) { if (count($response['cursus_users']) > 1 - && isset($response['login'])) { + && isset($response['login']) + ) { $profileLink = Url::to('/students/' . $response['login']); - } else if (isset($response['login'])) { + } elseif (isset($response['login'])) { $profileLink .= $response['login']; } } else { $profileLink = ''; } Yii::$app->session['profile'] = $profileLink; + return $response; } /** - * @param $authCode - * @param $state + * @param $authCode + * @param $state * @param array $params * * @return \yii\authclient\OAuthToken diff --git a/helpers/FlagsLang.php b/helpers/FlagsLang.php index 8d7d49d..ab4bc5e 100644 --- a/helpers/FlagsLang.php +++ b/helpers/FlagsLang.php @@ -2,12 +2,15 @@ namespace app\helpers; -use klisl\languages\widgets\ListWidget; use yii\helpers\Html; +use klisl\languages\widgets\ListWidget; class FlagsLang extends ListWidget { - protected function createLink($key, $value){ - return Html::a(Html::img('/web/img/flags/'.$value.'.png', ['width' => '24px', 'style' => 'padding:1px']), ['languages/default/index', 'lang' => $value], ['class' => 'language '.$value] ); + protected function createLink($key, $value) + { + return Html::a(Html::img('/web/img/flags/' . $value . '.png', ['width' => '24px', + 'style' => 'padding:1px']), ['languages/default/index', 'lang' => $value], ['class' => 'language ' + . $value]); } -} \ No newline at end of file +} diff --git a/helpers/LogTimeHelper.php b/helpers/LogTimeHelper.php index df74ce3..8975999 100644 --- a/helpers/LogTimeHelper.php +++ b/helpers/LogTimeHelper.php @@ -16,7 +16,7 @@ public function countTime($countTime, $summa = null) strtok($countTime, '.'); $exp = explode(':', $countTime); $result = intval($exp[0]); - $result = $result . '.' . strtok((($exp[1]/60) * 100), '.'); + $result = $result . '.' . strtok((($exp[1] / 60) * 100), '.'); return ($result); } @@ -24,8 +24,9 @@ public function countTime($countTime, $summa = null) $summa = floatval("$summa"); $exp = explode(':', $countTime); $result = intval($exp[0]); - $result = $result . '.' . strtok((($exp[1]/60) * 100), '.'); + $result = $result . '.' . strtok((($exp[1] / 60) * 100), '.'); $forReturn = round(floatval($result) + floatval($summa), 2); + return "$forReturn"; } @@ -50,7 +51,8 @@ public static function fix24(&$data) * getChartJSInfo * * @param Locations[] $models - * @param array $get - GET request + * @param array $get - GET request + * * @return array [$labels, $data, $amount] - info for ChartJS::widget */ public static function getChartJSInfo($models, $get = []) @@ -78,7 +80,7 @@ public static function getChartJSInfo($models, $get = []) while ($tempDate != $first) { $tempDate = date('Y-m-d', strtotime($tempDate . "-1 days")); $arr[$tempDate] = '00.00'; - break ; + break; } foreach ($models as $model) { @@ -89,7 +91,7 @@ public static function getChartJSInfo($models, $get = []) $arr[$tempDate] = '00.00'; } } else { - $tempDate = date('Y-m-d',strtotime($model->date)); + $tempDate = date('Y-m-d', strtotime($model->date)); $count--; } } @@ -98,7 +100,7 @@ public static function getChartJSInfo($models, $get = []) } else { $arr[$model->date] = self::countTime($model->how); } - $tempDate = date('Y-m-d',strtotime($model->date)); + $tempDate = date('Y-m-d', strtotime($model->date)); } foreach ($arr as $key => $value) { diff --git a/helpers/RememberUserInfo/RememberAchievements.php b/helpers/RememberUserInfo/RememberAchievements.php index a9577ed..24eccf0 100644 --- a/helpers/RememberUserInfo/RememberAchievements.php +++ b/helpers/RememberUserInfo/RememberAchievements.php @@ -16,7 +16,7 @@ protected function init() $this->ARcollection = $this->model::find() ->where(['xlogin' => $this->xlogin]) - ->all(); + ->all(); } /** @@ -28,7 +28,7 @@ protected function remember() $achievement['xlogin'] = $this->xlogin; self::setTrueFalse($achievement['visible']); $achievement['nbr_of_success'] = $achievement['nbr_of_success'] ?? 'None'; - self::swapKeysInArr($achievement, [ 'id' => 'aid' ]); + self::swapKeysInArr($achievement, ['id' => 'aid']); $achievement['description'] = htmlentities($achievement['description']); $achievement['visible'] = $achievement['visible'] ?? 'True'; diff --git a/helpers/RememberUserInfo/RememberCurses.php b/helpers/RememberUserInfo/RememberCurses.php index c9ea30e..4a4c5dd 100644 --- a/helpers/RememberUserInfo/RememberCurses.php +++ b/helpers/RememberUserInfo/RememberCurses.php @@ -15,8 +15,8 @@ protected function init() $this->idcol = 'cursus_users_id'; $this->ARcollection = $this->model::find() - ->where([ 'xlogin' => $this->xlogin ]) - ->all(); + ->where(['xlogin' => $this->xlogin]) + ->all(); } /** @@ -31,7 +31,7 @@ protected function remember() self::dateToSqlFormat($curs['begin_at']); self::dateToSqlFormat($curs['created_at']); self::dateToSqlFormat($curs['end_at']); - self::swapKeysInArr($curs, [ 'id' => 'cursus_users_id' ]); + self::swapKeysInArr($curs, ['id' => 'cursus_users_id']); $curs['xlogin'] = $this->xlogin; $curs['xid'] = $this->xid; self::setTrueFalse($curs['has_coalition']); diff --git a/helpers/RememberUserInfo/RememberHelper.php b/helpers/RememberUserInfo/RememberHelper.php index 707db81..58925b8 100644 --- a/helpers/RememberUserInfo/RememberHelper.php +++ b/helpers/RememberUserInfo/RememberHelper.php @@ -10,13 +10,21 @@ abstract class RememberHelper { protected $response; + protected $xlogin; + protected $xid; + protected $idcol = 'id'; + protected $responseSubset; + protected $model; + protected $ARcollection; + protected $bulkInsertArray = []; + protected $bulkUpdateArray = []; /** @@ -33,7 +41,9 @@ abstract protected function remember(); /** * __construct - method will done all work children of the class created for + * * @param array $response - .json given from 42 RESTfull API converted to php array + * * @see app\helpers\RememberUserInfo\RememberUserInfo */ public function __construct(&$response) @@ -49,9 +59,10 @@ public function __construct(&$response) /** * isArraysIdentical - * @param array $a1 - * @param array $a2 - * @param array $arrayKeysToCompare + * + * @param array $a1 + * @param array $a2 + * @param array $arrayKeysToCompare */ public static function isArraysIdentical($a1, $a2, $arrayKeysToCompare) { @@ -60,12 +71,14 @@ public static function isArraysIdentical($a1, $a2, $arrayKeysToCompare) return false; } } + return true; } /** * setTrueFalse - * @param bool reference $varToSetTrueFalse + * + * @param bool reference $varToSetTrueFalse */ public static function setTrueFalse(&$varToSetTrueFalse) { @@ -74,7 +87,8 @@ public static function setTrueFalse(&$varToSetTrueFalse) /** * setNULLtoZero - * @param array reference $arrToSetZeros + * + * @param array reference $arrToSetZeros */ public static function setNULLtoZero(&$arrToSetZeros) { @@ -85,19 +99,21 @@ public static function setNULLtoZero(&$arrToSetZeros) /** * dateToSqlFormat - * @param string $date + * + * @param string $date */ public static function dateToSqlFormat(&$date) { if ($date) { - $date = date('Y-m-d H:i:s', strtotime( $date )); + $date = date('Y-m-d H:i:s', strtotime($date)); } } /** * swapKeysInArr - * @param array reference $arrToChangeKeys - * @param array $keys + * + * @param array reference $arrToChangeKeys + * @param array $keys */ public static function swapKeysInArr(&$arrToChangeKeys, $keys) { @@ -109,8 +125,9 @@ public static function swapKeysInArr(&$arrToChangeKeys, $keys) /** * mergeChildArrByKey - * @param array $arr - * @param mixed $key - $arr's valid key + * + * @param array $arr + * @param mixed $key - $arr's valid key */ public static function mergeChildArrByKey(&$arr, $key) { @@ -120,10 +137,11 @@ public static function mergeChildArrByKey(&$arr, $key) unset($arr[$key]); } - /** * findARbyId - * @param array $id + * + * @param array $id + * * @return mixed|bool */ protected function findARbyId($id) @@ -137,7 +155,6 @@ protected function findARbyId($id) return false; } - /** * batchInsert * @return bool|void @@ -201,7 +218,8 @@ protected function updateDB() /** * saveChangesToDB - * @param array $arrToPutIntoDb + * + * @param array $arrToPutIntoDb */ protected function saveChangesToDB($arrToPutIntoDb) { diff --git a/helpers/RememberUserInfo/RememberProjects.php b/helpers/RememberUserInfo/RememberProjects.php index 51a9ffa..a9f35bf 100644 --- a/helpers/RememberUserInfo/RememberProjects.php +++ b/helpers/RememberUserInfo/RememberProjects.php @@ -16,7 +16,7 @@ protected function init() $this->ARcollection = $this->model::find() ->where(['xlogin' => $this->xlogin]) - ->all(); + ->all(); } /** @@ -31,10 +31,10 @@ protected function remember() } unset($project['marked']); unset($project['marked_at']); - self::swapKeysInArr($project, [ 'id' => 'puid', 'validated?' => 'validated' ]); + self::swapKeysInArr($project, ['id' => 'puid', 'validated?' => 'validated']); self::setTrueFalse($project['validated']); self::mergeChildArrByKey($project, 'project'); - self::swapKeysInArr($project, [ 'id' => 'project_id' ]); + self::swapKeysInArr($project, ['id' => 'project_id']); self::setNULLtoZero($project); $this->saveChangesToDB($project); diff --git a/helpers/RememberUserInfo/RememberSkills.php b/helpers/RememberUserInfo/RememberSkills.php index c6628de..33e967d 100644 --- a/helpers/RememberUserInfo/RememberSkills.php +++ b/helpers/RememberUserInfo/RememberSkills.php @@ -15,8 +15,8 @@ protected function init() $this->idcol = 'skills_id'; $this->ARcollection = $this->model::find() - ->where([ 'xlogin' => $this->xlogin ]) - ->all(); + ->where(['xlogin' => $this->xlogin]) + ->all(); } /** @@ -28,7 +28,7 @@ protected function remember() foreach ($cursus['skills'] as &$skill) { $skill['xlogin'] = $this->xlogin; $skill['cursus_id'] = $cursus['cursus_id']; - self::swapKeysInArr($skill, [ 'id' => 'skills_id', 'name' => 'skills_name', 'level' => 'skills_level' ]); + self::swapKeysInArr($skill, ['id' => 'skills_id', 'name' => 'skills_name', 'level' => 'skills_level']); $skill['skills_name'] = htmlentities($skill['skills_name']); self::saveChangesToDB($skill); diff --git a/helpers/RememberUserInfo/RememberUser.php b/helpers/RememberUserInfo/RememberUser.php index 960202c..7c5376f 100644 --- a/helpers/RememberUserInfo/RememberUser.php +++ b/helpers/RememberUserInfo/RememberUser.php @@ -3,8 +3,8 @@ namespace app\helpers\RememberUserInfo; use Yii; -use app\controllers\LocationsSearch; use app\helpers\LogTimeHelper; +use app\controllers\LocationsSearch; class RememberUser extends RememberHelper { @@ -19,8 +19,8 @@ protected function init() $this->idcol = 'xid'; $this->ARcollection = $this->model::find() - ->where([ 'login' => $this->responseSubset['login'] ]) - ->all(); + ->where(['login' => $this->responseSubset['login']]) + ->all(); } /** @@ -48,7 +48,7 @@ protected function remember() // $this->responseSubset['lastloc'] = $lastloc->begin_at; $this->responseSubset['location'] = $user->location ?? $lastloc->host; - self::swapKeysInArr($this->responseSubset, [ 'id' => 'xid', 'staff?' => 'staff' ]); + self::swapKeysInArr($this->responseSubset, ['id' => 'xid', 'staff?' => 'staff']); self::setTrueFalse($this->responseSubset['staff']); $this->saveChangesToDB($this->responseSubset); diff --git a/helpers/RememberUserInfo/RememberUserInfo.php b/helpers/RememberUserInfo/RememberUserInfo.php index 8b07fa9..35a0542 100644 --- a/helpers/RememberUserInfo/RememberUserInfo.php +++ b/helpers/RememberUserInfo/RememberUserInfo.php @@ -5,7 +5,7 @@ use Yii; /** - * Fills `cursus_users`, `skills`, `projects_users`, `achievements` and `xlogin` tables of cheatera's database + * Fills `cursus_users`, `skills`, `projects_users`, `achievements` and `xlogin` tables of cheatera's database * by response from OAuth2, 42API, when user login */ class RememberUserInfo @@ -13,12 +13,13 @@ class RememberUserInfo /** * rememberAllToDB + * * @param array $response - .json given from 42 RESTfull API converted to php array */ public function __construct($response) { if ($response === null) { - return ; + return; } Yii::$app->session->set('level', $response['cursus_users'][0]['level']); diff --git a/helpers/ThemesHelper.php b/helpers/ThemesHelper.php index 1fff527..0923de9 100644 --- a/helpers/ThemesHelper.php +++ b/helpers/ThemesHelper.php @@ -3,9 +3,10 @@ namespace app\helpers; use Yii; -// use yii\web\Cookie; use yii\helpers\Html; +// use yii\web\Cookie; + /** * ThemesHelper */ @@ -13,7 +14,7 @@ class ThemesHelper { public const ACTION_NAME = 'change-theme'; public const NAME = 'theme'; - + static private $themes = [ 'cerulean' => 'Cerulean', 'cosmo' => 'Cosmo', @@ -33,12 +34,11 @@ class ThemesHelper 'superhero' => 'Superhero', 'united' => 'United', 'yeti' => 'Yeti', - + 'default' => 'cosmo', 'dark' => 'superhero', ]; - private static function setCookie($value) { // return new Cookie([ @@ -53,7 +53,6 @@ private static function setCookie($value) /** * checkThemeCookie - get cookies Object for all the class * sets, if necessary, static::NAME cookie to static::$themes['default'] value. - * * @return Object Cookies Object */ private static function checkThemeCookie() @@ -70,6 +69,7 @@ private static function checkThemeCookie() if (!isset($_COOKIE[static::NAME])) { ThemesHelper::setDefault(); + return static::$themes['default']; } @@ -79,17 +79,16 @@ private static function checkThemeCookie() /** * getThemesSwitchetHtml - get html code for theme switcher to input to any place on site * - * @param Object $theme Initialized ThemeHelper, themself, Object + * @param Object $theme Initialized ThemeHelper, themself, Object * * @return String Generated Html for current ThemeHelper Object */ public static function getThemesSwitcherHtml() { - return Html::a( Yii::t('app', (static::isDefault() ? 'Set Dark Theme' : 'Set Light Theme')) - , '/' . static::ACTION_NAME ); + return Html::a(Yii::t('app', (static::isDefault() ? 'Set Dark Theme' : 'Set Light Theme')) + , '/' . static::ACTION_NAME); } - public static function getCurrent() { return static::checkThemeCookie(); //, static::getDefault()); @@ -117,12 +116,12 @@ public static function isDark() public static function setDark() { - static::setCookie( static::$themes['dark'] ); + static::setCookie(static::$themes['dark']); } public static function setDefault() { - static::setCookie( static::$themes['default'] ); + static::setCookie(static::$themes['default']); } } diff --git a/helpers/ViewHelper.php b/helpers/ViewHelper.php index 5d00e67..d5bf8c0 100644 --- a/helpers/ViewHelper.php +++ b/helpers/ViewHelper.php @@ -8,11 +8,11 @@ namespace app\helpers; -use app\models\UpdatedDb; -use DateTime; use Yii; +use DateTime; use yii\helpers\Url; use yii\helpers\Html; +use app\models\UpdatedDb; class ViewHelper { @@ -20,11 +20,12 @@ class ViewHelper * Study progress in percent * * @param $level + * * @return float|int */ public static function getProgress($level) { - return $level < 21 ? $level/(21/100): 100 ; + return $level < 21 ? $level / (21 / 100) : 100; } /** @@ -32,11 +33,12 @@ public static function getProgress($level) * * @param $mark * @param $course + * * @return float|int */ public static function getProgressProject($mark, $course) { - return $mark > (($course == 1) ? 49 : 24) ? $mark/(125/100) : 100; + return $mark > (($course == 1) ? 49 : 24) ? $mark / (125 / 100) : 100; } /** @@ -44,6 +46,7 @@ public static function getProgressProject($mark, $course) * * @param $mark * @param $course + * * @return float|int */ public static function getProgressProjectColor($mark, $course, $status) @@ -55,6 +58,7 @@ public static function getProgressProjectColor($mark, $course, $status) if ($mark > $min) { return 'success'; } + return $status === 'finished' ? 'danger' : 'warning'; } @@ -62,16 +66,21 @@ public static function getProgressProjectColor($mark, $course, $status) * Get class by level * * @param $level + * * @return string */ public static function getLevelColorClass($level) { - if ($level >= 16) + if ($level >= 16) { return "danger"; - if ($level >= 14) + } + if ($level >= 14) { return "warning"; - if ($level >= 7) + } + if ($level >= 7) { return "info"; + } + return "success"; } @@ -80,45 +89,47 @@ public static function getLevelColorClass($level) * * @param $login * @param $course + * * @return string */ public static function getLinkWithHover($login, $course) { - return Html::img( + return Html::img( Url::to( "https://cdn.intra.42.fr/users/$login.jpg"), - [ - 'id' => "ah-$login", - 'style' => 'position: absolute; left: 35px; top: 35px; width: 180px; display: none; z-index: 1111;', - ] + [ + 'id' => "ah-$login", + 'style' => 'position: absolute; left: 35px; top: 35px; width: 180px; display: none; z-index: 1111;', + ] ) - . Html::a( - Html::img( - Url::to( + . Html::a( + Html::img( + Url::to( '/web/img/profile.jpg'), - [ - 'width' => '20px', - 'id' => 'ah', - 'name' => $login, - 'data-placement' => 'top', - 'data-toggle' => 'tooltip', - 'title' => Yii::t('app', 'Show profile ') . $login, - 'data-original-title' => Yii::t('app', 'Show profile ') . $login - ] + [ + 'width' => '20px', + 'id' => 'ah', + 'name' => $login, + 'data-placement' => 'top', + 'data-toggle' => 'tooltip', + 'title' => Yii::t('app', 'Show profile ') . $login, + 'data-original-title' => Yii::t('app', 'Show profile ') . $login, + ] ), - Url::to( - '/' . Yii::$app->language . "/$course/$login"), + Url::to( + '/' . Yii::$app->language . "/$course/$login"), [ 'data-pjax' => '0', ] - ); + ); } /** * Convert time to human format * - * @param $datetime + * @param $datetime * @param bool $full + * * @return string * @throws \Exception */ @@ -131,7 +142,7 @@ public static function getHumanTime($datetime, $full = false) $diff->w = floor($diff->d / 7); $diff->d -= $diff->w * 7; - $string = array( + $string = [ 'y' => 'year', 'm' => 'month', 'w' => 'week', @@ -139,7 +150,7 @@ public static function getHumanTime($datetime, $full = false) 'h' => 'hour', 'i' => 'minute', 's' => 'second', - ); + ]; foreach ($string as $k => &$v) { if ($diff->$k) { $v = $diff->$k . ' ' . $v . ($diff->$k > 1 ? 's' : ''); @@ -147,8 +158,11 @@ public static function getHumanTime($datetime, $full = false) unset($string[$k]); } } - if (!$full) $string = array_slice($string, 0, 1); + if (!$full) { + $string = array_slice($string, 0, 1); + } $string = array_slice($string, 0, 1); + return $string ? implode(', ', $string) . ' ago' : 'no data'; } @@ -159,27 +173,49 @@ public static function getHumanTime($datetime, $full = false) public static function getLastUpdate() { $result = []; - $record = UpdatedDb::find()->where(['subject' => 'locations'])->orderBy(['updated_at' => SORT_DESC])->limit('1')->one(); - $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; - $record = UpdatedDb::find()->where(['subject' => 'users and projects'])->orderBy(['updated_at' => SORT_DESC])->limit('1')->one(); - $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; - $record = UpdatedDb::find()->where(['subject' => 'cheating'])->orderBy(['updated_at' => SORT_DESC])->limit('1')->one(); - $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; - $record = UpdatedDb::find()->where(['subject' => 'time at cluster'])->orderBy(['updated_at' => SORT_DESC])->limit('1')->one(); - $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; + $record = + UpdatedDb::find() + ->where(['subject' => 'locations']) + ->orderBy(['updated_at' => SORT_DESC]) + ->limit('1') + ->one(); + $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; + $record = + UpdatedDb::find() + ->where(['subject' => 'users and projects']) + ->orderBy(['updated_at' => SORT_DESC]) + ->limit('1') + ->one(); + $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; + $record = + UpdatedDb::find() + ->where(['subject' => 'cheating']) + ->orderBy(['updated_at' => SORT_DESC]) + ->limit('1') + ->one(); + $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; + $record = + UpdatedDb::find() + ->where(['subject' => 'time at cluster']) + ->orderBy(['updated_at' => SORT_DESC]) + ->limit('1') + ->one(); + $result[] = ['label' => 'Update ' . $record->subject . ' ' . self::getHumanTime($record->updated_at) . '.']; + return $result; } /** * @param $model + * * @return string */ public static function friendOnline($model) { - if($model->lastloc > 0){ + if ($model->lastloc > 0) { return ''; } else { return ThemesHelper::isDark() ? 'style="background-color: #1f601f;"' : 'style="background-color: #e5ffe5;"'; } } -} \ No newline at end of file +} diff --git a/helpers/helpers.php b/helpers/helpers.php index c47756b..852de2e 100644 --- a/helpers/helpers.php +++ b/helpers/helpers.php @@ -1,20 +1,21 @@ - + <?= Html::encode($this->title) ?> head() ?> - beginBody() ?> - - endBody() ?> +beginBody() ?> + +endBody() ?> endPage() ?> diff --git a/models/Achievements.php b/models/Achievements.php index 3975331..b46bcc3 100644 --- a/models/Achievements.php +++ b/models/Achievements.php @@ -6,11 +6,10 @@ /** * This is the model class for table "achievements". - * - * @property int $id + * @property int $id * @property string $xlogin * @property string $description - * @property int $aid + * @property int $aid * @property string $image * @property string $kind * @property string $name diff --git a/models/Calculator.php b/models/Calculator.php index ad4b5e8..2e59a6d 100644 --- a/models/Calculator.php +++ b/models/Calculator.php @@ -7,15 +7,13 @@ /** * Calculator is the model behind the Calculator controller. - * - * @property array $_expr_per_lvl - read-only array with coeficents to each level point earnings + * @property array $_expr_per_lvl - read-only array with coeficents to each level point earnings * @property array $_expr_per_tier - read-only array with coeficents to each level of complexity - * @property float $result - final result of the calculation, if 0 it does not exists - * @property float $lvlstart - initial student's - * @property float $tier - complexity level of the project - * @property float $finalmark - project's final mark achived by the student + * @property float $result - final result of the calculation, if 0 it does not exists + * @property float $lvlstart - initial student's + * @property float $tier - complexity level of the project + * @property float $finalmark - project's final mark achived by the student */ - class Calculator extends Model { static private $_expr_per_lvl = [ @@ -50,8 +48,9 @@ class Calculator extends Model 255564.2572599762, 291413.9287045184, 332152.19170968, - -1 + -1, ]; + static private $_expr_per_tier = [ 2.2, 8.8330, @@ -60,15 +59,18 @@ class Calculator extends Model 56.10, 79.2, 93.50, - 132 + 132, ]; + private $lvl_max; public $result; + public $lvlstart; + public $tier; - public $finalmark; + public $finalmark; function __construct() { @@ -86,7 +88,7 @@ public function rules() return [ [['lvlstart', 'finalmark'], 'required'], ['lvlstart', 'number', 'min' => 0, 'max' => $this->lvl_max], - ['finalmark', 'number', 'min' => 50, 'max' => 125] + ['finalmark', 'number', 'min' => 50, 'max' => 125], ]; } @@ -103,7 +105,7 @@ public function attributeLabels() public function getTier() { - return [ 'T0', 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7' ]; + return ['T0', 'T1', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7']; } public function resetToDefault() @@ -120,13 +122,10 @@ public function resetToDefault() return $this->lvlstart; } - - /** - * Do all magic ie counts the particular lvl up value from parameters. - * - * @return float lvl up value for given args - */ + * Do all magic ie counts the particular lvl up value from parameters. + * @return float lvl up value for given args + */ public function getMark() { // $tier_exps = array("0" => 2.2); @@ -143,14 +142,13 @@ public function getMark() $eplvl = self::$_expr_per_lvl; $expr_raising = self::$_expr_per_tier[$this->tier] * $this->finalmark - + $eplvl[$lvlstart_int] - + ($eplvl[$lvlstart_int + 1] - $eplvl[$lvlstart_int]) * $fract_part; + + $eplvl[$lvlstart_int] + + ($eplvl[$lvlstart_int + 1] - $eplvl[$lvlstart_int]) * $fract_part; - for($i = 0; $i < $this->lvl_max; $i++) - { + for ($i = 0; $i < $this->lvl_max; $i++) { if ($eplvl[$i] > $expr_raising) { $i--; - break ; + break; } } @@ -163,6 +161,7 @@ public function getMark() } $this->result = round($res, 2); + return $this->result; } } diff --git a/models/Cams.php b/models/Cams.php index 1a2fce0..9d4af29 100644 --- a/models/Cams.php +++ b/models/Cams.php @@ -6,7 +6,6 @@ /** * This is the model class for table "cams". - * * @property string $area_name * @property string $cam_address */ diff --git a/models/ContactForm.php b/models/ContactForm.php index 0b13cb0..c8fc277 100644 --- a/models/ContactForm.php +++ b/models/ContactForm.php @@ -11,11 +11,14 @@ class ContactForm extends Model { public $name; + public $email; + public $subject; + public $body; - public $verifyCode; + public $verifyCode; /** * @return array the validation rules. @@ -44,7 +47,9 @@ public function attributeLabels() /** * Sends an email to the specified email address using the information collected by this model. + * * @param string $email the target email address + * * @return bool whether the model passes validation */ public function contact($email) @@ -59,6 +64,7 @@ public function contact($email) return true; } + return false; } } diff --git a/models/Correct.php b/models/Correct.php index 22adc36..8beb551 100644 --- a/models/Correct.php +++ b/models/Correct.php @@ -6,10 +6,9 @@ /** * This is the model class for table "correction_history". - * - * @property int $id + * @property int $id * @property string $xlogin - * @property int $corrections + * @property int $corrections * @property double $level * @property string $date */ diff --git a/models/CorrectionHistory.php b/models/CorrectionHistory.php index 6a40322..9e85d17 100644 --- a/models/CorrectionHistory.php +++ b/models/CorrectionHistory.php @@ -6,10 +6,9 @@ /** * This is the model class for table "correction_history". - * - * @property int $id + * @property int $id * @property string $xlogin - * @property int $corrections + * @property int $corrections * @property double $level * @property string $date */ diff --git a/models/CorrectionLog.php b/models/CorrectionLog.php index 024f8f2..acfa6e5 100644 --- a/models/CorrectionLog.php +++ b/models/CorrectionLog.php @@ -6,9 +6,8 @@ /** * This is the model class for table "correction_log". - * - * @property int $id - * @property int $count + * @property int $id + * @property int $count * @property string $date */ class CorrectionLog extends \yii\db\ActiveRecord diff --git a/models/Curses.php b/models/Curses.php index 89a7d81..9fb7e47 100644 --- a/models/Curses.php +++ b/models/Curses.php @@ -6,10 +6,9 @@ /** * This is the model class for table "cursus_users". - * - * @property int $id + * @property int $id * @property string $xlogin - * @property int $cursus_id + * @property int $cursus_id * @property string $begin_at * @property string $created_at * @property string $name @@ -17,9 +16,9 @@ * @property string $end_at * @property string $grade * @property string $has_coalition - * @property int $cursus_users_id + * @property int $cursus_users_id * @property double $level - * @property int $xid + * @property int $xid */ class Curses extends \yii\db\ActiveRecord { diff --git a/models/Friend.php b/models/Friend.php index f12efca..0a51da5 100644 --- a/models/Friend.php +++ b/models/Friend.php @@ -6,28 +6,40 @@ /** * This is the model class for table "friend". - * - * @property int $id + * @property int $id * @property string $mylogin * @property string $xlogin - * @property int $status + * @property int $status * @property string $course */ class Friend extends \yii\db\ActiveRecord { public $login; + public $displayname; + public $phone; + public $image_url; + public $level; + public $correction_point; + public $pool_year; + public $pool_month; + public $location; + public $lastloc; + public $wallet; + public $howach; + public $hours; + /** * {@inheritdoc} */ diff --git a/models/Locations.php b/models/Locations.php index a8b4665..19c91c3 100644 --- a/models/Locations.php +++ b/models/Locations.php @@ -6,21 +6,23 @@ /** * This is the model class for table "locations". - * - * @property int $id - * @property int $lid - * @property int $campus_id + * @property int $id + * @property int $lid + * @property int $campus_id * @property string $host * @property string $begin_at * @property string $end_at * @property string $xlogin - * @property int $user_id + * @property int $user_id */ class Locations extends \yii\db\ActiveRecord { public $login; + public $dateStart = null; + public $dateEnd = null; + /** * {@inheritdoc} */ diff --git a/models/Log.php b/models/Log.php index 13b076c..513c32d 100644 --- a/models/Log.php +++ b/models/Log.php @@ -2,12 +2,9 @@ namespace app\models; -use Yii; - /** * This is the model class for table "log". - * - * @property int $id + * @property int $id * @property string $xlogin * @property string $auth_date * @property string $ip diff --git a/models/LoginForm.php b/models/LoginForm.php index cc6af26..c75958b 100644 --- a/models/LoginForm.php +++ b/models/LoginForm.php @@ -7,19 +7,18 @@ /** * LoginForm is the model behind the login form. - * * @property User|null $user This property is read-only. - * */ class LoginForm extends Model { public $username; + public $password; + public $rememberMe = true; private $_user = false; - /** * @return array the validation rules. */ @@ -40,7 +39,7 @@ public function rules() * This method serves as the inline validation for password. * * @param string $attribute the attribute currently being validated - * @param array $params the additional name-value pairs given in the rule + * @param array $params the additional name-value pairs given in the rule */ public function validatePassword($attribute, $params) { @@ -60,14 +59,14 @@ public function validatePassword($attribute, $params) public function login() { if ($this->validate()) { - return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600*24*30 : 0); + return Yii::$app->user->login($this->getUser(), $this->rememberMe ? 3600 * 24 * 30 : 0); } + return false; } /** * Finds user by [[username]] - * * @return User|null */ public function getUser() diff --git a/models/Minus42.php b/models/Minus42.php index c6466b2..54d92d7 100644 --- a/models/Minus42.php +++ b/models/Minus42.php @@ -6,17 +6,19 @@ /** * This is the model class for table "m42". - * - * @property int $id + * @property int $id * @property string $xlogin - * @property int $puid + * @property int $puid * @property string $updated_at */ class Minus42 extends \yii\db\ActiveRecord { public $pool_year; + public $pool_month; + public $name; + public $slug; /** diff --git a/models/PoolsList.php b/models/PoolsList.php index b7bb891..3e63e98 100644 --- a/models/PoolsList.php +++ b/models/PoolsList.php @@ -6,8 +6,7 @@ /** * This is the model class for table "pools". - * - * @property int $id + * @property int $id * @property string $year * @property string $month * @property string $begin_at diff --git a/models/Projects.php b/models/Projects.php index 375dedc..1a57b30 100644 --- a/models/Projects.php +++ b/models/Projects.php @@ -6,7 +6,6 @@ /** * This is the model class for table "projects_cache". - * * @property int $id * @property string $name * @property string $slug @@ -22,7 +21,7 @@ */ class Projects extends \yii\db\ActiveRecord { -// protected $course; + // protected $course; /** * {@inheritdoc} @@ -38,10 +37,12 @@ public static function tableName() public function rules() { return [ - [['name', 'slug', 'avgFinalMark', 'validated', 'finished', 'failed', 'wfc', 'inprogress', 'sag', 'cg'], 'required'], + [['name', 'slug', 'avgFinalMark', 'validated', 'finished', 'failed', 'wfc', 'inprogress', 'sag', 'cg'], + 'required'], [['slug'], 'string'], [['avgFinalMark'], 'number'], - [['validated', 'finished', 'failed', 'wfc', 'inprogress', 'sag', 'cg', 'project_id', 'parent_id', 'course'], 'integer'], + [['validated', 'finished', 'failed', 'wfc', 'inprogress', 'sag', 'cg', 'project_id', 'parent_id', 'course'], + 'integer'], [['name', 'course'], 'string', 'max' => 255], ]; } diff --git a/models/ProjectsAll.php b/models/ProjectsAll.php index aa652f5..0de78ef 100644 --- a/models/ProjectsAll.php +++ b/models/ProjectsAll.php @@ -6,7 +6,6 @@ /** * This is the model class for table "projects_users". - * * @property int $id * @property string $xlogin * @property int $current_team_id @@ -26,19 +25,27 @@ class ProjectsAll extends \yii\db\ActiveRecord { public $pool_year; + public $pool_month; public $fmark; + public $finished; + public $failed; + public $wfc; + public $inprogress; + public $sag; + public $cg; public $location; public $lastloc; + /** * {@inheritdoc} */ @@ -53,7 +60,8 @@ public static function tableName() public function rules() { return [ - [['current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], 'integer'], + [['current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], + 'integer'], [['xlogin'], 'string', 'max' => 12], [['name', 'slug'], 'string', 'max' => 255], [['status', 'validated'], 'string', 'max' => 25], diff --git a/models/ProjectsLogin.php b/models/ProjectsLogin.php index 7a8117f..70f17b7 100644 --- a/models/ProjectsLogin.php +++ b/models/ProjectsLogin.php @@ -6,7 +6,6 @@ /** * This is the model class for table "projects_users". - * */ class ProjectsLogin extends \yii\db\ActiveRecord { @@ -24,7 +23,8 @@ public static function tableName() public function rules() { return [ - [['current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], 'integer'], + [['current_team_id', 'cursus_ids', 'final_mark', 'puid', 'occurrence', 'project_id', 'parent_id'], + 'integer'], [['xlogin'], 'string', 'max' => 12], [['name', 'slug'], 'string', 'max' => 255], [['status', 'validated'], 'string', 'max' => 25], diff --git a/models/Show.php b/models/Show.php index cc50ed3..279c8be 100644 --- a/models/Show.php +++ b/models/Show.php @@ -6,7 +6,6 @@ /** * This is the model class for table "xlogins". - * * @property int $id * @property int $correction_point * @property string $displayname @@ -60,7 +59,9 @@ public function rules() [['kick', 'lastloc'], 'required'], [['lastloc'], 'safe'], [['hours', 'lasthours'], 'number'], - [['displayname', 'email', 'first_name', 'last_name', 'location', 'login', 'phone', 'pool_month', 'staff'], 'string', 'max' => 255], + [['displayname', 'email', 'first_name', 'last_name', 'location', 'login', 'phone', 'pool_month', 'staff'], + 'string', + 'max' => 255], ]; } @@ -94,7 +95,7 @@ public function attributeLabels() 'visible' => Yii::t('app', 'Visible'), 'level' => Yii::t('app', 'Level'), 'link' => Yii::t('app', ''), - 'grade' => Yii::t('app', 'grade') + 'grade' => Yii::t('app', 'grade'), ]; } } diff --git a/models/Skills.php b/models/Skills.php index 3c58bca..58a1370 100644 --- a/models/Skills.php +++ b/models/Skills.php @@ -6,11 +6,10 @@ /** * This is the model class for table "skills". - * - * @property int $id + * @property int $id * @property string $xlogin - * @property int $cursus_id - * @property int $skills_id + * @property int $cursus_id + * @property int $skills_id * @property double $skills_level * @property string $skills_name */ diff --git a/models/TimeInCluster.php b/models/TimeInCluster.php index 82d5544..097abf9 100644 --- a/models/TimeInCluster.php +++ b/models/TimeInCluster.php @@ -6,8 +6,7 @@ /** * This is the model class for table "time_in_cluster". - * - * @property int $id + * @property int $id * @property string $xlogin * @property string $oneday * @property double $timer diff --git a/models/UpdatedDb.php b/models/UpdatedDb.php index d8a4d45..140fcd2 100644 --- a/models/UpdatedDb.php +++ b/models/UpdatedDb.php @@ -6,8 +6,7 @@ /** * This is the model class for table "updated_db". - * - * @property int $id + * @property int $id * @property string $subject * @property string $updated_at */ diff --git a/models/User.php b/models/User.php index b6b8691..0f2cc3d 100644 --- a/models/User.php +++ b/models/User.php @@ -31,6 +31,7 @@ public static function findIdentityByAccessToken($token, $type = null) * Finds user by username * * @param string $xlogin + * * @return static|null */ public static function findByUsername($xlogin) diff --git a/requirements.php b/requirements.php index 91a0fb0..6c10082 100644 --- a/requirements.php +++ b/requirements.php @@ -1,10 +1,8 @@ Error\n\n" - . "

The path to yii framework seems to be incorrect.

\n" - . '

You need to install Yii framework via composer or adjust the framework path in file ' . basename(__FILE__) . ".

\n" - . '

Please refer to the README on how to install Yii.

\n"; + . "

The path to yii framework seems to be incorrect.

\n" + . '

You need to install Yii framework via composer or adjust the framework path in file ' + . basename(__FILE__) + . ".

\n" + . '

Please refer to the README on how to install Yii.

\n"; if (!empty($_SERVER['argv'])) { // do not print HTML when used in console mode @@ -46,7 +50,9 @@ require_once($frameworkPath . '/requirements/YiiRequirementChecker.php'); $requirementsChecker = new YiiRequirementChecker(); -$gdMemo = $imagickMemo = 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; +$gdMemo = +$imagickMemo = + 'Either GD PHP extension with FreeType support or ImageMagick PHP extension with PNG support is required for image CAPTCHA.'; $gdOK = $imagickOK = false; if (extension_loaded('imagick')) { @@ -71,90 +77,92 @@ /** * Adjust requirements according to your application specifics. */ -$requirements = array( +$requirements = [ // Database : - array( + [ 'name' => 'PDO extension', 'mandatory' => true, 'condition' => extension_loaded('pdo'), 'by' => 'All DB-related classes', - ), - array( + ], + [ 'name' => 'PDO SQLite extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_sqlite'), 'by' => 'All DB-related classes', 'memo' => 'Required for SQLite database.', - ), - array( + ], + [ 'name' => 'PDO MySQL extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_mysql'), 'by' => 'All DB-related classes', 'memo' => 'Required for MySQL database.', - ), - array( + ], + [ 'name' => 'PDO PostgreSQL extension', 'mandatory' => false, 'condition' => extension_loaded('pdo_pgsql'), 'by' => 'All DB-related classes', 'memo' => 'Required for PostgreSQL database.', - ), + ], // Cache : - array( + [ 'name' => 'Memcache extension', 'mandatory' => false, 'condition' => extension_loaded('memcache') || extension_loaded('memcached'), 'by' => 'MemCache', - 'memo' => extension_loaded('memcached') ? 'To use memcached set MemCache::useMemcached to true.' : '' - ), + 'memo' => extension_loaded('memcached') + ? 'To use memcached set MemCache::useMemcached to true.' + : '', + ], // CAPTCHA: - array( + [ 'name' => 'GD PHP extension with FreeType support', 'mandatory' => false, 'condition' => $gdOK, 'by' => 'Captcha', 'memo' => $gdMemo, - ), - array( + ], + [ 'name' => 'ImageMagick PHP extension with PNG support', 'mandatory' => false, 'condition' => $imagickOK, 'by' => 'Captcha', 'memo' => $imagickMemo, - ), + ], // PHP ini : - 'phpExposePhp' => array( + 'phpExposePhp' => [ 'name' => 'Expose PHP', 'mandatory' => false, 'condition' => $requirementsChecker->checkPhpIniOff("expose_php"), 'by' => 'Security reasons', 'memo' => '"expose_php" should be disabled at php.ini', - ), - 'phpAllowUrlInclude' => array( + ], + 'phpAllowUrlInclude' => [ 'name' => 'PHP allow url include', 'mandatory' => false, 'condition' => $requirementsChecker->checkPhpIniOff("allow_url_include"), 'by' => 'Security reasons', 'memo' => '"allow_url_include" should be disabled at php.ini', - ), - 'phpSmtp' => array( + ], + 'phpSmtp' => [ 'name' => 'PHP mail SMTP', 'mandatory' => false, 'condition' => strlen(ini_get('SMTP')) > 0, 'by' => 'Email sending', 'memo' => 'PHP mail SMTP server required', - ), -); + ], +]; // OPcache check if (!version_compare(phpversion(), '5.5', '>=')) { - $requirements[] = array( + $requirements[] = [ 'name' => 'APC extension', 'mandatory' => false, 'condition' => extension_loaded('apc'), 'by' => 'ApcCache', - ); + ]; } $requirementsChecker->checkYii()->check($requirements)->render(); diff --git a/tests/_bootstrap.php b/tests/_bootstrap.php index 131da42..7267c28 100644 --- a/tests/_bootstrap.php +++ b/tests/_bootstrap.php @@ -3,4 +3,4 @@ defined('YII_DEBUG') or define('YII_DEBUG', true); require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; -require __DIR__ .'/../vendor/autoload.php'; \ No newline at end of file +require __DIR__ . '/../vendor/autoload.php'; diff --git a/tests/_support/AcceptanceTester.php b/tests/_support/AcceptanceTester.php index 4c7dcbb..086585a 100644 --- a/tests/_support/AcceptanceTester.php +++ b/tests/_support/AcceptanceTester.php @@ -12,15 +12,14 @@ * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) - * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) - * + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) * @SuppressWarnings(PHPMD) -*/ + */ class AcceptanceTester extends \Codeception\Actor { use _generated\AcceptanceTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/tests/_support/FunctionalTester.php b/tests/_support/FunctionalTester.php index db2ce28..54445bc 100644 --- a/tests/_support/FunctionalTester.php +++ b/tests/_support/FunctionalTester.php @@ -12,10 +12,9 @@ * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) - * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) - * + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) * @SuppressWarnings(PHPMD) -*/ + */ class FunctionalTester extends \Codeception\Actor { use _generated\FunctionalTesterActions; diff --git a/tests/_support/UnitTester.php b/tests/_support/UnitTester.php index 2835357..481c10e 100644 --- a/tests/_support/UnitTester.php +++ b/tests/_support/UnitTester.php @@ -12,15 +12,14 @@ * @method void am($role) * @method void lookForwardTo($achieveValue) * @method void comment($description) - * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = NULL) - * + * @method \Codeception\Lib\Friend haveFriend($name, $actorClass = null) * @SuppressWarnings(PHPMD) -*/ + */ class UnitTester extends \Codeception\Actor { use _generated\UnitTesterActions; - /** - * Define custom actions here - */ + /** + * Define custom actions here + */ } diff --git a/tests/acceptance/ContactCest.php b/tests/acceptance/ContactCest.php index 90f9848..ac74fdb 100644 --- a/tests/acceptance/ContactCest.php +++ b/tests/acceptance/ContactCest.php @@ -8,7 +8,7 @@ public function _before(\AcceptanceTester $I) { $I->amOnPage(Url::toRoute('/site/contact')); } - + public function contactPageWorks(AcceptanceTester $I) { $I->wantTo('ensure that contact page works'); @@ -25,7 +25,7 @@ public function contactFormCanBeSubmitted(AcceptanceTester $I) $I->fillField('#contactform-verifycode', 'testme'); $I->click('contact-button'); - + $I->wait(2); // wait for button to be clicked $I->dontSeeElement('#contact-form'); diff --git a/tests/acceptance/HomeCest.php b/tests/acceptance/HomeCest.php index e65df16..98fb6b9 100644 --- a/tests/acceptance/HomeCest.php +++ b/tests/acceptance/HomeCest.php @@ -6,13 +6,13 @@ class HomeCest { public function ensureThatHomePageWorks(AcceptanceTester $I) { - $I->amOnPage(Url::toRoute('/site/index')); + $I->amOnPage(Url::toRoute('/site/index')); $I->see('My Company'); - + $I->seeLink('About'); $I->click('About'); $I->wait(2); // wait for page to be opened - + $I->see('This is the About page.'); } } diff --git a/tests/functional/ContactFormCest.php b/tests/functional/ContactFormCest.php index ad81678..22c271d 100644 --- a/tests/functional/ContactFormCest.php +++ b/tests/functional/ContactFormCest.php @@ -1,6 +1,6 @@ see('Contact', 'h1'); + $I->see('Contact', 'h1'); } public function submitEmptyForm(\FunctionalTester $I) @@ -38,7 +38,7 @@ public function submitFormWithIncorrectEmail(\FunctionalTester $I) $I->see('Email is not a valid email address.'); $I->dontSee('Subject cannot be blank', '.help-inline'); $I->dontSee('Body cannot be blank', '.help-inline'); - $I->dontSee('The verification code is incorrect', '.help-inline'); + $I->dontSee('The verification code is incorrect', '.help-inline'); } public function submitFormSuccessfully(\FunctionalTester $I) @@ -52,6 +52,6 @@ public function submitFormSuccessfully(\FunctionalTester $I) ]); $I->seeEmailIsSent(); $I->dontSeeElement('#contact-form'); - $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); + $I->see('Thank you for contacting us. We will respond to you as soon as possible.'); } } diff --git a/tests/functional/LoginFormCest.php b/tests/functional/LoginFormCest.php index 7a83a27..a1545a7 100644 --- a/tests/functional/LoginFormCest.php +++ b/tests/functional/LoginFormCest.php @@ -10,7 +10,6 @@ public function _before(\FunctionalTester $I) public function openLoginPage(\FunctionalTester $I) { $I->see('Login', 'h1'); - } // demonstrates `amLoggedInAs` method @@ -54,6 +53,6 @@ public function loginSuccessfully(\FunctionalTester $I) 'LoginForm[password]' => 'admin', ]); $I->see('Logout (admin)'); - $I->dontSeeElement('form#login-form'); + $I->dontSeeElement('form#login-form'); } -} \ No newline at end of file +} diff --git a/tests/unit/models/ContactFormTest.php b/tests/unit/models/ContactFormTest.php index 3848897..2b3fdfe 100644 --- a/tests/unit/models/ContactFormTest.php +++ b/tests/unit/models/ContactFormTest.php @@ -5,6 +5,7 @@ class ContactFormTest extends \Codeception\Test\Unit { private $model; + /** * @var \UnitTester */ diff --git a/tests/unit/models/UserTest.php b/tests/unit/models/UserTest.php index fc26450..f59d5e5 100644 --- a/tests/unit/models/UserTest.php +++ b/tests/unit/models/UserTest.php @@ -19,7 +19,7 @@ public function testFindUserByAccessToken() expect_that($user = User::findIdentityByAccessToken('100-token')); expect($user->username)->equals('admin'); - expect_not(User::findIdentityByAccessToken('non-existing')); + expect_not(User::findIdentityByAccessToken('non-existing')); } public function testFindUserByUsername() @@ -38,7 +38,7 @@ public function testValidateUser($user) expect_not($user->validateAuthKey('test102key')); expect_that($user->validatePassword('admin')); - expect_not($user->validatePassword('123456')); + expect_not($user->validatePassword('123456')); } } diff --git a/views/calculator/index.php b/views/calculator/index.php index e6de72c..a63222b 100644 --- a/views/calculator/index.php +++ b/views/calculator/index.php @@ -1,7 +1,7 @@ title) ?> 'calculator']); ?> - ['calculator/form-submission'], - 'options' => ['data' => ['pjax' => true]], - 'id' => 'calculator-form', - 'layout' => 'horizontal', - 'fieldConfig' => [ - 'template' => "
{label}
{input}
{error}
", - 'labelOptions' => ['class' => 'control-label'], - ], - ]); ?> + ['calculator/form-submission'], + 'options' => ['data' => ['pjax' => true]], + 'id' => 'calculator-form', + 'layout' => 'horizontal', + 'fieldConfig' => [ + 'template' => "
{label}
{input}
{error}
", + 'labelOptions' => ['class' => 'control-label'], + ], + ]); ?> -
- 'btn btn-lg btn-primary', 'name' => 'resetToDefault']) ?> -

- field($model, 'lvlstart') - ->label(Yii::t('app', 'Enter level')) - ->input('number', ['placeholder' => Yii::t('app', 'Enter number')]) - ->textInput() - ?> +
+
+ 'btn btn-lg btn-primary', + 'name' => 'resetToDefault']) ?> +
+
+ field($model, 'lvlstart') + ->label(Yii::t('app', 'Enter level')) + ->input('number', ['placeholder' => Yii::t('app', 'Enter number')]) + ->textInput() + ?> - field($model, 'finalmark') - ->label(Yii::t('app', 'Enter mark')) - ->input('number', ['placeholder' => Yii::t('app', 'Enter number')]) - ->textInput() - ?> + field($model, 'finalmark') + ->label(Yii::t('app', 'Enter mark')) + ->input('number', ['placeholder' => Yii::t('app', 'Enter number')]) + ->textInput() + ?> -
- getTier() as $k => $v) { - echo Html::submitButton($v, ['class' => 'btn btn-primary tier-key', 'name' => $k, 'style' => 'margin: 3px']); - } - ?> -

result ? $model->result : '' ?>

-
+
+ getTier() as $k => $v) { + echo Html::submitButton($v, ['class' => 'btn btn-primary tier-key', + 'name' => $k, + 'style' => 'margin: 3px']); + } + ?> +

result ? $model->result : '' ?>

+
- +
- 0.01 till 0.2 (magic Intra, magic!)', - Html::a('vpaladii', Url::toRoute('students/vpaladii', true)) ) + 0.01 till 0.2 (magic Intra, magic!)', + Html::a('vpaladii', Url::toRoute('students/vpaladii', true))) ?>
diff --git a/views/cams/_camimg.php b/views/cams/_camimg.php index 2b47df0..a92d4a0 100644 --- a/views/cams/_camimg.php +++ b/views/cams/_camimg.php @@ -8,5 +8,6 @@

area_name) ?>

- <?= Html::encode($model->area_name) ?> + <?= Html::encode($model->area_name) ?>
diff --git a/views/cams/index.php b/views/cams/index.php index ee81da7..3f1a0f3 100644 --- a/views/cams/index.php +++ b/views/cams/index.php @@ -1,7 +1,7 @@ false, 'itemView' => function ($model, $key, $index, $widget) use ($isAccessGaranted) { if ($isAccessGaranted || $model->accessible_outside_unit) { - return $this->render('_camimg', ['model' => $model, 'key' => $key, 'index' => $index, 'widget' => $widget]); + return $this->render('_camimg', ['model' => $model, + 'key' => $key, + 'index' => $index, + 'widget' => $widget]); } }, ]); ?> '

', - 'id' => 'modal-view-full-image', - 'size' => Modal::SIZE_LARGE, - ]); - echo '
'; - Modal::end(); +Modal::begin([ + 'header' => '

', + 'id' => 'modal-view-full-image', + 'size' => Modal::SIZE_LARGE, +]); +echo '
'; +Modal::end(); ?> diff --git a/views/corrections/_search.php b/views/corrections/_search.php index 709b3b0..2caa0df 100644 --- a/views/corrections/_search.php +++ b/views/corrections/_search.php @@ -15,36 +15,36 @@ 'action' => ['index'], 'method' => 'get', 'options' => [ - 'data-pjax' => 1 + 'data-pjax' => 1, ], ]); ?> - field($model, 'dateStart')->label(Yii::t('app', 'dateStart'))->widget(DatePicker::className(),[ - 'type' => DatePicker::TYPE_INPUT, - 'removeButton' => ['icon' => 'trash'], - 'pickerButton' => false, - 'pluginOptions' => [ - 'format' => 'yyyy-mm-dd', - 'autoclose' => true, - 'todayHighlight' => true, - ] - ]) ?> - - field($model, 'dateEnd')->label(Yii::t('app', 'dateEnd'))->widget(DatePicker::className(),[ - 'type' => DatePicker::TYPE_INPUT, - 'removeButton' => ['icon' => 'trash'], - 'pickerButton' => false, - 'pluginOptions' => [ - 'format' => 'yyyy-mm-dd', - 'autoclose' => true, - 'todayHighlight' => true, - ] - ]) ?> - -
- 'btn btn-primary']) ?> - 'btn btn-outline-secondary']) ?> -
+ field($model, 'dateStart')->label(Yii::t('app', 'dateStart'))->widget(DatePicker::className(), [ + 'type' => DatePicker::TYPE_INPUT, + 'removeButton' => ['icon' => 'trash'], + 'pickerButton' => false, + 'pluginOptions' => [ + 'format' => 'yyyy-mm-dd', + 'autoclose' => true, + 'todayHighlight' => true, + ], + ]) ?> + + field($model, 'dateEnd')->label(Yii::t('app', 'dateEnd'))->widget(DatePicker::className(), [ + 'type' => DatePicker::TYPE_INPUT, + 'removeButton' => ['icon' => 'trash'], + 'pickerButton' => false, + 'pluginOptions' => [ + 'format' => 'yyyy-mm-dd', + 'autoclose' => true, + 'todayHighlight' => true, + ], + ]) ?> + +
+ 'btn btn-primary']) ?> + 'btn btn-outline-secondary']) ?> +
diff --git a/views/corrections/index.php b/views/corrections/index.php index 142ba1e..742e5ae 100644 --- a/views/corrections/index.php +++ b/views/corrections/index.php @@ -17,57 +17,57 @@

title) ?>

- 10000 ]); ?> - render('_search', ['model' => $searchModel]); ?> - models as $model) { - $labels = array_merge([$model->date], $labels); - $data = array_merge([$model->count], $data); - } + 10000]); ?> + render('_search', ['model' => $searchModel]); ?> + models as $model) { + $labels = array_merge([$model->date], $labels); + $data = array_merge([$model->count], $data); + } ?> -
-
- 'line', - 'data' => [ - 'labels' => $labels, - 'datasets' => [ - [ - 'label' => Yii::t('app', 'Correction Logs'), - 'backgroundColor' => 'rgba(255,99,132,0.2)', - 'borderColor' => 'rgba(255,99,132,1)', - 'pointBackgroundColor' => 'rgba(255,99,132,1)', - 'pointBorderColor' => '#fff', - 'pointHoverBackgroundColor' => '#fff', - 'pointHoverBorderColor' => 'rgba(255,99,132,1)', - 'data' => $data - ] - ] - ], - 'options' => [ - 'responsive' => true, - 'maintainAspectRatio' => false, - 'tooltips' => [ - 'mode' => 'index', - 'intersect' => false, - ], - 'hover' => [ - 'mode' => 'nearest', - 'intersect' => true +
+
+ 'line', + 'data' => [ + 'labels' => $labels, + 'datasets' => [ + [ + 'label' => Yii::t('app', 'Correction Logs'), + 'backgroundColor' => 'rgba(255,99,132,0.2)', + 'borderColor' => 'rgba(255,99,132,1)', + 'pointBackgroundColor' => 'rgba(255,99,132,1)', + 'pointBorderColor' => '#fff', + 'pointHoverBackgroundColor' => '#fff', + 'pointHoverBorderColor' => 'rgba(255,99,132,1)', + 'data' => $data, ], - // !app\helpers\ThemesHelper::isDark() - // ?: 'legend' => [ - // 'labels' => [ - // 'fontColor' => '#fff', - // 'fontSize' => 18, - // ], - // ], ], - ]);?> -
+ ], + 'options' => [ + 'responsive' => true, + 'maintainAspectRatio' => false, + 'tooltips' => [ + 'mode' => 'index', + 'intersect' => false, + ], + 'hover' => [ + 'mode' => 'nearest', + 'intersect' => true, + ], + // !app\helpers\ThemesHelper::isDark() + // ?: 'legend' => [ + // 'labels' => [ + // 'fontColor' => '#fff', + // 'fontSize' => 18, + // ], + // ], + ], + ]); ?>
+
diff --git a/views/friend/_search.php b/views/friend/_search.php index 36709d3..6035b4f 100644 --- a/views/friend/_search.php +++ b/views/friend/_search.php @@ -14,7 +14,7 @@ 'action' => ['index'], 'method' => 'get', 'options' => [ - 'data-pjax' => 1 + 'data-pjax' => 1, ], ]); ?> diff --git a/views/friend/index.php b/views/friend/index.php index 2bd6454..097474f 100644 --- a/views/friend/index.php +++ b/views/friend/index.php @@ -1,8 +1,8 @@ title) ?> render('view', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'tab' => 'friends']); - $income = $this->render('view', ['searchModel' => $searchModelIncome, 'dataProvider' => $dataProviderIncome, 'tab' => 'income']); - $outgoing = $this->render('view', ['searchModel' => $searchModelOutgoing, 'dataProvider' => $dataProviderOutgoing, 'tab' => 'outgoing']); + $friends = + $this->render('view', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'tab' => 'friends']); + $income = + $this->render('view', ['searchModel' => $searchModelIncome, + 'dataProvider' => $dataProviderIncome, + 'tab' => 'income']); + $outgoing = + $this->render('view', ['searchModel' => $searchModelOutgoing, + 'dataProvider' => $dataProviderOutgoing, + 'tab' => 'outgoing']); $tmp = Yii::$app->session->get('username'); $items = [ [ - 'label' => ' ' . Yii::t('app', 'Friends'), + 'label' => ' ' . Yii::t('app', 'Friends'), 'content' => $friends, - 'active' => true + 'active' => true, ], [ - 'label' => ' ' . Yii::t('app', 'Income'), + 'label' => ' ' . Yii::t('app', 'Income'), 'content' => $income, ], [ - 'label' => ' ' . Yii::t('app', 'Outgoing'), + 'label' => ' ' . Yii::t('app', 'Outgoing'), 'content' => $outgoing, ], ]; echo TabsX::widget([ - 'items'=>$items, - 'position'=>TabsX::POS_ABOVE, - 'encodeLabels'=>false + 'items' => $items, + 'position' => TabsX::POS_ABOVE, + 'encodeLabels' => false, ]); Modal::begin([ - 'header' => '', - 'id' => 'modal-delete', - 'footer' => Html::a(Yii::t('app', 'Delete'), '', ['class' => 'btn btn-danger', 'data-method' => 'post', ]), + 'header' => '', + 'id' => 'modal-delete', + 'footer' => Html::a(Yii::t('app', 'Delete'), '', ['class' => 'btn btn-danger', 'data-method' => 'post',]), ]); Modal::end(); $this->registerJs("$(function() { diff --git a/views/friend/view.php b/views/friend/view.php index 8977dfa..82629fb 100644 --- a/views/friend/view.php +++ b/views/friend/view.php @@ -1,49 +1,87 @@ - - - $dataProvider, - 'summary' => false, + + + $dataProvider, + 'summary' => false, + + 'itemView' => function ($model, $key, $index, $widget) use ($tab) { + Yii::$app->user->setReturnUrl(['friend/index']); + $loc = ($model->lastloc != 0) ? ViewHelper::getHumanTime($model->lastloc) : Yii::t('app', 'ONLINE'); + $link = + $tab !== 'profile' + ? Html::a('', '', ['class' => 'popupModal btn btn-danger btn-sm pull-right glyphicon glyphicon-trash', + 'data-toggle' => 'modal', + 'data-target' => '#modal', + 'data-id' => $model->login]) : ''; + if ($tab === 'income') { + $link = + Html::a('', '/' + . Yii::$app->language + . '/friends/create/' + . $model['login'] + . '/' + . $model['course'], ['class' => 'btn btn-success btn-sm pull-right glyphicon glyphicon-plus']); + } - 'itemView' => function ($model , $key , $index , $widget) use ($tab) { - Yii::$app->user->setReturnUrl(['friend/index']); - $loc = ($model->lastloc != 0) ? ViewHelper::getHumanTime($model->lastloc) : Yii::t('app', 'ONLINE'); - $link = $tab !== 'profile' ? Html::a('', '', ['class' => 'popupModal btn btn-danger btn-sm pull-right glyphicon glyphicon-trash', 'data-toggle' => 'modal', 'data-target' => '#modal', 'data-id' => $model->login]) :''; - if ($tab === 'income') { - $link = Html::a('', '/' . Yii::$app->language . '/friends/create/' . $model['login'] . '/' . $model['course'], ['class' => 'btn btn-success btn-sm pull-right glyphicon glyphicon-plus']); - } - return '
-
- + return '
+
+
-

' . $model->login . ' ' . $model->level .' lvl

-

' . $loc . ' ' . $model->location . '

-

' . $model->displayname . '

-

' . $model->phone . '

-

' . $model->pool_month . ' ' . $model->pool_year . '

- '. $link . ' - course/$model->login") . '" class="btn btn-success btn-sm" data-pjax=0>' . Yii::t('app', 'Profile') . ' +

' + . $model->login + . ' ' + . $model->level + . ' lvl

+

' + . $loc + . ' ' + . $model->location + . '

+

' + . $model->displayname + . '

+

' + . $model->phone + . '

+

' + . $model->pool_month + . ' ' + . $model->pool_year + . '

+ ' + . $link + . ' + course/$model->login") + . '" class="btn btn-success btn-sm" data-pjax=0>' + . Yii::t('app', 'Profile') + . '
'; - } - ] ); ?> - +registerJsFile('@web/js/site.js', ['depends' => [yii\web\JqueryAsset::className()], 'position' => \yii\web\View::POS_END]); -$this->registerCssFile('@web/css/site' . (YII_ENV_DEV ? '.css' : '.min.css'), ['depends' => [yii\bootstrap\BootstrapAsset::className()]]); +$this->registerJsFile('@web/js/site.js', ['depends' => [yii\web\JqueryAsset::className()], + 'position' => \yii\web\View::POS_END]); +$this->registerCssFile('@web/css/site' . (YII_ENV_DEV ? '.css' + : '.min.css'), ['depends' => [yii\bootstrap\BootstrapAsset::className()]]); if (ThemesHelper::isDark()) { $this->registerCssFile('@web/css/fix-dark-theme.css'); } @@ -40,7 +42,11 @@