本文整理汇总了PHP中tpl_assign函数的典型用法代码示例。如果您正苦于以下问题:PHP tpl_assign函数的具体用法?PHP tpl_assign怎么用?PHP tpl_assign使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了tpl_assign函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute the script
*
* @param void
* @return boolean
*/
function execute()
{
// ---------------------------------------------------
// Check MySQL version
// ---------------------------------------------------
$mysql_version = mysql_get_server_info($this->database_connection);
if ($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
$constants['DB_CHARSET'] = 'utf8';
@mysql_query("SET NAMES 'utf8'", $this->database_connection);
tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
} else {
tpl_assign('default_collation', $default_collation = '');
tpl_assign('default_charset', $default_charset = '');
}
// if
tpl_assign('table_prefix', TABLE_PREFIX);
// ---------------------------------------------------
// Execute migration
// ---------------------------------------------------
$total_queries = 0;
$executed_queries = 0;
$upgrade_script = tpl_fetch(get_template_path('db_migration/1_0_milanga'));
if ($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
$this->printMessage("Database schema transformations executed (total queries: {$total_queries})");
} else {
$this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
return false;
}
// if
$this->printMessage('Feng Office has been upgraded. You are now running Feng Office ' . $this->getVersionTo() . ' Enjoy!');
}
示例2: execute
/**
* Prepare and process config form
*
* @access public
* @param void
* @return boolean
*/
function execute() {
if(!$this->installer->isExecutedStep(ACI_SYSTEM_CONFIG)) {
$this->goToStep(ACI_SYSTEM_CONFIG);
} // if
$installation = new acInstallation(new Output_Html());
$installation->setDatabaseType((string) trim($this->getFromStorage('database_type')));
$installation->setDatabaseHost((string) trim($this->getFromStorage('database_host')));
$installation->setDatabaseUsername((string) trim($this->getFromStorage('database_user')));
$installation->setDatabasePassword((string) $this->getFromStorage('database_pass'));
$installation->setDatabaseName((string) trim($this->getFromStorage('database_name')));
$installation->setTablePrefix((string) trim($this->getFromStorage('database_prefix')));
$installation->setDatabaseEngine((string) trim($this->getFromStorage('database_engine')));
$installation->setAbsoluteUrl((string) trim($this->getFromStorage('absolute_url')));
$installation->setPlugins($this->getFromStorage('plugins'));
ob_start();
if($installation->execute()) {
$all_ok = true;
$this->installer->clearStorage(); // lets clear data from session... its a DB pass we are talking about here
} else {
$all_ok = false;
} // if
tpl_assign('all_ok', $all_ok);
tpl_assign('status_messages', explode("\n", trim(ob_get_clean())));
$this->setContentFromTemplate('finish.php');
return false;
} // excute
示例3: update_category
/**
* Show and process config category form
*
* @param void
* @return null
*/
function update_category()
{
$category = ConfigCategories::findById(get_id());
if (!$category instanceof ConfigCategory) {
flash_error(lang('config category dnx'));
$this->redirectToReferer(get_url('administration'));
}
// if
if ($category->isEmpty()) {
flash_error(lang('config category is empty'));
$this->redirectToReferer(get_url('administration'));
}
// if
$options = $category->getOptions(false);
$categories = ConfigCategories::getAll(false);
tpl_assign('category', $category);
tpl_assign('options', $options);
tpl_assign('config_categories', $categories);
$submitted_values = array_var($_POST, 'options');
if (is_array($submitted_values)) {
foreach ($options as $option) {
$new_value = array_var($submitted_values, $option->getName());
if (is_null($new_value) || $new_value == $option->getValue()) {
continue;
}
$option->setValue($new_value);
$option->save();
}
// foreach
flash_success(lang('success update config category', $category->getDisplayName()));
$this->redirectTo('administration', 'configuration');
}
// if
$this->setSidebar(get_template_path('update_category_sidebar', 'config'));
}
示例4: advanced_pagination
/**
* Advanced pagination. Differenced between simple and advanced paginations is that
* advanced pagination uses template so its output can be changed in a great number of ways.
*
* All variables are just passed to the template, nothing is done inside the function!
*
* @access public
* @param DataPagination $pagination Pagination object
* @param string $url_base Base URL in witch we will insert current page number
* @param string $template Template that will be used. It can be absolute path to existing file
* or template name that used with get_template_path will return real template path
* @param string $page_placeholder Short string inside of $url_base that will be replaced with
* current page numer
* @return null
*/
function advanced_pagination(DataPagination $pagination, $url_base, $template = 'advanced_pagination', $page_placeholder = '#PAGE#')
{
tpl_assign(array('advanced_pagination_object' => $pagination, 'advanced_pagination_url_base' => $url_base, 'advanced_pagination_page_placeholder' => urlencode($page_placeholder)));
// tpl_assign
$template_path = is_file($template) ? $template : get_template_path($template);
return tpl_fetch($template_path);
}
示例5: execute
/**
* Prepare and process config form
*
* @access public
* @param void
* @return boolean
*/
function execute()
{
if (!$this->installer->isExecutedStep(INSTALL_SYSTEM_CONFIG)) {
$this->goToStep(INSTALL_SYSTEM_CONFIG);
}
// if
$installation = new installation(new Output_Html());
$installation->setDatabaseType((string) trim($this->getFromStorage('database_type')));
$installation->setDatabaseHost((string) trim($this->getFromStorage('database_host')));
$installation->setDatabaseUsername((string) trim($this->getFromStorage('database_user')));
$installation->setDatabasePassword((string) $this->getFromStorage('database_pass'));
$installation->setDatabaseName((string) trim($this->getFromStorage('database_name')));
$installation->setTablePrefix((string) trim($this->getFromStorage('database_prefix')));
ob_start();
if ($installation->execute()) {
$all_ok = true;
$this->installer->clearStorage();
// lets clear data from session... its a DB pass we are talking about here
$path = $_SERVER['PHP_SELF'];
$path = substr($path, 0, strpos($path, 'public'));
} else {
$all_ok = false;
$path = '';
}
// if
tpl_assign('all_ok', $all_ok);
tpl_assign('relative_url', $path);
tpl_assign('status_messages', explode("\n", trim(ob_get_clean())));
$this->setContentFromTemplate('finish.php');
return false;
}
示例6: help_options
function help_options()
{
$show_context_help = user_config_option('show_context_help', 'until_close', logged_user()->getId());
$show = true;
if ($show_context_help == 'never') {
$show = false;
}
tpl_assign('show_help', $show);
ajx_set_panel('help');
ajx_replace(true);
}
示例7: read_state
function read_state()
{
$this->setLayout("json");
$this->setTemplate(get_template_path("json"));
try {
$data = self::getState();
$object = array("success" => true, "data" => json_encode($data));
tpl_assign("object", $object);
} catch (Exception $e) {
$object = array("success" => false, "message" => $e->getMessage());
tpl_assign("object", $object);
}
}
示例8: execute
/**
* Execute the script
*
* @param void
* @return boolean
*/
function execute() {
// ---------------------------------------------------
// Check MySQL version
// ---------------------------------------------------
$mysql_version = mysql_get_server_info($this->database_connection);
if($mysql_version && version_compare($mysql_version, '4.1', '>=')) {
$constants['DB_CHARSET'] = 'utf8';
@mysql_query("SET NAMES 'utf8'", $this->database_connection);
tpl_assign('default_collation', $default_collation = 'collate utf8_unicode_ci');
tpl_assign('default_charset', $default_charset = 'DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci');
} else {
tpl_assign('default_collation', $default_collation = '');
tpl_assign('default_charset', $default_charset = '');
} // if
tpl_assign('table_prefix', TABLE_PREFIX);
if (defined('DB_ENGINE'))
tpl_assign('engine', DB_ENGINE);
else
tpl_assign('engine', 'InnoDB');
// ---------------------------------------------------
// Execute migration
// ---------------------------------------------------
$total_queries = 0;
$executed_queries = 0;
$installed_version = installed_version();
if (version_compare($installed_version, "1.1") <= 0) {
$upgrade_script = tpl_fetch(get_template_path('db_migration/1_2_chinchulin'));
} else {
$upgrade_script = "DELETE FROM `".TABLE_PREFIX."config_options` WHERE `name` = 'time_format_use_24';
UPDATE `".TABLE_PREFIX."config_options` SET `category_name` = 'modules' WHERE `name` = 'enable_email_module';
ALTER TABLE `".TABLE_PREFIX."mail_contents` ADD COLUMN `content_file_id` VARCHAR(40) NOT NULL default '';
";
}
@unlink("../../language/de_de/._lang.js");
if($this->executeMultipleQueries($upgrade_script, $total_queries, $executed_queries, $this->database_connection)) {
$this->printMessage("Database schema transformations executed (total queries: $total_queries)");
} else {
$this->printMessage('Failed to execute DB schema transformations. MySQL said: ' . mysql_error(), true);
return false;
} // if
$this->printMessage('Feng Office has been upgraded. You are now running Feng Office '.$this->getVersionTo().' Enjoy!');
} // execute
示例9: render_company_data_tab
function render_company_data_tab($genid, $company, $renderContext, $company_data)
{
$object = $company;
if ($company instanceof Contact && !$company->isNew()) {
$address = $company->getAddress('work');
$street = "";
$city = "";
$state = "";
$zipcode = "";
if ($address) {
$street = $address->getStreet();
$city = $address->getCity();
$state = $address->getState();
$zipcode = $address->getZipCode();
$country = $address->getCountry();
}
$company_data = array('first_name' => $company->getFirstName(), 'timezone' => $company->getTimezone(), 'email' => $company->getEmailAddress(), 'comments' => $company->getCommentsField());
// array
// telephone types
$all_telephone_types = TelephoneTypes::getAllTelephoneTypesInfo();
tpl_assign('all_telephone_types', $all_telephone_types);
// address types
$all_address_types = AddressTypes::getAllAddressTypesInfo();
tpl_assign('all_address_types', $all_address_types);
// webpage types
$all_webpage_types = WebpageTypes::getAllWebpageTypesInfo();
tpl_assign('all_webpage_types', $all_webpage_types);
// email types
$all_email_types = EmailTypes::getAllEmailTypesInfo();
tpl_assign('all_email_types', $all_email_types);
$all_phones = ContactTelephones::findAll(array('conditions' => 'contact_id = ' . $company->getId()));
$company_data['all_phones'] = $all_phones;
$all_addresses = ContactAddresses::findAll(array('conditions' => 'contact_id = ' . $company->getId()));
$company_data['all_addresses'] = $all_addresses;
$all_webpages = ContactWebpages::findAll(array('conditions' => 'contact_id = ' . $company->getId()));
$company_data['all_webpages'] = $all_webpages;
$all_emails = $company->getNonMainEmails();
$company_data['all_emails'] = $all_emails;
}
// telephone types
$all_telephone_types = TelephoneTypes::getAllTelephoneTypesInfo();
// address types
$all_address_types = AddressTypes::getAllAddressTypesInfo();
// webpage types
$all_webpage_types = WebpageTypes::getAllWebpageTypesInfo();
// email types
$all_email_types = EmailTypes::getAllEmailTypesInfo();
include get_template_path("tabs/company_data", "contact");
}
示例10: index
/**
* Default action
*/
public function index() {
try {
$request = $_REQUEST;
//Handle action
$action = $request['m'];
if (isset($request['args'])) {
$request['args'] = json_decode($request['args'], 1);
} else {
$request['args'] = array();
}
if (method_exists($this, $action))
$response = $this->$action($request);
tpl_assign('response', $response);
} catch (Exception $exception) {
throw $exception;
}
}
示例11: project_tag
/**
* Show project objects tagged with specific tag
*
* @access public
* @param void
* @return null
*/
function project_tag()
{
$tag = array_var($_GET, 'tag');
if (trim($tag) == '') {
flash_error(lang('tag dnx'));
$this->redirectTo('project', 'tags');
}
// if
$tagged_objects = active_or_personal_project()->getObjectsByTag($tag);
$total_tagged_objects = Tags::countObjectsByTag($tag);
if (is_array($tagged_objects)) {
foreach ($tagged_objects as $type => $objects) {
if (is_array($objects)) {
$total_tagged_objects += count($objects);
}
}
// foreach
}
// if
tpl_assign('tag', $tag);
tpl_assign('tagged_objects', $tagged_objects);
tpl_assign('total_tagged_objects', $total_tagged_objects);
}
示例12: lang
if ($hasComments) {
tpl_assign("widgetClass", 'dashComments');
tpl_assign("widgetTitle", lang('latest comments'));
tpl_assign("widgetTemplate", 'comments');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
if ($showWorkspaceInfo){
tpl_assign("widgetClass", 'dashInfo');
tpl_assign("widgetTitle", lang('workspace info'));
tpl_assign("widgetTemplate", 'dashboard_info');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}
if ($hasCharts) {
tpl_assign("widgetClass", 'dashChart');
tpl_assign("widgetTitle", lang('charts'));
tpl_assign("widgetTemplate", 'charts');
$this->includeTemplate(get_template_path('widget', 'dashboard'));
}?>
</td>
<?php } ?>
</tr></table>
</div>
</div>
<script>
//og.showWsPaths('<?php echo $genid ?>-db');
Ext.QuickTips.init();
</script>
示例13: calendar
/**
* Show calendar view milestone page
*
* @access public
* @param void
* @return null
*/
function calendar()
{
$this->addHelper('textile');
$project = active_project();
$id = get_id();
if (strlen($id) == 0) {
$id = gmdate('Ym');
}
if (preg_match('/^(\\d{4})(\\d{2})$/', $id, $matches)) {
list(, $year, $month) = $matches;
tpl_assign('year', $year);
tpl_assign('month', $month);
} else {
flash_error(lang('id missing'));
$this->redirectToReferer(get_url('milestone'));
}
tpl_assign('milestones', $project->getMilestonesByMonth($year, $month));
}
示例14: fixConfigFile
/**
* This function will configuration file
*
* @param void
* @return null
*/
function fixConfigFile()
{
$this->printMessage('Updating configuration file');
$constants = array('DB_ADAPTER' => DB_ADAPTER, 'DB_HOST' => DB_HOST, 'DB_USER' => DB_USER, 'DB_PASS' => DB_PASS, 'DB_NAME' => DB_NAME, 'DB_PERSIST' => true, 'TABLE_PREFIX' => TABLE_PREFIX, 'ROOT_URL' => ROOT_URL, 'DEFAULT_LOCALIZATION' => DEFAULT_LOCALIZATION, 'DEBUG' => false, 'PRODUCT_VERSION' => $this->getVersionTo());
// array
tpl_assign('config_file_constants', $constants);
if (file_put_contents(INSTALLATION_PATH . '/config/config.php', tpl_fetch(get_template_path('config_file')))) {
$this->printMessage('Configuration file updated');
return true;
} else {
$this->printMessage('Failed to update configuration file', true);
return false;
}
// if
}
示例15: render_project_application_logs
/**
* Render one project's application logs
*
* This helper will render array of log entries.
*
* @param array $project The project.
* @param array $log_entries An array of entries for this project.
* @return null
*/
function render_project_application_logs($project, $log_entries)
{
if (config_option('display_application_logs', true)) {
tpl_assign('application_logs_project', $project);
tpl_assign('application_logs_entries', $log_entries);
return tpl_fetch(get_template_path('render_project_application_logs', 'application'));
}
return '';
}