本文整理汇总了PHP中Phpfox_Template类的典型用法代码示例。如果您正苦于以下问题:PHP Phpfox_Template类的具体用法?PHP Phpfox_Template怎么用?PHP Phpfox_Template使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Phpfox_Template类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get
/**
* Get HTML form.
*
* @param array $aArgs ARRAY of settings to pass to the form.
* @return string HTML form.
*/
public function get($aArgs = array())
{
$aVars = Phpfox_Template::instance()->getVar('aForms');
$sHtml = '';
$sHtml .= '<input type="text" name="val[' . $aArgs['id'] . '][]" id="js_inline_input_' . $aArgs['id'] . '" style="width:' . $aArgs['width'] . ';" size="' . $aArgs['size'] . '"';
$sHtml .= " autocomplete=\"off\"";
if (isset($aArgs['edit']) && $aArgs['edit'] != '') {
$sHtml .= " value=\"" . $aArgs['edit'] . "\" ";
} elseif (isset($aArgs['display'])) {
$sHtml .= " value=\"" . $aArgs['display'] . "\" onfocus=\"if (this.value == '" . $aArgs['display'] . "') { this.value=''; }\"";
}
$sHtml .= " onkeyup=\"if (this.value != '') { oInlineSearch.call('" . $aArgs['id'] . "', '" . $aArgs['call'] . "', '" . Phpfox_Template::instance()->getVar('sTagType') . "'); }\" ";
$sHtml .= ' />';
if (isset($aArgs['type']) && $aArgs['type'] == 'comma') {
$sHtml .= ' <input type="button" value="Add" class="button" onclick="return oInlineSearch.addWithComma(\'' . $aArgs['id'] . '\');" />';
}
$sHtml .= '<div style="position:relative; width:' . $aArgs['width'] . '; z-index:100;"><div class="drop_layer" id="js_inline_hidden_' . $aArgs['id'] . '" style="position:absolute;"></div></div>';
$sHtml .= '<div class="inline_search_box" id="js_inline_search_box_' . $aArgs['id'] . '" style="width:' . $aArgs['width'] . ';"><div style="overflow:scroll; height:60px;"><div id="js_inline_search_content_' . $aArgs['id'] . '" style="padding:5px;"></div></div></div>';
if (isset($aArgs['info'])) {
$sHtml .= '<div class="p_4">' . $aArgs['info'] . '</div>';
}
if (isset($aVars[$aArgs['id']]) && is_array($aVars[$aArgs['id']])) {
$sHtml .= '<script type="text/javascript">';
foreach ($aVars[$aArgs['id']] as $mKey => $mValue) {
$sHtml .= "oInlineSearch.add('" . $aArgs['id'] . "', 'val[" . $aArgs['id'] . "]', '{$mKey}', '{$mValue}');";
}
$sHtml .= '</script>';
}
return $sHtml;
}
示例2: getNotificationAction
/** This function catches all the "actions" (Dislike, and in the future maybe others)
* */
public function getNotificationAction($aNotification)
{
//d($aNotification);die();
// get the type of item that was marked ("blog", "photo"...)
$aAction = $this->database()->select('*')->from(Phpfox::getT('action'))->where('action_id = ' . (int) $aNotification['item_id'])->limit(1)->execute('getSlaveRow');
if (empty($aAction) || !isset($aAction['item_type_id'])) {
return false;
throw new Exception('No type for this action (' . print_r($aAction, true) . ')');
}
// Check if the module is a sub module
if (preg_match('/(?P<module>[a-z]+)[_]?(?P<submodule>[a-z]{0,99})/i', $aAction['item_type_id'], $aMatch) < 1) {
throw new Exception('Malformed item_type');
}
// Call the module and get the title
if (!Phpfox::isModule($aMatch['module'])) {
return false;
}
$aRow = Phpfox::getService($aMatch['module'])->getInfoForAction($aAction);
$sUsers = Phpfox::getService('notification')->getUsers($aNotification);
$sTitle = Phpfox::getLib('parse.output')->shorten($aRow['title'], Phpfox::getParam('notification.total_notification_title_length'), '...');
$sPhrase = '';
if ($aNotification['user_id'] == $aRow['user_id']) {
// {users} disliked {gender} own {item} "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_gender_own_item_title', array('users' => $sUsers, 'gender' => Phpfox::getService('user')->gender($aRow['gender'], 1), 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} elseif ($aRow['user_id'] == Phpfox::getUserId()) {
// {users} liked your blog "{title}"
$sPhrase = Phpfox::getPhrase('like.users_disliked_your_item_title', array('users' => $sUsers, 'title' => $sTitle, 'item' => $aAction['item_type_id']));
} else {
$sPhrase = Phpfox::getPhrase('like.users_disliked_users_item', array('users' => $sUsers, 'row_full_name' => $aRow['full_name'], 'title' => $sTitle, 'item' => $aAction['item_type_id']));
}
return array('link' => $aRow['link'], 'message' => $sPhrase, 'icon' => Phpfox_Template::instance()->getStyle('image', 'activity.png', 'blog'));
}
示例3: addCategory
public function addCategory()
{
if (!Phpfox::getService('blog.category')->canAdd()) {
return $this->alert(Phpfox::getPhrase('blog.you_have_reached_your_limit'));
}
$aVals = $this->get('val');
$oBlogCategoryProcess = Phpfox::getService('blog.category.process');
$sCleanUrl = Phpfox::getLib('parse.input')->clean($aVals['add']);
if (Phpfox::getService('blog.category')->isPrivateCategory($sCleanUrl, Phpfox::getUserId())) {
$this->call('alert("' . Phpfox::getPhrase('blog.already_a_category') . '"); $("#js_add_category").val(""); $("#js_add_category").focus();');
return false;
}
$aCategories = explode(',', $aVals['add']);
$aRows = array();
foreach ($aCategories as $sCategory) {
$sCategory = trim($sCategory);
$iId = $oBlogCategoryProcess->add($sCategory);
$aRows[] = array('category_id' => $iId, 'name' => Phpfox::getLib('parse.input')->clean($sCategory, 255));
}
rsort($aRows);
foreach ($aRows as $aRow) {
Phpfox_Template::instance()->assign(array('aItem' => array('category_id' => $aRow['category_id'], 'name' => $aRow['name'], 'user_id' => Phpfox::getUserId())));
Phpfox_Template::instance()->getTemplate('blog.block.category-form');
}
$this->call('$("#js_add_new_category").prepend("' . $this->getContent() . '"); $("#js_category_info").html("' . Phpfox::getPhrase('blog.added') . '").highlightFade().fadeOut(5000); $("#js_add_category").val(""); $Core.loadInit();');
}
示例4: process
/**
* Controller
*/
public function process()
{
// $this->request()->cache('text/html', strtotime('-2 days'), 7);
if ($sPlugin = Phpfox_Plugin::get('core.component_controller_index_member_start')) {
eval($sPlugin);
}
if ($this->request()->segment(1) != 'hashtag') {
Phpfox::isUser(true);
}
if ($this->request()->get('req3') == 'customize') {
define('PHPFOX_IN_DESIGN_MODE', true);
define('PHPFOX_CAN_MOVE_BLOCKS', true);
if ($iTestStyle = $this->request()->get('test_style_id')) {
if (Phpfox_Template::instance()->testStyle($iTestStyle)) {
}
}
$aDesigner = array('current_style_id' => Phpfox::getUserBy('style_id'), 'design_header' => Phpfox::getPhrase('core.customize_dashboard'), 'current_page' => $this->url()->makeUrl(''), 'design_page' => $this->url()->makeUrl('core.index-member', 'customize'), 'block' => 'core.index-member', 'item_id' => Phpfox::getUserId(), 'type_id' => 'user');
$this->setParam('aDesigner', $aDesigner);
$this->template()->setPhrase(array('theme.are_you_sure'))->setHeader('cache', array('style.css' => 'style_css', 'video.css' => 'module_video', 'design.js' => 'module_theme', 'select.js' => 'module_theme'));
if (Phpfox::getParam('profile.can_drag_drop_blocks_on_profile')) {
$this->template()->setHeader('cache', array('jquery/ui.js' => 'static_script', 'sort.js' => 'module_theme'))->setHeader(array('<script type="text/javascript">$Behavior.core_controller_member_designonupdate = function() { function designOnUpdate() { $Core.design.updateSorting(); } };</script>', '<script type="text/javascript">$Behavior.core_controller_init = function() { $Core.design.init({type_id: \'user\'}); };</script>'));
}
} else {
// $this->template()->setHeader('jquery/ui.js', 'static_script');
$this->template()->setHeader('cache', array('sort.js' => 'module_theme', 'design.js' => 'module_theme', 'video.css' => 'module_video'))->setHeader(array());
}
if (Phpfox::getParam('video.convert_servers_enable')) {
$this->template()->setHeader('<script type="text/javascript">document.domain = "' . Phpfox::getParam('video.convert_js_parent') . '";</script>');
}
Phpfox_Module::instance()->setCacheBlockData(array('table' => 'user_dashboard', 'field' => 'user_id', 'item_id' => Phpfox::getUserId(), 'controller' => 'core.index-member'));
$this->template()->setHeader('cache', array('feed.js' => 'module_feed', 'welcome.css' => 'style_css', 'announcement.css' => 'style_css', 'comment.css' => 'style_css', 'quick_edit.js' => 'static_script', 'jquery/plugin/jquery.highlightFade.js' => 'static_script', 'jquery/plugin/jquery.scrollTo.js' => 'static_script'))->setEditor(array('load' => 'simple'));
}
示例5: getDashboardLinks
public function getDashboardLinks()
{
$aMenus = array();
$aModules = Phpfox::massCallback('getDashboardLinks');
foreach ($aModules as $aModule) {
if ($aModule === false) {
continue;
}
if (isset($aModule['submit']['link'])) {
$aMenus['submit'][] = $aModule['submit'];
} else {
foreach ($aModule['submit'] as $aSubModule) {
$aMenus['submit'][] = $aSubModule;
}
}
$aMenus['edit'][] = $aModule['edit'];
}
$aProfileMenus = Phpfox_Template::instance()->getMenu('profile');
foreach ($aProfileMenus as $aProfileMenu) {
if ($aProfileMenu['url'] == 'profile') {
continue;
}
$aMenus['profile'][] = array('module' => $aProfileMenu['module'], 'var_name' => $aProfileMenu['var_name'], 'url' => $aProfileMenu['url']);
}
// $this->cache()->save($sCacheId, $aMenus);
return $aMenus;
}
示例6: getRequestLink
public function getRequestLink()
{
($sPlugin = Phpfox_Plugin::get('comment.component_service_callback_getrequestlink__start')) ? eval($sPlugin) : false;
$iTotalApproveCount = $this->database()->select('COUNT(*)')->from(Phpfox::getT('comment'))->where('owner_user_id = ' . Phpfox::getUserId() . ' AND view_id = 1')->execute('getSlaveField');
if (!Phpfox::getParam('request.display_request_box_on_empty') && !$iTotalApproveCount) {
return null;
}
return '<li><a href="' . Phpfox_Url::instance()->makeUrl('request', '#comment') . '"' . (!$iTotalApproveCount ? ' onclick="alert(\'' . Phpfox::getPhrase('comment.nothing_new_to_approve') . '\'); return false;"' : '') . '><img src="' . Phpfox_Template::instance()->getStyle('image', 'misc/comment.png') . '" alt="" class="v_middle" /> ' . Phpfox::getPhrase('comment.comments_pending_approval_total', array('total' => $iTotalApproveCount)) . '</a></li>';
}
示例7: getContent
public function getContent()
{
$Template = \Phpfox_Template::instance();
if (!$this->_render) {
/*
if (PHPFOX_IS_AJAX_PAGE) {
\Phpfox_Module::instance()->getControllerTemplate();
$content = ob_get_contents(); ob_clean();
$content = (string) new View\Functions('content', $content);
return $content;
}
else {
\Phpfox_Module::instance()->getControllerTemplate();
$content = ob_get_contents(); ob_clean();
$this->_render['name'] = '@Base/Layout.html';
$this->_render['params']['content'] = $content;
}
*/
\Phpfox_Module::instance()->getControllerTemplate();
$content = ob_get_contents();
ob_clean();
$this->_render['name'] = '@Base/' . self::$template . '.html';
$this->_render['params']['content'] = $content;
}
$params = $this->_render['params'];
$params['content'] = $this->_env->render($this->_render['name'], $params);
if (PHPFOX_IS_AJAX_PAGE) {
$content = (string) new View\Functions('content', $params['content']);
return $content;
}
// $params['content'] = '<div class="_block_content">' . $params['content'] . '</div>';
$params['content'] = new View\Functions('content', $params['content']);
$params['header'] = $Template->getHeader();
$params['title'] = $Template->getTitle();
$params['js'] = $Template->getFooter();
$params['nav'] = new View\Functions('nav');
$params['menu'] = new View\Functions('menu');
$params['share'] = new View\Functions('share');
$params['notify'] = new View\Functions('notify');
$params['search'] = new View\Functions('search');
$params['footer'] = new View\Functions('footer');
$params['errors'] = new View\Functions('errors');
$params['top'] = new View\Functions('top');
$params['left'] = new View\Functions('left');
$params['right'] = new View\Functions('right');
$params['h1'] = new View\Functions('h1');
$params['breadcrumb'] = new View\Functions('breadcrumb');
$params['notification'] = new View\Functions('notification');
$params['logo'] = new View\Functions('logo');
$params['body'] = 'id="page_' . \Phpfox_Module::instance()->getPageId() . '" class="' . \Phpfox_Module::instance()->getPageClass() . '"';
// d($params['active']); exit;
$locale = \Phpfox_Locale::instance()->getLang();
$params['html'] = 'xmlns="http://www.w3.org/1999/xhtml" dir="' . $locale['direction'] . '" lang="' . $locale['language_code'] . '"';
// return $this->_env->render($this->_render['name'], $params);
return $this->_env->render('@Theme/' . self::$template . '.html', $params);
}
示例8: getNotificationLink
public function getNotificationLink($mId, $mTotal = null)
{
$sImage = '<img src="' . Phpfox_Template::instance()->getStyle('image', 'misc/email.png') . '" alt="" class="v_middle" />';
if (is_array($mId) && $mTotal === null) {
return Phpfox::getPhrase('mail.li_a_href_link_email_image_new_messages_messages_number_a_li', array('link' => Phpfox_Url::instance()->makeUrl('mail'), 'email_image' => $sImage, 'messages_number' => isset($mId['mail']) ? $mId['mail'] : '0'));
} else {
return '<li><a href="' . Phpfox_Url::instance()->makeUrl('mail') . '" class="js_nofitication_' . $mId . '">' . $sImage . ' ' . ($mTotal > 1 ? Phpfox::getPhrase('mail.total_new_messages', array('total' => $mTotal)) : Phpfox::getPhrase('mail.1_new_message')) . '</a></li>';
}
}
示例9: getSource
public function getSource($name)
{
if ($name == '@Theme/layout.html') {
$Theme = \Phpfox_Template::instance()->theme()->get();
$Service = new \Core\Theme\Service($Theme);
return $Service->html()->get();
}
return parent::getSource($name);
}
示例10: process
/**
* Controller
*/
public function process()
{
Phpfox::isUser(true);
if (!Phpfox::getParam('mail.threaded_mail_conversation')) {
$this->url()->send('mail');
}
$aVals = $this->request()->get('val');
if ($aVals && ($iNewId = Mail_Service_Process::instance()->add($aVals))) {
list($aCon, $aMessages) = Mail_Service_Mail::instance()->getThreadedMail($iNewId);
$aMessages = array_reverse($aMessages);
Phpfox_Template::instance()->assign(array('aMail' => $aMessages[0], 'aCon' => $aCon, 'bIsLastMessage' => true))->getTemplate('mail.block.entry');
$content = ob_get_contents();
ob_clean();
return ['append' => ['to' => '#mail_threaded_new_message', 'with' => $content]];
}
$iThreadId = $this->request()->getInt('id');
list($aThread, $aMessages) = Mail_Service_Mail::instance()->getThreadedMail($iThreadId);
if ($aThread === false) {
return Phpfox_Error::display(Phpfox::getPhrase('mail.unable_to_find_a_conversation_history_with_this_user'));
}
$aValidation = array('message' => Phpfox::getPhrase('mail.add_reply'));
$oValid = Phpfox_Validator::instance()->set(array('sFormName' => 'js_form', 'aParams' => $aValidation));
if ($aThread['user_is_archive']) {
$this->request()->set('view', 'trash');
}
Mail_Service_Mail::instance()->buildMenu();
Mail_Service_Process::instance()->threadIsRead($aThread['thread_id']);
$iUserCnt = 0;
$sUsers = '';
$bCanViewThread = false;
foreach ($aThread['users'] as $aUser) {
if ($aUser['user_id'] == Phpfox::getUserId()) {
$bCanViewThread = true;
}
if ($aUser['user_id'] == Phpfox::getUserId()) {
continue;
}
$iUserCnt++;
if ($iUserCnt == count($aThread['users']) - 1 && count($aThread['users']) - 1 > 1) {
$sUsers .= ' & ';
} else {
if ($iUserCnt != '1') {
$sUsers .= ', ';
}
}
$sUsers .= $aUser['full_name'];
}
if (!$bCanViewThread) {
return Phpfox_Error::display('Unable to view this thread.');
} else {
$this->template()->setBreadcrumb(Phpfox::getPhrase('mail.mail'), $this->url()->makeUrl('mail'))->setBreadcrumb($sUsers, $this->url()->makeUrl('mail.thread', array('id' => $iThreadId)), true);
}
$this->template()->setTitle($sUsers)->setTitle(Phpfox::getPhrase('mail.mail'))->setHeader('cache', array('mail.js' => 'module_mail', 'jquery/plugin/jquery.scrollTo.js' => 'static_script'))->assign(array('sCreateJs' => $oValid->createJS(), 'sGetJsForm' => $oValid->getJsForm(false), 'aMessages' => $aMessages, 'aThread' => $aThread, 'sCurrentPageCnt' => $this->request()->getInt('page', 0) + 1));
$this->setParam('attachment_share', array('type' => 'mail', 'id' => 'js_form_mail'));
$this->setParam('global_moderation', array('name' => 'mail', 'ajax' => 'mail.mailThreadAction', 'custom_fields' => '<div><input type="hidden" name="forward_thread_id" value="' . $aThread['thread_id'] . '" id="js_forward_thread_id" /></div>', 'menu' => array(array('phrase' => Phpfox::getPhrase('mail.forward'), 'action' => 'forward'))));
}
示例11: __construct
public function __construct($assets)
{
if (!is_array($assets)) {
$assets = [$assets];
}
foreach ($assets as $asset) {
if (substr($asset, 0, 7) == '@static') {
\Phpfox_Template::instance()->delayedHeaders[] = [str_replace('@static/', '', $asset) => 'static_script'];
}
}
}
示例12: __construct
public function __construct($path = null)
{
$this->request = new Request();
$this->url = new Url();
$this->active = (new \Api\User())->get(\Phpfox::getUserId());
$this->_template = \Phpfox_Template::instance();
$this->_view = new View();
if ($path !== null && is_dir($path)) {
$this->_view->loader()->addPath($path);
}
}
示例13: addThreadMail
public function addThreadMail()
{
$aVals = $this->get('val');
if ($iNewId = Mail_Service_Process::instance()->add($aVals)) {
list($aCon, $aMessages) = Mail_Service_Mail::instance()->getThreadedMail($iNewId);
$aMessages = array_reverse($aMessages);
Phpfox_Template::instance()->assign(array('aMail' => $aMessages[0], 'aCon' => $aCon, 'bIsLastMessage' => true))->getTemplate('mail.block.entry');
$this->call('$(\'.mail_thread_holder\').removeClass(\'is_last_message\');');
$this->append('#mail_threaded_new_message', $this->getContent(false));
$this->call("\$.scrollTo('.is_last_message:first');");
$this->call("\$('.mail_thread_form_holder').addClass('not_fixed');");
}
}
示例14: display
/**
* Displays the error message and directly creates a variable for the template engine
*
* @static
* @param string $sMsg Error message you want to display on the current page the user is on.
*/
public static function display($sMsg, $iErrCode = null)
{
if (PHPFOX_IS_AJAX) {
echo $sMsg;
} else {
Phpfox_Module::instance()->setController('error.display');
Phpfox_Template::instance()->assign(array('sErrorMessage' => $sMsg));
}
if ($iErrCode !== null) {
$oUrl = Phpfox_Url::instance();
header($oUrl->getHeaderCode($iErrCode));
}
return false;
}
示例15: loadProfileBlock
public function loadProfileBlock()
{
exit;
$sProfileUrl = str_replace('profile_', '', $this->get('url'));
if ($this->get('url') == 'profile_info') {
$sProfileUrl = 'profile';
}
if (!Phpfox::isModule($sProfileUrl)) {
Phpfox_Error::set('Trying to load an invalid module.');
} else {
if (!Phpfox::hasCallback($sProfileUrl, 'getAjaxProfileController')) {
Phpfox_Error::set('Unable to load the section you are looking for.');
}
}
if (Phpfox_Error::isPassed()) {
$oModule = Phpfox_Module::instance();
$oTpl = Phpfox_Template::instance();
$oTpl->assign(array('bIsAjaxLoader' => true));
$aStyleInUse = $oTpl->getStyleInUse();
$oModule->loadBlocks();
$aUrlParams = array($this->get('user_name'));
if ($this->get('url') != 'profile') {
$aUrlParams[] = str_replace('profile_', '', $this->get('url'));
}
Phpfox_Url::instance()->setParam($aUrlParams);
$oModule->setController(Phpfox::callback($sProfileUrl . '.getAjaxProfileController'));
if ($aStyleInUse['total_column'] == '3') {
$oTpl->assign(array('aBlocks1' => $oTpl->bIsSample ? true : Phpfox_Module::instance()->getModuleBlocks(1), 'aBlocks3' => $oTpl->bIsSample ? true : Phpfox_Module::instance()->getModuleBlocks(3), 'aAdBlocks1' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Ad_Service_Ad::instance()->getForBlock(1) : null), 'aAdBlocks3' => $oTpl->bIsSample ? true : (Phpfox::isModule('ad') ? Ad_Service_Ad::instance()->getForBlock(3) : null)));
} else {
$oTpl->assign(array('aBlocks1' => array(), 'aBlocks3' => array(), 'aAdBlocks1' => array(), 'aAdBlocks3' => array()));
}
$oTpl->assign(array('sPublicMessage' => Phpfox::getMessage(), 'aErrors' => Phpfox_Error::getDisplay() ? Phpfox_Error::get() : array(), 'aStyleInUse' => $aStyleInUse));
list($aBreadCrumbs, $aBreadCrumbTitle) = $oTpl->getBreadCrumb();
$this->remove('#js_temp_breadcrumb');
if (count($aBreadCrumbs)) {
foreach ($aBreadCrumbs as $sLink => $sPhrase) {
$this->append('h1', '<span id="js_temp_breadcrumb"><span class="profile_breadcrumb">»</span><a href="' . $sLink . '">' . $sPhrase . '</a></span>');
break;
}
}
$oTpl->getLayout($oTpl->sDisplayLayout);
$this->html($aStyleInUse['total_column'] == '3' ? '#content_load_data' : '#content', $this->getContent(false));
if ($this->get('url') == 'profile_info') {
$this->call('$Core.loadProfileInfo();');
}
} else {
$this->html('#js_profile_block_view_data_' . $this->get('url'), implode('', Phpfox_Error::get()));
}
$this->call('$Core.loadInit();');
}