本文整理汇总了PHP中TPL::import_js方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::import_js方法的具体用法?PHP TPL::import_js怎么用?PHP TPL::import_js使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::import_js方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mp_menu_action
public function mp_menu_action()
{
$this->crumb(AWS_APP::lang()->_t('菜单管理'), 'admin/weixin/mp_menu/');
if (!isset($_GET['id'])) {
$_GET['id'] = 0;
}
$accounts_list = $this->model('weixin')->get_accounts_info();
$account_id = $accounts_list[$_GET['id']]['id'];
if (!isset($account_id)) {
H::redirect_msg(AWS_APP::lang()->_t('公众账号不存在'));
}
if ($accounts_list[$account_id]['weixin_account_role'] == 'base' or !$accounts_list[$account_id]['weixin_app_id'] or !$accounts_list[$account_id]['weixin_app_secret']) {
H::redirect_msg(AWS_APP::lang()->_t('此功能不适用于未通过微信认证的订阅号'), '/admin/');
}
$this->model('weixin')->client_list_image_clean($accounts_list[$account_id]['weixin_mp_menu']);
TPL::assign('account_id', $account_id);
TPL::assign('mp_menu', $accounts_list[$account_id]['weixin_mp_menu']);
TPL::assign('accounts_list', $accounts_list);
TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(803));
TPL::assign('feature_list', $this->model('feature')->get_enabled_feature_list('id DESC', null, null));
if (get_setting('category_enable') == 'Y') {
TPL::assign('category_data', json_decode($this->model('system')->build_category_json('question'), true));
}
TPL::assign('reply_rule_list', $this->model('weixin')->fetch_unique_reply_rule_list($account_id));
TPL::import_js('js/fileupload.js');
TPL::import_js('js/md5.js');
TPL::output('admin/weixin/mp_menu');
}
示例2: index_action
public function index_action()
{
if (!$this->user_id) {
HTTP::redirect('/explore/');
}
if (!$this->user_info['email']) {
HTTP::redirect('/account/complete_profile/');
}
// 边栏可能感兴趣的人或话题
if (TPL::is_output('block/sidebar_recommend_users_topics.tpl.htm', 'home/index')) {
$recommend_users_topics = $this->model('module')->recommend_users_topics($this->user_id);
TPL::assign('sidebar_recommend_users_topics', $recommend_users_topics);
}
// 边栏热门用户
if (TPL::is_output('block/sidebar_hot_users.tpl.htm', 'home/index')) {
$sidebar_hot_users = $this->model('module')->sidebar_hot_users($this->user_id);
TPL::assign('sidebar_hot_users', $sidebar_hot_users);
}
$this->crumb(AWS_APP::lang()->_t('动态'), '/home/');
TPL::import_js('js/app/index.js');
if ($_GET['first_login']) {
TPL::import_js('js/ajaxupload.js');
}
TPL::output('home/index');
}
示例3: index_action
public function index_action()
{
if (is_digits($_GET['id'])) {
$feature_info = $this->model('feature')->get_feature_by_id($_GET['id']);
} else {
$feature_info = $this->model('feature')->get_feature_by_url_token($_GET['id']);
}
if (!$feature_info) {
header('HTTP/1.1 404 Not Found');
H::redirect_msg(AWS_APP::lang()->_t('专题不存在'), '/');
}
if (!$feature_info['enabled']) {
H::redirect_msg(AWS_APP::lang()->_t('专题未启用'), '/');
}
if ($feature_info['url_token'] != $_GET['id'] and !$_GET['sort_type'] and !$_GET['is_recommend']) {
HTTP::redirect('/feature/' . $feature_info['url_token']);
}
if (!($topic_list = $this->model('topic')->get_topics_by_ids($this->model('feature')->get_topics_by_feature_id($feature_info['id'])))) {
H::redirect_msg(AWS_APP::lang()->_t('专题下必须包含一个以上话题'), '/');
}
if ($feature_info['seo_title']) {
TPL::assign('page_title', $feature_info['seo_title']);
} else {
$this->crumb($feature_info['title'], '/feature/' . $feature_info['url_token']);
}
TPL::assign('sidebar_hot_topics', $topic_list);
TPL::assign('feature_info', $feature_info);
TPL::import_js('js/app/feature.js');
TPL::output('feature/detail');
}
示例4: login_action
public function login_action()
{
$url = base64_decode($_GET['url']);
if ($this->user_id) {
if ($url) {
header('Location: ' . $url);
} else {
HTTP::redirect('/');
}
}
if (is_mobile()) {
HTTP::redirect('/m/login/url-' . $_GET['url']);
}
$this->crumb(AWS_APP::lang()->_t('登录'), '/account/login/');
TPL::import_css('css/login.css');
// md5 password...
if (get_setting('ucenter_enabled') != 'Y') {
TPL::import_js('js/md5.js');
}
if ($_GET['url']) {
$return_url = htmlspecialchars(base64_decode($_GET['url']));
} else {
$return_url = htmlspecialchars($_SERVER['HTTP_REFERER']);
}
TPL::assign('return_url', $return_url);
TPL::output("account/login");
}
示例5: setup
public function setup()
{
HTTP::no_cache_header();
TPL::import_clean();
TPL::import_css(array('mobile/css/icon.css', 'mobile/css/mobile.css'));
TPL::import_js(array('js/jquery.2.js', 'js/jquery.form.js', 'mobile/js/framework.js', 'mobile/js/aws-mobile.js', 'mobile/js/app.js', 'mobile/js/aw-mobile-template.js'));
}
示例6: nav_menu_action
public function nav_menu_action()
{
$this->crumb(AWS_APP::lang()->_t('导航设置'), 'admin/nav_menu/');
if (!$this->user_info['permission']['is_administortar']) {
H::redirect_msg(AWS_APP::lang()->_t('你没有访问权限, 请重新登录'), '/');
}
TPL::assign('nav_menu_list', $this->model('menu')->get_nav_menu_list());
TPL::assign('category_list', $this->model('system')->build_category_html('question', 0, 0, null, true));
TPL::assign('setting', get_setting());
TPL::import_js(array('js/fileupload.js'));
TPL::assign('menu_list', $this->model('admin')->fetch_menu_list(307));
TPL::output('admin/nav_menu');
}
示例7: profile_action
public function profile_action()
{
$this->crumb(AWS_APP::lang()->_t('基本资料'), '/account/setting/profile/');
for ($i = date('Y'); $i > 1900; $i--) {
$birthday_y[$i] = $i;
}
TPL::assign('birthday_y', $birthday_y);
for ($tmp_i = 1; $tmp_i <= 31; $tmp_i++) {
$birthday_d[$tmp_i] = $tmp_i;
}
TPL::assign('birthday_d', $birthday_d);
TPL::assign('job_list', $this->model('work')->get_jobs_list());
TPL::assign('education_experience_list', $this->model('education')->get_education_experience_list($this->user_id));
$jobs_list = $this->model('work')->get_jobs_list();
if ($work_experience_list = $this->model('work')->get_work_experience_list($this->user_id)) {
foreach ($work_experience_list as $key => $val) {
$work_experience_list[$key]['job_name'] = $jobs_list[$val['job_id']];
}
}
TPL::assign('work_experience_list', $work_experience_list);
TPL::import_js('js/fileupload.js');
TPL::output('account/setting/profile');
}
示例8: index_action
//.........这里部分代码省略.........
$answer['user_rated_uninterested'] = $answer_users_rated_uninterested[$answer['answer_id']];
$answer['answer_content'] = $this->model('question')->parse_at_user(FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($answer['answer_content']))));
$answer['agree_users'] = $answer_agree_users[$answer['answer_id']];
$answer['agree_status'] = $answer_vote_status[$answer['answer_id']];
if ($question_info['best_answer'] == $answer['answer_id'] and intval($_GET['page']) < 2) {
$answers[0] = $answer;
} else {
$answers[] = $answer;
}
}
if (!$answers[0]) {
unset($answers[0]);
}
if (get_setting('answer_unique') == 'Y') {
if ($this->model('answer')->has_answer_by_uid($question_info['question_id'], $this->user_id)) {
TPL::assign('user_answered', 1);
} else {
TPL::assign('user_answered', 0);
}
}
TPL::assign('answers', $answers);
TPL::assign('answer_count', $answer_count);
}
if ($this->user_id) {
TPL::assign('question_thanks', $this->model('question')->get_question_thanks($question_info['question_id'], $this->user_id));
TPL::assign('invite_users', $this->model('question')->get_invite_users($question_info['question_id']));
TPL::assign('user_follow_check', $this->model('follow')->user_follow_check($this->user_id, $question_info['published_uid']));
if ($this->user_info['draft_count'] > 0) {
TPL::assign('draft_content', $this->model('draft')->get_data($question_info['question_id'], 'answer', $this->user_id));
}
}
$question_info['question_detail'] = FORMAT::parse_attachs(nl2br(FORMAT::parse_bbcode($question_info['question_detail'])));
TPL::assign('question_info', $question_info);
TPL::assign('question_focus', $this->model('question')->has_focus_question($question_info['question_id'], $this->user_id));
$question_topics = $this->model('topic')->get_topics_by_item_id($question_info['question_id'], 'question');
if (sizeof($question_topics) == 0 and $this->user_id) {
$related_topics = $this->model('question')->get_related_topics($question_info['question_content']);
TPL::assign('related_topics', $related_topics);
}
TPL::assign('question_topics', $question_topics);
TPL::assign('question_related_list', $this->model('question')->get_related_question_list($question_info['question_id'], $question_info['question_content']));
TPL::assign('question_related_links', $this->model('related')->get_related_links('question', $question_info['question_id']));
if ($this->user_id) {
if ($question_topics) {
foreach ($question_topics as $key => $val) {
$question_topic_ids[] = $val['topic_id'];
}
}
if ($helpful_users = $this->model('topic')->get_helpful_users_by_topic_ids($question_topic_ids, 17)) {
foreach ($helpful_users as $key => $val) {
if ($val['user_info']['uid'] == $this->user_id) {
unset($helpful_users[$key]);
} else {
$helpful_users[$key]['has_invite'] = $this->model('question')->has_question_invite($question_info['question_id'], $val['user_info']['uid'], $this->user_id);
$helpful_users[$key]['experience'] = end($helpful_users[$key]['experience']);
}
}
TPL::assign('helpful_users', $helpful_users);
}
}
$this->crumb($question_info['question_content'], '/question/' . $question_info['question_id']);
if ($_GET['column'] == 'log') {
$this->crumb(AWS_APP::lang()->_t('日志'), '/question/id-' . $question_info['question_id'] . '__column-log');
} else {
TPL::assign('human_valid', human_valid('answer_valid_hour'));
if ($this->user_id) {
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/question/id-' . $question_info['question_id'] . '__sort_key-' . $_GET['sort_key'] . '__sort-' . $_GET['sort'] . '__uid-' . $_GET['uid']), 'total_rows' => $answer_count, 'per_page' => 100))->create_links());
}
}
TPL::set_meta('keywords', implode(',', $this->model('system')->analysis_keyword($question_info['question_content'])));
TPL::set_meta('description', $question_info['question_content'] . ' - ' . cjk_substr(str_replace("\r\n", ' ', strip_tags($question_info['question_detail'])), 0, 128, 'UTF-8', '...'));
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
if (get_setting('upload_enable') == 'Y') {
// fileupload
TPL::import_js('js/fileupload.js');
}
TPL::assign('attach_access_key', md5($this->user_id . time()));
TPL::assign('redirect_message', $redirect_message);
$recommend_posts = $this->model('posts')->get_recommend_posts_by_topic_ids($question_topic_ids);
if ($recommend_posts) {
foreach ($recommend_posts as $key => $value) {
if ($value['question_id'] and $value['question_id'] == $question_info['question_id']) {
unset($recommend_posts[$key]);
break;
}
}
TPL::assign('recommend_posts', $recommend_posts);
}
// 答题选项
if (intval($question_info['quiz_id']) > 0) {
$question_quiz = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
TPL::import_js('js/quiz.js');
TPL::import_css('css/quiz.css');
TPL::import_js('js/app/question.js');
TPL::assign('question_quiz', $question_quiz);
}
TPL::output('question/index');
}
示例9: publish_action
public function publish_action()
{
if ($_GET['id']) {
if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('指定主题不存在'));
}
if (!$this->user_info['permission']['is_administortar'] and !$this->user_info['permission']['is_moderator'] and !$this->user_info['permission']['edit_question']) {
if ($question_info['published_uid'] != $this->user_id) {
H::redirect_msg(AWS_APP::lang()->_t('你没有权限编辑这个主题'), '/m/question/' . $_GET['id']);
}
}
TPL::assign('question_info', $question_info);
} else {
if (!$this->user_info['permission']['publish_question']) {
H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布主题'));
} else {
if ($this->is_post() and $_POST['question_detail']) {
TPL::assign('question_info', array('question_content' => $_POST['question_content'], 'question_detail' => $_POST['question_detail']));
$question_info['category_id'] = $_POST['category_id'];
} else {
if ($_GET['weixin_media_id']) {
$weixin_pic_url = AWS_APP::cache()->get('weixin_pic_url_' . md5(base64_decode($_GET['weixin_media_id'])));
if (!$weixin_pic_url) {
H::redirect_msg(AWS_APP::lang()->_t('图片已过期或 media_id 无效'));
}
TPL::assign('weixin_media_id', $_GET['weixin_media_id']);
TPL::assign('weixin_pic_url', $weixin_pic_url);
} else {
$draft_content = $this->model('draft')->get_data(1, 'question', $this->user_id);
TPL::assign('question_info', array('question_content' => $_POST['question_content'], 'question_detail' => $draft_content['message']));
}
}
}
}
if ($this->user_info['integral'] < 0 and get_setting('integral_system_enabled') == 'Y' and !$_GET['id']) {
H::redirect_msg(AWS_APP::lang()->_t('你的剩余积分已经不足以进行此操作'));
}
if (!$question_info['category_id'] and $_GET['category_id']) {
$question_info['category_id'] = $_GET['category_id'];
}
if (get_setting('category_enable') == 'Y') {
TPL::assign('question_category_list', $this->model('system')->build_category_html('question', 0, $question_info['category_id']));
}
if ($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'] or $question_info['published_uid'] == $this->user_id and $_GET['id'] or !$_GET['id']) {
TPL::assign('attach_access_key', md5($this->user_id . time()));
}
TPL::import_js(array('js/fileupload.js'));
TPL::assign('body_class', 'active');
TPL::assign('human_valid', human_valid('question_valid_hour'));
TPL::output('m/publish');
}
示例10: edit_action
public function edit_action()
{
if (!($topic_info = $this->model('topic')->get_topic_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('话题不存在'), '/');
}
if (!($this->user_info['permission']['is_administortar'] or $this->user_info['permission']['is_moderator'])) {
if (!$this->user_info['permission']['edit_topic']) {
H::redirect_msg(AWS_APP::lang()->_t('你没有权限进行此操作'));
} else {
if ($this->model('topic')->has_lock_topic($_GET['id'])) {
H::redirect_msg(AWS_APP::lang()->_t('已锁定的话题不能编辑'));
}
}
}
$this->crumb(AWS_APP::lang()->_t('话题编辑'), '/topic/edit/' . $topic_info['topic_id']);
$this->crumb($topic_info['topic_title'], '/topic/' . $topic_info['topic_id']);
TPL::assign('topic_info', $topic_info);
TPL::assign('related_topics', $this->model('topic')->related_topics($_GET['id']));
TPL::import_js('js/fileupload.js');
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
TPL::output('topic/edit');
}
示例11: record_action
public function record_action()
{
if (!($question_info = $this->model('question')->get_question_info_by_id($_GET['id']))) {
H::redirect_msg(AWS_APP::lang()->_t('问题不存在或已被删除'), '/question/');
}
TPL::assign('question_info', $question_info);
if ($_GET['uid']) {
if (!($user_info = $this->model('account')->get_user_info_by_uid($_GET['uid']))) {
H::redirect_msg(AWS_APP::lang()->_t('用户不存在'), '/question/' . $_GET['id']);
}
TPL::assign('quiz_user_info', $user_info);
// 获取用户在该问题下的答题记录
$user_quiz_record = $this->model('quiz')->get_question_quiz_record_by_user($question_info['question_id'], $user_info['uid'], $_GET['page'], 10);
TPL::assign('user_quiz_record', $user_quiz_record);
TPL::assign('user_quiz_record_count', $this->model('quiz')->get_question_quiz_record_user_count());
TPL::assign('user_quiz_passed', $this->model('quiz')->user_question_quiz_passed($question_info['question_id'], $user_info['uid']));
TPL::output('question/record_user');
} else {
if ($question_info['quiz_id'] > 0) {
$question_info['quiz_info'] = $this->model('quiz')->get_question_quiz_info_by_id($question_info['quiz_id']);
}
// 获取问题答题纪录及统计
$question_quiz_record = $this->model('quiz')->get_question_quiz_record_list_page($question_info['question_id'], $_GET['page'], 10);
TPL::assign('question_quiz_record', $question_quiz_record);
TPL::import_js('js/flot/jquery.flot.js');
TPL::import_js('js/flot/jquery.flot.pie.js');
TPL::import_js('js/flot/jquery.flot.resize.js');
TPL::output('question/record');
}
}
示例12: edit_action
public function edit_action()
{
$this->crumb(AWS_APP::lang()->_t('话题编辑'), 'admin/topic/edit/');
if (!($topic_info = $this->model('topic')->get_topic_by_id($_GET['topic_id']))) {
H::redirect_msg(AWS_APP::lang()->_t('话题不存在'), '/admin/topic/list/');
}
TPL::assign('topic_info', $topic_info);
TPL::assign('parent_topics', $this->model('topic')->get_parent_topics());
TPL::import_js('js/ajaxupload.js');
TPL::output('admin/topic/edit');
}
示例13: publish_action
public function publish_action()
{
if (!$this->user_info['permission']['publish_ticket']) {
H::redirect_msg(AWS_APP::lang()->_t('你所在用户组没有权限发布工单'));
}
$this->crumb(AWS_APP::lang()->_t('发布工单'), '/ticket/publish/');
TPL::assign('draft_content', $this->model('draft')->get_data(1, 'ticket', $this->user_id));
TPL::assign('attach_access_key', md5($this->user_id . time()));
TPL::assign('human_valid', human_valid('question_valid_hour'));
TPL::import_js('js/app/publish.js');
if (get_setting('advanced_editor_enable') == 'Y') {
import_editor_static_files();
}
if (get_setting('upload_enable') == 'Y') {
// fileupload
TPL::import_js('js/fileupload.js');
}
TPL::output('ticket/publish');
}
示例14: index_square_action
public function index_square_action()
{
if (!$_GET['page']) {
$_GET['page'] = 1;
}
$this->crumb(AWS_APP::lang()->_t('用户列表'), '/people/');
if ($_GET['topic_id']) {
if ($helpful_users = $this->model('topic')->get_helpful_users_by_topic_ids($this->model('topic')->get_child_topic_ids($_GET['topic_id']), get_setting('contents_per_page'), 4)) {
foreach ($helpful_users as $key => $val) {
$users_list[$key] = $val['user_info'];
$users_list[$key]['experience'] = $val['experience'];
foreach ($val['experience'] as $exp_key => $exp_val) {
$users_list[$key]['total_agree_count'] += $exp_val['agree_count'];
}
}
}
} else {
$where = array();
if ($_GET['group_id']) {
$where[] = 'group_id = ' . intval($_GET['group_id']);
}
if ($_GET['sort_type']) {
switch ($_GET['sort_type']) {
case 'passed':
$sort_key = 'question_quiz_count_passed DESC';
break;
case 'poft':
$sort_key = 'question_quiz_poft_ratio DESC';
break;
case 'question_count':
$sort_key = 'question_count DESC';
break;
case 'quiz_count':
$sort_key = 'question_quiz_count_total DESC';
break;
case 'integral':
$sort_key = 'integral DESC';
break;
default:
$sort_key = 'question_quiz_success_ratio DESC';
break;
}
} else {
$sort_key = 'question_quiz_success_ratio DESC';
}
$where[] = 'forbidden = 0 AND group_id >=4 AND group_id < 99';
$users_list = $this->model('account')->get_users_list(implode('', $where), calc_page_limit($_GET['page'], get_setting('user_rank_list_perpage')), true, false, $sort_key);
TPL::assign('pagination', AWS_APP::pagination()->initialize(array('base_url' => get_js_url('/people/sort_type-' . $_GET['sort_type'] . '__group_id-' . $_GET['group_id']), 'total_rows' => $this->model('account')->get_user_count(implode(' AND ', $where)), 'per_page' => get_setting('user_rank_list_perpage')))->create_links());
}
if ($users_list) {
foreach ($users_list as $key => $val) {
if ($val['reputation']) {
$reputation_users_ids[] = $val['uid'];
$users_reputations[$val['uid']] = $val['reputation'];
}
$uids[] = $val['uid'];
}
if (!$_GET['topic_id']) {
$reputation_topics = $this->model('people')->get_users_reputation_topic($reputation_users_ids, $users_reputations, 5);
foreach ($users_list as $key => $val) {
$users_list[$key]['reputation_topics'] = $reputation_topics[$val['uid']];
}
}
if ($uids and $this->user_id) {
$users_follow_check = $this->model('follow')->users_follow_check($this->user_id, $uids);
foreach ($users_list as $key => $val) {
$users_list[$key]['focus'] = $users_follow_check[$val['uid']];
}
}
TPL::assign('users_list', array_values($users_list));
}
if (!$_GET['group_id']) {
TPL::assign('parent_topics', $this->model('topic')->get_parent_topics());
}
TPL::assign('custom_group', $this->model('account')->get_user_group_list(0, 1));
if ($_GET['sort_type']) {
TPL::assign('sort_type', $_GET['sort_type']);
}
TPL::import_js('js/app/rank.js');
TPL::output('people/square');
}
示例15: import_editor_static_files
function import_editor_static_files()
{
TPL::import_js('js/editor/Markdown.Converter.js');
TPL::import_js('js/editor/Markdown.Sanitizer.js');
TPL::import_js('js/editor/Markdown.Editor.js');
}