本文整理汇总了PHP中TLSmarty::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP TLSmarty::assign方法的具体用法?PHP TLSmarty::assign怎么用?PHP TLSmarty::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLSmarty
的用法示例。
在下文中一共展示了TLSmarty::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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);
}
}
示例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: 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);
}
示例5: 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;
}
}
示例6: 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');
?>
示例7: 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':
//.........这里部分代码省略.........
示例8: init_args
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;
}
/*
function: do_export
示例9: initializeGui
*
**/
require_once '../../config.inc.php';
require_once 'common.php';
require_once "users.inc.php";
require_once 'treeMenu.inc.php';
require_once 'exec.inc.php';
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$chronos[] = $tstart = microtime(true);
$control = new tlTestCaseFilterControl($db, 'execution_mode');
$control->formAction = '';
$gui = initializeGui($control);
$control->build_tree_menu($gui);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('control', $control);
$smarty->assign('menuUrl', $gui->menuUrl);
$smarty->assign('args', $gui->args);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
*
*
*/
function initializeGui(&$control)
{
$gui = new stdClass();
// This logic is managed from execSetResults.php
$gui->loadExecDashboard = true;
if (isset($_SESSION['loadExecDashboard'][$control->form_token]) || $control->args->loadExecDashboard == 0) {
$gui->loadExecDashboard = false;
示例10: init_args
header("Location: keywordsView.php");
exit;
}
}
@unlink($dest);
}
} else {
$msg = lang_get('please_choose_keywords_file');
}
}
$tlKeyword = new tlKeyword();
$importTypes = $tlKeyword->getSupportedSerializationInterfaces();
$formatStrings = $tlKeyword->getSupportedSerializationFormatDescriptions();
$file_size_limit = config_get('import_file_max_size_bytes');
$smarty = new TLSmarty();
$smarty->assign('import_type_selected', $args->importType);
$smarty->assign('msg', $msg);
$smarty->assign('keywordFormatStrings', $formatStrings);
$smarty->assign('importTypes', $importTypes);
$smarty->assign('tproject_name', $args->testproject_name);
$smarty->assign('tproject_id', $args->testproject_id);
$smarty->assign('fileSizeLimitMsg', sprintf(lang_get('max_file_size_is'), $file_size_limit / 1024 . ' KB '));
$smarty->assign('importLimit', $file_size_limit);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
* @return object returns the arguments for the page
*/
function init_args()
{
$iParams = array("UploadFile" => array(tlInputParameter::STRING_N, 0, 1), "importType" => array(tlInputParameter::STRING_N, 0, 100));
$args = new stdClass();
示例11: init_args
}
}
$gui->loginHistory = new stdClass();
$gui->loginHistory->failed = $g_tlLogger->getAuditEventsFor($args->userID, "users", "LOGIN_FAILED", 10);
$gui->loginHistory->ok = $g_tlLogger->getAuditEventsFor($args->userID, "users", "LOGIN", 10);
if ($op->status != tl::OK) {
$op->user_feedback = getUserErrorMessage($op->status);
}
$user->readFromDB($db);
// set a string if not generated key yet
if (null == $user->userApiKey) {
$user->userApiKey = TLS('none');
}
$gui->user_feedback = $op->user_feedback;
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('user', $user);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function init_args()
{
$_REQUEST = strings_stripSlashes($_REQUEST);
$iParams = array("firstName" => array("POST", tlInputParameter::STRING_N, 0, 30), "lastName" => array("REQUEST", tlInputParameter::STRING_N, 0, 30), "emailAddress" => array("REQUEST", tlInputParameter::STRING_N, 0, 100), "locale" => array("POST", tlInputParameter::STRING_N, 0, 10), "oldpassword" => array("POST", tlInputParameter::STRING_N, 0, 32), "newpassword" => array("POST", tlInputParameter::STRING_N, 0, 32), "doAction" => array("POST", tlInputParameter::STRING_N, 0, 15, null, 'checkDoAction'));
$pParams = I_PARAMS($iParams);
$args = new stdClass();
$args->user = new stdClass();
$args->user->firstName = $pParams["firstName"];
$args->user->lastName = $pParams["lastName"];
$args->user->emailAddress = $pParams["emailAddress"];
$args->user->locale = $pParams["locale"];
$args->oldpassword = $pParams["oldpassword"];
$args->newpassword = $pParams["newpassword"];
示例12: initializeGui
* added custom field filtering logic
* 20091210 - franciscom - test case execution type filter
* 20090308 - franciscom - added option Any in keywords filter
* 20090210 - BUGID 2062 - franciscom -
*/
require_once '../../config.inc.php';
require_once "common.php";
require_once "treeMenu.inc.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
// new class for filter controlling/handling
$control = new tlTestCaseFilterControl($db, 'edit_mode');
$gui = initializeGui($db, $control);
$control->build_tree_menu($gui);
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->assign('control', $control);
$smarty->assign('args', $control->get_argument_string());
$smarty->assign('menuUrl', $gui->menuUrl);
$smarty->display($templateCfg->template_dir . 'tcTree.tpl');
/**
* Initialize object with information for graphical user interface.
*
* @param tlTestCaseFilterControl $control
* @return stdClass $gui
*/
function initializeGui(&$dbHandler, &$control)
{
$gui = new stdClass();
$gui->feature = $control->args->feature;
$gui->treeHeader = lang_get('title_navigator') . ' - ' . lang_get('title_test_spec');
示例13: init_args
$tplan_mgr = new testplan($db);
$dmy = $tplan_mgr->get_by_id($context->tplan_id);
$gui->buildInfoSet = $tplan_mgr->get_builds($gui->tplan_id);
$report_plans = $tplan_mgr->report_get_plans($args->tproject_id);
$report_suites = $tplan_mgr->report_get_suites($args->tproject_id);
$report_builds = $tplan_mgr->report_get_builds();
$report_build_total = count($report_builds);
$report_devices = $tplan_mgr->report_get_devices($args->tproject_id);
$report_device_total = count($report_devices);
unset($tplan_mgr);
$context->apikey = $dmy['api_key'];
// $context->apikey = $_SESSION['currentUser']->userApiKey;
$context->imgSet = $smarty->getImages();
$gui->menuItems = $reports_mgr->get_list_reports($context, $gui->btsEnabled, $args->optReqs, $tlCfg->reports_formats[$args->format]);
}
$smarty->assign('gui', $gui);
$smarty->assign('report_plans', $report_plans);
$smarty->assign('report_suites', $report_suites);
$smarty->assign('report_builds', json_encode($report_builds));
$smarty->assign('report_build_total', $report_build_total);
$smarty->assign('report_devices', json_encode($report_devices));
$smarty->assign('report_device_total', $report_device_total);
$smarty->assign('arrReportTypes', localize_array($tlCfg->reports_formats));
$smarty->assign('selectedReportType', $args->format);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
*
*
*/
function init_args()
{
示例14: krsort
krsort($rel[builds], SORT_NUMERIC);
foreach ($rel[builds] as $buildID => $build) {
$releaseTablesReg[releases][$name][buildTables][$buildID] = createGrenRegBuildTable($build, $buildID, $arr[1]);
$buildCountID++;
$regCount++;
}
$releaseTablesReg[releases][$name][releaseTable] = createReleaseTable($rel, $name, $relCountID, count($rel[builds]), $regCount);
$buildCountID = 0;
$releaseTablesReg[releases][$name][countID] = $relCountID;
$relCountID++;
}
krsort($releaseTablesReg[releases], SORT_NUMERIC);
}
/////////////////////////////////////////////////////////////////////////////
$smarty = new TLSmarty();
$smarty->assign('releaseTables', $releaseTables);
$smarty->assign('releaseTablesReg', $releaseTablesReg);
$smarty->assign('releaseCount', count($arrData));
$smarty->assign('releaseCountReg', count($arrDataReg));
$smarty->assign('startRegID', 50);
$smarty->assign('valid_user', $arr[0]);
$smarty->assign('none', $arr[1]);
$smarty->assign('userString', $arr[2]);
$smarty->assign('to', $to);
$smarty->assign('from', $from);
$smarty->assign('noNext', $noNext);
$smarty->assign('searchPHP', "search.php");
$smarty->assign('submitPHP', "gren.php");
$smarty->assign('totalColLabel', "Total Smoke Runs");
$smarty->assign('columnHide', "");
$smarty->assign('columnCount', "11");
示例15: renderGui
/**
* renderGui
*
*/
function renderGui(&$argsObj, $guiObj, $opObj, $templateCfg, $editorCfg)
{
$smartyObj = new TLSmarty();
$renderType = 'none';
$tpl = $tpd = null;
$actionOperation = array('create' => 'doCreate', 'edit' => 'doUpdate', 'doDelete' => '', 'doReorder' => '', 'reorder' => '', 'doCreate' => 'doCreate', 'doUpdate' => 'doUpdate', 'createChild' => 'doCreate', 'copy' => 'doCopy', 'doCopy' => 'doCopy', 'copyRequirements' => 'doCopyRequirements', 'doCopyRequirements' => 'doCopyRequirements');
$owebEditor = web_editor('scope', $argsObj->basehref, $editorCfg);
switch ($argsObj->doAction) {
case "edit":
case "doCreate":
$owebEditor->Value = $argsObj->scope;
break;
default:
$owebEditor->Value = getItemTemplateContents('req_spec_template', $owebEditor->InstanceName, $argsObj->scope);
break;
}
$guiObj->scope = $owebEditor->CreateHTML();
$guiObj->editorType = $editorCfg['type'];
// 20100808 - aismon - added logic to refresh filtered tree on action
switch ($argsObj->doAction) {
case "doCreate":
case "doUpdate":
case "doCopyRequirements":
case "doCopy":
case "doDelete":
$guiObj->refreshTree = $argsObj->refreshTree;
break;
}
switch ($argsObj->doAction) {
case "edit":
case "create":
case "createChild":
case "reorder":
case "doDelete":
case "doReorder":
case "doCreate":
case "doUpdate":
case "copyRequirements":
case "doCopyRequirements":
case "copy":
case "doCopy":
$renderType = 'template';
$key2loop = get_object_vars($opObj);
foreach ($key2loop as $key => $value) {
$guiObj->{$key} = $value;
}
$guiObj->operation = $actionOperation[$argsObj->doAction];
$tpl = is_null($opObj->template) ? $templateCfg->default_template : $opObj->template;
$tpd = isset($key2loop['template_dir']) ? $opObj->template_dir : $templateCfg->template_dir;
break;
}
switch ($argsObj->doAction) {
case "edit":
case "create":
case "createChild":
case "reorder":
case "doDelete":
case "doReorder":
case "copyRequirements":
case "copy":
$tpl = $tpd . $tpl;
break;
case "doCreate":
case "doUpdate":
case "doCopyRequirements":
case "doCopy":
$pos = strpos($tpl, '.php');
if ($pos === false) {
$tpl = $templateCfg->template_dir . $tpl;
} else {
$renderType = 'redirect';
}
break;
}
switch ($renderType) {
case 'template':
$smartyObj->assign('mgt_view_events', has_rights($db, "mgt_view_events"));
$smartyObj->assign('gui', $guiObj);
$smartyObj->display($tpl);
break;
case 'redirect':
header("Location: {$tpl}");
exit;
break;
default:
break;
}
}