Файл: Проце‬ссы при‬нятия решений в организации.pdf

ВУЗ: Не указан

Категория: Курсовая работа

Дисциплина: Не указана

Добавлен: 14.03.2024

Просмотров: 45

Скачиваний: 0

ВНИМАНИЕ! Если данный файл нарушает Ваши авторские права, то обязательно сообщите нам.

Escape String access public param string return string function escape_str(str) Access the CI object CI get_instance();

ODBC doesn"t require escaping return CI_remove_invisible_characters(str);

Affected Rows access public return integer function affected_rows() return odbc_num_rows(thisconn_id);

Insert ID access public return integer function insert_id() return odbc_insert_id(thisconn_id);

query Generates a platformspecific query string that counts all records in the specified database access public param string return string function count_all(table "") if (table "") return 0;

query thisquery(this_count_string. this_protect_identifiers("numrows").. this_protect_identifiers(table, TRUE, NULL, FALSE));

if (querynum_rows() 0) return 0;

row queryrow();

return (int) rownumrows;

Show table query Generates a platformspecific query string so that the table names can be fetched access private param boolean return string function _list_tables(prefix_limit FALSE) sql "SHOW TABLES FROM `".thisdatabase.;

if (prefix_limit ! FALSE AND thisdbprefix ! "")

sql..thisdbprefix.;

return FALSE; not currently supported return sql;

Show column query Generates a platformspecific query string so that the column names can be fetched access public param string the table name return string function _list_columns(table "") return "SHOW COLUMNS FROM ".table;

Field data query Generates a platformspecific query so that the column data can be retrieved access public param string the table name return object function _field_data(table) return "SELECT TOP 1 FROM ".table;

The error message string access private return string function _error_message() return odbc_errormsg(thisconn_id);

The error message number access private return integer function _error_number() return odbc_error(thisconn_id);

Escape the SQL Identifiers This function escapes column and table names access private param string return string function _escape_identifiers(item) if (this_escape_char "") return item;

foreach (this_reserved_identifiers as id) if (strpos(item, ".".id) ! FALSE) str this_escape_char. str_replace(".", this_escape_char.".", item);

remove duplicates if the user already included the escape return preg_replace("[".this_escape_char."]+", this_escape_char, str);

} if (strpos(item, ".") ! FALSE) str this_escape_char.str_replace(".", this_escape_char.".".this_escape_char, item).this_escape_char;

else str this_escape_char.item.this_escape_char;

remove duplicates if the user already included the escape return preg_replace("[".this_escape_char."]+", this_escape_char, str);

From Tables This function implicitly groups FROM tables so there is no confusion about operator precedence in harmony with SQL standards access public param type return type function _from_tables(tables) if ( ! is_array(tables)) tables array(tables);

return "(".implode(", ", tables).")";

Insert statement Generates a platformspecific insert string from the supplied data access public param string the table name param array the insert keys param array the insert values return string function _insert(table, keys, values) { return.table..implode(", ", keys)..implode(", ", values).;

Update statement Generates a platformspecific update string from the supplied data access public param string the table name param array the update data param array the where clause param array the orderby clause param array the limit clause return string function _update(table, values, where, orderby array(), limit FALSE) foreach(values as key val) valstr key..val;

limit ( ! limit) ? "": " LIMIT ".limit;

orderby (count(orderby) 1)?" ORDER BY ".implode(, orderby):"";

sql.table..implode(", ", valstr);

sql. (where ! "" AND count(where) 1) ?.implode(, where): "";

sql. orderby.limit;

return sql;

Truncate statement Generates a platformspecific truncate string from the supplied data If the database does not support the truncate() command This function maps to "DELETE FROM table" access public param string the table name return string function _truncate(table) return this_delete(table);

Delete statement Generates a platformspecific delete string from the supplied data access public param string the table name param array the where clause param string the limit clause return string function _delete(table, where array(), like array(), limit FALSE) conditions "";


if (count(where) 0 OR count(like) 0) conditions;

conditions. implode(, thisar_where);

if (count(where) 0 count(like) 0) conditions.;

conditions. implode(, like);

limit ( ! limit) ? "": " LIMIT ".limit;

return.table.conditions.limit;

Limit string Generates a platformspecific LIMIT clause access public param string the sql query string param integer the number of rows to limit the query to param integer the offset value return string function _limit(sql, limit, offset) Does ODBC doesn"t use the LIMIT clause?

return sql;

Close DB Connection access public param resource return void function _close(conn_id) require_once("Parser.php");

require_once("BIFFwriter.php");

Class for generating Excel Spreadsheets author Xavier Noguer xnoguerrezebra.com package Spreadsheet_WriteExcel class Worksheet extends BIFFwriter { Constructor param string name The name of the new worksheet param integer index The index of the new worksheet param mixed activesheet The current activesheet of the workbook we belong to param mixed firstsheet The first worksheet in the workbook we belong to param mixed url_format The default format for hyperlinks param mixed parser The formula parser created for the Workbook function Worksheet(name,index,activesheet,firstsheet,url_format,parser) thisBIFFwriter(); It needs to call its parent"s constructor explicitly rowmax 65536; 16384 in Excel 5 colmax 256;

strmax 255;thisname name;thisindex index;thisactivesheet activesheet;

thisfirstsheet firstsheet;this_url_format url_format;this_parser parser;thisext_sheets array();this_using_tmpfile 1;

this_filehandle;thisfileclosed 0;

thisoffset 0;thisxls_rowmax rowmax;

thisxls_colmax colmax;thisxls_strmax strmax;

thisdim_rowmin rowmax +1;thisdim_rowmax 0;

thisdim_colmin colmax +1;thisdim_colmax 0;

thiscolinfo array();this_selection array(0,0,0,0);

this_panes array();this_active_pane 3;this_frozen 0;thisselected 0;this_paper_size 0x0;this_orientation 0x1;this_header "";

this_footer "";this_hcenter 0;this_vcenter 0;

this_margin_head 0.50;this_margin_foot 0.50;this_margin_left 0.5;

this_margin_right 0.75;this_margin_top 1.00;this_margin_bottom 1.00;this_title_rowmin NULL;this_title_rowmax NULL;

this_title_colmin NULL;this_title_colmax NULL;this_print_rowmin NULL;

this_print_rowmax NULL;this_print_colmin NULL;this_print_colmax NULL;

this_print_gridlines 1;this_print_headers 0;this_fit_page 0;this_fit_width 0;this_fit_height 0;this_hbreaks array();this_vbreaks array();this_protect 0;this_password NULL;thiscol_sizes array();

thisrow_sizes array();this_zoom 100;

this_print_scale 100;this_initialize();

Open a tmp file to store the majority of the Worksheet data. If this fails, for example due to write permissions, store the data in memory. This can be slow for large files.

function _initialize() Open tmp file for storing Worksheet data fh tmpfile();

if ( fh) { Store filehandle this_filehandle fh;

else { If tmpfile() fails store data in memory this_using_tmpfile 0;

Add data to the beginning of the workbook (note the reverse order) and to the end of the workbook.

access public see Workbook:store_workbook() param array sheetnames The array of sheetnames from the Workbook this worksheet belongs to function close(sheetnames) num_sheets count(sheetnames);

Prepend in reverse order!

Prepend the sheet dimensions this_store_dimensions();

Prepend the sheet password this_store_password();

Prepend the sheet protection this_store_protect();

Prepend the page setup this_store_setup();

Prepend the bottom margin this_store_margin_bottom();

Prepend the top margin this_store_margin_top();

Prepend the right margin this_store_margin_right();

Prepend the left margin this_store_margin_left();

Prepend the page vertical centering thisstore_vcenter();

Prepend the page horizontal centering thisstore_hcenter();

Prepend the page footer thisstore_footer();

Prepend the page header thisstore_header();

Prepend the vertical page breaks this_store_vbreak();

Prepend the horizontal page breaks this_store_hbreak();

Prepend WSBOOL this_store_wsbool(); Prepend GRIDSET this_store_gridset();

Prepend PRINTGRIDLINES this_store_print_gridlines(); Prepend PRINTHEADERS this_store_print_headers(); Prepend EXTERNSHEET references for (i num_sheets; i 0; i) { sheetname sheetnames;


this_store_externsheet(sheetname); Prepend the EXTERNCOUNT of external references.this_store_externcount(num_sheets);

Prepend the COLINFO records if they exist if (!empty(thiscolinfo)){ for(i0; i count(thiscolinfo); i++) this_store_colinfo(thiscolinfo);

this_store_defcol(); Prepend the BOF record this_store_bof(0x010);

End of prepend. Read upwards from here.

Append this_store_window2();

this_store_zoom();

if(!empty(this_panes)) this_store_panes(this_panes);

this_store_selection(this_selection);

this_store_eof();

Retrieve the worksheet name. This is usefull when creating worksheets without a name.

access public return string The worksheet"s name function get_name() return(thisname);

Retrieves data from memory in one chunk, or from disk in buffer sized chunks.

return string The data function get_data() buffer 4096;

Return data stored in memory if (isset(this_data)) { tmp this_data;

unset(this_data);

fh this_filehandle;

if (this_using_tmpfile) { fseek(fh, 0);

return(tmp);

Return data stored on disk if (this_using_tmpfile) { if (tmp fread(this_filehandle, buffer)) { return(tmp);

No data to return return("");

Set this worksheet as a selected worksheet, i.e. the worksheet has its tab highlighted.

access public function select() thisselected 1;

Set this worksheet as the active worksheet, i.e. the worksheet that is displayed when the workbook is opened. Also set it as selected.

access public function activate() thisselected 1;

thisactivesheet thisindex;

Set this worksheet as the first visible sheet. This is necessary when there are a large number of worksheets and the activated worksheet is not visible on the screen.

access public function set_first_sheet() thisfirstsheet thisindex;

Set the worksheet protection flag to prevent accidental modification and to hide formulas if the locked and hidden format properties have been set.

access public param string password The password to use for protecting the sheet.

function protect(password) this_protect 1;

this_password this_encode_password(password);

Set the width of a single column or a range of columns.

access public see _store_colinfo() param integer firstcol first column on the range param integer lastcol last column on the range param integer width width to set param mixed format The optional XF format to apply to the columns param integer hidden The optional hidden atribute function set_column(firstcol, lastcol, width, format 0, hidden 0) thiscolinfo array(firstcol, lastcol, width, format, hidden);

Set width to zero if column is hidden width (hidden) ? 0: width;

for(col firstcol; col lastcol; col++) { thiscol_sizes width;

Set which cell or cells are selected in a worksheet access public param integer first_row first row in the selected quadrant param integer first_column first column in the selected quadrant param integer last_row last row in the selected quadrant param integer last_column last column in the selected quadrant see _store_selection() function set_selection(first_row,first_column,last_row,last_column) this_selection array(first_row,first_column,last_row,last_column);

Set panes and mark them as frozen.

access public param array panes This is the only parameter received and is composed of the following:

0 Vertical split position, 1 Horizontal split position 2 Top row visible 3 Leftmost column visible 4 Active pane function freeze_panes(panes) this_frozen 1;

this_panes panes;

Set panes and mark them as unfrozen.

access public param array panes This is the only parameter received and is composed of the following:

0 Vertical split position, 1 Horizontal split position 2 Top row visible 3 Leftmost column visible 4 Active pane function thaw_panes(panes) this_frozen 0;

this_panes panes;

Set the page orientation as portrait.

access public function set_portrait() this_orientation 1;

Set the page orientation as landscape.

access public function set_landscape() this_orientation 0;

Set the paper type. Ex. 1 US Letter, 9 A4 access public param integer size The type of paper size to use function set_paper(size 0) this_paper_size size;

Set the page header caption and optional margin.

access public param string string The header text param float margin optional head margin in inches.


function set_header(string,margin 0.50)

if (strlen(string) 255) { carp "Header string must be less than 255 characters";

return;

this_header string;

this_margin_head margin;

Set the page footer caption and optional margin.

access public param string string The footer text param float margin optional foot margin in inches.

function set_footer(string,margin 0.50)

if (strlen(string) 255) { carp "Footer string must be less than 255 characters";

return;

this_footer string;

this_margin_foot margin;

Center the page horinzontally.

access public param integer center the optional value for centering. Defaults to 1 (center).

function center_horizontally(center 1) this_hcenter center;

Center the page horinzontally.

access public param integer center the optional value for centering. Defaults to 1 (center).

function center_vertically(center 1) this_vcenter center;

Set all the page margins to the same value in inches.

access public param float margin The margin to set in inches function set_margins(margin) thisset_margin_left(margin);

thisset_margin_right(margin);

thisset_margin_top(margin);

thisset_margin_bottom(margin);

Set the left and right margins to the same value in inches.

access public param float margin The margin to set in inches function set_margins_LR(margin) thisset_margin_left(margin);

thisset_margin_right(margin);

Set the top and bottom margins to the same value in inches.

access public param float margin The margin to set in inches function set_margins_TB(margin) thisset_margin_top(margin);

thisset_margin_bottom(margin);

Set the left margin in inches.

access public param float margin The margin to set in inches function set_margin_left(margin 0.75)

this_margin_left margin;

Set the right margin in inches.

access public param float margin The margin to set in inches function set_margin_right(margin 0.75)

this_margin_right margin;

Set the top margin in inches.

access public param float margin The margin to set in inches function set_margin_top(margin 1.00)

this_margin_top margin;

Set the bottom margin in inches.

access public param float margin The margin to set in inches function set_margin_bottom(margin 1.00)

this_margin_bottom margin;

Set the rows to repeat at the top of each printed page. See also the _store_name_xxxx() methods in Workbook.php access public param integer first_row First row to repeat param integer last_row Last row to repeat. Optional.

function repeat_rows(first_row, last_row NULL) this_title_rowmin first_row;

if(isset(last_row)) { Second row is optional this_title_rowmax last_row;

else { this_title_rowmax first_row;

Set the columns to repeat at the left hand side of each printed page.

See also the _store_names() methods in Workbook.php access public param integer first_col First column to repeat param integer last_col Last column to repeat. Optional.

function repeat_columns(first_col, last_col NULL) this_title_colmin first_col;

if(isset(last_col)) { Second col is optional this_title_colmax last_col;

else { this_title_colmax first_col;

Set the area of each worksheet that will be printed.

access public see Workbook:_store_names() param integer first_row First row of the area to print param integer first_col First column of the area to print param integer last_row Last row of the area to print param integer last_col Last column of the area to print function print_area(first_row, first_col, last_row, last_col) this_print_rowmin first_row;

this_print_colmin first_col;

this_print_rowmax last_row;

this_print_colmax last_col;

Set the option to hide gridlines on the printed page.

access public see _store_print_gridlines(), _store_gridset() function hide_gridlines() this_print_gridlines 0;

Set the option to print the row and column headers on the printed page.

See also the _store_print_headers() method below.

access public see _store_print_headers() param integer print Whether to print the headers or not. Defaults to 1 (print).

function print_row_col_headers(print 1) this_print_headers print;

Store the vertical and horizontal number of pages that will define the maximum area printed. It doesn"t seem to work with OpenOffice.


access public param integer width Maximun width of printed area in pages param integer heigth Maximun heigth of printed area in pages see set_print_scale() function fit_to_pages(width, height) this_fit_page 1;

this_fit_width width;

this_fit_height height;

Store the horizontal page breaks on a worksheet (for printing).

The breaks represent the row after which the break is inserted.

access public param array breaks Array containing the horizontal page breaks function set_h_pagebreaks(breaks) foreach(breaks as break) { array_push(this_hbreaks,break);

Store the vertical page breaks on a worksheet (for printing).

The breaks represent the column after which the break is inserted.

access public param array breaks Array containing the vertical page breaks function set_v_pagebreaks(breaks) foreach(breaks as break) { array_push(this_vbreaks,break);

Set the worksheet zoom factor.

access public param integer scale The zoom factor function set_zoom(scale 100) Confine the scale to Excel"s range if (scale 10 or scale 400) { carp "Zoom factor scale outside range: 10 zoom 400";

scale 100;

this_zoom floor(scale);

Set the scale factor for the printed page.

It turns off the option access public param integer scale The optional scale factor. Defaults to 100 function set_print_scale(scale 100) Confine the scale to Excel"s range if (scale 10 or scale 400) REPLACE THIS FOR A WARNING die("Print scale scale outside range: 10 zoom 400");

scale 100;

Turn off option this_fit_page 0;

this_print_scale floor(scale);

Map to the appropriate write method acording to the token recieved.

access public param integer row The row of the cell we are writing to param integer col The column of the cell we are writing to param mixed token What we are writing param mixed format The optional format to apply to the cell function write(row, col, token, format 0) Check for a cell reference in A1 notation and substitute row and column if (_ ~ ^\D) { _ this_substitute_cellref(_);

} Match an array ref.

if (ref token eq ) { return thiswrite_row(_);

} Match number if (preg_match("^(?)(?\d|\.\d)\d(\.\d)?((?\d+))?",token)) { return thiswrite_number(row,col,token,format);

Match http or ftp URL elseif (preg_match(,token)) { return thiswrite_url(row, col, token, format);

Match mailto:

elseif (preg_match(,token)) { return thiswrite_url(row, col, token, format);

Match internal or external sheet link elseif (preg_match("^(?:in|ex)ternal:",token)) { return thiswrite_url(row, col, token, format);

Match formula elseif (preg_match(,token)) { return thiswrite_formula(row, col, token, format);

Match formula elseif (preg_match(,token)) { return thiswrite_formula(row, col, token, format);

Match blank elseif (token "") { return thiswrite_blank(row,col,format);

Default: match string else { return thiswrite_string(row,col,token,format);

Returns an index to the XF record in the workbook param mixed format The optional XF format return integer The XF record index function _XF(format) if(format ! 0)

return(formatget_xf_index());

else return(0x0F);

Internal methods Store Worksheet data in memory using the parent"s class append() or to a temporary file, the default.

param string data The binary data to append function _append(data) if (this_using_tmpfile) Add CONTINUE records if necessary if (strlen(data) this_limit) { data this_add_continue(data);

fwrite(this_filehandle,data);

this_datasize + strlen(data);

else { parent:_append(data);

Substitute an Excel cell reference in A1 notation for zero based row and column values in an argument list.

Ex: (, ) is converted to (3, 0, ).

param string cell The cell reference. Or range of cells.

return array function _substitute_cellref(cell) cell strtoupper(cell);

Convert a column range: "A:A" or "B:G" if (preg_match("(?):(?)",cell,match)) { list(no_use, col1) this_cell_to_rowcol(match."1"); Add a dummy row list(no_use, col2) this_cell_to_rowcol(match."1"); Add a dummy row return(array(col1, col2));

Convert a cell range: "A1:B7" if (preg_match("\?(?\?\d+):\?(?\?\d+)",cell,match)) { list(row1, col1) this_cell_to_rowcol(match);

list(row2, col2) this_cell_to_rowcol(match);

return(array(row1, col1, row2, col2));

Convert a cell reference: "A1" or "AD2000" if (preg_match("\?(?\?\d+)",cell)) { list(row1, col1) this_cell_to_rowcol(match);