本文整理汇总了PHP中clsTinyButStrong::PlugIn方法的典型用法代码示例。如果您正苦于以下问题:PHP clsTinyButStrong::PlugIn方法的具体用法?PHP clsTinyButStrong::PlugIn怎么用?PHP clsTinyButStrong::PlugIn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类clsTinyButStrong
的用法示例。
在下文中一共展示了clsTinyButStrong::PlugIn方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Select slide #2
$TBS->Plugin(OPENTBS_SELECT_SLIDE, 2);
// Change a picture using the command (it can also be done at the template side using parameter "ope=changepic")
$TBS->Plugin(OPENTBS_CHANGE_PICTURE, '#merge_me#', 'pic_1234f.png');
// Merge a chart
$ChartRef = 'my_chart';
// Title of the shape that embeds the chart
$SeriesNameOrNum = 1;
$NewValues = array(array('Cat. A', 'Cat. B', 'Cat. C', 'Cat. D'), array(0.7, 1.0, 3.2, 4.8));
$NewLegend = "Merged";
$TBS->PlugIn(OPENTBS_CHART, $ChartRef, $SeriesNameOrNum, $NewValues, $NewLegend);
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_' . date('Y-m-d') . $save_as . '.', $template);
if ($save_as === '') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Also merges all [onshow] automatic fields.
} else {
// Output the result as a file on the server
$TBS->Show(OPENTBS_FILE + TBS_EXIT, $output_file_name);
// Also merges all [onshow] automatic fields.
}
示例2: clsTinyButStrong
<?php
include_once 'tbs_class.php';
$TBS = new clsTinyButStrong();
include_once 'tbs_plugin_cache.php';
// Load the Cache System library
$TBS->PlugIn(TBS_INSTALL, TBS_CACHE, dirname(__FILE__));
// Install the plug-in
// Call the Cache System which is deciding wheter to continue and store the result into a cache file, or to display a cached page.
if ($TBS->PlugIn(TBS_CACHE, 'testcache', 10)) {
} else {
$TBS->LoadTemplate('tbs_us_examples_cache.htm');
$TBS->Show();
}
示例3: isset
// Display the intented XML of the current sub-file, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'info') {
$TBS->Plugin(OPENTBS_DEBUG_INFO, true);
}
// Display information about the document, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'show') {
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Merge data in a table (there is no need to select the slide with an ODP)
$TBS->MergeBlock('b', $data);
// Hide a slide
$TBS->PlugIn(OPENTBS_DISPLAY_SLIDES, 'slide to hide', false);
// Delete a slide
$TBS->PlugIn(OPENTBS_DELETE_SLIDES, 'slide to delete');
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_' . date('Y-m-d') . $save_as . '.', $template);
if ($save_as === '') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Also merges all [onshow] automatic fields.
} else {
// Output the result as a file on the server
$TBS->Show(OPENTBS_FILE + TBS_EXIT, $output_file_name);
示例4: array
if (isset($_POST['debug']) && $_POST['debug'] == 'show') {
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Merge data in the body of the document
$TBS->MergeBlock('a,b', $data);
// Change chart series
$ChartNameOrNum = 'a nice chart';
// Title of the shape that embeds the chart
$SeriesNameOrNum = 'Series 2';
$NewValues = array(array('Category A', 'Category B', 'Category C', 'Category D'), array(3, 1.1, 4.0, 3.3));
$NewLegend = "Updated series 2";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);
// Delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_' . date('Y-m-d') . $save_as . '.', $template);
if ($save_as === '') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Also merges all [onshow] automatic fields.
} else {
// Output the result as a file on the server
$TBS->Show(OPENTBS_FILE + TBS_EXIT, $output_file_name);
示例5: date
$fecha = date('d/m/Y');
// Load the template
$TBS->LoadTemplate($template);
if ($debug == 2) {
// debug mode 2
$TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT);
exit;
} elseif ($debug == 1) {
// debug mode 1
$TBS->Plugin(OPENTBS_DEBUG_INFO);
exit;
}
$TBS->MergeBlock('a', $data);
// Define the name of the output file
// delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);
$file_name = str_replace('.', '_' . date('Y-m-d') . '.', $template);
// Output as a download file (some automatic fields are merged here)
if ($debug == 3) {
// debug mode 3
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
} elseif ($suffix === '') {
// download
$TBS->Show(OPENTBS_DOWNLOAD, $file_name);
} else {
// save as file
$file_name = str_replace('.', '_' . $suffix . '.', $file_name);
$TBS->Show(OPENTBS_FILE + TBS_EXIT, $file_name);
}
} else {
print_r($_POST);
示例6: isset
$TBS->Plugin(OPENTBS_DEBUG_INFO, true);
}
// Display information about the document, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'show') {
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Merge data in the first sheet
$TBS->MergeBlock('a,b', $data);
// Merge cells (extending columns)
$TBS->MergeBlock('cell1,cell2', $data);
// Change the current sheet
$TBS->PlugIn(OPENTBS_SELECT_SHEET, 2);
// Merge data in Sheet 2
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Merge pictures of the current sheet
$x_picture = 'pic_1523d.gif';
$TBS->PlugIn(OPENTBS_MERGE_SPECIAL_ITEMS);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet (make it visible)
$TBS->PlugIn(OPENTBS_DISPLAY_SHEETS, 'Display me');
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
示例7: array
$data[] = array('product' => 'Harmonica', 'price' => 5.99);
$data[] = array('product' => 'Bass', 'price' => 189.0);
$data[] = array('product' => 'Harp', 'price' => 199.0);
$data[] = array('product' => 'Violin', 'price' => 64.95);
$data[] = array('product' => 'Bagpipes', 'price' => 129.0);
$data[] = array('product' => 'Ukulele', 'price' => 48.0);
// Default value
if (!isset($_GET)) {
$_GET =& $HTTP_GET_VARS;
}
if (isset($_GET['PageNum'])) {
$PageNum = $_GET['PageNum'];
} else {
$PageNum = 1;
}
// Default value
if (isset($_GET['RecCnt'])) {
$RecCnt = intval($_GET['RecCnt']);
} else {
$RecCnt = -1;
}
$PageSize = 5;
$TBS = new clsTinyButStrong();
$TBS->LoadTemplate('tbs_us_examples_page.htm');
// Merge the block by page
$TBS->PlugIn(TBS_BYPAGE, $PageSize, $PageNum, $RecCnt);
// Next block will be merged suing By-Page mode.
$RecCnt = $TBS->MergeBlock('blk', $data);
// Merge the Navigation Bar
$TBS->PlugIn(TBS_NAVBAR, 'nv', '', $PageNum, $RecCnt, $PageSize);
$TBS->Show();
示例8: download
public static function download($fileNameResource, $extResource, $fileNameResult, $data, $mode = [])
{
$fileNameResult = $fileNameResult . '.' . $extResource;
# checking tmp directory for save result
$assetsPath = Setting::getAssetPath();
$tmpDir = $assetsPath . DIRECTORY_SEPARATOR . "exports";
if (!is_dir($tmpDir)) {
mkdir($tmpDir, 0777, TRUE);
}
# checking fileNameResourse
$fileNameResourceExplode = explode('.', $fileNameResource);
if (count($fileNameResourceExplode) == 2) {
$pathResources = Yii::getPathOfAlias('app.modules.' . $fileNameResourceExplode[0] . '.reports.' . $fileNameResourceExplode[1]);
} else {
$pathResources = Yii::getPathOfAlias('app.reports.' . $fileNameResourceExplode[0]);
}
$pathResources .= '.' . $extResource;
if (file_exists($pathResources) != true) {
// throw new CDbException('The specified file cannot be found.');
echo 'The specified file cannot be found.';
exit;
}
$allow_ext = array('odt', 'ods', 'odp', 'odg', 'odf', 'docx', 'xlsx', 'pptx');
if (!in_array($extResource, $allow_ext)) {
echo 'Extension File yang diijinkan hanya [odt, ods, odp, odg, odf, docx, xlsx, pptx]';
exit;
}
// spl_autoload_unregister(array('YiiBase','autoload'));
// Include classes
require_once Yii::getPathOfAlias('ext.ertong.tbs.opentbs.demo.tbs_class') . '.php';
require_once Yii::getPathOfAlias('ext.ertong.tbs.opentbs.tbs_plugin_opentbs') . '.php';
// spl_autoload_register(array('YiiBase','autoload'));
// prevent from a PHP configuration problem when using mktime() and date()
if (version_compare(PHP_VERSION, '5.1.0') >= 0) {
if (ini_get('date.timezone') == '') {
date_default_timezone_set('UTC');
}
}
// Initialize the TBS instance
$TBS = new clsTinyButStrong();
// new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
// load the OpenTBS plugin
$template = $pathResources;
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
// Also merge some [onload] automatic fields (depends of the type of document).
# get Key of array data
foreach (array_keys($data) as $key) {
$TBS->MergeBlock($key, $data[$key]);
}
if (isset($mode['x_picture'])) {
$x_picture = $mode['x_picture'];
$TBS->PlugIn(OPENTBS_MERGE_SPECIAL_ITEMS);
}
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
$output_file_name = $fileNameResult;
if ($save_as === '') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Be sure that no more output is done, otherwise the download file is corrupted with extra data.
exit;
} else {
// Output the result as a file on the server.
$TBS->Show(OPENTBS_FILE, $output_file_name);
// Also merges all [onshow] automatic fields.
// The script can continue.
exit("File [{$output_file_name}] has been created.");
}
}
示例9: isset
// Display information about the document, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'show') {
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Merge data in the Workbook (all sheets)
$TBS->MergeBlock('a,b', $data);
// Merge data in Sheet 2
// No need to change the current sheet, they are all stored in the same XML subfile.
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet (make it visible)
$TBS->PlugIn(OPENTBS_DISPLAY_SHEETS, 'Display me');
// -----------------
// Output the result
// -----------------
// Define the name of the output file
$save_as = isset($_POST['save_as']) && trim($_POST['save_as']) !== '' && $_SERVER['SERVER_NAME'] == 'localhost' ? trim($_POST['save_as']) : '';
$output_file_name = str_replace('.', '_' . date('Y-m-d') . $save_as . '.', $template);
if ($save_as === '') {
// Output the result as a downloadable file (only streaming, no data saved in the server)
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Also merges all [onshow] automatic fields.
// Be sure that no more output is done, otherwise the download file is corrupted with extra data.
exit;
} else {
示例10: elseif
// debug mode 2
$TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT);
exit;
} elseif ($debug == 1) {
// debug mode 1
$TBS->Plugin(OPENTBS_DEBUG_INFO);
exit;
}
// Merge data
$TBS->MergeBlock('a,b', $data);
// specific merges depending to the document
if ($template_ext == 'xlsx') {
// merge cells (exending columns)
$TBS->MergeBlock('cell1,cell2', $data);
// change the current sheet
$TBS->PlugIn(OPENTBS_SELECT_SHEET, 2);
// merge data in Sheet 2
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet
$TBS->PlugIn(OPENTBS_DISPLAY_SHEETS, 'Display me');
} elseif ($template_ext == 'ods') {
// no need to change the current sheet, they are all stored in the same XML subfile.
// merge data in Sheet 2
$TBS->MergeBlock('cell1,cell2', 'num', 3);
$TBS->MergeBlock('b2', $data);
// Delete a sheet
$TBS->PlugIn(OPENTBS_DELETE_SHEETS, 'Delete me');
// Display a sheet
示例11: pruebatbswordAction
public function pruebatbswordAction($value = '')
{
$this->view->disable();
// Include classes
include_once 'tbs_us/tbs_class.php';
// Load the TinyButStrong template engine
include_once 'tbs_us/tbs_plugin_opentbs/tbs_plugin_opentbs.php';
// Load the OpenTBS plugin
// Initialize the TBS instance
$TBS = new clsTinyButStrong();
// new instance of TBS
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
// load the OpenTBS plugin
// ------------------------------
// Prepare some data for the demo
// ------------------------------
// Retrieve the user name to display
// $yourname = "Luis Freddy Velasco Poma";
$TBS->VarRef['yourname'] = "Nelica Blanco";
// $yourname = trim(''.$yourname);
// if ($yourname=='') $yourname = "(no name)";
// A recordset for merging tables
$data = array();
$data[] = array('rank' => 'A', 'firstname' => 'Marco', 'name' => 'Hill', 'number' => '1523d', 'score' => 200, 'email_1' => 'sh@tbs.com', 'email_2' => 'sandra@tbs.com', 'email_3' => 's.hill@tbs.com');
$data[] = array('rank' => 'A', 'firstname' => 'Fernando', 'name' => 'Smith', 'number' => '1234f', 'score' => 800, 'email_1' => 'rs@tbs.com', 'email_2' => 'robert@tbs.com', 'email_3' => 'r.smith@tbs.com');
$data[] = array('rank' => 'B', 'firstname' => 'Nelica', 'name' => 'Mac Dowell', 'number' => '5491y', 'score' => 130, 'email_1' => 'wmc@tbs.com', 'email_2' => 'william@tbs.com', 'email_3' => 'w.m.dowell@tbs.com');
// Other single data items
$x_num = 3152.456;
$x_pc = 0.2567;
$x_dt = mktime(13, 0, 0, 2, 15, 2010);
$x_bt = true;
$x_bf = false;
$TBS->VarRef['x_delete'] = 1;
// $x_delete = 1;
// -----------------
// Load the template
// -----------------
// $template = 'demo_ms_word.docx';
$template = 'file/template/demo_ms_word.docx';
$TBS->LoadTemplate($template, OPENTBS_ALREADY_UTF8);
// Also merge some [onload] automatic fields (depends of the type of document).
// ----------------------
// Debug mode of the demo
// ----------------------
if (isset($_POST['debug']) && $_POST['debug'] == 'current') {
$TBS->Plugin(OPENTBS_DEBUG_XML_CURRENT, true);
}
// Display the intented XML of the current sub-file, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'info') {
$TBS->Plugin(OPENTBS_DEBUG_INFO, true);
}
// Display information about the document, and exit.
if (isset($_POST['debug']) && $_POST['debug'] == 'show') {
$TBS->Plugin(OPENTBS_DEBUG_XML_SHOW);
}
// Tells TBS to display information when the document is merged. No exit.
// --------------------------------------------
// Merging and other operations on the template
// --------------------------------------------
// Merge data in the body of the document
$TBS->MergeBlock('a,b', $data);
// Merge data in colmuns
$data = array(array('date' => '2013-10-13', 'thin' => 156, 'heavy' => 128, 'total' => 284), array('date' => '2013-10-14', 'thin' => 233, 'heavy' => 25, 'total' => 284), array('date' => '2013-10-15', 'thin' => 110, 'heavy' => 412, 'total' => 130), array('date' => '2013-10-16', 'thin' => 258, 'heavy' => 522, 'total' => 258));
$TBS->MergeBlock('c', $data);
// Change chart series
$ChartNameOrNum = 'a nice chart';
// Title of the shape that embeds the chart
$SeriesNameOrNum = 'Series 2';
$NewValues = array(array('Category A', 'Category B', 'Category C', 'Category D'), array(3, 1.1, 4.0, 3.3));
$NewLegend = "Updated series 2";
$TBS->PlugIn(OPENTBS_CHART, $ChartNameOrNum, $SeriesNameOrNum, $NewValues, $NewLegend);
// Delete comments
$TBS->PlugIn(OPENTBS_DELETE_COMMENTS);
// -----------------
// Output the result
// -----------------
$output_file_name = str_replace('.', '_' . date('Y-m-d') . '.', $template);
$TBS->Show(OPENTBS_DOWNLOAD, $output_file_name);
// Also merges all [onshow] automatic fields.
exit;
}
示例12: clsTinyButStrong
<h2>OpenTBS xlsx with merged cells</h2>
<a href="template.xlsx">Template file</a>
<a href="output.xlsx">Output file</a>
<?php
require_once 'tbs_class.php';
require_once 'tbs_plugin_opentbs.php';
$TBS = new clsTinyButStrong();
$TBS->Plugin(TBS_INSTALL, OPENTBS_PLUGIN);
$data = array();
for ($i = 0; $i < 20; $i++) {
$data[$i] = array('num' => $i + 1, 'name' => 'Name ' . time(), 'val' => rand() / 1000);
}
$template = 'template.xlsx';
if (!file_exists($template)) {
echo "file {$template} not found";
}
$TBS->LoadTemplate($template);
//$TBS->PlugIn(OPENTBS_DEBUG_INFO);
//$TBS->PlugIn(OPENTBS_DEBUG_XML_CURRENT);
$TBS->PlugIn(OPENTBS_SELECT_SHEET, 1);
$TBS->MergeBlock('a', $data);
$TBS->PlugIn(OPENTBS_MERGE_CELLS);
$filename = "output.xlsx";
$TBS->Show(OPENTBS_FILE + TBS_EXIT, $filename);
//$TBS->Show(OPENTBS_DOWNLOAD+TBS_EXIT, $filename);