******************** AN-Framework files ******************** schoolmng\an\view WParentRoot_AN.php DWParent_AN.php EWParent_AN.php LWParent_AN.php ExWParent_AN.php ************************** DEFINITION (DEF) file ************************** * DEF file types (and also screen types) DW: detail view: Used to see the details of a record, ex: student details view screen EW: Edit view: Used to create/edit a record, ex: student info edit screen LW: List View: This screen type is for seaching and displaying list of records: ex: Student search screen, there is a search form and after the search there will be a list just below the seach form with paging * location of the files: Under each module folder, there are following folders for each type of DEF file an/viewdefs/DW, an/viewdefs/EW, an/viewdefs/LW * Main parts of the DEF files + Groups: Each block of fields are defined in a group. It is possible to define different css styles for each group. There can be titles for each group + Fields: The smallest unit on the screen. For DW screen, it is label and value For EW screen, label and form input element For LW screen: Search form part is similar to EW screen, it is a form, For the list part, there are columns in the list. Each column is a field in the definition file * Each FIELD in the DEF file is an ARRAY of information. The main list of the information used to create a field is as follows: ** def: array defining some main attributes of the field such as field name in the related DB table, db type (ex: varchar). ** def_local: similar to "def", but not linked to a DB field. In a form, some fields are directly linked to DB fields, but some fields only submit some value not directly stored in DB ** label: label of the field. This value is displayed on the screen after processing in the "_t()" function NOTE: _t() function takes a parameter, if this parameter is found in the language file, shows that value, if not found, shows the parameter directly ** field_span: similar to col_span in HTML, but shows how many field-space is used for this field ** attributes: this value is added to the field HTML directly, we can put here anything like "disabled" keyword etc ** label_td_attributes: attributes for the label TD. Normally we put here style ** data_td_attributes: style of the data TD ** hide_time: for datetime fields, does not show the time ** default: default value of the field, for some fields like date, it is possible to use some keywords like "today" ** db_table: it is possible to define a default db table for a screen, but for special case handling, we can overwrite these values for each field When we are creating some automatic db queries, this value is important ** nl2br: for some fields like "description", we may need to convert "\n" (new line) to
tag ** lang_module: sometimes we may need to use a different lang file from the default module. For example, if we are showing a student module screen, default module is "student". We may need to show a label from another module file (see _t(..) function code) ** sortable: for list view fields (columns), it is possible to make a columns sortable (boolean, true/false) ** assign: an array of key/value pairs. Key is found in the field html in the curly brackets {}. Value is replaced with {KEY}. ** no_sql_deleted_condition use to remove the "deleted=0" condition from the auto generated query, because some tables dont have deleted field If used only in one field of the table in LW def file, it is enough. No need to add all the fields of the table ** sql_match for LIKE sql matches 'sql_match'=>'%', // one of %, %%, = , if not defined default = ** range_search if true, the fields is processed as range, 2 fields are created (from - to), this can be any text field or enum type field 'range_search'=>true, ** range_search_sep used together with 'range_search', if range type of field, this label is added between 2 fields ex: 'range_search_sep'=>'~', ** field_set This is used to create range search for a set of fields, like more than one dates with radio buttons Each field in the set should have 'field_set'=>'FIELD SET NAME', for example, 'field_set'=>'date_group1', if the field_set name (var_name) is "date_group1" 'type'=>'field_set', ** show_subete_option No need to create 2 options list with/without ""=>"", just use this setting show_subete_option=>true, adds one empty option (also possible to add a label for this empty option), "subete_option_label" if needed ** show_area_subete_option used for school area pull down. If this value is not set, "show_subete_option" is used as default value ** subete_option_label used together with "show_subete_option", sets label for empty option ** 'button_label: label of the button. If this field is set to "" (empty string) explicitly, then the button is not shown. This is sometimes needed for some special cases For example, if we dont want to show the popup button for some cases, but only the text box, then set the 'button_label'=>'' (empty string) ** tooltip Small tooltip button is created on the right side of the field, the tooltip text is shown using _t() function 'custom_tooltip'=>'HLP_BANKINFO_CREATE_GESSHA', ** is_validate_search_form Set this value to TRUE to validate the search form, if not set in SW definition, default is FALSe in the program "ValidateBeforeSearch()" function in the LWParent_AN is the default validation function, overwrite it if needed The timing of the validation is also important. If validation is run from a custom function, for example custome excel creation, we may need to validate the form in that custom function In that case, no need to run the default validation function. So, set "is_validate_search_form=false" after validating the form in the custom function once (or don't set it to TRUE in the SW definition array) 'is_validate_search_form'=>true, ** functin_to_create_list: used for pulldowns if the list is not a simple array. Ex: 'function_to_create_list'=>array('name'=>'get_audit_fields_AN', 'scope'=>'global', 'params'=>array('module'=>'Teacher')), * Other notes about DEF files ----------------------------- ** row_unique_id set 'row_unique_id' to a unique field name, this is used as returning value for checkbox listviews, also used to add unique subpanel beneath a row ex: 'row_unique_id'=>'smsevent_instances_id' for creating a listview for course-student schedule hours with checkcboxes * ajax data 1) get data with ajax triggered with a button click, and put the retrieved data into a specific html element with known ID In this example: "kakunin_div" is the target element ID, data is put into this element "query_string" is parsed and each "key=value" pair in the string becomes a hidden var in the form of the button. Put "is_ajax_AN=true" into the query string 'henkin_kakunin_button'=>array( 'type'=>'button', 'query_string'=>'is_ajax_AN=true', 'onclick'=>"this.form.submittype.value='kakunin';querystring=form_elements_as_query_string(this.form); ajax_AN('kakunin_div', 'index.php', querystring);", 'label'=>'THIS IS A LABEL', 'group_name'=>'other_buttons', 'attributes'=>" class='button' ", ), If we want the ajax to work for only this button, not for all the buttons of the form, put the is_ajax_AN into onclick event ... querystring=form_elements_as_query_string(this.form); querystring=querystring+'&is_ajax_AN=true'; ajax_AN('kakunin_div', 'index.php', querystring); ... ** records_per_page (LW) number of rows in the listview Ex: 'records_per_page'=>5, ** no_paging (LW) if we don't need paging at the top and bottom, use this setting and set it to "true" (if no setting, shows paging) --> 'no_paging'=>true, If we want to set a limit to the number of displayed rows in listview, when there is not paging, set it as follows --> 'no_paging_max_rows'=>10, // max num of rows to show without paging (used if no_paging=true) ****************** ACTION FILES ***************** * CUSTOM Functions --------------------- ** field html function (inner and outer html, not just value) // used by SW, EW and DW (DW calls this functin only for form elements like buttons, for other display values, DW returns display value before calling this function) $custom_function_name="Custom_field_function_".$var_name; Custom_field_function_".$var_name($var_name, $field, $value_to_assign, $value_to_assign1); ** display function (LW, DW) $custom_function_name="Custom_field_display_function_".$var_name; $value_to_display=$this->$custom_function_name($var_name, $field, $data); ** default value function (EW, SW) $function_name="Field_default_function_{$var_name}"; return $this->$function_name($var_name, $field); ** submit function (DW, EW) $submit_handle_function_name="Custom_submit_function_".$_REQUEST['submittype']; $return_value=$this->$submit_handle_function_name(); // gerekirse bu functin icinde redirect ve exit yap if (isset($return_value) && !empty($return_value)) { $submit_function_handler_return=$return_value; } ** submit function (LW, SW) (sometimes we need different handlers in SW and LW, or in both of them, there are different functions for each case) // SW $submit_handle_function_name="SW_submit_function_".$_REQUEST['submittype']; $this->$submit_handle_function_name(); // LW $submit_handle_function_name="LW_submit_function_".$_REQUEST['submittype']; $this->$submit_handle_function_name(); // SW_LW $submit_handle_function_name="LW_SW_submit_function_".$_REQUEST['submittype']; $this->$submit_handle_function_name(); // redirect and exit in this function if needed ** field value function (EW, SW) // value to show in the field in EW and SW forms (not all field html, only content) $custom_function_name="Custom_field_value_function_".$var_name; // CUSTOM FUNCTION check first $value_to_assign=$this->$custom_function_name($var_name, $field, $use_request_values); ** excel cell data (EXCEL) (including tags) $function_name="Excel_data_{$var_name}"; $xml .=$this->$function_name($var_name, $field); ** sql WHERE function (LW) // for some fields we have custom function, for example course_category search "LW_where_function_course_category_popup()" $function_name="LW_where_function_{$var_name}"; $arr=$this->$function_name($str, $var_name, $field, $arr); ** sql ORDER_BY function (LW) $function_name="LW_order_by_function_{$orderBy}"; $order_by_full =$this->$function_name($order_direction); // return this value directly, it should include all field names and ASC, DESC etc ** LW title TD (LW) $function_name="LW_title_td_function_{$var_name}"; $title_html=$this->$function_name(); --> return something like this : ''; ** LW data TD (LW) $function_name="LW_data_td_function_{$var_name}"; $data_html .= $this->$function_name($var_name, $field, $data, $data_display_value, $td_class, $bg_color, $attributes_str); --> return something like: $data_html .= ''; $data_html .= $data_display_value; $data_html .= ""; ** field html (before, after, below, above) additions $function_name="get_add_html_for_{$var_name}"; $ret_arr=$this->$function_name($var_name, $field, $this->group_fields); // return position and raw html in array: array('html'=>'', 'location'=>'before_field') --> location: one of "before_field", "before_label", "after_label", "after_field" --> html: raw html ** assign function $function_name="Custom_assign_function_".$var_name; $arr_assign=$this->$function_name($var_name, $field, $arr_assign); ** validation function $function_name="Validation_function_".$var_name; $err_msg=$this->$function_name();