function index() { $sheet = get_current_sheet(); $max_rows = $this->_get("rows", 20); $max_cols = $this->_get("cols", 10); echo '<head><title>phpMyExcel Таблица ' . get_current_sheet() . '</title><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head>'; echo '<script src="' . Root::i()->getVar('wroot') . 'js/jquery-1.3.2.min.js"></script>'; echo '<script src="' . Root::i()->getVar('wroot') . 'js/short_ajax.js"></script>'; echo '<script src="' . Root::i()->getVar('wroot') . 'js/myexcel.js"></script>'; echo '<LINK REL="stylesheet" HREF="' . Root::i()->getVar('wroot') . 'style.css" TYPE="text/css">'; //echo "<input type='hidden' name='sheet' value='$sheet'>"; echo "<div class='toolbar'>"; echo "<div style='float:right'><a href='phpmyexcel.zip'>исходники</a> <a href='http://code.google.com/p/phpmyexcel/'>SVN</a></div>"; echo "<form method='GET'>"; echo "таблица: <input type='text' name='sheet' value='" . get_current_sheet() . "'>"; echo " столбцов: <input type='text' name='cols' value='{$max_cols}' size=2>"; echo " строк: <input type='text' name='rows' value='{$max_rows}' size=2>"; echo " <input type='submit' value='Открыть'>"; foreach (MyExcel::getLastSheets(10) as $one) { echo " <a style='font-size:10px' href='?sheet={$one}'>{$one}</a>"; } echo "</form>"; echo "</div>"; echo "<table id='excel'>"; echo "<tr>"; echo "<td colspan=100> </td>"; echo "</tr>"; echo "<tr>"; echo "<th> </th>"; for ($col = 0; $col < $max_cols; $col++) { echo "<th>" . chr(0x41 + $col) . "</th>"; } echo "</tr>"; for ($row = 0; $row < $max_rows; $row++) { echo "<tr>"; echo "<th>" . $row . "</th>"; for ($col = 0; $col < $max_cols; $col++) { $cellId = chr(0x41 + $col) . $row; echo "<td width=100 class='cell'>"; echo "<form id='form_{$cellId}' action='" . Root::i()->getVar('wroot') . "?Act=saveCell&sheet={$sheet}&cell_id={$cellId}' method='POST' onSubmit='return false;' style='margin:0; padding:0;'>"; $input_source = preg_replace("/\"/", """, MyExcel::getCellSource($sheet, $cellId)); //echo "<input name='content' class='cellinput' title='$cellId' type='text' value=\"".$input_source."\" id='$cellId' onkeypress='inputKeyPress(this, event)'>"; echo "<textarea rows='10' cols='40' name='content' class='cellinput' title='{$cellId}' type='text' id='{$cellId}' onkeypress='inputKeyPress(this, event)'>" . $input_source . "</textarea>"; echo "</form>"; echo "<div onclick='onCellClick(\"{$cellId}\")' id='{$cellId}_value' style='min-height:20px;white-space: nowrap;'>" . MyExcel::getCellValue($sheet, $cellId) . "</div>"; echo "</td>"; } echo "</tr>"; } echo "</table>"; }
<?php include ".setup.php"; Database::query("\r\nCREATE TABLE IF NOT EXISTS `myexcel` (\r\n `sheet` varchar(255) NOT NULL,\r\n `x` varchar(10) NOT NULL,\r\n `y` varchar(10) NOT NULL,\r\n `src` text,\r\n PRIMARY KEY (`sheet`,`x`,`y`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=cp1251\r\n"); header("Location: " . Root::i()->getVar('wroot'));
<?php header("Content-type: text/html; charset=utf-8"); require_once dirname(realpath(__FILE__)) . '/inc/__autoload.php'; //здесь задаётся веб-путь к phpMyExcel (по умолчанию это корень "/") Root::i()->setVar("wroot", "/"); Database::$DB_HOST = 'localhost'; Database::$DB_DATABASENAME = 'test'; Database::$DB_USER = '******'; Database::$DB_PASS = '******'; if (file_exists(dirname(__FILE__) . "/_local_settings.php")) { include dirname(__FILE__) . "/_local_settings.php"; } Database::connect(); session_start(); $auth = new HttpAuth(); $auth->authorize();