本文整理汇总了PHP中Template::set_object方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::set_object方法的具体用法?PHP Template::set_object怎么用?PHP Template::set_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template::set_object方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Pagination
function generate_inner_html()
{
$Pagination = new Pagination();
$Pagination->setPaging($this->Paging);
$this->page_prev = $Pagination->getPreviousPage();
$this->page_next = $Pagination->getNextPage();
$this->page_links = $Pagination->getPageLinks();
$inner_template = NULL;
switch ($this->mode) {
case 'relations':
case 'in_relations':
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
break;
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public_relation.tpl';
}
$obj_inner_template = new Template($inner_template, $this);
$obj_inner_template->set_object('links', $this->links);
$obj_inner_template->set_object('gid', @$this->gid);
$obj_inner_template->set('sub_title', @$this->sub_title);
$obj_inner_template->set('total', $this->Paging['count']);
$obj_inner_template->set('reciprocated_relationship_set', @$this->reciprocated_relationship_set);
$obj_inner_template->set('relations', @$this->relations);
$obj_inner_template->set('in_relations', @$this->in_relations);
$obj_inner_template->set('user_name', $this->page_user);
$obj_inner_template->set('page_prev', $this->page_prev);
$obj_inner_template->set('page_next', $this->page_next);
$obj_inner_template->set('page_links', $this->page_links);
$obj_inner_template->set('view_type', $this->view_type);
$inner_html = $obj_inner_template->fetch();
return $inner_html;
}
示例2: switch
function generate_inner_html()
{
$links = $this->links;
switch ($this->mode) {
default:
$tmp_file = PA::$blockmodule_path . "/MediaManagementModule/center_inner_public.tpl";
}
$info = new Template($tmp_file);
$info->set_object('uid', $this->uid);
$info->set_object('links', $links);
$info->set_object('type_image', $this->type_image);
$info->set('page_links', $this->page_links);
$info->set('PagingArray', $this->PagingArray);
$inner_html = $info->fetch();
return $inner_html;
}
示例3: explode
function generate_inner_html()
{
if (empty($this->links)) {
return "";
}
$links = $this->links;
/*
if ($links->type == 'textpad') {
$this->title = $links->title;
}
*/
$pos = explode(',', $links->orientation);
$x_loc = $pos[0];
if ($x_loc == 2) {
$width = AD_WIDTH_MIDDLE;
//$height = AD_HEIGHT_MIDDLE;
} else {
$width = AD_WIDTH_LR;
//$height = AD_HEIGHT_LR;
$this->outer_template = 'cnmodule_advertisement.php';
}
// we never want to reduce the height of an ad, so we set $height very high
$height = 1000;
$tmp_file = PA::$blockmodule_path . '/' . get_class($this) . '/cnmodule.php';
$inner_html_gen = new Template($tmp_file);
$inner_html_gen->set_object('links', $links);
$inner_html_gen->set('width', $width);
$inner_html_gen->set('height', $height);
$inner_html_gen->set('block_name', $this->html_block_id);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例4: generate_inner_html
public function generate_inner_html()
{
switch ($this->mode) {
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl';
}
$inner_html_gen = new Template($inner_template);
$inner_html_gen->set_object('group_details', $this->group_details);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例5: Template
function generate_center_public_inner_html()
{
$tmp_file = PA::$blockmodule_path . '/' . get_class($this) . "/inner_html.tpl";
$info = new Template($tmp_file, $this);
$info->set_object('uid', @$this->uid);
$info->set('msg', @$this->msg);
$info->set('array_of_errors', @$this->array_of_errors);
$info->set('user_picture', @$this->user_picture);
$info->set('login_name', @$this->login_name);
$info->set('rel_type', @$this->rel_type);
$inner_html = $info->fetch();
return $inner_html;
}
示例6: array
function generate_inner_html($template_vars = array())
{
$inner_html_gen = new Template($this->inner_template);
foreach ($template_vars as $name => $value) {
if (is_object($value)) {
$inner_html_gen->set_object($name, $value);
} else {
$inner_html_gen->set($name, $value);
}
}
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例7: render
public function render($template_vars, $template_path)
{
$template_file = getShadowedPath($template_path);
$html = new Template($template_file);
foreach ($template_vars as $name => $value) {
if (is_object($value)) {
$html->set_object($name, $value);
} else {
$html->set($name, $value);
}
}
echo $html->fetch();
exit;
}
示例8: Comment
function generate_inner_html()
{
$links = $this->media_data;
// Here we get all the comment of that content
$comment = new Comment();
$comment->parent_id = $links->content_id;
$comment->parent_type = TYPE_CONTENT;
$this->Paging["count"] = $comment->get_multiples_comment($cnt = TRUE);
$result = $comment->get_multiples_comment($cnt = FALSE, $this->Paging["show"], $this->Paging["page"]);
$this->comments = $result;
$param = $this->handle_field_param($links);
$Pagination = new Pagination();
$Pagination->setPaging($this->Paging);
$this->page_first = $Pagination->getFirstPage();
$this->page_last = $Pagination->getLastPage();
$this->page_links = $Pagination->getPageLinks();
switch ($this->mode) {
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_public.tpl';
}
$info = new Template($inner_template);
$info->set_object('param', $param);
$info->set_object('uid', $this->uid);
$info->set_object('links', $links);
$info->set_object('comments', $this->comments);
$info->set('back', @$_SERVER['HTTP_REFERER']);
$info->set('page_first', $this->page_first);
$info->set('page_last', $this->page_last);
$info->set('page_links', $this->page_links);
// when we show Group media - check is user still Group member
if (isset($_GET['gid'])) {
$is_author_member = $this->is_author_group_member($links->author_id, $_GET['gid']);
$info->set('is_author_member', $is_author_member);
}
$inner_html = $info->fetch();
return $inner_html;
}
示例9: generate_inner_html
public function generate_inner_html()
{
switch ($this->mode) {
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/side_inner_public.tpl';
}
$this->generate_group_links();
$this->title = chop_string(stripslashes(!empty($this->group_details) ? $this->group_details->title : NULL), GROUP_TITLE_LENGTH);
$inner_html_gen = new Template($inner_template);
$inner_html_gen->set_object('group_details', $this->group_details);
$inner_html_gen->set('join_this_group_string', $this->join_this_group_string);
$inner_html_gen->set('is_member', $this->is_member);
$inner_html_gen->set('is_admin', $this->is_admin);
$inner_html = $inner_html_gen->fetch();
return $inner_html;
}
示例10: TinyMCE
/** !!
* Gather the list of all email templates to be displayed on the drop down
* menu by calling { @link getEmailContainers() } and placing it in
* { @link $template_list }. Once a template has been selected create objects
* to store all information for the email such as author and subject and place
* them into ( @link $obj_inner_template }.
* @return string $inner_html all the html to be displayed in the email,
* gathered by setting this equal to { @link $obj_inner_template }
*/
function generate_inner_html()
{
if (!empty($_GET['template'])) {
$this->template = $_GET['template'];
}
$tiny = new TinyMCE('medium');
$email_list = EmailMessages::get_email_list();
$template_list = $this->getEmailContainers(PA::$config_path . "/email_containers");
$inner_template = NULL;
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_html.tpl';
$obj_inner_template = new Template($inner_template);
$obj_inner_template->set('email_list', $email_list);
$obj_inner_template->set('template_list', $template_list);
$obj_inner_template->set('subject', $this->subject);
$obj_inner_template->set('message', $this->message);
$obj_inner_template->set('category', $this->category);
$obj_inner_template->set('template', $this->template);
$obj_inner_template->set('description', $this->description);
$obj_inner_template->set('configurable_variables', $this->configurable_variables);
$obj_inner_template->set('preview', $this->preview_msg);
$obj_inner_template->set_object('tiny_mce', $tiny);
$inner_html = $obj_inner_template->fetch();
return $inner_html;
}
示例11: uihelper_generate_center_content_permalink
//.........这里部分代码省略.........
}
// replace magic strings
$content->replace_percent_strings(PA::$url);
$type = $content->type;
$type = $type . 'Permalink';
// comments
$comments_list_tpl = new Template(CURRENT_THEME_FSPATH . "/cncontent_comments.php");
$comments_list_tpl->set('current_theme_path', PA::$theme_url);
$comments_list_tpl->set('comments', $comments);
$comments_list_tpl->set('author_id', $content->author_id);
// Setting the variable for the abuse form ...
$comments_list = $comments_list_tpl->fetch();
//comment form
$cnform_comment_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_comment.php");
$cnform_comment_tpl->set('current_theme_path', PA::$theme_url);
if (isset(PA::$login_uid)) {
$user = new User();
$user->load((int) PA::$login_uid);
$login_name = $user->login_name;
$cnform_comment_tpl->set('name', $login_name);
$cnform_comment_tpl->set('login_name', $user->login_name);
}
$cnform_comment_tpl->set('cid', $cid);
if ($content->parent_collection_id > 0) {
$cnform_comment_tpl->set('ccid', $content->parent_collection_id);
}
// abuse form
$cnform_abuse_tpl = new Template(CURRENT_THEME_FSPATH . "/cnform_abuse.php");
/* Permalink and edit links for content */
if ($content->parent_collection_id != -1) {
$perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id . '&ccid=' . $content->parent_collection_id;
} else {
$perma_link = PA::$url . PA_ROUTE_PERMALINK . "/cid=" . $content->content_id;
}
$params = array('permissions' => 'edit_content', 'uid' => PA::$login_uid, 'cid' => $content->content_id);
if (PermissionsHandler::can_user(PA::$login_uid, $params)) {
if ($media_gallery_content) {
$edit_link = PA::$url . '/edit_media.php?cid=' . $content->content_id;
} else {
$edit_link = PA::$url . "/cncontent_blog.php?cid=" . $content->content_id;
}
$delete_link = PA::$url . PA_ROUTE_CONTENT . "?action=deleteContent&cid=" . $content->content_id . '&back_page=' . $back_page;
// handle Event separately
if ($type == "EventPermalink") {
$edit_link = PA::$url . '/calendar.php?cid=' . $content->content_id;
$delete_link = $edit_link . "&delete=1" . '&back_page=' . $back_page;
}
} else {
$edit_link = $delete_link = NULL;
}
$user_link = PA::$url . PA_ROUTE_USER_PUBLIC . '/' . $content->author_id;
/* Code for Approval and Denial links for a content */
if ($moderateduser && $content->is_active == 2) {
$approval_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&apv=1';
$denial_link = PA::$url . PA_ROUTE_PERMALINK . '/cid=' . $content->content_id . '&ccid=' . $content->parent_collection_id . '&dny=1';
} else {
$approval_link = $denial_link = NULL;
}
// Show comments form to logged in users, only if comments enabled.
global $comments_disabled;
// fix by Z.Hron; if group content - only members of group can comment it
$can_user_comment = true;
if (isset($_GET['gid']) && isset(PA::$login_uid)) {
$can_user_comment = Group::member_exists((int) $_GET['gid'], PA::$login_uid);
}
if (!$comments_disabled && !empty(PA::$login_uid) && $can_user_comment) {
$cnform_comment = $cnform_comment_tpl->fetch();
$cnform_abuse = $cnform_abuse_tpl->fetch();
} else {
$cnform_comment = $cnform_abuse = NULL;
}
if (getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php")) {
$middle_content = new Template(getShadowedPath(CURRENT_THEME_FSPATH . "/{$type}.php"));
$middle_content->set_object('contents', $content);
$middle_content->set('editable', $editable);
$middle_content->set('picture_name', $content_user->picture);
// to set picture name for diplaying in contets
$middle_content->set('user_id', $content_user->user_id);
$middle_content->set('user_name', $content_user->first_name . ' ' . $content_user->last_name);
$middle_content->set('current_theme_path', PA::$theme_url);
$middle_content->set('back_page', $back_page);
$middle_content->set('comments', $comments_list);
$middle_content->set('cnform_comment', $cnform_comment);
$middle_content->set('cnform_abuse', $cnform_abuse);
$middle_content->set('media_gallery_content', $media_gallery_content);
if ($show == 1) {
$middle_content->set('show', $show);
}
$middle_content->set('permalink', $perma_link);
$middle_content->set('edit_link', $edit_link);
$middle_content->set('approval_link', $approval_link);
$middle_content->set('denial_link', $denial_link);
$middle_content->set('delete_link', $delete_link);
$middle_content->set('user_link', $user_link);
$return_content = $middle_content->fetch();
} else {
$return_content = '<p>Content does not have a display template.</p><p>Create a ' . $type . '.php file to display this content type.</p>';
}
return $return_content;
}
示例12: switch
/** !!
* Generates, again using the template file, the edit page, if the media meets
* a certain condition.
*
* @return string The HTML for this module.
*/
function generate_group_inner_html()
{
switch ($this->mode) {
default:
$template_file = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_group.tpl';
}
$template_file_obj = new Template($template_file);
$template_file_obj->set_object('uid', $this->uid);
$template_file_obj->set_object('media_data', $this->media_data);
$template_file_obj->set_object('contentcollection_type', $this->contentcollection_type);
$inner_html = $template_file_obj->fetch();
return $inner_html;
}
示例13: Template
$optional_parameters = "onload=\"{$onload}\"";
html_body($optional_parameters);
//header of group page
$header = new Template(CURRENT_THEME_FSPATH . "/header.tpl");
$header->set('current_theme_path', PA::$theme_url);
$header->set('current_theme_rel_path', PA::$theme_rel);
// find navigation link for header
$navigation = new Navigation();
$navigation_links = $navigation->get_links();
$header->set('navigation_links', $navigation_links);
$header->set('onload', $onload);
$header->tier_one_tab = $main_tier;
$header->tier_two_tab = $second_tier;
$header->tier_three_tab = $third_tier;
if (PA::$network_info) {
$header->set_object('network_info', PA::$network_info);
}
// This block of code has to be removed when this page will be rendered using PageRenderer.
$top_navigation_bar = new Template(CURRENT_THEME_FSPATH . "/top_navigation_bar.tpl");
$top_navigation_bar->set('navigation_links', $navigation_links);
//left of group page
foreach ($leftModulesFromDB as $leftModule) {
$file = PA::$blockmodule_path . "/{$leftModule}/{$leftModule}.php";
require_once $file;
$obj = new $leftModule();
$array_left_modules[] = $obj->render();
}
//middle of group page
foreach ($middleModulesFromDB as $middleModule) {
$file = PA::$blockmodule_path . "/{$middleModule}/{$middleModule}.php";
require_once $file;
示例14: main
function main()
{
if (!@PA::$config->enable_widgetization_testbench) {
?>
<p>Widgetization testbench must be enabled specifically by setting <code>PA::$config->enable_widgetization_testbench = TRUE</code> in local_config.php.</p>
<?php
exit;
}
$module_name = @$_GET['module'];
if (empty($module_name)) {
$this->show_modules();
return;
}
$module_view = @$_GET['view'];
if (empty($module_view)) {
$module_view = "default";
}
$json = new Services_JSON();
// prefix to mark parameters as being for this module
$param_prefix = "w_" . $module_name . "_";
// parameters to pass through to the backend
$params = array();
// GET or POST?
$method = 'get';
// If we got an HTTP POST, mark this as so
if ($_SERVER['REQUEST_METHOD'] == 'POST' && $_GET['wop'] == 'post') {
$method = 'post';
}
// Collect parameters and pass them through
foreach ($_REQUEST as $k => &$v) {
if (strpos($k, $param_prefix) !== 0) {
continue;
}
$params[substr($k, strlen($param_prefix))] =& $v;
}
$request = array('modules' => array(array('id' => 1, 'name' => $module_name, 'method' => $method, 'post_url' => PA::$url . "/widget_testbench.php?module={$module_name}&wop=post", 'param_prefix' => $param_prefix, 'args' => array('view' => $module_view, 'position' => 'center'), 'params' => $params)), 'global' => array('namespace' => 'testbench', 'user' => array('user_id' => "pa_" . PA::$login_user->user_id, 'email' => "testbench+" . PA::$login_user->email, 'first_name' => PA::$login_user->first_name, 'last_name' => PA::$login_user->last_name)));
$request_url = PA::$url . "/widget_dispatch.php";
if (!preg_match("|^http://(.*?)(/.*)\$|", $request_url, $m)) {
die("couldn't parse url");
}
list(, $request_host, $request_path) = $m;
$request_json = $json->encode($request);
$post = "POST {$request_path} HTTP/1.0\nHost: {$request_host}\nConnection: close\nContent-Type: application/x-javascript\nContent-Length: " . strlen($request_json) . "\n\n{$request_json}\n";
// actually perform POST
$fs = fsockopen($request_host, 80, $errno, $errstr, 4);
if (!$fs) {
$response = array("error" => "Failed to connect to widget server");
} else {
fputs($fs, $post);
$response_raw = "";
while (!feof($fs)) {
$resp = fread($fs, 8192);
if ($resp === FALSE) {
break;
}
$response_raw .= $resp;
}
fclose($fs);
list($response_headers, $response_body) = explode("\r\n\r\n", $response_raw, 2);
$response = $json->decode($response_body);
}
$tpl = new Template(PA::$theme_path . '/widget_testbench_widget.tpl');
$tpl->set("module_name", $module_name);
$tpl->set("post", $post);
$tpl->set("response_raw", $response_raw);
$tpl->set_object("response", $response);
echo $tpl->fetch();
}
示例15: switch
/** !!
* Parses the template to generate the HTML.
*
* @return string HTML.
*/
function generate_inner_html()
{
switch ($this->mode) {
default:
$inner_template = PA::$blockmodule_path . '/' . get_class($this) . '/center_inner_private.tpl';
}
$info = new Template($inner_template);
// This lets us know what has just been POSTed, if anything.
// e.g.: if $post_profile_type == 'basic', 'apply changes' has
// just been clicked on the basic profile tab.
$info->set('post_profile_type', !isset($_POST['submit']) ? NULL : $_POST['profile_type']);
$info->set_object('uid', $this->uid);
@$info->set('array_of_errors', $this->array_of_errors);
@$info->set('user_data', $this->user_data);
@$info->set('user_personal_data', $this->user_personal_data);
@$info->set('user_professional_data', $this->user_professional_data);
$info->set('blogsetting_status', $this->blogsetting_status);
$info->set('type', $this->profile_type);
$info->set('profile_type', $this->profile_type);
$info->set('section_info', $this->section_info);
$info->set_object('user_info', $this->user_info);
$info->set('request_data', $this->request_data);
$inner_html = $info->fetch();
return $inner_html;
}