"justify"> ($ i=0; $ i lt; mysql_num_rows ($ result); $ i ++)
{
$ data_info [$ i]=mysql_fetch_array ($ result);
$ parent_id= * raquo ;;
$ data_info [$ i] [ n ]=$ i + 1;
($ exist_parent)
{
$ parent_id=$ data_info [$ i] [ parent_id ];
$ where_arr [ parent_id ]=$ data_info [$ i] [ id ]; ($ get_children)
$ data_info [$ i] [ children ]=$ this- gt; get_few_data ($ where_arr, $ num_page, $ order_arr);
$ data_info [$ i] [ max_status ]=$ this- gt; get_max_status_data ($ parent_id);
}
{
$ data_info [$ i] [ max_status ]=$ max_status;
}
($ exist_date)
{
$ data_info [$ i] [ s_day ]=date ( d raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_month ]=date ( m raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_year ]=date ( Y raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_hour ]=date ( H raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_minute ]=date ( i raquo ;, strtotime ($ data_info [$ i] [ date ]));
}
($ exist_image)
{
$ data_info [$ i] [ image_size ]=(! empty ($ data_info [$ i] [ image ]))? $ GLOBALS [ images ] - gt; get_image_size ($ data_info [$ i] [ image ]): null;
($ exist_name)
$ data_info [$ i] [ name_image ]=str_replace (array ( amp; raquo ;, « raquo ;,« »), array ( laquo ;, «,«), $ data_info [$ i] [ name ']);
}
$ data_info [$ i] [ line_pos ]=$ i% (int) $ GLOBALS [ in_line ];
}
$ data_info;
}
/**
* Отримати список записів з бази
*/function get_few_data ($ where_arr=array (), $ num_page= * raquo ;, $ order_arr=array ( status = gt; ASC raquo ;, id = gt; ASC ), $ get_children=true)
{
$ data_info=array ();
$ where_str=$ this- gt; _get_where ($ where_arr);
$ limit_str=$ this- gt; _get_limit ($ num_page, $ where_arr);
$ fields_str=$ this- gt; _get_fields ();
$ order_str=$ this- gt; _get_order ($ order_arr);
$ exist_parent=$ this- gt; _exist_field ( parent_id );
$ exist_date=$ this- gt; _exist_field ( date );
$ exist_image=$ this- gt; _exist_field ( image );
$ exist_name=$ this- gt; _exist_field ( name );
$ max_status=$ this- gt; get_max_status_data ( * );
$ sql=«SELECT $ fields_str». $ this- gt; table_name. »
$ where_str
$ order_str
$ limit_str »;
$ result=$ this- gt; _execute_query ($ sql, __LINE__);
($ i=0; $ i lt; mysql_num_rows ($ result); $ i ++)
{
$ data_info [$ i]=mysql_fetch_array ($ result);
$ parent_id= * raquo ;;
$ data_info [$ i] [ n ]=$ i + 1;
($ exist_parent)
{
$ parent_id=$ data_info [$ i] [ parent_id ];
$ where_arr [ parent_id ]=$ data_info [$ i] [ id ]; ($ get_children)
$ data_info [$ i] [ children ]=$ this- gt; get_few_data ($ where_arr, $ num_page, $ order_arr);
$ data_info [$ i] [ max_status ]=$ this- gt; get_max_status_data ($ parent_id);
}
{
$ data_info [$ i] [ max_status ]=$ max_status;
}
($ exist_date)
{
$ data_info [$ i] [ s_day ]=date ( d raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_month ]=date ( m raquo ;, strtotime ($ data_info [$ i] [ date ]));
$ data_info [$ i] [ s_year ]=date ( Y raquo ;, strtotime ($ data_info [$ i] [ date ]));