本文整理汇总了PHP中TLSmarty类的典型用法代码示例。如果您正苦于以下问题:PHP TLSmarty类的具体用法?PHP TLSmarty怎么用?PHP TLSmarty使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TLSmarty类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderGui
function renderGui(&$argsObj, &$guiObj, $templateCfg)
{
$smarty = new TLSmarty();
$smarty->assign('gui', $guiObj);
$doRender = false;
switch ($argsObj->doAction) {
case "edit":
case "create":
$doRender = true;
$tpl = $templateCfg->default_template;
break;
case "doCreate":
case "doUpdate":
if (!is_null($templateCfg->template)) {
$doRender = true;
$tpl = $templateCfg->template;
} else {
header("Location: rolesView.php?tproject_id={$guiObj->tproject_id}");
exit;
}
break;
}
if ($doRender) {
$smarty->display($templateCfg->template_dir . $tpl);
}
}
示例2: displayInfo
/**
* Display simple info and exit
*
* @param string $title
* @param string $message
*/
function displayInfo($title, $message)
{
$smarty = new TLSmarty();
$smarty->assign('title', $title);
$smarty->assign('content', $message);
$smarty->display('workAreaSimple.tpl');
exit;
}
示例3: displayInfo
/**
* Display simple info and exit
*
* @param string $title
* @param string $message
*/
function displayInfo($title, $message)
{
$smarty = new TLSmarty();
$gui = new stdClass();
$gui->title = $title;
$gui->content = $message;
$gui->hint_text = $gui->link_to_op = '';
$smarty->assign('gui', $gui);
$smarty->display('workAreaSimple.tpl');
exit;
}
示例4: renderGui
/**
*/
function renderGui(&$dbHandler, &$argsObj, $guiObj, $opObj, $templateCfg)
{
$smartyObj = new TLSmarty();
$renderType = 'none';
// key: gui action
// value: next gui action (used to set value of action button on gui)
$actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate');
// Get rendering type and set variable for template
switch ($argsObj->doAction) {
case "edit":
case "create":
case "doDelete":
case "doCreate":
case "doUpdate":
$key2loop = get_object_vars($opObj);
foreach ($key2loop as $key => $value) {
$guiObj->{$key} = $value;
}
$guiObj->operation = $actionOperation[$argsObj->doAction];
$renderType = 'redirect';
$tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
$pos = strpos($tpl, '.php');
if ($pos === false) {
$tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir;
$tpl = $tplDir . $tpl;
$renderType = 'template';
}
break;
}
// execute rendering
// new dBug($tpl);
// new dBug($guiObj);
switch ($renderType) {
case 'template':
$smartyObj->assign('gui', $guiObj);
$smartyObj->display($tpl);
break;
case 'redirect':
header("Location: {$tpl}");
exit;
break;
default:
break;
}
}
示例5: displayReport
/**
*
*
*/
function displayReport($template_file, &$smarty, $doc_format, $mailCfg = null)
{
switch ($doc_format) {
case FORMAT_HTML:
case FORMAT_ODT:
case FORMAT_ODS:
case FORMAT_XLS:
case FORMAT_MSWORD:
case FORMAT_PDF:
flushHttpHeader($doc_format, $doc_kind = 0);
break;
case FORMAT_MAIL_HTML:
$op = generateHtmlEmail($smarty, $template_file, $mailCfg);
$message = $op->status_ok ? '' : lang_get('send_mail_ko');
$smarty = new TLSmarty();
$smarty->assign('message', $message . ' ' . $op->msg);
$smarty->assign('title', $mailCfg->subject);
$template_file = "emailSent.tpl";
break;
}
$smarty->display($template_file);
}
示例6: renderGui
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg)
{
$smartyObj = new TLSmarty();
//
// key: operation requested (normally received from GUI on doAction)
// value: operation value to set on doAction HTML INPUT
// This is useful when you use same template (example xxEdit.tpl), for create and edit.
// When template is used for create -> operation: doCreate.
// When template is used for edit -> operation: doUpdate.
//
// used to set value of: $guiObj->operation
//
$actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate');
$renderType = 'none';
switch ($argsObj->doAction) {
case "edit":
case "create":
case "doDelete":
case "doCreate":
case "doUpdate":
$renderType = 'template';
$key2loop = get_object_vars($opObj);
foreach ($key2loop as $key => $value) {
$guiObj->{$key} = $value;
}
$guiObj->operation = $actionOperation[$argsObj->doAction];
$tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir;
$tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
$pos = strpos($tpl, '.php');
if ($pos === false) {
$tpl = $tplDir . $tpl;
} else {
$renderType = 'redirect';
}
break;
}
switch ($renderType) {
case 'template':
$smartyObj->assign('gui', $guiObj);
$smartyObj->display($tpl);
break;
case 'redirect':
header("Location: {$tpl}");
exit;
break;
default:
break;
}
}
示例7: while
while ($myrow = mysql_fetch_assoc($result)) {
$data[runID][$myrow['runID']] = $myrow;
$limitedRunIDs[] = $myrow['runID'];
if (!isset($machine[$myrow['runMachineID']])) {
list($ip, $client, $hostnameID, $hostname) = getMachineInfo($myrow['runID']);
$machine[$hostnameID][ip] = $ip;
$machine[$hostnameID][client] = $client;
$machine[$hostnameID][hostnameID] = $hostnameID;
$machine[$hostnameID][hostname] = $hostname;
}
$data[runID][$myrow['runID']][machineIPAddr] = $machine[$myrow['runMachineID']][ip];
$data[runID][$myrow['runID']][p4Client] = $machine[$myrow['runMachineID']][client];
$data[runID][$myrow['runID']][hostname] = $machine[$myrow['runMachineID']][hostname];
$data[runID][$myrow['runID']][scriptCount] = 0;
$data[runID][$myrow['runID']][caseCount] = 0;
$data[runID][$myrow['runID']][scripts][passed] = 0;
}
}
getTestScriptResults($data, $condition, $limitedRunIDs);
$smarty = new TLSmarty();
$smarty->assign("chosenQueueID", is_null($queueIDform) ? "" : $queueIDform);
$smarty->assign("errors", $error);
$smarty->assign("data", $data);
# note: for the href to work you will need to edit gui/javascript/highlightTableRow.js
# in order to propery set the <rowname>href attribute
$spanInfo = array(array(id => "runID", show => "yes", message => "runID", colName => "runID", tdTag => 'id="runID" width="6%"', href => 'smokeruns_ts.php?runID={$data.runID.$runID.runID}'), array(id => "versioncolumn", show => "yes", message => "Version", colName => "versionDottedQuad"), array(id => "buildcolumn", show => "yes", message => "Build", colName => "buildNum"), array(id => "purpose", show => "no", message => "Purpose", colName => "runPurpose"), array(id => "user", show => "yes", message => "User", colName => "NTID"), array(id => "total", show => "yes", message => "Total", colName => "scriptCount"), array(id => "passed", show => "yes", message => "Passed", evalColName => '{$data.runID.$runID.scripts.passed}'), array(id => "status", show => "yes", color => "yes", message => "Status", colName => "runStatus"), array(id => "machine", show => "no", message => "Where Run", colName => "hostname"), array(id => "cli", show => "no", color => "no", tdTag => 'class="cli"', message => "Command Line", colName => "runExecuteMethod"));
$smarty->assign("spaninfo", $spanInfo);
$smarty->display('smokeruns.tpl');
?>
示例8: implode
$filter['by_scope'] = " AND RS.scope like '%{$scope}%' ";
}
if ($args->custom_field_id > 0) {
//search by custom fields
$args->custom_field_id = $db->prepare_int($args->custom_field_id);
$args->custom_field_value = $db->prepare_string($args->custom_field_value);
$from['by_custom_field'] = ", {$tables['cfield_design_values']} CFD ";
$filter['by_custom_field'] = " AND CFD.field_id={$args->custom_field_id} " . " AND CFD.node_id=NH.id " . " AND CFD.value like '%{$args->custom_field_value}%' ";
}
$sql = " SELECT NH.id AS id,NH.name as name " . " FROM {$tables['nodes_hierarchy']} NH, " . " {$tables['req_specs']} RS {$from['by_custom_field']} " . " WHERE NH.id = RS.id " . " AND RS.testproject_id = {$args->tprojectID} ";
if ($filter) {
$sql .= implode("", $filter);
}
$map = $db->fetchRowsIntoMap($sql, 'id');
}
$smarty = new TLSmarty();
$gui->row_qty = count($map);
if ($gui->row_qty) {
$tpl = 'reqSpecSearchResults.tpl';
$gui->pageTitle = $gui->main_descr . " - " . lang_get('match_count') . ": " . $gui->row_qty;
$gui->resultSet = $map;
if ($gui->row_qty <= $req_cfg->search->max_qty_for_display) {
$req_set = array_keys($map);
$gui->path_info = $tproject_mgr->tree_manager->get_full_path_verbose($req_set);
} else {
$gui->warning_msg = lang_get('too_wide_search_criteria');
}
} else {
$the_tpl = config_get('tpl');
$gui->pageTitle = $gui->main_descr;
$tpl = isset($the_tpl['reqSpecSearchView']) ? $the_tpl['reqSpecSearchView'] : 'reqSpecView.tpl';
示例9: renderGui
/**
* manage GUI rendering
*
*/
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $cfgObj, $edit_steps)
{
$smartyObj = new TLSmarty();
// need by webeditor loading logic present on inc_head.tpl
$smartyObj->assign('editorType', $guiObj->editorType);
$renderType = 'none';
//
// key: operation requested (normally received from GUI on doAction)
// value: operation value to set on doAction HTML INPUT
// This is useful when you use same template (example xxEdit.tpl), for create and edit.
// When template is used for create -> operation: doCreate.
// When template is used for edit -> operation: doUpdate.
//
// used to set value of: $guiObj->operation
//
$actionOperation = array('create' => 'doCreate', 'doCreate' => 'doCreate', 'edit' => 'doUpdate', 'delete' => 'doDelete', 'doDelete' => '', 'createStep' => 'doCreateStep', 'doCreateStep' => 'doCreateStep', 'doCopyStep' => 'doUpdateStep', 'editStep' => 'doUpdateStep', 'doUpdateStep' => 'doUpdateStep', 'doDeleteStep' => '', 'doReorderSteps' => '', 'doInsertStep' => 'doUpdateStep');
$key2work = 'initWebEditorFromTemplate';
$initWebEditorFromTemplate = property_exists($opObj, $key2work) ? $opObj->{$key2work} : false;
$key2work = 'cleanUpWebEditor';
$cleanUpWebEditor = property_exists($opObj, $key2work) ? $opObj->{$key2work} : false;
$oWebEditor = createWebEditors($argsObj->basehref, $cfgObj->webEditorCfg, null, $edit_steps);
foreach ($oWebEditor->cfg as $key => $value) {
$of =& $oWebEditor->editor[$key];
$rows = $oWebEditor->cfg[$key]['rows'];
$cols = $oWebEditor->cfg[$key]['cols'];
switch ($argsObj->doAction) {
case "edit":
case "delete":
case "editStep":
$initWebEditorFromTemplate = false;
$of->Value = $argsObj->{$key};
break;
case "doCreate":
case "doDelete":
case "doCopyStep":
case "doUpdateStep":
$initWebEditorFromTemplate = false;
$of->Value = $argsObj->{$key};
break;
case "create":
case "doCreateStep":
case "doInsertStep":
default:
$initWebEditorFromTemplate = true;
break;
}
$guiObj->operation = $actionOperation[$argsObj->doAction];
if ($initWebEditorFromTemplate) {
$of->Value = getItemTemplateContents('testcase_template', $of->InstanceName, '');
} else {
if ($cleanUpWebEditor) {
$of->Value = '';
}
}
$smartyObj->assign($key, $of->CreateHTML($rows, $cols));
}
// manage tree refresh
switch ($argsObj->doAction) {
case "doDelete":
$guiObj->refreshTree = $argsObj->refreshTree;
break;
}
switch ($argsObj->doAction) {
case "edit":
case "create":
case "delete":
case "createStep":
case "editStep":
case "doCreate":
case "doDelete":
case "doCreateStep":
case "doUpdateStep":
case "doDeleteStep":
case "doReorderSteps":
case "doCopyStep":
case "doInsertStep":
$renderType = 'template';
// Document !!!!
$key2loop = get_object_vars($opObj);
foreach ($key2loop as $key => $value) {
$guiObj->{$key} = $value;
}
$guiObj->operation = $actionOperation[$argsObj->doAction];
new dBug($opObj);
$tplDir = !isset($opObj->template_dir) || is_null($opObj->template_dir) ? $templateCfg->template_dir : $opObj->template_dir;
$tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
$pos = strpos($tpl, '.php');
if ($pos === false) {
$tpl = $tplDir . $tpl;
} else {
$renderType = 'redirect';
}
break;
}
switch ($renderType) {
case 'template':
//.........这里部分代码省略.........
示例10: testlinkInitPage
require_once "common.php";
require_once "csv.inc.php";
require_once "xml.inc.php";
testlinkInitPage($db, false, false, "checkRights");
$templateCfg = templateConfiguration();
$args = init_args();
switch ($args->doAction) {
case "do_export":
$op = do_export($db, $smarty, $args);
break;
}
$keyword = new tlKeyword();
$exportTypes = $keyword->getSupportedSerializationInterfaces();
$main_descr = lang_get('testproject') . TITLE_SEP . $args->testproject_name;
$fileName = is_null($args->export_filename) ? 'keywords.xml' : $args->export_filename;
$smarty = new TLSmarty();
$smarty->assign('export_filename', $fileName);
$smarty->assign('main_descr', $main_descr);
$smarty->assign('action_descr', lang_get('export_keywords'));
$smarty->assign('exportTypes', $exportTypes);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function init_args()
{
$iParams = array("doAction" => array("GET", tlInputParameter::STRING_N, 0, 50), "export_filename" => array("POST", tlInputParameter::STRING_N, 0, 255), "exportType" => array("POST", tlInputParameter::STRING_N, 0, 255));
$args = new stdClass();
$pParams = I_PARAMS($iParams, $args);
$args->testproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$args->testproject_name = $_SESSION['testprojectName'];
return $args;
}
/*
示例11: setcookie
} else {
// general role applied
$testprojectRole = $args->user->globalRole->getDisplayName();
}
$gui->whoami = $args->user->getDisplayName() . ' ' . $tlCfg->gui->role_separator_open . $testprojectRole . $tlCfg->gui->role_separator_close;
// only when the user has changed project using the combo the _GET has this key.
// Use this clue to launch a refresh of other frames present on the screen
// using the onload HTML body attribute
$gui->updateMainPage = 0;
if ($args->testproject) {
$gui->updateMainPage = 1;
// set test project ID for the next session
setcookie('TL_lastTestProjectForUserID_' . $args->user->dbID, $args->testproject, TL_COOKIE_KEEPTIME, '/');
}
$gui->grants = getGrants($db, $args->user);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display('navBar.tpl');
/**
*
*/
function getGrants(&$db, &$userObj)
{
$grants = new stdClass();
$grants->view_testcase_spec = $userObj->hasRight($db, "mgt_view_tc");
return $grants;
}
function init_args()
{
$iParams = array("testproject" => array(tlInputParameter::INT_N));
$args = new stdClass();
示例12: testlinkInitPage
* @filesource tcSearch.php
* @package TestLink
* @author TestLink community
* @copyright 2007-2015, TestLink community
* @link http://www.testlink.org/
*
*
* @internal revisions
* @since 1.9.15
**/
require_once "../../config.inc.php";
require_once "common.php";
require_once 'exttable.class.php';
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$smarty = new TLSmarty();
$tpl = 'tcSearchResults.tpl';
$tproject_mgr = new testproject($db);
$tcase_mgr = new testcase($db);
$tcase_cfg = config_get('testcase_cfg');
$charset = config_get('charset');
$filter = null;
list($args, $filter) = init_args($tproject_mgr);
$ga = initializeGui($args, $tproject_mgr);
$gx = $tcase_mgr->getTcSearchSkeleton($args);
$gui = (object) array_merge((array) $ga, (array) $gx);
initSearch($gui, $args, $tproject_mgr);
$map = null;
if ($args->tprojectID && $args->doAction == 'doSearch') {
$tables = tlObjectWithDB::getDBTables(array('cfield_design_values', 'nodes_hierarchy', 'requirements', 'req_coverage', 'tcsteps', 'testcase_keywords', 'tcversions', 'users'));
$gui->tcasePrefix = $tproject_mgr->getTestCasePrefix($args->tprojectID);
示例13: isset
$buildid = isset($_GET['buildid']) ? $_GET['buildid'] : 1;
$deviceid = isset($_GET['deviceid']) ? $_GET['deviceid'] : 1;
$topotype = isset($_GET['topotype']) ? $_GET['topotype'] : 999;
$suite = isset($_GET['suite']) ? $_GET['suite'] : 1;
$gui->saveresult = 2;
if ($needsave == 1) {
$result = isset($_POST['result']) ? $_POST['result'] : 'none';
$result_summary = isset($_POST['result_summary']) ? $_POST['result_summary'] : '';
$reviewer = isset($_POST['reviewer']) ? $_POST['reviewer'] : '';
$review_summary = isset($_POST['review_summary']) ? $_POST['review_summary'] : '';
$result_report = isset($_POST['result_report']) ? $_POST['result_report'] : '';
$gui->saveresult = $tplan_mgr->setTestResult($tplanid, $deviceid, $buildid, $topotype, $suite, $result, $result_summary, $reviewer, $review_summary, $result_report);
}
$gui->reviewers = $tplan_mgr->get_review_users();
$dcnresult = $tplan_mgr->getTestResult($tplanid, $deviceid, $buildid, $topotype, $suite);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('tplanid', $tplanid);
$smarty->assign('buildid', $buildid);
$smarty->assign('deviceid', $deviceid);
$smarty->assign('topotype', $topotype);
$smarty->assign('suite', $suite);
$smarty->assign('result', $dcnresult);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function init_args()
{
$args = new stdClass();
$args->testproject_id = isset($_SESSION['testprojectID']) ? $_SESSION['testprojectID'] : 0;
$args->currentUser = $_SESSION['currentUser'];
$args->username = $_SESSION['currentUser']->getDisplayName();
return $args;
示例14: array
$filters = null;
$options = array('output' => 'map', 'only_executed' => true, 'execution_details' => 'add_build');
$execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
$options = array('output' => 'mapOfArray', 'only_executed' => true, 'execution_details' => 'add_build');
$execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
$options = array('output' => 'mapOfMap', 'only_executed' => true, 'execution_details' => 'add_build');
$execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
$options = array('output' => 'array', 'only_executed' => true, 'execution_details' => 'add_build');
$execResults = $tplan_mgr->get_linked_tcversions($args->tplan_id, $filters, $options);
$milestonesList = $tplan_mgr->get_milestones($args->tplan_id);
if (!empty($milestonesList)) {
$gui->statistics->milestones = $metricsMgr->getMilestonesMetrics($args->tplan_id, $milestonesList);
}
}
// ----------------------------------------------------------------------------
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('buildColDefinition', $colDefinition);
$smarty->assign('buildResults', $results);
displayReport($templateCfg->template_dir . $templateCfg->default_template, $smarty, $args->format, $mailCfg);
/*
function: init_args
args: none
returns: array
*/
function init_args()
{
$iParams = array("tplan_id" => array(tlInputParameter::INT_N), "format" => array(tlInputParameter::INT_N));
$args = new stdClass();
$pParams = G_PARAMS($iParams, $args);
$args->tproject_id = $_SESSION['testprojectID'];
示例15: show_instructions
show_instructions('tc_exec_assignment');
break;
}
$gui->items = $out['spec_view'];
// useful to avoid error messages on smarty template.
$gui->items_qty = is_null($gui->items) ? 0 : count($gui->items);
$gui->has_tc = $out['num_tc'] > 0 ? 1 : 0;
$gui->support_array = array_keys($gui->items);
if ($_SESSION['testprojectOptions']->testPriorityEnabled) {
$urgencyCfg = config_get('urgency');
$gui->priority_labels = init_labels($urgencyCfg["code_label"]);
}
// Changing to _flat template
$tpl = $templateCfg->template_dir . $templateCfg->default_template;
$tpl = str_replace('.tpl', '_flat.tpl', $tpl);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($tpl);
/*
function:
args :
returns:
*/
function init_args()
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$args = new stdClass();
$args->user_id = intval($_SESSION['userID']);
$args->tproject_id = intval($_SESSION['testprojectID']);
$args->tproject_name = $_SESSION['testprojectName'];