本文整理汇总了PHP中TemplateHandler类的典型用法代码示例。如果您正苦于以下问题:PHP TemplateHandler类的具体用法?PHP TemplateHandler怎么用?PHP TemplateHandler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TemplateHandler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showTransactionDetails
/**
* Show details for specified transaction
*/
private function showTransactionDetails()
{
$manager = ShopTransactionsManager::getInstance();
$buyer_manager = ShopBuyersManager::getInstance();
$address_manager = ShopDeliveryAddressManager::getInstance();
$id = fix_id($_REQUEST['id']);
$transaction = $manager->getSingleItem($manager->getFieldNames(), array('id' => $id));
$buyer = $buyer_manager->getSingleItem($buyer_manager->getFieldNames(), array('id' => $transaction->buyer));
$address = $address_manager->getSingleItem($address_manager->getFieldNames(), array('id' => $transaction->address));
$full_address = "{$address->name}\n\n{$address->street}\n";
$full_address .= "{$address->zip} {$address->city}\n";
if (empty($address->state)) {
$full_address .= $address->country;
} else {
$full_address .= "{$address->state}, {$address->country}";
}
$params = array('id' => $transaction->id, 'uid' => $transaction->uid, 'type' => $transaction->type, 'type_string' => '', 'status' => $transaction->status, 'currency' => $transaction->currency, 'handling' => $transaction->handling, 'shipping' => $transaction->shipping, 'timestamp' => $transaction->timestamp, 'delivery_method' => $transaction->delivery_method, 'remark' => $transaction->remark, 'total' => $transaction->total, 'first_name' => $buyer->first_name, 'last_name' => $buyer->last_name, 'email' => $buyer->email, 'address_name' => $address->name, 'address_street' => $address->street, 'address_city' => $address->city, 'address_zip' => $address->zip, 'address_state' => $address->state, 'address_country' => $address->country, 'full_address' => $full_address);
$template = new TemplateHandler('transaction_details.xml', $this->path . 'templates/');
// register tag handler
$template->registerTagHandler('_item_list', $this, 'tag_TransactionItemList');
$template->registerTagHandler('_transaction_status', $this, 'tag_TransactionStatus');
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例2: display
function display()
{
require_once "include/Expressions/Dependency.php";
require_once "include/TemplateHandler/TemplateHandler.php";
$th = new TemplateHandler();
$depScript = $th->createDependencyJavascript(array('phone_office' => array('calculated' => true, "formula" => 'add(strlen($name), $employees)', "enforced" => true)), array(), "EditView");
$smarty = new Sugar_Smarty();
$smarty->assign("dependencies", $depScript);
$smarty->display('modules/ExpressionEngine/tpls/cfTest.tpl');
}
示例3: embedSWF
/**
* Embed flash player with specified parameters
*
* @param string $url
* @param string $target_id
* @param integer $width
* @param integer $height
* @param array $flash_vars
* @param array $params
*/
public function embedSWF($url, $target_id, $width, $height, $flash_vars = array(), $params = array())
{
$template = new TemplateHandler('embed.xml', $this->path . 'templates/');
$template->setMappedModule($this->name);
$p_flashvars = json_encode($flash_vars);
$p_params = json_encode($params);
$script = "swfobject.embedSWF('{$url}', '{$target_id}', '{$width}', '{$height}', '{$this->flash_version}', null, {$p_flashvars}, {$p_params});";
$params = array('params' => $p_params, 'flash_vars' => $p_flashvars, 'url' => $url, 'id' => $target_id, 'width' => $width, 'height' => $height, 'version' => $this->flash_version, 'script' => $script);
$template->restoreXML();
$template->setLocalParams($params);
$template->parse();
}
示例4: display
public function display()
{
global $current_user;
$this->bean->custom_fields->retrieve();
unset($this->dv->defs['templateMeta']['form']['buttons'][1]);
unset($this->dv->defs['templateMeta']['form']['buttons'][2]);
unset($this->dv->defs['templateMeta']['form']['buttons'][3]);
unset($this->dv->defs['templateMeta']['form']['buttons'][4]);
$th = new TemplateHandler();
$th->clearCache($this->module);
parent::display();
}
示例5: procSmartPhone
function procSmartPhone(&$oSmartPhone)
{
$prev_date = Context::get('prev_date');
if ($prev_date) {
$oSmartPhone->setPrevUrl(getUrl('date', $prev_date, 'document_srl', ''));
}
$next_date = Context::get('next_date');
if ($next_date) {
$oSmartPhone->setNextUrl(getUrl('date', $next_date, 'document_srl', ''));
}
$oTemplate = new TemplateHandler();
$content = $oTemplate->compile($this->module_path . 'tpl', 'smartphone');
$oSmartPhone->setContent($content);
}
示例6: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
// 제목
$title = $args->title;
// 출력된 목록 수
$list_count = (int) $args->list_count;
if (!$list_count) {
$list_count = 5;
}
$args->list_count = $list_count;
// 중복 허용/ 비허용 체크
if ($args->allow_repetition != 'Y') {
$output = executeQueryArray('widgets.planet_document.getUniqueNewestDocuments', $args);
} else {
$output = executeQueryArray('widgets.planet_document.getNewestDocuments', $args);
}
// 플래닛 글 목록 구함
$oPlanetModel =& getModel('planet');
Context::set('planet', $planet = $oPlanetModel->getPlanet());
if (count($output->data)) {
foreach ($output->data as $key => $val) {
$document_srl = $val->document_srl;
$oPlanet = null;
$oPlanet = new PlanetItem();
$oPlanet->setAttribute($val);
$planet_list[] = $oPlanet;
}
} else {
$planet_list = array();
}
Context::set('planet_list', $planet_list);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
$tpl_file = 'list';
if (!$args->thumbnail_width) {
$args->thumbnail_width = 50;
}
if (!$args->thumbnail_height) {
$args->thumbnail_height = 50;
}
$widget_info->thumbnail_width = $args->thumbnail_width;
$widget_info->thumbnail_height = $args->thumbnail_height;
$widget_info->domain = Context::getDefaultUrl();
if (!$args->show_number_of_comments) {
$args->show_number_of_comments = "N";
}
if (!$args->show_author_name) {
$args->show_author_name = "N";
}
$widget_info->show_number_of_comments = $args->show_number_of_comments;
$widget_info->show_author_name = $args->show_author_name;
$widget_info->content_cut_size = $args->content_cut_size;
Context::set('widget_info', $widget_info);
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
$output = $oTemplate->compile($tpl_path, $tpl_file);
return $output;
}
示例7: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
$list_count = (int) $args->list_count;
if (!$list_count) {
$list_count = 5;
}
$use_mid = $args->use_mid;
if ($use_mid == 'mid') {
$mid = Context::get('mid');
} else {
$mid = null;
}
$obj->list_count = $list_count;
$obj->mid = $mid;
// session model 객체 생성
$oSessionModel =& getModel('session');
$output = $oSessionModel->getLoggedMembers($obj);
$widget_info->member_list = $output->data;
$widget_info->logged_member_count = $output->total_count;
Context::set('widget_info', $widget_info);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
$tpl_file = 'list';
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
$output = $oTemplate->compile($tpl_path, $tpl_file);
return $output;
}
示例8: triggerDispFileAdditionSetup
/**
* This is for additional configuration for service module
* It only receives file configurations
*
* @param string $obj The html string of page of addition setup of module
* @return Object
*/
function triggerDispFileAdditionSetup(&$obj)
{
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if (!$current_module_srl && !$current_module_srls) {
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if (!$current_module_srl) {
return new Object();
}
}
// Get file configurations of the module
$oFileModel = getModel('file');
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
Context::set('file_config', $file_config);
// Get a permission for group setting
$oMemberModel = getModel('member');
$site_module_info = Context::get('site_module_info');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
// Set a template file
$oTemplate =& TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'file_module_config');
$obj .= $tpl;
return new Object();
}
示例9: transHTML
/**
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
*/
function transHTML($xml_obj)
{
$args = new stdClass();
$args->poll_srl = $xml_obj->attrs->poll_srl;
$skin = $xml_obj->attrs->skin;
if (!$skin) {
$skin = 'default';
}
$args->skin = $skin;
preg_match('/width([^[:digit:]]+)([0-9]+)/i', $xml_obj->attrs->style, $matches);
$width = $matches[2];
if (!$width) {
$width = 400;
}
$args->style = sprintf('width:%dpx', $width);
// Set a path of the template skin (values of skin, colorset settings)
$tpl_path = sprintf('%sskins/%s', _XE_PATH_ . 'widgets/pollWidget/', $args->skin);
$tpl_file = 'pollview';
Context::set('colorset', $args->colorset);
Context::set('poll_srl', $args->poll_srl);
Context::set('style', $args->style);
// Compile a template
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例10: triggerDispPointAdditionSetup
/**
* @brief Additional configurations for a service module
* Receive the form for the form used by point
*/
function triggerDispPointAdditionSetup(&$obj)
{
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if (!$current_module_srl && !$current_module_srls) {
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if (!$current_module_srl) {
return new Object();
}
}
// Get the configuration information
$oModuleModel = getModel('module');
$config = $oModuleModel->getModuleConfig('point');
if ($current_module_srl) {
$module_config = $oModuleModel->getModulePartConfig('point', $current_module_srl);
if (!$module_config) {
$module_config['insert_document'] = $config->insert_document;
$module_config['insert_comment'] = $config->insert_comment;
$module_config['upload_file'] = $config->upload_file;
$module_config['download_file'] = $config->download_file;
$module_config['read_document'] = $config->read_document;
$module_config['voted'] = $config->voted;
$module_config['blamed'] = $config->blamed;
}
}
$module_config['module_srl'] = $current_module_srl;
$module_config['point_name'] = $config->point_name;
Context::set('module_config', $module_config);
// Set the template file
$oTemplate =& TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'point_module_config');
$obj .= $tpl;
return new Object();
}
示例11: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
// 대상 모듈 (mid_list는 기존 위젯의 호환을 위해서 처리하는 루틴을 유지. module_srls로 위젯에서 변경)
$oModuleModel =& getModel('module');
if ($args->mid_list) {
$mid_list = explode(",", $args->mid_list);
if (count($mid_list)) {
$module_srls = $oModuleModel->getModuleSrlByMid($mid_list);
if (count($module_srls)) {
$args->module_srls = implode(',', $module_srls);
} else {
$args->module_srls = null;
}
}
}
// 제목
$title = $args->title;
// 정렬 대상
$order_target = $args->order_target;
if (!in_array($order_target, array('list_order', 'update_order'))) {
$order_target = 'list_order';
}
// 정렬 순서
$order_type = $args->order_type;
if (!in_array($order_type, array('asc', 'desc'))) {
$order_type = 'asc';
}
// 출력된 목록 수
$list_count = (int) $args->list_count;
if (!$list_count) {
$list_count = 5;
}
// 대상 모듈이 선택되어 있지 않으면 해당 사이트의 전체 모듈을 대상으로 함
$site_module_info = Context::get('site_module_info');
if ($args->module_srls) {
$obj->module_srl = $args->module_srls;
} else {
if ($site_module_info) {
$obj->site_srl = (int) $site_module_info->site_srl;
}
}
$obj->sort_index = $order_target;
$obj->list_count = $list_count;
// trackback 모듈의 model 객체를 받아서 getTrackbackList() method를 실행
$oTrackbackModel =& getModel('trackback');
$output = $oTrackbackModel->getNewestTrackbackList($obj);
$widget_info->title = $title;
$widget_info->trackback_list = $output->data;
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i', $args->style, $matches);
$widget_info->width = trim($matches[3][0]);
Context::set('widget_info', $widget_info);
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
$tpl_file = 'list';
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例12: proc
/**
* @brief Widget execution
* Get extra_vars declared in ./widgets/widget/conf/info.xml as arguments
* After generating the result, do not print but return it.
*/
function proc($args)
{
// Get status of the accumulated, yesterday's, today's counts
$oCounterModel = getModel('counter');
$site_module_info = Context::get('site_module_info');
$output = $oCounterModel->getStatus(array('00000000', date('Ymd', $_SERVER['REQUEST_TIME'] - 60 * 60 * 24), date('Ymd')), $site_module_info->site_srl);
if (count($output)) {
foreach ($output as $key => $val) {
if (!$key) {
Context::set('total_counter', $val);
} elseif ($key == date("Ymd")) {
Context::set('today_counter', $val);
} else {
Context::set('yesterday_counter', $val);
}
}
}
// Set a path of the template skin (values of skin, colorset settings)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// Specify a template file
$tpl_file = 'counter_status';
// Compile a template
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例13: proc
/**
* @brief 위젯의 실행 부분
*
* ./widgets/위젯/conf/info.xml 에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
$oDocument =& getClass('document');
$site_module_info = Context::get('site_module_info');
Context::set('widget_info', $widget_info);
$args->site_srl = (int) $site_module_info->site_srl;
// 회원수 추출
$output = executeQuery('widgets.site_info.getMemberCount', $args);
$widget_info->member_count = $output->data->cnt;
// 새글 추출
$args->regdate = date("YmdHis", time() - 24 * 60 * 60);
$output = executeQuery('widgets.site_info.getNewDocument', $args);
$widget_info->new_documents = $output->data->cnt;
// 개설일
$output = executeQuery('widgets.site_info.getCreatedDate', $args);
$widget_info->created = $output->data->regdate;
// 가입 여부
$logged_info = Context::get('logged_info');
if (count($logged_info->group_list)) {
$widget_info->joined = true;
} else {
$widget_info->joined = false;
}
Context::set('widget_info', $widget_info);
Context::set('colorset', $args->colorset);
// 템플릿 컴파일
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
$tpl_file = 'site_info';
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例14: proc
/**
* @brief 위젯의 실행 부분
* ./widgets/위젯/conf/info.xml에 선언한 extra_vars를 args로 받는다
* 결과를 만든후 print가 아니라 return 해주어야 한다
**/
function proc($args)
{
// 템플릿의 스킨 경로를 지정 (skin, colorset에 따른 값을 설정)
$tpl_path = sprintf('%sskins/%s', $this->widget_path, $args->skin);
Context::set('colorset', $args->colorset);
// 템플릿 파일을 지정
if (Context::get('is_logged')) {
$tpl_file = 'login_info';
} else {
$tpl_file = 'login_form';
}
// 회원 관리 정보를 받음
$oModuleModel =& getModel('module');
$this->member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $this->member_config);
// ssl 사용시 현재 https접속상태인지에 대한 flag및 https url 생성
$ssl_mode = false;
if ($this->member_config->enable_ssl == 'Y') {
if (preg_match('/^https:\\/\\//i', Context::getRequestUri())) {
$ssl_mode = true;
}
}
Context::set('ssl_mode', $ssl_mode);
// 템플릿 컴파일
$oTemplate =& TemplateHandler::getInstance();
return $oTemplate->compile($tpl_path, $tpl_file);
}
示例15: triggerDispCommentAdditionSetup
/**
* @brief 모듈의 추가 설정에서 댓글 설정을 하는 form 추가
**/
function triggerDispCommentAdditionSetup(&$obj)
{
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if (!$current_module_srl && !$current_module_srls) {
// 선택된 모듈의 정보를 가져옴
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if (!$current_module_srl) {
return new Object();
}
}
// 댓글 설정을 구함
$oCommentModel =& getModel('comment');
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
Context::set('comment_config', $comment_config);
// 그룹 목록을 구함
$oMemberModel =& getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// 템플릿 파일 지정
$oTemplate =& TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path . 'tpl', 'comment_module_config');
$obj .= $tpl;
return new Object();
}