本文整理汇总了PHP中Template::Set方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::Set方法的具体用法?PHP Template::Set怎么用?PHP Template::Set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::Set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: RadioInput
public function RadioInput($sName, $sId, $sLabel, $vValue, $vDefault)
{
$oTemplate = new Template('radio-input.php', '', ConfigHelper::Get('/template/paths'));
$oTemplate->Set('name', $sName);
$oTemplate->Set('id', $sId);
$oTemplate->Set('label', $sLabel);
$oTemplate->Set('value', $vValue);
$oTemplate->Set('current', $this->GetCurrentValue($sName, $vDefault));
return $oTemplate->Display();
}
示例2: CheckServer
/**
* Installer::CheckServer()
*
* @return
*/
public static function CheckServer()
{
$noerror = true;
$version = phpversion();
$wf = array();
// These needa be writable
$wf[] = 'core/cache';
$wf[] = 'core/logs';
$wf[] = 'core/pages';
$wf[] = 'lib/avatars';
$wf[] = 'lib/rss';
$wf[] = 'lib/signatures';
// Check the PHP version
if ($version[0] != '5') {
$noerror = false;
$type = 'error';
$message = 'You need PHP 5 (your version: ' . $version . ')';
} else {
$type = 'success';
$message = 'OK! (your version:' . $version . ')';
}
Template::Set('phpversion', '<div id="' . $type . '">' . $message . '</div>');
// Check if core/site_config.inc.php is writeable
if (!file_exists(CORE_PATH . '/local.config.php')) {
if (!($fp = fopen(CORE_PATH . '/local.config.php', 'w'))) {
$noerror = false;
$type = 'error';
$message = 'Could not create core/local.config.php. Create this file, blank, with write permissions.';
} else {
$type = 'success';
$message = 'core/local.config.php is writeable!';
}
} else {
if (!is_writeable(CORE_PATH . '/local.config.php')) {
$noerror = false;
$type = 'error';
$message = 'core/local.config.php is not writeable';
} else {
$type = 'success';
$message = 'core/local.config.php is writeable!';
}
}
Template::Set('configfile', '<div id="' . $type . '">' . $message . '</div>');
// Check all of the folders for writable permissions
$status = '';
foreach ($wf as $folder) {
if (!is_writeable(SITE_ROOT . '/' . $folder)) {
$noerror = false;
$type = 'error';
$message = $folder . ' is not writeable';
} else {
$type = 'success';
$message = $folder . ' is writeable!';
}
$status .= '<div id="' . $type . '">' . $message . '</div>';
}
Template::Set('directories', $status);
//Template::Set('pagesdir', '<div id="'.$type.'">'.$message.'</div>');
return $noerror;
}
示例3: create_vatsim_data
public function create_vatsim_data($find, $type, $callsign)
{
if ($this->section == null) {
$this->get_vatsim_data();
}
foreach ($this->section as $row) {
$row_info = explode(":", $row);
if (ereg("^{$type}", $row_info[3])) {
if (ereg("^{$callsign}", $row_info[0])) {
Template::Set('row_info', $row_info);
Template::Show('vatsim.tpl');
}
}
}
}
示例4: set
public function set($name, $value)
{
Template::Set($name, $value);
}
示例5: findRetiredPilots
/**
* Find and set any pilots as retired
*
* @return mixed This is the return value description
*
*/
public static function findRetiredPilots()
{
$days = Config::Get('PILOT_INACTIVE_TIME');
if ($days == '') {
$days = 90;
}
$sql = "SELECT * FROM " . TABLE_PREFIX . "pilots\n\t\t\t\tWHERE DATE_SUB(CURDATE(), INTERVAL {$days} DAY) > `lastlogin` \n\t\t\t\t\tAND `totalflights` = 0 AND `lastlogin` != 0\n\t\t\t\t\tAND `retired` = 0";
$results = DB::get_results($sql);
$sql = "SELECT * FROM " . TABLE_PREFIX . "pilots\n\t\t\t\tWHERE DATE_SUB(CURDATE(), INTERVAL {$days} DAY) > `lastpirep` \n\t\t\t\t\tAND `totalflights` > 0 AND `lastpirep` != 0\n\t\t\t\t\tAND `retired` = 0";
$results2 = DB::get_results($sql);
// messy but two queries, merge them both
if (!is_array($results) && !is_array($results2)) {
return false;
} else {
if (is_array($results) && is_array($results2)) {
$results = array_merge($results, $results2);
}
if (!is_array($results) && is_array($results2)) {
$results = $results2;
}
}
if (!$results) {
return false;
}
# Find the retired status
$statuses = Config::get('PILOT_STATUS_TYPES');
foreach ($statuses as $retired_id => $status) {
if ($status['autoretire'] == true) {
break;
}
}
foreach ($results as $row) {
// Set them retired
self::updateProfile($row->pilotid, array('retired' => $retired_id));
Template::Set('pilot', $row);
$pilot_retired_template = Template::Get('email_pilot_retired.tpl', true, true, true);
Util::SendEmail($row->email, Lang::get('email.pilot.retired.subject'), $pilot_retired_template);
}
}
示例6: send_blank
public function send_blank()
{
$this->set('title', 'Pilot Manager');
$email = $this->post->blank;
$subject = $this->post->subject;
$message = $this->post->message;
$pilotinfo = PManagerData::getpilotbyemail($email);
$pilot = $pilotinfo->pilotid;
Template::Set('pilot', PManagerData::getpilotbyemail($email));
Template::Set('subject', $subject);
Template::Set('email', $email);
Template::Set('message', $message);
if ($subject == '') {
$this->set('title', 'Pilot Manager');
$this->set('message', 'You must enter a subject!');
$this->render('core_error.tpl');
$this->set('email', $email);
$this->show('/pm/blank_email.php');
return;
}
if ($message == '') {
$this->set('title', 'Pilot Manager');
$this->set('message', 'You must enter a message!');
$this->render('core_error.tpl');
$this->set('email', $email);
$this->show('/pm/blank_email.php');
return;
}
Util::SendEmail($email, $subject, $message);
PManagerData::blanksent($pilot, $message);
$this->show('/pm/email_confirm.php');
}
示例7: define
*/
define('ADMIN_PANEL', true);
include '../core/codon.config.php';
if (!Auth::LoggedIn()) {
Debug::showCritical('Please login first');
die;
}
if (!PilotGroups::group_has_perm(Auth::$usergroups, ACCESS_ADMIN)) {
Debug::showCritical('Unauthorized access');
die;
}
$BaseTemplate = new TemplateSet();
$tplname = Config::Get('ADMIN_SKIN');
if ($tplname == '') {
$tplname = 'layout';
}
//load the main skin
$settings_file = SITE_ROOT . '/admin/lib/' . $tplname . '/' . $tplname . '.php';
if (file_exists($settings_file)) {
include $settings_file;
}
$BaseTemplate->template_path = SITE_ROOT . '/admin/lib/' . $tplname;
$BaseTemplate->Set('title', SITE_NAME);
Template::Set('MODULE_NAV_INC', $NAVBAR);
Template::Set('MODULE_HEAD_INC', $HTMLHead);
$BaseTemplate->Show('header.tpl');
flush();
MainController::runAllActions();
$BaseTemplate->Show('footer.tpl');
# Force connection close
DB::close();
示例8:
echo '<div id="error">' . Installer::$error . '</div>';
break;
}
SettingsData::saveSetting('PHPVMS_VERSION', INSTALLER_VERSION);
echo '<div align="center" style="font-size: 18px;"><br />
<a href="install.php?page=sitesetup">Continue to the next step</a>
</div>';
}
break;
case 'sitesetup':
Template::Show('s2_site_setup.tpl');
break;
case 'complete':
if ($_POST['action'] == 'submitsetup') {
if ($_POST['firstname'] == '' || $_POST['lastname'] == '' || $_POST['email'] == '' || $_POST['password'] == '' || $_POST['vaname'] == '' || $_POST['vacode'] == '') {
Template::Set('message', 'You must fill out all of the fields');
Template::Show('s2_site_setup.tpl');
break;
}
$_POST['SITE_NAME'] = $_POST['vaname'];
if (!Installer::SiteSetup()) {
Template::Set('message', Installer::$error);
Template::Show('s2_site_setup.tpl');
} else {
Installer::RegisterInstall(INSTALLER_VERSION);
Template::Show('s3_setup_finished.tpl');
}
}
break;
}
Template::Show('footer.tpl');
示例9: SendEmailConfirm
public static function SendEmailConfirm($email, $firstname, $lastname, $newpw = '')
{
/*$firstname = Vars::POST('firstname');
$lastname = Vars::POST('lastname');
$email = Vars::POST('email');*/
$confid = self::$salt;
$subject = SITE_NAME . ' Registration';
Template::Set('firstname', $firstname);
Template::Set('lastname', $lastname);
Template::Set('confid', $confid);
$message = Template::GetTemplate('email_registered.tpl', true);
//email them the confirmation
Util::SendEmail($email, $subject, $message);
}
示例10: dirname
<?php
include dirname(__FILE__) . '/loader.inc.php';
if (!DB::init($_POST['DBASE_TYPE'])) {
Template::Set('message', 'There was an error initializing the database');
Template::Show('error.tpl');
return false;
}
$ret = DB::connect($_POST['DBASE_USER'], $_POST['DBASE_PASS'], $_POST['DBASE_NAME'], $_POST['DBASE_SERVER']);
if ($ret == false) {
Template::Set('message', DB::error());
Template::Show('error.tpl');
return false;
}
if (!DB::select($_POST['DBASE_NAME'])) {
Template::Set('message', DB::error());
Template::Show('error.tpl');
return false;
}
Template::Set('message', 'Database connection is ok!');
Template::Show('success.tpl');
示例11: Template
$oTemplate->Set('basename', $sBasename);
echo $oTemplate->Display();
exit;
}
$sUploadDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/upload_dir'));
$sSpriteDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/sprite_dir'));
$sTranslationsCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/translations_dir'));
$sCssCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/css_archive'));
$sJsCacheDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/js_archive'));
ConfigHelper::CreateDir($sUploadDir);
ConfigHelper::CreateDir($sSpriteDir);
ConfigHelper::CreateDir($sTranslationsCacheDir);
ConfigHelper::CreateDir($sCssCacheDir);
ConfigHelper::CreateDir($sJsCacheDir);
// This section is present for Project Fondue use only and can be safely removed */
if (ConfigHelper::Get('/cache/tla/dir')) {
$sTextLinkAdsDir = ConfigHelper::GetAbsolutePath($sBasename . ConfigHelper::Get('/cache/tla/dir'));
ConfigHelper::CreateDir($sTextLinkAdsDir);
ConfigHelper::CreateFile($sTextLinkAdsDir . '/' . ConfigHelper::Get('/cache/tla/file'));
}
// End section //
if (!is_writeable($sUploadDir) || !is_writeable($sSpriteDir) || !is_writeable($sTranslationsCacheDir) || !is_writeable($sCssCacheDir) || !is_writeable($sJsCacheDir)) {
$oTemplate = new Template('setup-permissions-error.php');
$oTemplate->Set('uploadDir', $sUploadDir);
$oTemplate->Set('spriteDir', $sSpriteDir);
$oTemplate->Set('translationsCacheDir', $sTranslationsCacheDir);
$oTemplate->Set('cssCacheDir', $sCssCacheDir);
$oTemplate->Set('jsCacheDir', $sJsCacheDir);
echo $oTemplate->Display();
exit;
}
示例12: getReportDetails
/**
* Get all of the details for a PIREP, including lat/long of the airports
*/
public static function getReportDetails($pirepid)
{
$sql = 'SELECT p.*, s.*, s.id AS scheduleid, p.route, p.route_details,
u.pilotid, u.firstname, u.lastname, u.email, u.rank,
dep.name as depname, dep.lat AS deplat, dep.lng AS deplng,
arr.name as arrname, arr.lat AS arrlat, arr.lng AS arrlng,
p.code, p.flightnum, p.depicao, p.arricao, p.price AS price,
a.id as aircraftid, a.name as aircraft, a.registration, p.flighttime,
p.distance,
UNIX_TIMESTAMP(p.submitdate) as submitdate,
UNIX_TIMESTAMP(p.modifieddate) as modifieddate,
p.accepted, p.log
FROM ' . TABLE_PREFIX . 'pilots u, ' . TABLE_PREFIX . 'pireps p
LEFT JOIN ' . TABLE_PREFIX . 'airports AS dep ON dep.icao = p.depicao
LEFT JOIN ' . TABLE_PREFIX . 'airports AS arr ON arr.icao = p.arricao
LEFT JOIN ' . TABLE_PREFIX . 'aircraft a ON a.id = p.aircraft
LEFT JOIN ' . TABLE_PREFIX . 'schedules s ON s.code = p.code AND s.flightnum = p.flightnum
WHERE p.pilotid=u.pilotid AND p.pirepid=' . $pirepid;
$row = DB::get_row($sql);
$row->rawdata = unserialize($row->rawdata);
/* Do any specific replacements here */
if ($row) {
/* If it's FSFlightKeeper, process the `rawdata` column, which contains
array()'d copied of extra data that was sent by the ACARS. Run that
through some templates which we've got. This can probably be generic-ized
but it's fine now for FSFK. This can probably move through an outside
function, but seems OK to stay in getReportDetails() for now, since this
is semi-intensive code here (the most expensive is populating the templates,
and I wouldn't want to run it for EVERY PIREP which is called by the system.
*/
if ($row->source == 'fsfk') {
/* Do data stuff in the logs */
$data = $row->rawdata;
/* Process flight data */
if (isset($data['FLIGHTDATA'])) {
Template::Set('data', $data['FLIGHTDATA']);
$flightdata = Template::Get('fsfk_log_flightdata.tpl', true, true, true);
$row->log .= $flightdata;
unset($flightdata);
}
/* Process the flightplan */
if (isset($data['FLIGHTPLAN'])) {
$value = trim($data['FLIGHTPLAN']);
$lines = explode("\n", $value);
Template::Set('lines', $lines);
$flightplan = Template::Get('fsfk_log_flightplan.tpl', true, true, true);
$row->log .= $flightplan;
unset($flightplan);
}
/* Process flight critique data */
if (isset($data['FLIGHTCRITIQUE'])) {
$value = $data['FLIGHTCRITIQUE'];
$value = trim($value);
preg_match_all("/(.*) \\| (.*)\n/", $value, $matches);
# Get these from a template
Template::Set('matches', $matches);
$critique = Template::Get('fsfk_log_flightcritique.tpl', true, true, true);
$row->log .= $critique;
unset($critique);
}
/* Process the flight images, last */
if (isset($data['FLIGHTMAPS'])) {
Template::Set('images', $data['FLIGHTMAPS']);
$flightimages = Template::Get('fsfk_log_flightimages.tpl', true, true, true);
$row->log .= $flightimages;
unset($flightimages);
}
}
/* End "if FSFK" */
if ($row->route_details != '') {
$row->route_details = unserialize($row->route_details);
} else {
$row->route_details = NavData::parseRoute($row);
}
}
/* End "if $row" */
return $row;
}
示例13: __construct
public function __construct()
{
require '../includes/config.inc.php';
$this->SetLanguage(ConfigHelper::Get('/languages/installed'));
// check validity of selected view (to prevent loading of other files from the filesystem)
if (isset($_REQUEST['view']) && preg_match("/^[a-z0-9_-]+\$/i", $_REQUEST['view']) && file_exists('../views/' . $_REQUEST['view'] . '.php')) {
// we now have a safe string
$this->sView = $_REQUEST['view'];
$this->sViewPath = '../views/' . $_REQUEST['view'] . '.php';
} elseif (empty($_REQUEST['view']) && file_exists('../views/home.php')) {
// look for default view
$this->sView = 'home';
$this->sViewPath = '../views/home.php';
} else {
// invalid request and no default view available - quit application
die('Invalid view specified.');
}
if (!in_array($this->sView, array('download'))) {
// instantiate translations
$oTranslations = new Translations($this->sLanguage, ConfigHelper::Get('/cache/translations_dir/'), ConfigHelper::Get('/translations/allow_show_keys'));
// instantiate layout template
if (ConfigHelper::Get('/template/paths')) {
$oTemplate = new Template('layout.php', $this->sLanguage, ConfigHelper::Get('/template/paths'));
} else {
$oTemplate = new Template('layout.php', $this->sLanguage);
}
// pass common data to template
$oTemplate->Set('appRoot', ConfigHelper::Get('/app_root'));
$oTemplate->Set('contactEmail', ConfigHelper::Get('/emails/contact'));
$oTemplate->Set('languages', ConfigHelper::Get('/languages/installed'));
$oTemplate->Set('language', $this->sLanguage);
$oTemplate->Set('missingTranslations', !in_array($this->sLanguage, ConfigHelper::Get('/languages/complete')));
$oTemplate->Set('languageSwitch', ConfigHelper::Get('/languages/switch'));
$oTemplate->Set('view', $this->sView);
$oTemplate->Set('template', $this->sView);
$oTemplate->Set('translation', $oTranslations);
$oTemplate->Set('assetsDir', ConfigHelper::Get('/assets_dir'));
// add content template
$oTemplate->Set('content', new Template("{$this->sView}.php", $this->sLanguage, ConfigHelper::Get('/template/paths')));
$oTemplate->Set('headerImageUrl', ConfigHelper::Get('/images/header/url'));
$oTemplate->Set('headerImageAlt', ConfigHelper::Get('/images/header/alt'));
$oTemplate->Set('headerImageWidth', ConfigHelper::Get('/images/header/width'));
$oTemplate->Set('headerImageHeight', ConfigHelper::Get('/images/header/height'));
$oTemplate->Set('headerHref', ConfigHelper::Get('/urls/header'));
$oTemplate->Set('reportBugUrl', ConfigHelper::Get('/urls/report_bug'));
$oTemplate->Set('viewsDir', '../views/');
$oTemplate->Set('toolUrl', str_replace(array('http://', 'https://'), '', ConfigHelper::Get('/urls/tool')));
// load view
require $this->GetViewPath();
// display resulting page
echo $oTemplate->Display();
} else {
// load view
require $this->GetViewPath();
}
}
示例14:
<!--<button class="jqModal {button:{icons:{primary:'ui-icon-signal-diag'}}}" id="dialog_route"
href="<?php
echo SITE_URL;
?>
/admin/action.php/operations/viewmap?type=pirep&id=<?php
echo $pirep->pirepid;
?>
">Route</button>-->
</div>
<br />
<?php
# If there was an error, don't allow the PIREP to go through
if ($pirep->aircraft == '') {
$error = true;
Template::Set('message', 'No aircraft for this PIREP. You must edit and assign before you can accept it.');
Template::Show('core_error.tpl');
}
?>
<table id="details_dialog_<?php
echo $pirep->pirepid;
?>
"
style="display:none; border-left: 3px solid #FF6633; margin-top: 3px;padding-left: 3px;" width="100%">
<tr>
<td><strong>Client: </strong> <?php
echo $pirep->source;
?>
</td>
<td><strong>Aircraft: </strong>
<?php
示例15: foreach
</tr>
<tr>
<td style="font-weight: bold;">Select Aircraft:</td>
<td>
<select name="aircraft" id="aircraft">
<option value="">Select the aircraft of this flight</option>
<?php
foreach ($allaircraft as $aircraft) {
$sel = $pirep->aircraftid == $aircraft->id ? 'selected' : '';
echo '<option value="' . $aircraft->id . '" ' . $sel . '>' . $aircraft->name . ' - ' . $aircraft->registration . '</option>';
}
?>
</select>
<?php
if ($pirep->aircraftid == '') {
Template::Set('message', 'You must set an aircraft');
Template::Show('core_error.tpl');
}
?>
</td>
</tr>
<tr>
<td style="font-weight: bold;">Flight Time</td>
<td><input type="text" name="flighttime" value="<?php
echo $pirep->flighttime;
?>
" />
<p>Enter as hours:minutes - "5:30" is five hours and thirty minutes</p></td>
</tr>